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.

feat: publish GPT Voice for Mac with an interactive website

Vishesh Raheja8cbe137737f0
diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml
new file mode 100644
index 0000000..7a22198
--- /dev/null
+++ b/.github/workflows/checks.yml
@@ -0,0 +1,18 @@
+name: Check
+on:
+ push:
+ branches: [main]
+ pull_request:
+permissions:
+ contents: read
+jobs:
+ swift:
+ runs-on: macos-15
+ steps:
+ - uses: actions/checkout@v4
+ - name: Build and test
+ run: swift test
+ - name: Check release scripts
+ run: |
+ bash -n scripts/build.sh
+ python3 -m py_compile scripts/package-dmg.py
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..666e063
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,37 @@
+.build/
+/dist/
+.DS_Store
+investigation/codex-protocol/
+investigation/*evidence*.json
+investigation/opus-*.log
+investigation/opus-*.jsonl
+investigation/dictation-subset/
+investigation/protocol-slice/
+investigation/rea-evidence.json.gz
+investigation/*.wav
+investigation/*.aiff
+.local-signing-identity
+
+# Local research, captures, credentials, and build products
+.local/
+investigation/
+promo/
+.local-*
+*.dmg
+*.zip
+*.p12
+*.p8
+*.pem
+*.cer
+*.key
+.env
+.env.*
+node_modules/
+__pycache__/
+.swiftpm/
+website/.git/
+website/.sites-*/
+website/.openai/
+
+# Launch drafts remain local until the author posts them.
+marketing/
diff --git a/BUILD_NUMBER b/BUILD_NUMBER
new file mode 100644
index 0000000..b8626c4
--- /dev/null
+++ b/BUILD_NUMBER
@@ -0,0 +1 @@
+4
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..9573161
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,32 @@
+# Contributing
+
+Start an issue for a new feature or a change to sign-in or audio handling.
+Small fixes can go directly to a pull request.
+
+## Local setup
+
+1. Install Xcode Command Line Tools and Python 3 on macOS 13 or later.
+2. Clone this repository.
+3. Run `swift test`.
+4. Run `./scripts/build.sh` to create `dist/GPT Voice.app`.
+
+Use `./scripts/build.sh --install` to install your build in `~/Applications`.
+A local build uses ad hoc signing unless you select a certificate.
+Changing its signature can require new microphone and Accessibility grants.
+
+Use the same signing identity across local builds when possible.
+Set `GPT_VOICE_SIGNING_IDENTITY` or put the identity in `.local-signing-identity`.
+Do not commit certificates, keys, or credentials.
+
+## Checks
+
+- Run `swift test` after a behavior change.
+- Check the actual app in light and dark mode after a UI change.
+- Keep temporary capture files and account data out of tests and issues.
+- Explain what changed, why, and how you checked it in your pull request.
+
+The website is a static site in `website/dist`.
+Serve it with `python3 -m http.server 4173 --directory website/dist`.
+Its interactive preview uses scripted sample text. It does not access the microphone or ChatGPT.
+
+Your contribution uses the project's MIT license. Third-party assets retain their own licenses.
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..3e2efd9
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2026 Vishesh Raheja
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/Package.swift b/Package.swift
new file mode 100644
index 0000000..39e8a51
--- /dev/null
+++ b/Package.swift
@@ -0,0 +1,15 @@
+// swift-tools-version: 5.9
+import PackageDescription
+
+let package = Package(
+ name: "GPTVoice",
+ platforms: [.macOS(.v13)],
+ products: [.executable(name: "GPTVoice", targets: ["GPTVoice"])],
+ targets: [
+ .target(name: "DictationCore"),
+ .executableTarget(name: "GPTVoice", dependencies: ["DictationCore"],
+ resources: [.copy("Resources/Fonts")]),
+ .testTarget(name: "DictationCoreTests", dependencies: ["DictationCore"]),
+ .testTarget(name: "DictationAppTests", dependencies: ["GPTVoice"])
+ ]
+)
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..89bde98
--- /dev/null
+++ b/README.md
@@ -0,0 +1,95 @@
+<p align="center">
+ <picture>
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/readme-hero-dark.png">
+ <img src="docs/assets/readme-hero-light.png" alt="GPT Voice — Dictate into any app on your Mac" width="100%">
+ </picture>
+</p>
+
+<p align="center">
+ <a href="https://github.com/entropyconquers/gpt-voice/releases">Download for Mac</a> ·
+ <a href="#see-it-in-action">Watch the demo</a> ·
+ <a href="LICENSE">MIT license</a>
+</p>
+
+# GPT Voice
+
+ChatGPT transcription in a small Mac menu bar app. Press a shortcut, speak, and put the transcript into your text field.
+Use it with T3 Code, Codex CLI, your editor, or another app. It never submits the text for you.
+
+I built this after moving from the Codex app to T3 Code and missing ChatGPT's dictation workflow.
+GPT Voice uses your existing ChatGPT sign-in through Codex CLI. It needs no separate API key.
+
+> Independent project. Not affiliated with OpenAI or T3 Code. Transcription uses a private ChatGPT endpoint that can change. Access and limits can vary by account.
+
+## See it in action
+
+[![Watch the 43-second GPT Voice demo](docs/assets/video-poster.jpg)](docs/media/GPT-Voice-Promo.mp4)
+
+[Watch or download the MP4](docs/media/GPT-Voice-Promo.mp4).
+This is a staged promo with synthetic speech by [ElevenLabs](https://elevenlabs.io/), not a transcription benchmark.
+Keyboard footage: [Designed by Magnific](https://www.magnific.com/). [All media credits](THIRD_PARTY_NOTICES.md).
+
+## Install
+
+**Requirements:** macOS 13 or later, internet access, [Codex CLI](https://developers.openai.com/codex/cli/), and a ChatGPT account with access to the transcription service.
+
+1. Download the DMG from [Releases](https://github.com/entropyconquers/gpt-voice/releases).
+2. Open it. Drag **GPT Voice** to **Applications**.
+3. Open GPT Voice from Applications.
+4. Reuse your existing session, or select **Sign in with ChatGPT**.
+5. Grant microphone access. Grant Accessibility access for automatic paste, or choose manual paste.
+6. Choose a shortcut and try the practice recording.
+
+**Release status:** Developer ID signing and Apple notarization are pending. The current local build is ad hoc signed.
+It cannot offer the same first-launch experience as a notarized Mac app. See each release's signing status before downloading.
+Do not disable Gatekeeper or other macOS protections.
+
+## A small tool that stays out of the way
+
+- A configurable global shortcut. The default is **Control–Option–Space**.
+- A compact recording pill with input level, elapsed time, cancel and stop.
+- Automatic paste, or **Command–V** for manual paste.
+- 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.
+
+The app keeps the last transcript in memory for recovery until you quit.
+Audio goes to ChatGPT for transcription. This is not an offline tool. [Read the privacy notes](docs/PRIVACY.md).
+
+## Build from source
+
+Install Xcode Command Line Tools and Python 3, then run:
+
+```sh
+git clone https://github.com/entropyconquers/gpt-voice.git
+cd gpt-voice
+swift test
+./scripts/build.sh --install
+```
+
+The app appears in `~/Applications/GPT Voice.app`.
+To build both Apple Silicon and Intel support, run `./scripts/build.sh --universal`.
+Local builds use ad hoc signing by default. Keep a stable certificate across updates if you need persistent permission grants.
+[Build and release details](docs/RELEASING.md).
+
+## Questions
+
+**Do I need an API key?** No. GPT Voice reuses the file-backed ChatGPT session from Codex CLI.
+
+**Does it work with every ChatGPT subscription?** This is not verified. The private endpoint can restrict access or change behavior.
+
+**Does ChatGPT need to be running?** No. Codex CLI supplies the shared session.
+
+**Does it work offline?** No. Audio is sent to ChatGPT.
+
+**Can I use Command–Space?** Yes, if Spotlight and other apps release that shortcut. The app checks conflicts before saving it.
+
+**Why does Accessibility still show as missing?** A changed local signature can invalidate an old grant. See [troubleshooting](docs/TROUBLESHOOTING.md).
+
+## Project
+
+[How it works](docs/ARCHITECTURE.md) · [Contributing](CONTRIBUTING.md) · [Security](SECURITY.md) · [Privacy](docs/PRIVACY.md)
+
+The app code is [MIT licensed](LICENSE). Third-party assets keep their original terms.
+ChatGPT and OpenAI are trademarks of OpenAI. T3 Code belongs to its respective owners.
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 0000000..c087d7b
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,16 @@
+# Security
+
+Do not include account tokens, audio, transcripts, or `~/.codex/auth.json` in an issue.
+Use [GitHub private vulnerability reporting](https://github.com/entropyconquers/gpt-voice/security/advisories/new) for a security report.
+
+GPT Voice reads the ChatGPT session that Codex CLI stores on your Mac.
+It sends audio only to `https://chatgpt.com/backend-api/transcribe`.
+The HTTP client rejects redirects so credentials do not follow another host.
+The app does not receive your ChatGPT password.
+
+Accessibility is optional. It permits the app to send Command–V to the selected app.
+GPT Voice does not press Return or submit your text.
+Review the transcript before you submit it.
+
+The transcription endpoint is private and unsupported for this third-party app.
+Access or behavior can change without notice.
diff --git a/Sources/DictationCore/CodexAuthentication.swift b/Sources/DictationCore/CodexAuthentication.swift
new file mode 100644
index 0000000..40168a8
--- /dev/null
+++ b/Sources/DictationCore/CodexAuthentication.swift
@@ -0,0 +1,68 @@
+import Foundation
+
+public enum CodexAuthentication {
+ public static var cliAvailable: Bool { CodexTokenRefresh.executable != nil }
+
+ public static func refresh() async throws -> CodexCredentials {
+ try await CodexTokenRefresh.refresh()
+ }
+
+ public static func signIn(openURL: @escaping (URL) async -> Void) async throws {
+ guard let executable = CodexTokenRefresh.executable else { throw DictationError.refreshUnavailable }
+ let process = Process()
+ process.executableURL = executable
+ process.arguments = ["app-server", "--stdio"]
+ process.currentDirectoryURL = FileManager.default.homeDirectoryForCurrentUser
+ let input = Pipe()
+ let output = Pipe()
+ process.standardInput = input
+ process.standardOutput = output
+ process.standardError = FileHandle.nullDevice
+ func send(_ object: [String: Any]) throws {
+ var data = try JSONSerialization.data(withJSONObject: object)
+ data.append(0x0a)
+ try input.fileHandleForWriting.write(contentsOf: data)
+ }
+ try process.run()
+ let timeout = Task {
+ try await Task.sleep(nanoseconds: 600_000_000_000)
+ if process.isRunning { process.terminate() }
+ }
+ defer {
+ timeout.cancel()
+ try? input.fileHandleForWriting.close()
+ if process.isRunning { process.terminate() }
+ }
+ try await withTaskCancellationHandler {
+ try send(["id": 1, "method": "initialize", "params": [
+ "clientInfo": ["name": "codex_dictation", "version": "0.1.0"],
+ "capabilities": ["experimentalApi": true]
+ ]])
+ for try await line in output.fileHandleForReading.bytes.lines {
+ try Task.checkCancellation()
+ guard let data = line.data(using: .utf8),
+ let message = try? JSONSerialization.jsonObject(with: data) as? [String: Any] else { continue }
+ if message["error"] != nil { throw DictationError.signInFailed }
+ if message["id"] as? Int == 1 {
+ try send(["method": "initialized"])
+ try send(["id": 2, "method": "account/login/start", "params": ["type": "chatgpt"]])
+ } else if message["id"] as? Int == 2 {
+ guard let result = message["result"] as? [String: Any],
+ let address = result["authUrl"] as? String,
+ let url = URL(string: address), url.scheme == "https",
+ ["auth.openai.com", "auth.chatgpt.com", "chatgpt.com"].contains(url.host ?? "") else {
+ throw DictationError.signInFailed
+ }
+ await openURL(url)
+ } else if message["method"] as? String == "account/login/completed" {
+ guard let params = message["params"] as? [String: Any],
+ params["success"] as? Bool == true else { throw DictationError.signInFailed }
+ return
+ }
+ }
+ throw DictationError.signInFailed
+ } onCancel: {
+ if process.isRunning { process.terminate() }
+ }
+ }
+}
diff --git a/Sources/DictationCore/CodexCredentials.swift b/Sources/DictationCore/CodexCredentials.swift
new file mode 100644
index 0000000..2275071
--- /dev/null
+++ b/Sources/DictationCore/CodexCredentials.swift
@@ -0,0 +1,49 @@
+import Foundation
+
+public struct CodexCredentials: Sendable {
+ let accessToken: String
+ let accountID: String
+ let expiresAt: Date?
+
+ public var needsRefresh: Bool {
+ expiresAt.map { $0.timeIntervalSinceNow < 60 } ?? false
+ }
+
+ public static var authFile: URL {
+ let environment = ProcessInfo.processInfo.environment
+ let directory = environment["CODEX_HOME"].map { URL(fileURLWithPath: $0) }
+ ?? FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent(".codex")
+ return directory.appendingPathComponent("auth.json")
+ }
+
+ public static func load(from file: URL = authFile) throws -> CodexCredentials {
+ guard FileManager.default.fileExists(atPath: file.path) else { throw DictationError.signInRequired }
+ guard let data = try? Data(contentsOf: file) else { throw DictationError.invalidCredentials }
+ return try decode(data)
+ }
+
+ static func decode(_ data: Data) throws -> CodexCredentials {
+ guard let auth = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
+ auth["auth_mode"] as? String == "chatgpt",
+ let tokens = auth["tokens"] as? [String: Any],
+ let token = tokens["access_token"] as? String,
+ let account = tokens["account_id"] as? String,
+ !token.isEmpty, !account.isEmpty else { throw DictationError.signInRequired }
+ return from(token: token, accountID: account)
+ }
+
+ static func from(token: String, accountID: String) -> CodexCredentials {
+ let payload = jwtPayload(token)
+ let expiresAt = (payload?["exp"] as? Double).map { Date(timeIntervalSince1970: $0) }
+ return CodexCredentials(accessToken: token, accountID: accountID, expiresAt: expiresAt)
+ }
+
+ static func jwtPayload(_ token: String) -> [String: Any]? {
+ let parts = token.split(separator: ".", omittingEmptySubsequences: false)
+ guard parts.count == 3 else { return nil }
+ var base64 = String(parts[1]).replacingOccurrences(of: "-", with: "+").replacingOccurrences(of: "_", with: "/")
+ base64 += String(repeating: "=", count: (4 - base64.count % 4) % 4)
+ guard let data = Data(base64Encoded: base64) else { return nil }
+ return (try? JSONSerialization.jsonObject(with: data)) as? [String: Any]
+ }
+}
diff --git a/Sources/DictationCore/CodexTokenRefresh.swift b/Sources/DictationCore/CodexTokenRefresh.swift
new file mode 100644
index 0000000..32bc85e
--- /dev/null
+++ b/Sources/DictationCore/CodexTokenRefresh.swift
@@ -0,0 +1,69 @@
+import Foundation
+
+struct CodexTokenRefresh {
+ static var executable: URL? {
+ let searchPath = ProcessInfo.processInfo.environment["PATH"] ?? ""
+ let environmentPaths = searchPath.split(separator: ":").filter { $0.hasPrefix("/") }
+ .map { URL(fileURLWithPath: String($0)).appendingPathComponent("codex").path }
+ let paths = ["/opt/homebrew/bin/codex", "/usr/local/bin/codex",
+ FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent(".local/bin/codex").path]
+ + environmentPaths
+ return paths.first { FileManager.default.isExecutableFile(atPath: $0) }.map { URL(fileURLWithPath: $0) }
+ }
+
+ static func refresh() async throws -> CodexCredentials {
+ guard let executable else { throw DictationError.refreshUnavailable }
+ let process = Process()
+ process.executableURL = executable
+ process.arguments = ["app-server", "--stdio"]
+ let input = Pipe()
+ let output = Pipe()
+ process.standardInput = input
+ process.standardOutput = output
+ process.standardError = FileHandle.nullDevice
+ process.currentDirectoryURL = FileManager.default.homeDirectoryForCurrentUser
+ func send(_ object: [String: Any]) throws {
+ var data = try JSONSerialization.data(withJSONObject: object)
+ data.append(0x0a)
+ try input.fileHandleForWriting.write(contentsOf: data)
+ }
+ try process.run()
+ let timeout = Task {
+ try await Task.sleep(nanoseconds: 30_000_000_000)
+ if process.isRunning { process.terminate() }
+ }
+ defer {
+ timeout.cancel()
+ try? input.fileHandleForWriting.close()
+ if process.isRunning { process.terminate() }
+ }
+ try send(["id": 1, "method": "initialize", "params": [
+ "clientInfo": ["name": "codex_dictation", "version": "0.1.0"],
+ "capabilities": ["experimentalApi": true]
+ ]])
+ return try await withTaskCancellationHandler {
+ for try await line in output.fileHandleForReading.bytes.lines {
+ try Task.checkCancellation()
+ guard let data = line.data(using: .utf8),
+ let message = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
+ let id = message["id"] as? Int else { continue }
+ if message["error"] != nil { throw DictationError.refreshFailed }
+ if id == 1 {
+ try send(["method": "initialized"])
+ try send(["id": 2, "method": "getAuthStatus", "params": ["includeToken": true, "refreshToken": true]])
+ } else if id == 2 {
+ guard let result = message["result"] as? [String: Any],
+ result["authMethod"] as? String == "chatgpt",
+ let token = result["authToken"] as? String, !token.isEmpty,
+ let claims = CodexCredentials.jwtPayload(token),
+ let auth = claims["https://api.openai.com/auth"] as? [String: Any],
+ let accountID = auth["chatgpt_account_id"] as? String else { throw DictationError.refreshFailed }
+ return CodexCredentials.from(token: token, accountID: accountID)
+ }
+ }
+ throw DictationError.refreshFailed
+ } onCancel: {
+ if process.isRunning { process.terminate() }
+ }
+ }
+}
diff --git a/Sources/DictationCore/DictationError.swift b/Sources/DictationCore/DictationError.swift
new file mode 100644
index 0000000..f9ec667
--- /dev/null
+++ b/Sources/DictationCore/DictationError.swift
@@ -0,0 +1,32 @@
+import Foundation
+
+public enum DictationError: LocalizedError {
+ case signInRequired
+ case invalidCredentials
+ case refreshUnavailable
+ case refreshFailed
+ case signInFailed
+ case invalidAudio
+ case audioTooLarge
+ case service(Int)
+ case invalidResponse
+ case emptyTranscript
+
+ public var errorDescription: String? {
+ switch self {
+ case .signInRequired: return "Sign in with ChatGPT in Codex CLI. Run: codex login"
+ case .invalidCredentials: return "Codex sign-in data could not be read. Run: codex login"
+ case .refreshUnavailable: return "Install Codex CLI to renew your ChatGPT sign-in."
+ case .refreshFailed: return "Your ChatGPT sign-in could not be renewed. Run: codex login"
+ case .signInFailed: return "ChatGPT sign-in did not finish. Select Sign in with ChatGPT to try again."
+ case .invalidAudio: return "Choose a WAV, M4A, MP3, MP4, WebM, Ogg, or FLAC audio file."
+ case .audioTooLarge: return "This app accepts recordings smaller than 20 MB."
+ case .service(401): return "Your ChatGPT sign-in expired. Run: codex login"
+ case .service(403): return "ChatGPT denied this dictation request for your account."
+ case .service(429): return "ChatGPT reached a request limit. Try again later."
+ case .service(let code): return "ChatGPT could not transcribe this recording (HTTP \(code))."
+ case .invalidResponse: return "ChatGPT returned an unreadable transcript."
+ case .emptyTranscript: return "No speech was found. Try another recording."
+ }
+ }
+}
diff --git a/Sources/DictationCore/MultipartAudio.swift b/Sources/DictationCore/MultipartAudio.swift
new file mode 100644
index 0000000..c771fd1
--- /dev/null
+++ b/Sources/DictationCore/MultipartAudio.swift
@@ -0,0 +1,25 @@
+import Foundation
+
+struct MultipartAudio {
+ let boundary: String
+ let body: Data
+
+ init(audio: Data, filename: String, contentType: String, language: String? = nil,
+ boundary: String = "----codex-dictation-\(UUID().uuidString)") {
+ self.boundary = boundary
+ var result = Data()
+ func append(_ value: String) { result.append(Data(value.utf8)) }
+ let name = filename.replacingOccurrences(of: "\"", with: "")
+ .replacingOccurrences(of: "\r", with: "").replacingOccurrences(of: "\n", with: "")
+ append("--\(boundary)\r\n")
+ append("Content-Disposition: form-data; name=\"file\"; filename=\"\(name)\"\r\n")
+ append("Content-Type: \(contentType)\r\n\r\n")
+ result.append(audio)
+ append("\r\n")
+ if let language, !language.isEmpty {
+ append("--\(boundary)\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n\(language)\r\n")
+ }
+ append("--\(boundary)--\r\n")
+ body = result
+ }
+}
diff --git a/Sources/DictationCore/NoRedirectDelegate.swift b/Sources/DictationCore/NoRedirectDelegate.swift
new file mode 100644
index 0000000..46e387e
--- /dev/null
+++ b/Sources/DictationCore/NoRedirectDelegate.swift
@@ -0,0 +1,10 @@
+import Foundation
+
+final class NoRedirectDelegate: NSObject, URLSessionTaskDelegate {
+ func urlSession(_ session: URLSession, task: URLSessionTask,
+ willPerformHTTPRedirection response: HTTPURLResponse,
+ newRequest request: URLRequest,
+ completionHandler: @escaping (URLRequest?) -> Void) {
+ completionHandler(nil)
+ }
+}
diff --git a/Sources/DictationCore/TranscriptText.swift b/Sources/DictationCore/TranscriptText.swift
new file mode 100644
index 0000000..59f9c68
--- /dev/null
+++ b/Sources/DictationCore/TranscriptText.swift
@@ -0,0 +1,11 @@
+import Foundation
+
+public enum TranscriptText {
+ public static func forAutomaticPaste(_ text: String) -> String {
+ let separators = CharacterSet.controlCharacters.union(.newlines)
+ return text.components(separatedBy: separators)
+ .filter { !$0.isEmpty }
+ .joined(separator: " ")
+ .trimmingCharacters(in: .whitespacesAndNewlines)
+ }
+}
diff --git a/Sources/DictationCore/TranscriptionClient.swift b/Sources/DictationCore/TranscriptionClient.swift
new file mode 100644
index 0000000..58aa7b7
--- /dev/null
+++ b/Sources/DictationCore/TranscriptionClient.swift
@@ -0,0 +1,54 @@
+import Foundation
+
+public final class TranscriptionClient {
+ static let endpoint = URL(string: "https://chatgpt.com/backend-api/transcribe")!
+ private let session: URLSession
+
+ public init() {
+ let configuration = URLSessionConfiguration.ephemeral
+ configuration.timeoutIntervalForRequest = 90
+ configuration.timeoutIntervalForResource = 110
+ configuration.httpShouldSetCookies = false
+ session = URLSession(configuration: configuration, delegate: NoRedirectDelegate(), delegateQueue: nil)
+ }
+
+ init(session: URLSession) { self.session = session }
+
+ public func transcribe(file: URL, language: String? = nil) async throws -> String {
+ let types = ["wav": "audio/wav", "m4a": "audio/mp4", "mp4": "audio/mp4", "mp3": "audio/mpeg",
+ "webm": "audio/webm", "ogg": "audio/ogg", "flac": "audio/flac"]
+ guard let contentType = types[file.pathExtension.lowercased()] else { throw DictationError.invalidAudio }
+ let attributes = try FileManager.default.attributesOfItem(atPath: file.path)
+ guard let size = attributes[.size] as? NSNumber, size.intValue > 0 else { throw DictationError.invalidAudio }
+ guard size.intValue < 20_000_000 else { throw DictationError.audioTooLarge }
+ let audio = try Data(contentsOf: file)
+ let multipart = MultipartAudio(audio: audio, filename: "dictation.\(file.pathExtension.lowercased())",
+ contentType: contentType, language: language)
+ let current = try CodexCredentials.load()
+ let credentials = current.needsRefresh ? try await CodexTokenRefresh.refresh() : current
+ do {
+ return try await request(multipart, credentials: credentials)
+ } catch DictationError.service(401) {
+ try Task.checkCancellation()
+ return try await request(multipart, credentials: CodexTokenRefresh.refresh())
+ }
+ }
+
+ func request(_ multipart: MultipartAudio, credentials: CodexCredentials) async throws -> String {
+ var request = URLRequest(url: Self.endpoint)
+ request.httpMethod = "POST"
+ request.setValue("Bearer \(credentials.accessToken)", forHTTPHeaderField: "Authorization")
+ request.setValue(credentials.accountID, forHTTPHeaderField: "ChatGPT-Account-Id")
+ request.setValue("multipart/form-data; boundary=\(multipart.boundary)", forHTTPHeaderField: "Content-Type")
+ request.setValue("GPTVoice", forHTTPHeaderField: "User-Agent")
+ request.setValue("codex_dictation", forHTTPHeaderField: "originator")
+ request.httpBody = multipart.body
+ let (data, response) = try await session.data(for: request)
+ guard let response = response as? HTTPURLResponse else { throw DictationError.invalidResponse }
+ guard response.statusCode == 200 else { throw DictationError.service(response.statusCode) }
+ guard let object = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
+ let text = object["text"] as? String else { throw DictationError.invalidResponse }
+ guard !text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { throw DictationError.emptyTranscript }
+ return text
+ }
+}
diff --git a/Sources/GPTVoice/AboutSection.swift b/Sources/GPTVoice/AboutSection.swift
new file mode 100644
index 0000000..b78b24b
--- /dev/null
+++ b/Sources/GPTVoice/AboutSection.swift
@@ -0,0 +1,22 @@
+import AppKit
+import SwiftUI
+
+/// Version and documentation link, shown at the bottom of Privacy.
+struct AboutSection: View {
+ private var version: String {
+ let info = Bundle.main.infoDictionary
+ guard let short = info?["CFBundleShortVersionString"] as? String else { return "Development build" }
+ return "Version \(short)"
+ }
+
+ var body: some View {
+ HStack(spacing: 10) {
+ WaveMark(size: 18)
+ Text("GPT Voice").font(AppType.brand)
+ Text(version).font(AppType.detail).foregroundStyle(.secondary)
+ Spacer(minLength: 12)
+ Button("Codex CLI documentation") { NSWorkspace.shared.open(AppModel.installCodexURL) }
+ .buttonStyle(AppButtonStyle(kind: .quiet, showsArrow: true, small: true))
+ }
+ }
+}
diff --git a/Sources/GPTVoice/AccentChoice.swift b/Sources/GPTVoice/AccentChoice.swift
new file mode 100644
index 0000000..faffcbf
--- /dev/null
+++ b/Sources/GPTVoice/AccentChoice.swift
@@ -0,0 +1,75 @@
+import AppKit
+import SwiftUI
+
+/// Accent choices. The accent marks selection and the main action. It never means error.
+/// The stored value `system` is kept for saved preferences and now shows Graphite:
+/// a near-black fill in light mode and a near-white fill in dark mode.
+enum AccentChoice: String, CaseIterable, Identifiable {
+ case system
+ case blue
+ case violet
+ case rose
+ case amber
+ case green
+ case teal
+
+ var id: String { rawValue }
+
+ var title: String {
+ switch self {
+ case .system: return "Graphite"
+ case .blue: return "Blue"
+ case .violet: return "Violet"
+ case .rose: return "Rose"
+ case .amber: return "Amber"
+ case .green: return "Green"
+ case .teal: return "Teal"
+ }
+ }
+
+ /// Fill role for AppKit painting.
+ var nsColor: NSColor {
+ switch self {
+ case .system: return AppPalette.dynamicNS(light: 0x1C1C1E, dark: 0xECECEC)
+ case .blue: return NSColor(srgbRed: 0.145, green: 0.388, blue: 0.922, alpha: 1) // #2563EB
+ case .violet: return NSColor(srgbRed: 0.486, green: 0.227, blue: 0.929, alpha: 1) // #7C3AED
+ case .rose: return NSColor(srgbRed: 0.882, green: 0.114, blue: 0.282, alpha: 1) // #E11D48
+ case .amber: return NSColor(srgbRed: 0.706, green: 0.325, blue: 0.035, alpha: 1) // #B45309
+ case .green: return NSColor(srgbRed: 0.082, green: 0.502, blue: 0.239, alpha: 1) // #15803D
+ case .teal: return NSColor(srgbRed: 0.059, green: 0.463, blue: 0.431, alpha: 1) // #0F766E
+ }
+ }
+
+ /// Fill role: primary buttons, switch tracks, selected swatch, stop button.
+ var color: Color { Color(nsColor: nsColor) }
+
+ /// Text and symbols placed on the fill.
+ var onFill: Color {
+ self == .system ? AppPalette.dynamic(light: 0xFFFFFF, dark: 0x1C1C1E) : .white
+ }
+
+ /// Foreground role: small selected icons and meter bars on app surfaces.
+ var foreground: Color {
+ if self == .system { return AppPalette.dynamic(light: 0x1C1C1E, dark: 0xECECEC) }
+ let light = nsColor
+ let dark = darkForeground
+ return Color(nsColor: NSColor(name: nil) { appearance in
+ appearance.bestMatch(from: [.aqua, .darkAqua]) == .darkAqua ? dark : light
+ })
+ }
+
+ private var darkForeground: NSColor {
+ switch self {
+ case .system: return AppPalette.dynamicNS(light: 0xECECEC, dark: 0xECECEC)
+ case .blue: return NSColor(srgbRed: 0.376, green: 0.647, blue: 0.980, alpha: 1) // #60A5FA
+ case .violet: return NSColor(srgbRed: 0.655, green: 0.545, blue: 0.980, alpha: 1) // #A78BFA
+ case .rose: return NSColor(srgbRed: 0.984, green: 0.443, blue: 0.522, alpha: 1) // #FB7185
+ case .amber: return NSColor(srgbRed: 0.984, green: 0.749, blue: 0.141, alpha: 1) // #FBBF24
+ case .green: return NSColor(srgbRed: 0.290, green: 0.871, blue: 0.502, alpha: 1) // #4ADE80
+ case .teal: return NSColor(srgbRed: 0.176, green: 0.831, blue: 0.749, alpha: 1) // #2DD4BF
+ }
+ }
+
+ /// Tint for the few remaining system controls, such as progress spinners. Graphite keeps the system tint.
+ var tint: Color? { self == .system ? nil : color }
+}
diff --git a/Sources/GPTVoice/AccentSwatchPicker.swift b/Sources/GPTVoice/AccentSwatchPicker.swift
new file mode 100644
index 0000000..cfca515
--- /dev/null
+++ b/Sources/GPTVoice/AccentSwatchPicker.swift
@@ -0,0 +1,47 @@
+import AppKit
+import SwiftUI
+
+/// Accent swatches. Each is a focusable button with a name, and a check plus ring when selected.
+struct AccentSwatchPicker: View {
+ @Binding var selection: AccentChoice
+ @FocusState private var focused: AccentChoice?
+
+ var body: some View {
+ HStack(spacing: 6) {
+ ForEach(AccentChoice.allCases) { choice in
+ Button {
+ selection = choice
+ } label: {
+ swatch(choice)
+ }
+ .buttonStyle(PressScaleButtonStyle())
+ .focused($focused, equals: choice)
+ .modifier(KeyboardFocusRing(isFocused: focused == choice, shape: Circle()))
+ .help(choice.title)
+ .accessibilityLabel("\(choice.title) accent")
+ .accessibilityValue(choice == selection ? "Selected" : "")
+ .accessibilityAddTraits(choice == selection ? .isSelected : [])
+ }
+ }
+ }
+
+ private func swatch(_ choice: AccentChoice) -> some View {
+ let selected = choice == selection
+ return ZStack {
+ Circle()
+ .strokeBorder(selected ? Color.primary.opacity(0.45) : Color.clear, lineWidth: 1.5)
+ .frame(width: 26, height: 26)
+ Circle()
+ .fill(choice.color)
+ .frame(width: 18, height: 18)
+ .overlay(Circle().strokeBorder(AppPalette.hairline))
+ if selected {
+ Image(systemName: "checkmark")
+ .font(.system(size: 8, weight: .bold))
+ .foregroundStyle(choice.onFill)
+ }
+ }
+ .frame(width: 26, height: 26)
+ .contentShape(Circle())
+ }
+}
diff --git a/Sources/GPTVoice/AccessibilityCard.swift b/Sources/GPTVoice/AccessibilityCard.swift
new file mode 100644
index 0000000..5f05a46
--- /dev/null
+++ b/Sources/GPTVoice/AccessibilityCard.swift
@@ -0,0 +1,53 @@
+import SwiftUI
+
+/// Accessibility row for automatic paste. Optional, so it never uses a warning tone.
+struct AccessibilityCard: View {
+ @ObservedObject var model: AppModel
+ @ObservedObject var preferences: AppPreferences
+ var offersManualPaste = false
+
+ init(model: AppModel, offersManualPaste: Bool = false) {
+ self.model = model
+ self.preferences = model.preferences
+ self.offersManualPaste = offersManualPaste
+ }
+
+ var body: some View {
+ if model.accessibilityTrusted {
+ StatusRow(tone: .good, symbol: "checkmark.circle.fill", title: "Accessibility",
+ detail: preferences.automaticPaste ? "" : "Automatic paste is off.", value: "Allowed") {
+ if !preferences.automaticPaste {
+ Button("Turn on paste") { model.setAutomaticPaste(true) }
+ .buttonStyle(AppButtonStyle(kind: .secondary, small: true))
+ }
+ }
+ } else if !preferences.automaticPaste {
+ StatusRow(tone: .neutral, symbol: "doc.on.clipboard", title: "Manual paste",
+ detail: "Text is copied. You press ⌘V.") {
+ Button("Use automatic paste") { model.setAutomaticPaste(true) }
+ .buttonStyle(AppButtonStyle(kind: .quiet, small: true))
+ }
+ } else {
+ VStack(alignment: .leading, spacing: 0) {
+ StatusRow(tone: .neutral, symbol: "circle.dashed", title: "Accessibility",
+ detail: "Optional. Lets the app paste for you.") {
+ Button("Allow") { model.requestAccessibility() }
+ .buttonStyle(AppButtonStyle(kind: .secondary, small: true))
+ .accessibilityLabel("Allow Accessibility")
+ Button("Open Settings") { model.openAccessibilitySettings() }
+ .buttonStyle(AppButtonStyle(kind: .quiet, small: true))
+ .accessibilityLabel("Open Accessibility settings")
+ QuietIconButton(symbol: "arrow.clockwise", label: "Check Accessibility again") {
+ model.refreshStatus()
+ }
+ }
+ if offersManualPaste {
+ Button("Skip and use manual paste") { model.setAutomaticPaste(false) }
+ .buttonStyle(AppButtonStyle(kind: .quiet, small: true))
+ .padding(.leading, 16)
+ .padding(.bottom, 10)
+ }
+ }
+ }
+ }
+}
diff --git a/Sources/GPTVoice/ActivityIndicator.swift b/Sources/GPTVoice/ActivityIndicator.swift
new file mode 100644
index 0000000..038d761
--- /dev/null
+++ b/Sources/GPTVoice/ActivityIndicator.swift
@@ -0,0 +1,20 @@
+import SwiftUI
+
+/// Small in-progress ring drawn in the secondary label color, so it reads on light and dark surfaces.
+/// It spins only while shown. Under Reduce Motion it stays still, and the adjacent label carries the state.
+struct ActivityIndicator: View {
+ var size: CGFloat = 12
+ @State private var spinning = false
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+
+ var body: some View {
+ Circle()
+ .trim(from: 0, to: 0.72)
+ .stroke(Color.secondary, style: StrokeStyle(lineWidth: 1.6, lineCap: .round))
+ .frame(width: size, height: size)
+ .rotationEffect(.degrees(spinning ? 360 : 0))
+ .animation(reduceMotion ? nil : .linear(duration: 0.9).repeatForever(autoreverses: false), value: spinning)
+ .onAppear { spinning = !reduceMotion }
+ .accessibilityHidden(true)
+ }
+}
diff --git a/Sources/GPTVoice/AppAccentFillKey.swift b/Sources/GPTVoice/AppAccentFillKey.swift
new file mode 100644
index 0000000..674ab91
--- /dev/null
+++ b/Sources/GPTVoice/AppAccentFillKey.swift
@@ -0,0 +1,6 @@
+import SwiftUI
+
+/// Environment key for the accent fill role: backgrounds behind white content.
+struct AppAccentFillKey: EnvironmentKey {
+ static let defaultValue: Color = .accentColor
+}
diff --git a/Sources/GPTVoice/AppAccentKey.swift b/Sources/GPTVoice/AppAccentKey.swift
new file mode 100644
index 0000000..c71fe80
--- /dev/null
+++ b/Sources/GPTVoice/AppAccentKey.swift
@@ -0,0 +1,6 @@
+import SwiftUI
+
+/// Environment key for the selected accent color.
+struct AppAccentKey: EnvironmentKey {
+ static let defaultValue: Color = .accentColor
+}
diff --git a/Sources/GPTVoice/AppAccentOnFillKey.swift b/Sources/GPTVoice/AppAccentOnFillKey.swift
new file mode 100644
index 0000000..65592dd
--- /dev/null
+++ b/Sources/GPTVoice/AppAccentOnFillKey.swift
@@ -0,0 +1,6 @@
+import SwiftUI
+
+/// Environment key for text and symbols drawn on the accent fill.
+struct AppAccentOnFillKey: EnvironmentKey {
+ static let defaultValue: Color = .white
+}
diff --git a/Sources/GPTVoice/AppButtonLabel.swift b/Sources/GPTVoice/AppButtonLabel.swift
new file mode 100644
index 0000000..020ce4c
--- /dev/null
+++ b/Sources/GPTVoice/AppButtonLabel.swift
@@ -0,0 +1,75 @@
+import AppKit
+import SwiftUI
+
+/// Rendering for `AppButtonStyle`: default, hover, press, focus, loading, and disabled states.
+struct AppButtonLabel: View {
+ let configuration: ButtonStyle.Configuration
+ let style: AppButtonStyle
+
+ @State private var hovering = false
+ @Environment(\.isEnabled) private var isEnabled
+ @Environment(\.isFocused) private var isFocused
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+ @Environment(\.appAccentFill) private var accentFill
+ @Environment(\.appAccentOnFill) private var onAccent
+
+ private var height: CGFloat { style.small ? 28 : 36 }
+ private static let radius: CGFloat = 10
+
+ var body: some View {
+ HStack(spacing: 6) {
+ if style.isLoading {
+ ProgressView()
+ .controlSize(.small)
+ .scaleEffect(0.7)
+ .frame(width: 12, height: 12)
+ .accessibilityHidden(true)
+ }
+ configuration.label
+ .font(style.small ? AppType.controlSmall : AppType.control)
+ .lineLimit(1)
+ if style.showsArrow {
+ Image(systemName: "arrow.right")
+ .font(.system(size: style.small ? 10 : 11, weight: .medium))
+ .accessibilityHidden(true)
+ }
+ }
+ .foregroundStyle(foreground)
+ .padding(.horizontal, style.kind == .quiet ? 10 : (style.small ? 12 : 16))
+ .frame(minHeight: height)
+ .frame(maxWidth: style.fullWidth ? .infinity : nil)
+ .background(RoundedRectangle(cornerRadius: Self.radius, style: .continuous).fill(background))
+ .overlay(RoundedRectangle(cornerRadius: Self.radius, style: .continuous)
+ .strokeBorder(style.kind == .secondary ? AppPalette.hairline : .clear))
+ .overlay(
+ RoundedRectangle(cornerRadius: Self.radius + 3, style: .continuous)
+ .strokeBorder(Color(nsColor: .keyboardFocusIndicatorColor), lineWidth: 2)
+ .padding(-3)
+ .opacity(isFocused ? 1 : 0)
+ )
+ .contentShape(RoundedRectangle(cornerRadius: Self.radius, style: .continuous))
+ .opacity(isEnabled ? 1 : 0.4)
+ .scaleEffect(configuration.isPressed && !reduceMotion ? 0.98 : 1)
+ .animation(AppMotion.control(reduceMotion), value: configuration.isPressed)
+ .animation(AppMotion.control(reduceMotion), value: hovering)
+ .onHover { hovering = $0 }
+ }
+
+ private var foreground: Color {
+ switch style.kind {
+ case .primary: return onAccent
+ case .secondary, .quiet: return .primary
+ case .destructive: return AppPalette.problem
+ }
+ }
+
+ private var background: Color {
+ let lift = hovering && isEnabled
+ switch style.kind {
+ case .primary: return accentFill.opacity(configuration.isPressed ? 0.8 : (lift ? 0.9 : 1))
+ case .secondary: return lift ? AppPalette.well : AppPalette.surface
+ case .quiet: return lift ? AppPalette.well : .clear
+ case .destructive: return AppPalette.problemSoft.opacity(lift ? 1 : 0.75)
+ }
+ }
+}
diff --git a/Sources/GPTVoice/AppButtonStyle.swift b/Sources/GPTVoice/AppButtonStyle.swift
new file mode 100644
index 0000000..08f6f55
--- /dev/null
+++ b/Sources/GPTVoice/AppButtonStyle.swift
@@ -0,0 +1,26 @@
+import SwiftUI
+
+/// Rounded-rectangle buttons (radius 10). Native `Button` semantics, keyboard activation, and focus stay intact.
+struct AppButtonStyle: ButtonStyle {
+ enum Kind {
+ /// One per view. Accent fill.
+ case primary
+ /// Surface fill with a hairline.
+ case secondary
+ /// Text only until hovered.
+ case quiet
+ /// Problem-colored, for actions that stop or remove something.
+ case destructive
+ }
+
+ var kind: Kind = .secondary
+ var isLoading = false
+ /// Adds a small plain arrow after the label, for navigation.
+ var showsArrow = false
+ var small = false
+ var fullWidth = false
+
+ func makeBody(configuration: Configuration) -> some View {
+ AppButtonLabel(configuration: configuration, style: self)
+ }
+}
diff --git a/Sources/GPTVoice/AppDelegate.swift b/Sources/GPTVoice/AppDelegate.swift
new file mode 100644
index 0000000..9d52c41
--- /dev/null
+++ b/Sources/GPTVoice/AppDelegate.swift
@@ -0,0 +1,90 @@
+import AppKit
+
+@MainActor
+final class AppDelegate: NSObject, NSApplicationDelegate {
+ private let options: LaunchOptions
+ private let model: AppModel
+ private let windows: WindowCoordinator
+ private var statusMenu: StatusMenuController?
+ private var panel: DictationPanelController?
+ private var appearance: AppearanceController?
+ private var verificationTrace: VerificationTrace?
+ private var observers: [NSObjectProtocol] = []
+
+ init(options: LaunchOptions) {
+ self.options = options
+ model = AppModel()
+ windows = WindowCoordinator(model: model)
+ super.init()
+ }
+
+ func applicationDidFinishLaunching(_ notification: Notification) {
+ NSApp.setActivationPolicy(.accessory)
+ NSApp.mainMenu = MainMenuBuilder.make()
+ appearance = AppearanceController(preferences: model.preferences)
+ statusMenu = StatusMenuController(model: model, windows: windows)
+ panel = DictationPanelController(model: model)
+ model.activate()
+ model.refreshStatus()
+ observeOtherLaunches()
+
+ switch options {
+ case .showOnboarding:
+ windows.showOnboarding()
+ case .showSettings:
+ windows.showSettings()
+ case .transcribeAndPaste(let url):
+ verificationTrace = VerificationTrace(model: model)
+ if let expected = ProcessInfo.processInfo.environment["CODEX_DICTATION_EXPECT_TARGET"],
+ NSWorkspace.shared.frontmostApplication?.bundleIdentifier != expected {
+ FileHandle.standardError.write(Data("Verification stopped: the expected target app is not in front.\n".utf8))
+ NSApp.terminate(nil)
+ return
+ }
+ model.transcribeFile(url)
+ case .practiceAudio(let url):
+ verificationTrace = VerificationTrace(model: model)
+ model.transcribeFile(url, forPractice: true)
+ windows.showOnboarding()
+ case .normal:
+ if !model.preferences.onboardingCompleted { windows.showOnboarding() }
+ }
+ }
+
+ func applicationDidBecomeActive(_ notification: Notification) {
+ model.refreshStatus()
+ }
+
+ func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
+ windows.showSettings()
+ return false
+ }
+
+ func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { false }
+
+ /// Waits for a pending clipboard restore so the old clipboard returns before quitting.
+ func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
+ guard model.isPasteLeasePending else {
+ model.cleanup()
+ return .terminateNow
+ }
+ Task {
+ await model.waitForPasteLease()
+ model.cleanup()
+ NSApp.reply(toApplicationShouldTerminate: true)
+ }
+ return .terminateLater
+ }
+
+ private func observeOtherLaunches() {
+ let center = DistributedNotificationCenter.default()
+ observers.append(center.addObserver(forName: LaunchOptions.showSettingsNotification, object: nil,
+ queue: nil) { [weak self] _ in
+ DispatchQueue.main.async { self?.windows.showSettings() }
+ })
+ observers.append(center.addObserver(forName: LaunchOptions.showOnboardingNotification, object: nil,
+ queue: nil) { [weak self] _ in
+ DispatchQueue.main.async { self?.windows.showOnboarding() }
+ })
+ }
+}
diff --git a/Sources/GPTVoice/AppModel.swift b/Sources/GPTVoice/AppModel.swift
new file mode 100644
index 0000000..d13a84d
--- /dev/null
+++ b/Sources/GPTVoice/AppModel.swift
@@ -0,0 +1,572 @@
+import AppKit
+import ApplicationServices
+import AVFoundation
+import DictationCore
+import ServiceManagement
+
+/// Owns dictation, sign-in, permissions, shortcut, and preferences for every view.
+@MainActor
+final class AppModel: NSObject, ObservableObject {
+ let preferences: AppPreferences
+
+ @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 hotkeyError: String?
+ /// True when the last shortcut failed because a macOS shortcut, such as Spotlight, owns it.
+ @Published private(set) var hotkeyBlockedBySystem = false
+ @Published private(set) var isCapturingShortcut = false
+ @Published private(set) var shortcutTestStatus: ShortcutTestStatus = .idle
+ @Published private(set) var launchAtLogin = LaunchAtLoginStatus.current()
+ @Published private(set) var launchAtLoginError: String?
+ @Published private(set) var elapsed: TimeInterval = 0
+ @Published private(set) var level: Float = 0
+ /// The last successful transcript. Memory only.
+ @Published private(set) var lastTranscript: String?
+ @Published private(set) var practiceTranscript: String?
+ @Published private(set) var isPracticeSession = false
+
+ private let audio: AudioCapture
+ private let paste: PasteCoordinator
+ private let transcribeAudio: @Sendable (URL) async throws -> String
+ private var shortcut: GlobalShortcut?
+ private var generation = 0
+ private var operation: Task<Void, Never>?
+ private var signInTask: Task<Void, Never>?
+ private var activeAudio: URL?
+ private var failedAudio: URL?
+ private var meterTimer: Timer?
+ private var permissionRefresh: Task<Void, Never>?
+ private var isPracticingInOnboarding = false
+
+ static let installCodexURL = URL(string: "https://developers.openai.com/codex/cli/")!
+
+ init(preferences: AppPreferences? = nil, pasteboard: NSPasteboard? = nil,
+ transcribeAudio: @escaping @Sendable (URL) async throws -> String = {
+ try await TranscriptionClient().transcribe(file: $0)
+ }) {
+ self.preferences = preferences ?? AppPreferences()
+ self.transcribeAudio = transcribeAudio
+ audio = AudioCapture()
+ paste = PasteCoordinator(pasteboard: pasteboard ?? .general)
+ super.init()
+ audio.onMaximumDuration = { [weak self] url in self?.captureEnded(url: url) }
+ audio.onFailure = { [weak self] error, url in self?.captureFailed(error, url: url) }
+ shortcut = GlobalShortcut { [weak self] in self?.receiveGlobalShortcut() }
+ refreshStatus()
+ }
+
+ // MARK: Derived state
+
+ var statusText: String { phase.statusText }
+ var canStart: Bool { !phase.isBusy && !paste.isLeasePending }
+ var canRetry: Bool { failedAudio != nil && !phase.isBusy }
+ var canChangeSettings: Bool { !phase.isBusy && !paste.isLeasePending }
+ var hotkey: HotkeySpec { preferences.hotkey }
+ var commandSpaceIsActive: Bool {
+ hotkey == .commandSpace && shortcut?.current == .commandSpace && hotkeyError == nil
+ }
+ var isReadyToDictate: Bool {
+ connection.isUsable && (microphone == .granted || microphone == .notRequested)
+ }
+
+ /// Items still missing for onboarding. Accessibility is optional.
+ var missingRequirements: [String] {
+ var missing: [String] = []
+ if !connection.isUsable { missing.append("Sign in with ChatGPT") }
+ if microphone != .granted { missing.append("Allow microphone access") }
+ if hotkeyError != nil || shortcut?.current == nil { missing.append("Choose a working shortcut") }
+ return missing
+ }
+
+ // MARK: Lifecycle
+
+ /// Registers the saved shortcut. Call once after launch.
+ func activate() {
+ do {
+ try shortcut?.replace(with: preferences.hotkey)
+ hotkeyError = nil
+ } catch {
+ hotkeyError = error.localizedDescription
+ if case GlobalShortcut.RegistrationError.systemShortcut = error { hotkeyBlockedBySystem = true }
+ }
+ }
+
+ /// Rechecks sign-in, permissions, and login item status without prompting.
+ func refreshStatus() {
+ cliAvailable = CodexAuthentication.cliAvailable
+ if signInTask == nil { connection = ConnectionStatus.current() }
+ microphone = PermissionStatus(AudioCapture.microphoneStatus)
+ accessibilityTrusted = AXIsProcessTrusted()
+ launchAtLogin = LaunchAtLoginStatus.current()
+ recheckPermissionsAfterReturn()
+ }
+
+ /// macOS can publish a permission change after its Settings window loses focus.
+ /// Recheck briefly so the UI reflects the grant without another click.
+ private func recheckPermissionsAfterReturn() {
+ permissionRefresh?.cancel()
+ permissionRefresh = Task { [weak self] in
+ for delay in [300_000_000, 700_000_000, 1_500_000_000] as [UInt64] {
+ do { try await Task.sleep(nanoseconds: delay) } catch { return }
+ guard let self, !Task.isCancelled else { return }
+ let microphone = PermissionStatus(AudioCapture.microphoneStatus)
+ let accessibility = AXIsProcessTrusted()
+ if self.microphone != microphone { self.microphone = microphone }
+ if self.accessibilityTrusted != accessibility { self.accessibilityTrusted = accessibility }
+ }
+ }
+ }
+
+ func completeOnboarding() {
+ guard missingRequirements.isEmpty else { return }
+ preferences.onboardingCompleted = true
+ }
+
+ /// Stops all work and deletes every owned audio file. Call on quit.
+ func cleanup() {
+ permissionRefresh?.cancel()
+ permissionRefresh = nil
+ endShortcutTest()
+ isPracticingInOnboarding = false
+ cancel()
+ signInTask?.cancel()
+ signInTask = nil
+ audio.cleanup()
+ failedAudio = nil
+ practiceTranscript = nil
+ shortcut?.unregister()
+ }
+
+ // MARK: Dictation
+
+ /// Starts recording when idle. Stops and transcribes when recording.
+ func toggleDictation() {
+ if phase == .recording { stopDictation() } else { startDictation() }
+ }
+
+ func startDictation() {
+ endShortcutTest()
+ startCapture(practice: isPracticingInOnboarding)
+ }
+
+ func beginPractice() {
+ endShortcutTest()
+ isPracticingInOnboarding = true
+ }
+
+ func startPracticeDictation() {
+ startCapture(practice: true)
+ }
+
+ func endPractice() {
+ isPracticingInOnboarding = false
+ guard isPracticeSession else { return }
+ cancel()
+ practiceTranscript = nil
+ }
+
+ private func startCapture(practice: Bool) {
+ guard canStart, !isCapturingShortcut else { return }
+ isPracticeSession = practice
+ if practice { practiceTranscript = nil }
+ refreshStatus()
+ guard connection.isUsable else {
+ fail(DictationFailure(message: "Sign in with ChatGPT in Settings, then start dictation.", recovery: .none,
+ overlayMessage: "Sign in to ChatGPT"))
+ return
+ }
+ discardFailedAudio()
+ generation += 1
+ let current = generation
+ phase = .preparing
+ operation = Task {
+ await paste.waitForLease()
+ guard current == generation else { return }
+ if !isPracticeSession { paste.beginSession() }
+ do {
+ try await audio.start()
+ } catch let error as AudioCaptureError {
+ guard current == generation else { return }
+ microphone = PermissionStatus(AudioCapture.microphoneStatus)
+ fail(DictationFailure(captureError: error, audioKept: false))
+ return
+ } catch {
+ guard current == generation else { return }
+ fail(DictationFailure(captureError: .startFailed, audioKept: false))
+ return
+ }
+ guard current == generation else { audio.cancel(); return }
+ microphone = .granted
+ phase = .recording
+ startMeter()
+ cue(.start)
+ }
+ }
+
+ func stopDictation() {
+ guard phase == .recording, let url = try? audio.stop() else { return }
+ captureEnded(url: url)
+ }
+
+ /// Cancels recording or transcription. Deletes the audio. A stale result never pastes.
+ /// Paste delivery is short and cannot be cancelled, so it keeps its clipboard lease.
+ func cancel() {
+ let pasting = phase == .pasting
+ if !pasting { generation += 1 }
+ operation?.cancel()
+ operation = nil
+ stopMeter()
+ audio.cancel()
+ if let activeAudio { audio.remove(activeAudio) }
+ activeAudio = nil
+ discardFailedAudio()
+ guard !pasting else { return }
+ paste.endSession()
+ isPracticeSession = false
+ phase = .idle
+ }
+
+ /// Sends the kept audio again.
+ func retry() {
+ guard canRetry, let url = failedAudio else { return }
+ failedAudio = nil
+ generation += 1
+ let current = generation
+ phase = .preparing
+ operation = Task {
+ await paste.waitForLease()
+ guard current == generation else { return }
+ if !isPracticeSession { paste.beginSession() }
+ transcribe(url)
+ }
+ }
+
+ func copyLastTranscript() {
+ guard let lastTranscript else { return }
+ paste.copy(lastTranscript)
+ if !phase.isBusy { phase = .finished(.copied(.automaticPasteOff)) }
+ }
+
+ /// Pastes the last transcript into the current frontmost app.
+ func pasteLastTranscript() {
+ guard let text = lastTranscript, canStart else { return }
+ isPracticeSession = false
+ generation += 1
+ let current = generation
+ phase = .pasting
+ operation = Task {
+ await paste.waitForLease()
+ paste.beginSession()
+ let outcome = await paste.deliver(text: text, automaticPaste: true)
+ if current == generation { phase = .finished(outcome) }
+ }
+ }
+
+ /// Test path: transcribes a supplied audio file and delivers it like a recording. No microphone use.
+ /// The supplied file is not owned, so it is never deleted.
+ func transcribeFile(_ url: URL, forPractice: Bool = false) {
+ guard canStart else { return }
+ isPracticeSession = forPractice
+ if forPractice { practiceTranscript = nil }
+ refreshStatus()
+ discardFailedAudio()
+ generation += 1
+ let current = generation
+ phase = .preparing
+ operation = Task {
+ await paste.waitForLease()
+ guard current == generation else { return }
+ if !isPracticeSession { paste.beginSession() }
+ transcribe(url)
+ }
+ }
+
+ /// Hides a finished or failed status. Failed audio stays available for Retry.
+ func dismissStatus() {
+ guard !phase.isBusy else { return }
+ phase = .idle
+ }
+
+ var isPasteLeasePending: Bool { paste.isLeasePending }
+
+ func waitForPasteLease() async { await paste.waitForLease() }
+
+ func openMicrophoneSettings() { SystemSettingsLink.microphone.open() }
+ func openAccessibilitySettings() { SystemSettingsLink.accessibility.open() }
+
+ // MARK: Permissions
+
+ /// Asks for microphone access the first time. Opens System Settings after a denial.
+ func requestMicrophone() {
+ switch AudioCapture.microphoneStatus {
+ case .notDetermined:
+ Task {
+ _ = await AVCaptureDevice.requestAccess(for: .audio)
+ microphone = PermissionStatus(AudioCapture.microphoneStatus)
+ }
+ case .authorized:
+ microphone = .granted
+ default:
+ openMicrophoneSettings()
+ }
+ }
+
+ /// 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)
+ }
+
+ // MARK: Sign-in
+
+ func signIn() {
+ guard signInTask == nil else { return }
+ cliAvailable = CodexAuthentication.cliAvailable
+ guard cliAvailable else {
+ authError = "Install Codex CLI, then select Sign in with ChatGPT."
+ return
+ }
+ authError = nil
+ connection = .signingIn
+ signInTask = Task {
+ do {
+ try await CodexAuthentication.signIn { url in
+ await MainActor.run { _ = NSWorkspace.shared.open(url) }
+ }
+ } catch {
+ if !Task.isCancelled {
+ authError = "Sign-in did not finish. Select Sign in with ChatGPT to try again."
+ }
+ }
+ guard !Task.isCancelled else { return }
+ signInTask = nil
+ connection = ConnectionStatus.current()
+ if connection.isUsable { authError = nil }
+ }
+ }
+
+ func cancelSignIn() {
+ signInTask?.cancel()
+ signInTask = nil
+ connection = ConnectionStatus.current()
+ }
+
+ /// Renews the shared sign-in through Codex CLI.
+ func reconnect() {
+ guard signInTask == nil else { return }
+ guard cliAvailable else { signIn(); return }
+ authError = nil
+ connection = .renewing
+ signInTask = Task {
+ do {
+ _ = try await CodexAuthentication.refresh()
+ } catch {
+ if !Task.isCancelled {
+ authError = "Renewal failed. Select Sign in with ChatGPT to sign in again."
+ }
+ }
+ guard !Task.isCancelled else { return }
+ signInTask = nil
+ connection = ConnectionStatus.current()
+ }
+ }
+
+ func openInstallCodex() { NSWorkspace.shared.open(Self.installCodexURL) }
+
+ // MARK: Shortcut
+
+ /// Waits for the registered shortcut without starting the microphone.
+ func beginShortcutTest() {
+ guard canChangeSettings else { return }
+ if isCapturingShortcut { endShortcutCapture() }
+ guard shortcut?.current != nil, hotkeyError == nil else {
+ shortcutTestStatus = .unavailable(hotkeyError ?? "Choose a working shortcut first.")
+ return
+ }
+ shortcutTestStatus = .listening
+ }
+
+ func endShortcutTest() { shortcutTestStatus = .idle }
+
+ func receiveGlobalShortcut() {
+ switch shortcutTestStatus {
+ case .listening, .received:
+ shortcutTestStatus = .received
+ case .idle, .unavailable:
+ toggleDictation()
+ }
+ }
+
+ /// Suspends the global shortcut so the recorder receives the keys.
+ func beginShortcutCapture() {
+ endShortcutTest()
+ guard canChangeSettings else {
+ hotkeyError = "Finish the current dictation, then change the shortcut."
+ return
+ }
+ isCapturingShortcut = true
+ shortcut?.unregister()
+ }
+
+ /// Restores the saved shortcut if the recorder did not save a new one.
+ func endShortcutCapture() {
+ isCapturingShortcut = false
+ guard shortcut?.current != preferences.hotkey else { return }
+ activate()
+ }
+
+ /// Registers a new shortcut and saves it only on success. The previous shortcut stays on failure.
+ @discardableResult
+ func setHotkey(_ spec: HotkeySpec) -> Bool {
+ guard canChangeSettings else {
+ hotkeyError = "Finish the current dictation, then change the shortcut."
+ return false
+ }
+ endShortcutTest()
+ do {
+ hotkeyBlockedBySystem = false
+ try shortcut?.replace(with: spec)
+ preferences.hotkey = spec
+ hotkeyError = nil
+ return true
+ } catch {
+ hotkeyError = error.localizedDescription
+ if case GlobalShortcut.RegistrationError.systemShortcut = error {
+ hotkeyBlockedBySystem = true
+ }
+ if shortcut?.current == nil, !isCapturingShortcut { try? shortcut?.replace(with: preferences.hotkey) }
+ return false
+ }
+ }
+
+ func resetHotkey() { setHotkey(.default) }
+
+ /// Tries Command–Space. The recorder cannot capture it while macOS owns it, so this preset exists.
+ func useCommandSpace() { setHotkey(.commandSpace) }
+
+ func openKeyboardShortcutsSettings() { SystemSettingsLink.keyboardShortcuts.open() }
+
+ /// Shows a recorder error, for example a reserved shortcut, without changing registration.
+ func reportShortcutProblem(_ problem: HotkeySpec.Problem) {
+ hotkeyError = problem.message
+ hotkeyBlockedBySystem = false
+ }
+
+ // MARK: Behavior
+
+ func setAutomaticPaste(_ value: Bool) {
+ guard canChangeSettings else { return }
+ preferences.automaticPaste = value
+ }
+
+ func setSoundCues(_ value: Bool) {
+ guard canChangeSettings else { return }
+ preferences.soundCues = value
+ }
+
+ func setLaunchAtLogin(_ enabled: Bool) {
+ launchAtLoginError = nil
+ do {
+ if enabled { try SMAppService.mainApp.register() } else { try SMAppService.mainApp.unregister() }
+ } catch {
+ launchAtLoginError = enabled
+ ? "Launch at login could not be turned on. Open Login Items and allow GPT Voice."
+ : "Launch at login could not be turned off. Remove GPT Voice in Login Items."
+ }
+ launchAtLogin = LaunchAtLoginStatus.current()
+ }
+
+ func openLoginItemsSettings() { SMAppService.openSystemSettingsLoginItems() }
+
+ // MARK: Private
+
+ private func captureEnded(url: URL) {
+ stopMeter()
+ cue(.stop)
+ generation += 1
+ transcribe(url)
+ }
+
+ private func captureFailed(_ error: AudioCaptureError, url: URL?) {
+ stopMeter()
+ generation += 1
+ operation = nil
+ failedAudio = url
+ fail(DictationFailure(captureError: error, audioKept: url != nil))
+ }
+
+ /// Transcribes and delivers one file. Uses the current generation to reject stale results.
+ private func transcribe(_ url: URL) {
+ let current = generation
+ activeAudio = url
+ phase = .transcribing
+ operation = Task {
+ let text: String
+ do {
+ text = try await transcribeAudio(url)
+ } catch {
+ guard current == generation, !Task.isCancelled else { return }
+ activeAudio = nil
+ let failure = DictationFailure(transcriptionError: error)
+ if failure.keepsAudio { failedAudio = url } else { audio.remove(url) }
+ fail(failure)
+ return
+ }
+ guard current == generation, !Task.isCancelled else { return }
+ activeAudio = nil
+ audio.remove(url)
+ lastTranscript = text
+ if isPracticeSession {
+ practiceTranscript = text
+ operation = nil
+ paste.endSession()
+ phase = .finished(.previewed)
+ return
+ }
+ phase = .pasting
+ let outcome = await paste.deliver(text: text, automaticPaste: preferences.automaticPaste)
+ operation = nil
+ if current == generation { phase = .finished(outcome) }
+ }
+ }
+
+ private func fail(_ failure: DictationFailure) {
+ operation = nil
+ if !failure.keepsAudio { paste.endSession() }
+ phase = .failed(failure)
+ cue(.failure)
+ }
+
+ private func discardFailedAudio() {
+ if let failedAudio { audio.remove(failedAudio) }
+ failedAudio = nil
+ }
+
+ private func cue(_ sound: SoundCue) {
+ if preferences.soundCues { sound.play() }
+ }
+
+ private func startMeter() {
+ meterTimer?.invalidate()
+ let timer = Timer(timeInterval: 0.05, target: self, selector: #selector(meterTick), userInfo: nil, repeats: true)
+ RunLoop.main.add(timer, forMode: .common)
+ meterTimer = timer
+ }
+
+ private func stopMeter() {
+ meterTimer?.invalidate()
+ meterTimer = nil
+ elapsed = 0
+ level = 0
+ }
+
+ @objc private func meterTick() {
+ guard audio.isRecording else { stopMeter(); return }
+ elapsed = audio.elapsed
+ level = audio.currentLevel()
+ }
+}
diff --git a/Sources/GPTVoice/AppMotion.swift b/Sources/GPTVoice/AppMotion.swift
new file mode 100644
index 0000000..55180a9
--- /dev/null
+++ b/Sources/GPTVoice/AppMotion.swift
@@ -0,0 +1,14 @@
+import SwiftUI
+
+/// Motion tokens. Short and settled. No bounce anywhere. Reduce Motion removes movement.
+enum AppMotion {
+ /// Hover, press, toggle, segment: 0.16 s ease-out.
+ static func control(_ reduceMotion: Bool) -> Animation? {
+ reduceMotion ? nil : .easeOut(duration: 0.16)
+ }
+
+ /// Page and step changes: a 0.22 s cross-fade. Movement stays at 6 pt or less.
+ static func reveal(_ reduceMotion: Bool) -> Animation? {
+ reduceMotion ? .easeOut(duration: 0.1) : .easeOut(duration: 0.22)
+ }
+}
diff --git a/Sources/GPTVoice/AppPalette.swift b/Sources/GPTVoice/AppPalette.swift
new file mode 100644
index 0000000..046d501
--- /dev/null
+++ b/Sources/GPTVoice/AppPalette.swift
@@ -0,0 +1,48 @@
+import AppKit
+import SwiftUI
+
+/// Neutral color roles. Light: soft gray paper. Dark: neutral charcoal, no blue tint.
+/// Color is used only for meaning: selection (accent), recording, success, warning, problem.
+enum AppPalette {
+ static let canvas = dynamic(light: 0xF4F4F3, dark: 0x1C1C1E)
+ static let sidebar = dynamic(light: 0xEBEBEA, dark: 0x161617)
+ static let surface = dynamic(light: 0xFFFFFF, dark: 0x252527)
+ /// Recessed fills: toggle tracks, segment backgrounds, selection, hover.
+ static let well = dynamic(light: 0xE6E6E4, dark: 0x303033)
+ static let hairline = Color(nsColor: NSColor(name: nil) { appearance in
+ isDark(appearance) ? NSColor.white.withAlphaComponent(0.09) : NSColor.black.withAlphaComponent(0.09)
+ })
+
+ /// Live recording only.
+ static let recording = dynamic(light: 0xD5432B, dark: 0xFF6A50)
+ static let success = dynamic(light: 0x2C7A4B, dark: 0x62C48C)
+ static let warning = dynamic(light: 0x935400, dark: 0xE6AE4A)
+ /// Light #B3232F: about 5.3:1 on problemSoft #FDE1E3 (hand calculation).
+ static let problem = dynamic(light: 0xB3232F, dark: 0xFF6B76)
+ static let problemSoft = dynamic(light: 0xFDE1E3, dark: 0x3A1D20)
+
+ static let nsCanvas = dynamicNS(light: 0xF4F4F3, dark: 0x1C1C1E)
+ static let nsWell = dynamicNS(light: 0xE6E6E4, dark: 0x303033)
+ static let nsSurface = dynamicNS(light: 0xFFFFFF, dark: 0x252527)
+
+ private static func isDark(_ appearance: NSAppearance) -> Bool {
+ appearance.bestMatch(from: [.aqua, .darkAqua]) == .darkAqua
+ }
+
+ static func dynamic(light: UInt32, dark: UInt32) -> Color {
+ Color(nsColor: dynamicNS(light: light, dark: dark))
+ }
+
+ static func dynamicNS(light: UInt32, dark: UInt32) -> NSColor {
+ NSColor(name: nil) { appearance in
+ rgb(isDark(appearance) ? dark : light)
+ }
+ }
+
+ private static func rgb(_ hex: UInt32) -> NSColor {
+ NSColor(srgbRed: CGFloat((hex >> 16) & 0xFF) / 255,
+ green: CGFloat((hex >> 8) & 0xFF) / 255,
+ blue: CGFloat(hex & 0xFF) / 255,
+ alpha: 1)
+ }
+}
diff --git a/Sources/GPTVoice/AppPreferences.swift b/Sources/GPTVoice/AppPreferences.swift
new file mode 100644
index 0000000..401fbfb
--- /dev/null
+++ b/Sources/GPTVoice/AppPreferences.swift
@@ -0,0 +1,73 @@
+import Foundation
+
+/// User preferences. Stores only settings and onboarding state.
+/// Never stores credentials, audio, or transcripts.
+@MainActor
+final class AppPreferences: ObservableObject {
+ private enum Key {
+ static let hotkey = "hotkey"
+ static let automaticPaste = "automaticPaste"
+ static let soundCues = "soundCues"
+ static let onboardingCompleted = "onboardingCompleted"
+ static let theme = "theme"
+ static let accent = "accent"
+ static let overlayPlacement = "overlayPlacement"
+ static let manualPasteHelpDismissed = "manualPasteHelpDismissed"
+ }
+
+ @Published var overlayPlacement: OverlayPlacement {
+ didSet { defaults.set(overlayPlacement.rawValue, forKey: Key.overlayPlacement) }
+ }
+
+ @Published var manualPasteHelpDismissed: Bool {
+ didSet { defaults.set(manualPasteHelpDismissed, forKey: Key.manualPasteHelpDismissed) }
+ }
+
+ @Published var theme: AppTheme {
+ didSet { defaults.set(theme.rawValue, forKey: Key.theme) }
+ }
+
+ @Published var accent: AccentChoice {
+ didSet { defaults.set(accent.rawValue, forKey: Key.accent) }
+ }
+
+ private let defaults: UserDefaults
+
+ @Published var hotkey: HotkeySpec {
+ didSet {
+ guard let data = try? JSONEncoder().encode(hotkey) else { return }
+ defaults.set(data, forKey: Key.hotkey)
+ }
+ }
+
+ @Published var automaticPaste: Bool {
+ didSet { defaults.set(automaticPaste, forKey: Key.automaticPaste) }
+ }
+
+ @Published var soundCues: Bool {
+ didSet { defaults.set(soundCues, forKey: Key.soundCues) }
+ }
+
+ @Published var onboardingCompleted: Bool {
+ didSet { defaults.set(onboardingCompleted, forKey: Key.onboardingCompleted) }
+ }
+
+ init(defaults: UserDefaults = .standard) {
+ self.defaults = defaults
+ defaults.register(defaults: [
+ Key.automaticPaste: true,
+ Key.soundCues: false,
+ Key.onboardingCompleted: false
+ ])
+ let stored = defaults.data(forKey: Key.hotkey).flatMap { try? JSONDecoder().decode(HotkeySpec.self, from: $0) }
+ hotkey = stored.flatMap { $0.isValid ? $0 : nil } ?? .default
+ automaticPaste = defaults.bool(forKey: Key.automaticPaste)
+ soundCues = defaults.bool(forKey: Key.soundCues)
+ onboardingCompleted = defaults.bool(forKey: Key.onboardingCompleted)
+ theme = defaults.string(forKey: Key.theme).flatMap(AppTheme.init(rawValue:)) ?? .system
+ accent = defaults.string(forKey: Key.accent).flatMap(AccentChoice.init(rawValue:)) ?? .system
+ overlayPlacement = defaults.string(forKey: Key.overlayPlacement)
+ .flatMap(OverlayPlacement.init(rawValue:)) ?? .bottom
+ manualPasteHelpDismissed = defaults.bool(forKey: Key.manualPasteHelpDismissed)
+ }
+}
diff --git a/Sources/GPTVoice/AppSegmented.swift b/Sources/GPTVoice/AppSegmented.swift
new file mode 100644
index 0000000..056284f
--- /dev/null
+++ b/Sources/GPTVoice/AppSegmented.swift
@@ -0,0 +1,54 @@
+import AppKit
+import SwiftUI
+
+/// Compact segmented choice. Each option is a focusable button. The selected option sits on a flat surface.
+struct AppSegmented<Value: Hashable & Identifiable>: View {
+ let label: String
+ let options: [Value]
+ let title: (Value) -> String
+ @Binding var selection: Value
+
+ @FocusState private var focused: Value.ID?
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+
+ var body: some View {
+ HStack(spacing: 2) {
+ ForEach(options) { option in
+ let selected = option == selection
+ Button {
+ selection = option
+ } label: {
+ Text(title(option))
+ .font(AppType.controlSmall)
+ .foregroundStyle(selected ? Color.primary : Color.secondary)
+ .padding(.horizontal, 12)
+ .frame(minHeight: 26)
+ .background(
+ RoundedRectangle(cornerRadius: 6, style: .continuous)
+ .fill(selected ? AppPalette.surface : .clear)
+ )
+ .overlay(
+ RoundedRectangle(cornerRadius: 6, style: .continuous)
+ .strokeBorder(selected ? AppPalette.hairline : .clear)
+ )
+ .contentShape(RoundedRectangle(cornerRadius: 6, style: .continuous))
+ }
+ .buttonStyle(.plain)
+ .focused($focused, equals: option.id)
+ .overlay(
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
+ .strokeBorder(Color(nsColor: .keyboardFocusIndicatorColor), lineWidth: 2)
+ .padding(-2)
+ .opacity(focused == option.id ? 1 : 0)
+ )
+ .accessibilityLabel(title(option))
+ .accessibilityAddTraits(selected ? .isSelected : [])
+ }
+ }
+ .padding(2)
+ .background(RoundedRectangle(cornerRadius: 8, style: .continuous).fill(AppPalette.well))
+ .animation(AppMotion.control(reduceMotion), value: selection)
+ .accessibilityElement(children: .contain)
+ .accessibilityLabel(label)
+ }
+}
diff --git a/Sources/GPTVoice/AppTheme.swift b/Sources/GPTVoice/AppTheme.swift
new file mode 100644
index 0000000..a7819ea
--- /dev/null
+++ b/Sources/GPTVoice/AppTheme.swift
@@ -0,0 +1,27 @@
+import AppKit
+
+/// Light or dark appearance choice. System follows macOS.
+enum AppTheme: String, CaseIterable, Identifiable {
+ case system
+ case light
+ case dark
+
+ var id: String { rawValue }
+
+ var title: String {
+ switch self {
+ case .system: return "System"
+ case .light: return "Light"
+ case .dark: return "Dark"
+ }
+ }
+
+ /// nil lets the app follow the system appearance.
+ var appearance: NSAppearance? {
+ switch self {
+ case .system: return nil
+ case .light: return NSAppearance(named: .aqua)
+ case .dark: return NSAppearance(named: .darkAqua)
+ }
+ }
+}
diff --git a/Sources/GPTVoice/AppToggle.swift b/Sources/GPTVoice/AppToggle.swift
new file mode 100644
index 0000000..db01dcc
--- /dev/null
+++ b/Sources/GPTVoice/AppToggle.swift
@@ -0,0 +1,48 @@
+import AppKit
+import SwiftUI
+
+/// Compact switch (36×20). A native button underneath, so Space and Return toggle it with keyboard focus.
+/// VoiceOver reads the label, "On" or "Off", and the hint.
+struct AppToggle: View {
+ let label: String
+ var hint: String = ""
+ @Binding var isOn: Bool
+
+ @FocusState private var focused: Bool
+ @Environment(\.isEnabled) private var isEnabled
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+ @Environment(\.appAccentFill) private var accentFill
+
+ var body: some View {
+ Button {
+ isOn.toggle()
+ } label: {
+ ZStack(alignment: isOn ? .trailing : .leading) {
+ Capsule()
+ .fill(isOn ? accentFill : AppPalette.well)
+ Circle()
+ .fill(Color.white)
+ .shadow(color: .black.opacity(0.15), radius: 1, y: 0.5)
+ .padding(2)
+ }
+ .frame(width: 36, height: 20)
+ .contentShape(Capsule())
+ }
+ .buttonStyle(.plain)
+ .focused($focused)
+ .overlay(
+ Capsule()
+ .strokeBorder(Color(nsColor: .keyboardFocusIndicatorColor), lineWidth: 2)
+ .padding(-3)
+ .opacity(focused ? 1 : 0)
+ )
+ .opacity(isEnabled ? 1 : 0.4)
+ .animation(AppMotion.control(reduceMotion), value: isOn)
+ .accessibilityElement(children: .ignore)
+ .accessibilityLabel(label)
+ .accessibilityValue(isOn ? "On" : "Off")
+ .accessibilityHint(hint)
+ .accessibilityAddTraits(.isButton)
+ .accessibilityAction { isOn.toggle() }
+ }
+}
diff --git a/Sources/GPTVoice/AppType.swift b/Sources/GPTVoice/AppType.swift
new file mode 100644
index 0000000..583e437
--- /dev/null
+++ b/Sources/GPTVoice/AppType.swift
@@ -0,0 +1,44 @@
+import AppKit
+import SwiftUI
+
+/// Type roles, in two families with distinct jobs:
+/// - FT Regola Neue (display): page titles, section headings and the GPT Voice wordmark. Only its three
+/// shipped weights are used, so no weight is ever synthesized.
+/// - San Francisco (system): everything people read or operate, such as rows, body, details, controls,
+/// keycaps, captions and timers.
+/// Numbers that change in place (timers) add tabular figures with `.monospacedDigit()` at the call site.
+enum AppType {
+ static let regular = "FTRegolaNeue-Regular"
+ static let medium = "FTRegolaNeue-Medium"
+ static let semibold = "FTRegolaNeue-Semibold"
+
+ // MARK: Display (FT Regola Neue)
+
+ /// Page and onboarding titles.
+ static let title = Font.custom(semibold, size: 26)
+ /// Section headings and the sidebar wordmark.
+ static let heading = Font.custom(semibold, size: 15)
+ /// The GPT Voice wordmark inline with other text (About row).
+ static let brand = Font.custom(medium, size: 14)
+
+ // MARK: Reading and controls (San Francisco)
+
+ /// Row titles and selected sidebar items.
+ static let rowTitle = Font.system(size: 14, weight: .medium)
+ static let body = Font.system(size: 14, weight: .regular)
+ static let detail = Font.system(size: 13, weight: .regular)
+ /// Small labels, step counts, disclosure labels.
+ static let caption = Font.system(size: 12, weight: .medium)
+ static let control = Font.system(size: 13.5, weight: .medium)
+ static let controlSmall = Font.system(size: 12.5, weight: .medium)
+ static let keycap = Font.system(size: 13, weight: .medium)
+ static let keycapLarge = Font.system(size: 20, weight: .medium)
+ /// Timers: tabular figures applied by the caller.
+ static let timer = Font.system(size: 12.5, weight: .medium)
+
+ /// Title tracking, as in the reference type scale (tight at large sizes).
+ static let titleTracking: CGFloat = -0.4
+
+ /// AppKit counterpart of `controlSmall`, for custom-painted controls.
+ static var nsControlSmall: NSFont { .systemFont(ofSize: 12.5, weight: .medium) }
+}
diff --git a/Sources/GPTVoice/AppearanceController.swift b/Sources/GPTVoice/AppearanceController.swift
new file mode 100644
index 0000000..e0925f1
--- /dev/null
+++ b/Sources/GPTVoice/AppearanceController.swift
@@ -0,0 +1,15 @@
+import AppKit
+import Combine
+
+/// Applies the saved theme to the whole app: windows, AppKit controls, and the overlay panel.
+@MainActor
+final class AppearanceController {
+ private var themeObserver: AnyCancellable?
+
+ init(preferences: AppPreferences) {
+ NSApp.appearance = preferences.theme.appearance
+ themeObserver = preferences.$theme
+ .removeDuplicates()
+ .sink { theme in NSApp.appearance = theme.appearance }
+ }
+}
diff --git a/Sources/GPTVoice/AppearancePreview.swift b/Sources/GPTVoice/AppearancePreview.swift
new file mode 100644
index 0000000..cb1e20d
--- /dev/null
+++ b/Sources/GPTVoice/AppearancePreview.swift
@@ -0,0 +1,18 @@
+import SwiftUI
+
+/// The real recording bar views in two sample states. No microphone use.
+struct AppearancePreview: View {
+ private static let recording = DictationOverlayState.recording(elapsed: 12, level: 0.5)
+ private static let working = DictationOverlayState.working(label: "Transcribing", cancellable: true)
+
+ var body: some View {
+ HStack(spacing: 12) {
+ DictationOverlayView(state: Self.recording, actions: .preview)
+ DictationOverlayView(state: Self.working, actions: .preview)
+ Spacer(minLength: 0)
+ }
+ .padding(.vertical, 16)
+ .accessibilityElement(children: .contain)
+ .accessibilityLabel("Sample recording bar")
+ }
+}
diff --git a/Sources/GPTVoice/AppearanceSection.swift b/Sources/GPTVoice/AppearanceSection.swift
new file mode 100644
index 0000000..649623a
--- /dev/null
+++ b/Sources/GPTVoice/AppearanceSection.swift
@@ -0,0 +1,27 @@
+import SwiftUI
+
+/// Theme, accent, and bar position, then the real recording bar preview. Changes apply at once and persist.
+struct AppearanceSection: View {
+ @ObservedObject var preferences: AppPreferences
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 24) {
+ SettingsGroup {
+ SettingsRow(title: "Theme") {
+ AppSegmented(label: "Theme", options: AppTheme.allCases, title: \.title,
+ selection: $preferences.theme)
+ }
+ SettingsRow(title: "Accent") {
+ AccentSwatchPicker(selection: $preferences.accent)
+ }
+ SettingsRow(title: "Bar position", showsDivider: false) {
+ AppSegmented(label: "Recording bar position", options: OverlayPlacement.allCases,
+ title: \.title, selection: $preferences.overlayPlacement)
+ }
+ }
+ SettingsGroup(title: "Recording bar") {
+ AppearancePreview()
+ }
+ }
+ }
+}
diff --git a/Sources/GPTVoice/AudioCapture.swift b/Sources/GPTVoice/AudioCapture.swift
new file mode 100644
index 0000000..67f44c6
--- /dev/null
+++ b/Sources/GPTVoice/AudioCapture.swift
@@ -0,0 +1,156 @@
+import AVFoundation
+import Foundation
+
+/// Records mono 24 kHz 16-bit PCM WAV files into a private temporary directory.
+/// Recording starts only from an explicit `start()` call.
+@MainActor
+final class AudioCapture: NSObject, AVAudioRecorderDelegate {
+ static let maximumDuration: TimeInterval = 300
+
+ /// Called when the 5-minute cap ends the recording. The file is complete and owned by the caller.
+ var onMaximumDuration: ((URL) -> Void)?
+ /// Called when the device or encoder fails. The partial file is kept for Retry when it exists.
+ var onFailure: ((AudioCaptureError, URL?) -> Void)?
+
+ private var recorder: AVAudioRecorder?
+ private var directory: URL?
+ private var ownedFiles: Set<URL> = []
+ private var generation = 0
+ private var stoppingByRequest = false
+
+ static var microphoneStatus: AVAuthorizationStatus {
+ AVCaptureDevice.authorizationStatus(for: .audio)
+ }
+
+ var isRecording: Bool { recorder != nil }
+
+ /// Seconds recorded so far, or zero when idle.
+ var elapsed: TimeInterval { recorder?.currentTime ?? 0 }
+
+ /// Normalized input level from 0 to 1, or zero when idle. For UI only.
+ func currentLevel() -> Float {
+ guard let recorder else { return 0 }
+ recorder.updateMeters()
+ let decibels = recorder.averagePower(forChannel: 0)
+ return max(0, min(1, (decibels + 50) / 50))
+ }
+
+ /// Asks for microphone access on first use, then starts recording.
+ func start() async throws {
+ guard recorder == nil else { throw AudioCaptureError.alreadyRecording }
+ generation += 1
+ let startGeneration = generation
+ switch Self.microphoneStatus {
+ case .authorized: break
+ case .notDetermined:
+ let granted = await AVCaptureDevice.requestAccess(for: .audio)
+ guard granted else { throw AudioCaptureError.microphoneDenied }
+ default: throw AudioCaptureError.microphoneDenied
+ }
+ guard startGeneration == generation, recorder == nil else { throw AudioCaptureError.cancelled }
+
+ let url = try makeFileURL()
+ let settings: [String: Any] = [
+ AVFormatIDKey: kAudioFormatLinearPCM,
+ AVSampleRateKey: 24_000,
+ AVNumberOfChannelsKey: 1,
+ AVLinearPCMBitDepthKey: 16,
+ AVLinearPCMIsFloatKey: false,
+ AVLinearPCMIsBigEndianKey: false
+ ]
+ let newRecorder: AVAudioRecorder
+ do {
+ newRecorder = try AVAudioRecorder(url: url, settings: settings)
+ } catch {
+ throw AudioCaptureError.startFailed
+ }
+ newRecorder.delegate = self
+ newRecorder.isMeteringEnabled = true
+ ownedFiles.insert(url)
+ guard newRecorder.prepareToRecord(), newRecorder.record(forDuration: Self.maximumDuration) else {
+ remove(url)
+ throw AudioCaptureError.startFailed
+ }
+ stoppingByRequest = false
+ recorder = newRecorder
+ }
+
+ /// Stops recording and returns the finished file. The caller removes it with `remove(_:)`.
+ func stop() throws -> URL {
+ guard let recorder else { throw AudioCaptureError.notRecording }
+ stoppingByRequest = true
+ recorder.stop()
+ self.recorder = nil
+ generation += 1
+ return recorder.url
+ }
+
+ /// Stops any recording, including a pending permission request, and deletes its file.
+ func cancel() {
+ generation += 1
+ guard let recorder else { return }
+ stoppingByRequest = true
+ recorder.stop()
+ self.recorder = nil
+ remove(recorder.url)
+ }
+
+ /// Deletes one owned audio file, for example after a successful transcription.
+ func remove(_ url: URL) {
+ guard ownedFiles.remove(url) != nil else { return }
+ try? FileManager.default.removeItem(at: url)
+ }
+
+ /// Cancels recording and deletes every owned file and the private directory. Call on quit.
+ func cleanup() {
+ cancel()
+ for url in ownedFiles { try? FileManager.default.removeItem(at: url) }
+ ownedFiles.removeAll()
+ if let directory { try? FileManager.default.removeItem(at: directory) }
+ directory = nil
+ }
+
+ private func makeFileURL() throws -> URL {
+ if directory == nil {
+ let url = FileManager.default.temporaryDirectory
+ .appendingPathComponent("GPTVoice-\(UUID().uuidString)", isDirectory: true)
+ do {
+ try FileManager.default.createDirectory(at: url, withIntermediateDirectories: false,
+ attributes: [.posixPermissions: 0o700])
+ } catch {
+ throw AudioCaptureError.startFailed
+ }
+ directory = url
+ }
+ return directory!.appendingPathComponent("\(UUID().uuidString).wav")
+ }
+
+ private func recorderFinished(_ finished: AVAudioRecorder, successfully: Bool) {
+ guard finished === recorder, !stoppingByRequest else { return }
+ recorder = nil
+ generation += 1
+ let url = finished.url
+ if successfully {
+ onMaximumDuration?(url)
+ } else {
+ onFailure?(.deviceFailed, ownedFiles.contains(url) ? url : nil)
+ }
+ }
+
+ private func recorderFailed(_ failed: AVAudioRecorder) {
+ guard failed === recorder else { return }
+ stoppingByRequest = true
+ failed.stop()
+ recorder = nil
+ generation += 1
+ onFailure?(.deviceFailed, ownedFiles.contains(failed.url) ? failed.url : nil)
+ }
+
+ nonisolated func audioRecorderDidFinishRecording(_ recorder: AVAudioRecorder, successfully flag: Bool) {
+ DispatchQueue.main.async { self.recorderFinished(recorder, successfully: flag) }
+ }
+
+ nonisolated func audioRecorderEncodeErrorDidOccur(_ recorder: AVAudioRecorder, error: Error?) {
+ DispatchQueue.main.async { self.recorderFailed(recorder) }
+ }
+}
diff --git a/Sources/GPTVoice/AudioCaptureError.swift b/Sources/GPTVoice/AudioCaptureError.swift
new file mode 100644
index 0000000..cef185f
--- /dev/null
+++ b/Sources/GPTVoice/AudioCaptureError.swift
@@ -0,0 +1,21 @@
+import Foundation
+
+enum AudioCaptureError: LocalizedError, Equatable {
+ case microphoneDenied
+ case alreadyRecording
+ case notRecording
+ case cancelled
+ case startFailed
+ case deviceFailed
+
+ var errorDescription: String? {
+ switch self {
+ case .microphoneDenied: return "Microphone access is off. Turn it on in System Settings."
+ case .alreadyRecording: return "A recording is already active."
+ case .notRecording: return "No recording is active."
+ case .cancelled: return "Recording was cancelled."
+ case .startFailed: return "Recording could not start. Check your microphone."
+ case .deviceFailed: return "The microphone stopped working. Your audio up to this point is kept."
+ }
+ }
+}
diff --git a/Sources/GPTVoice/BehaviorSection.swift b/Sources/GPTVoice/BehaviorSection.swift
new file mode 100644
index 0000000..f702207
--- /dev/null
+++ b/Sources/GPTVoice/BehaviorSection.swift
@@ -0,0 +1,46 @@
+import SwiftUI
+
+/// Automatic paste, sound cues, and launch at login. Short labels. A detail only when it changes a decision.
+struct BehaviorSection: View {
+ @ObservedObject var model: AppModel
+ @ObservedObject var preferences: AppPreferences
+
+ init(model: AppModel) {
+ self.model = model
+ self.preferences = model.preferences
+ }
+
+ private var showsLoginIssue: Bool {
+ model.launchAtLoginError != nil || model.launchAtLogin == .requiresApproval
+ }
+
+ var body: some View {
+ SettingsGroup {
+ SettingsRow(title: "Paste automatically",
+ detail: model.accessibilityTrusted ? nil : "Needs Accessibility. Until then, text is copied.") {
+ AppToggle(label: "Paste automatically",
+ isOn: Binding(get: { preferences.automaticPaste }, set: { model.setAutomaticPaste($0) }))
+ .disabled(!model.canChangeSettings)
+ }
+ SettingsRow(title: "Sound cues") {
+ AppToggle(label: "Sound cues",
+ isOn: Binding(get: { preferences.soundCues }, set: { model.setSoundCues($0) }))
+ .disabled(!model.canChangeSettings)
+ }
+ SettingsRow(title: "Open at login", showsDivider: showsLoginIssue) {
+ AppToggle(label: "Open at login",
+ isOn: Binding(get: { model.launchAtLogin.isOn }, set: { model.setLaunchAtLogin($0) }))
+ .disabled(!model.canChangeSettings)
+ }
+ if showsLoginIssue {
+ StatusRow(tone: model.launchAtLoginError == nil ? .attention : .problem,
+ symbol: "exclamationmark.circle.fill",
+ title: model.launchAtLoginError == nil ? "Needs approval in Login Items" : "Login item problem",
+ detail: model.launchAtLoginError ?? "") {
+ Button("Open Login Items") { model.openLoginItemsSettings() }
+ .buttonStyle(AppButtonStyle(kind: .secondary, showsArrow: true, small: true))
+ }
+ }
+ }
+ }
+}
diff --git a/Sources/GPTVoice/ClipboardSnapshot.swift b/Sources/GPTVoice/ClipboardSnapshot.swift
new file mode 100644
index 0000000..2c99172
--- /dev/null
+++ b/Sources/GPTVoice/ClipboardSnapshot.swift
@@ -0,0 +1,29 @@
+import AppKit
+
+/// Every representation of every pasteboard item, plus the change count at capture time.
+struct ClipboardSnapshot {
+ let changeCount: Int
+ private let items: [[NSPasteboard.PasteboardType: Data]]
+
+ static func capture(_ pasteboard: NSPasteboard) -> ClipboardSnapshot {
+ let items = (pasteboard.pasteboardItems ?? []).map { item in
+ item.types.reduce(into: [NSPasteboard.PasteboardType: Data]()) { result, type in
+ if let data = item.data(forType: type) { result[type] = data }
+ }
+ }
+ return ClipboardSnapshot(changeCount: pasteboard.changeCount, items: items)
+ }
+
+ /// Writes the saved items back. Returns the new change count.
+ @discardableResult
+ func restore(to pasteboard: NSPasteboard) -> Int {
+ pasteboard.clearContents()
+ let restored = items.map { representations in
+ let item = NSPasteboardItem()
+ for (type, data) in representations { item.setData(data, forType: type) }
+ return item
+ }
+ if !restored.isEmpty { pasteboard.writeObjects(restored) }
+ return pasteboard.changeCount
+ }
+}
diff --git a/Sources/GPTVoice/CommandLineTool.swift b/Sources/GPTVoice/CommandLineTool.swift
new file mode 100644
index 0000000..e33f715
--- /dev/null
+++ b/Sources/GPTVoice/CommandLineTool.swift
@@ -0,0 +1,82 @@
+import ApplicationServices
+import AVFoundation
+import DictationCore
+import Foundation
+
+/// Command-line modes. Never prompts for permissions and never prints credential values.
+enum CommandLineTool {
+ static var appVersion: String {
+ Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "development"
+ }
+
+ /// Prints status JSON. Reads status only.
+ static func diagnose() -> Int32 {
+ FontRegistration.registerBundledFonts()
+ var result: [String: Any] = [
+ "appVersion": appVersion,
+ "microphone": microphoneName(AVCaptureDevice.authorizationStatus(for: .audio)),
+ "accessibility": AXIsProcessTrusted(),
+ "codexCLIAvailable": CodexAuthentication.cliAvailable,
+ "bundledFonts": FontRegistration.fontAvailability
+ ]
+ do {
+ let credentials = try CodexCredentials.load()
+ result["authAvailable"] = true
+ result["needsRefresh"] = credentials.needsRefresh
+ } catch {
+ result["authAvailable"] = false
+ result["needsRefresh"] = NSNull()
+ result["authError"] = error.localizedDescription
+ }
+ return printJSON(result, to: .standardOutput) ? 0 : 1
+ }
+
+ /// Prints only the transcript to stdout. Failures go to stderr.
+ static func transcribe(path: String) async -> Int32 {
+ let url = URL(fileURLWithPath: path)
+ do {
+ let text = try await TranscriptionClient().transcribe(file: url)
+ FileHandle.standardOutput.write(Data((text + "\n").utf8))
+ return 0
+ } catch {
+ FileHandle.standardError.write(Data((error.localizedDescription + "\n").utf8))
+ return 1
+ }
+ }
+
+ /// Renews the shared sign-in through Codex CLI. Prints success or failure metadata only.
+ static func refreshAuthCheck() async -> Int32 {
+ do {
+ let credentials = try await CodexAuthentication.refresh()
+ _ = printJSON(["ok": true, "needsRefresh": credentials.needsRefresh], to: .standardOutput)
+ return 0
+ } catch {
+ _ = printJSON(["ok": false, "error": error.localizedDescription], to: .standardError)
+ return 1
+ }
+ }
+
+ static func usageError(_ message: String) -> Int32 {
+ FileHandle.standardError.write(Data((message + "\n").utf8))
+ return 2
+ }
+
+ private static func microphoneName(_ status: AVAuthorizationStatus) -> String {
+ switch status {
+ case .authorized: return "authorized"
+ case .denied: return "denied"
+ case .restricted: return "restricted"
+ case .notDetermined: return "notDetermined"
+ @unknown default: return "unknown"
+ }
+ }
+
+ private static func printJSON(_ object: [String: Any], to handle: FileHandle) -> Bool {
+ guard var data = try? JSONSerialization.data(withJSONObject: object, options: [.prettyPrinted, .sortedKeys]) else {
+ return false
+ }
+ data.append(0x0a)
+ handle.write(data)
+ return true
+ }
+}
diff --git a/Sources/GPTVoice/ConnectionPanel.swift b/Sources/GPTVoice/ConnectionPanel.swift
new file mode 100644
index 0000000..4902889
--- /dev/null
+++ b/Sources/GPTVoice/ConnectionPanel.swift
@@ -0,0 +1,77 @@
+import SwiftUI
+
+/// The ChatGPT row, through the shared Codex CLI sign-in. One line when healthy. Recovery text only when needed.
+/// Place inside a SettingsGroup.
+struct ConnectionPanel: View {
+ @ObservedObject var model: AppModel
+ /// True when the sign-in action is the view's single main action.
+ var prominentSignIn = true
+
+ var body: some View {
+ VStack(spacing: 0) {
+ row
+ if let error = model.authError, model.connection != .signingIn, model.connection != .renewing {
+ RowDivider()
+ StatusRow(tone: .problem, symbol: "exclamationmark.triangle.fill",
+ title: "Sign-in did not finish", detail: error) {
+ Button("Try again") { model.signIn() }
+ .buttonStyle(AppButtonStyle(kind: .secondary, small: true))
+ }
+ }
+ }
+ }
+
+ private var cliMissing: Bool {
+ !model.cliAvailable && (model.connection == .missing || model.connection == .unreadable)
+ }
+
+ private var mainKind: AppButtonStyle.Kind { prominentSignIn ? .primary : .secondary }
+
+ @ViewBuilder private var row: some View {
+ switch model.connection {
+ case .checking:
+ StatusRow(tone: .working, symbol: "", title: "Checking ChatGPT sign-in") { EmptyView() }
+ case .connected:
+ StatusRow(tone: .good, symbol: "checkmark.circle.fill", title: "Connected to ChatGPT") {
+ QuietIconButton(symbol: "arrow.clockwise", label: "Check sign-in again") { model.refreshStatus() }
+ }
+ case .expired:
+ StatusRow(tone: .attention, symbol: "clock.fill", title: "ChatGPT sign-in expired",
+ detail: "It renews on your next dictation.") {
+ Button("Renew now") { model.reconnect() }
+ .buttonStyle(AppButtonStyle(kind: .secondary, small: true))
+ }
+ case .renewing:
+ StatusRow(tone: .working, symbol: "", title: "Renewing ChatGPT sign-in") {
+ Button("Cancel") { model.cancelSignIn() }
+ .buttonStyle(AppButtonStyle(kind: .quiet, small: true))
+ }
+ case .signingIn:
+ StatusRow(tone: .working, symbol: "", title: "Waiting for your browser",
+ detail: "Finish signing in to ChatGPT, then come back.") {
+ Button("Cancel") { model.cancelSignIn() }
+ .buttonStyle(AppButtonStyle(kind: .quiet, small: true))
+ }
+ case .missing, .unreadable:
+ if cliMissing {
+ StatusRow(tone: .problem, symbol: "exclamationmark.circle.fill", title: "Codex CLI not installed",
+ detail: "Install Codex CLI to sign in, then check again.") {
+ Button("Install Codex") { model.openInstallCodex() }
+ .buttonStyle(AppButtonStyle(kind: mainKind, small: !prominentSignIn))
+ QuietIconButton(symbol: "arrow.clockwise", label: "Check again") { model.refreshStatus() }
+ }
+ } else if model.connection == .missing {
+ StatusRow(tone: .attention, symbol: "exclamationmark.circle.fill", title: "Not signed in to ChatGPT") {
+ Button("Sign in with ChatGPT") { model.signIn() }
+ .buttonStyle(AppButtonStyle(kind: mainKind, small: !prominentSignIn))
+ }
+ } else {
+ StatusRow(tone: .problem, symbol: "exclamationmark.triangle.fill", title: "ChatGPT sign-in unreadable",
+ detail: "Sign in again to repair it.") {
+ Button("Sign in with ChatGPT") { model.signIn() }
+ .buttonStyle(AppButtonStyle(kind: mainKind, small: !prominentSignIn))
+ }
+ }
+ }
+ }
+}
diff --git a/Sources/GPTVoice/ConnectionStatus.swift b/Sources/GPTVoice/ConnectionStatus.swift
new file mode 100644
index 0000000..777538a
--- /dev/null
+++ b/Sources/GPTVoice/ConnectionStatus.swift
@@ -0,0 +1,52 @@
+import DictationCore
+import Foundation
+
+/// The shared Codex CLI ChatGPT sign-in state. Never holds credentials.
+enum ConnectionStatus: Equatable {
+ case checking
+ case connected
+ /// The token expired. Codex CLI renews it on the next request.
+ case expired
+ case missing
+ case unreadable
+ case signingIn
+ /// Codex CLI is renewing an expired sign-in. No browser is involved.
+ case renewing
+
+ /// Reads auth.json without prompting or renewing.
+ static func current() -> ConnectionStatus {
+ do {
+ return try CodexCredentials.load().needsRefresh ? .expired : .connected
+ } catch DictationError.signInRequired {
+ return .missing
+ } catch {
+ return .unreadable
+ }
+ }
+
+ var isUsable: Bool { self == .connected || self == .expired }
+
+ var title: String {
+ switch self {
+ case .checking: return "Checking sign-in…"
+ case .connected: return "Connected to ChatGPT"
+ case .expired: return "Sign-in expired"
+ case .missing: return "Not signed in"
+ case .unreadable: return "Sign-in data can’t be read"
+ case .signingIn: return "Waiting for browser…"
+ case .renewing: return "Renewing sign-in…"
+ }
+ }
+
+ var detail: String {
+ switch self {
+ case .checking: return ""
+ case .connected: return "This app uses your Codex CLI sign-in."
+ case .expired: return "Codex CLI renews it on your next dictation. Select Reconnect to renew it now."
+ case .missing: return "Sign in with ChatGPT to start dictation."
+ case .unreadable: return "Sign in with ChatGPT again to repair it."
+ case .signingIn: return "Finish sign-in in your browser. Select Cancel to stop."
+ case .renewing: return "Codex CLI is renewing your ChatGPT sign-in."
+ }
+ }
+}
diff --git a/Sources/GPTVoice/DictationFailure.swift b/Sources/GPTVoice/DictationFailure.swift
new file mode 100644
index 0000000..6d7d0e2
--- /dev/null
+++ b/Sources/GPTVoice/DictationFailure.swift
@@ -0,0 +1,83 @@
+import DictationCore
+import Foundation
+
+/// A user-facing failure with one recovery path.
+struct DictationFailure: Equatable {
+ enum Kind: Equatable {
+ case noSpeech
+ case other
+ }
+
+ enum Recovery: Equatable {
+ /// The audio is kept. Retry sends it again.
+ case retry
+ /// The audio is kept. Sign in, then Retry.
+ case signInThenRetry
+ /// Turn on the microphone in System Settings.
+ case microphoneSettings
+ /// Nothing to retry.
+ case none
+ }
+
+ let message: String
+ let recovery: Recovery
+ let overlayMessage: String
+ let kind: Kind
+
+ var keepsAudio: Bool { recovery == .retry || recovery == .signInThenRetry }
+
+ init(message: String, recovery: Recovery, overlayMessage: String = "Dictation stopped", kind: Kind = .other) {
+ self.message = message
+ self.recovery = recovery
+ self.overlayMessage = overlayMessage
+ self.kind = kind
+ }
+
+ /// Maps a transcription error to plain recovery text.
+ init(transcriptionError error: Error) {
+ switch error {
+ case DictationError.signInRequired, DictationError.invalidCredentials,
+ DictationError.refreshFailed, DictationError.service(401):
+ self.init(message: "Your ChatGPT sign-in is missing or expired. Sign in, then select Retry.",
+ recovery: .signInThenRetry, overlayMessage: "Sign in to ChatGPT")
+ case DictationError.refreshUnavailable:
+ self.init(message: "Install Codex CLI and sign in with ChatGPT, then select Retry.",
+ recovery: .signInThenRetry, overlayMessage: "Sign in to ChatGPT")
+ case DictationError.audioTooLarge:
+ self.init(message: "This recording is too large to send. Record a shorter one.", recovery: .none,
+ overlayMessage: "Recording too long")
+ case DictationError.invalidAudio:
+ self.init(message: "The recording could not be read. Record again.", recovery: .none,
+ overlayMessage: "Recording unreadable")
+ case DictationError.emptyTranscript:
+ self.init(message: "No speech found. Try another recording.", recovery: .none,
+ overlayMessage: "No speech found", kind: .noSpeech)
+ case DictationError.service(429):
+ self.init(message: "ChatGPT reached a request limit. Wait a moment, then select Retry.", recovery: .retry,
+ overlayMessage: "Try again in a moment")
+ case let error as DictationError:
+ self.init(message: "\(error.localizedDescription) Select Retry to send the audio again.", recovery: .retry,
+ overlayMessage: "Transcription failed")
+ case is URLError:
+ self.init(message: "ChatGPT could not be reached. Check your network, then select Retry.", recovery: .retry,
+ overlayMessage: "Couldn’t reach ChatGPT")
+ default:
+ self.init(message: "Transcription failed. Select Retry to send the audio again.", recovery: .retry,
+ overlayMessage: "Transcription failed")
+ }
+ }
+
+ init(captureError error: AudioCaptureError, audioKept: Bool) {
+ switch error {
+ case .microphoneDenied:
+ self.init(message: "Microphone access is off. Turn it on in System Settings, then start again.",
+ recovery: .microphoneSettings, overlayMessage: "Microphone access is off")
+ case .deviceFailed where audioKept:
+ self.init(message: "The microphone stopped. Select Retry to transcribe the audio recorded so far.",
+ recovery: .retry, overlayMessage: "Microphone stopped")
+ default:
+ self.init(message: error.localizedDescription + " Start dictation again.", recovery: .none,
+ overlayMessage: "Microphone unavailable")
+ }
+ }
+}
diff --git a/Sources/GPTVoice/DictationOverlayActions.swift b/Sources/GPTVoice/DictationOverlayActions.swift
new file mode 100644
index 0000000..7533197
--- /dev/null
+++ b/Sources/GPTVoice/DictationOverlayActions.swift
@@ -0,0 +1,10 @@
+import Foundation
+
+/// Overlay callbacks. The Appearance preview passes `.preview`, which does nothing.
+struct DictationOverlayActions {
+ var stop: () -> Void
+ var cancel: () -> Void
+ var dismiss: () -> Void
+
+ static let preview = DictationOverlayActions(stop: {}, cancel: {}, dismiss: {})
+}
diff --git a/Sources/GPTVoice/DictationOverlayNotice.swift b/Sources/GPTVoice/DictationOverlayNotice.swift
new file mode 100644
index 0000000..2989d2e
--- /dev/null
+++ b/Sources/GPTVoice/DictationOverlayNotice.swift
@@ -0,0 +1,7 @@
+import Foundation
+
+/// The one-time explanation for copying when Accessibility is unavailable.
+struct DictationOverlayNotice: Equatable {
+ let title: String
+ let message: String
+}
diff --git a/Sources/GPTVoice/DictationOverlayState.swift b/Sources/GPTVoice/DictationOverlayState.swift
new file mode 100644
index 0000000..cfc7c0b
--- /dev/null
+++ b/Sources/GPTVoice/DictationOverlayState.swift
@@ -0,0 +1,68 @@
+import Foundation
+
+/// What the overlay shows. Built from the model, or set explicitly for the Appearance preview.
+enum DictationOverlayState: Equatable {
+ case hidden
+ case recording(elapsed: TimeInterval, level: Float)
+ case working(label: String, cancellable: Bool)
+ case success(label: String)
+ case message(label: String, kind: OverlayMessageKind)
+ case notice(DictationOverlayNotice)
+
+ init(phase: DictationPhase, elapsed: TimeInterval, level: Float, manualPasteHelpDismissed: Bool = true) {
+ switch phase {
+ case .idle:
+ self = .hidden
+ case .preparing:
+ self = .working(label: "Starting", cancellable: true)
+ case .recording:
+ self = .recording(elapsed: elapsed, level: level)
+ case .transcribing:
+ self = .working(label: "Transcribing", cancellable: true)
+ case .pasting:
+ self = .working(label: "Pasting", cancellable: false)
+ case .finished(.pasted):
+ self = .success(label: "Pasted")
+ case .finished(.previewed):
+ self = .success(label: "Preview ready")
+ case .finished(.copied(.accessibilityMissing)) where !manualPasteHelpDismissed:
+ self = .notice(DictationOverlayNotice(title: "Copied to clipboard",
+ message: "Press ⌘V to paste. Allow Accessibility in System Settings for automatic paste."))
+ case .finished(.copied):
+ self = .message(label: "Press ⌘V to paste", kind: .info)
+ case .finished(.preservedNewerClipboard):
+ self = .message(label: "Transcript ready · Copy from menu", kind: .info)
+ case .failed(let failure):
+ self = .message(label: failure.overlayMessage, kind: failure.kind == .noSpeech ? .noSpeech : .warning)
+ }
+ }
+
+ var transitionID: String {
+ switch self {
+ case .hidden: return "hidden"
+ case .recording: return "recording"
+ case .working(let label, _): return "working-\(label)"
+ case .success(let label): return "success-\(label)"
+ case .message(let label, _): return "message-\(label)"
+ case .notice: return "manual-paste-help"
+ }
+ }
+
+ var isHelp: Bool {
+ if case .notice = self { return true }
+ return false
+ }
+
+ var announcement: String? {
+ switch self {
+ case .success(let label), .message(let label, _): return label
+ case .notice(let notice): return "\(notice.title). \(notice.message)"
+ case .hidden, .recording, .working: return nil
+ }
+ }
+
+ static func format(_ seconds: TimeInterval) -> String {
+ let total = Int(seconds)
+ return String(format: "%d:%02d", total / 60, total % 60)
+ }
+}
diff --git a/Sources/GPTVoice/DictationOverlayView.swift b/Sources/GPTVoice/DictationOverlayView.swift
new file mode 100644
index 0000000..d43298e
--- /dev/null
+++ b/Sources/GPTVoice/DictationOverlayView.swift
@@ -0,0 +1,18 @@
+import SwiftUI
+
+/// Renders one overlay state. Shared by the live panel and the Appearance preview.
+struct DictationOverlayView: View {
+ let state: DictationOverlayState
+ let actions: DictationOverlayActions
+
+ var body: some View {
+ switch state {
+ case .notice(let notice):
+ OverlayCard(notice: notice, actions: actions)
+ case .hidden:
+ EmptyView()
+ default:
+ OverlayCapsule(state: state, actions: actions)
+ }
+ }
+}
diff --git a/Sources/GPTVoice/DictationPanel.swift b/Sources/GPTVoice/DictationPanel.swift
new file mode 100644
index 0000000..30a1e3c
--- /dev/null
+++ b/Sources/GPTVoice/DictationPanel.swift
@@ -0,0 +1,24 @@
+import AppKit
+
+/// A floating, nonactivating panel that never takes keyboard focus from the target app.
+final class DictationPanel: NSPanel {
+ init() {
+ super.init(contentRect: NSRect(x: 0, y: 0, width: 400, height: 80),
+ styleMask: [.nonactivatingPanel, .borderless, .fullSizeContentView],
+ backing: .buffered, defer: true)
+ isFloatingPanel = true
+ level = .floating
+ hidesOnDeactivate = false
+ becomesKeyOnlyIfNeeded = true
+ isMovableByWindowBackground = false
+ isOpaque = false
+ backgroundColor = .clear
+ hasShadow = true
+ animationBehavior = .none
+ collectionBehavior = [.moveToActiveSpace, .fullScreenAuxiliary, .transient, .ignoresCycle]
+ setAccessibilityLabel("Dictation status")
+ }
+
+ override var canBecomeKey: Bool { false }
+ override var canBecomeMain: Bool { false }
+}
diff --git a/Sources/GPTVoice/DictationPanelController.swift b/Sources/GPTVoice/DictationPanelController.swift
new file mode 100644
index 0000000..855e0ac
--- /dev/null
+++ b/Sources/GPTVoice/DictationPanelController.swift
@@ -0,0 +1,200 @@
+import AppKit
+import Combine
+import QuartzCore
+import SwiftUI
+
+/// Owns the overlay's frame, timed notices, and interruptible dismissal.
+@MainActor
+final class DictationPanelController: NSObject {
+ private static let edgeInset: CGFloat = 24
+ private let panel: DictationPanel
+ private let hosting: NSHostingView<ThemedRoot<DictationPanelView>>
+ private let presentation: OverlayPresentation
+ private let model: AppModel
+ private let timing: OverlayTiming
+ private let reduceMotion: () -> Bool
+ private var phaseObserver: AnyCancellable?
+ private var meterObserver: AnyCancellable?
+ private var hideTimer: Timer?
+ private var generation = 0
+
+ var isVisible: Bool { panel.isVisible }
+ var isExiting: Bool { presentation.exiting }
+ var opacity: CGFloat { panel.alphaValue }
+ var displayedState: DictationOverlayState { presentation.state }
+ var frame: NSRect { panel.frame }
+ private(set) var targetFrame: NSRect = .zero
+
+ #if DEBUG
+ /// Promo capture only. A fixed screen for the panel, so framing does not follow the pointer.
+ /// nil keeps the production behavior.
+ var promoScreen: NSScreen?
+
+ /// Promo capture only. Feeds meter values into a displayed recording state.
+ /// It does not change the model, resize the panel, or restart timers.
+ func promoSetMeter(elapsed: TimeInterval, level: Float) {
+ guard case .recording = presentation.state, !presentation.exiting else { return }
+ presentation.state = .recording(elapsed: elapsed, level: level)
+ }
+ #endif
+
+ init(model: AppModel, timing: OverlayTiming = OverlayTiming(),
+ reduceMotion: @escaping () -> Bool = { NSWorkspace.shared.accessibilityDisplayShouldReduceMotion }) {
+ self.model = model
+ self.timing = timing
+ self.reduceMotion = reduceMotion
+ let presentation = OverlayPresentation()
+ self.presentation = presentation
+ panel = DictationPanel()
+ hosting = NSHostingView(rootView: ThemedRoot(preferences: model.preferences) {
+ DictationPanelView(presentation: presentation, actions: .preview, timing: timing)
+ })
+ super.init()
+ hosting.sizingOptions = []
+ hosting.autoresizingMask = [.width, .height]
+ hosting.rootView = ThemedRoot(preferences: model.preferences) {
+ DictationPanelView(presentation: presentation, actions: actions, timing: timing)
+ }
+ panel.contentView = hosting
+ phaseObserver = model.$phase.dropFirst().sink { [weak self] phase in
+ self?.update(for: phase)
+ }
+ meterObserver = model.$elapsed.combineLatest(model.$level).sink { [weak self] elapsed, level in
+ guard let self, self.model.phase == .recording,
+ case .recording(let previous, _) = self.presentation.state, elapsed >= previous else { return }
+ self.presentation.state = .recording(elapsed: elapsed, level: level)
+ }
+ update(for: model.phase)
+ }
+
+ /// Called once per operation phase. Meter ticks update content without resizing or restarting timers.
+ func update(for phase: DictationPhase) {
+ generation += 1
+ cancelTimer()
+ if phase == .idle {
+ hide()
+ return
+ }
+ let state = DictationOverlayState(phase: phase, elapsed: model.elapsed, level: model.level,
+ manualPasteHelpDismissed: model.preferences.manualPasteHelpDismissed)
+ show(state)
+ if let hold = timing.hold(for: state) {
+ let timer = Timer(timeInterval: hold, target: self, selector: #selector(hideTimerFired(_:)),
+ userInfo: nil, repeats: false)
+ hideTimer = timer
+ RunLoop.main.add(timer, forMode: .common)
+ }
+ }
+
+ func dismissHelp() {
+ guard presentation.state.isHelp else { return }
+ model.preferences.manualPasteHelpDismissed = true
+ generation += 1
+ cancelTimer()
+ hide()
+ }
+
+ func shutdown() {
+ generation += 1
+ cancelTimer()
+ phaseObserver?.cancel()
+ meterObserver?.cancel()
+ panel.orderOut(nil)
+ presentation.state = .hidden
+ presentation.exiting = false
+ }
+
+ private var actions: DictationOverlayActions {
+ DictationOverlayActions(stop: { [weak model] in model?.stopDictation() },
+ cancel: { [weak model] in
+ guard let model, model.phase.canCancel else { return }
+ model.cancel()
+ },
+ dismiss: { [weak self] in self?.dismissHelp() })
+ }
+
+ @objc private func hideTimerFired(_ timer: Timer) {
+ guard timer === hideTimer else { return }
+ hideTimer = nil
+ if presentation.state.isHelp { model.preferences.manualPasteHelpDismissed = true }
+ hide()
+ }
+
+ private func cancelTimer() {
+ hideTimer?.invalidate()
+ hideTimer = nil
+ }
+
+ private func show(_ state: DictationOverlayState) {
+ let wasVisible = panel.isVisible
+ let size = measure(state)
+ let mouse = NSEvent.mouseLocation
+ #if DEBUG
+ let preferredScreen = promoScreen
+ #else
+ let preferredScreen: NSScreen? = nil
+ #endif
+ let screen = wasVisible ? panel.screen
+ : preferredScreen ?? NSScreen.screens.first { NSMouseInRect(mouse, $0.frame, false) } ?? NSScreen.main
+ let visible = screen?.visibleFrame ?? NSRect(x: 0, y: 0, width: 1024, height: 768)
+ let y = model.preferences.overlayPlacement == .top
+ ? visible.maxY - Self.edgeInset - size.height : visible.minY + Self.edgeInset
+ targetFrame = NSRect(x: visible.midX - size.width / 2, y: y, width: size.width, height: size.height)
+ presentation.exiting = false
+ presentation.state = state
+
+ let reduced = reduceMotion()
+ if wasVisible && !reduced {
+ NSAnimationContext.runAnimationGroup { context in
+ context.duration = timing.resize
+ context.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut)
+ panel.animator().setFrame(targetFrame, display: true)
+ panel.animator().alphaValue = 1
+ }
+ } else {
+ panel.setFrame(targetFrame, display: true)
+ if !wasVisible { panel.alphaValue = 0 }
+ panel.orderFrontRegardless()
+ NSAnimationContext.runAnimationGroup { context in
+ context.duration = reduced ? timing.reducedFade : timing.entrance
+ panel.animator().alphaValue = 1
+ }
+ }
+ if let announcement = state.announcement {
+ NSAccessibility.post(element: NSApplication.shared, notification: .announcementRequested,
+ userInfo: [.announcement: announcement,
+ .priority: NSAccessibilityPriorityLevel.high.rawValue])
+ }
+ }
+
+ private func measure(_ state: DictationOverlayState) -> NSSize {
+ let view = NSHostingView(rootView: ThemedRoot(preferences: model.preferences) {
+ DictationOverlayView(state: state, actions: .preview)
+ })
+ view.layoutSubtreeIfNeeded()
+ let size = view.fittingSize
+ return NSSize(width: ceil(size.width), height: ceil(size.height))
+ }
+
+ private func hide() {
+ guard panel.isVisible else { return }
+ let current = generation
+ presentation.exiting = true
+ NSAnimationContext.runAnimationGroup { context in
+ context.duration = reduceMotion() ? timing.reducedFade : timing.exit
+ context.timingFunction = CAMediaTimingFunction(name: .easeOut)
+ panel.animator().alphaValue = 0
+ } completionHandler: { [weak self] in
+ DispatchQueue.main.async {
+ self?.finishHide(generation: current)
+ }
+ }
+ }
+
+ private func finishHide(generation: Int) {
+ guard self.generation == generation, presentation.exiting else { return }
+ panel.orderOut(nil)
+ presentation.state = .hidden
+ presentation.exiting = false
+ }
+}
diff --git a/Sources/GPTVoice/DictationPanelView.swift b/Sources/GPTVoice/DictationPanelView.swift
new file mode 100644
index 0000000..506fd52
--- /dev/null
+++ b/Sources/GPTVoice/DictationPanelView.swift
@@ -0,0 +1,44 @@
+import SwiftUI
+
+/// Keeps one surface while the window resizes and the content cross-fades.
+struct DictationPanelView: View {
+ @ObservedObject var presentation: OverlayPresentation
+ let actions: DictationOverlayActions
+ let timing: OverlayTiming
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+
+ var body: some View {
+ GeometryReader { _ in
+ ZStack {
+ content
+ .id(presentation.state.transitionID)
+ .transition(OverlayContentTransition.transition(reduceMotion: reduceMotion))
+ }
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ .animation(.easeOut(duration: reduceMotion ? timing.reducedFade : timing.resize),
+ value: presentation.state.transitionID)
+ .blur(radius: presentation.exiting && !reduceMotion ? 2.5 : 0)
+ .animation(.easeOut(duration: reduceMotion ? timing.reducedFade : timing.exit),
+ value: presentation.exiting)
+ .modifier(OverlaySurface(shape: RoundedRectangle(cornerRadius: presentation.state.isHelp ? 14 : 20,
+ style: .continuous)))
+ }
+ .ignoresSafeArea()
+ .accessibilityElement(children: .contain)
+ .accessibilityLabel("Dictation status")
+ }
+
+ @ViewBuilder private var content: some View {
+ if case .notice(let notice) = presentation.state {
+ OverlayHelpContent(notice: notice, dismiss: actions.dismiss)
+ } else {
+ HStack(spacing: 10) {
+ OverlayCapsuleContent(state: presentation.state, actions: actions)
+ }
+ .padding(.leading, 14)
+ .padding(.trailing, 8)
+ .frame(height: 40)
+ .fixedSize(horizontal: true, vertical: false)
+ }
+ }
+}
diff --git a/Sources/GPTVoice/DictationPhase.swift b/Sources/GPTVoice/DictationPhase.swift
new file mode 100644
index 0000000..74f5cef
--- /dev/null
+++ b/Sources/GPTVoice/DictationPhase.swift
@@ -0,0 +1,40 @@
+import Foundation
+
+/// The single dictation operation state. Only one operation runs at a time.
+enum DictationPhase: Equatable {
+ case idle
+ /// Waiting for microphone permission or a pending clipboard lease.
+ case preparing
+ case recording
+ case transcribing
+ case pasting
+ case finished(PasteOutcome)
+ case failed(DictationFailure)
+
+ /// True while an operation owns the microphone, network, or clipboard.
+ var isBusy: Bool {
+ switch self {
+ case .preparing, .recording, .transcribing, .pasting: return true
+ case .idle, .finished, .failed: return false
+ }
+ }
+
+ var canCancel: Bool {
+ switch self {
+ case .preparing, .recording, .transcribing: return true
+ default: return false
+ }
+ }
+
+ var statusText: String {
+ switch self {
+ case .idle: return "Ready"
+ case .preparing: return "Getting ready…"
+ case .recording: return "Listening…"
+ case .transcribing: return "Transcribing…"
+ case .pasting: return "Pasting…"
+ case .finished(let outcome): return outcome.message
+ case .failed(let failure): return failure.message
+ }
+ }
+}
diff --git a/Sources/GPTVoice/EnvironmentValues+appAccent.swift b/Sources/GPTVoice/EnvironmentValues+appAccent.swift
new file mode 100644
index 0000000..2c3a4fe
--- /dev/null
+++ b/Sources/GPTVoice/EnvironmentValues+appAccent.swift
@@ -0,0 +1,9 @@
+import SwiftUI
+
+extension EnvironmentValues {
+ /// The selected accent, foreground role: icons and indicators. For fills behind white content use `appAccentFill`.
+ var appAccent: Color {
+ get { self[AppAccentKey.self] }
+ set { self[AppAccentKey.self] = newValue }
+ }
+}
diff --git a/Sources/GPTVoice/EnvironmentValues+appAccentFill.swift b/Sources/GPTVoice/EnvironmentValues+appAccentFill.swift
new file mode 100644
index 0000000..f6f1f19
--- /dev/null
+++ b/Sources/GPTVoice/EnvironmentValues+appAccentFill.swift
@@ -0,0 +1,9 @@
+import SwiftUI
+
+extension EnvironmentValues {
+ /// The selected accent for fills behind white labels or symbols.
+ var appAccentFill: Color {
+ get { self[AppAccentFillKey.self] }
+ set { self[AppAccentFillKey.self] = newValue }
+ }
+}
diff --git a/Sources/GPTVoice/EnvironmentValues+appAccentOnFill.swift b/Sources/GPTVoice/EnvironmentValues+appAccentOnFill.swift
new file mode 100644
index 0000000..11e4c47
--- /dev/null
+++ b/Sources/GPTVoice/EnvironmentValues+appAccentOnFill.swift
@@ -0,0 +1,9 @@
+import SwiftUI
+
+extension EnvironmentValues {
+ /// Text and symbol color for content placed on `appAccentFill`.
+ var appAccentOnFill: Color {
+ get { self[AppAccentOnFillKey.self] }
+ set { self[AppAccentOnFillKey.self] = newValue }
+ }
+}
diff --git a/Sources/GPTVoice/ErrorMessage.swift b/Sources/GPTVoice/ErrorMessage.swift
new file mode 100644
index 0000000..1b7f701
--- /dev/null
+++ b/Sources/GPTVoice/ErrorMessage.swift
@@ -0,0 +1,15 @@
+import SwiftUI
+
+/// Inline problem text with a symbol. It stays visible until the state changes.
+struct ErrorMessage: View {
+ let text: String
+
+ var body: some View {
+ HStack(alignment: .firstTextBaseline, spacing: 8) {
+ Image(systemName: "exclamationmark.triangle.fill").foregroundStyle(AppPalette.problem)
+ Text(text).font(AppType.detail).fixedSize(horizontal: false, vertical: true)
+ }
+ .accessibilityElement(children: .combine)
+ .accessibilityLabel("Problem: \(text)")
+ }
+}
diff --git a/Sources/GPTVoice/FontRegistration.swift b/Sources/GPTVoice/FontRegistration.swift
new file mode 100644
index 0000000..ed0375d
--- /dev/null
+++ b/Sources/GPTVoice/FontRegistration.swift
@@ -0,0 +1,28 @@
+import AppKit
+import CoreText
+import Foundation
+
+enum FontRegistration {
+ static var fontAvailability: [String: Bool] {
+ ["FTRegolaNeue-Regular", "FTRegolaNeue-Medium", "FTRegolaNeue-Semibold"].reduce(into: [:]) { result, name in
+ result[name] = NSFont(name: name, size: 16)?.fontName == name
+ }
+ }
+
+ static func registerBundledFonts() {
+ // SwiftPM's generated accessor searches beside the executable. App bundles keep resources
+ // in Contents/Resources, so resolve that location before the development-build fallback.
+ let resources: URL?
+ if Bundle.main.bundleURL.pathExtension == "app" {
+ resources = Bundle.main.url(forResource: "GPTVoice_GPTVoice", withExtension: "bundle")
+ .flatMap { Bundle(url: $0)?.resourceURL }
+ } else {
+ resources = Bundle.module.resourceURL
+ }
+ guard let root = resources?.appendingPathComponent("Fonts"),
+ let files = try? FileManager.default.contentsOfDirectory(at: root, includingPropertiesForKeys: nil) else { return }
+ for file in files where ["ttf", "otf"].contains(file.pathExtension.lowercased()) {
+ CTFontManagerRegisterFontsForURL(file as CFURL, .process, nil)
+ }
+ }
+}
diff --git a/Sources/GPTVoice/GPTVoiceEntryPoint.swift b/Sources/GPTVoice/GPTVoiceEntryPoint.swift
new file mode 100644
index 0000000..ddef126
--- /dev/null
+++ b/Sources/GPTVoice/GPTVoiceEntryPoint.swift
@@ -0,0 +1,74 @@
+import AppKit
+
+/// Routes command-line modes, or runs the menu bar app.
+@main
+struct GPTVoiceEntryPoint {
+ @MainActor
+ static func main() {
+ let arguments = Array(CommandLine.arguments.dropFirst())
+ var launchOptions = LaunchOptions.normal
+
+ switch arguments.first {
+ case "--diagnose":
+ exit(CommandLineTool.diagnose())
+ case "--transcribe":
+ guard let path = value(after: "--transcribe", in: arguments) else {
+ exit(CommandLineTool.usageError("Usage: GPTVoice --transcribe FILE"))
+ }
+ runAsync { await CommandLineTool.transcribe(path: path) }
+ case "--refresh-auth-check":
+ runAsync { await CommandLineTool.refreshAuthCheck() }
+ case "--show-onboarding":
+ launchOptions = .showOnboarding
+ case "--show-settings":
+ launchOptions = .showSettings
+ case "--transcribe-and-paste":
+ guard let path = value(after: "--transcribe-and-paste", in: arguments) else {
+ exit(CommandLineTool.usageError("Usage: GPTVoice --transcribe-and-paste FILE"))
+ }
+ launchOptions = .transcribeAndPaste(URL(fileURLWithPath: path))
+ case "--practice-audio":
+ guard let path = value(after: "--practice-audio", in: arguments) else {
+ exit(CommandLineTool.usageError("Usage: GPTVoice --practice-audio FILE"))
+ }
+ launchOptions = .practiceAudio(URL(fileURLWithPath: path))
+ case nil:
+ break
+ default:
+ if arguments.first?.hasPrefix("-psn") != true {
+ exit(CommandLineTool.usageError(
+ "Options: --diagnose, --transcribe FILE, --refresh-auth-check, --show-onboarding, "
+ + "--show-settings, --transcribe-and-paste FILE, --practice-audio FILE"))
+ }
+ }
+
+ if SingleInstance.forwardToRunningInstance(launchOptions) {
+ exit(0)
+ }
+ runApplication(launchOptions)
+ }
+
+ /// Runs the GUI app. Synchronous on the main actor.
+ @MainActor
+ private static func runApplication(_ options: LaunchOptions) {
+ FontRegistration.registerBundledFonts()
+ let app = NSApplication.shared
+ let delegate = AppDelegate(options: options)
+ app.delegate = delegate
+ app.setActivationPolicy(.accessory)
+ app.run()
+ // NSApplication holds the delegate weakly. Keep it alive for the whole run.
+ withExtendedLifetime(delegate) {}
+ }
+
+ /// Runs one async CLI operation, then exits with its status.
+ private static func runAsync(_ work: @escaping () async -> Int32) -> Never {
+ Task { exit(await work()) }
+ dispatchMain()
+ }
+
+ private static func value(after flag: String, in arguments: [String]) -> String? {
+ guard let index = arguments.firstIndex(of: flag), arguments.indices.contains(index + 1) else { return nil }
+ return arguments[index + 1]
+ }
+}
diff --git a/Sources/GPTVoice/GlobalShortcut.swift b/Sources/GPTVoice/GlobalShortcut.swift
new file mode 100644
index 0000000..575b172
--- /dev/null
+++ b/Sources/GPTVoice/GlobalShortcut.swift
@@ -0,0 +1,129 @@
+import Carbon.HIToolbox
+import Foundation
+
+/// Registers one global hotkey with Carbon `RegisterEventHotKey`.
+/// No event tap is used, so Input Monitoring permission is not needed.
+@MainActor
+final class GlobalShortcut {
+ enum RegistrationError: LocalizedError, Equatable {
+ case invalid(HotkeySpec.Problem)
+ case conflict
+ case systemShortcut(HotkeySpec)
+ case system(OSStatus)
+
+ var errorDescription: String? {
+ switch self {
+ case .invalid(let problem): return problem.message
+ case .conflict: return "Another app uses this shortcut. Choose another one."
+ case .systemShortcut(let spec):
+ return spec == .commandSpace
+ ? "Spotlight uses Command–Space. Turn off or change that shortcut in System Settings → Keyboard → Keyboard Shortcuts → Spotlight, then try again."
+ : "macOS uses this shortcut. Change it in System Settings → Keyboard → Keyboard Shortcuts, then try again."
+ case .system(let status): return "macOS could not register this shortcut (error \(status))."
+ }
+ }
+ }
+
+ private static let signature: OSType = 0x4344_6374 // "CDct"
+
+ private(set) var current: HotkeySpec?
+ private var currentRef: EventHotKeyRef?
+ private var currentID: UInt32 = 0
+ private var nextID: UInt32 = 1
+ private var handlerRef: EventHandlerRef?
+ private let onPress: @MainActor () -> Void
+
+ init(onPress: @escaping @MainActor () -> Void) {
+ self.onPress = onPress
+ installHandler()
+ }
+
+ deinit {
+ if let currentRef { UnregisterEventHotKey(currentRef) }
+ if let handlerRef { RemoveEventHandler(handlerRef) }
+ }
+
+ /// Registers `spec` as the active shortcut. The previous shortcut stays
+ /// active when the new registration fails.
+ func replace(with spec: HotkeySpec) throws {
+ if let problem = spec.problem { throw RegistrationError.invalid(problem) }
+ if Self.isSystemShortcutEnabled(spec) { throw RegistrationError.systemShortcut(spec) }
+ if spec == current, currentRef != nil { return }
+
+ let previousRef = currentRef
+ // The same combination cannot register twice. Release it first, and put it back on failure.
+ let sameCombination = previousRef != nil && current.map {
+ $0.keyCode == spec.keyCode && $0.modifiers == spec.modifiers
+ } == true
+ if sameCombination, let previousRef {
+ UnregisterEventHotKey(previousRef)
+ currentRef = nil
+ }
+
+ let id = nextID
+ nextID &+= 1
+ var ref: EventHotKeyRef?
+ let status = RegisterEventHotKey(spec.keyCode, spec.modifiers,
+ EventHotKeyID(signature: Self.signature, id: id),
+ GetApplicationEventTarget(), OptionBits(kEventHotKeyExclusive), &ref)
+ guard status == noErr, let ref else {
+ if sameCombination, let old = current { restore(old) }
+ throw status == OSStatus(eventHotKeyExistsErr) ? RegistrationError.conflict : RegistrationError.system(status)
+ }
+ if !sameCombination, let previousRef { UnregisterEventHotKey(previousRef) }
+ currentRef = ref
+ currentID = id
+ current = spec
+ }
+
+ /// Removes the active shortcut.
+ func unregister() {
+ if let currentRef { UnregisterEventHotKey(currentRef) }
+ currentRef = nil
+ current = nil
+ }
+
+ private func restore(_ spec: HotkeySpec) {
+ var ref: EventHotKeyRef?
+ let status = RegisterEventHotKey(spec.keyCode, spec.modifiers,
+ EventHotKeyID(signature: Self.signature, id: currentID),
+ GetApplicationEventTarget(), OptionBits(kEventHotKeyExclusive), &ref)
+ if status == noErr { currentRef = ref } else { current = nil }
+ }
+
+ fileprivate func handlePress(id: UInt32) {
+ guard id == currentID, currentRef != nil else { return }
+ onPress()
+ }
+
+ static func isSystemShortcutEnabled(_ spec: HotkeySpec) -> Bool {
+ var shortcuts: Unmanaged<CFArray>?
+ guard CopySymbolicHotKeys(&shortcuts) == noErr,
+ let entries = shortcuts?.takeRetainedValue() as? [[String: Any]] else { return false }
+ return entries.contains { entry in
+ guard (entry[kHISymbolicHotKeyEnabled] as? NSNumber)?.boolValue == true,
+ let code = entry[kHISymbolicHotKeyCode] as? NSNumber,
+ let modifiers = entry[kHISymbolicHotKeyModifiers] as? NSNumber else { return false }
+ return HotkeySpec(keyCode: code.uint32Value, modifiers: modifiers.uint32Value) == spec
+ }
+ }
+
+ private func installHandler() {
+ var eventType = EventTypeSpec(eventClass: OSType(kEventClassKeyboard), eventKind: UInt32(kEventHotKeyPressed))
+ let context = Unmanaged.passUnretained(self).toOpaque()
+ InstallEventHandler(GetApplicationEventTarget(), { _, event, userData in
+ guard let event, let userData else { return OSStatus(eventNotHandledErr) }
+ var hotKeyID = EventHotKeyID()
+ let status = GetEventParameter(event, EventParamName(kEventParamDirectObject),
+ EventParamType(typeEventHotKeyID), nil,
+ MemoryLayout<EventHotKeyID>.size, nil, &hotKeyID)
+ guard status == noErr, hotKeyID.signature == GlobalShortcut.signature else {
+ return OSStatus(eventNotHandledErr)
+ }
+ let shortcut = Unmanaged<GlobalShortcut>.fromOpaque(userData).takeUnretainedValue()
+ let id = hotKeyID.id
+ DispatchQueue.main.async { shortcut.handlePress(id: id) }
+ return noErr
+ }, 1, &eventType, context, &handlerRef)
+ }
+}
diff --git a/Sources/GPTVoice/HomePage.swift b/Sources/GPTVoice/HomePage.swift
new file mode 100644
index 0000000..ce5d0c4
--- /dev/null
+++ b/Sources/GPTVoice/HomePage.swift
@@ -0,0 +1,41 @@
+import SwiftUI
+
+/// Home: each state shown once with its action, then the current shortcut and one line of instruction.
+struct HomePage: View {
+ @ObservedObject var model: AppModel
+ @ObservedObject var preferences: AppPreferences
+ let goTo: (SettingsPage) -> Void
+
+ init(model: AppModel, goTo: @escaping (SettingsPage) -> Void) {
+ self.model = model
+ self.preferences = model.preferences
+ self.goTo = goTo
+ }
+
+ var body: some View {
+ let ready = model.missingRequirements.isEmpty
+ VStack(alignment: .leading, spacing: 24) {
+ SettingsGroup(footnote: ready
+ ? "Press \(preferences.hotkey.displayLabel) in any app to start. Press it again to stop."
+ : "Dictation works once the items marked here are fixed.") {
+ ConnectionPanel(model: model, prominentSignIn: false)
+ .disabled(!model.canChangeSettings)
+ RowDivider()
+ MicrophoneCard(model: model, prominent: false)
+ RowDivider()
+ AccessibilityCard(model: model)
+ RowDivider()
+ SettingsRow(title: "Shortcut", showsDivider: false) {
+ HStack(spacing: 8) {
+ KeycapsView(spec: preferences.hotkey)
+ Button("Change") { goTo(.shortcuts) }
+ .buttonStyle(AppButtonStyle(kind: .quiet, small: true))
+ }
+ }
+ }
+
+ InfoDisclosure(label: "How dictation works",
+ text: "Click where you want the text. Press your shortcut and speak. Press it again to finish. With automatic paste, the text goes where you clicked. Otherwise it is copied and you press ⌘V.")
+ }
+ }
+}
diff --git a/Sources/GPTVoice/HostingWindowController.swift b/Sources/GPTVoice/HostingWindowController.swift
new file mode 100644
index 0000000..b64e9ce
--- /dev/null
+++ b/Sources/GPTVoice/HostingWindowController.swift
@@ -0,0 +1,53 @@
+import AppKit
+import SwiftUI
+
+/// A window that hosts one SwiftUI view with integrated chrome: content runs under a hidden, transparent
+/// title bar, and the real traffic-light buttons sit at the top left of the custom header.
+/// Showing it activates the app because the user asked for it.
+@MainActor
+final class HostingWindowController: NSWindowController, NSWindowDelegate {
+ /// Height of the header strip that holds the traffic lights. Views keep this area free of controls.
+ static let chromeHeight: CGFloat = 52
+
+ private let onClose: () -> Void
+
+ init<Content: View>(title: String, size: NSSize, minSize: NSSize = NSSize(width: 640, height: 520),
+ rootView: Content, onClose: @escaping () -> Void) {
+ self.onClose = onClose
+ let window = NSWindow(contentRect: NSRect(origin: .zero, size: size),
+ styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView],
+ backing: .buffered, defer: false)
+ // The title stays set for the Window menu, Mission Control, and VoiceOver. It is not drawn.
+ window.title = title
+ window.titleVisibility = .hidden
+ window.titlebarAppearsTransparent = true
+ window.titlebarSeparatorStyle = .none
+ window.toolbar = nil
+ window.isMovableByWindowBackground = false
+ window.backgroundColor = AppPalette.nsCanvas
+ window.isReleasedWhenClosed = false
+ // Open on the user's current desktop instead of switching to the Space where it was last shown.
+ window.collectionBehavior.insert(.moveToActiveSpace)
+ window.contentMinSize = minSize
+ let hosting = NSHostingController(rootView: rootView.ignoresSafeArea())
+ window.contentViewController = hosting
+ window.setContentSize(size)
+ window.center()
+ super.init(window: window)
+ window.delegate = self
+ }
+
+ required init?(coder: NSCoder) { nil }
+
+ func present() {
+ NSApp.activate(ignoringOtherApps: true)
+ showWindow(nil)
+ window?.makeKeyAndOrderFront(nil)
+ }
+
+ func windowWillClose(_ notification: Notification) {
+ // Ends a shortcut capture so the saved shortcut is registered again.
+ window?.makeFirstResponder(nil)
+ onClose()
+ }
+}
diff --git a/Sources/GPTVoice/HotkeySpec.swift b/Sources/GPTVoice/HotkeySpec.swift
new file mode 100644
index 0000000..1904d7c
--- /dev/null
+++ b/Sources/GPTVoice/HotkeySpec.swift
@@ -0,0 +1,149 @@
+import AppKit
+import Carbon.HIToolbox
+
+/// A global keyboard shortcut: one virtual key code plus Carbon modifier flags.
+struct HotkeySpec: Codable, Equatable, Hashable {
+ enum Problem: Equatable {
+ case needsModifier
+ case modifierOnly
+ case reserved
+
+ var message: String {
+ switch self {
+ case .needsModifier: return "Use Control, Option, or Command with a key."
+ case .modifierOnly: return "Add a key to the modifiers."
+ case .reserved: return "macOS uses this shortcut. Choose another one."
+ }
+ }
+ }
+
+ let keyCode: UInt32
+ let modifiers: UInt32
+
+ static let `default` = HotkeySpec(keyCode: UInt32(kVK_Space), modifiers: UInt32(controlKey | optionKey))
+ static let commandSpace = HotkeySpec(keyCode: UInt32(kVK_Space), modifiers: UInt32(cmdKey))
+
+ init(keyCode: UInt32, modifiers: UInt32) {
+ self.keyCode = keyCode
+ self.modifiers = modifiers & Self.supportedModifiers
+ }
+
+ /// Builds a shortcut from an AppKit key event's code and modifier flags.
+ init(keyCode: UInt16, cocoaModifiers flags: NSEvent.ModifierFlags) {
+ var carbon: UInt32 = 0
+ if flags.contains(.control) { carbon |= UInt32(controlKey) }
+ if flags.contains(.option) { carbon |= UInt32(optionKey) }
+ if flags.contains(.shift) { carbon |= UInt32(shiftKey) }
+ if flags.contains(.command) { carbon |= UInt32(cmdKey) }
+ self.init(keyCode: UInt32(keyCode), modifiers: carbon)
+ }
+
+ private static let supportedModifiers = UInt32(controlKey | optionKey | shiftKey | cmdKey)
+ private static let primaryModifiers = UInt32(controlKey | optionKey | cmdKey)
+
+ private static let modifierKeyCodes: Set<UInt32> = [
+ kVK_Command, kVK_RightCommand, kVK_Shift, kVK_RightShift, kVK_Option, kVK_RightOption,
+ kVK_Control, kVK_RightControl, kVK_CapsLock, kVK_Function
+ ].reduce(into: []) { $0.insert(UInt32($1)) }
+
+ private static let reservedShortcuts: Set<HotkeySpec> = [
+ HotkeySpec(keyCode: UInt32(kVK_Tab), modifiers: UInt32(cmdKey)),
+ HotkeySpec(keyCode: UInt32(kVK_Tab), modifiers: UInt32(cmdKey | shiftKey)),
+ HotkeySpec(keyCode: UInt32(kVK_ANSI_Grave), modifiers: UInt32(cmdKey)),
+ HotkeySpec(keyCode: UInt32(kVK_ANSI_Q), modifiers: UInt32(cmdKey)),
+ HotkeySpec(keyCode: UInt32(kVK_ANSI_W), modifiers: UInt32(cmdKey)),
+ HotkeySpec(keyCode: UInt32(kVK_ANSI_H), modifiers: UInt32(cmdKey)),
+ HotkeySpec(keyCode: UInt32(kVK_ANSI_M), modifiers: UInt32(cmdKey)),
+ HotkeySpec(keyCode: UInt32(kVK_ANSI_C), modifiers: UInt32(cmdKey)),
+ HotkeySpec(keyCode: UInt32(kVK_ANSI_V), modifiers: UInt32(cmdKey)),
+ HotkeySpec(keyCode: UInt32(kVK_ANSI_X), modifiers: UInt32(cmdKey)),
+ HotkeySpec(keyCode: UInt32(kVK_ANSI_Z), modifiers: UInt32(cmdKey)),
+ HotkeySpec(keyCode: UInt32(kVK_ANSI_A), modifiers: UInt32(cmdKey)),
+ HotkeySpec(keyCode: UInt32(kVK_ANSI_Q), modifiers: UInt32(cmdKey | controlKey)),
+ HotkeySpec(keyCode: UInt32(kVK_ANSI_Q), modifiers: UInt32(cmdKey | shiftKey)),
+ HotkeySpec(keyCode: UInt32(kVK_ANSI_3), modifiers: UInt32(cmdKey | shiftKey)),
+ HotkeySpec(keyCode: UInt32(kVK_ANSI_4), modifiers: UInt32(cmdKey | shiftKey)),
+ HotkeySpec(keyCode: UInt32(kVK_ANSI_5), modifiers: UInt32(cmdKey | shiftKey)),
+ HotkeySpec(keyCode: UInt32(kVK_ANSI_F), modifiers: UInt32(cmdKey | controlKey)),
+ HotkeySpec(keyCode: UInt32(kVK_Escape), modifiers: UInt32(cmdKey | optionKey))
+ ]
+
+ /// The first reason this shortcut cannot be used, or nil when it is acceptable.
+ var problem: Problem? {
+ if Self.modifierKeyCodes.contains(keyCode) { return .modifierOnly }
+ if modifiers & Self.primaryModifiers == 0 { return .needsModifier }
+ if Self.reservedShortcuts.contains(self) { return .reserved }
+ return nil
+ }
+
+ var isValid: Bool { problem == nil }
+
+ /// Modifier symbols in macOS order, then the key name. For keycap display.
+ var keycaps: [String] {
+ var caps: [String] = []
+ if modifiers & UInt32(controlKey) != 0 { caps.append("⌃") }
+ if modifiers & UInt32(optionKey) != 0 { caps.append("⌥") }
+ if modifiers & UInt32(shiftKey) != 0 { caps.append("⇧") }
+ if modifiers & UInt32(cmdKey) != 0 { caps.append("⌘") }
+ caps.append(keyName)
+ return caps
+ }
+
+ /// Compact label, for example "⌃⌥Space".
+ var displayLabel: String { keycaps.joined() }
+
+ /// Spoken label for VoiceOver, for example "Control Option Space".
+ var accessibilityLabel: String {
+ var words: [String] = []
+ if modifiers & UInt32(controlKey) != 0 { words.append("Control") }
+ if modifiers & UInt32(optionKey) != 0 { words.append("Option") }
+ if modifiers & UInt32(shiftKey) != 0 { words.append("Shift") }
+ if modifiers & UInt32(cmdKey) != 0 { words.append("Command") }
+ words.append(keyName)
+ return words.joined(separator: " ")
+ }
+
+ /// AppKit modifier flags, for menu item shortcut hints.
+ var cocoaModifiers: NSEvent.ModifierFlags {
+ var flags: NSEvent.ModifierFlags = []
+ if modifiers & UInt32(controlKey) != 0 { flags.insert(.control) }
+ if modifiers & UInt32(optionKey) != 0 { flags.insert(.option) }
+ if modifiers & UInt32(shiftKey) != 0 { flags.insert(.shift) }
+ if modifiers & UInt32(cmdKey) != 0 { flags.insert(.command) }
+ return flags
+ }
+
+ /// A menu key equivalent string, or nil when the key has no single-character form.
+ var menuKeyEquivalent: String? {
+ if Int(keyCode) == kVK_Space { return " " }
+ let name = keyName
+ return name.count == 1 && name.allSatisfy(\.isASCII) ? name.lowercased() : nil
+ }
+
+ var keyName: String {
+ Self.keyNames[Int(keyCode)] ?? "Key \(keyCode)"
+ }
+
+ private static let keyNames: [Int: String] = [
+ kVK_Space: "Space", kVK_Return: "Return", kVK_Tab: "Tab", kVK_Delete: "Delete",
+ kVK_ForwardDelete: "Forward Delete", kVK_Escape: "Esc",
+ kVK_LeftArrow: "←", kVK_RightArrow: "→", kVK_UpArrow: "↑", kVK_DownArrow: "↓",
+ kVK_Home: "Home", kVK_End: "End", kVK_PageUp: "Page Up", kVK_PageDown: "Page Down",
+ kVK_F1: "F1", kVK_F2: "F2", kVK_F3: "F3", kVK_F4: "F4", kVK_F5: "F5", kVK_F6: "F6",
+ kVK_F7: "F7", kVK_F8: "F8", kVK_F9: "F9", kVK_F10: "F10", kVK_F11: "F11", kVK_F12: "F12",
+ kVK_F13: "F13", kVK_F14: "F14", kVK_F15: "F15", kVK_F16: "F16", kVK_F17: "F17",
+ kVK_F18: "F18", kVK_F19: "F19", kVK_F20: "F20",
+ kVK_ANSI_A: "A", kVK_ANSI_B: "B", kVK_ANSI_C: "C", kVK_ANSI_D: "D", kVK_ANSI_E: "E",
+ kVK_ANSI_F: "F", kVK_ANSI_G: "G", kVK_ANSI_H: "H", kVK_ANSI_I: "I", kVK_ANSI_J: "J",
+ kVK_ANSI_K: "K", kVK_ANSI_L: "L", kVK_ANSI_M: "M", kVK_ANSI_N: "N", kVK_ANSI_O: "O",
+ kVK_ANSI_P: "P", kVK_ANSI_Q: "Q", kVK_ANSI_R: "R", kVK_ANSI_S: "S", kVK_ANSI_T: "T",
+ kVK_ANSI_U: "U", kVK_ANSI_V: "V", kVK_ANSI_W: "W", kVK_ANSI_X: "X", kVK_ANSI_Y: "Y",
+ kVK_ANSI_Z: "Z",
+ kVK_ANSI_0: "0", kVK_ANSI_1: "1", kVK_ANSI_2: "2", kVK_ANSI_3: "3", kVK_ANSI_4: "4",
+ kVK_ANSI_5: "5", kVK_ANSI_6: "6", kVK_ANSI_7: "7", kVK_ANSI_8: "8", kVK_ANSI_9: "9",
+ kVK_ANSI_Minus: "-", kVK_ANSI_Equal: "=", kVK_ANSI_LeftBracket: "[",
+ kVK_ANSI_RightBracket: "]", kVK_ANSI_Backslash: "\\", kVK_ANSI_Semicolon: ";",
+ kVK_ANSI_Quote: "'", kVK_ANSI_Comma: ",", kVK_ANSI_Period: ".", kVK_ANSI_Slash: "/",
+ kVK_ANSI_Grave: "`"
+ ]
+}
diff --git a/Sources/GPTVoice/InfoDisclosure.swift b/Sources/GPTVoice/InfoDisclosure.swift
new file mode 100644
index 0000000..eec475a
--- /dev/null
+++ b/Sources/GPTVoice/InfoDisclosure.swift
@@ -0,0 +1,52 @@
+import AppKit
+import SwiftUI
+
+/// A quiet, labelled disclosure for secondary detail. The label always names what it reveals.
+/// A native button underneath, so it is keyboard focusable and VoiceOver reads "expanded" or "collapsed".
+struct InfoDisclosure: View {
+ let label: String
+ let text: String
+
+ @State private var expanded = false
+ @FocusState private var focused: Bool
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 6) {
+ Button {
+ expanded.toggle()
+ } label: {
+ HStack(spacing: 5) {
+ Image(systemName: "chevron.right")
+ .font(.system(size: 9, weight: .semibold))
+ .rotationEffect(.degrees(expanded ? 90 : 0))
+ Text(label).font(AppType.caption)
+ }
+ .foregroundStyle(.secondary)
+ .padding(.vertical, 3)
+ .contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .focused($focused)
+ .overlay(
+ RoundedRectangle(cornerRadius: 4, style: .continuous)
+ .strokeBorder(Color(nsColor: .keyboardFocusIndicatorColor), lineWidth: 2)
+ .padding(-3)
+ .opacity(focused ? 1 : 0)
+ )
+ .accessibilityValue(expanded ? "Expanded" : "Collapsed")
+
+ if expanded {
+ Text(text)
+ .font(AppType.detail)
+ .foregroundStyle(.secondary)
+ .lineSpacing(2)
+ .fixedSize(horizontal: false, vertical: true)
+ .frame(maxWidth: 520, alignment: .leading)
+ .padding(.leading, 14)
+ .transition(.opacity)
+ }
+ }
+ .animation(AppMotion.control(reduceMotion), value: expanded)
+ }
+}
diff --git a/Sources/GPTVoice/KeyboardFocusRing.swift b/Sources/GPTVoice/KeyboardFocusRing.swift
new file mode 100644
index 0000000..c29ec8c
--- /dev/null
+++ b/Sources/GPTVoice/KeyboardFocusRing.swift
@@ -0,0 +1,18 @@
+import AppKit
+import SwiftUI
+
+/// Draws the system keyboard focus color around a custom-styled control while it has focus.
+/// Custom button styles can lose the native ring, so this restores a visible 2 pt indicator.
+struct KeyboardFocusRing<RingShape: InsettableShape>: ViewModifier {
+ let isFocused: Bool
+ let shape: RingShape
+
+ func body(content: Content) -> some View {
+ content.overlay(
+ shape
+ .strokeBorder(Color(nsColor: .keyboardFocusIndicatorColor), lineWidth: 2)
+ .opacity(isFocused ? 1 : 0)
+ .allowsHitTesting(false)
+ )
+ }
+}
diff --git a/Sources/GPTVoice/KeycapsView.swift b/Sources/GPTVoice/KeycapsView.swift
new file mode 100644
index 0000000..e2d5b06
--- /dev/null
+++ b/Sources/GPTVoice/KeycapsView.swift
@@ -0,0 +1,28 @@
+import SwiftUI
+
+/// Shows a shortcut as flat keycaps, for example ⌘ Space. Regola Medium.
+struct KeycapsView: View {
+ let spec: HotkeySpec
+ var large = false
+
+ var body: some View {
+ HStack(spacing: large ? 6 : 4) {
+ ForEach(Array(spec.keycaps.enumerated()), id: \.offset) { _, cap in
+ Text(cap)
+ .font(large ? AppType.keycapLarge : AppType.keycap)
+ .padding(.horizontal, large ? 12 : 7)
+ .frame(minWidth: large ? 44 : 26, minHeight: large ? 44 : 24)
+ .background(
+ RoundedRectangle(cornerRadius: large ? 10 : 6, style: .continuous)
+ .fill(AppPalette.surface)
+ )
+ .overlay(
+ RoundedRectangle(cornerRadius: large ? 10 : 6, style: .continuous)
+ .strokeBorder(AppPalette.hairline)
+ )
+ }
+ }
+ .accessibilityElement(children: .ignore)
+ .accessibilityLabel(spec.accessibilityLabel)
+ }
+}
diff --git a/Sources/GPTVoice/LaunchAtLoginStatus.swift b/Sources/GPTVoice/LaunchAtLoginStatus.swift
new file mode 100644
index 0000000..b0b02a8
--- /dev/null
+++ b/Sources/GPTVoice/LaunchAtLoginStatus.swift
@@ -0,0 +1,27 @@
+import ServiceManagement
+
+enum LaunchAtLoginStatus: Equatable {
+ case enabled
+ case requiresApproval
+ case disabled
+
+ /// `.notFound` can mean the system has not seen an unregistered service yet, so it maps to disabled.
+ /// A real registration problem appears as an error from `register()`.
+ static func current() -> LaunchAtLoginStatus {
+ switch SMAppService.mainApp.status {
+ case .enabled: return .enabled
+ case .requiresApproval: return .requiresApproval
+ case .notRegistered, .notFound: return .disabled
+ @unknown default: return .disabled
+ }
+ }
+
+ var isOn: Bool { self == .enabled || self == .requiresApproval }
+
+ var detail: String? {
+ switch self {
+ case .enabled, .disabled: return nil
+ case .requiresApproval: return "Allow GPT Voice in Login Items to finish."
+ }
+ }
+}
diff --git a/Sources/GPTVoice/LaunchOptions.swift b/Sources/GPTVoice/LaunchOptions.swift
new file mode 100644
index 0000000..12a8bb7
--- /dev/null
+++ b/Sources/GPTVoice/LaunchOptions.swift
@@ -0,0 +1,16 @@
+import Foundation
+
+/// How the GUI app starts.
+enum LaunchOptions: Equatable {
+ case normal
+ case showOnboarding
+ case showSettings
+ /// Test path: transcribe a supplied file and deliver it. Skips automatic setup windows.
+ case transcribeAndPaste(URL)
+ /// Test path: show a real file transcription in onboarding without changing the clipboard.
+ case practiceAudio(URL)
+
+ /// The distributed notification a duplicate launch posts to the running instance.
+ static let showSettingsNotification = Notification.Name("com.vishesh.codex-dictation.show-settings")
+ static let showOnboardingNotification = Notification.Name("com.vishesh.codex-dictation.show-onboarding")
+}
diff --git a/Sources/GPTVoice/LevelMeterView.swift b/Sources/GPTVoice/LevelMeterView.swift
new file mode 100644
index 0000000..1ad70f3
--- /dev/null
+++ b/Sources/GPTVoice/LevelMeterView.swift
@@ -0,0 +1,31 @@
+import SwiftUI
+
+/// Five bars driven only by the real input level. Silence shows flat bars.
+struct LevelMeterView: View {
+ let level: Float
+ @Environment(\.appAccent) private var accent
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+
+ /// Fixed shape so louder input reads taller in the middle. Not animated on its own.
+ private static let weights: [CGFloat] = [0.55, 0.8, 1, 0.8, 0.55]
+ private static let barWidth: CGFloat = 3
+ private static let minimumHeight: CGFloat = 3
+
+ var body: some View {
+ GeometryReader { proxy in
+ HStack(alignment: .center, spacing: 3) {
+ ForEach(Array(Self.weights.enumerated()), id: \.offset) { _, weight in
+ Capsule()
+ .fill(accent)
+ .frame(width: Self.barWidth,
+ height: max(Self.minimumHeight, proxy.size.height * weight * CGFloat(level)))
+ }
+ }
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ .animation(reduceMotion ? nil : .linear(duration: 0.08), value: level)
+ }
+ .accessibilityElement()
+ .accessibilityLabel("Input level")
+ .accessibilityValue("\(Int(level * 100)) percent")
+ }
+}
diff --git a/Sources/GPTVoice/MainMenuBuilder.swift b/Sources/GPTVoice/MainMenuBuilder.swift
new file mode 100644
index 0000000..7e886b6
--- /dev/null
+++ b/Sources/GPTVoice/MainMenuBuilder.swift
@@ -0,0 +1,32 @@
+import AppKit
+
+/// Minimal main menu so Close, Quit, and text editing shortcuts work in setup windows.
+enum MainMenuBuilder {
+ @MainActor
+ static func make() -> NSMenu {
+ let main = NSMenu()
+
+ let appItem = NSMenuItem()
+ let appMenu = NSMenu()
+ appMenu.addItem(withTitle: "Quit GPT Voice", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q")
+ appItem.submenu = appMenu
+ main.addItem(appItem)
+
+ let editItem = NSMenuItem()
+ let editMenu = NSMenu(title: "Edit")
+ editMenu.addItem(withTitle: "Cut", action: #selector(NSText.cut(_:)), keyEquivalent: "x")
+ editMenu.addItem(withTitle: "Copy", action: #selector(NSText.copy(_:)), keyEquivalent: "c")
+ editMenu.addItem(withTitle: "Paste", action: #selector(NSText.paste(_:)), keyEquivalent: "v")
+ editMenu.addItem(withTitle: "Select All", action: #selector(NSText.selectAll(_:)), keyEquivalent: "a")
+ editItem.submenu = editMenu
+ main.addItem(editItem)
+
+ let windowItem = NSMenuItem()
+ let windowMenu = NSMenu(title: "Window")
+ windowMenu.addItem(withTitle: "Close", action: #selector(NSWindow.performClose(_:)), keyEquivalent: "w")
+ windowItem.submenu = windowMenu
+ main.addItem(windowItem)
+
+ return main
+ }
+}
diff --git a/Sources/GPTVoice/MicrophoneCard.swift b/Sources/GPTVoice/MicrophoneCard.swift
new file mode 100644
index 0000000..9bf8504
--- /dev/null
+++ b/Sources/GPTVoice/MicrophoneCard.swift
@@ -0,0 +1,46 @@
+import SwiftUI
+
+/// Microphone row. Purpose in one short line. Recovery text only when blocked or restricted.
+struct MicrophoneCard: View {
+ @ObservedObject var model: AppModel
+ /// True when the grant action is the view's single main action.
+ var prominent = true
+
+ var body: some View {
+ switch model.microphone {
+ case .granted:
+ StatusRow(tone: .good, symbol: "checkmark.circle.fill", title: "Microphone",
+ value: "Allowed") { EmptyView() }
+ case .notRequested:
+ StatusRow(tone: .attention, symbol: "exclamationmark.circle.fill", title: "Microphone",
+ detail: "Required to hear you.") {
+ Button("Allow") { model.requestMicrophone() }
+ .buttonStyle(AppButtonStyle(kind: prominent ? .primary : .secondary, small: true))
+ .accessibilityLabel("Allow microphone")
+ settingsButton
+ }
+ case .denied:
+ StatusRow(tone: .problem, symbol: "mic.slash.fill", title: "Microphone blocked",
+ detail: "Turn on GPT Voice in Privacy & Security > Microphone.") {
+ settingsButton
+ recheck
+ }
+ case .restricted:
+ StatusRow(tone: .problem, symbol: "lock.fill", title: "Microphone restricted",
+ detail: "A device policy or Screen Time blocks it. Ask the person who manages this Mac.") {
+ settingsButton
+ recheck
+ }
+ }
+ }
+
+ private var settingsButton: some View {
+ Button("Open Settings") { model.openMicrophoneSettings() }
+ .buttonStyle(AppButtonStyle(kind: .quiet, small: true))
+ .accessibilityLabel("Open microphone settings")
+ }
+
+ private var recheck: some View {
+ QuietIconButton(symbol: "arrow.clockwise", label: "Check microphone again") { model.refreshStatus() }
+ }
+}
diff --git a/Sources/GPTVoice/OnboardingHeader.swift b/Sources/GPTVoice/OnboardingHeader.swift
new file mode 100644
index 0000000..81aecc3
--- /dev/null
+++ b/Sources/GPTVoice/OnboardingHeader.swift
@@ -0,0 +1,22 @@
+import SwiftUI
+
+/// One title and one short instruction for an onboarding step.
+struct OnboardingHeader: View {
+ let title: String
+ let summary: String
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 6) {
+ Text(title)
+ .font(AppType.title)
+ .tracking(AppType.titleTracking)
+ .fixedSize(horizontal: false, vertical: true)
+ .accessibilityAddTraits(.isHeader)
+ Text(summary)
+ .font(AppType.body)
+ .foregroundStyle(.secondary)
+ .fixedSize(horizontal: false, vertical: true)
+ }
+ .frame(maxWidth: 480, alignment: .leading)
+ }
+}
diff --git a/Sources/GPTVoice/OnboardingPermissionsStep.swift b/Sources/GPTVoice/OnboardingPermissionsStep.swift
new file mode 100644
index 0000000..f759224
--- /dev/null
+++ b/Sources/GPTVoice/OnboardingPermissionsStep.swift
@@ -0,0 +1,18 @@
+import SwiftUI
+
+struct OnboardingPermissionsStep: View {
+ @ObservedObject var model: AppModel
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 24) {
+ OnboardingHeader(title: "Allow access",
+ summary: "The microphone is required. Accessibility is optional.")
+ VStack(alignment: .leading, spacing: 8) {
+ SettingsGroup {
+ PermissionsPanel(model: model, offersManualPaste: true, prominent: true)
+ }
+ InfoDisclosure(label: "Why these permissions?", text: PermissionsPanel.details)
+ }
+ }
+ }
+}
diff --git a/Sources/GPTVoice/OnboardingPracticeStep.swift b/Sources/GPTVoice/OnboardingPracticeStep.swift
new file mode 100644
index 0000000..ff1af55
--- /dev/null
+++ b/Sources/GPTVoice/OnboardingPracticeStep.swift
@@ -0,0 +1,14 @@
+import SwiftUI
+
+struct OnboardingPracticeStep: View {
+ @ObservedObject var model: AppModel
+ let goTo: (OnboardingStep) -> Void
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 24) {
+ OnboardingHeader(title: "Try it",
+ summary: "Say one sentence. The text stays in this window.")
+ PracticeConsole(model: model, goTo: goTo)
+ }
+ }
+}
diff --git a/Sources/GPTVoice/OnboardingProgress.swift b/Sources/GPTVoice/OnboardingProgress.swift
new file mode 100644
index 0000000..6a4f8ce
--- /dev/null
+++ b/Sources/GPTVoice/OnboardingProgress.swift
@@ -0,0 +1,26 @@
+import SwiftUI
+
+/// Quiet step indicator: "2 of 5" and the step name, with five short segments. Only the current one is filled.
+/// Position is shown, never completion.
+struct OnboardingProgress: View {
+ let current: OnboardingStep
+ @Environment(\.appAccentFill) private var accentFill
+
+ var body: some View {
+ HStack(spacing: 10) {
+ HStack(spacing: 4) {
+ ForEach(OnboardingStep.allCases) { step in
+ Capsule()
+ .fill(step == current ? accentFill : AppPalette.well)
+ .frame(width: step == current ? 18 : 10, height: 3)
+ }
+ }
+ Text("\(current.rawValue + 1) of \(OnboardingStep.allCases.count) \(current.label)")
+ .font(AppType.caption)
+ .monospacedDigit()
+ .foregroundStyle(.secondary)
+ }
+ .accessibilityElement(children: .ignore)
+ .accessibilityLabel("Step \(current.rawValue + 1) of \(OnboardingStep.allCases.count): \(current.label)")
+ }
+}
diff --git a/Sources/GPTVoice/OnboardingReadyStep.swift b/Sources/GPTVoice/OnboardingReadyStep.swift
new file mode 100644
index 0000000..b5dfb4b
--- /dev/null
+++ b/Sources/GPTVoice/OnboardingReadyStep.swift
@@ -0,0 +1,33 @@
+import SwiftUI
+
+/// Compact truthful checks. No tutorial repeat. Missing items get one instruction and real Fix actions.
+struct OnboardingReadyStep: View {
+ @ObservedObject var model: AppModel
+ @ObservedObject var preferences: AppPreferences
+ let goTo: (OnboardingStep) -> Void
+
+ init(model: AppModel, goTo: @escaping (OnboardingStep) -> Void) {
+ self.model = model
+ self.preferences = model.preferences
+ self.goTo = goTo
+ }
+
+ var body: some View {
+ let ready = model.missingRequirements.isEmpty
+ VStack(alignment: .leading, spacing: 24) {
+ OnboardingHeader(title: ready ? "Ready to dictate" : "Almost ready",
+ summary: ready
+ ? "Press \(preferences.hotkey.displayLabel) in any app to start."
+ : "Fix the items marked missing, or finish later in Settings.")
+ SettingsGroup {
+ ReadinessList(model: model) { fix in
+ switch fix {
+ case .connection: goTo(.welcome)
+ case .permissions: goTo(.permissions)
+ case .shortcut: goTo(.shortcut)
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Sources/GPTVoice/OnboardingShortcutStep.swift b/Sources/GPTVoice/OnboardingShortcutStep.swift
new file mode 100644
index 0000000..aebb113
--- /dev/null
+++ b/Sources/GPTVoice/OnboardingShortcutStep.swift
@@ -0,0 +1,13 @@
+import SwiftUI
+
+struct OnboardingShortcutStep: View {
+ @ObservedObject var model: AppModel
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 24) {
+ OnboardingHeader(title: "Choose a shortcut",
+ summary: "Press it once to start dictation. Press it again to stop.")
+ ShortcutPanel(model: model)
+ }
+ }
+}
diff --git a/Sources/GPTVoice/OnboardingStep.swift b/Sources/GPTVoice/OnboardingStep.swift
new file mode 100644
index 0000000..8d71cc4
--- /dev/null
+++ b/Sources/GPTVoice/OnboardingStep.swift
@@ -0,0 +1,24 @@
+import Foundation
+
+enum OnboardingStep: Int, CaseIterable, Identifiable {
+ case welcome
+ case permissions
+ case shortcut
+ case practice
+ case ready
+
+ var id: Int { rawValue }
+
+ var label: String {
+ switch self {
+ case .welcome: return "Connect"
+ case .permissions: return "Access"
+ case .shortcut: return "Shortcut"
+ case .practice: return "Try it"
+ case .ready: return "Ready"
+ }
+ }
+
+ var previous: OnboardingStep? { OnboardingStep(rawValue: rawValue - 1) }
+ var next: OnboardingStep? { OnboardingStep(rawValue: rawValue + 1) }
+}
diff --git a/Sources/GPTVoice/OnboardingView.swift b/Sources/GPTVoice/OnboardingView.swift
new file mode 100644
index 0000000..64c4f28
--- /dev/null
+++ b/Sources/GPTVoice/OnboardingView.swift
@@ -0,0 +1,111 @@
+import AppKit
+import SwiftUI
+
+/// Five-step setup in one focused column under integrated window chrome, with a stable footer.
+struct OnboardingView: View {
+ @ObservedObject var model: AppModel
+ let onFinish: () -> Void
+ @State private var step: OnboardingStep = .welcome
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+
+ init(model: AppModel, onFinish: @escaping () -> Void) {
+ self.model = model
+ self.onFinish = onFinish
+ }
+
+ var body: some View {
+ VStack(spacing: 0) {
+ ZStack {
+ WindowDragArea()
+ OnboardingProgress(current: step)
+ }
+ .frame(height: HostingWindowController.chromeHeight)
+
+ ScrollView {
+ content
+ .id(step)
+ .transition(.opacity)
+ .padding(.horizontal, 40)
+ .padding(.top, 16)
+ .padding(.bottom, 24)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
+
+ RowDivider()
+ footer
+ .padding(.horizontal, 40)
+ .padding(.vertical, 14)
+ }
+ .background(AppPalette.canvas)
+ .animation(AppMotion.reveal(reduceMotion), value: step)
+ .frame(minWidth: 600, idealWidth: 660, minHeight: 480, idealHeight: 520)
+ .onAppear {
+ model.refreshStatus()
+ if model.isPracticeSession { step = .practice }
+ if step == .practice { model.beginPractice() }
+ }
+ .onDisappear { model.endPractice() }
+ .onChange(of: step) { newStep in
+ // Entering Try it enables the practice context without starting the microphone.
+ if newStep == .practice { model.beginPractice() } else { model.endPractice() }
+ }
+ .onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { _ in
+ model.refreshStatus()
+ }
+ .onReceive(NotificationCenter.default.publisher(for: NSWindow.didBecomeKeyNotification)) { _ in
+ model.refreshStatus()
+ }
+ }
+
+ @ViewBuilder private var content: some View {
+ switch step {
+ case .welcome: OnboardingWelcomeStep(model: model)
+ case .permissions: OnboardingPermissionsStep(model: model)
+ case .shortcut: OnboardingShortcutStep(model: model)
+ case .practice: OnboardingPracticeStep(model: model) { step = $0 }
+ case .ready: OnboardingReadyStep(model: model) { step = $0 }
+ }
+ }
+
+ private var footer: some View {
+ HStack(spacing: 8) {
+ if let previous = step.previous {
+ Button("Back") { step = previous }
+ .buttonStyle(AppButtonStyle(kind: .quiet))
+ .keyboardShortcut(.cancelAction)
+ }
+ Spacer()
+ if let next = step.next {
+ mainButton(pending ? "Skip for now" : "Continue", arrow: true) { step = next }
+ } else {
+ mainButton(model.missingRequirements.isEmpty ? "Done" : "Finish later", arrow: false) {
+ model.endPractice()
+ model.completeOnboarding()
+ onFinish()
+ }
+ }
+ }
+ }
+
+ /// The footer action is the main action only when the step has no other pending main action.
+ @ViewBuilder
+ private func mainButton(_ title: String, arrow: Bool, action: @escaping () -> Void) -> some View {
+ if pending {
+ Button(title, action: action)
+ .buttonStyle(AppButtonStyle(kind: .secondary))
+ } else {
+ Button(title, action: action)
+ .buttonStyle(AppButtonStyle(kind: .primary, showsArrow: arrow))
+ .keyboardShortcut(.defaultAction)
+ }
+ }
+
+ private var pending: Bool {
+ switch step {
+ case .welcome: return !model.connection.isUsable
+ case .permissions: return model.microphone != .granted
+ case .practice: return model.practiceTranscript == nil
+ case .shortcut, .ready: return false
+ }
+ }
+}
diff --git a/Sources/GPTVoice/OnboardingWelcomeStep.swift b/Sources/GPTVoice/OnboardingWelcomeStep.swift
new file mode 100644
index 0000000..c2b75bf
--- /dev/null
+++ b/Sources/GPTVoice/OnboardingWelcomeStep.swift
@@ -0,0 +1,41 @@
+import SwiftUI
+
+/// Welcome in three zones: what it does, a small demonstration with the real keys and bar, and the ChatGPT row.
+struct OnboardingWelcomeStep: View {
+ @ObservedObject var model: AppModel
+ @ObservedObject var preferences: AppPreferences
+
+ init(model: AppModel) {
+ self.model = model
+ self.preferences = model.preferences
+ }
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 32) {
+ OnboardingHeader(title: "Dictate into any app",
+ summary: "Press your shortcut, speak, and press it again.")
+
+ HStack(spacing: 14) {
+ KeycapsView(spec: preferences.hotkey)
+ Image(systemName: "arrow.right")
+ .font(.system(size: 11, weight: .medium))
+ .foregroundStyle(.tertiary)
+ .accessibilityHidden(true)
+ DictationOverlayView(state: .recording(elapsed: 4, level: 0.5), actions: .preview)
+ }
+ .accessibilityElement(children: .ignore)
+ .accessibilityLabel("Sample: press \(preferences.hotkey.accessibilityLabel) and the recording bar appears.")
+
+ VStack(alignment: .leading, spacing: 8) {
+ SettingsGroup {
+ ConnectionPanel(model: model, prominentSignIn: true)
+ }
+ Text("Audio is sent to ChatGPT for transcription.")
+ .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.")
+ }
+ }
+ }
+}
diff --git a/Sources/GPTVoice/OverlayCapsule.swift b/Sources/GPTVoice/OverlayCapsule.swift
new file mode 100644
index 0000000..27106e3
--- /dev/null
+++ b/Sources/GPTVoice/OverlayCapsule.swift
@@ -0,0 +1,20 @@
+import SwiftUI
+
+/// The compact static preview. The live panel owns one continuously resizing surface.
+struct OverlayCapsule: View {
+ let state: DictationOverlayState
+ let actions: DictationOverlayActions
+
+ var body: some View {
+ HStack(spacing: 10) {
+ OverlayCapsuleContent(state: state, actions: actions)
+ }
+ .padding(.leading, 14)
+ .padding(.trailing, 8)
+ .frame(height: 40)
+ .fixedSize(horizontal: true, vertical: false)
+ .modifier(OverlaySurface(shape: Capsule()))
+ .accessibilityElement(children: .contain)
+ .accessibilityLabel("Dictation status")
+ }
+}
diff --git a/Sources/GPTVoice/OverlayCapsuleContent.swift b/Sources/GPTVoice/OverlayCapsuleContent.swift
new file mode 100644
index 0000000..c91f1b5
--- /dev/null
+++ b/Sources/GPTVoice/OverlayCapsuleContent.swift
@@ -0,0 +1,55 @@
+import SwiftUI
+
+/// Shared content for the live, resizing shell and the static preview.
+struct OverlayCapsuleContent: View {
+ let state: DictationOverlayState
+ let actions: DictationOverlayActions
+
+ @ViewBuilder var body: some View {
+ switch state {
+ case .recording(let elapsed, let level):
+ Circle().fill(AppPalette.recording).frame(width: 7, height: 7)
+ .accessibilityLabel("Recording")
+ LevelMeterView(level: level).frame(width: 36, height: 18)
+ Text(DictationOverlayState.format(elapsed))
+ .font(AppType.timer)
+ .monospacedDigit()
+ .foregroundStyle(.secondary)
+ .accessibilityLabel("Elapsed \(DictationOverlayState.format(elapsed))")
+ OverlayIconButton(symbol: "xmark", label: "Cancel dictation", action: actions.cancel)
+ OverlayIconButton(symbol: "stop.fill", label: "Stop and transcribe", prominent: true, action: actions.stop)
+ case .working(let label, let cancellable):
+ // Secondary-label ring: visible on light and dark surfaces, unlike the small system spinner.
+ ActivityIndicator(size: 13)
+ .frame(width: 16, height: 16)
+ Text(label)
+ .font(AppType.control)
+ .lineLimit(1)
+ .frame(minWidth: 96, alignment: .leading)
+ if cancellable {
+ OverlayIconButton(symbol: "xmark", label: "Cancel dictation", action: actions.cancel)
+ } else {
+ Color.clear.frame(width: 6, height: 24)
+ }
+ case .success(let label):
+ Image(systemName: "checkmark.circle.fill")
+ .foregroundStyle(AppPalette.success)
+ .accessibilityHidden(true)
+ Text(label)
+ .font(AppType.control)
+ .lineLimit(1)
+ .padding(.trailing, 8)
+ case .message(let label, let kind):
+ Image(systemName: kind == .noSpeech ? "waveform.slash" :
+ kind == .warning ? "exclamationmark.circle" : "doc.on.clipboard")
+ .foregroundStyle(.secondary)
+ .accessibilityHidden(true)
+ Text(label)
+ .font(AppType.control)
+ .lineLimit(1)
+ .padding(.trailing, 8)
+ case .hidden, .notice:
+ EmptyView()
+ }
+ }
+}
diff --git a/Sources/GPTVoice/OverlayCard.swift b/Sources/GPTVoice/OverlayCard.swift
new file mode 100644
index 0000000..0faa5ca
--- /dev/null
+++ b/Sources/GPTVoice/OverlayCard.swift
@@ -0,0 +1,12 @@
+import SwiftUI
+
+/// The first manual-paste explanation. Later results use a compact message.
+struct OverlayCard: View {
+ let notice: DictationOverlayNotice
+ let actions: DictationOverlayActions
+
+ var body: some View {
+ OverlayHelpContent(notice: notice, dismiss: actions.dismiss)
+ .modifier(OverlaySurface(shape: RoundedRectangle(cornerRadius: 14, style: .continuous)))
+ }
+}
diff --git a/Sources/GPTVoice/OverlayContentTransition.swift b/Sources/GPTVoice/OverlayContentTransition.swift
new file mode 100644
index 0000000..7c8f49c
--- /dev/null
+++ b/Sources/GPTVoice/OverlayContentTransition.swift
@@ -0,0 +1,20 @@
+import SwiftUI
+
+struct OverlayContentTransition: AnimatableModifier {
+ var opacity: Double
+ var blur: CGFloat
+
+ var animatableData: AnimatablePair<Double, CGFloat> {
+ get { AnimatablePair(opacity, blur) }
+ set { opacity = newValue.first; blur = newValue.second }
+ }
+
+ func body(content: Content) -> some View {
+ content.opacity(opacity).blur(radius: blur)
+ }
+
+ static func transition(reduceMotion: Bool) -> AnyTransition {
+ .modifier(active: Self(opacity: 0, blur: reduceMotion ? 0 : 2.5),
+ identity: Self(opacity: 1, blur: 0))
+ }
+}
diff --git a/Sources/GPTVoice/OverlayHelpContent.swift b/Sources/GPTVoice/OverlayHelpContent.swift
new file mode 100644
index 0000000..75db948
--- /dev/null
+++ b/Sources/GPTVoice/OverlayHelpContent.swift
@@ -0,0 +1,23 @@
+import SwiftUI
+
+struct OverlayHelpContent: View {
+ let notice: DictationOverlayNotice
+ let dismiss: () -> Void
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 6) {
+ HStack(spacing: 8) {
+ Text(notice.title).font(AppType.rowTitle)
+ Spacer(minLength: 8)
+ OverlayIconButton(symbol: "xmark", label: "Dismiss paste help", action: dismiss)
+ }
+ Text(notice.message)
+ .font(AppType.detail)
+ .foregroundStyle(.secondary)
+ .fixedSize(horizontal: false, vertical: true)
+ }
+ .padding(14)
+ .frame(width: 320, alignment: .leading)
+ .accessibilityElement(children: .contain)
+ }
+}
diff --git a/Sources/GPTVoice/OverlayIconButton.swift b/Sources/GPTVoice/OverlayIconButton.swift
new file mode 100644
index 0000000..e5c6b67
--- /dev/null
+++ b/Sources/GPTVoice/OverlayIconButton.swift
@@ -0,0 +1,25 @@
+import SwiftUI
+
+/// A 24 pt round icon button for the compact overlay. Always has an accessible name.
+struct OverlayIconButton: View {
+ let symbol: String
+ let label: String
+ var prominent = false
+ let action: () -> Void
+ @Environment(\.appAccentFill) private var accent
+ @Environment(\.appAccentOnFill) private var onAccent
+
+ var body: some View {
+ Button(action: action) {
+ Image(systemName: symbol)
+ .font(.system(size: 10, weight: .bold))
+ .foregroundStyle(prominent ? onAccent : Color.primary)
+ .frame(width: 24, height: 24)
+ .background(Circle().fill(prominent ? accent : Color.primary.opacity(0.1)))
+ .contentShape(Circle())
+ }
+ .buttonStyle(PressScaleButtonStyle())
+ .help(label)
+ .accessibilityLabel(label)
+ }
+}
diff --git a/Sources/GPTVoice/OverlayMessageKind.swift b/Sources/GPTVoice/OverlayMessageKind.swift
new file mode 100644
index 0000000..328bfde
--- /dev/null
+++ b/Sources/GPTVoice/OverlayMessageKind.swift
@@ -0,0 +1,5 @@
+enum OverlayMessageKind: Equatable {
+ case noSpeech
+ case warning
+ case info
+}
diff --git a/Sources/GPTVoice/OverlayPlacement.swift b/Sources/GPTVoice/OverlayPlacement.swift
new file mode 100644
index 0000000..61f75c1
--- /dev/null
+++ b/Sources/GPTVoice/OverlayPlacement.swift
@@ -0,0 +1,16 @@
+import Foundation
+
+/// Where the dictation overlay appears on the current screen.
+enum OverlayPlacement: String, CaseIterable, Identifiable {
+ case bottom
+ case top
+
+ var id: String { rawValue }
+
+ var title: String {
+ switch self {
+ case .bottom: return "Bottom"
+ case .top: return "Top"
+ }
+ }
+}
diff --git a/Sources/GPTVoice/OverlayPresentation.swift b/Sources/GPTVoice/OverlayPresentation.swift
new file mode 100644
index 0000000..01caa1a
--- /dev/null
+++ b/Sources/GPTVoice/OverlayPresentation.swift
@@ -0,0 +1,7 @@
+import Combine
+
+@MainActor
+final class OverlayPresentation: ObservableObject {
+ @Published var state: DictationOverlayState = .hidden
+ @Published var exiting = false
+}
diff --git a/Sources/GPTVoice/OverlaySurface.swift b/Sources/GPTVoice/OverlaySurface.swift
new file mode 100644
index 0000000..ebb228f
--- /dev/null
+++ b/Sources/GPTVoice/OverlaySurface.swift
@@ -0,0 +1,15 @@
+import SwiftUI
+
+/// Flat, near-opaque overlay surface with a hairline border. Stronger under Increase Contrast.
+struct OverlaySurface<SurfaceShape: InsettableShape>: ViewModifier {
+ let shape: SurfaceShape
+ @Environment(\.colorSchemeContrast) private var contrast
+
+ func body(content: Content) -> some View {
+ let increased = contrast == .increased
+ content
+ .background(shape.fill(AppPalette.surface.opacity(increased ? 1 : 0.97)))
+ .overlay(shape.strokeBorder(Color.primary.opacity(increased ? 0.5 : 0.12), lineWidth: increased ? 1.5 : 1))
+ .clipShape(shape)
+ }
+}
diff --git a/Sources/GPTVoice/OverlayTiming.swift b/Sources/GPTVoice/OverlayTiming.swift
new file mode 100644
index 0000000..3b4cd6d
--- /dev/null
+++ b/Sources/GPTVoice/OverlayTiming.swift
@@ -0,0 +1,24 @@
+import Foundation
+
+struct OverlayTiming {
+ var resize: TimeInterval = 0.24
+ var entrance: TimeInterval = 0.16
+ var exit: TimeInterval = 0.18
+ var reducedFade: TimeInterval = 0.1
+ var success: TimeInterval = 1.6
+ var noSpeech: TimeInterval = 2
+ var warning: TimeInterval = 3
+ var pasteHint: TimeInterval = 3
+ var help: TimeInterval = 7.5
+
+ func hold(for state: DictationOverlayState) -> TimeInterval? {
+ switch state {
+ case .success: return success
+ case .message(_, .noSpeech): return noSpeech
+ case .message(_, .warning): return warning
+ case .message(_, .info): return pasteHint
+ case .notice: return help
+ case .hidden, .recording, .working: return nil
+ }
+ }
+}
diff --git a/Sources/GPTVoice/PageHeader.swift b/Sources/GPTVoice/PageHeader.swift
new file mode 100644
index 0000000..f393e28
--- /dev/null
+++ b/Sources/GPTVoice/PageHeader.swift
@@ -0,0 +1,23 @@
+import SwiftUI
+
+/// Page title, with a short subtitle only when the title needs one.
+struct PageHeader: View {
+ let title: String
+ var intro: String?
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 6) {
+ Text(title)
+ .font(AppType.title)
+ .tracking(AppType.titleTracking)
+ .accessibilityAddTraits(.isHeader)
+ if let intro {
+ Text(intro)
+ .font(AppType.body)
+ .foregroundStyle(.secondary)
+ .fixedSize(horizontal: false, vertical: true)
+ }
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
+}
diff --git a/Sources/GPTVoice/PasteCoordinator.swift b/Sources/GPTVoice/PasteCoordinator.swift
new file mode 100644
index 0000000..52e6996
--- /dev/null
+++ b/Sources/GPTVoice/PasteCoordinator.swift
@@ -0,0 +1,112 @@
+import AppKit
+import ApplicationServices
+import Carbon.HIToolbox
+import DictationCore
+
+/// Serial owner of the clipboard lease and paste delivery.
+/// Call `beginSession()` when recording starts and `deliver(text:automaticPaste:)` when the transcript arrives.
+@MainActor
+final class PasteCoordinator {
+ /// Time that the target app gets to read the pasteboard before the old content returns.
+ static let restoreDelay: UInt64 = 750_000_000
+
+ private let pasteboard: NSPasteboard
+ private var target: PasteTarget?
+ private var snapshot: ClipboardSnapshot?
+ private var delivery: Task<PasteOutcome, Never>?
+
+ init(pasteboard: NSPasteboard = .general) {
+ self.pasteboard = pasteboard
+ }
+
+ /// True while a paste or a clipboard restore is pending. Block new recordings while true.
+ var isLeasePending: Bool { delivery != nil }
+
+ /// Waits for any pending paste and clipboard restore to finish.
+ func waitForLease() async {
+ while let pending = delivery { _ = await pending.value }
+ }
+
+ /// Captures the paste target and the clipboard. Call at recording start.
+ func beginSession() {
+ target = PasteTarget.captureFrontmost()
+ snapshot = ClipboardSnapshot.capture(pasteboard)
+ }
+
+ /// Drops the captured target and clipboard, for example after Cancel.
+ func endSession() {
+ target = nil
+ snapshot = nil
+ }
+
+ /// Explicit user Copy. Writes the original transcript.
+ func copy(_ text: String) {
+ write(text)
+ }
+
+ /// Delivers a transcript once. Never replaces a clipboard that changed since `beginSession()`.
+ func deliver(text: String, automaticPaste: Bool) async -> PasteOutcome {
+ await waitForLease()
+ let task = Task { () -> PasteOutcome in
+ let outcome = await self.performDelivery(text: text, automaticPaste: automaticPaste)
+ self.endSession()
+ self.delivery = nil
+ return outcome
+ }
+ delivery = task
+ return await task.value
+ }
+
+ private func performDelivery(text: String, automaticPaste: Bool) async -> PasteOutcome {
+ if let snapshot, pasteboard.changeCount != snapshot.changeCount {
+ return .preservedNewerClipboard
+ }
+ let reason: PasteOutcome.ManualReason?
+ if !automaticPaste {
+ reason = .automaticPasteOff
+ } else if !AXIsProcessTrusted() {
+ reason = .accessibilityMissing
+ } else if target == nil || snapshot == nil {
+ reason = .noTarget
+ } else if target?.isStillFrontmost() != true {
+ reason = .targetChanged
+ } else {
+ reason = nil
+ }
+ if let reason {
+ write(text)
+ return .copied(reason)
+ }
+
+ let ownedChange = write(TranscriptText.forAutomaticPaste(text))
+ guard postCommandV() else {
+ // Keep the transcript on the clipboard for manual recovery.
+ return .copied(.injectionFailed)
+ }
+ try? await Task.sleep(nanoseconds: Self.restoreDelay)
+ if pasteboard.changeCount == ownedChange, let snapshot {
+ snapshot.restore(to: pasteboard)
+ }
+ return .pasted(appName: target?.appName)
+ }
+
+ @discardableResult
+ private func write(_ text: String) -> Int {
+ pasteboard.clearContents()
+ pasteboard.setString(text, forType: .string)
+ return pasteboard.changeCount
+ }
+
+ /// Posts Command+V with explicit flags. Never posts Return.
+ private func postCommandV() -> Bool {
+ let source = CGEventSource(stateID: .privateState)
+ let key = CGKeyCode(kVK_ANSI_V)
+ guard let down = CGEvent(keyboardEventSource: source, virtualKey: key, keyDown: true),
+ let up = CGEvent(keyboardEventSource: source, virtualKey: key, keyDown: false) else { return false }
+ down.flags = .maskCommand
+ up.flags = .maskCommand
+ down.post(tap: .cghidEventTap)
+ up.post(tap: .cghidEventTap)
+ return true
+ }
+}
diff --git a/Sources/GPTVoice/PasteOutcome.swift b/Sources/GPTVoice/PasteOutcome.swift
new file mode 100644
index 0000000..4d8b4e3
--- /dev/null
+++ b/Sources/GPTVoice/PasteOutcome.swift
@@ -0,0 +1,43 @@
+import Foundation
+
+/// The result of delivering a transcript. The caller keeps the original transcript in memory in all cases.
+enum PasteOutcome: Equatable {
+ /// The practice result is visible in the app. The clipboard was not changed.
+ case previewed
+ enum ManualReason: Equatable {
+ case automaticPasteOff
+ case accessibilityMissing
+ case targetChanged
+ case noTarget
+ case injectionFailed
+ }
+
+ /// Text was pasted into the original app.
+ case pasted(appName: String?)
+ /// Text is on the clipboard. The user must paste it.
+ case copied(ManualReason)
+ /// The clipboard changed during dictation. It was not replaced. Offer Copy.
+ case preservedNewerClipboard
+
+ var message: String {
+ switch self {
+ case .previewed:
+ return "Practice text is ready. Your clipboard was not changed."
+ case .pasted(let name):
+ return name.map { "Pasted into \($0)." } ?? "Pasted."
+ case .copied(.automaticPasteOff):
+ return "Copied. Press ⌘V to paste."
+ case .copied(.accessibilityMissing):
+ return "Copied. Accessibility is off, so press ⌘V to paste."
+ case .copied(.targetChanged):
+ return "Copied. You changed apps, so automatic paste was skipped. Press ⌘V to paste."
+ case .copied(.noTarget):
+ return "Copied. No target app was found. Press ⌘V to paste."
+ case .copied(.injectionFailed):
+ return "Copied. Automatic paste failed. Press ⌘V to paste."
+ case .preservedNewerClipboard:
+ return "Your clipboard changed, so it was not replaced. Select Copy to copy the transcript."
+ }
+ }
+
+}
diff --git a/Sources/GPTVoice/PasteTarget.swift b/Sources/GPTVoice/PasteTarget.swift
new file mode 100644
index 0000000..6df99e8
--- /dev/null
+++ b/Sources/GPTVoice/PasteTarget.swift
@@ -0,0 +1,47 @@
+import AppKit
+import ApplicationServices
+
+/// The app and, when Accessibility allows it, the focused element and window at recording start.
+struct PasteTarget {
+ let processID: pid_t
+ let appName: String?
+ let focusedElement: AXUIElement?
+ let focusedWindow: AXUIElement?
+
+ /// Captures the frontmost app. Returns nil when this app is frontmost.
+ static func captureFrontmost() -> PasteTarget? {
+ guard let app = NSWorkspace.shared.frontmostApplication,
+ 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)
+ return PasteTarget(processID: pid, appName: app.localizedName,
+ focusedElement: focus.element, focusedWindow: focus.window)
+ }
+
+ /// True when the same process is frontmost and any captured focus still matches.
+ func isStillFrontmost() -> Bool {
+ guard NSWorkspace.shared.frontmostApplication?.processIdentifier == processID else { return false }
+ guard focusedElement != nil || focusedWindow != nil else { return true }
+ let now = Self.focusedAttributes(of: processID)
+ if let focusedWindow {
+ guard let window = now.window, CFEqual(focusedWindow, window) else { return false }
+ }
+ if let focusedElement {
+ guard let element = now.element, CFEqual(focusedElement, element) else { return false }
+ }
+ return true
+ }
+
+ private static func focusedAttributes(of pid: pid_t) -> (element: AXUIElement?, window: AXUIElement?) {
+ let app = AXUIElementCreateApplication(pid)
+ return (copyElement(app, kAXFocusedUIElementAttribute), copyElement(app, kAXFocusedWindowAttribute))
+ }
+
+ private static func copyElement(_ owner: AXUIElement, _ attribute: String) -> AXUIElement? {
+ var value: CFTypeRef?
+ guard AXUIElementCopyAttributeValue(owner, attribute as CFString, &value) == .success,
+ let value, CFGetTypeID(value) == AXUIElementGetTypeID() else { return nil }
+ return (value as! AXUIElement)
+ }
+}
diff --git a/Sources/GPTVoice/PermissionStatus.swift b/Sources/GPTVoice/PermissionStatus.swift
new file mode 100644
index 0000000..e48c0e8
--- /dev/null
+++ b/Sources/GPTVoice/PermissionStatus.swift
@@ -0,0 +1,26 @@
+import AVFoundation
+
+enum PermissionStatus: Equatable {
+ case granted
+ case notRequested
+ case denied
+ case restricted
+
+ init(_ status: AVAuthorizationStatus) {
+ switch status {
+ case .authorized: self = .granted
+ case .notDetermined: self = .notRequested
+ case .restricted: self = .restricted
+ default: self = .denied
+ }
+ }
+
+ var title: String {
+ switch self {
+ case .granted: return "Allowed"
+ case .notRequested: return "Not requested"
+ case .denied: return "Off"
+ case .restricted: return "Restricted"
+ }
+ }
+}
diff --git a/Sources/GPTVoice/PermissionsPanel.swift b/Sources/GPTVoice/PermissionsPanel.swift
new file mode 100644
index 0000000..1d95cf3
--- /dev/null
+++ b/Sources/GPTVoice/PermissionsPanel.swift
@@ -0,0 +1,26 @@
+import SwiftUI
+
+/// Microphone and Accessibility rows with real grant and recovery actions. Place inside a SettingsGroup.
+struct PermissionsPanel: View {
+ @ObservedObject var model: AppModel
+ var offersManualPaste = false
+ /// True when the microphone grant is the view's single main action.
+ var prominent = false
+
+ init(model: AppModel, offersManualPaste: Bool = false, prominent: Bool = false) {
+ self.model = model
+ self.offersManualPaste = offersManualPaste
+ self.prominent = prominent
+ }
+
+ var body: some View {
+ VStack(spacing: 0) {
+ MicrophoneCard(model: model, prominent: prominent)
+ RowDivider()
+ AccessibilityCard(model: model, offersManualPaste: offersManualPaste)
+ }
+ }
+
+ /// Secondary detail shown behind a disclosure wherever permissions appear.
+ static let details = "The microphone records only between your two shortcut presses. Accessibility lets the app press ⌘V in the app you were using. It never presses Return. macOS asks you to confirm each permission. This app cannot turn them on for you."
+}
diff --git a/Sources/GPTVoice/PracticeConsole.swift b/Sources/GPTVoice/PracticeConsole.swift
new file mode 100644
index 0000000..1a864cb
--- /dev/null
+++ b/Sources/GPTVoice/PracticeConsole.swift
@@ -0,0 +1,112 @@
+import SwiftUI
+
+/// Real practice dictation in one action area. Starts only when the user selects Start.
+/// The transcript area appears only after a real result. The result is never pasted or copied.
+struct PracticeConsole: View {
+ @ObservedObject var model: AppModel
+ let goTo: (OnboardingStep) -> Void
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 12) {
+ SettingsGroup {
+ if let blocker {
+ blocker
+ } else {
+ actionArea
+ }
+ }
+ if blocker == nil, let text = model.practiceTranscript {
+ TranscriptBox(text: text)
+ }
+ }
+ }
+
+ /// The phase only while this window owns a practice session. Otherwise idle.
+ private var sessionPhase: DictationPhase { model.isPracticeSession ? model.phase : .idle }
+
+ private var blocker: AnyView? {
+ if model.isPracticeSession { return nil }
+ if model.phase.isBusy {
+ return AnyView(StatusRow(tone: .working, symbol: "", title: "Another dictation is running") {
+ Button("Cancel it") { model.cancel() }
+ .buttonStyle(AppButtonStyle(kind: .secondary, small: true))
+ .disabled(!model.phase.canCancel)
+ })
+ }
+ if !model.connection.isUsable {
+ return AnyView(StatusRow(tone: .attention, symbol: "exclamationmark.circle.fill",
+ title: "Sign in to ChatGPT first") {
+ Button("Go to Connect") { goTo(.welcome) }
+ .buttonStyle(AppButtonStyle(kind: .secondary, small: true))
+ })
+ }
+ if model.microphone != .granted {
+ return AnyView(StatusRow(tone: .attention, symbol: "exclamationmark.circle.fill",
+ title: "Allow the microphone first") {
+ Button("Go to Access") { goTo(.permissions) }
+ .buttonStyle(AppButtonStyle(kind: .secondary, small: true))
+ })
+ }
+ return nil
+ }
+
+ @ViewBuilder private var actionArea: some View {
+ switch sessionPhase {
+ case .preparing:
+ StatusRow(tone: .working, symbol: "", title: "Starting the microphone") { cancelButton }
+ case .recording:
+ HStack(spacing: 10) {
+ Circle().fill(AppPalette.recording).frame(width: 7, height: 7).accessibilityHidden(true)
+ Text("Listening").font(AppType.rowTitle)
+ Text(DictationOverlayState.format(model.elapsed))
+ .font(AppType.timer)
+ .monospacedDigit()
+ .foregroundStyle(.secondary)
+ .accessibilityLabel("Elapsed \(DictationOverlayState.format(model.elapsed))")
+ LevelMeterView(level: model.level).frame(width: 44, height: 16)
+ Spacer(minLength: 8)
+ cancelButton
+ Button("Stop") { model.stopDictation() }
+ .buttonStyle(AppButtonStyle(kind: .primary, small: true))
+ }
+ .padding(.vertical, 12)
+ case .transcribing:
+ StatusRow(tone: .working, symbol: "", title: "Transcribing") { cancelButton }
+ case .failed(let failure):
+ StatusRow(tone: .problem, symbol: "exclamationmark.triangle.fill",
+ title: "Practice did not finish", detail: failure.message) {
+ if model.canRetry {
+ Button("Retry") { model.retry() }
+ .buttonStyle(AppButtonStyle(kind: .primary, small: true))
+ }
+ switch failure.recovery {
+ case .microphoneSettings:
+ Button("Microphone settings") { model.openMicrophoneSettings() }
+ .buttonStyle(AppButtonStyle(kind: .secondary, small: true))
+ case .signInThenRetry:
+ Button("Go to Connect") { goTo(.welcome) }
+ .buttonStyle(AppButtonStyle(kind: .secondary, small: true))
+ case .retry, .none:
+ EmptyView()
+ }
+ Button("Start over") { model.startPracticeDictation() }
+ .buttonStyle(AppButtonStyle(kind: .quiet, small: true))
+ }
+ default:
+ SettingsRow(title: model.practiceTranscript == nil ? "Ready when you are" : "Try another sentence",
+ detail: "Your clipboard does not change.", showsDivider: false) {
+ Button(model.practiceTranscript == nil ? "Start" : "Try again") { model.startPracticeDictation() }
+ .buttonStyle(AppButtonStyle(kind: model.practiceTranscript == nil ? .primary : .secondary,
+ small: true))
+ .disabled(!model.canStart)
+ .accessibilityLabel(model.practiceTranscript == nil ? "Start practice" : "Try again")
+ }
+ }
+ }
+
+ /// Cancel keeps the practice context, so a later shortcut press still practices here.
+ private var cancelButton: some View {
+ Button("Cancel") { model.cancel() }
+ .buttonStyle(AppButtonStyle(kind: .quiet, small: true))
+ }
+}
diff --git a/Sources/GPTVoice/PressScaleButtonStyle.swift b/Sources/GPTVoice/PressScaleButtonStyle.swift
new file mode 100644
index 0000000..be48d98
--- /dev/null
+++ b/Sources/GPTVoice/PressScaleButtonStyle.swift
@@ -0,0 +1,13 @@
+import SwiftUI
+
+/// Scales to 0.96 on press. No scale under Reduce Motion.
+struct PressScaleButtonStyle: ButtonStyle {
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+
+ func makeBody(configuration: Configuration) -> some View {
+ configuration.label
+ .scaleEffect(configuration.isPressed && !reduceMotion ? 0.96 : 1)
+ .opacity(configuration.isPressed ? 0.8 : 1)
+ .animation(reduceMotion ? nil : .easeOut(duration: 0.1), value: configuration.isPressed)
+ }
+}
diff --git a/Sources/GPTVoice/PrivacyPage.swift b/Sources/GPTVoice/PrivacyPage.swift
new file mode 100644
index 0000000..b3b1de2
--- /dev/null
+++ b/Sources/GPTVoice/PrivacyPage.swift
@@ -0,0 +1,50 @@
+import SwiftUI
+
+/// Privacy: four concise facts with labelled details, actionable permissions, then About.
+struct PrivacyPage: View {
+ @ObservedObject var model: AppModel
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 24) {
+ SettingsGroup(title: "Your data") {
+ 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("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)
+ }
+ VStack(alignment: .leading, spacing: 8) {
+ SettingsGroup(title: "Permissions") {
+ PermissionsPanel(model: model)
+ .disabled(!model.canChangeSettings)
+ }
+ InfoDisclosure(label: "About these permissions", text: PermissionsPanel.details)
+ }
+ AboutSection()
+ }
+ }
+
+ private func fact(_ title: String, _ text: String, details: String? = nil, last: Bool = false) -> some View {
+ VStack(spacing: 0) {
+ HStack(alignment: .firstTextBaseline, spacing: 16) {
+ Text(title)
+ .font(AppType.rowTitle)
+ .frame(width: 92, alignment: .leading)
+ VStack(alignment: .leading, spacing: 6) {
+ Text(text)
+ .font(AppType.body)
+ .foregroundStyle(.secondary)
+ .fixedSize(horizontal: false, vertical: true)
+ if let details {
+ InfoDisclosure(label: "\(title) details", text: details)
+ }
+ }
+ Spacer(minLength: 0)
+ }
+ .padding(.vertical, 12)
+ if !last { RowDivider() }
+ }
+ }
+}
diff --git a/Sources/GPTVoice/QuietIconButton.swift b/Sources/GPTVoice/QuietIconButton.swift
new file mode 100644
index 0000000..5f7e873
--- /dev/null
+++ b/Sources/GPTVoice/QuietIconButton.swift
@@ -0,0 +1,36 @@
+import AppKit
+import SwiftUI
+
+/// Small borderless icon action for secondary, repeatable actions such as "check again".
+/// Always has an accessible name and a tooltip.
+struct QuietIconButton: View {
+ let symbol: String
+ let label: String
+ let action: () -> Void
+
+ @State private var hovering = false
+ @FocusState private var focused: Bool
+
+ var body: some View {
+ Button(action: action) {
+ Image(systemName: symbol)
+ .font(.system(size: 11, weight: .medium))
+ .foregroundStyle(.secondary)
+ .frame(width: 26, height: 26)
+ .background(RoundedRectangle(cornerRadius: 7, style: .continuous)
+ .fill(hovering ? AppPalette.well : .clear))
+ .contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .focused($focused)
+ .overlay(
+ RoundedRectangle(cornerRadius: 9, style: .continuous)
+ .strokeBorder(Color(nsColor: .keyboardFocusIndicatorColor), lineWidth: 2)
+ .padding(-2)
+ .opacity(focused ? 1 : 0)
+ )
+ .onHover { hovering = $0 }
+ .help(label)
+ .accessibilityLabel(label)
+ }
+}
diff --git a/Sources/GPTVoice/ReadinessList.swift b/Sources/GPTVoice/ReadinessList.swift
new file mode 100644
index 0000000..f95cd9c
--- /dev/null
+++ b/Sources/GPTVoice/ReadinessList.swift
@@ -0,0 +1,52 @@
+import SwiftUI
+
+/// Real readiness checks as rows. Each row reflects actual state, never navigation. Place inside a SettingsGroup.
+struct ReadinessList: View {
+ @ObservedObject var model: AppModel
+ @ObservedObject var preferences: AppPreferences
+ let fix: (Fix) -> Void
+
+ enum Fix {
+ case connection
+ case permissions
+ case shortcut
+ }
+
+ init(model: AppModel, fix: @escaping (Fix) -> Void) {
+ self.model = model
+ self.preferences = model.preferences
+ self.fix = fix
+ }
+
+ /// A short value that does not repeat the "ChatGPT" label.
+ private var connectionValue: String {
+ switch model.connection {
+ case .checking: return "Checking"
+ case .connected: return "Connected"
+ case .expired: return "Sign-in expired"
+ case .missing: return model.cliAvailable ? "Not signed in" : "Codex CLI not installed"
+ case .unreadable: return "Sign-in unreadable"
+ case .signingIn: return "Waiting for browser"
+ case .renewing: return "Renewing"
+ }
+ }
+
+ var body: some View {
+ let shortcutWorks = !model.missingRequirements.contains("Choose a working shortcut")
+ let automatic = preferences.automaticPaste && model.accessibilityTrusted
+ VStack(spacing: 0) {
+ ReadinessRow(title: "ChatGPT", detail: connectionValue,
+ status: model.connection.isUsable ? .ready : .missing) { fix(.connection) }
+ ReadinessRow(title: "Microphone", detail: model.microphone.title,
+ status: model.microphone == .granted ? .ready : .missing) { fix(.permissions) }
+ ReadinessRow(title: "Shortcut",
+ detail: shortcutWorks ? preferences.hotkey.accessibilityLabel : (model.hotkeyError ?? "Not registered"),
+ status: shortcutWorks ? .ready : .missing) { fix(.shortcut) }
+ ReadinessRow(title: automatic ? "Automatic paste" : "Manual paste",
+ detail: automatic ? "On" : "Optional. Text is copied for ⌘V.",
+ status: automatic ? .ready : .optional, fixTitle: "Set up", showsDivider: false) {
+ fix(.permissions)
+ }
+ }
+ }
+}
diff --git a/Sources/GPTVoice/ReadinessRow.swift b/Sources/GPTVoice/ReadinessRow.swift
new file mode 100644
index 0000000..bd75468
--- /dev/null
+++ b/Sources/GPTVoice/ReadinessRow.swift
@@ -0,0 +1,94 @@
+import SwiftUI
+
+/// One readiness line: symbol, name in a fixed label column, value in an aligned column, and a fix action.
+/// When the row is too narrow, the value moves under the name instead of breaking the column.
+struct ReadinessRow: View {
+ enum Status {
+ case ready
+ case missing
+ case optional
+ }
+
+ let title: String
+ let detail: String
+ let status: Status
+ var fixTitle = "Fix"
+ var showsDivider = true
+ var fix: (() -> Void)?
+
+ /// Fits the longest label ("Automatic paste") in Regola Medium 14 with room to spare.
+ private static let labelColumn: CGFloat = 132
+
+ var body: some View {
+ VStack(spacing: 0) {
+ HStack(alignment: .firstTextBaseline, spacing: 10) {
+ Image(systemName: symbol)
+ .font(.system(size: 12, weight: .semibold))
+ .foregroundStyle(color)
+ .frame(width: 16)
+ .accessibilityHidden(true)
+ ViewThatFits(in: .horizontal) {
+ HStack(alignment: .firstTextBaseline, spacing: 12) {
+ Text(title).font(AppType.rowTitle)
+ .frame(width: Self.labelColumn, alignment: .leading)
+ value
+ Spacer(minLength: 8)
+ fixButton
+ }
+ HStack(alignment: .firstTextBaseline, spacing: 12) {
+ VStack(alignment: .leading, spacing: 2) {
+ Text(title).font(AppType.rowTitle)
+ value
+ }
+ Spacer(minLength: 8)
+ fixButton
+ }
+ }
+ }
+ .padding(.vertical, 12)
+ .accessibilityElement(children: .contain)
+ .accessibilityLabel("\(title), \(statusWord), \(detail)")
+ if showsDivider { RowDivider() }
+ }
+ }
+
+ private var value: some View {
+ Text(detail)
+ .font(AppType.detail)
+ .foregroundStyle(.secondary)
+ .fixedSize(horizontal: false, vertical: true)
+ }
+
+ @ViewBuilder private var fixButton: some View {
+ if let fix, status != .ready {
+ Button(fixTitle, action: fix)
+ .buttonStyle(AppButtonStyle(kind: status == .missing ? .secondary : .quiet, small: true))
+ .fixedSize()
+ .accessibilityLabel("\(fixTitle): \(title)")
+ }
+ }
+
+ private var statusWord: String {
+ switch status {
+ case .ready: return "ready"
+ case .missing: return "missing"
+ case .optional: return "optional"
+ }
+ }
+
+ private var symbol: String {
+ switch status {
+ case .ready: return "checkmark.circle.fill"
+ case .missing: return "exclamationmark.circle.fill"
+ case .optional: return "circle.dashed"
+ }
+ }
+
+ private var color: Color {
+ switch status {
+ case .ready: return AppPalette.success
+ case .missing: return AppPalette.warning
+ case .optional: return .secondary
+ }
+ }
+}
diff --git a/Sources/GPTVoice/Resources/Fonts/FTRegolaNeue-Medium.otf b/Sources/GPTVoice/Resources/Fonts/FTRegolaNeue-Medium.otf
new file mode 100644
index 0000000..bd8aafe
Binary files /dev/null and b/Sources/GPTVoice/Resources/Fonts/FTRegolaNeue-Medium.otf differ
diff --git a/Sources/GPTVoice/Resources/Fonts/FTRegolaNeue-Regular.otf b/Sources/GPTVoice/Resources/Fonts/FTRegolaNeue-Regular.otf
new file mode 100644
index 0000000..c4745b8
Binary files /dev/null and b/Sources/GPTVoice/Resources/Fonts/FTRegolaNeue-Regular.otf differ
diff --git a/Sources/GPTVoice/Resources/Fonts/FTRegolaNeue-Semibold.otf b/Sources/GPTVoice/Resources/Fonts/FTRegolaNeue-Semibold.otf
new file mode 100644
index 0000000..0130e71
Binary files /dev/null and b/Sources/GPTVoice/Resources/Fonts/FTRegolaNeue-Semibold.otf differ
diff --git a/Sources/GPTVoice/RowDivider.swift b/Sources/GPTVoice/RowDivider.swift
new file mode 100644
index 0000000..1f791a2
--- /dev/null
+++ b/Sources/GPTVoice/RowDivider.swift
@@ -0,0 +1,8 @@
+import SwiftUI
+
+/// The hairline between rows inside a SettingsGroup.
+struct RowDivider: View {
+ var body: some View {
+ Rectangle().fill(AppPalette.hairline).frame(height: 1).accessibilityHidden(true)
+ }
+}
diff --git a/Sources/GPTVoice/SettingsGroup.swift b/Sources/GPTVoice/SettingsGroup.swift
new file mode 100644
index 0000000..5ac8989
--- /dev/null
+++ b/Sources/GPTVoice/SettingsGroup.swift
@@ -0,0 +1,30 @@
+import SwiftUI
+
+/// One section: an optional heading, then rows on a single flat surface (radius 12, one hairline).
+/// Rows inside use dividers. Never nest a group inside another group.
+struct SettingsGroup<Content: View>: View {
+ var title: String?
+ var footnote: String?
+ @ViewBuilder var content: () -> Content
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 8) {
+ if let title {
+ Text(title)
+ .font(AppType.heading)
+ .accessibilityAddTraits(.isHeader)
+ }
+ VStack(alignment: .leading, spacing: 0) { content() }
+ .padding(.horizontal, 16)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .background(RoundedRectangle(cornerRadius: 12, style: .continuous).fill(AppPalette.surface))
+ .overlay(RoundedRectangle(cornerRadius: 12, style: .continuous).strokeBorder(AppPalette.hairline))
+ if let footnote {
+ Text(footnote)
+ .font(AppType.detail)
+ .foregroundStyle(.secondary)
+ .fixedSize(horizontal: false, vertical: true)
+ }
+ }
+ }
+}
diff --git a/Sources/GPTVoice/SettingsLockBanner.swift b/Sources/GPTVoice/SettingsLockBanner.swift
new file mode 100644
index 0000000..5cf5dcc
--- /dev/null
+++ b/Sources/GPTVoice/SettingsLockBanner.swift
@@ -0,0 +1,13 @@
+import SwiftUI
+
+/// Shown while dictation is active and settings cannot change.
+struct SettingsLockBanner: View {
+ var body: some View {
+ HStack(spacing: 8) {
+ Circle().fill(AppPalette.recording).frame(width: 6, height: 6)
+ Text("Dictation is active. Finish or cancel it to change settings.")
+ .font(AppType.detail)
+ }
+ .accessibilityElement(children: .combine)
+ }
+}
diff --git a/Sources/GPTVoice/SettingsPage.swift b/Sources/GPTVoice/SettingsPage.swift
new file mode 100644
index 0000000..3875460
--- /dev/null
+++ b/Sources/GPTVoice/SettingsPage.swift
@@ -0,0 +1,39 @@
+import Foundation
+
+enum SettingsPage: String, CaseIterable, Identifiable {
+ case home
+ case shortcuts
+ case appearance
+ case preferences
+ case privacy
+
+ var id: String { rawValue }
+
+ var title: String {
+ switch self {
+ case .home: return "Home"
+ case .shortcuts: return "Shortcut"
+ case .appearance: return "Appearance"
+ case .preferences: return "Preferences"
+ case .privacy: return "Privacy"
+ }
+ }
+
+ var symbol: String {
+ switch self {
+ case .home: return "house"
+ case .shortcuts: return "command"
+ case .appearance: return "circle.lefthalf.filled"
+ case .preferences: return "slider.horizontal.3"
+ case .privacy: return "hand.raised"
+ }
+ }
+
+ /// A subtitle only where the title alone does not explain the page.
+ 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
+ }
+ }
+}
diff --git a/Sources/GPTVoice/SettingsRow.swift b/Sources/GPTVoice/SettingsRow.swift
new file mode 100644
index 0000000..b1b3700
--- /dev/null
+++ b/Sources/GPTVoice/SettingsRow.swift
@@ -0,0 +1,44 @@
+import SwiftUI
+
+/// Label and detail on the leading side, control on the trailing side, with a divider below.
+/// Stacks the control under the label when the row is too narrow.
+struct SettingsRow<Control: View>: View {
+ let title: String
+ var detail: String?
+ var showsDivider = true
+ @ViewBuilder var control: () -> Control
+
+ var body: some View {
+ VStack(spacing: 0) {
+ ViewThatFits(in: .horizontal) {
+ HStack(alignment: .center, spacing: 16) {
+ labels
+ Spacer(minLength: 12)
+ control()
+ }
+ VStack(alignment: .leading, spacing: 10) {
+ labels
+ control()
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(.vertical, 12)
+ if showsDivider {
+ Rectangle().fill(AppPalette.hairline).frame(height: 1).accessibilityHidden(true)
+ }
+ }
+ }
+
+ private var labels: some View {
+ VStack(alignment: .leading, spacing: 2) {
+ Text(title).font(AppType.rowTitle)
+ if let detail {
+ Text(detail)
+ .font(AppType.detail)
+ .foregroundStyle(.secondary)
+ .fixedSize(horizontal: false, vertical: true)
+ }
+ }
+ }
+}
diff --git a/Sources/GPTVoice/SettingsSidebar.swift b/Sources/GPTVoice/SettingsSidebar.swift
new file mode 100644
index 0000000..2545f89
--- /dev/null
+++ b/Sources/GPTVoice/SettingsSidebar.swift
@@ -0,0 +1,35 @@
+import SwiftUI
+
+/// Settings navigation. The top strip stays clear for the native window buttons and drags the window.
+struct SettingsSidebar: View {
+ @Binding var selection: SettingsPage
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 2) {
+ WindowDragArea()
+ .frame(height: HostingWindowController.chromeHeight)
+
+ HStack(spacing: 8) {
+ WaveMark(size: 20)
+ Text("GPT Voice").font(AppType.heading)
+ }
+ .padding(.horizontal, 10)
+ .padding(.bottom, 16)
+ .accessibilityElement(children: .ignore)
+ .accessibilityLabel("GPT Voice")
+
+ ForEach(SettingsPage.allCases) { page in
+ Button(page.title) { selection = page }
+ .buttonStyle(SidebarButtonStyle(isSelected: page == selection, symbol: page.symbol))
+ .accessibilityAddTraits(page == selection ? .isSelected : [])
+ }
+ Spacer(minLength: 0)
+ }
+ .padding(.horizontal, 10)
+ .padding(.bottom, 16)
+ .frame(width: 192)
+ .frame(maxHeight: .infinity)
+ .background(AppPalette.sidebar)
+ .overlay(alignment: .trailing) { Rectangle().fill(AppPalette.hairline).frame(width: 1) }
+ }
+}
diff --git a/Sources/GPTVoice/SettingsView.swift b/Sources/GPTVoice/SettingsView.swift
new file mode 100644
index 0000000..1c3ee36
--- /dev/null
+++ b/Sources/GPTVoice/SettingsView.swift
@@ -0,0 +1,64 @@
+import AppKit
+import SwiftUI
+
+/// Settings window: sidebar and one scrollable page under integrated window chrome.
+struct SettingsView: View {
+ @ObservedObject var model: AppModel
+ @ObservedObject var preferences: AppPreferences
+ @State private var page: SettingsPage = .home
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+
+ init(model: AppModel) {
+ self.model = model
+ self.preferences = model.preferences
+ }
+
+ var body: some View {
+ HStack(spacing: 0) {
+ SettingsSidebar(selection: $page)
+ ZStack(alignment: .top) {
+ ScrollView {
+ VStack(alignment: .leading, spacing: 24) {
+ PageHeader(title: page.title, intro: page.intro)
+ if !model.canChangeSettings, page != .appearance {
+ SettingsLockBanner()
+ }
+ content
+ .id(page)
+ .transition(.opacity)
+ }
+ .padding(.horizontal, 32)
+ .padding(.top, HostingWindowController.chromeHeight)
+ .padding(.bottom, 32)
+ .frame(maxWidth: 640, alignment: .leading)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
+ // Blank header strip: drags the window. Content scrolls under a short fade.
+ WindowDragArea()
+ .frame(height: HostingWindowController.chromeHeight - 12)
+ .background(LinearGradient(colors: [AppPalette.canvas, AppPalette.canvas.opacity(0)],
+ startPoint: .top, endPoint: .bottom))
+ }
+ .background(AppPalette.canvas)
+ }
+ .animation(AppMotion.reveal(reduceMotion), value: page)
+ .frame(minWidth: 720, idealWidth: 820, minHeight: 540, idealHeight: 600)
+ .onAppear { model.refreshStatus() }
+ .onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { _ in
+ model.refreshStatus()
+ }
+ .onReceive(NotificationCenter.default.publisher(for: NSWindow.didBecomeKeyNotification)) { _ in
+ model.refreshStatus()
+ }
+ }
+
+ @ViewBuilder private var content: some View {
+ switch page {
+ case .home: HomePage(model: model) { page = $0 }
+ case .shortcuts: ShortcutPanel(model: model)
+ case .appearance: AppearanceSection(preferences: preferences)
+ case .preferences: BehaviorSection(model: model)
+ case .privacy: PrivacyPage(model: model)
+ }
+ }
+}
diff --git a/Sources/GPTVoice/ShortcutPanel.swift b/Sources/GPTVoice/ShortcutPanel.swift
new file mode 100644
index 0000000..39cfce0
--- /dev/null
+++ b/Sources/GPTVoice/ShortcutPanel.swift
@@ -0,0 +1,56 @@
+import SwiftUI
+
+/// Keycaps and recorder, quiet presets, then the receipt test. Start and stop are explained by the caller once.
+struct ShortcutPanel: View {
+ @ObservedObject var model: AppModel
+ @ObservedObject var preferences: AppPreferences
+
+ init(model: AppModel) {
+ self.model = model
+ self.preferences = model.preferences
+ }
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 12) {
+ SettingsGroup {
+ SettingsRow(title: "Shortcut") {
+ KeycapsView(spec: preferences.hotkey)
+ }
+ SettingsRow(title: "Change") {
+ ShortcutRecorderField(model: model, isEnabled: model.canChangeSettings)
+ .frame(width: 220, height: 30)
+ }
+ SettingsRow(title: "Presets") {
+ HStack(spacing: 6) {
+ Button("Command–Space") { model.useCommandSpace() }
+ .buttonStyle(AppButtonStyle(kind: .secondary, small: true))
+ .disabled(!model.canChangeSettings || model.commandSpaceIsActive)
+ .accessibilityLabel("Use Command–Space")
+ Button("Default") { model.resetHotkey() }
+ .buttonStyle(AppButtonStyle(kind: .secondary, small: true))
+ .disabled(!model.canChangeSettings || preferences.hotkey == .default)
+ .accessibilityLabel("Reset to default shortcut")
+ }
+ }
+ ShortcutTestRow(model: model)
+ }
+
+ if let error = model.hotkeyError {
+ SettingsGroup {
+ StatusRow(tone: .problem, symbol: "exclamationmark.triangle.fill",
+ title: "That shortcut cannot be used", detail: error) {
+ if model.hotkeyBlockedBySystem {
+ Button("Keyboard settings") { model.openKeyboardShortcutsSettings() }
+ .buttonStyle(AppButtonStyle(kind: .secondary, showsArrow: true, small: true))
+ }
+ }
+ }
+ }
+
+ InfoDisclosure(label: "Shortcut not responding?",
+ text: "Another app may use the same keys. Check ChatGPT and System Settings > Keyboard > Keyboard Shortcuts, or choose another shortcut. The recorder cannot capture keys macOS keeps, such as Command–Space. Use the preset for those.")
+ }
+ // Never leave a listening test behind when the panel goes away.
+ .onDisappear { model.endShortcutTest() }
+ }
+}
diff --git a/Sources/GPTVoice/ShortcutRecorderField.swift b/Sources/GPTVoice/ShortcutRecorderField.swift
new file mode 100644
index 0000000..14e8d0f
--- /dev/null
+++ b/Sources/GPTVoice/ShortcutRecorderField.swift
@@ -0,0 +1,30 @@
+import SwiftUI
+
+/// SwiftUI wrapper for the native shortcut recorder. Suspends the global shortcut while recording.
+struct ShortcutRecorderField: NSViewRepresentable {
+ @ObservedObject var model: AppModel
+ let isEnabled: Bool
+
+ func makeNSView(context: Context) -> ShortcutRecorderNSView {
+ let view = ShortcutRecorderNSView()
+ view.setContentHuggingPriority(.defaultHigh, for: .vertical)
+ // Let the SwiftUI frame win over the view's intrinsic width, so the field never overhangs its row.
+ view.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
+ return view
+ }
+
+ func updateNSView(_ view: ShortcutRecorderNSView, context: Context) {
+ let model = model
+ view.onBegin = { model.beginShortcutCapture() }
+ view.onEnd = { model.endShortcutCapture() }
+ view.onCapture = { model.setHotkey($0) }
+ view.onProblem = { model.reportShortcutProblem($0) }
+ view.currentLabel = model.hotkey.accessibilityLabel
+ view.isEnabled = isEnabled
+ view.accentColor = model.preferences.accent.nsColor
+ }
+
+ static func dismantleNSView(_ view: ShortcutRecorderNSView, coordinator: ()) {
+ view.isEnabled = false
+ }
+}
diff --git a/Sources/GPTVoice/ShortcutRecorderNSView.swift b/Sources/GPTVoice/ShortcutRecorderNSView.swift
new file mode 100644
index 0000000..ec373ed
--- /dev/null
+++ b/Sources/GPTVoice/ShortcutRecorderNSView.swift
@@ -0,0 +1,167 @@
+import AppKit
+import Carbon.HIToolbox
+
+/// A focusable control that records one modifier+key shortcut.
+/// Click it, or focus it and press Space or Return, to start. Esc cancels.
+final class ShortcutRecorderNSView: NSView {
+ var onBegin: () -> Void = {}
+ var onEnd: () -> Void = {}
+ /// Returns true when the shortcut was saved.
+ var onCapture: (HotkeySpec) -> Bool = { _ in false }
+ var onProblem: (HotkeySpec.Problem) -> Void = { _ in }
+ var currentLabel = "" { didSet { updateAccessibility() } }
+ var accentColor: NSColor = .controlAccentColor { didSet { needsDisplay = true } }
+ var isEnabled = true {
+ didSet {
+ if !isEnabled { stopRecording() }
+ needsDisplay = true
+ }
+ }
+
+ private(set) var isRecording = false {
+ didSet {
+ needsDisplay = true
+ updateAccessibility()
+ }
+ }
+ private var observers: [NSObjectProtocol] = []
+ private static let radius: CGFloat = 6
+
+ override init(frame frameRect: NSRect) {
+ super.init(frame: frameRect)
+ focusRingType = .default
+ setAccessibilityElement(true)
+ setAccessibilityRole(.button)
+ setAccessibilityLabel("Keyboard shortcut recorder")
+ updateAccessibility()
+ }
+
+ required init?(coder: NSCoder) { nil }
+
+ override var intrinsicContentSize: NSSize { NSSize(width: 220, height: 28) }
+ override var acceptsFirstResponder: Bool { isEnabled }
+ override var canBecomeKeyView: Bool { isEnabled }
+ override var focusRingMaskBounds: NSRect { bounds }
+
+ override func drawFocusRingMask() {
+ NSBezierPath(roundedRect: bounds, xRadius: 8, yRadius: 8).fill()
+ }
+
+ /// Rounded-rectangle painting (radius 8). Idle: recessed well. Recording: light accent wash and a 2 pt accent edge.
+ override func draw(_ dirtyRect: NSRect) {
+ let rect = bounds.insetBy(dx: 1, dy: 1)
+ let radius: CGFloat = 8
+ let path = NSBezierPath(roundedRect: rect, xRadius: radius, yRadius: radius)
+ AppPalette.nsWell.setFill()
+ path.fill()
+ if isRecording {
+ accentColor.withAlphaComponent(0.08).setFill()
+ path.fill()
+ }
+ (isRecording ? accentColor : NSColor.separatorColor.withAlphaComponent(0.4)).setStroke()
+ path.lineWidth = isRecording ? 2 : 1
+ path.stroke()
+
+ let text = isRecording ? "Press the new keys. Esc cancels." : "Click to record"
+ let color: NSColor = !isEnabled ? .tertiaryLabelColor : (isRecording ? .labelColor : .secondaryLabelColor)
+ let style = NSMutableParagraphStyle()
+ style.alignment = .center
+ style.lineBreakMode = .byTruncatingTail
+ let attributes: [NSAttributedString.Key: Any] = [
+ .font: AppType.nsControlSmall,
+ .foregroundColor: color,
+ .paragraphStyle: style
+ ]
+ let string = NSAttributedString(string: text, attributes: attributes)
+ let height = string.size().height
+ string.draw(in: NSRect(x: 8, y: (bounds.height - height) / 2, width: bounds.width - 16, height: height))
+ }
+
+ override func mouseDown(with event: NSEvent) {
+ guard isEnabled else { return }
+ window?.makeFirstResponder(self)
+ startRecording()
+ }
+
+ override func accessibilityPerformPress() -> Bool {
+ guard isEnabled else { return false }
+ window?.makeFirstResponder(self)
+ startRecording()
+ return true
+ }
+
+ override func keyDown(with event: NSEvent) {
+ let flags = event.modifierFlags.intersection(.deviceIndependentFlagsMask)
+ let plain = flags.intersection([.command, .option, .control, .shift]).isEmpty
+ guard isRecording else {
+ if plain, [kVK_Space, kVK_Return].contains(Int(event.keyCode)) {
+ startRecording()
+ } else if plain, Int(event.keyCode) == kVK_Tab {
+ window?.selectNextKeyView(self)
+ } else {
+ super.keyDown(with: event)
+ }
+ return
+ }
+ handle(event)
+ }
+
+ override func performKeyEquivalent(with event: NSEvent) -> Bool {
+ guard isRecording, window?.firstResponder === self else { return super.performKeyEquivalent(with: event) }
+ handle(event)
+ return true
+ }
+
+ override func resignFirstResponder() -> Bool {
+ stopRecording()
+ return super.resignFirstResponder()
+ }
+
+ override func viewWillMove(toWindow newWindow: NSWindow?) {
+ stopRecording()
+ observers.forEach(NotificationCenter.default.removeObserver)
+ observers.removeAll()
+ super.viewWillMove(toWindow: newWindow)
+ }
+
+ override func viewDidMoveToWindow() {
+ super.viewDidMoveToWindow()
+ guard let window else { return }
+ for name in [NSWindow.didResignKeyNotification, NSWindow.willCloseNotification] {
+ observers.append(NotificationCenter.default.addObserver(forName: name, object: window, queue: .main) {
+ [weak self] _ in self?.stopRecording()
+ })
+ }
+ }
+
+ private func handle(_ event: NSEvent) {
+ let flags = event.modifierFlags.intersection(.deviceIndependentFlagsMask)
+ if Int(event.keyCode) == kVK_Escape, flags.intersection([.command, .option, .control, .shift]).isEmpty {
+ stopRecording()
+ return
+ }
+ let spec = HotkeySpec(keyCode: event.keyCode, cocoaModifiers: flags)
+ if let problem = spec.problem {
+ onProblem(problem)
+ return
+ }
+ if onCapture(spec) { stopRecording() }
+ }
+
+ private func startRecording() {
+ guard isEnabled, !isRecording else { return }
+ isRecording = true
+ onBegin()
+ }
+
+ private func stopRecording() {
+ guard isRecording else { return }
+ isRecording = false
+ onEnd()
+ }
+
+ private func updateAccessibility() {
+ setAccessibilityValue(isRecording ? "Recording. Press a shortcut, or Esc to cancel." : currentLabel)
+ setAccessibilityHelp("Records a new keyboard shortcut for dictation.")
+ }
+}
diff --git a/Sources/GPTVoice/ShortcutTestRow.swift b/Sources/GPTVoice/ShortcutTestRow.swift
new file mode 100644
index 0000000..e10e649
--- /dev/null
+++ b/Sources/GPTVoice/ShortcutTestRow.swift
@@ -0,0 +1,50 @@
+import SwiftUI
+
+/// Checks that the real global shortcut reaches this app. The model's Carbon handler reports receipt.
+/// Nothing here listens for keys, records, transcribes, pastes, or touches the clipboard.
+struct ShortcutTestRow: View {
+ @ObservedObject var model: AppModel
+ @ObservedObject var preferences: AppPreferences
+
+ init(model: AppModel) {
+ self.model = model
+ self.preferences = model.preferences
+ }
+
+ var body: some View {
+ Group {
+ switch model.shortcutTestStatus {
+ case .idle:
+ SettingsRow(title: "Test shortcut", showsDivider: false) {
+ Button("Test") { model.beginShortcutTest() }
+ .buttonStyle(AppButtonStyle(kind: .secondary, small: true))
+ .disabled(!model.canChangeSettings)
+ .accessibilityLabel("Test shortcut")
+ }
+ case .listening:
+ StatusRow(tone: .working, symbol: "", title: "Press \(preferences.hotkey.displayLabel)",
+ detail: "Microphone off") {
+ Button("Cancel") { model.endShortcutTest() }
+ .buttonStyle(AppButtonStyle(kind: .quiet, small: true))
+ }
+ case .received:
+ StatusRow(tone: .good, symbol: "checkmark.circle.fill", title: "Shortcut received",
+ detail: "Nothing was recorded.") {
+ Button("Done") { model.endShortcutTest() }
+ .buttonStyle(AppButtonStyle(kind: .secondary, small: true))
+ }
+ case .unavailable(let reason):
+ StatusRow(tone: .problem, symbol: "exclamationmark.triangle.fill",
+ title: "Cannot test the shortcut", detail: reason) {
+ if model.hotkeyBlockedBySystem {
+ Button("Keyboard settings") { model.openKeyboardShortcutsSettings() }
+ .buttonStyle(AppButtonStyle(kind: .secondary, showsArrow: true, small: true))
+ }
+ Button("Done") { model.endShortcutTest() }
+ .buttonStyle(AppButtonStyle(kind: .quiet, small: true))
+ }
+ }
+ }
+ .accessibilityElement(children: .contain)
+ }
+}
diff --git a/Sources/GPTVoice/ShortcutTestStatus.swift b/Sources/GPTVoice/ShortcutTestStatus.swift
new file mode 100644
index 0000000..fc67391
--- /dev/null
+++ b/Sources/GPTVoice/ShortcutTestStatus.swift
@@ -0,0 +1,8 @@
+import Foundation
+
+enum ShortcutTestStatus: Equatable {
+ case idle
+ case listening
+ case received
+ case unavailable(String)
+}
diff --git a/Sources/GPTVoice/SidebarButtonStyle.swift b/Sources/GPTVoice/SidebarButtonStyle.swift
new file mode 100644
index 0000000..51a8153
--- /dev/null
+++ b/Sources/GPTVoice/SidebarButtonStyle.swift
@@ -0,0 +1,11 @@
+import SwiftUI
+
+/// Sidebar row: plain icon and text, quiet selection fill, hover tint, and a keyboard focus ring.
+struct SidebarButtonStyle: ButtonStyle {
+ let isSelected: Bool
+ let symbol: String
+
+ func makeBody(configuration: Configuration) -> some View {
+ SidebarItemLabel(configuration: configuration, isSelected: isSelected, symbol: symbol)
+ }
+}
diff --git a/Sources/GPTVoice/SidebarItemLabel.swift b/Sources/GPTVoice/SidebarItemLabel.swift
new file mode 100644
index 0000000..99c4948
--- /dev/null
+++ b/Sources/GPTVoice/SidebarItemLabel.swift
@@ -0,0 +1,41 @@
+import AppKit
+import SwiftUI
+
+/// Rendering for `SidebarButtonStyle`.
+struct SidebarItemLabel: View {
+ let configuration: ButtonStyle.Configuration
+ let isSelected: Bool
+ let symbol: String
+
+ @State private var hovering = false
+ @Environment(\.isFocused) private var isFocused
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+
+ var body: some View {
+ HStack(spacing: 9) {
+ Image(systemName: symbol)
+ .font(.system(size: 12.5, weight: .regular))
+ .foregroundStyle(isSelected ? Color.primary : Color.secondary)
+ .frame(width: 16)
+ configuration.label
+ .font(isSelected ? AppType.rowTitle : AppType.body)
+ .foregroundStyle(isSelected ? Color.primary : Color.secondary)
+ Spacer(minLength: 0)
+ }
+ .padding(.horizontal, 10)
+ .frame(height: 30)
+ .background(
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
+ .fill(isSelected ? AppPalette.well : (hovering ? AppPalette.well.opacity(0.5) : .clear))
+ )
+ .overlay(
+ RoundedRectangle(cornerRadius: 8, style: .continuous)
+ .strokeBorder(Color(nsColor: .keyboardFocusIndicatorColor), lineWidth: 2)
+ .opacity(isFocused ? 1 : 0)
+ )
+ .contentShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
+ .opacity(configuration.isPressed ? 0.75 : 1)
+ .animation(AppMotion.control(reduceMotion), value: hovering)
+ .onHover { hovering = $0 }
+ }
+}
diff --git a/Sources/GPTVoice/SingleInstance.swift b/Sources/GPTVoice/SingleInstance.swift
new file mode 100644
index 0000000..d3cec28
--- /dev/null
+++ b/Sources/GPTVoice/SingleInstance.swift
@@ -0,0 +1,21 @@
+import AppKit
+
+/// Prevents a second GUI instance from registering a second shortcut.
+enum SingleInstance {
+ /// Returns true when another instance runs. It then receives a request to show a window.
+ static func forwardToRunningInstance(_ options: LaunchOptions) -> Bool {
+ if case .transcribeAndPaste = options { return false }
+ if case .practiceAudio = options { return false }
+ guard let bundleID = Bundle.main.bundleIdentifier else { return false }
+ let ownPID = ProcessInfo.processInfo.processIdentifier
+ let others = NSRunningApplication.runningApplications(withBundleIdentifier: bundleID)
+ .filter { $0.processIdentifier != ownPID && !$0.isTerminated }
+ guard !others.isEmpty else { return false }
+ let name = options == .showOnboarding
+ ? LaunchOptions.showOnboardingNotification
+ : LaunchOptions.showSettingsNotification
+ DistributedNotificationCenter.default().postNotificationName(name, object: nil, userInfo: nil,
+ deliverImmediately: true)
+ return true
+ }
+}
diff --git a/Sources/GPTVoice/SoundCue.swift b/Sources/GPTVoice/SoundCue.swift
new file mode 100644
index 0000000..03cffaf
--- /dev/null
+++ b/Sources/GPTVoice/SoundCue.swift
@@ -0,0 +1,17 @@
+import AppKit
+
+enum SoundCue {
+ case start
+ case stop
+ case failure
+
+ func play() {
+ let name: String
+ switch self {
+ case .start: name = "Tink"
+ case .stop: name = "Pop"
+ case .failure: name = "Basso"
+ }
+ NSSound(named: NSSound.Name(name))?.play()
+ }
+}
diff --git a/Sources/GPTVoice/StatusMenuController.swift b/Sources/GPTVoice/StatusMenuController.swift
new file mode 100644
index 0000000..f369876
--- /dev/null
+++ b/Sources/GPTVoice/StatusMenuController.swift
@@ -0,0 +1,102 @@
+import AppKit
+import Combine
+
+/// The always-visible menu bar item. Rebuilds its menu from model state each time it opens.
+/// Opening the menu does not activate the app, so the paste target stays frontmost.
+@MainActor
+final class StatusMenuController: NSObject, NSMenuDelegate {
+ private let model: AppModel
+ private let windows: WindowCoordinator
+ private let statusItem: NSStatusItem
+ private let menu: NSMenu
+ private var phaseObserver: AnyCancellable?
+
+ init(model: AppModel, windows: WindowCoordinator) {
+ self.model = model
+ self.windows = windows
+ statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
+ menu = NSMenu()
+ super.init()
+ menu.delegate = self
+ menu.autoenablesItems = false
+ statusItem.menu = menu
+ statusItem.isVisible = true
+ updateIcon(for: model.phase)
+ phaseObserver = model.$phase
+ .removeDuplicates()
+ .receive(on: DispatchQueue.main)
+ .sink { [weak self] phase in self?.updateIcon(for: phase) }
+ }
+
+ private func updateIcon(for phase: DictationPhase) {
+ let symbol: String
+ let description: String
+ switch phase {
+ case .recording: symbol = "mic.fill"; description = "GPT Voice, listening"
+ case .preparing, .transcribing, .pasting: symbol = "mic.circle"; description = "GPT Voice, working"
+ case .failed: symbol = "mic.slash"; description = "GPT Voice, needs attention"
+ case .idle, .finished: symbol = "mic"; description = "GPT Voice"
+ }
+ let image = NSImage(systemSymbolName: symbol, accessibilityDescription: description)
+ ?? NSImage(systemSymbolName: "mic", accessibilityDescription: description)
+ image?.isTemplate = true
+ statusItem.button?.image = image
+ statusItem.button?.toolTip = description
+ }
+
+ func menuNeedsUpdate(_ menu: NSMenu) {
+ model.refreshStatus()
+ menu.removeAllItems()
+
+ let status = NSMenuItem(title: model.statusText, action: nil, keyEquivalent: "")
+ status.isEnabled = false
+ menu.addItem(status)
+ menu.addItem(.separator())
+
+ let recording = model.phase == .recording
+ let toggle = item(recording ? "Stop Dictation" : "Start Dictation", #selector(toggleDictation),
+ enabled: recording || model.canStart)
+ if let key = model.hotkey.menuKeyEquivalent {
+ toggle.keyEquivalent = key
+ toggle.keyEquivalentModifierMask = model.hotkey.cocoaModifiers
+ } else {
+ toggle.title += " (\(model.hotkey.displayLabel))"
+ }
+ menu.addItem(toggle)
+ if model.phase.canCancel {
+ menu.addItem(item("Cancel", #selector(cancel), enabled: true))
+ }
+ if model.canRetry {
+ menu.addItem(item("Retry", #selector(retry), enabled: true))
+ }
+ menu.addItem(.separator())
+ let hasTranscript = model.lastTranscript != nil
+ menu.addItem(item("Paste Last Transcript", #selector(pasteLast), enabled: hasTranscript && model.canStart))
+ menu.addItem(item("Copy Last Transcript", #selector(copyLast), enabled: hasTranscript))
+ menu.addItem(.separator())
+ let settings = item("Settings…", #selector(showSettings), enabled: true)
+ settings.keyEquivalent = ","
+ menu.addItem(settings)
+ menu.addItem(item("Run Setup Again…", #selector(showOnboarding), enabled: true))
+ menu.addItem(.separator())
+ let quit = item("Quit GPT Voice", #selector(quit), enabled: true)
+ quit.keyEquivalent = "q"
+ menu.addItem(quit)
+ }
+
+ private func item(_ title: String, _ action: Selector, enabled: Bool) -> NSMenuItem {
+ let item = NSMenuItem(title: title, action: action, keyEquivalent: "")
+ item.target = self
+ item.isEnabled = enabled
+ return item
+ }
+
+ @objc private func toggleDictation() { model.toggleDictation() }
+ @objc private func cancel() { model.cancel() }
+ @objc private func retry() { model.retry() }
+ @objc private func pasteLast() { model.pasteLastTranscript() }
+ @objc private func copyLast() { model.copyLastTranscript() }
+ @objc private func showSettings() { windows.showSettings() }
+ @objc private func showOnboarding() { windows.showOnboarding() }
+ @objc private func quit() { NSApp.terminate(nil) }
+}
diff --git a/Sources/GPTVoice/StatusRow.swift b/Sources/GPTVoice/StatusRow.swift
new file mode 100644
index 0000000..1b03555
--- /dev/null
+++ b/Sources/GPTVoice/StatusRow.swift
@@ -0,0 +1,78 @@
+import SwiftUI
+
+/// One status line inside a section: tone symbol, title, optional detail or trailing value, and trailing actions.
+/// The symbol aligns with the title's first baseline. Actions sit at the trailing edge, and when the row is
+/// too narrow they move under the text, aligned to the title. Includes its own vertical row inset.
+struct StatusRow<Actions: View>: View {
+ let tone: StatusTone
+ let symbol: String
+ let title: String
+ var detail: String = ""
+ /// A short state word shown on the same line, trailing, for healthy rows ("Allowed").
+ var value: String?
+ @ViewBuilder var actions: () -> Actions
+
+ var body: some View {
+ HStack(alignment: .firstTextBaseline, spacing: 10) {
+ indicator
+ ViewThatFits(in: .horizontal) {
+ HStack(alignment: .firstTextBaseline, spacing: 12) {
+ labels
+ Spacer(minLength: 8)
+ trailing
+ }
+ VStack(alignment: .leading, spacing: 10) {
+ labels
+ trailing
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
+ }
+ .padding(.vertical, 12)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
+
+ @ViewBuilder private var indicator: some View {
+ Group {
+ if tone == .working {
+ ActivityIndicator(size: 11)
+ } else {
+ Image(systemName: symbol)
+ .font(.system(size: 12, weight: .semibold))
+ .foregroundStyle(tone.color)
+ }
+ }
+ .frame(width: 16)
+ .accessibilityHidden(true)
+ }
+
+ private var trailing: some View {
+ HStack(alignment: .firstTextBaseline, spacing: 6) {
+ if let value {
+ // Included in the labels' accessible name, so hidden here to avoid reading it twice.
+ Text(value).font(AppType.detail).foregroundStyle(.secondary)
+ .accessibilityHidden(true)
+ }
+ actions()
+ }
+ }
+
+ private var labels: some View {
+ VStack(alignment: .leading, spacing: 2) {
+ Text(title).font(AppType.rowTitle)
+ if !detail.isEmpty {
+ Text(detail)
+ .font(AppType.detail)
+ .foregroundStyle(.secondary)
+ .fixedSize(horizontal: false, vertical: true)
+ }
+ }
+ .accessibilityElement(children: .ignore)
+ .accessibilityLabel(accessibleName)
+ }
+
+ /// One explicit name: title, then detail and value when present ("Microphone, Allowed").
+ private var accessibleName: String {
+ [title, detail, value ?? ""].filter { !$0.isEmpty }.joined(separator: ", ")
+ }
+}
diff --git a/Sources/GPTVoice/StatusTone.swift b/Sources/GPTVoice/StatusTone.swift
new file mode 100644
index 0000000..7daf255
--- /dev/null
+++ b/Sources/GPTVoice/StatusTone.swift
@@ -0,0 +1,19 @@
+import SwiftUI
+
+/// Meaning of a status row. Each tone has a symbol and words, so color is never the only cue.
+enum StatusTone {
+ case good
+ case attention
+ case problem
+ case working
+ case neutral
+
+ var color: Color {
+ switch self {
+ case .good: return AppPalette.success
+ case .attention: return AppPalette.warning
+ case .problem: return AppPalette.problem
+ case .working, .neutral: return .secondary
+ }
+ }
+}
diff --git a/Sources/GPTVoice/SystemSettingsLink.swift b/Sources/GPTVoice/SystemSettingsLink.swift
new file mode 100644
index 0000000..4599a33
--- /dev/null
+++ b/Sources/GPTVoice/SystemSettingsLink.swift
@@ -0,0 +1,13 @@
+import AppKit
+
+enum SystemSettingsLink: String {
+ case microphone = "x-apple.systempreferences:com.apple.preference.security?Privacy_Microphone"
+ case accessibility = "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility"
+ case keyboardShortcuts = "x-apple.systempreferences:com.apple.preference.keyboard?Shortcuts"
+
+ @MainActor
+ func open() {
+ guard let url = URL(string: rawValue) else { return }
+ NSWorkspace.shared.open(url)
+ }
+}
diff --git a/Sources/GPTVoice/ThemedRoot.swift b/Sources/GPTVoice/ThemedRoot.swift
new file mode 100644
index 0000000..106ab93
--- /dev/null
+++ b/Sources/GPTVoice/ThemedRoot.swift
@@ -0,0 +1,22 @@
+import SwiftUI
+
+/// Applies the saved accent and the default body font to a SwiftUI root, and updates both live.
+/// Light and dark come from `NSApp.appearance`, set by `AppearanceController`.
+struct ThemedRoot<Content: View>: View {
+ @ObservedObject var preferences: AppPreferences
+ let content: Content
+
+ init(preferences: AppPreferences, @ViewBuilder content: () -> Content) {
+ self.preferences = preferences
+ self.content = content()
+ }
+
+ var body: some View {
+ content
+ .font(AppType.body)
+ .environment(\.appAccent, preferences.accent.foreground)
+ .environment(\.appAccentFill, preferences.accent.color)
+ .environment(\.appAccentOnFill, preferences.accent.onFill)
+ .tint(preferences.accent.tint)
+ }
+}
diff --git a/Sources/GPTVoice/TranscriptBox.swift b/Sources/GPTVoice/TranscriptBox.swift
new file mode 100644
index 0000000..6a64adf
--- /dev/null
+++ b/Sources/GPTVoice/TranscriptBox.swift
@@ -0,0 +1,23 @@
+import SwiftUI
+
+/// The one practice transcript area, shown only after a real result. Selectable, and scrolls when long.
+struct TranscriptBox: View {
+ let text: String
+
+ var body: some View {
+ ScrollView {
+ Text(text)
+ .font(AppType.body)
+ .lineSpacing(3)
+ .textSelection(.enabled)
+ .frame(maxWidth: .infinity, alignment: .topLeading)
+ .padding(16)
+ }
+ .frame(minHeight: 64, maxHeight: 140)
+ .fixedSize(horizontal: false, vertical: true)
+ .background(RoundedRectangle(cornerRadius: 12, style: .continuous).fill(AppPalette.surface))
+ .overlay(RoundedRectangle(cornerRadius: 12, style: .continuous).strokeBorder(AppPalette.hairline))
+ .accessibilityElement(children: .combine)
+ .accessibilityLabel("Transcript: \(text)")
+ }
+}
diff --git a/Sources/GPTVoice/VerificationTrace.swift b/Sources/GPTVoice/VerificationTrace.swift
new file mode 100644
index 0000000..e3d4a99
--- /dev/null
+++ b/Sources/GPTVoice/VerificationTrace.swift
@@ -0,0 +1,33 @@
+import AppKit
+import ApplicationServices
+import Combine
+
+/// Status-only diagnostics for the explicit file-to-paste verification mode.
+/// It never logs audio, transcripts, clipboard contents, credentials, or window titles.
+@MainActor
+final class VerificationTrace {
+ private var observer: AnyCancellable?
+
+ init(model: AppModel) {
+ Self.write([
+ "event": "start",
+ "targetBundleID": NSWorkspace.shared.frontmostApplication?.bundleIdentifier ?? "unknown",
+ "accessibility": AXIsProcessTrusted()
+ ])
+ observer = model.$phase.sink { phase in
+ var fields: [String: Any] = ["event": "phase", "status": phase.statusText]
+ switch phase {
+ case .finished(let outcome): fields["delivery"] = outcome.message
+ case .failed(let failure): fields["error"] = failure.message
+ default: break
+ }
+ Self.write(fields)
+ }
+ }
+
+ private static func write(_ fields: [String: Any]) {
+ guard var data = try? JSONSerialization.data(withJSONObject: fields, options: [.sortedKeys]) else { return }
+ data.append(0x0A)
+ FileHandle.standardError.write(data)
+ }
+}
diff --git a/Sources/GPTVoice/WaveMark.swift b/Sources/GPTVoice/WaveMark.swift
new file mode 100644
index 0000000..d6b88f3
--- /dev/null
+++ b/Sources/GPTVoice/WaveMark.swift
@@ -0,0 +1,26 @@
+import SwiftUI
+
+/// App mark: a graphite rounded square with five voice bars. Monochrome in both themes.
+struct WaveMark: View {
+ var size: CGFloat = 20
+
+ private static let heights: [CGFloat] = [0.26, 0.5, 0.7, 0.44, 0.22]
+ private static let ink = AppPalette.dynamic(light: 0x1C1C1E, dark: 0xECECEC)
+ private static let paper = AppPalette.dynamic(light: 0xF4F4F3, dark: 0x1C1C1E)
+
+ var body: some View {
+ RoundedRectangle(cornerRadius: size * 0.26, style: .continuous)
+ .fill(Self.ink)
+ .frame(width: size, height: size)
+ .overlay(
+ HStack(alignment: .center, spacing: size * 0.07) {
+ ForEach(Array(Self.heights.enumerated()), id: \.offset) { _, height in
+ Capsule()
+ .fill(Self.paper)
+ .frame(width: size * 0.08, height: size * height)
+ }
+ }
+ )
+ .accessibilityHidden(true)
+ }
+}
diff --git a/Sources/GPTVoice/WindowCoordinator.swift b/Sources/GPTVoice/WindowCoordinator.swift
new file mode 100644
index 0000000..e512707
--- /dev/null
+++ b/Sources/GPTVoice/WindowCoordinator.swift
@@ -0,0 +1,48 @@
+import AppKit
+
+/// Owns the setup and settings windows. One of each at a time.
+@MainActor
+final class WindowCoordinator {
+ private let model: AppModel
+ private var onboarding: HostingWindowController?
+ private var settings: HostingWindowController?
+
+ init(model: AppModel) {
+ self.model = model
+ }
+
+ func showOnboarding() {
+ if let onboarding { onboarding.present(); return }
+ let view = ThemedRoot(preferences: model.preferences) {
+ OnboardingView(model: model) { [weak self] in
+ self?.onboarding?.close()
+ }
+ }
+ let controller = HostingWindowController(title: "Set Up GPT Voice", size: NSSize(width: 660, height: 520),
+ minSize: NSSize(width: 600, height: 480),
+ rootView: view) { [weak self] in self?.windowClosed(isSettings: false) }
+ onboarding = controller
+ controller.present()
+ }
+
+ func showSettings() {
+ if let settings { settings.present(); return }
+ let controller = HostingWindowController(title: "GPT Voice Settings", size: NSSize(width: 820, height: 600),
+ minSize: NSSize(width: 720, height: 540),
+ rootView: ThemedRoot(preferences: model.preferences) {
+ SettingsView(model: model)
+ }) { [weak self] in
+ self?.windowClosed(isSettings: true)
+ }
+ settings = controller
+ controller.present()
+ }
+
+ private func windowClosed(isSettings: Bool) {
+ if model.isCapturingShortcut { model.endShortcutCapture() }
+ model.endShortcutTest()
+ // Closing setup stops any practice recording. It never affects a normal dictation.
+ if !isSettings { model.endPractice() }
+ if isSettings { settings = nil } else { onboarding = nil }
+ }
+}
diff --git a/Sources/GPTVoice/WindowDragArea.swift b/Sources/GPTVoice/WindowDragArea.swift
new file mode 100644
index 0000000..f179331
--- /dev/null
+++ b/Sources/GPTVoice/WindowDragArea.swift
@@ -0,0 +1,7 @@
+import SwiftUI
+
+/// SwiftUI wrapper for a draggable blank header region. Place it only where no control sits.
+struct WindowDragArea: NSViewRepresentable {
+ func makeNSView(context: Context) -> WindowDragView { WindowDragView() }
+ func updateNSView(_ view: WindowDragView, context: Context) {}
+}
diff --git a/Sources/GPTVoice/WindowDragView.swift b/Sources/GPTVoice/WindowDragView.swift
new file mode 100644
index 0000000..9ee9bd1
--- /dev/null
+++ b/Sources/GPTVoice/WindowDragView.swift
@@ -0,0 +1,19 @@
+import AppKit
+
+/// Blank header area that moves the window. A double-click follows the system title-bar action.
+final class WindowDragView: NSView {
+ override var mouseDownCanMoveWindow: Bool { true }
+
+ override func mouseDown(with event: NSEvent) {
+ if event.clickCount == 2 {
+ let action = UserDefaults.standard.string(forKey: "AppleActionOnDoubleClick") ?? "Maximize"
+ if action == "Minimize" {
+ window?.performMiniaturize(nil)
+ } else if action != "None" {
+ window?.performZoom(nil)
+ }
+ return
+ }
+ window?.performDrag(with: event)
+ }
+}
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md
new file mode 100644
index 0000000..9071139
--- /dev/null
+++ b/THIRD_PARTY_NOTICES.md
@@ -0,0 +1,22 @@
+# Third-party notices
+
+The [MIT license](LICENSE) applies to GPT Voice's original source code.
+Third-party assets retain their original terms. The license does not grant rights to third-party trademarks or media.
+
+## Promo video
+
+The promo is a staged demonstration with synthetic speech. It is not an accuracy benchmark.
+The published MP4 is a showcase asset, not a collection of reusable stock media.
+
+- **Voice:** generated with ElevenLabs, stock Chris voice, Eleven v3. [ElevenLabs](https://elevenlabs.io/).
+- **Keyboard footage:** Designed by Magnific. [Magnific](https://www.magnific.com/). A short excerpt of [Top View Finger Pushing Alt Gr and Ctrl Keyboard Buttons](https://www.magnific.com/free-video/top-view-finger-pushing-alt-gr-ctrl-keyboard-buttons_77077). Attribution is included here and next to the video.
+- **Music:** Frédéric Chopin, Minute Waltz, Op. 64 No. 1. Performance by Olga Gurevich for Musopen. The source marks the composition and recording as public domain. [Source and reuse notice](https://commons.wikimedia.org/wiki/File:Chopin_-_Waltz_No._6_in_D-flat_major,_Op._64,_No._1_'Minute'_(Olga_Gurevich).flac).
+- **Mouse click:** “Mouse Click Sound.mp3” by Pixeliota, CC0 1.0. [Original recording](https://freesound.org/people/Pixeliota/sounds/678248/). Trimmed, filtered and level adjusted.
+- **Capture:** [Recordly](https://github.com/webadderallorg/Recordly).
+- **App cues:** macOS Tink and Pop, as heard in the recorded app. No standalone Apple sound files are bundled with the app.
+- **Wallpaper, app icon and composition:** original project graphics.
+
+## Names
+
+GPT Voice is an independent project. It is not an official OpenAI, ChatGPT or T3 Code application.
+ChatGPT and OpenAI are trademarks of OpenAI. Other names belong to their respective owners.
diff --git a/Tests/DictationAppTests/GlobalShortcutTests.swift b/Tests/DictationAppTests/GlobalShortcutTests.swift
new file mode 100644
index 0000000..9a2d0f2
--- /dev/null
+++ b/Tests/DictationAppTests/GlobalShortcutTests.swift
@@ -0,0 +1,36 @@
+import Carbon.HIToolbox
+import XCTest
+@testable import GPTVoice
+
+final class GlobalShortcutTests: XCTestCase {
+ @MainActor
+ func testFailedReplacementKeepsThePreviousShortcut() async throws {
+ let first = GlobalShortcut(onPress: {})
+ let second = GlobalShortcut(onPress: {})
+ defer { first.unregister(); second.unregister() }
+ let a = HotkeySpec(keyCode: UInt32(kVK_F19), modifiers: UInt32(controlKey | optionKey | shiftKey))
+ let b = HotkeySpec(keyCode: UInt32(kVK_F20), modifiers: UInt32(controlKey | optionKey | shiftKey))
+ try first.replace(with: a)
+ try second.replace(with: b)
+ XCTAssertThrowsError(try second.replace(with: a))
+ XCTAssertEqual(second.current, b)
+ }
+
+ @MainActor
+ func testCommandSpaceUsesCurrentSystemSettings() async throws {
+ let shortcut = GlobalShortcut(onPress: {})
+ defer { shortcut.unregister() }
+ if GlobalShortcut.isSystemShortcutEnabled(.commandSpace) {
+ XCTAssertThrowsError(try shortcut.replace(with: .commandSpace)) { error in
+ XCTAssertEqual(error as? GlobalShortcut.RegistrationError, .systemShortcut(.commandSpace))
+ }
+ } else {
+ do {
+ try shortcut.replace(with: .commandSpace)
+ XCTAssertEqual(shortcut.current, .commandSpace)
+ } catch GlobalShortcut.RegistrationError.conflict {
+ throw XCTSkip("Another app currently owns Command–Space.")
+ }
+ }
+ }
+}
diff --git a/Tests/DictationAppTests/HotkeySpecTests.swift b/Tests/DictationAppTests/HotkeySpecTests.swift
new file mode 100644
index 0000000..c401180
--- /dev/null
+++ b/Tests/DictationAppTests/HotkeySpecTests.swift
@@ -0,0 +1,35 @@
+import AppKit
+import Carbon.HIToolbox
+import XCTest
+@testable import GPTVoice
+
+final class HotkeySpecTests: XCTestCase {
+ func testCommandSpaceCanBeChosenWhenTheSystemShortcutIsDisabled() {
+ XCTAssertNil(HotkeySpec.commandSpace.problem)
+ XCTAssertEqual(HotkeySpec.commandSpace.displayLabel, "⌘Space")
+ }
+
+ func testConfigurableSystemCombinationsAreNotPermanentlyBlocked() {
+ for modifiers in [controlKey, cmdKey | optionKey, controlKey | cmdKey] {
+ XCTAssertNil(HotkeySpec(keyCode: UInt32(kVK_Space), modifiers: UInt32(modifiers)).problem)
+ }
+ }
+
+ func testEditingAndQuitShortcutsRemainProtected() {
+ for code in [kVK_ANSI_Q, kVK_ANSI_V, kVK_ANSI_C, kVK_ANSI_Z] {
+ XCTAssertEqual(HotkeySpec(keyCode: UInt32(code), modifiers: UInt32(cmdKey)).problem, .reserved)
+ }
+ }
+
+ func testCommandSpaceRoundTripKeepsItsKeyAndModifiers() throws {
+ let data = try JSONEncoder().encode(HotkeySpec.commandSpace)
+ let restored = try JSONDecoder().decode(HotkeySpec.self, from: data)
+ XCTAssertEqual(restored, .commandSpace)
+ XCTAssertEqual(restored.accessibilityLabel, "Command Space")
+ }
+
+ func testPlainSpaceAndModifierKeysAreRejected() {
+ XCTAssertEqual(HotkeySpec(keyCode: UInt32(kVK_Space), modifiers: 0).problem, .needsModifier)
+ XCTAssertEqual(HotkeySpec(keyCode: UInt32(kVK_Command), modifiers: UInt32(cmdKey)).problem, .modifierOnly)
+ }
+}
diff --git a/Tests/DictationAppTests/NoSpeechTests.swift b/Tests/DictationAppTests/NoSpeechTests.swift
new file mode 100644
index 0000000..4eaccd5
--- /dev/null
+++ b/Tests/DictationAppTests/NoSpeechTests.swift
@@ -0,0 +1,38 @@
+import AppKit
+import Combine
+import DictationCore
+import XCTest
+@testable import GPTVoice
+
+final class NoSpeechTests: XCTestCase {
+ @MainActor
+ func testNoSpeechDoesNotKeepAudioForRetryOrChangeTheClipboard() async throws {
+ let suite = "no-speech-test-\(UUID().uuidString)"
+ 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
+ throw DictationError.emptyTranscript
+ }
+ defer {
+ model.cleanup()
+ clipboard.releaseGlobally()
+ defaults.removePersistentDomain(forName: suite)
+ }
+ let failed = expectation(description: "No speech result")
+ let observer = model.$phase.sink { phase in
+ if case .failed = phase { failed.fulfill() }
+ }
+ defer { observer.cancel() }
+
+ model.transcribeFile(URL(fileURLWithPath: "/no-speech-check.wav"))
+ await fulfillment(of: [failed], timeout: 2)
+
+ guard case .failed(let failure) = model.phase else { return XCTFail("Expected no speech result") }
+ XCTAssertEqual(failure.overlayMessage, "No speech found")
+ XCTAssertFalse(model.canRetry)
+ XCTAssertTrue(model.canStart)
+ XCTAssertFalse(model.isPasteLeasePending)
+ XCTAssertEqual(clipboard.string(forType: .string), "Keep my clipboard")
+ }
+}
diff --git a/Tests/DictationAppTests/OverlayLifecycleTests.swift b/Tests/DictationAppTests/OverlayLifecycleTests.swift
new file mode 100644
index 0000000..1aecfaf
--- /dev/null
+++ b/Tests/DictationAppTests/OverlayLifecycleTests.swift
@@ -0,0 +1,170 @@
+import AppKit
+import Combine
+import DictationCore
+import XCTest
+@testable import GPTVoice
+
+final class OverlayLifecycleTests: XCTestCase {
+ @MainActor
+ func testNoSpeechKeepsItsContentDuringFadeThenDisappears() async throws {
+ let fixture = Fixture()
+ defer { fixture.cleanup() }
+ fixture.controller.update(for: .failed(DictationFailure(transcriptionError: DictationError.emptyTranscript)))
+ XCTAssertEqual(fixture.controller.displayedState, .message(label: "No speech found", kind: .noSpeech))
+ XCTAssertTrue(fixture.controller.isVisible)
+
+ try await waitUntil { fixture.controller.isExiting }
+ XCTAssertEqual(fixture.controller.displayedState, .message(label: "No speech found", kind: .noSpeech))
+ try await waitUntil { !fixture.controller.isVisible }
+ XCTAssertEqual(fixture.controller.displayedState, .hidden)
+ }
+
+ @MainActor
+ func testAnOldFadeCannotHideNewRecording() async throws {
+ let fixture = Fixture()
+ defer { fixture.cleanup() }
+ fixture.controller.update(for: .finished(.copied(.automaticPasteOff)))
+ try await waitUntil { fixture.controller.isExiting }
+
+ fixture.controller.update(for: .recording)
+ try await Task.sleep(nanoseconds: 350_000_000)
+
+ XCTAssertTrue(fixture.controller.isVisible)
+ XCTAssertFalse(fixture.controller.isExiting)
+ XCTAssertEqual(fixture.controller.opacity, 1, accuracy: 0.01)
+ guard case .recording = fixture.controller.displayedState else { return XCTFail("New recording was lost") }
+ }
+
+ @MainActor
+ func testClosingHelpPersistsEvenWhenNewWorkInterruptsTheFade() async throws {
+ let fixture = Fixture()
+ defer { fixture.cleanup() }
+ fixture.controller.update(for: .finished(.copied(.accessibilityMissing)))
+ XCTAssertTrue(fixture.controller.displayedState.isHelp)
+
+ fixture.controller.dismissHelp()
+ fixture.controller.update(for: .recording)
+ fixture.controller.update(for: .finished(.copied(.accessibilityMissing)))
+
+ XCTAssertTrue(AppPreferences(defaults: fixture.defaults).manualPasteHelpDismissed)
+ XCTAssertEqual(fixture.controller.displayedState, .message(label: "Press ⌘V to paste", kind: .info))
+ try await waitUntil { !fixture.controller.isVisible }
+ }
+
+ @MainActor
+ func testHelpAlsoExpiresButAnInterruptedExplanationIsNotAcknowledged() async throws {
+ let fixture = Fixture()
+ defer { fixture.cleanup() }
+ fixture.controller.update(for: .finished(.copied(.accessibilityMissing)))
+ fixture.controller.update(for: .recording)
+ try await Task.sleep(nanoseconds: 350_000_000)
+ XCTAssertTrue(fixture.controller.isVisible)
+ XCTAssertFalse(fixture.model.preferences.manualPasteHelpDismissed)
+
+ fixture.controller.update(for: .finished(.copied(.accessibilityMissing)))
+ try await waitUntil { !fixture.controller.isVisible }
+ XCTAssertTrue(fixture.model.preferences.manualPasteHelpDismissed)
+ }
+
+ @MainActor
+ func testRepeatedCopyShowsTheHintAgainWithoutClearingTheResult() async throws {
+ let fixture = Fixture()
+ defer { fixture.cleanup() }
+ fixture.model.preferences.automaticPaste = false
+ fixture.model.transcribeFile(URL(fileURLWithPath: "/overlay-copy-check.wav"))
+ try await waitUntil { fixture.model.phase == .finished(.copied(.automaticPasteOff)) }
+ try await waitUntil { !fixture.controller.isVisible }
+
+ fixture.model.copyLastTranscript()
+
+ XCTAssertTrue(fixture.controller.isVisible)
+ XCTAssertEqual(fixture.controller.displayedState, .message(label: "Press ⌘V to paste", kind: .info))
+ XCTAssertEqual(fixture.clipboard.string(forType: .string), "Overlay test text")
+ try await waitUntil { !fixture.controller.isVisible }
+ XCTAssertEqual(fixture.model.phase, .finished(.copied(.automaticPasteOff)))
+ }
+
+ @MainActor
+ func testResizingKeepsTheCentreAndTopEdgeFixed() async throws {
+ let fixture = Fixture()
+ defer { fixture.cleanup() }
+ fixture.model.preferences.overlayPlacement = .top
+ fixture.controller.update(for: .recording)
+ let original = fixture.controller.targetFrame
+ fixture.controller.update(for: .finished(.preservedNewerClipboard))
+ let target = fixture.controller.targetFrame
+
+ XCTAssertGreaterThan(target.width, original.width)
+ XCTAssertEqual(target.midX, original.midX, accuracy: 0.5)
+ XCTAssertEqual(target.maxY, original.maxY, accuracy: 0.5)
+ try await waitUntil { abs(fixture.controller.frame.width - target.width) < 0.5 }
+ }
+
+ @MainActor
+ func testWidthMovesThroughAnIntermediateFrame() async throws {
+ let fixture = Fixture(resize: 0.4)
+ defer { fixture.cleanup() }
+ fixture.controller.update(for: .recording)
+ let original = fixture.controller.frame.width
+ fixture.controller.update(for: .pasting)
+ let target = fixture.controller.targetFrame.width
+ XCTAssertNotEqual(original, target)
+
+ try await Task.sleep(nanoseconds: 120_000_000)
+ let intermediate = fixture.controller.frame.width
+ XCTAssertGreaterThan(intermediate, min(original, target))
+ XCTAssertLessThan(intermediate, max(original, target))
+ try await waitUntil { abs(fixture.controller.frame.width - target) < 0.5 }
+ }
+
+ @MainActor
+ func testReduceMotionChangesSizeWithoutMovementAndStillFadesOut() async throws {
+ let fixture = Fixture(reduceMotion: true)
+ defer { fixture.cleanup() }
+ fixture.controller.update(for: .recording)
+ fixture.controller.update(for: .finished(.preservedNewerClipboard))
+ XCTAssertEqual(fixture.controller.frame.width, fixture.controller.targetFrame.width, accuracy: 0.5)
+
+ try await waitUntil { fixture.controller.isExiting }
+ XCTAssertNotEqual(fixture.controller.displayedState, .hidden)
+ try await waitUntil { !fixture.controller.isVisible }
+ }
+
+ @MainActor
+ private func waitUntil(_ condition: () -> Bool) async throws {
+ let deadline = Date().addingTimeInterval(2)
+ while !condition(), Date() < deadline {
+ try await Task.sleep(nanoseconds: 10_000_000)
+ }
+ XCTAssertTrue(condition(), "Overlay did not reach the expected state")
+ }
+
+ @MainActor
+ private final class Fixture {
+ let suite = "overlay-test-\(UUID().uuidString)"
+ let defaults: UserDefaults
+ let clipboard: NSPasteboard
+ let model: AppModel
+ let controller: DictationPanelController
+
+ init(resize: TimeInterval = 0.12, reduceMotion: Bool = false) {
+ _ = NSApplication.shared
+ FontRegistration.registerBundledFonts()
+ defaults = UserDefaults(suiteName: suite)!
+ clipboard = NSPasteboard.withUniqueName()
+ model = AppModel(preferences: AppPreferences(defaults: defaults), pasteboard: clipboard) { _ in
+ "Overlay test text"
+ }
+ let timing = OverlayTiming(resize: resize, entrance: 0.02, exit: 0.2, reducedFade: 0.1,
+ success: 0.08, noSpeech: 0.08, warning: 0.08, pasteHint: 0.08, help: 0.08)
+ controller = DictationPanelController(model: model, timing: timing, reduceMotion: { reduceMotion })
+ }
+
+ func cleanup() {
+ controller.shutdown()
+ model.cleanup()
+ clipboard.releaseGlobally()
+ defaults.removePersistentDomain(forName: suite)
+ }
+ }
+}
diff --git a/Tests/DictationAppTests/PracticeDictationTests.swift b/Tests/DictationAppTests/PracticeDictationTests.swift
new file mode 100644
index 0000000..657a726
--- /dev/null
+++ b/Tests/DictationAppTests/PracticeDictationTests.swift
@@ -0,0 +1,90 @@
+import AppKit
+import Combine
+import XCTest
+@testable import GPTVoice
+
+final class PracticeDictationTests: XCTestCase {
+ @MainActor
+ func testPracticeShowsItsTextWithoutChangingTheClipboard() async throws {
+ let defaults = UserDefaults(suiteName: "practice-test-\(UUID().uuidString)")!
+ let preferences = AppPreferences(defaults: defaults)
+ 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." }
+ defer { model.cleanup(); clipboard.releaseGlobally() }
+ let finished = expectation(description: "Practice result is visible")
+ let observer = model.$phase.sink { phase in
+ if phase == .finished(.previewed) { finished.fulfill() }
+ }
+ defer { observer.cancel() }
+
+ model.transcribeFile(URL(fileURLWithPath: "/practice-check.wav"), forPractice: true)
+ await fulfillment(of: [finished], timeout: 2)
+
+ XCTAssertEqual(model.practiceTranscript, "A clear thought.")
+ XCTAssertEqual(clipboard.string(forType: .string), "Keep my clipboard")
+ XCTAssertFalse(model.isPasteLeasePending)
+ }
+
+ @MainActor
+ func testLeavingPracticeRejectsALateTranscription() async throws {
+ let preferences = AppPreferences(defaults: UserDefaults(suiteName: "practice-test-\(UUID().uuidString)")!)
+ let clipboard = NSPasteboard.withUniqueName()
+ 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
+ started.fulfill()
+ try? await Task.sleep(nanoseconds: 1_000_000_000)
+ returned.fulfill()
+ return "Late text"
+ }
+ defer { model.cleanup(); clipboard.releaseGlobally() }
+
+ model.transcribeFile(URL(fileURLWithPath: "/practice-check.wav"), forPractice: true)
+ await fulfillment(of: [started], timeout: 2)
+ model.endPractice()
+ await fulfillment(of: [returned], timeout: 2)
+ await Task.yield()
+
+ XCTAssertEqual(model.phase, .idle)
+ XCTAssertNil(model.practiceTranscript)
+ XCTAssertFalse(model.isPracticeSession)
+ XCTAssertEqual(clipboard.string(forType: .string), "Keep my clipboard")
+ }
+
+ @MainActor
+ func testRetryOfFailedPracticeStillUsesThePreview() async throws {
+ let preferences = AppPreferences(defaults: UserDefaults(suiteName: "practice-test-\(UUID().uuidString)")!)
+ let clipboard = NSPasteboard.withUniqueName()
+ clipboard.setString("Keep my clipboard", forType: .string)
+ let attempts = AttemptCounter()
+ let model = AppModel(preferences: preferences, pasteboard: clipboard) { _ in
+ if await attempts.next() == 1 { throw URLError(.timedOut) }
+ return "Second try"
+ }
+ defer { model.cleanup(); clipboard.releaseGlobally() }
+ let failed = expectation(description: "Practice can retry")
+ let finished = expectation(description: "Retry preview is ready")
+ let observer = model.$phase.sink { phase in
+ if case .failed = phase { failed.fulfill() }
+ if phase == .finished(.previewed) { finished.fulfill() }
+ }
+ defer { observer.cancel() }
+
+ model.transcribeFile(URL(fileURLWithPath: "/practice-check.wav"), forPractice: true)
+ await fulfillment(of: [failed], timeout: 2)
+ XCTAssertTrue(model.canRetry)
+ model.retry()
+ await fulfillment(of: [finished], timeout: 2)
+
+ XCTAssertEqual(model.practiceTranscript, "Second try")
+ XCTAssertEqual(clipboard.string(forType: .string), "Keep my clipboard")
+ }
+}
+
+private actor AttemptCounter {
+ private var count = 0
+ func next() -> Int { count += 1; return count }
+}
diff --git a/Tests/DictationAppTests/ShortcutReceiptTests.swift b/Tests/DictationAppTests/ShortcutReceiptTests.swift
new file mode 100644
index 0000000..7038bb7
--- /dev/null
+++ b/Tests/DictationAppTests/ShortcutReceiptTests.swift
@@ -0,0 +1,34 @@
+import AppKit
+import XCTest
+@testable import GPTVoice
+
+final class ShortcutReceiptTests: XCTestCase {
+ @MainActor
+ func testShortcutCheckDoesNotStartTheMicrophoneOrChangeTheClipboard() throws {
+ let suite = "shortcut-receipt-test-\(UUID().uuidString)"
+ let defaults = UserDefaults(suiteName: suite)!
+ defer { defaults.removePersistentDomain(forName: suite) }
+ let preferences = AppPreferences(defaults: defaults)
+ let clipboard = NSPasteboard.withUniqueName()
+ clipboard.setString("Keep my clipboard", forType: .string)
+ let model = AppModel(preferences: preferences, pasteboard: clipboard)
+ defer { model.cleanup(); clipboard.releaseGlobally() }
+ model.activate()
+ guard model.hotkeyError == nil else {
+ throw XCTSkip("The test shortcut is owned by another app.")
+ }
+
+ model.beginShortcutTest()
+ XCTAssertEqual(model.shortcutTestStatus, .listening)
+ model.receiveGlobalShortcut()
+ XCTAssertEqual(model.shortcutTestStatus, .received)
+ XCTAssertEqual(model.phase, .idle)
+ XCTAssertEqual(clipboard.string(forType: .string), "Keep my clipboard")
+
+ // A repeated press stays in the test until it is explicitly closed.
+ model.receiveGlobalShortcut()
+ XCTAssertEqual(model.phase, .idle)
+ model.endShortcutTest()
+ XCTAssertEqual(model.shortcutTestStatus, .idle)
+ }
+}
diff --git a/Tests/DictationCoreTests/DictationCoreTests.swift b/Tests/DictationCoreTests/DictationCoreTests.swift
new file mode 100644
index 0000000..844e8b8
--- /dev/null
+++ b/Tests/DictationCoreTests/DictationCoreTests.swift
@@ -0,0 +1,41 @@
+import XCTest
+@testable import DictationCore
+
+final class DictationCoreTests: XCTestCase {
+ func testRejectsAPIKeySignIn() {
+ XCTAssertThrowsError(try CodexCredentials.decode(Data(#"{"auth_mode":"apikey","OPENAI_API_KEY":"test"}"#.utf8)))
+ }
+
+ func testReadsExistingChatGPTSignInAndExpiry() throws {
+ let payload = Data(#"{"exp":1}"#.utf8).base64EncodedString()
+ let data = try JSONSerialization.data(withJSONObject: ["auth_mode": "chatgpt", "tokens": ["access_token": "header.\(payload).signature", "account_id": "test-account"]])
+ let credentials = try CodexCredentials.decode(data)
+ XCTAssertEqual(credentials.accountID, "test-account")
+ XCTAssertTrue(credentials.needsRefresh)
+ }
+
+ func testMissingCredentialsGivesSignInInstruction() {
+ XCTAssertThrowsError(try CodexCredentials.load(from: URL(fileURLWithPath: "/absent-codex-dictation-auth"))) {
+ XCTAssertTrue($0.localizedDescription.contains("codex login"))
+ }
+ }
+
+ func testMultipartPreservesAudioBytesAndLanguage() {
+ let bytes = Data([0, 13, 10, 255, 2])
+ let multipart = MultipartAudio(audio: bytes, filename: "dictation.wav", contentType: "audio/wav", language: "en", boundary: "test-boundary")
+ XCTAssertNotNil(multipart.body.range(of: bytes))
+ XCTAssertNotNil(multipart.body.range(of: Data("name=\"language\"\r\n\r\nen\r\n".utf8)))
+ XCTAssertTrue(multipart.body.suffix(Data("--test-boundary--\r\n".utf8).count) == Data("--test-boundary--\r\n".utf8))
+ }
+
+ func testMultipartRemovesHeaderInjectionFromFilename() {
+ let multipart = MultipartAudio(audio: Data([1]), filename: "x\"\r\nInjected: true.wav", contentType: "audio/wav")
+ let text = String(decoding: multipart.body, as: UTF8.self)
+ XCTAssertFalse(text.contains("\r\nInjected:"))
+ }
+
+ func testServiceErrorsDoNotExposeResponseOrCredentials() {
+ XCTAssertEqual(DictationError.service(429).localizedDescription, "ChatGPT reached a request limit. Try again later.")
+ XCTAssertTrue(DictationError.service(403).localizedDescription.contains("denied"))
+ }
+}
diff --git a/Tests/DictationCoreTests/StubURLProtocol.swift b/Tests/DictationCoreTests/StubURLProtocol.swift
new file mode 100644
index 0000000..7c70b47
--- /dev/null
+++ b/Tests/DictationCoreTests/StubURLProtocol.swift
@@ -0,0 +1,20 @@
+import Foundation
+
+final class StubURLProtocol: URLProtocol {
+ static var response: (Int, Data) = (200, Data())
+ static var lastRequest: URLRequest?
+
+ override class func canInit(with request: URLRequest) -> Bool { true }
+ override class func canonicalRequest(for request: URLRequest) -> URLRequest { request }
+
+ override func startLoading() {
+ Self.lastRequest = request
+ let (status, body) = Self.response
+ let response = HTTPURLResponse(url: request.url!, statusCode: status, httpVersion: "HTTP/1.1", headerFields: ["Content-Type": "application/json"])!
+ client?.urlProtocol(self, didReceive: response, cacheStoragePolicy: .notAllowed)
+ client?.urlProtocol(self, didLoad: body)
+ client?.urlProtocolDidFinishLoading(self)
+ }
+
+ override func stopLoading() {}
+}
diff --git a/Tests/DictationCoreTests/TranscriptTextTests.swift b/Tests/DictationCoreTests/TranscriptTextTests.swift
new file mode 100644
index 0000000..e76facc
--- /dev/null
+++ b/Tests/DictationCoreTests/TranscriptTextTests.swift
@@ -0,0 +1,14 @@
+import XCTest
+@testable import DictationCore
+
+final class TranscriptTextTests: XCTestCase {
+ func testAutomaticPasteRemovesLineBreaksAndTerminalControls() {
+ let text = TranscriptText.forAutomaticPaste("List files\r\nthen explain\u{1b}the result\n")
+ XCTAssertEqual(text, "List files then explain the result")
+ XCTAssertTrue(text.unicodeScalars.allSatisfy { !CharacterSet.controlCharacters.contains($0) })
+ }
+
+ func testAutomaticPastePreservesPunctuationAndUnicode() {
+ XCTAssertEqual(TranscriptText.forAutomaticPaste("Fix ‘café’ — please."), "Fix ‘café’ — please.")
+ }
+}
diff --git a/Tests/DictationCoreTests/TranscriptionClientTests.swift b/Tests/DictationCoreTests/TranscriptionClientTests.swift
new file mode 100644
index 0000000..7f8925a
--- /dev/null
+++ b/Tests/DictationCoreTests/TranscriptionClientTests.swift
@@ -0,0 +1,56 @@
+import XCTest
+@testable import DictationCore
+
+final class TranscriptionClientTests: XCTestCase {
+ private func client(status: Int, body: String) -> TranscriptionClient {
+ StubURLProtocol.response = (status, Data(body.utf8))
+ let config = URLSessionConfiguration.ephemeral
+ config.protocolClasses = [StubURLProtocol.self]
+ return TranscriptionClient(session: URLSession(configuration: config))
+ }
+
+ private let credentials = CodexCredentials.from(token: "test-only-token", accountID: "test-account")
+ private let multipart = MultipartAudio(audio: Data([0, 1, 2]), filename: "test.wav", contentType: "audio/wav")
+
+ func testTranscriptionUsesSharedAccountAndReturnsText() async throws {
+ let client = client(status: 200, body: #"{"text":"A spoken command.","asset_pointer":"ignored"}"#)
+ let result = try await client.request(multipart, credentials: credentials)
+ XCTAssertEqual(result, "A spoken command.")
+ let request = try XCTUnwrap(StubURLProtocol.lastRequest)
+ XCTAssertEqual(request.url?.absoluteString, "https://chatgpt.com/backend-api/transcribe")
+ XCTAssertEqual(request.httpMethod, "POST")
+ XCTAssertEqual(request.value(forHTTPHeaderField: "ChatGPT-Account-Id"), "test-account")
+ XCTAssertEqual(request.value(forHTTPHeaderField: "Authorization"), "Bearer test-only-token")
+ }
+
+ func testServerFailureKeepsStatusWithoutExposingResponseBody() async {
+ let client = client(status: 403, body: #"{"detail":"private server data"}"#)
+ do {
+ _ = try await client.request(multipart, credentials: credentials)
+ XCTFail("Expected a denied request")
+ } catch {
+ XCTAssertEqual(error.localizedDescription, DictationError.service(403).localizedDescription)
+ XCTAssertFalse(error.localizedDescription.contains("private"))
+ }
+ }
+
+ func testBlankTranscriptIsRecoverableFailure() async {
+ let client = client(status: 200, body: #"{"text":" "}"#)
+ do {
+ _ = try await client.request(multipart, credentials: credentials)
+ XCTFail("Expected no speech error")
+ } catch {
+ XCTAssertEqual(error.localizedDescription, DictationError.emptyTranscript.localizedDescription)
+ }
+ }
+
+ func testUnexpectedResponseIsRecoverableFailure() async {
+ let client = client(status: 200, body: #"{"message":"unknown"}"#)
+ do {
+ _ = try await client.request(multipart, credentials: credentials)
+ XCTFail("Expected unreadable response error")
+ } catch {
+ XCTAssertEqual(error.localizedDescription, DictationError.invalidResponse.localizedDescription)
+ }
+ }
+}
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..b1e80bb
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.1.3
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
new file mode 100644
index 0000000..454836d
--- /dev/null
+++ b/docs/ARCHITECTURE.md
@@ -0,0 +1,27 @@
+# How GPT Voice works
+
+GPT Voice is a native Swift app with AppKit windows and SwiftUI content.
+It does not contain extracted ChatGPT application code or a local transcription model.
+The implementation sends a request shaped like the transcription request observed in the ChatGPT desktop app.
+
+1. A global shortcut starts AVFoundation audio capture.
+2. The second press stops capture.
+3. `DictationCore` sends the audio to ChatGPT over HTTPS.
+4. The response becomes a transcript.
+5. The app pastes it into the original app, or copies it for manual paste.
+
+`Sources/DictationCore` owns credentials, request construction, token renewal and transcript handling.
+`Sources/GPTVoice` owns recording, shortcuts, paste delivery, settings and the recording pill.
+`Tests` covers request behavior, empty speech, shortcut ownership, practice mode and overlay lifecycle.
+
+Sign-in and token renewal use the installed Codex CLI app-server protocol.
+GPT Voice reads the resulting file-backed ChatGPT session. API-key authentication is not supported.
+The current implementation does not read Codex sessions stored only in the macOS Keychain.
+
+The service route is `https://chatgpt.com/backend-api/transcribe`.
+It is private, undocumented for this use, and can change.
+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.
diff --git a/docs/PRIVACY.md b/docs/PRIVACY.md
new file mode 100644
index 0000000..d5e6d2c
--- /dev/null
+++ b/docs/PRIVACY.md
@@ -0,0 +1,26 @@
+# Privacy
+
+GPT Voice has no developer-operated server, analytics, or account database.
+Transcription requires an internet connection and sends recorded audio to ChatGPT.
+It does not run an offline speech model.
+
+| Data | Where it goes |
+| --- | --- |
+| 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 |
+| 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.
+ChatGPT's handling of uploaded audio is subject to your account settings and OpenAI's policies.
+
+Microphone access permits recording after you start dictation.
+Accessibility access permits automatic paste. You can decline it and paste with Command–V instead.
+The app rechecks permissions when you return from System Settings.
+
+The website's interactive preview runs in your browser with fixed sample text.
+It does not record or upload audio. Its video is a staged demonstration, not an accuracy benchmark.
diff --git a/docs/RELEASING.md b/docs/RELEASING.md
new file mode 100644
index 0000000..e34c23b
--- /dev/null
+++ b/docs/RELEASING.md
@@ -0,0 +1,65 @@
+# Releasing GPT Voice
+
+A public direct-download release uses **Developer ID Application** signing and Apple notarization.
+An App Store Connect app record, TestFlight build and App Store listing are not required.
+
+## Build
+
+1. Update `VERSION` and increase `BUILD_NUMBER`.
+2. Run `swift test`.
+3. Set `GPT_VOICE_SIGNING_IDENTITY` to the intended Developer ID Application identity.
+4. Run `./scripts/build.sh --universal`.
+
+The result is `dist/GPT Voice.app`, with Apple Silicon and Intel executable slices.
+The build enables the hardened runtime for certificate-signed builds and includes the microphone entitlement.
+It keeps the original bundle identifier for existing settings.
+
+## Notarize the app
+
+Submit a ZIP of the signed app to Apple using your existing notarization credentials.
+Wait for an **Accepted** result before proceeding.
+Staple the ticket to the app and check it:
+
+```sh
+xcrun stapler staple "dist/GPT Voice.app"
+xcrun stapler validate "dist/GPT Voice.app"
+spctl --assess --type execute --verbose=2 "dist/GPT Voice.app"
+```
+
+## Package the installer
+
+Use a separate Python environment for packaging:
+
+```sh
+python3 -m venv .local/release-tools
+.local/release-tools/bin/pip install dmgbuild==1.6.7
+.local/release-tools/bin/python scripts/package-dmg.py
+```
+
+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.
+`--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.
+Run `xcrun stapler validate dist/GPT-Voice.dmg` before release.
+Check it with `hdiutil verify` and `spctl --assess --type open --context context:primary-signature --verbose=2`.
+
+## Check the download experience
+
+- Mount the final DMG and inspect its icon layout and instruction text.
+- Copy the app to Applications. Eject the DMG before launching the installed copy.
+- Test onboarding, sign-in, permissions, a recording, paste and cancel.
+- Check light and dark mode and Reduce Motion.
+- Download the uploaded asset through its public release URL and compare its SHA-256 checksum.
+- Check Gatekeeper with quarantine on the downloaded copy. Do not disable security checks.
+- Prefer a separate Mac with no earlier GPT Voice grants for a final first-install check.
+
+Notarization verifies Apple's scan and signing requirements. It does not prove transcription access for every ChatGPT plan.
+An Intel slice can be built on Apple Silicon, but Intel execution requires a separate check.
+
+## Publish
+
+Attach `GPT-Voice.dmg`, an app ZIP, checksums, release notes and the promo MP4 to the matching GitHub release.
+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.
diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md
new file mode 100644
index 0000000..d8662b2
--- /dev/null
+++ b/docs/TROUBLESHOOTING.md
@@ -0,0 +1,62 @@
+# Troubleshooting
+
+## Sign-in
+
+Install [Codex CLI](https://developers.openai.com/codex/cli/) before starting browser sign-in.
+GPT Voice checks `/opt/homebrew/bin`, `/usr/local/bin`, `~/.local/bin` and the app's PATH for `codex`.
+If a custom installation is not found, place the executable in one of those locations, then reopen the app.
+
+Select **Sign in with ChatGPT** in the app. The flow uses Codex CLI's browser login.
+The current build reads file-backed sessions in `~/.codex/auth.json`, or the directory set by `CODEX_HOME`.
+It does not read keychain-only sessions. Do not paste access tokens into issues or send them to the maintainer.
+
+If an account request fails after sign-in, try signing in again.
+The private transcription endpoint can reject accounts or change. A subscription does not guarantee access to this third-party client.
+
+## Microphone
+
+Open **System Settings → Privacy & Security → Microphone** and enable GPT Voice.
+Return to the app to refresh its status.
+If macOS did not yet list the app, select **Allow** inside GPT Voice to request access.
+
+## Accessibility and paste
+
+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.
+
+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.
+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.
+This protects newer clipboard content and avoids sending text to the wrong app.
+Use **Copy Last Transcript** from the menu bar to recover the last result.
+
+## Shortcut
+
+Use **Settings → Shortcut → Test** to check receipt without recording.
+Command–Space often belongs to Spotlight or another app.
+Change that competing shortcut, or select a different shortcut in GPT Voice.
+The default is Control–Option–Space.
+
+## Download and installation
+
+Use the official GitHub release. Confirm the release's signing and notarization status.
+Open the DMG and drag the app to Applications. Eject the image, then open the installed copy.
+A first launch can still show Apple's normal downloaded-app confirmation.
+Microphone and Accessibility permission prompts are separate from Gatekeeper.
+
+If Gatekeeper blocks a release described as notarized, do not disable it.
+Report the release version, macOS version, processor type and exact message without account data.
+
+## Diagnostics
+
+```sh
+"/Applications/GPT Voice.app/Contents/MacOS/GPTVoice" --diagnose
+```
+
+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.
diff --git a/docs/assets/readme-hero-dark.png b/docs/assets/readme-hero-dark.png
new file mode 100644
index 0000000..92af526
Binary files /dev/null and b/docs/assets/readme-hero-dark.png differ
diff --git a/docs/assets/readme-hero-dark.svg b/docs/assets/readme-hero-dark.svg
new file mode 100644
index 0000000..0ecfebe
--- /dev/null
+++ b/docs/assets/readme-hero-dark.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="1280" height="520" viewBox="0 0 1280 520"><defs><filter id="blur" x="-20%" y="-50%" width="140%" height="200%"><feGaussianBlur stdDeviation="9"/></filter></defs><rect width="1280" height="520" rx="24" fill="#111112"/><defs><linearGradient id="igd" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2B2B2D"/><stop offset="1" stop-color="#1D1D1F"/></linearGradient></defs><rect x="393.78200000000004" y="108" width="84" height="84" rx="18.98" fill="url(#igd)"/><g fill="#EBEBEB"><rect x="409.15" y="141.43" width="6.26" height="17.05" rx="3.12"/><rect x="420.91" y="133.62" width="6.26" height="32.76" rx="3.12"/><rect x="432.76" y="127.07" width="6.26" height="45.95" rx="3.12"/><rect x="444.52" y="135.55" width="6.26" height="28.98" rx="3.12"/><rect x="456.19" y="142.78" width="6.26" height="14.45" rx="3.12"/></g><path d="M539.802 178.84C557.6940000000001 178.84 568.6980000000001 165.484 568.6980000000001 148.684V145.99599999999998H539.97V153.808H559.1220000000001C557.778 165.064 549.63 171.028 539.802 171.028C527.4540000000001 171.028 518.8860000000001 161.2 518.8860000000001 147.76C518.8860000000001 134.32 527.4540000000001 124.49199999999999 539.802 124.49199999999999C549.21 124.49199999999999 556.182 129.7 557.946 138.184L567.4380000000001 137.00799999999998C565.0020000000001 125.08 553.7460000000001 116.68 539.802 116.68C522.582 116.68 509.73 129.952 509.73 147.76C509.73 165.568 522.582 178.84 539.802 178.84ZM578.2740000000001 178.0H587.094V153.472H598.4340000000001C609.522 153.472 617.586 145.99599999999998 617.586 135.49599999999998C617.586 124.996 609.522 117.52 598.4340000000001 117.52H578.2740000000001ZM597.5100000000001 145.576H587.094V125.416H597.5100000000001C604.1460000000001 125.416 608.4300000000001 129.364 608.4300000000001 135.49599999999998C608.4300000000001 141.628 604.1460000000001 145.576 597.5100000000001 145.576ZM637.0740000000001 178.0H645.8940000000001V125.584H663.1140000000001V117.52H619.7700000000001V125.584H637.0740000000001ZM698.6460000000001 178.0H708.5580000000001L731.238 117.52H721.662L703.6020000000001 167.92L685.5420000000001 117.52H675.9660000000001ZM749.8860000000001 178.84C762.3180000000001 178.84 771.558 169.516 771.558 157.0C771.558 144.48399999999998 762.3180000000001 135.16 749.8860000000001 135.16C737.4540000000001 135.16 728.214 144.48399999999998 728.214 157.0C728.214 169.516 737.4540000000001 178.84 749.8860000000001 178.84ZM749.8860000000001 171.61599999999999C742.2420000000001 171.61599999999999 737.034 165.568 737.034 157.0C737.034 148.432 742.2420000000001 142.38400000000001 749.8860000000001 142.38400000000001C757.5300000000001 142.38400000000001 762.822 148.432 762.822 157.0C762.822 165.568 757.5300000000001 171.61599999999999 749.8860000000001 171.61599999999999ZM779.37 178.0H787.7700000000001V136.0H779.37ZM783.57 129.61599999999999C786.846 129.61599999999999 789.3660000000001 127.18 789.3660000000001 123.904C789.3660000000001 120.62799999999999 786.846 118.192 783.57 118.192C780.2940000000001 118.192 777.774 120.62799999999999 777.774 123.904C777.774 127.18 780.2940000000001 129.61599999999999 783.57 129.61599999999999ZM816.834 178.84C826.494 178.84 834.222 173.128 836.658 163.552L827.754 162.46C826.746 168.256 822.126 171.61599999999999 816.834 171.61599999999999C809.358 171.61599999999999 804.4019999999999 165.568 804.4019999999999 157.0C804.4019999999999 148.432 809.358 142.38400000000001 816.834 142.38400000000001C822.21 142.38400000000001 826.746 145.66 827.754 151.372L836.658 150.28C834.894 141.124 826.746 135.16 816.834 135.16C804.486 135.16 795.582 144.48399999999998 795.582 157.0C795.582 169.516 804.5699999999999 178.84 816.834 178.84ZM862.278 178.84C871.4340000000001 178.84 878.994 173.716 881.7660000000001 165.316L872.8620000000001 164.14C871.7700000000001 168.59199999999998 867.8220000000001 171.61599999999999 862.278 171.61599999999999C855.3900000000001 171.61599999999999 850.518 166.66 849.7620000000001 159.184H882.942V157.42C882.942 143.89600000000002 874.71 135.16 862.278 135.16C850.2660000000001 135.16 841.278 144.48399999999998 841.278 157.0C841.278 169.516 850.0980000000001 178.84 862.278 178.84ZM850.0980000000001 152.716C851.442 146.416 856.062 142.3 862.278 142.3C868.998 142.3 873.3660000000001 146.668 874.206 152.716Z" fill="#ECECEC"/><path d="M362.258 262.0H370.88399999999996C378.674 262.0 384.298 256.262 384.298 248.32C384.298 240.378 378.59799999999996 234.64 370.77 234.64H362.258ZM370.88399999999996 258.96H365.488V237.68H370.77C376.81199999999995 237.68 380.95399999999995 241.974 380.95399999999995 248.32C380.95399999999995 254.666 376.888 258.96 370.88399999999996 258.96ZM388.63 262.0H391.66999999999996V243.0H388.63ZM390.15 239.88400000000001C391.47999999999996 239.88400000000001 392.506 238.858 392.506 237.528C392.506 236.198 391.47999999999996 235.172 390.15 235.172C388.82 235.172 387.794 236.198 387.794 237.528C387.794 238.858 388.82 239.88400000000001 390.15 239.88400000000001ZM405.426 262.38C409.758 262.38 413.06399999999996 259.796 414.24199999999996 255.654L410.89799999999997 255.16C410.404 257.972 408.08599999999996 259.568 405.426 259.568C401.702 259.568 399.15599999999995 256.604 399.15599999999995 252.5C399.15599999999995 248.39600000000002 401.702 245.43200000000002 405.426 245.43200000000002C408.12399999999997 245.43200000000002 410.366 246.99 410.89799999999997 249.764L414.24199999999996 249.308C413.48199999999997 245.318 409.87199999999996 242.62 405.426 242.62C399.95399999999995 242.62 395.964 246.876 395.964 252.5C395.964 258.124 399.95399999999995 262.38 405.426 262.38ZM423.856 262.228C424.53999999999996 262.228 425.33799999999997 262.114 425.67999999999995 262.0V259.188C425.224 259.302 424.806 259.34 424.426 259.34C423.628 259.34 423.058 259.15 422.71599999999995 258.808C422.412 258.466 422.26 258.048 422.26 257.364V245.66H425.67999999999995V243.0H422.26V238.44H419.21999999999997V243.0H416.104V245.66H419.21999999999997V257.744C419.21999999999997 259.302 419.59999999999997 260.366 420.35999999999996 261.088C421.15799999999996 261.848 422.33599999999996 262.228 423.856 262.228ZM435.218 262.38C437.878 262.38 440.006 261.354 441.488 259.302C441.526 260.214 441.602 261.012 441.716 262.0H444.718C444.566 260.86 444.49 259.986 444.49 258.846V249.916C444.49 247.636 443.882 246.002 442.628 244.672C441.374 243.34199999999998 439.322 242.62 436.814 242.62C432.292 242.62 429.252 245.052 428.948 248.966H432.216C432.52 246.534 434.154 245.28 436.814 245.28C438.40999999999997 245.28 439.55 245.774 440.348 246.572C441.146 247.37 441.488 248.51 441.488 250.068V250.828L434.724 251.018C430.658 251.132 428.492 253.108 428.492 256.452C428.492 259.986 431.152 262.38 435.218 262.38ZM431.68399999999997 256.49C431.68399999999997 254.59 432.9 253.564 435.522 253.488L441.488 253.298V254.286C441.488 257.63 439.17 259.872 435.788 259.872C433.318 259.872 431.68399999999997 258.58 431.68399999999997 256.49ZM455.168 262.228C455.852 262.228 456.65 262.114 456.99199999999996 262.0V259.188C456.536 259.302 456.118 259.34 455.738 259.34C454.94 259.34 454.37 259.15 454.02799999999996 258.808C453.724 258.466 453.572 258.048 453.572 257.364V245.66H456.99199999999996V243.0H453.572V238.44H450.532V243.0H447.416V245.66H450.532V257.744C450.532 259.302 450.912 260.366 451.67199999999997 261.088C452.46999999999997 261.848 453.64799999999997 262.228 455.168 262.228ZM468.61999999999995 262.38C472.76199999999994 262.38 476.10599999999994 259.986 477.28399999999993 256.262L473.93999999999994 255.768C473.40799999999996 258.048 471.39399999999995 259.568 468.61999999999995 259.568C465.12399999999997 259.568 462.69199999999995 257.022 462.388 253.26H477.816V252.728C477.816 246.61 474.16799999999995 242.62 468.61999999999995 242.62C463.26199999999994 242.62 459.234 246.876 459.234 252.5C459.234 258.124 463.22399999999993 262.38 468.61999999999995 262.38ZM462.53999999999996 250.676C463.186 247.484 465.50399999999996 245.43200000000002 468.61999999999995 245.43200000000002C472.00199999999995 245.43200000000002 474.12999999999994 247.598 474.50999999999993 250.676ZM490.622 262.0H493.662V243.0H490.622ZM492.142 239.88400000000001C493.472 239.88400000000001 494.498 238.858 494.498 237.528C494.498 236.198 493.472 235.172 492.142 235.172C490.812 235.172 489.786 236.198 489.786 237.528C489.786 238.858 490.812 239.88400000000001 492.142 239.88400000000001ZM499.286 262.0H502.32599999999996V250.752C502.32599999999996 247.598 504.34 245.43200000000002 507.304 245.43200000000002C508.71 245.43200000000002 509.84999999999997 245.926 510.61 246.8C511.37 247.636 511.788 248.89 511.788 250.372V262.0H514.828V249.916C514.828 247.788 514.144 246.002 512.966 244.71C511.788 243.38 510.03999999999996 242.62 507.988 242.62C505.556 242.62 503.504 243.722 502.25 245.736V243.0H499.286ZM525.468 262.228C526.152 262.228 526.95 262.114 527.292 262.0V259.188C526.836 259.302 526.418 259.34 526.038 259.34C525.24 259.34 524.67 259.15 524.328 258.808C524.024 258.466 523.872 258.048 523.872 257.364V245.66H527.292V243.0H523.872V238.44H520.832V243.0H517.716V245.66H520.832V257.744C520.832 259.302 521.212 260.366 521.972 261.088C522.77 261.848 523.948 262.228 525.468 262.228ZM539.1479999999999 262.38C544.658 262.38 548.762 258.162 548.762 252.5C548.762 246.838 544.658 242.62 539.1479999999999 242.62C533.6379999999999 242.62 529.534 246.838 529.534 252.5C529.534 258.162 533.6379999999999 262.38 539.1479999999999 262.38ZM539.1479999999999 259.568C535.386 259.568 532.726 256.68 532.726 252.5C532.726 248.32 535.386 245.43200000000002 539.1479999999999 245.43200000000002C542.91 245.43200000000002 545.5699999999999 248.32 545.5699999999999 252.5C545.5699999999999 256.68 542.91 259.568 539.1479999999999 259.568ZM567.2299999999999 262.38C569.89 262.38 572.0179999999999 261.354 573.4999999999999 259.302C573.5379999999999 260.214 573.6139999999999 261.012 573.728 262.0H576.7299999999999C576.578 260.86 576.502 259.986 576.502 258.846V249.916C576.502 247.636 575.8939999999999 246.002 574.64 244.672C573.386 243.34199999999998 571.334 242.62 568.8259999999999 242.62C564.304 242.62 561.2639999999999 245.052 560.9599999999999 248.966H564.228C564.5319999999999 246.534 566.1659999999999 245.28 568.8259999999999 245.28C570.4219999999999 245.28 571.5619999999999 245.774 572.3599999999999 246.572C573.1579999999999 247.37 573.4999999999999 248.51 573.4999999999999 250.068V250.828L566.736 251.018C562.67 251.132 560.5039999999999 253.108 560.5039999999999 256.452C560.5039999999999 259.986 563.164 262.38 567.2299999999999 262.38ZM563.6959999999999 256.49C563.6959999999999 254.59 564.9119999999999 253.564 567.534 253.488L573.4999999999999 253.298V254.286C573.4999999999999 257.63 571.1819999999999 259.872 567.8 259.872C565.3299999999999 259.872 563.6959999999999 258.58 563.6959999999999 256.49ZM581.8979999999999 262.0H584.938V250.752C584.938 247.598 586.952 245.43200000000002 589.9159999999999 245.43200000000002C591.322 245.43200000000002 592.462 245.926 593.222 246.8C593.982 247.636 594.4 248.89 594.4 250.372V262.0H597.4399999999999V249.916C597.4399999999999 247.788 596.756 246.002 595.578 244.71C594.4 243.38 592.6519999999999 242.62 590.5999999999999 242.62C588.168 242.62 586.116 243.722 584.862 245.736V243.0H581.8979999999999ZM604.4319999999999 269.6H607.852L618.606 243.0H615.1859999999999L609.372 258.2L603.2539999999999 243.0H599.834L607.814 261.734ZM635.212 262.38C637.8720000000001 262.38 640.0 261.354 641.482 259.302C641.52 260.214 641.596 261.012 641.71 262.0H644.712C644.5600000000001 260.86 644.484 259.986 644.484 258.846V249.916C644.484 247.636 643.876 246.002 642.6220000000001 244.672C641.368 243.34199999999998 639.316 242.62 636.808 242.62C632.2860000000001 242.62 629.246 245.052 628.942 248.966H632.21C632.514 246.534 634.148 245.28 636.808 245.28C638.404 245.28 639.544 245.774 640.342 246.572C641.14 247.37 641.482 248.51 641.482 250.068V250.828L634.7180000000001 251.018C630.652 251.132 628.486 253.108 628.486 256.452C628.486 259.986 631.1460000000001 262.38 635.212 262.38ZM631.678 256.49C631.678 254.59 632.894 253.564 635.5160000000001 253.488L641.482 253.298V254.286C641.482 257.63 639.164 259.872 635.782 259.872C633.312 259.872 631.678 258.58 631.678 256.49ZM649.8799999999999 269.6H652.882V258.77C654.174 261.05 656.7199999999999 262.38 659.5319999999999 262.38C664.6239999999999 262.38 668.4999999999999 258.086 668.4999999999999 252.5C668.4999999999999 246.914 664.6239999999999 242.62 659.5319999999999 242.62C656.6819999999999 242.62 654.136 243.988 652.8439999999999 246.306V243.0H649.8799999999999ZM659.0379999999999 259.568C655.276 259.568 652.7679999999999 256.604 652.7679999999999 252.5C652.7679999999999 248.39600000000002 655.276 245.43200000000002 659.0379999999999 245.43200000000002C662.8 245.43200000000002 665.3079999999999 248.39600000000002 665.3079999999999 252.5C665.3079999999999 256.604 662.8 259.568 659.0379999999999 259.568ZM672.7559999999999 269.6H675.7579999999999V258.77C677.05 261.05 679.5959999999999 262.38 682.4079999999999 262.38C687.4999999999999 262.38 691.3759999999999 258.086 691.3759999999999 252.5C691.3759999999999 246.914 687.4999999999999 242.62 682.4079999999999 242.62C679.5579999999999 242.62 677.012 243.988 675.7199999999999 246.306V243.0H672.7559999999999ZM681.9139999999999 259.568C678.1519999999999 259.568 675.6439999999999 256.604 675.6439999999999 252.5C675.6439999999999 248.39600000000002 678.1519999999999 245.43200000000002 681.9139999999999 245.43200000000002C685.6759999999999 245.43200000000002 688.1839999999999 248.39600000000002 688.1839999999999 252.5C688.1839999999999 256.604 685.6759999999999 259.568 681.9139999999999 259.568ZM712.5039999999999 262.38C718.014 262.38 722.1179999999999 258.162 722.1179999999999 252.5C722.1179999999999 246.838 718.014 242.62 712.5039999999999 242.62C706.9939999999999 242.62 702.89 246.838 702.89 252.5C702.89 258.162 706.9939999999999 262.38 712.5039999999999 262.38ZM712.5039999999999 259.568C708.742 259.568 706.082 256.68 706.082 252.5C706.082 248.32 708.742 245.43200000000002 712.5039999999999 245.43200000000002C716.266 245.43200000000002 718.9259999999999 248.32 718.9259999999999 252.5C718.9259999999999 256.68 716.266 259.568 712.5039999999999 259.568ZM726.4119999999999 262.0H729.452V250.752C729.452 247.598 731.466 245.43200000000002 734.43 245.43200000000002C735.836 245.43200000000002 736.976 245.926 737.736 246.8C738.496 247.636 738.914 248.89 738.914 250.372V262.0H741.954V249.916C741.954 247.788 741.27 246.002 740.092 244.71C738.914 243.38 737.1659999999999 242.62 735.1139999999999 242.62C732.682 242.62 730.63 243.722 729.376 245.736V243.0H726.4119999999999ZM757.0399999999998 269.6H760.4599999999999L771.2139999999999 243.0H767.7939999999999L761.9799999999999 258.2L755.8619999999999 243.0H752.4419999999999L760.4219999999999 261.734ZM782.2719999999999 262.38C787.782 262.38 791.886 258.162 791.886 252.5C791.886 246.838 787.782 242.62 782.2719999999999 242.62C776.762 242.62 772.658 246.838 772.658 252.5C772.658 258.162 776.762 262.38 782.2719999999999 262.38ZM782.2719999999999 259.568C778.51 259.568 775.85 256.68 775.85 252.5C775.85 248.32 778.51 245.43200000000002 782.2719999999999 245.43200000000002C786.034 245.43200000000002 788.694 248.32 788.694 252.5C788.694 256.68 786.034 259.568 782.2719999999999 259.568ZM802.6779999999999 262.38C805.1099999999999 262.38 807.0479999999999 261.278 808.3019999999999 259.112V262.0H811.2659999999998V243.0H808.2259999999999V253.754C808.2259999999999 257.212 806.4399999999998 259.568 803.3619999999999 259.568C802.0699999999999 259.568 800.9299999999998 259.074 800.1699999999998 258.2C799.4099999999999 257.364 798.9919999999998 256.11 798.9919999999998 254.248V243.0H795.9519999999999V254.552C795.9519999999999 257.212 796.6359999999999 258.998 797.8139999999999 260.29C798.9919999999998 261.62 800.7399999999999 262.38 802.6779999999999 262.38ZM816.8899999999999 262.0H819.93V252.842C819.93 248.51 821.8299999999999 245.888 824.9459999999999 245.888C825.4019999999999 245.888 825.858 245.926 826.276 246.002V242.734C825.9719999999999 242.65800000000002 825.5919999999999 242.62 825.1739999999999 242.62C822.78 242.62 820.804 244.178 819.8539999999999 246.686V243.0H816.8899999999999ZM838.0179999999999 262.0H841.2479999999999V239.504L850.2539999999999 262.0H853.218L862.2239999999999 239.504V262.0H865.454V234.64H860.8939999999999L851.7359999999999 257.82L842.5779999999999 234.64H838.0179999999999ZM876.8919999999999 262.38C879.552 262.38 881.68 261.354 883.1619999999999 259.302C883.1999999999999 260.214 883.276 261.012 883.39 262.0H886.3919999999999C886.24 260.86 886.164 259.986 886.164 258.846V249.916C886.164 247.636 885.5559999999999 246.002 884.302 244.672C883.048 243.34199999999998 880.996 242.62 878.4879999999999 242.62C873.966 242.62 870.9259999999999 245.052 870.622 248.966H873.89C874.194 246.534 875.828 245.28 878.4879999999999 245.28C880.084 245.28 881.2239999999999 245.774 882.0219999999999 246.572C882.8199999999999 247.37 883.1619999999999 248.51 883.1619999999999 250.068V250.828L876.398 251.018C872.332 251.132 870.1659999999999 253.108 870.1659999999999 256.452C870.1659999999999 259.986 872.826 262.38 876.8919999999999 262.38ZM873.358 256.49C873.358 254.59 874.574 253.564 877.196 253.488L883.1619999999999 253.298V254.286C883.1619999999999 257.63 880.8439999999999 259.872 877.462 259.872C874.992 259.872 873.358 258.58 873.358 256.49ZM899.692 262.38C904.024 262.38 907.33 259.796 908.508 255.654L905.164 255.16C904.67 257.972 902.352 259.568 899.692 259.568C895.968 259.568 893.422 256.604 893.422 252.5C893.422 248.39600000000002 895.968 245.43200000000002 899.692 245.43200000000002C902.39 245.43200000000002 904.632 246.99 905.164 249.764L908.508 249.308C907.748 245.318 904.138 242.62 899.692 242.62C894.22 242.62 890.23 246.876 890.23 252.5C890.23 258.124 894.22 262.38 899.692 262.38ZM915.4239999999999 262.38C916.7539999999999 262.38 917.7799999999999 261.392 917.7799999999999 260.024C917.7799999999999 258.656 916.7539999999999 257.668 915.4239999999999 257.668C914.0939999999998 257.668 913.0679999999999 258.656 913.0679999999999 260.024C913.0679999999999 261.392 914.0939999999998 262.38 915.4239999999999 262.38Z" fill="#A1A1A6"/><rect x="463.3" y="355.4" width="353.4" height="76.0" rx="38.0" fill="#000" opacity="0.28" filter="url(#blur)"/><rect x="467.1" y="344.0" width="345.8" height="76.0" rx="38.0" fill="#252527" stroke="rgba(236,236,236,0.12)" stroke-width="1.90"/><circle cx="500.4" cy="382.0" r="6.6" fill="#FF6A50"/><rect x="526.0" y="375.9" width="5.7" height="12.3" rx="2.8" fill="#ECECEC"/><rect x="537.4" y="369.6" width="5.7" height="24.8" rx="2.8" fill="#ECECEC"/><rect x="548.8" y="364.9" width="5.7" height="34.2" rx="2.8" fill="#ECECEC"/><rect x="560.2" y="371.9" width="5.7" height="20.2" rx="2.8" fill="#ECECEC"/><rect x="571.6" y="377.1" width="5.7" height="9.9" rx="2.8" fill="#ECECEC"/><path d="M609.657 390.987C613.5349 390.987 616.1037 387.3561 616.1037 381.848C616.1037 376.3399 613.5349 372.709 609.657 372.709C605.7791 372.709 603.2103 376.3399 603.2103 381.848C603.2103 387.3561 605.7791 390.987 609.657 390.987ZM609.657 389.1098C607.0141 389.1098 605.3345 386.2693 605.3345 381.848C605.3345 377.4267 607.0141 374.5862 609.657 374.5862C612.2999 374.5862 613.9795 377.4267 613.9795 381.848C613.9795 386.2693 612.2999 389.1098 609.657 389.1098ZM621.1424999999999 382.7866C622.007 382.7866 622.6739 382.1444 622.6739 381.2552C622.6739 380.366 622.007 379.7238 621.1424999999999 379.7238C620.278 379.7238 619.6111 380.366 619.6111 381.2552C619.6111 382.1444 620.278 382.7866 621.1424999999999 382.7866ZM621.1424999999999 390.987C622.007 390.987 622.6739 390.3448 622.6739 389.4556C622.6739 388.5664 622.007 387.9242 621.1424999999999 387.9242C620.278 387.9242 619.6111 388.5664 619.6111 389.4556C619.6111 390.3448 620.278 390.987 621.1424999999999 390.987ZM632.628 390.987C636.5059 390.987 639.0747 387.3561 639.0747 381.848C639.0747 376.3399 636.5059 372.709 632.628 372.709C628.7501 372.709 626.1813 376.3399 626.1813 381.848C626.1813 387.3561 628.7501 390.987 632.628 390.987ZM632.628 389.1098C629.9851 389.1098 628.3055 386.2693 628.3055 381.848C628.3055 377.4267 629.9851 374.5862 632.628 374.5862C635.2709 374.5862 636.9505 377.4267 636.9505 381.848C636.9505 386.2693 635.2709 389.1098 632.628 389.1098ZM644.237 390.74H646.5093999999999C647.9173 384.5897 650.5602 379.0816 654.0676 374.85790000000003V372.956H642.5821V374.8085H651.7705C648.2878 379.2792 645.6449 384.7379 644.237 390.74Z" fill="#A1A1A6"/><circle cx="710.3" cy="382.0" r="22.8" fill="#ECECEC" opacity="0.10"/><path d="M704.2 375.9L716.4 388.1M716.4 375.9L704.2 388.1" stroke="#ECECEC" stroke-width="3.04" stroke-linecap="round"/><circle cx="774.9" cy="382.0" r="22.8" fill="#ECECEC"/><rect x="767.3" y="374.4" width="15.2" height="15.2" rx="2.7" fill="#1C1C1E"/></svg>
diff --git a/docs/assets/readme-hero-light.png b/docs/assets/readme-hero-light.png
new file mode 100644
index 0000000..8aee33b
Binary files /dev/null and b/docs/assets/readme-hero-light.png differ
diff --git a/docs/assets/readme-hero-light.svg b/docs/assets/readme-hero-light.svg
new file mode 100644
index 0000000..b70e120
--- /dev/null
+++ b/docs/assets/readme-hero-light.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="1280" height="520" viewBox="0 0 1280 520"><defs><filter id="blur" x="-20%" y="-50%" width="140%" height="200%"><feGaussianBlur stdDeviation="9"/></filter></defs><rect width="1280" height="520" rx="24" fill="#FFFFFF"/><rect x="0.5" y="0.5" width="1279" height="519" rx="23.5" fill="none" stroke="rgba(0,0,0,0.08)"/><defs><linearGradient id="igl" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2B2B2D"/><stop offset="1" stop-color="#1D1D1F"/></linearGradient></defs><rect x="393.78200000000004" y="108" width="84" height="84" rx="18.98" fill="url(#igl)"/><g fill="#EBEBEB"><rect x="409.15" y="141.43" width="6.26" height="17.05" rx="3.12"/><rect x="420.91" y="133.62" width="6.26" height="32.76" rx="3.12"/><rect x="432.76" y="127.07" width="6.26" height="45.95" rx="3.12"/><rect x="444.52" y="135.55" width="6.26" height="28.98" rx="3.12"/><rect x="456.19" y="142.78" width="6.26" height="14.45" rx="3.12"/></g><path d="M539.802 178.84C557.6940000000001 178.84 568.6980000000001 165.484 568.6980000000001 148.684V145.99599999999998H539.97V153.808H559.1220000000001C557.778 165.064 549.63 171.028 539.802 171.028C527.4540000000001 171.028 518.8860000000001 161.2 518.8860000000001 147.76C518.8860000000001 134.32 527.4540000000001 124.49199999999999 539.802 124.49199999999999C549.21 124.49199999999999 556.182 129.7 557.946 138.184L567.4380000000001 137.00799999999998C565.0020000000001 125.08 553.7460000000001 116.68 539.802 116.68C522.582 116.68 509.73 129.952 509.73 147.76C509.73 165.568 522.582 178.84 539.802 178.84ZM578.2740000000001 178.0H587.094V153.472H598.4340000000001C609.522 153.472 617.586 145.99599999999998 617.586 135.49599999999998C617.586 124.996 609.522 117.52 598.4340000000001 117.52H578.2740000000001ZM597.5100000000001 145.576H587.094V125.416H597.5100000000001C604.1460000000001 125.416 608.4300000000001 129.364 608.4300000000001 135.49599999999998C608.4300000000001 141.628 604.1460000000001 145.576 597.5100000000001 145.576ZM637.0740000000001 178.0H645.8940000000001V125.584H663.1140000000001V117.52H619.7700000000001V125.584H637.0740000000001ZM698.6460000000001 178.0H708.5580000000001L731.238 117.52H721.662L703.6020000000001 167.92L685.5420000000001 117.52H675.9660000000001ZM749.8860000000001 178.84C762.3180000000001 178.84 771.558 169.516 771.558 157.0C771.558 144.48399999999998 762.3180000000001 135.16 749.8860000000001 135.16C737.4540000000001 135.16 728.214 144.48399999999998 728.214 157.0C728.214 169.516 737.4540000000001 178.84 749.8860000000001 178.84ZM749.8860000000001 171.61599999999999C742.2420000000001 171.61599999999999 737.034 165.568 737.034 157.0C737.034 148.432 742.2420000000001 142.38400000000001 749.8860000000001 142.38400000000001C757.5300000000001 142.38400000000001 762.822 148.432 762.822 157.0C762.822 165.568 757.5300000000001 171.61599999999999 749.8860000000001 171.61599999999999ZM779.37 178.0H787.7700000000001V136.0H779.37ZM783.57 129.61599999999999C786.846 129.61599999999999 789.3660000000001 127.18 789.3660000000001 123.904C789.3660000000001 120.62799999999999 786.846 118.192 783.57 118.192C780.2940000000001 118.192 777.774 120.62799999999999 777.774 123.904C777.774 127.18 780.2940000000001 129.61599999999999 783.57 129.61599999999999ZM816.834 178.84C826.494 178.84 834.222 173.128 836.658 163.552L827.754 162.46C826.746 168.256 822.126 171.61599999999999 816.834 171.61599999999999C809.358 171.61599999999999 804.4019999999999 165.568 804.4019999999999 157.0C804.4019999999999 148.432 809.358 142.38400000000001 816.834 142.38400000000001C822.21 142.38400000000001 826.746 145.66 827.754 151.372L836.658 150.28C834.894 141.124 826.746 135.16 816.834 135.16C804.486 135.16 795.582 144.48399999999998 795.582 157.0C795.582 169.516 804.5699999999999 178.84 816.834 178.84ZM862.278 178.84C871.4340000000001 178.84 878.994 173.716 881.7660000000001 165.316L872.8620000000001 164.14C871.7700000000001 168.59199999999998 867.8220000000001 171.61599999999999 862.278 171.61599999999999C855.3900000000001 171.61599999999999 850.518 166.66 849.7620000000001 159.184H882.942V157.42C882.942 143.89600000000002 874.71 135.16 862.278 135.16C850.2660000000001 135.16 841.278 144.48399999999998 841.278 157.0C841.278 169.516 850.0980000000001 178.84 862.278 178.84ZM850.0980000000001 152.716C851.442 146.416 856.062 142.3 862.278 142.3C868.998 142.3 873.3660000000001 146.668 874.206 152.716Z" fill="#1C1C1E"/><path d="M362.258 262.0H370.88399999999996C378.674 262.0 384.298 256.262 384.298 248.32C384.298 240.378 378.59799999999996 234.64 370.77 234.64H362.258ZM370.88399999999996 258.96H365.488V237.68H370.77C376.81199999999995 237.68 380.95399999999995 241.974 380.95399999999995 248.32C380.95399999999995 254.666 376.888 258.96 370.88399999999996 258.96ZM388.63 262.0H391.66999999999996V243.0H388.63ZM390.15 239.88400000000001C391.47999999999996 239.88400000000001 392.506 238.858 392.506 237.528C392.506 236.198 391.47999999999996 235.172 390.15 235.172C388.82 235.172 387.794 236.198 387.794 237.528C387.794 238.858 388.82 239.88400000000001 390.15 239.88400000000001ZM405.426 262.38C409.758 262.38 413.06399999999996 259.796 414.24199999999996 255.654L410.89799999999997 255.16C410.404 257.972 408.08599999999996 259.568 405.426 259.568C401.702 259.568 399.15599999999995 256.604 399.15599999999995 252.5C399.15599999999995 248.39600000000002 401.702 245.43200000000002 405.426 245.43200000000002C408.12399999999997 245.43200000000002 410.366 246.99 410.89799999999997 249.764L414.24199999999996 249.308C413.48199999999997 245.318 409.87199999999996 242.62 405.426 242.62C399.95399999999995 242.62 395.964 246.876 395.964 252.5C395.964 258.124 399.95399999999995 262.38 405.426 262.38ZM423.856 262.228C424.53999999999996 262.228 425.33799999999997 262.114 425.67999999999995 262.0V259.188C425.224 259.302 424.806 259.34 424.426 259.34C423.628 259.34 423.058 259.15 422.71599999999995 258.808C422.412 258.466 422.26 258.048 422.26 257.364V245.66H425.67999999999995V243.0H422.26V238.44H419.21999999999997V243.0H416.104V245.66H419.21999999999997V257.744C419.21999999999997 259.302 419.59999999999997 260.366 420.35999999999996 261.088C421.15799999999996 261.848 422.33599999999996 262.228 423.856 262.228ZM435.218 262.38C437.878 262.38 440.006 261.354 441.488 259.302C441.526 260.214 441.602 261.012 441.716 262.0H444.718C444.566 260.86 444.49 259.986 444.49 258.846V249.916C444.49 247.636 443.882 246.002 442.628 244.672C441.374 243.34199999999998 439.322 242.62 436.814 242.62C432.292 242.62 429.252 245.052 428.948 248.966H432.216C432.52 246.534 434.154 245.28 436.814 245.28C438.40999999999997 245.28 439.55 245.774 440.348 246.572C441.146 247.37 441.488 248.51 441.488 250.068V250.828L434.724 251.018C430.658 251.132 428.492 253.108 428.492 256.452C428.492 259.986 431.152 262.38 435.218 262.38ZM431.68399999999997 256.49C431.68399999999997 254.59 432.9 253.564 435.522 253.488L441.488 253.298V254.286C441.488 257.63 439.17 259.872 435.788 259.872C433.318 259.872 431.68399999999997 258.58 431.68399999999997 256.49ZM455.168 262.228C455.852 262.228 456.65 262.114 456.99199999999996 262.0V259.188C456.536 259.302 456.118 259.34 455.738 259.34C454.94 259.34 454.37 259.15 454.02799999999996 258.808C453.724 258.466 453.572 258.048 453.572 257.364V245.66H456.99199999999996V243.0H453.572V238.44H450.532V243.0H447.416V245.66H450.532V257.744C450.532 259.302 450.912 260.366 451.67199999999997 261.088C452.46999999999997 261.848 453.64799999999997 262.228 455.168 262.228ZM468.61999999999995 262.38C472.76199999999994 262.38 476.10599999999994 259.986 477.28399999999993 256.262L473.93999999999994 255.768C473.40799999999996 258.048 471.39399999999995 259.568 468.61999999999995 259.568C465.12399999999997 259.568 462.69199999999995 257.022 462.388 253.26H477.816V252.728C477.816 246.61 474.16799999999995 242.62 468.61999999999995 242.62C463.26199999999994 242.62 459.234 246.876 459.234 252.5C459.234 258.124 463.22399999999993 262.38 468.61999999999995 262.38ZM462.53999999999996 250.676C463.186 247.484 465.50399999999996 245.43200000000002 468.61999999999995 245.43200000000002C472.00199999999995 245.43200000000002 474.12999999999994 247.598 474.50999999999993 250.676ZM490.622 262.0H493.662V243.0H490.622ZM492.142 239.88400000000001C493.472 239.88400000000001 494.498 238.858 494.498 237.528C494.498 236.198 493.472 235.172 492.142 235.172C490.812 235.172 489.786 236.198 489.786 237.528C489.786 238.858 490.812 239.88400000000001 492.142 239.88400000000001ZM499.286 262.0H502.32599999999996V250.752C502.32599999999996 247.598 504.34 245.43200000000002 507.304 245.43200000000002C508.71 245.43200000000002 509.84999999999997 245.926 510.61 246.8C511.37 247.636 511.788 248.89 511.788 250.372V262.0H514.828V249.916C514.828 247.788 514.144 246.002 512.966 244.71C511.788 243.38 510.03999999999996 242.62 507.988 242.62C505.556 242.62 503.504 243.722 502.25 245.736V243.0H499.286ZM525.468 262.228C526.152 262.228 526.95 262.114 527.292 262.0V259.188C526.836 259.302 526.418 259.34 526.038 259.34C525.24 259.34 524.67 259.15 524.328 258.808C524.024 258.466 523.872 258.048 523.872 257.364V245.66H527.292V243.0H523.872V238.44H520.832V243.0H517.716V245.66H520.832V257.744C520.832 259.302 521.212 260.366 521.972 261.088C522.77 261.848 523.948 262.228 525.468 262.228ZM539.1479999999999 262.38C544.658 262.38 548.762 258.162 548.762 252.5C548.762 246.838 544.658 242.62 539.1479999999999 242.62C533.6379999999999 242.62 529.534 246.838 529.534 252.5C529.534 258.162 533.6379999999999 262.38 539.1479999999999 262.38ZM539.1479999999999 259.568C535.386 259.568 532.726 256.68 532.726 252.5C532.726 248.32 535.386 245.43200000000002 539.1479999999999 245.43200000000002C542.91 245.43200000000002 545.5699999999999 248.32 545.5699999999999 252.5C545.5699999999999 256.68 542.91 259.568 539.1479999999999 259.568ZM567.2299999999999 262.38C569.89 262.38 572.0179999999999 261.354 573.4999999999999 259.302C573.5379999999999 260.214 573.6139999999999 261.012 573.728 262.0H576.7299999999999C576.578 260.86 576.502 259.986 576.502 258.846V249.916C576.502 247.636 575.8939999999999 246.002 574.64 244.672C573.386 243.34199999999998 571.334 242.62 568.8259999999999 242.62C564.304 242.62 561.2639999999999 245.052 560.9599999999999 248.966H564.228C564.5319999999999 246.534 566.1659999999999 245.28 568.8259999999999 245.28C570.4219999999999 245.28 571.5619999999999 245.774 572.3599999999999 246.572C573.1579999999999 247.37 573.4999999999999 248.51 573.4999999999999 250.068V250.828L566.736 251.018C562.67 251.132 560.5039999999999 253.108 560.5039999999999 256.452C560.5039999999999 259.986 563.164 262.38 567.2299999999999 262.38ZM563.6959999999999 256.49C563.6959999999999 254.59 564.9119999999999 253.564 567.534 253.488L573.4999999999999 253.298V254.286C573.4999999999999 257.63 571.1819999999999 259.872 567.8 259.872C565.3299999999999 259.872 563.6959999999999 258.58 563.6959999999999 256.49ZM581.8979999999999 262.0H584.938V250.752C584.938 247.598 586.952 245.43200000000002 589.9159999999999 245.43200000000002C591.322 245.43200000000002 592.462 245.926 593.222 246.8C593.982 247.636 594.4 248.89 594.4 250.372V262.0H597.4399999999999V249.916C597.4399999999999 247.788 596.756 246.002 595.578 244.71C594.4 243.38 592.6519999999999 242.62 590.5999999999999 242.62C588.168 242.62 586.116 243.722 584.862 245.736V243.0H581.8979999999999ZM604.4319999999999 269.6H607.852L618.606 243.0H615.1859999999999L609.372 258.2L603.2539999999999 243.0H599.834L607.814 261.734ZM635.212 262.38C637.8720000000001 262.38 640.0 261.354 641.482 259.302C641.52 260.214 641.596 261.012 641.71 262.0H644.712C644.5600000000001 260.86 644.484 259.986 644.484 258.846V249.916C644.484 247.636 643.876 246.002 642.6220000000001 244.672C641.368 243.34199999999998 639.316 242.62 636.808 242.62C632.2860000000001 242.62 629.246 245.052 628.942 248.966H632.21C632.514 246.534 634.148 245.28 636.808 245.28C638.404 245.28 639.544 245.774 640.342 246.572C641.14 247.37 641.482 248.51 641.482 250.068V250.828L634.7180000000001 251.018C630.652 251.132 628.486 253.108 628.486 256.452C628.486 259.986 631.1460000000001 262.38 635.212 262.38ZM631.678 256.49C631.678 254.59 632.894 253.564 635.5160000000001 253.488L641.482 253.298V254.286C641.482 257.63 639.164 259.872 635.782 259.872C633.312 259.872 631.678 258.58 631.678 256.49ZM649.8799999999999 269.6H652.882V258.77C654.174 261.05 656.7199999999999 262.38 659.5319999999999 262.38C664.6239999999999 262.38 668.4999999999999 258.086 668.4999999999999 252.5C668.4999999999999 246.914 664.6239999999999 242.62 659.5319999999999 242.62C656.6819999999999 242.62 654.136 243.988 652.8439999999999 246.306V243.0H649.8799999999999ZM659.0379999999999 259.568C655.276 259.568 652.7679999999999 256.604 652.7679999999999 252.5C652.7679999999999 248.39600000000002 655.276 245.43200000000002 659.0379999999999 245.43200000000002C662.8 245.43200000000002 665.3079999999999 248.39600000000002 665.3079999999999 252.5C665.3079999999999 256.604 662.8 259.568 659.0379999999999 259.568ZM672.7559999999999 269.6H675.7579999999999V258.77C677.05 261.05 679.5959999999999 262.38 682.4079999999999 262.38C687.4999999999999 262.38 691.3759999999999 258.086 691.3759999999999 252.5C691.3759999999999 246.914 687.4999999999999 242.62 682.4079999999999 242.62C679.5579999999999 242.62 677.012 243.988 675.7199999999999 246.306V243.0H672.7559999999999ZM681.9139999999999 259.568C678.1519999999999 259.568 675.6439999999999 256.604 675.6439999999999 252.5C675.6439999999999 248.39600000000002 678.1519999999999 245.43200000000002 681.9139999999999 245.43200000000002C685.6759999999999 245.43200000000002 688.1839999999999 248.39600000000002 688.1839999999999 252.5C688.1839999999999 256.604 685.6759999999999 259.568 681.9139999999999 259.568ZM712.5039999999999 262.38C718.014 262.38 722.1179999999999 258.162 722.1179999999999 252.5C722.1179999999999 246.838 718.014 242.62 712.5039999999999 242.62C706.9939999999999 242.62 702.89 246.838 702.89 252.5C702.89 258.162 706.9939999999999 262.38 712.5039999999999 262.38ZM712.5039999999999 259.568C708.742 259.568 706.082 256.68 706.082 252.5C706.082 248.32 708.742 245.43200000000002 712.5039999999999 245.43200000000002C716.266 245.43200000000002 718.9259999999999 248.32 718.9259999999999 252.5C718.9259999999999 256.68 716.266 259.568 712.5039999999999 259.568ZM726.4119999999999 262.0H729.452V250.752C729.452 247.598 731.466 245.43200000000002 734.43 245.43200000000002C735.836 245.43200000000002 736.976 245.926 737.736 246.8C738.496 247.636 738.914 248.89 738.914 250.372V262.0H741.954V249.916C741.954 247.788 741.27 246.002 740.092 244.71C738.914 243.38 737.1659999999999 242.62 735.1139999999999 242.62C732.682 242.62 730.63 243.722 729.376 245.736V243.0H726.4119999999999ZM757.0399999999998 269.6H760.4599999999999L771.2139999999999 243.0H767.7939999999999L761.9799999999999 258.2L755.8619999999999 243.0H752.4419999999999L760.4219999999999 261.734ZM782.2719999999999 262.38C787.782 262.38 791.886 258.162 791.886 252.5C791.886 246.838 787.782 242.62 782.2719999999999 242.62C776.762 242.62 772.658 246.838 772.658 252.5C772.658 258.162 776.762 262.38 782.2719999999999 262.38ZM782.2719999999999 259.568C778.51 259.568 775.85 256.68 775.85 252.5C775.85 248.32 778.51 245.43200000000002 782.2719999999999 245.43200000000002C786.034 245.43200000000002 788.694 248.32 788.694 252.5C788.694 256.68 786.034 259.568 782.2719999999999 259.568ZM802.6779999999999 262.38C805.1099999999999 262.38 807.0479999999999 261.278 808.3019999999999 259.112V262.0H811.2659999999998V243.0H808.2259999999999V253.754C808.2259999999999 257.212 806.4399999999998 259.568 803.3619999999999 259.568C802.0699999999999 259.568 800.9299999999998 259.074 800.1699999999998 258.2C799.4099999999999 257.364 798.9919999999998 256.11 798.9919999999998 254.248V243.0H795.9519999999999V254.552C795.9519999999999 257.212 796.6359999999999 258.998 797.8139999999999 260.29C798.9919999999998 261.62 800.7399999999999 262.38 802.6779999999999 262.38ZM816.8899999999999 262.0H819.93V252.842C819.93 248.51 821.8299999999999 245.888 824.9459999999999 245.888C825.4019999999999 245.888 825.858 245.926 826.276 246.002V242.734C825.9719999999999 242.65800000000002 825.5919999999999 242.62 825.1739999999999 242.62C822.78 242.62 820.804 244.178 819.8539999999999 246.686V243.0H816.8899999999999ZM838.0179999999999 262.0H841.2479999999999V239.504L850.2539999999999 262.0H853.218L862.2239999999999 239.504V262.0H865.454V234.64H860.8939999999999L851.7359999999999 257.82L842.5779999999999 234.64H838.0179999999999ZM876.8919999999999 262.38C879.552 262.38 881.68 261.354 883.1619999999999 259.302C883.1999999999999 260.214 883.276 261.012 883.39 262.0H886.3919999999999C886.24 260.86 886.164 259.986 886.164 258.846V249.916C886.164 247.636 885.5559999999999 246.002 884.302 244.672C883.048 243.34199999999998 880.996 242.62 878.4879999999999 242.62C873.966 242.62 870.9259999999999 245.052 870.622 248.966H873.89C874.194 246.534 875.828 245.28 878.4879999999999 245.28C880.084 245.28 881.2239999999999 245.774 882.0219999999999 246.572C882.8199999999999 247.37 883.1619999999999 248.51 883.1619999999999 250.068V250.828L876.398 251.018C872.332 251.132 870.1659999999999 253.108 870.1659999999999 256.452C870.1659999999999 259.986 872.826 262.38 876.8919999999999 262.38ZM873.358 256.49C873.358 254.59 874.574 253.564 877.196 253.488L883.1619999999999 253.298V254.286C883.1619999999999 257.63 880.8439999999999 259.872 877.462 259.872C874.992 259.872 873.358 258.58 873.358 256.49ZM899.692 262.38C904.024 262.38 907.33 259.796 908.508 255.654L905.164 255.16C904.67 257.972 902.352 259.568 899.692 259.568C895.968 259.568 893.422 256.604 893.422 252.5C893.422 248.39600000000002 895.968 245.43200000000002 899.692 245.43200000000002C902.39 245.43200000000002 904.632 246.99 905.164 249.764L908.508 249.308C907.748 245.318 904.138 242.62 899.692 242.62C894.22 242.62 890.23 246.876 890.23 252.5C890.23 258.124 894.22 262.38 899.692 262.38ZM915.4239999999999 262.38C916.7539999999999 262.38 917.7799999999999 261.392 917.7799999999999 260.024C917.7799999999999 258.656 916.7539999999999 257.668 915.4239999999999 257.668C914.0939999999998 257.668 913.0679999999999 258.656 913.0679999999999 260.024C913.0679999999999 261.392 914.0939999999998 262.38 915.4239999999999 262.38Z" fill="#5E5E63"/><rect x="463.3" y="355.4" width="353.4" height="76.0" rx="38.0" fill="#000" opacity="0.1" filter="url(#blur)"/><rect x="467.1" y="344.0" width="345.8" height="76.0" rx="38.0" fill="#FFFFFF" stroke="rgba(28,28,30,0.12)" stroke-width="1.90"/><circle cx="500.4" cy="382.0" r="6.6" fill="#D5432B"/><rect x="526.0" y="375.9" width="5.7" height="12.3" rx="2.8" fill="#1C1C1E"/><rect x="537.4" y="369.6" width="5.7" height="24.8" rx="2.8" fill="#1C1C1E"/><rect x="548.8" y="364.9" width="5.7" height="34.2" rx="2.8" fill="#1C1C1E"/><rect x="560.2" y="371.9" width="5.7" height="20.2" rx="2.8" fill="#1C1C1E"/><rect x="571.6" y="377.1" width="5.7" height="9.9" rx="2.8" fill="#1C1C1E"/><path d="M609.657 390.987C613.5349 390.987 616.1037 387.3561 616.1037 381.848C616.1037 376.3399 613.5349 372.709 609.657 372.709C605.7791 372.709 603.2103 376.3399 603.2103 381.848C603.2103 387.3561 605.7791 390.987 609.657 390.987ZM609.657 389.1098C607.0141 389.1098 605.3345 386.2693 605.3345 381.848C605.3345 377.4267 607.0141 374.5862 609.657 374.5862C612.2999 374.5862 613.9795 377.4267 613.9795 381.848C613.9795 386.2693 612.2999 389.1098 609.657 389.1098ZM621.1424999999999 382.7866C622.007 382.7866 622.6739 382.1444 622.6739 381.2552C622.6739 380.366 622.007 379.7238 621.1424999999999 379.7238C620.278 379.7238 619.6111 380.366 619.6111 381.2552C619.6111 382.1444 620.278 382.7866 621.1424999999999 382.7866ZM621.1424999999999 390.987C622.007 390.987 622.6739 390.3448 622.6739 389.4556C622.6739 388.5664 622.007 387.9242 621.1424999999999 387.9242C620.278 387.9242 619.6111 388.5664 619.6111 389.4556C619.6111 390.3448 620.278 390.987 621.1424999999999 390.987ZM632.628 390.987C636.5059 390.987 639.0747 387.3561 639.0747 381.848C639.0747 376.3399 636.5059 372.709 632.628 372.709C628.7501 372.709 626.1813 376.3399 626.1813 381.848C626.1813 387.3561 628.7501 390.987 632.628 390.987ZM632.628 389.1098C629.9851 389.1098 628.3055 386.2693 628.3055 381.848C628.3055 377.4267 629.9851 374.5862 632.628 374.5862C635.2709 374.5862 636.9505 377.4267 636.9505 381.848C636.9505 386.2693 635.2709 389.1098 632.628 389.1098ZM644.237 390.74H646.5093999999999C647.9173 384.5897 650.5602 379.0816 654.0676 374.85790000000003V372.956H642.5821V374.8085H651.7705C648.2878 379.2792 645.6449 384.7379 644.237 390.74Z" fill="#5E5E63"/><circle cx="710.3" cy="382.0" r="22.8" fill="#1C1C1E" opacity="0.10"/><path d="M704.2 375.9L716.4 388.1M716.4 375.9L704.2 388.1" stroke="#1C1C1E" stroke-width="3.04" stroke-linecap="round"/><circle cx="774.9" cy="382.0" r="22.8" fill="#1C1C1E"/><rect x="767.3" y="374.4" width="15.2" height="15.2" rx="2.7" fill="#FFFFFF"/></svg>
diff --git a/docs/assets/social-preview.png b/docs/assets/social-preview.png
new file mode 100644
index 0000000..15214d6
Binary files /dev/null and b/docs/assets/social-preview.png differ
diff --git a/docs/assets/social-preview.svg b/docs/assets/social-preview.svg
new file mode 100644
index 0000000..8e787f3
--- /dev/null
+++ b/docs/assets/social-preview.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="1280" height="640" viewBox="0 0 1280 640"><defs><filter id="blur" x="-20%" y="-50%" width="140%" height="200%"><feGaussianBlur stdDeviation="9"/></filter></defs><rect width="1280" height="640" fill="#F4F4F3"/><defs><linearGradient id="igs" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2B2B2D"/><stop offset="1" stop-color="#1D1D1F"/></linearGradient></defs><rect x="88" y="104" width="96" height="96" rx="21.70" fill="url(#igs)"/><g fill="#EBEBEB"><rect x="105.57" y="142.21" width="7.15" height="19.49" rx="3.57"/><rect x="119.01" y="133.28" width="7.15" height="37.44" rx="3.57"/><rect x="132.54" y="125.79" width="7.15" height="52.51" rx="3.57"/><rect x="145.98" y="135.49" width="7.15" height="33.12" rx="3.57"/><rect x="159.33" y="143.74" width="7.15" height="16.51" rx="3.57"/></g><path d="M121.25999999999999 316.92C140.856 316.92 152.90800000000002 302.292 152.90800000000002 283.892V280.948H121.444V289.504H142.42000000000002C140.948 301.832 132.024 308.364 121.25999999999999 308.364C107.736 308.364 98.352 297.6 98.352 282.88C98.352 268.16 107.736 257.396 121.25999999999999 257.396C131.564 257.396 139.2 263.1 141.132 272.392L151.52800000000002 271.104C148.86 258.04 136.53199999999998 248.84 121.25999999999999 248.84C102.4 248.84 88.324 263.376 88.324 282.88C88.324 302.384 102.4 316.92 121.25999999999999 316.92ZM163.39600000000002 316.0H173.056V289.136H185.476C197.62 289.136 206.452 280.948 206.452 269.448C206.452 257.948 197.62 249.76 185.476 249.76H163.39600000000002ZM184.464 280.488H173.056V258.408H184.464C191.73200000000003 258.408 196.424 262.73199999999997 196.424 269.448C196.424 276.164 191.73200000000003 280.488 184.464 280.488ZM227.796 316.0H237.456V258.592H256.31600000000003V249.76H208.844V258.592H227.796ZM295.23199999999997 316.0H306.08799999999997L330.928 249.76H320.44L300.65999999999997 304.96L280.88 249.76H270.392ZM351.35200000000003 316.92C364.968 316.92 375.088 306.708 375.088 293.0C375.088 279.29200000000003 364.968 269.08 351.35200000000003 269.08C337.73600000000005 269.08 327.61600000000004 279.29200000000003 327.61600000000004 293.0C327.61600000000004 306.708 337.73600000000005 316.92 351.35200000000003 316.92ZM351.35200000000003 309.008C342.98 309.008 337.276 302.384 337.276 293.0C337.276 283.616 342.98 276.992 351.35200000000003 276.992C359.72400000000005 276.992 365.52000000000004 283.616 365.52000000000004 293.0C365.52000000000004 302.384 359.72400000000005 309.008 351.35200000000003 309.008ZM383.644 316.0H392.844V270.0H383.644ZM388.24399999999997 263.008C391.832 263.008 394.592 260.34000000000003 394.592 256.752C394.592 253.164 391.832 250.49599999999998 388.24399999999997 250.49599999999998C384.656 250.49599999999998 381.896 253.164 381.896 256.752C381.896 260.34000000000003 384.656 263.008 388.24399999999997 263.008ZM424.676 316.92C435.256 316.92 443.71999999999997 310.664 446.388 300.176L436.63599999999997 298.98C435.532 305.328 430.472 309.008 424.676 309.008C416.48799999999994 309.008 411.05999999999995 302.384 411.05999999999995 293.0C411.05999999999995 283.616 416.48799999999994 276.992 424.676 276.992C430.56399999999996 276.992 435.532 280.58 436.63599999999997 286.836L446.388 285.64C444.45599999999996 275.612 435.532 269.08 424.676 269.08C411.152 269.08 401.4 279.29200000000003 401.4 293.0C401.4 306.708 411.24399999999997 316.92 424.676 316.92ZM474.448 316.92C484.476 316.92 492.756 311.308 495.792 302.108L486.03999999999996 300.82C484.844 305.696 480.52 309.008 474.448 309.008C466.904 309.008 461.568 303.58 460.74 295.392H497.08V293.46C497.08 278.648 488.06399999999996 269.08 474.448 269.08C461.292 269.08 451.448 279.29200000000003 451.448 293.0C451.448 306.708 461.108 316.92 474.448 316.92ZM461.108 288.308C462.58 281.408 467.64 276.9 474.448 276.9C481.808 276.9 486.592 281.68399999999997 487.512 288.308Z" fill="#1C1C1E"/><path d="M91.76 386.0H100.84C109.03999999999999 386.0 114.96000000000001 379.96 114.96000000000001 371.6C114.96000000000001 363.24 108.96000000000001 357.2 100.72 357.2H91.76ZM100.84 382.8H95.16V360.4H100.72C107.08 360.4 111.44 364.92 111.44 371.6C111.44 378.28 107.16 382.8 100.84 382.8ZM119.52 386.0H122.72V366.0H119.52ZM121.12 362.72C122.52 362.72 123.6 361.64 123.6 360.24C123.6 358.84 122.52 357.76 121.12 357.76C119.72 357.76 118.64 358.84 118.64 360.24C118.64 361.64 119.72 362.72 121.12 362.72ZM137.20000000000002 386.4C141.76 386.4 145.24 383.68 146.48000000000002 379.32L142.96 378.8C142.44 381.76 140.0 383.44 137.20000000000002 383.44C133.28 383.44 130.6 380.32 130.6 376.0C130.6 371.68 133.28 368.56 137.20000000000002 368.56C140.04 368.56 142.4 370.2 142.96 373.12L146.48000000000002 372.64C145.68 368.44 141.88 365.6 137.20000000000002 365.6C131.44 365.6 127.24000000000001 370.08 127.24000000000001 376.0C127.24000000000001 381.92 131.44 386.4 137.20000000000002 386.4ZM156.6 386.24C157.32 386.24 158.16 386.12 158.52 386.0V383.04C158.04 383.16 157.6 383.2 157.2 383.2C156.36 383.2 155.76 383.0 155.4 382.64C155.08 382.28 154.92000000000002 381.84 154.92000000000002 381.12V368.8H158.52V366.0H154.92000000000002V361.2H151.72V366.0H148.44V368.8H151.72V381.52C151.72 383.16 152.12 384.28 152.92000000000002 385.04C153.76 385.84 155.0 386.24 156.6 386.24ZM168.55999999999997 386.4C171.35999999999999 386.4 173.6 385.32 175.15999999999997 383.16C175.2 384.12 175.27999999999997 384.96 175.39999999999998 386.0H178.55999999999997C178.39999999999998 384.8 178.32 383.88 178.32 382.68V373.28C178.32 370.88 177.67999999999998 369.16 176.35999999999999 367.76C175.04 366.36 172.88 365.6 170.23999999999998 365.6C165.48 365.6 162.27999999999997 368.16 161.95999999999998 372.28H165.39999999999998C165.71999999999997 369.72 167.43999999999997 368.4 170.23999999999998 368.4C171.92 368.4 173.11999999999998 368.92 173.95999999999998 369.76C174.79999999999998 370.6 175.15999999999997 371.8 175.15999999999997 373.44V374.24L168.04 374.44C163.76 374.56 161.48 376.64 161.48 380.16C161.48 383.88 164.27999999999997 386.4 168.55999999999997 386.4ZM164.83999999999997 380.2C164.83999999999997 378.2 166.11999999999998 377.12 168.88 377.04L175.15999999999997 376.84V377.88C175.15999999999997 381.4 172.71999999999997 383.76 169.15999999999997 383.76C166.55999999999997 383.76 164.83999999999997 382.4 164.83999999999997 380.2ZM189.55999999999997 386.24C190.27999999999997 386.24 191.11999999999998 386.12 191.48 386.0V383.04C190.99999999999997 383.16 190.55999999999997 383.2 190.15999999999997 383.2C189.32 383.2 188.71999999999997 383.0 188.35999999999999 382.64C188.04 382.28 187.88 381.84 187.88 381.12V368.8H191.48V366.0H187.88V361.2H184.67999999999998V366.0H181.39999999999998V368.8H184.67999999999998V381.52C184.67999999999998 383.16 185.07999999999998 384.28 185.88 385.04C186.71999999999997 385.84 187.95999999999998 386.24 189.55999999999997 386.24ZM203.71999999999997 386.4C208.07999999999998 386.4 211.6 383.88 212.83999999999997 379.96L209.32 379.44C208.76 381.84 206.64 383.44 203.71999999999997 383.44C200.04 383.44 197.48 380.76 197.16 376.8H213.39999999999998V376.24C213.39999999999998 369.8 209.55999999999997 365.6 203.71999999999997 365.6C198.07999999999998 365.6 193.83999999999997 370.08 193.83999999999997 376.0C193.83999999999997 381.92 198.04 386.4 203.71999999999997 386.4ZM197.32 374.08C197.99999999999997 370.72 200.44 368.56 203.71999999999997 368.56C207.27999999999997 368.56 209.51999999999998 370.84 209.92 374.08ZM226.88 386.0H230.08V366.0H226.88ZM228.48 362.72C229.88 362.72 230.96 361.64 230.96 360.24C230.96 358.84 229.88 357.76 228.48 357.76C227.08 357.76 226.0 358.84 226.0 360.24C226.0 361.64 227.08 362.72 228.48 362.72ZM236.0 386.0H239.20000000000002V374.16C239.20000000000002 370.84 241.32 368.56 244.44 368.56C245.92000000000002 368.56 247.12 369.08 247.92000000000002 370.0C248.72 370.88 249.16 372.2 249.16 373.76V386.0H252.36V373.28C252.36 371.04 251.64000000000001 369.16 250.4 367.8C249.16 366.4 247.32 365.6 245.16 365.6C242.6 365.6 240.44 366.76 239.12 368.88V366.0H236.0ZM263.56 386.24C264.28000000000003 386.24 265.12 386.12 265.48 386.0V383.04C265.0 383.16 264.56 383.2 264.16 383.2C263.32 383.2 262.72 383.0 262.36 382.64C262.04 382.28 261.88 381.84 261.88 381.12V368.8H265.48V366.0H261.88V361.2H258.68V366.0H255.4V368.8H258.68V381.52C258.68 383.16 259.08 384.28 259.88 385.04C260.72 385.84 261.96000000000004 386.24 263.56 386.24ZM277.96000000000004 386.4C283.76000000000005 386.4 288.08000000000004 381.96 288.08000000000004 376.0C288.08000000000004 370.04 283.76000000000005 365.6 277.96000000000004 365.6C272.16 365.6 267.84000000000003 370.04 267.84000000000003 376.0C267.84000000000003 381.96 272.16 386.4 277.96000000000004 386.4ZM277.96000000000004 383.44C274.00000000000006 383.44 271.20000000000005 380.4 271.20000000000005 376.0C271.20000000000005 371.6 274.00000000000006 368.56 277.96000000000004 368.56C281.92 368.56 284.72 371.6 284.72 376.0C284.72 380.4 281.92 383.44 277.96000000000004 383.44ZM307.52000000000004 386.4C310.32 386.4 312.56 385.32 314.12 383.16C314.16 384.12 314.24 384.96 314.36 386.0H317.52000000000004C317.36 384.8 317.28000000000003 383.88 317.28000000000003 382.68V373.28C317.28000000000003 370.88 316.64000000000004 369.16 315.32 367.76C314.0 366.36 311.84000000000003 365.6 309.20000000000005 365.6C304.44 365.6 301.24 368.16 300.92 372.28H304.36C304.68 369.72 306.40000000000003 368.4 309.20000000000005 368.4C310.88 368.4 312.08000000000004 368.92 312.92 369.76C313.76 370.6 314.12 371.8 314.12 373.44V374.24L307.0 374.44C302.72 374.56 300.44 376.64 300.44 380.16C300.44 383.88 303.24 386.4 307.52000000000004 386.4ZM303.8 380.2C303.8 378.2 305.08000000000004 377.12 307.84000000000003 377.04L314.12 376.84V377.88C314.12 381.4 311.68 383.76 308.12 383.76C305.52000000000004 383.76 303.8 382.4 303.8 380.2ZM322.96000000000004 386.0H326.16V374.16C326.16 370.84 328.28000000000003 368.56 331.40000000000003 368.56C332.88 368.56 334.08000000000004 369.08 334.88 370.0C335.68 370.88 336.12 372.2 336.12 373.76V386.0H339.32V373.28C339.32 371.04 338.6 369.16 337.36 367.8C336.12 366.4 334.28000000000003 365.6 332.12 365.6C329.56 365.6 327.40000000000003 366.76 326.08 368.88V366.0H322.96000000000004ZM346.67999999999995 394.0H350.28L361.59999999999997 366.0H358.0L351.88 382.0L345.44 366.0H341.84L350.23999999999995 385.72ZM379.08000000000004 386.4C381.88 386.4 384.12 385.32 385.68 383.16C385.72 384.12 385.8 384.96 385.92 386.0H389.08000000000004C388.92 384.8 388.84000000000003 383.88 388.84000000000003 382.68V373.28C388.84000000000003 370.88 388.20000000000005 369.16 386.88 367.76C385.56 366.36 383.40000000000003 365.6 380.76000000000005 365.6C376.0 365.6 372.8 368.16 372.48 372.28H375.92C376.24 369.72 377.96000000000004 368.4 380.76000000000005 368.4C382.44 368.4 383.64000000000004 368.92 384.48 369.76C385.32000000000005 370.6 385.68 371.8 385.68 373.44V374.24L378.56 374.44C374.28000000000003 374.56 372.0 376.64 372.0 380.16C372.0 383.88 374.8 386.4 379.08000000000004 386.4ZM375.36 380.2C375.36 378.2 376.64000000000004 377.12 379.40000000000003 377.04L385.68 376.84V377.88C385.68 381.4 383.24 383.76 379.68 383.76C377.08000000000004 383.76 375.36 382.4 375.36 380.2ZM394.52000000000004 394.0H397.68V382.6C399.04 385.0 401.72 386.4 404.68 386.4C410.04 386.4 414.12 381.88 414.12 376.0C414.12 370.12 410.04 365.6 404.68 365.6C401.68 365.6 399.0 367.04 397.64 369.48V366.0H394.52000000000004ZM404.16 383.44C400.2 383.44 397.56 380.32 397.56 376.0C397.56 371.68 400.2 368.56 404.16 368.56C408.12 368.56 410.76 371.68 410.76 376.0C410.76 380.32 408.12 383.44 404.16 383.44ZM418.6 394.0H421.76V382.6C423.12 385.0 425.8 386.4 428.76 386.4C434.12 386.4 438.2 381.88 438.2 376.0C438.2 370.12 434.12 365.6 428.76 365.6C425.76 365.6 423.08 367.04 421.71999999999997 369.48V366.0H418.6ZM428.24 383.44C424.28 383.44 421.64 380.32 421.64 376.0C421.64 371.68 424.28 368.56 428.24 368.56C432.2 368.56 434.84 371.68 434.84 376.0C434.84 380.32 432.2 383.44 428.24 383.44Z" fill="#5E5E63"/><path d="M99.88 436.4C105.68 436.4 110.0 431.96 110.0 426.0C110.0 420.04 105.68 415.6 99.88 415.6C94.08 415.6 89.76 420.04 89.76 426.0C89.76 431.96 94.08 436.4 99.88 436.4ZM99.88 433.44C95.92 433.44 93.12 430.4 93.12 426.0C93.12 421.6 95.92 418.56 99.88 418.56C103.84 418.56 106.64 421.6 106.64 426.0C106.64 430.4 103.84 433.44 99.88 433.44ZM114.52 436.0H117.72V424.16C117.72 420.84 119.84 418.56 122.96 418.56C124.44 418.56 125.64 419.08 126.44 420.0C127.24 420.88 127.68 422.2 127.68 423.76V436.0H130.88V423.28C130.88 421.04 130.16 419.16 128.92 417.8C127.68 416.4 125.84 415.6 123.68 415.6C121.12 415.6 118.96 416.76 117.64 418.88V416.0H114.52ZM146.76000000000002 444.0H150.36L161.68 416.0H158.08L151.96 432.0L145.52 416.0H141.92000000000002L150.32000000000002 435.72ZM173.32 436.4C179.12 436.4 183.44 431.96 183.44 426.0C183.44 420.04 179.12 415.6 173.32 415.6C167.52 415.6 163.2 420.04 163.2 426.0C163.2 431.96 167.52 436.4 173.32 436.4ZM173.32 433.44C169.35999999999999 433.44 166.56 430.4 166.56 426.0C166.56 421.6 169.35999999999999 418.56 173.32 418.56C177.28 418.56 180.07999999999998 421.6 180.07999999999998 426.0C180.07999999999998 430.4 177.28 433.44 173.32 433.44ZM194.8 436.4C197.36 436.4 199.4 435.24 200.72 432.96V436.0H203.84V416.0H200.64000000000001V427.32C200.64000000000001 430.96 198.76000000000002 433.44 195.52 433.44C194.16000000000003 433.44 192.96 432.92 192.16000000000003 432.0C191.36 431.12 190.92000000000002 429.8 190.92000000000002 427.84V416.0H187.72V428.16C187.72 430.96 188.44 432.84 189.68 434.2C190.92000000000002 435.6 192.76000000000002 436.4 194.8 436.4ZM209.76000000000002 436.0H212.96000000000004V426.36C212.96000000000004 421.8 214.96000000000004 419.04 218.24 419.04C218.72000000000003 419.04 219.20000000000002 419.08 219.64000000000001 419.16V415.72C219.32000000000002 415.64 218.92000000000002 415.6 218.48000000000002 415.6C215.96000000000004 415.6 213.88000000000002 417.24 212.88000000000002 419.88V416.0H209.76000000000002ZM232.0 436.0H235.4V412.32L244.88 436.0H248.0L257.48 412.32V436.0H260.88V407.2H256.08L246.44 431.6L236.8 407.2H232.0ZM272.92 436.4C275.71999999999997 436.4 277.96 435.32 279.52 433.16C279.56 434.12 279.64 434.96 279.76 436.0H282.92C282.76 434.8 282.68 433.88 282.68 432.68V423.28C282.68 420.88 282.04 419.16 280.71999999999997 417.76C279.4 416.36 277.24 415.6 274.6 415.6C269.84 415.6 266.64 418.16 266.32 422.28H269.76C270.08 419.72 271.8 418.4 274.6 418.4C276.28 418.4 277.48 418.92 278.32 419.76C279.15999999999997 420.6 279.52 421.8 279.52 423.44V424.24L272.4 424.44C268.12 424.56 265.84 426.64 265.84 430.16C265.84 433.88 268.64 436.4 272.92 436.4ZM269.2 430.2C269.2 428.2 270.48 427.12 273.24 427.04L279.52 426.84V427.88C279.52 431.4 277.08 433.76 273.52 433.76C270.92 433.76 269.2 432.4 269.2 430.2ZM296.9200000000001 436.4C301.48 436.4 304.96000000000004 433.68 306.20000000000005 429.32L302.68000000000006 428.8C302.16 431.76 299.72 433.44 296.9200000000001 433.44C293.00000000000006 433.44 290.32000000000005 430.32 290.32000000000005 426.0C290.32000000000005 421.68 293.00000000000006 418.56 296.9200000000001 418.56C299.76000000000005 418.56 302.12000000000006 420.2 302.68000000000006 423.12L306.20000000000005 422.64C305.40000000000003 418.44 301.6 415.6 296.9200000000001 415.6C291.16 415.6 286.96000000000004 420.08 286.96000000000004 426.0C286.96000000000004 431.92 291.16 436.4 296.9200000000001 436.4ZM313.47999999999996 436.4C314.88 436.4 315.96 435.36 315.96 433.92C315.96 432.48 314.88 431.44 313.47999999999996 431.44C312.08 431.44 311.0 432.48 311.0 433.92C311.0 435.36 312.08 436.4 313.47999999999996 436.4Z" fill="#5E5E63"/><path d="M90.068 548.0H91.96V540.96H98.29599999999999V539.2H91.96V533.92H99.616V532.16H90.068ZM100.98 548.0H102.74000000000001V542.698C102.74000000000001 540.19 103.84 538.672 105.644 538.672C105.908 538.672 106.172 538.694 106.414 538.738V536.846C106.238 536.802 106.018 536.78 105.77600000000001 536.78C104.39 536.78 103.24600000000001 537.682 102.696 539.134V537.0H100.98ZM112.86 548.22C115.258 548.22 117.194 546.834 117.876 544.678L115.94 544.392C115.632 545.712 114.466 546.592 112.86 546.592C110.836 546.592 109.428 545.118 109.252 542.94H118.184V542.632C118.184 539.09 116.072 536.78 112.86 536.78C109.758 536.78 107.426 539.244 107.426 542.5C107.426 545.756 109.736 548.22 112.86 548.22ZM109.34 541.444C109.714 539.596 111.056 538.408 112.86 538.408C114.818 538.408 116.05 539.662 116.27 541.444ZM125.51 548.22C127.908 548.22 129.844 546.834 130.526 544.678L128.59 544.392C128.282 545.712 127.116 546.592 125.51 546.592C123.486 546.592 122.078 545.118 121.902 542.94H130.834V542.632C130.834 539.09 128.722 536.78 125.51 536.78C122.408 536.78 120.07600000000001 539.244 120.07600000000001 542.5C120.07600000000001 545.756 122.38600000000001 548.22 125.51 548.22ZM121.99000000000001 541.444C122.364 539.596 123.706 538.408 125.51 538.408C127.468 538.408 128.7 539.662 128.92000000000002 541.444ZM141.922 548.22C143.462 548.22 144.694 547.626 145.552 546.438C145.57399999999998 546.966 145.618 547.428 145.684 548.0H147.422C147.33399999999997 547.34 147.29 546.834 147.29 546.174V541.004C147.29 539.684 146.938 538.738 146.212 537.968C145.486 537.198 144.298 536.78 142.84599999999998 536.78C140.22799999999998 536.78 138.468 538.188 138.292 540.454H140.184C140.35999999999999 539.046 141.30599999999998 538.32 142.84599999999998 538.32C143.76999999999998 538.32 144.42999999999998 538.606 144.892 539.068C145.35399999999998 539.53 145.552 540.19 145.552 541.092V541.532L141.636 541.642C139.28199999999998 541.708 138.028 542.852 138.028 544.788C138.028 546.834 139.56799999999998 548.22 141.922 548.22ZM139.87599999999998 544.81C139.87599999999998 543.71 140.57999999999998 543.116 142.09799999999998 543.072L145.552 542.962V543.534C145.552 545.47 144.20999999999998 546.768 142.25199999999998 546.768C140.822 546.768 139.87599999999998 546.02 139.87599999999998 544.81ZM150.634 548.0H152.39399999999998V541.488C152.39399999999998 539.662 153.55999999999997 538.408 155.27599999999998 538.408C156.08999999999997 538.408 156.75 538.694 157.19 539.2C157.63 539.684 157.87199999999999 540.41 157.87199999999999 541.268V548.0H159.63199999999998V541.004C159.63199999999998 539.772 159.236 538.738 158.55399999999997 537.99C157.87199999999999 537.22 156.85999999999999 536.78 155.672 536.78C154.26399999999998 536.78 153.076 537.418 152.35 538.584V537.0H150.634ZM167.354 548.22C169.00400000000002 548.22 170.478 547.428 171.226 546.086V548.0H172.942V532.16H171.204V538.87C170.45600000000002 537.55 168.982 536.78 167.354 536.78C164.406 536.78 162.162 539.266 162.162 542.5C162.162 545.734 164.406 548.22 167.354 548.22ZM167.64000000000001 546.592C165.46200000000002 546.592 164.01000000000002 544.876 164.01000000000002 542.5C164.01000000000002 540.124 165.46200000000002 538.408 167.64000000000001 538.408C169.818 538.408 171.27 540.124 171.27 542.5C171.27 544.876 169.818 546.592 167.64000000000001 546.592ZM186.406 548.22C189.596 548.22 191.972 545.778 191.972 542.5C191.972 539.222 189.596 536.78 186.406 536.78C183.216 536.78 180.84 539.222 180.84 542.5C180.84 545.778 183.216 548.22 186.406 548.22ZM186.406 546.592C184.228 546.592 182.68800000000002 544.92 182.68800000000002 542.5C182.68800000000002 540.08 184.228 538.408 186.406 538.408C188.584 538.408 190.12400000000002 540.08 190.12400000000002 542.5C190.12400000000002 544.92 188.584 546.592 186.406 546.592ZM194.678 552.4H196.416V546.13C197.164 547.45 198.638 548.22 200.266 548.22C203.214 548.22 205.458 545.734 205.458 542.5C205.458 539.266 203.214 536.78 200.266 536.78C198.61599999999999 536.78 197.142 537.572 196.394 538.914V537.0H194.678ZM199.98 546.592C197.802 546.592 196.35 544.876 196.35 542.5C196.35 540.124 197.802 538.408 199.98 538.408C202.158 538.408 203.60999999999999 540.124 203.60999999999999 542.5C203.60999999999999 544.876 202.158 546.592 199.98 546.592ZM212.80599999999998 548.22C215.204 548.22 217.14 546.834 217.822 544.678L215.886 544.392C215.578 545.712 214.412 546.592 212.80599999999998 546.592C210.78199999999998 546.592 209.374 545.118 209.198 542.94H218.13V542.632C218.13 539.09 216.018 536.78 212.80599999999998 536.78C209.704 536.78 207.37199999999999 539.244 207.37199999999999 542.5C207.37199999999999 545.756 209.682 548.22 212.80599999999998 548.22ZM209.286 541.444C209.66 539.596 211.002 538.408 212.80599999999998 538.408C214.764 538.408 215.99599999999998 539.662 216.216 541.444ZM220.792 548.0H222.552V541.488C222.552 539.662 223.718 538.408 225.434 538.408C226.248 538.408 226.90800000000002 538.694 227.348 539.2C227.788 539.684 228.03 540.41 228.03 541.268V548.0H229.79V541.004C229.79 539.772 229.394 538.738 228.712 537.99C228.03 537.22 227.018 536.78 225.83 536.78C224.422 536.78 223.234 537.418 222.508 538.584V537.0H220.792ZM241.78 548.22C244.2 548.22 245.916 546.79 245.916 544.7C245.916 543.05 244.882 542.17 242.44 541.686L241.208 541.444C240.042 541.224 239.514 540.762 239.514 539.97C239.514 538.98 240.35 538.32 241.692 538.32C242.99 538.32 243.87 539.024 243.958 540.102H245.784C245.65200000000002 538.1 244.002 536.78 241.692 536.78C239.382 536.78 237.71 538.188 237.71 540.102C237.71 541.73 238.766 542.698 240.966 543.138L242.154 543.38C243.584 543.666 244.112 544.062 244.112 544.942C244.112 545.976 243.188 546.68 241.78 546.68C240.284 546.68 239.36 545.932 239.25 544.722H237.40200000000002C237.534 546.768 239.36 548.22 241.78 548.22ZM253.48399999999998 548.22C256.674 548.22 259.05 545.778 259.05 542.5C259.05 539.222 256.674 536.78 253.48399999999998 536.78C250.29399999999998 536.78 247.91799999999998 539.222 247.91799999999998 542.5C247.91799999999998 545.778 250.29399999999998 548.22 253.48399999999998 548.22ZM253.48399999999998 546.592C251.30599999999998 546.592 249.766 544.92 249.766 542.5C249.766 540.08 251.30599999999998 538.408 253.48399999999998 538.408C255.66199999999998 538.408 257.202 540.08 257.202 542.5C257.202 544.92 255.66199999999998 546.592 253.48399999999998 546.592ZM265.51800000000003 548.22C266.92600000000004 548.22 268.048 547.582 268.774 546.328V548.0H270.49V537.0H268.73V543.226C268.73 545.228 267.696 546.592 265.91400000000004 546.592C265.16600000000005 546.592 264.50600000000003 546.306 264.06600000000003 545.8C263.62600000000003 545.316 263.384 544.59 263.384 543.512V537.0H261.624V543.688C261.624 545.228 262.02000000000004 546.262 262.70200000000006 547.01C263.384 547.78 264.396 548.22 265.51800000000003 548.22ZM273.96599999999995 548.0H275.72599999999994V542.698C275.72599999999994 540.19 276.82599999999996 538.672 278.62999999999994 538.672C278.89399999999995 538.672 279.15799999999996 538.694 279.4 538.738V536.846C279.22399999999993 536.802 279.00399999999996 536.78 278.76199999999994 536.78C277.376 536.78 276.23199999999997 537.682 275.68199999999996 539.134V537.0H273.96599999999995ZM285.89 548.22C288.39799999999997 548.22 290.31199999999995 546.724 290.99399999999997 544.326L289.05799999999994 544.04C288.77199999999993 545.668 287.42999999999995 546.592 285.89 546.592C283.734 546.592 282.25999999999993 544.876 282.25999999999993 542.5C282.25999999999993 540.124 283.734 538.408 285.89 538.408C287.45199999999994 538.408 288.74999999999994 539.31 289.05799999999994 540.916L290.99399999999997 540.652C290.554 538.342 288.46399999999994 536.78 285.89 536.78C282.722 536.78 280.412 539.244 280.412 542.5C280.412 545.756 282.722 548.22 285.89 548.22ZM298.21 548.22C300.608 548.22 302.544 546.834 303.226 544.678L301.28999999999996 544.392C300.98199999999997 545.712 299.816 546.592 298.21 546.592C296.186 546.592 294.778 545.118 294.602 542.94H303.534V542.632C303.534 539.09 301.42199999999997 536.78 298.21 536.78C295.108 536.78 292.776 539.244 292.776 542.5C292.776 545.756 295.086 548.22 298.21 548.22ZM294.69 541.444C295.06399999999996 539.596 296.406 538.408 298.21 538.408C300.168 538.408 301.4 539.662 301.62 541.444ZM318.252 543.864C319.022 543.864 319.616 543.292 319.616 542.5C319.616 541.708 319.022 541.136 318.252 541.136C317.48199999999997 541.136 316.888 541.708 316.888 542.5C316.888 543.292 317.48199999999997 543.864 318.252 543.864ZM333.784 548.0H335.544V541.466C335.544 539.574 336.556 538.408 338.206 538.408C338.976 538.408 339.57 538.672 339.966 539.156C340.36199999999997 539.618 340.56 540.322 340.56 541.202V548.0H342.32V541.466C342.32 539.574 343.332 538.408 344.98199999999997 538.408C345.752 538.408 346.346 538.672 346.742 539.156C347.138 539.618 347.336 540.322 347.336 541.202V548.0H349.096V540.938C349.096 539.662 348.722 538.584 348.084 537.88C347.44599999999997 537.176 346.544 536.78 345.444 536.78C343.948 536.78 342.738 537.506 341.924 538.87C341.37399999999997 537.55 340.252 536.78 338.69 536.78C337.348 536.78 336.226 537.374 335.5 538.584V537.0H333.784ZM355.674 548.22C357.214 548.22 358.446 547.626 359.304 546.438C359.326 546.966 359.37 547.428 359.436 548.0H361.174C361.086 547.34 361.042 546.834 361.042 546.174V541.004C361.042 539.684 360.69 538.738 359.964 537.968C359.238 537.198 358.05 536.78 356.598 536.78C353.98 536.78 352.21999999999997 538.188 352.044 540.454H353.936C354.112 539.046 355.058 538.32 356.598 538.32C357.522 538.32 358.182 538.606 358.644 539.068C359.106 539.53 359.304 540.19 359.304 541.092V541.532L355.388 541.642C353.034 541.708 351.78 542.852 351.78 544.788C351.78 546.834 353.32 548.22 355.674 548.22ZM353.628 544.81C353.628 543.71 354.332 543.116 355.85 543.072L359.304 542.962V543.534C359.304 545.47 357.962 546.768 356.004 546.768C354.574 546.768 353.628 546.02 353.628 544.81ZM369.094 548.22C371.602 548.22 373.51599999999996 546.724 374.198 544.326L372.26199999999994 544.04C371.97599999999994 545.668 370.63399999999996 546.592 369.094 546.592C366.938 546.592 365.46399999999994 544.876 365.46399999999994 542.5C365.46399999999994 540.124 366.938 538.408 369.094 538.408C370.65599999999995 538.408 371.95399999999995 539.31 372.26199999999994 540.916L374.198 540.652C373.758 538.342 371.66799999999995 536.78 369.094 536.78C365.926 536.78 363.616 539.244 363.616 542.5C363.616 545.756 365.926 548.22 369.094 548.22ZM384.142 548.22C388.762 548.22 392.172 544.656 392.172 540.08C392.172 535.504 388.762 531.94 384.142 531.94C379.522 531.94 376.112 535.504 376.112 540.08C376.112 544.656 379.522 548.22 384.142 548.22ZM384.142 546.504C380.666 546.504 378.048 543.732 378.048 540.08C378.048 536.428 380.666 533.656 384.142 533.656C387.618 533.656 390.236 536.428 390.236 540.08C390.236 543.732 387.618 546.504 384.142 546.504ZM400.048 548.22C403.238 548.22 405.504 546.24 405.504 543.446C405.504 541.268 404.008 539.816 401.082 539.2L399.52 538.87C397.43 538.43 396.594 537.726 396.594 536.296C396.594 534.712 397.87 533.634 399.84999999999997 533.634C401.808 533.634 403.15 534.712 403.304 536.406H405.284C405.174 533.81 402.88599999999997 531.94 399.84999999999997 531.94C396.858 531.94 394.658 533.854 394.658 536.362C394.658 538.672 396.066 540.014 398.83799999999997 540.63L400.444 540.982C402.776 541.488 403.568 542.192 403.568 543.622C403.568 545.382 402.182 546.526 400.048 546.526C397.82599999999996 546.526 396.37399999999997 545.316 396.21999999999997 543.38H394.218C394.34999999999997 546.196 396.81399999999996 548.22 400.048 548.22ZM413.88599999999997 548.0H424.15999999999997V546.35H419.936V532.16H418.462C417.318 533.26 415.734 534.052 413.952 534.36V536.296C415.602 536.054 417.07599999999996 535.394 418.132 534.448V546.35H413.88599999999997ZM432.01399999999995 548.22C434.852 548.22 437.05199999999996 546.108 437.05199999999996 543.358C437.05199999999996 540.674 434.962 538.65 432.234 538.65L436.80999999999995 533.766V532.16H427.328V533.81H434.49999999999994L429.748 538.87V540.432C429.748 540.432 430.628 540.256 431.68399999999997 540.256C433.818 540.256 435.15999999999997 541.488 435.15999999999997 543.38C435.15999999999997 545.25 433.84 546.548 432.01399999999995 546.548C430.23199999999997 546.548 429.022 545.426 428.82399999999996 543.556L426.82199999999995 543.842C427.19599999999997 546.46 429.33 548.22 432.01399999999995 548.22ZM445.08199999999994 545.888H446.75399999999996V541.202H451.10999999999996V539.552H446.75399999999996V534.888H445.08199999999994V539.552H440.72599999999994V541.202H445.08199999999994Z" fill="#75757A"/><rect x="700" y="196" width="492" height="117.0" rx="14" fill="#FFFFFF" stroke="rgba(0,0,0,0.10)"/><rect x="718.0" y="212.2" width="307.9" height="39.6" rx="4" fill="rgba(28,28,30,0.08)"/><path d="M723.82 241.6H726.37V223.84L733.48 241.6H735.82L742.93 223.84V241.6H745.48V220.0H741.88L734.65 238.29999999999998L727.42 220.0H723.82ZM754.81 241.9C756.91 241.9 758.5899999999999 241.09 759.76 239.47C759.79 240.19 759.85 240.82 759.9399999999999 241.6H762.31C762.1899999999999 240.7 762.13 240.01 762.13 239.10999999999999V232.06C762.13 230.26 761.65 228.97 760.66 227.92C759.67 226.87 758.05 226.29999999999998 756.0699999999999 226.29999999999998C752.5 226.29999999999998 750.1 228.22 749.86 231.31H752.4399999999999C752.68 229.39 753.97 228.4 756.0699999999999 228.4C757.3299999999999 228.4 758.23 228.79 758.86 229.42C759.49 230.04999999999998 759.76 230.95 759.76 232.18V232.78L754.42 232.93C751.2099999999999 233.01999999999998 749.5 234.57999999999998 749.5 237.22C749.5 240.01 751.6 241.9 754.81 241.9ZM752.02 237.25C752.02 235.75 752.98 234.94 755.05 234.88L759.76 234.73V235.51C759.76 238.15 757.93 239.92 755.26 239.92C753.31 239.92 752.02 238.9 752.02 237.25ZM766.69 241.6H769.0600000000001V234.37L776.23 241.6H779.6800000000001L771.5500000000001 233.59L779.1700000000001 226.6H775.75L769.0600000000001 232.95999999999998V220.0H766.69ZM787.39 241.9C790.66 241.9 793.3 240.01 794.23 237.07L791.5899999999999 236.68C791.17 238.48 789.5799999999999 239.68 787.39 239.68C784.63 239.68 782.7099999999999 237.67 782.4699999999999 234.7H794.65V234.28C794.65 229.45 791.77 226.29999999999998 787.39 226.29999999999998C783.16 226.29999999999998 779.98 229.66 779.98 234.1C779.98 238.54 783.13 241.9 787.39 241.9ZM782.5899999999999 232.66C783.1 230.14 784.93 228.51999999999998 787.39 228.51999999999998C790.06 228.51999999999998 791.74 230.23 792.04 232.66ZM809.77 241.78C810.3100000000001 241.78 810.94 241.69 811.21 241.6V239.38C810.85 239.47 810.52 239.5 810.22 239.5C809.59 239.5 809.14 239.35 808.87 239.07999999999998C808.63 238.81 808.51 238.48 808.51 237.94V228.7H811.21V226.6H808.51V223.0H806.11V226.6H803.65V228.7H806.11V238.23999999999998C806.11 239.47 806.41 240.31 807.01 240.88C807.64 241.48 808.57 241.78 809.77 241.78ZM814.63 241.6H817.03V232.72C817.03 230.23 818.62 228.51999999999998 820.96 228.51999999999998C822.0699999999999 228.51999999999998 822.97 228.91 823.5699999999999 229.6C824.17 230.26 824.5 231.25 824.5 232.42V241.6H826.9V232.06C826.9 230.38 826.36 228.97 825.43 227.95C824.5 226.9 823.12 226.29999999999998 821.5 226.29999999999998C819.58 226.29999999999998 817.99 227.14 817.0 228.7V220.0H814.63ZM837.82 241.9C841.09 241.9 843.73 240.01 844.6600000000001 237.07L842.02 236.68C841.6 238.48 840.01 239.68 837.82 239.68C835.0600000000001 239.68 833.14 237.67 832.9 234.7H845.08V234.28C845.08 229.45 842.2 226.29999999999998 837.82 226.29999999999998C833.59 226.29999999999998 830.4100000000001 229.66 830.4100000000001 234.1C830.4100000000001 238.54 833.5600000000001 241.9 837.82 241.9ZM833.02 232.66C833.5300000000001 230.14 835.36 228.51999999999998 837.82 228.51999999999998C840.49 228.51999999999998 842.1700000000001 230.23 842.47 232.66ZM855.79 241.6H858.1899999999999V234.37C858.1899999999999 230.95 859.6899999999999 228.88 862.15 228.88C862.51 228.88 862.87 228.91 863.1999999999999 228.97V226.39C862.9599999999999 226.32999999999998 862.66 226.29999999999998 862.3299999999999 226.29999999999998C860.4399999999999 226.29999999999998 858.88 227.53 858.13 229.51V226.6H855.79ZM871.99 241.9C875.26 241.9 877.9 240.01 878.83 237.07L876.1899999999999 236.68C875.77 238.48 874.18 239.68 871.99 239.68C869.23 239.68 867.31 237.67 867.0699999999999 234.7H879.25V234.28C879.25 229.45 876.37 226.29999999999998 871.99 226.29999999999998C867.76 226.29999999999998 864.58 229.66 864.58 234.1C864.58 238.54 867.73 241.9 871.99 241.9ZM867.1899999999999 232.66C867.7 230.14 869.53 228.51999999999998 871.99 228.51999999999998C874.66 228.51999999999998 876.34 230.23 876.64 232.66ZM887.02 241.78C887.5600000000001 241.78 888.19 241.69 888.46 241.6V239.38C888.1 239.47 887.77 239.5 887.47 239.5C886.84 239.5 886.39 239.35 886.12 239.07999999999998C885.88 238.81 885.76 238.48 885.76 237.94V228.7H888.46V226.6H885.76V223.0H883.36V226.6H880.9V228.7H883.36V238.23999999999998C883.36 239.47 883.66 240.31 884.26 240.88C884.89 241.48 885.82 241.78 887.02 241.78ZM891.88 241.6H894.28V234.37C894.28 230.95 895.78 228.88 898.24 228.88C898.6 228.88 898.96 228.91 899.29 228.97V226.39C899.05 226.32999999999998 898.75 226.29999999999998 898.42 226.29999999999998C896.53 226.29999999999998 894.97 227.53 894.22 229.51V226.6H891.88ZM903.94 247.6H906.64L915.13 226.6H912.4300000000001L907.84 238.6L903.01 226.6H900.3100000000001L906.61 241.39ZM932.05 241.9C936.0699999999999 241.9 939.13 238.51 939.13 234.1C939.13 229.69 936.0699999999999 226.29999999999998 932.05 226.29999999999998C929.8299999999999 226.29999999999998 927.8199999999999 227.35 926.8 229.15V220.0H924.43V241.6H926.77V238.98999999999998C927.79 240.82 929.8 241.9 932.05 241.9ZM931.66 239.68C928.6899999999999 239.68 926.7099999999999 237.34 926.7099999999999 234.1C926.7099999999999 230.85999999999999 928.6899999999999 228.51999999999998 931.66 228.51999999999998C934.63 228.51999999999998 936.6099999999999 230.85999999999999 936.6099999999999 234.1C936.6099999999999 237.34 934.63 239.68 931.66 239.68ZM947.1999999999999 241.9C949.3 241.9 950.9799999999999 241.09 952.15 239.47C952.18 240.19 952.24 240.82 952.3299999999999 241.6H954.6999999999999C954.5799999999999 240.7 954.52 240.01 954.52 239.10999999999999V232.06C954.52 230.26 954.04 228.97 953.05 227.92C952.06 226.87 950.4399999999999 226.29999999999998 948.4599999999999 226.29999999999998C944.89 226.29999999999998 942.49 228.22 942.25 231.31H944.8299999999999C945.0699999999999 229.39 946.36 228.4 948.4599999999999 228.4C949.7199999999999 228.4 950.62 228.79 951.25 229.42C951.88 230.04999999999998 952.15 230.95 952.15 232.18V232.78L946.81 232.93C943.5999999999999 233.01999999999998 941.89 234.57999999999998 941.89 237.22C941.89 240.01 943.99 241.9 947.1999999999999 241.9ZM944.41 237.25C944.41 235.75 945.37 234.94 947.4399999999999 234.88L952.15 234.73V235.51C952.15 238.15 950.3199999999999 239.92 947.65 239.92C945.6999999999999 239.92 944.41 238.9 944.41 237.25ZM965.5 241.9C968.9200000000001 241.9 971.5300000000001 239.85999999999999 972.46 236.59L969.82 236.2C969.4300000000001 238.42 967.6 239.68 965.5 239.68C962.5600000000001 239.68 960.5500000000001 237.34 960.5500000000001 234.1C960.5500000000001 230.85999999999999 962.5600000000001 228.51999999999998 965.5 228.51999999999998C967.63 228.51999999999998 969.4000000000001 229.75 969.82 231.94L972.46 231.57999999999998C971.86 228.43 969.01 226.29999999999998 965.5 226.29999999999998C961.1800000000001 226.29999999999998 958.0300000000001 229.66 958.0300000000001 234.1C958.0300000000001 238.54 961.1800000000001 241.9 965.5 241.9ZM975.9399999999999 241.6H978.31V234.37L985.4799999999999 241.6H988.93L980.8 233.59L988.42 226.6H984.9999999999999L978.31 232.95999999999998V220.0H975.9399999999999ZM996.8199999999999 241.9C1001.17 241.9 1004.41 238.57 1004.41 234.1C1004.41 229.63 1001.17 226.29999999999998 996.8199999999999 226.29999999999998C992.4699999999999 226.29999999999998 989.23 229.63 989.23 234.1C989.23 238.57 992.4699999999999 241.9 996.8199999999999 241.9ZM996.8199999999999 239.68C993.85 239.68 991.75 237.4 991.75 234.1C991.75 230.79999999999998 993.85 228.51999999999998 996.8199999999999 228.51999999999998C999.79 228.51999999999998 1001.89 230.79999999999998 1001.89 234.1C1001.89 237.4 999.79 239.68 996.8199999999999 239.68ZM1011.07 228.7H1017.13V241.6H1019.53V228.7H1022.23V226.6H1019.53V223.39C1019.53 222.37 1020.01 221.98 1021.15 221.98C1021.45 221.98 1021.87 222.01 1022.23 222.07V219.85C1021.84 219.76 1021.33 219.7 1020.79 219.7C1018.36 219.7 1017.13 220.95999999999998 1017.13 223.39V226.6H1011.07V223.39C1011.07 222.37 1011.55 221.98 1012.69 221.98C1012.99 221.98 1013.41 222.01 1013.77 222.07V219.85C1013.38 219.76 1012.87 219.7 1012.33 219.7C1009.9 219.7 1008.67 220.95999999999998 1008.67 223.39V226.6H1006.21V228.7H1008.67V241.6H1011.07Z" fill="#1C1C1E"/><rect x="718.0" y="255.7" width="314.5" height="39.6" rx="4" fill="rgba(28,28,30,0.08)"/><path d="M729.73 285.40000000000003C733.0 285.40000000000003 735.64 283.51000000000005 736.57 280.57000000000005L733.93 280.18C733.51 281.98 731.92 283.18 729.73 283.18C726.97 283.18 725.05 281.17 724.81 278.20000000000005H736.99V277.78000000000003C736.99 272.95000000000005 734.11 269.8 729.73 269.8C725.5 269.8 722.32 273.16 722.32 277.6C722.32 282.04 725.47 285.40000000000003 729.73 285.40000000000003ZM724.93 276.16C725.44 273.64000000000004 727.27 272.02000000000004 729.73 272.02000000000004C732.4 272.02000000000004 734.08 273.73 734.38 276.16ZM738.01 285.1H741.01L744.85 279.31L748.7800000000001 285.1H751.7800000000001L746.32 277.54L751.6 270.1H748.6L744.94 275.89000000000004L741.19 270.1H738.19L743.47 277.66ZM754.57 291.1H756.94V282.55C757.96 284.35 759.97 285.40000000000003 762.19 285.40000000000003C766.21 285.40000000000003 769.2700000000001 282.01000000000005 769.2700000000001 277.6C769.2700000000001 273.19 766.21 269.8 762.19 269.8C759.94 269.8 757.9300000000001 270.88 756.9100000000001 272.71000000000004V270.1H754.57ZM761.8000000000001 283.18C758.83 283.18 756.85 280.84000000000003 756.85 277.6C756.85 274.36 758.83 272.02000000000004 761.8000000000001 272.02000000000004C764.7700000000001 272.02000000000004 766.75 274.36 766.75 277.6C766.75 280.84000000000003 764.7700000000001 283.18 761.8000000000001 283.18ZM779.4699999999999 285.40000000000003C783.8199999999999 285.40000000000003 787.06 282.07000000000005 787.06 277.6C787.06 273.13 783.8199999999999 269.8 779.4699999999999 269.8C775.1199999999999 269.8 771.88 273.13 771.88 277.6C771.88 282.07000000000005 775.1199999999999 285.40000000000003 779.4699999999999 285.40000000000003ZM779.4699999999999 283.18C776.5 283.18 774.4 280.90000000000003 774.4 277.6C774.4 274.3 776.5 272.02000000000004 779.4699999999999 272.02000000000004C782.4399999999999 272.02000000000004 784.54 274.3 784.54 277.6C784.54 280.90000000000003 782.4399999999999 283.18 779.4699999999999 283.18ZM790.75 285.1H793.15V276.22C793.15 273.73 794.74 272.02000000000004 797.08 272.02000000000004C798.1899999999999 272.02000000000004 799.09 272.41 799.6899999999999 273.1C800.29 273.76000000000005 800.62 274.75 800.62 275.92V285.1H803.02V275.56C803.02 273.88 802.48 272.47 801.55 271.45000000000005C800.62 270.40000000000003 799.24 269.8 797.62 269.8C795.7 269.8 794.08 270.67 793.09 272.26000000000005V270.1H790.75ZM813.91 285.40000000000003C817.18 285.40000000000003 819.8199999999999 283.51000000000005 820.75 280.57000000000005L818.1099999999999 280.18C817.6899999999999 281.98 816.0999999999999 283.18 813.91 283.18C811.15 283.18 809.2299999999999 281.17 808.9899999999999 278.20000000000005H821.17V277.78000000000003C821.17 272.95000000000005 818.29 269.8 813.91 269.8C809.68 269.8 806.5 273.16 806.5 277.6C806.5 282.04 809.65 285.40000000000003 813.91 285.40000000000003ZM809.1099999999999 276.16C809.62 273.64000000000004 811.4499999999999 272.02000000000004 813.91 272.02000000000004C816.5799999999999 272.02000000000004 818.26 273.73 818.56 276.16ZM824.8 285.1H827.1999999999999V276.22C827.1999999999999 273.73 828.79 272.02000000000004 831.13 272.02000000000004C832.2399999999999 272.02000000000004 833.14 272.41 833.7399999999999 273.1C834.3399999999999 273.76000000000005 834.67 274.75 834.67 275.92V285.1H837.0699999999999V275.56C837.0699999999999 273.88 836.53 272.47 835.5999999999999 271.45000000000005C834.67 270.40000000000003 833.29 269.8 831.67 269.8C829.75 269.8 828.13 270.67 827.14 272.26000000000005V270.1H824.8ZM845.77 285.28000000000003C846.3100000000001 285.28000000000003 846.94 285.19 847.21 285.1V282.88C846.85 282.97 846.52 283.0 846.22 283.0C845.59 283.0 845.14 282.85 844.87 282.58000000000004C844.63 282.31 844.51 281.98 844.51 281.44V272.20000000000005H847.21V270.1H844.51V266.5H842.11V270.1H839.65V272.20000000000005H842.11V281.74C842.11 282.97 842.41 283.81 843.01 284.38C843.64 284.98 844.57 285.28000000000003 845.77 285.28000000000003ZM850.63 285.1H853.03V270.1H850.63ZM851.83 267.64000000000004C852.88 267.64000000000004 853.6899999999999 266.83000000000004 853.6899999999999 265.78000000000003C853.6899999999999 264.73 852.88 263.92 851.83 263.92C850.78 263.92 849.97 264.73 849.97 265.78000000000003C849.97 266.83000000000004 850.78 267.64000000000004 851.83 267.64000000000004ZM862.18 285.40000000000003C864.28 285.40000000000003 865.9599999999999 284.59000000000003 867.13 282.97C867.16 283.69 867.22 284.32000000000005 867.31 285.1H869.68C869.56 284.20000000000005 869.5 283.51000000000005 869.5 282.61V275.56C869.5 273.76000000000005 869.02 272.47 868.03 271.42C867.04 270.37 865.42 269.8 863.4399999999999 269.8C859.87 269.8 857.47 271.72 857.23 274.81H859.81C860.05 272.89000000000004 861.34 271.90000000000003 863.4399999999999 271.90000000000003C864.6999999999999 271.90000000000003 865.6 272.29 866.23 272.92C866.86 273.55 867.13 274.45000000000005 867.13 275.68V276.28000000000003L861.79 276.43C858.5799999999999 276.52000000000004 856.87 278.08000000000004 856.87 280.72C856.87 283.51000000000005 858.97 285.40000000000003 862.18 285.40000000000003ZM859.39 280.75C859.39 279.25 860.35 278.44 862.42 278.38L867.13 278.23V279.01000000000005C867.13 281.65000000000003 865.3 283.42 862.63 283.42C860.68 283.42 859.39 282.40000000000003 859.39 280.75ZM874.0600000000001 285.1H876.46V263.5H874.0600000000001ZM881.29 288.70000000000005H883.3899999999999L885.0699999999999 281.98H882.3699999999999ZM900.37 285.1H903.3100000000001L907.1800000000001 272.86L911.0500000000001 285.1H913.99L919.09 270.1H916.3900000000001L912.5200000000001 282.76000000000005L908.5300000000001 270.1H905.83L901.84 282.76000000000005L897.97 270.1H895.2700000000001ZM922.03 285.1H924.43V270.1H922.03ZM923.23 267.64000000000004C924.28 267.64000000000004 925.0899999999999 266.83000000000004 925.0899999999999 265.78000000000003C925.0899999999999 264.73 924.28 263.92 923.23 263.92C922.18 263.92 921.37 264.73 921.37 265.78000000000003C921.37 266.83000000000004 922.18 267.64000000000004 923.23 267.64000000000004ZM933.5799999999999 285.28000000000003C934.12 285.28000000000003 934.75 285.19 935.02 285.1V282.88C934.66 282.97 934.3299999999999 283.0 934.03 283.0C933.4 283.0 932.9499999999999 282.85 932.68 282.58000000000004C932.4399999999999 282.31 932.3199999999999 281.98 932.3199999999999 281.44V272.20000000000005H935.02V270.1H932.3199999999999V266.5H929.92V270.1H927.4599999999999V272.20000000000005H929.92V281.74C929.92 282.97 930.2199999999999 283.81 930.8199999999999 284.38C931.4499999999999 284.98 932.38 285.28000000000003 933.5799999999999 285.28000000000003ZM938.4399999999999 285.1H940.8399999999999V276.22C940.8399999999999 273.73 942.43 272.02000000000004 944.77 272.02000000000004C945.8799999999999 272.02000000000004 946.78 272.41 947.3799999999999 273.1C947.9799999999999 273.76000000000005 948.31 274.75 948.31 275.92V285.1H950.7099999999999V275.56C950.7099999999999 273.88 950.17 272.47 949.2399999999999 271.45000000000005C948.31 270.40000000000003 946.93 269.8 945.31 269.8C943.39 269.8 941.8 270.64000000000004 940.81 272.20000000000005V263.5H938.4399999999999ZM960.49 291.40000000000003C963.22 291.40000000000003 964.75 289.87 964.75 287.02000000000004V270.1H962.35V286.87C962.35 288.49 961.78 289.12 960.22 289.12C959.6800000000001 289.12 959.08 289.06 958.6 288.97V291.19C959.23 291.34000000000003 959.86 291.40000000000003 960.49 291.40000000000003ZM963.5500000000001 267.64000000000004C964.6 267.64000000000004 965.41 266.83000000000004 965.41 265.78000000000003C965.41 264.73 964.6 263.92 963.5500000000001 263.92C962.5 263.92 961.69 264.73 961.69 265.78000000000003C961.69 266.83000000000004 962.5 267.64000000000004 963.5500000000001 267.64000000000004ZM969.49 285.1H971.89V270.1H969.49ZM970.69 267.64000000000004C971.74 267.64000000000004 972.55 266.83000000000004 972.55 265.78000000000003C972.55 264.73 971.74 263.92 970.69 263.92C969.64 263.92 968.83 264.73 968.83 265.78000000000003C968.83 266.83000000000004 969.64 267.64000000000004 970.69 267.64000000000004ZM981.04 285.28000000000003C981.58 285.28000000000003 982.21 285.19 982.48 285.1V282.88C982.12 282.97 981.79 283.0 981.49 283.0C980.86 283.0 980.41 282.85 980.14 282.58000000000004C979.9 282.31 979.78 281.98 979.78 281.44V272.20000000000005H982.48V270.1H979.78V266.5H977.38V270.1H974.92V272.20000000000005H977.38V281.74C977.38 282.97 977.68 283.81 978.28 284.38C978.91 284.98 979.84 285.28000000000003 981.04 285.28000000000003ZM990.31 285.28000000000003C990.85 285.28000000000003 991.48 285.19 991.75 285.1V282.88C991.39 282.97 991.06 283.0 990.76 283.0C990.13 283.0 989.68 282.85 989.41 282.58000000000004C989.17 282.31 989.05 281.98 989.05 281.44V272.20000000000005H991.75V270.1H989.05V266.5H986.65V270.1H984.1899999999999V272.20000000000005H986.65V281.74C986.65 282.97 986.9499999999999 283.81 987.55 284.38C988.18 284.98 989.11 285.28000000000003 990.31 285.28000000000003ZM1001.23 285.40000000000003C1004.5 285.40000000000003 1007.14 283.51000000000005 1008.07 280.57000000000005L1005.43 280.18C1005.01 281.98 1003.42 283.18 1001.23 283.18C998.47 283.18 996.55 281.17 996.31 278.20000000000005H1008.49V277.78000000000003C1008.49 272.95000000000005 1005.61 269.8 1001.23 269.8C997.0 269.8 993.82 273.16 993.82 277.6C993.82 282.04 996.97 285.40000000000003 1001.23 285.40000000000003ZM996.43 276.16C996.94 273.64000000000004 998.77 272.02000000000004 1001.23 272.02000000000004C1003.9 272.02000000000004 1005.58 273.73 1005.88 276.16ZM1012.12 285.1H1014.52V277.87C1014.52 274.45000000000005 1016.02 272.38 1018.48 272.38C1018.84 272.38 1019.2 272.41 1019.53 272.47V269.89000000000004C1019.29 269.83000000000004 1018.99 269.8 1018.66 269.8C1016.77 269.8 1015.21 271.03000000000003 1014.46 273.01000000000005V270.1H1012.12ZM1024.8700000000001 285.40000000000003C1025.92 285.40000000000003 1026.73 284.62 1026.73 283.54C1026.73 282.46000000000004 1025.92 281.68 1024.8700000000001 281.68C1023.82 281.68 1023.01 282.46000000000004 1023.01 283.54C1023.01 284.62 1023.82 285.40000000000003 1024.8700000000001 285.40000000000003Z" fill="#1C1C1E"/><rect x="1032.5" y="257.5" width="2" height="35.4" rx="1" fill="#1C1C1E"/><rect x="787.9" y="365.2" width="316.2" height="68.0" rx="34.0" fill="#000" opacity="0.1" filter="url(#blur)"/><rect x="791.3" y="355.0" width="309.4" height="68.0" rx="34.0" fill="#FFFFFF" stroke="rgba(28,28,30,0.12)" stroke-width="1.70"/><circle cx="821.0" cy="389.0" r="6.0" fill="#D5432B"/><rect x="844.0" y="383.5" width="5.1" height="11.0" rx="2.5" fill="#1C1C1E"/><rect x="854.2" y="377.9" width="5.1" height="22.2" rx="2.5" fill="#1C1C1E"/><rect x="864.4" y="373.7" width="5.1" height="30.6" rx="2.5" fill="#1C1C1E"/><rect x="874.6" y="380.0" width="5.1" height="18.0" rx="2.5" fill="#1C1C1E"/><rect x="884.8" y="384.6" width="5.1" height="8.9" rx="2.5" fill="#1C1C1E"/><path d="M918.851 397.041C922.3207 397.041 924.6191 393.7923 924.6191 388.864C924.6191 383.9357 922.3207 380.687 918.851 380.687C915.3813 380.687 913.0829 383.9357 913.0829 388.864C913.0829 393.7923 915.3813 397.041 918.851 397.041ZM918.851 395.3614C916.4863 395.3614 914.9835 392.8199 914.9835 388.864C914.9835 384.9081 916.4863 382.3666 918.851 382.3666C921.2157 382.3666 922.7185 384.9081 922.7185 388.864C922.7185 392.8199 921.2157 395.3614 918.851 395.3614ZM929.1275 389.7038C929.901 389.7038 930.4977 389.12919999999997 930.4977 388.3336C930.4977 387.538 929.901 386.9634 929.1275 386.9634C928.354 386.9634 927.7573 387.538 927.7573 388.3336C927.7573 389.12919999999997 928.354 389.7038 929.1275 389.7038ZM929.1275 397.041C929.901 397.041 930.4977 396.4664 930.4977 395.6708C930.4977 394.8752 929.901 394.3006 929.1275 394.3006C928.354 394.3006 927.7573 394.8752 927.7573 395.6708C927.7573 396.4664 928.354 397.041 929.1275 397.041ZM939.404 397.041C942.8737 397.041 945.1721 393.7923 945.1721 388.864C945.1721 383.9357 942.8737 380.687 939.404 380.687C935.9343 380.687 933.6359 383.9357 933.6359 388.864C933.6359 393.7923 935.9343 397.041 939.404 397.041ZM939.404 395.3614C937.0393 395.3614 935.5365 392.8199 935.5365 388.864C935.5365 384.9081 937.0393 382.3666 939.404 382.3666C941.7687 382.3666 943.2715 384.9081 943.2715 388.864C943.2715 392.8199 941.7687 395.3614 939.404 395.3614ZM949.7909999999999 396.82H951.8242C953.0839 391.3171 955.4485999999999 386.3888 958.5868 382.6097V380.908H948.3103V382.5655H956.5315C953.4154 386.5656 951.0507 391.4497 949.7909999999999 396.82Z" fill="#5E5E63"/><circle cx="1008.9" cy="389.0" r="20.4" fill="#1C1C1E" opacity="0.10"/><path d="M1003.5 383.6L1014.3 394.4M1014.3 383.6L1003.5 394.4" stroke="#1C1C1E" stroke-width="2.72" stroke-linecap="round"/><circle cx="1066.7" cy="389.0" r="20.4" fill="#1C1C1E"/><rect x="1059.9" y="382.2" width="13.6" height="13.6" rx="2.4" fill="#FFFFFF"/></svg>
diff --git a/docs/assets/src/build-graphics.py b/docs/assets/src/build-graphics.py
new file mode 100644
index 0000000..5362efb
--- /dev/null
+++ b/docs/assets/src/build-graphics.py
@@ -0,0 +1,187 @@
+"""Builds the README hero and the repository social preview as standalone SVGs.
+
+Text is set in FT Regola Neue with HarfBuzz shaping and converted to outlines, so the
+SVGs render identically on GitHub and anywhere else (no font loading needed).
+
+ python3 -m venv /tmp/gv-venv && /tmp/gv-venv/bin/pip install fonttools brotli uharfbuzz resvg-py
+ /tmp/gv-venv/bin/python docs/assets/src/build-graphics.py
+
+Writes docs/assets/*.svg, PNG renders next to them (when resvg-py is installed), and a
+copy of the social preview PNG to website/dist/assets/social-preview.png.
+"""
+import pathlib
+import uharfbuzz as hb
+from fontTools.ttLib import TTFont
+from fontTools.pens.svgPathPen import SVGPathPen
+from fontTools.pens.transformPen import TransformPen
+
+ROOT = pathlib.Path(__file__).resolve().parents[3]
+FONTS = ROOT / "website" / "dist" / "fonts"
+OUT = ROOT / "docs" / "assets"
+
+
+class Face:
+ def __init__(self, path):
+ self.tt = TTFont(path)
+ self.tt.flavor = None
+ import io
+ buf = io.BytesIO(); self.tt.save(buf) # plain sfnt bytes for HarfBuzz
+ self.hb_font = hb.Font(hb.Face(hb.Blob(buf.getvalue())))
+ self.upm = self.tt["head"].unitsPerEm
+ self.glyphs = self.tt.getGlyphSet()
+ self.order = self.tt.getGlyphOrder()
+
+ def shape(self, text, tracking=0.0):
+ buf = hb.Buffer(); buf.add_str(text); buf.guess_segment_properties()
+ hb.shape(self.hb_font, buf, {"kern": True, "liga": True, "tnum": True})
+ out, x = [], 0
+ for info, pos in zip(buf.glyph_infos, buf.glyph_positions):
+ out.append((self.order[info.codepoint], x + pos.x_offset))
+ x += pos.x_advance + tracking * self.upm
+ return out, x - tracking * self.upm
+
+ def width(self, text, size, tracking=0.0):
+ return self.shape(text, tracking)[1] * size / self.upm
+
+ def path(self, text, x, y, size, tracking=0.0, anchor="start"):
+ glyphs, adv = self.shape(text, tracking)
+ s = size / self.upm
+ if anchor == "middle": x -= adv * s / 2
+ if anchor == "end": x -= adv * s
+ pen = SVGPathPen(self.glyphs)
+ for name, gx in glyphs:
+ self.glyphs[name].draw(TransformPen(pen, (s, 0, 0, -s, x + gx * s, y)))
+ return pen.getCommands()
+
+
+REG = Face(FONTS / "FTRegolaNeue-Regular.woff2")
+MED = Face(FONTS / "FTRegolaNeue-Medium.woff2")
+
+BARS = [(18.3, 39.8, 20.3), (32.3, 30.5, 39.0), (46.4, 22.7, 54.7), (60.4, 32.8, 34.5), (74.3, 41.4, 17.2)]
+
+
+def app_icon(x, y, size, uid):
+ k = size / 100
+ bars = "".join(f'<rect x="{x + bx * k:.2f}" y="{y + by * k:.2f}" width="{7.45 * k:.2f}" height="{bh * k:.2f}" rx="{3.72 * k:.2f}"/>' for bx, by, bh in BARS)
+ return (f'<defs><linearGradient id="ig{uid}" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2B2B2D"/><stop offset="1" stop-color="#1D1D1F"/></linearGradient></defs>'
+ f'<rect x="{x}" y="{y}" width="{size}" height="{size}" rx="{22.6 * k:.2f}" fill="url(#ig{uid})"/>'
+ f'<g fill="#EBEBEB">{bars}</g>')
+
+
+def pill(cx, cy, scale, theme):
+ """The app's recording bar, drawn at 40pt height times scale, centred on (cx, cy)."""
+ dark = theme == "dark"
+ surface, ink, ink2 = ("#252527", "#ECECEC", "#A1A1A6") if dark else ("#FFFFFF", "#1C1C1E", "#5E5E63")
+ rec = "#FF6A50" if dark else "#D5432B"
+ accent, on_accent = ("#ECECEC", "#1C1C1E") if dark else ("#1C1C1E", "#FFFFFF")
+ stroke = "rgba(236,236,236,0.12)" if dark else "rgba(28,28,30,0.12)"
+ s = scale
+ w, h = 182 * s, 40 * s
+ x0, y0 = cx - w / 2, cy - h / 2
+ parts = [
+ f'<rect x="{x0 - 2 * s:.1f}" y="{y0 + 6 * s:.1f}" width="{w + 4 * s:.1f}" height="{h:.1f}" rx="{h / 2:.1f}" fill="#000" opacity="{0.28 if dark else 0.10}" filter="url(#blur)"/>',
+ f'<rect x="{x0:.1f}" y="{y0:.1f}" width="{w:.1f}" height="{h:.1f}" rx="{h / 2:.1f}" fill="{surface}" stroke="{stroke}" stroke-width="{s:.2f}"/>',
+ f'<circle cx="{x0 + 17.5 * s:.1f}" cy="{cy:.1f}" r="{3.5 * s:.1f}" fill="{rec}"/>',
+ ]
+ weights, level = [0.55, 0.8, 1, 0.8, 0.55], [0.62, 0.86, 0.95, 0.7, 0.5]
+ bx = x0 + 31 * s
+ for i, wgt in enumerate(weights):
+ bh = max(3, 18 * wgt * level[i] / max(level) * 1.0) * s
+ parts.append(f'<rect x="{bx + i * 6 * s:.1f}" y="{cy - bh / 2:.1f}" width="{3 * s:.1f}" height="{bh:.1f}" rx="{1.5 * s:.1f}" fill="{accent}"/>')
+ parts.append(f'<path d="{REG.path("0:07", x0 + 71 * s, cy + 4.6 * s, 13 * s)}" fill="{ink2}"/>')
+ c1, c2 = x0 + 128 * s, x0 + 162 * s
+ parts.append(f'<circle cx="{c1:.1f}" cy="{cy:.1f}" r="{12 * s:.1f}" fill="{ink}" opacity="0.10"/>')
+ d = 3.2 * s
+ parts.append(f'<path d="M{c1 - d:.1f} {cy - d:.1f}L{c1 + d:.1f} {cy + d:.1f}M{c1 + d:.1f} {cy - d:.1f}L{c1 - d:.1f} {cy + d:.1f}" stroke="{ink}" stroke-width="{1.6 * s:.2f}" stroke-linecap="round"/>')
+ parts.append(f'<circle cx="{c2:.1f}" cy="{cy:.1f}" r="{12 * s:.1f}" fill="{accent}"/>')
+ parts.append(f'<rect x="{c2 - 4 * s:.1f}" y="{cy - 4 * s:.1f}" width="{8 * s:.1f}" height="{8 * s:.1f}" rx="{1.4 * s:.1f}" fill="{on_accent}"/>')
+ return "".join(parts)
+
+
+def field(x, y, w, theme, text_lines, size):
+ """A plain text field holding just-pasted words, with a caret."""
+ dark = theme == "dark"
+ surface, stroke, ink, hl = (("#1C1C1E", "rgba(255,255,255,0.10)", "#ECECEC", "rgba(236,236,236,0.14)") if dark
+ else ("#FFFFFF", "rgba(0,0,0,0.10)", "#1C1C1E", "rgba(28,28,30,0.08)"))
+ lh = size * 1.45
+ h = 30 + lh * len(text_lines)
+ parts = [f'<rect x="{x}" y="{y}" width="{w}" height="{h:.1f}" rx="14" fill="{surface}" stroke="{stroke}"/>']
+ ty = y + 15 + size * 1.02
+ for i, line in enumerate(text_lines):
+ lw = REG.width(line, size)
+ parts.append(f'<rect x="{x + 18:.1f}" y="{ty - size * 0.98:.1f}" width="{lw + 6:.1f}" height="{size * 1.32:.1f}" rx="4" fill="{hl}"/>')
+ parts.append(f'<path d="{REG.path(line, x + 21, ty, size)}" fill="{ink}"/>')
+ if i == len(text_lines) - 1:
+ parts.append(f'<rect x="{x + 24 + lw:.1f}" y="{ty - size * 0.92:.1f}" width="2" height="{size * 1.18:.1f}" rx="1" fill="{ink}"/>')
+ ty += lh
+ return "".join(parts), h
+
+
+def svg(w, h, body):
+ return (f'<svg xmlns="http://www.w3.org/2000/svg" width="{w}" height="{h}" viewBox="0 0 {w} {h}">'
+ '<defs><filter id="blur" x="-20%" y="-50%" width="140%" height="200%"><feGaussianBlur stdDeviation="9"/></filter></defs>'
+ f'{body}</svg>\n')
+
+
+def social():
+ W, H = 1280, 640
+ bg, ink, ink2, ink3 = "#F4F4F3", "#1C1C1E", "#5E5E63", "#75757A"
+ b = [f'<rect width="{W}" height="{H}" fill="{bg}"/>']
+ # Left: identity and the one claim.
+ b.append(app_icon(88, 104, 96, "s"))
+ b.append(f'<path d="{MED.path("GPT Voice", 84, 316, 92, tracking=-0.02)}" fill="{ink}"/>')
+ b.append(f'<path d="{REG.path("Dictate into any app", 88, 386, 40, tracking=-0.01)}" fill="{ink2}"/>')
+ b.append(f'<path d="{REG.path("on your Mac.", 88, 436, 40, tracking=-0.01)}" fill="{ink2}"/>')
+ b.append(f'<path d="{REG.path("Free and open source · macOS 13+", 88, 548, 22)}" fill="{ink3}"/>')
+ # Right: a text field receiving the words, and the recording bar under it.
+ f, fh = field(700, 196, 492, "light", ["Make the retry backoff", "exponential, with jitter."], 30)
+ b.append(f)
+ b.append(pill(946, 196 + fh + 76, 1.7, "light"))
+ return svg(W, H, "".join(b))
+
+
+def hero(theme):
+ W, H = 1280, 520
+ dark = theme == "dark"
+ bg, ink, ink2 = ("#111112", "#ECECEC", "#A1A1A6") if dark else ("#FFFFFF", "#1C1C1E", "#5E5E63")
+ b = [f'<rect width="{W}" height="{H}" rx="24" fill="{bg}"/>']
+ if not dark:
+ b.append(f'<rect x="0.5" y="0.5" width="{W - 1}" height="{H - 1}" rx="23.5" fill="none" stroke="rgba(0,0,0,0.08)"/>')
+ title = "GPT Voice"
+ tw = MED.width(title, 84, tracking=-0.02)
+ icon = 84
+ gap = 28
+ x0 = (W - (icon + gap + tw)) / 2
+ b.append(app_icon(x0, 108, icon, theme[0]))
+ b.append(f'<path d="{MED.path(title, x0 + icon + gap, 178, 84, tracking=-0.02)}" fill="{ink}"/>')
+ b.append(f'<path d="{REG.path("Dictate into any app on your Mac.", W / 2, 262, 38, tracking=-0.01, anchor="middle")}" fill="{ink2}"/>')
+ b.append(pill(W / 2, 382, 1.9, theme))
+ return svg(W, H, "".join(b))
+
+
+def main():
+ outputs = {
+ "social-preview.svg": social(),
+ "readme-hero-light.svg": hero("light"),
+ "readme-hero-dark.svg": hero("dark"),
+ }
+ for name, data in outputs.items():
+ (OUT / name).write_text(data)
+ print("wrote", OUT / name)
+ try:
+ import resvg_py
+ except ImportError:
+ print("resvg-py not installed; skipped PNG renders")
+ return
+ for name, scale in (("social-preview.svg", 1), ("readme-hero-light.svg", 2), ("readme-hero-dark.svg", 2)):
+ png = resvg_py.svg_to_bytes(svg_string=outputs[name], zoom=scale)
+ data = bytes(png)
+ target = OUT / name.replace(".svg", ".png")
+ target.write_bytes(data)
+ print("wrote", target)
+ if name == "social-preview.svg":
+ (ROOT / "website" / "dist" / "assets" / "social-preview.png").write_bytes(data)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/docs/assets/video-poster.jpg b/docs/assets/video-poster.jpg
new file mode 100644
index 0000000..a671e55
Binary files /dev/null and b/docs/assets/video-poster.jpg differ
diff --git a/docs/installer/README.md b/docs/installer/README.md
new file mode 100644
index 0000000..9b33372
--- /dev/null
+++ b/docs/installer/README.md
@@ -0,0 +1,31 @@
+# DMG window background
+
+A standard Finder drag-to-install window. Finder draws the icons and labels; the image leaves that area empty.
+
+| File | Pixels | DPI | Use |
+| --- | --- | --- | --- |
+| `background.png` | 760 x 500 | 72 | 1x |
+| `[email protected]` | 1520 x 1000 | 144 | Retina |
+| `background.tiff` | both, multi-resolution | 72 / 144 | single file for dmgbuild `background` |
+| `render-background.swift` | | | source renderer |
+
+Layout, in Finder points with the origin at the top left:
+
+- Window 760 x 500; toolbar, sidebar and status bar hidden.
+- App icon center (210, 255) and Applications link center (550, 255); icon size 112, labels at the bottom.
+- WaveMark and "GPT Voice" wordmark centered at y 76; "Drag to Applications" at y 106–124.
+- Arrow from x 306 to 454 at y 255, 40 points clear of each icon.
+- Footnote "Then open GPT Voice from your Applications folder." at y 446.
+- Empty from y 190 to 430 apart from the arrow, for icons and labels.
+
+Colors come from the app's light palette: paper #F6F6F5 to #EFEFEE, ink #1C1C1E, secondary #6E6E73, tertiary #8E8E93.
+The background is light in both system appearances, because Finder does not swap background images. Finder's default dark label text stays legible on it.
+
+## Regenerate
+
+```sh
+swift docs/installer/render-background.swift Sources/GPTVoice/Resources/Fonts docs/installer
+tiffutil -cathidpicheck docs/installer/background.png docs/installer/[email protected] -out docs/installer/background.tiff
+```
+
+The WaveMark and arrow use original vector paths drawn by the renderer.
diff --git a/docs/installer/background.png b/docs/installer/background.png
new file mode 100644
index 0000000..bb91c15
Binary files /dev/null and b/docs/installer/background.png differ
diff --git a/docs/installer/background.tiff b/docs/installer/background.tiff
new file mode 100644
index 0000000..dae20e5
Binary files /dev/null and b/docs/installer/background.tiff differ
diff --git a/docs/installer/[email protected] b/docs/installer/[email protected]
new file mode 100644
index 0000000..aed3a94
Binary files /dev/null and b/docs/installer/[email protected] differ
diff --git a/docs/installer/render-background.swift b/docs/installer/render-background.swift
new file mode 100644
index 0000000..d802acd
--- /dev/null
+++ b/docs/installer/render-background.swift
@@ -0,0 +1,161 @@
+// Renders the GPT Voice DMG window background: a standard Finder window, 760 x 500 points.
+// Light paper in the app's canvas color, the WaveMark and wordmark at the top, one instruction line,
+// and an arrow between the app icon (210, 255) and the Applications link (550, 255).
+// Finder draws the icons and their labels; this image leaves that area empty.
+// All text is the app's bundled FT Regola Neue display face; no system font is rasterized.
+// Usage: swift docs/installer/render-background.swift FONT_DIRECTORY OUTPUT_DIRECTORY
+// Writes background.png (760 x 500, 72 dpi) and [email protected] (1520 x 1000, 144 dpi).
+import AppKit
+import CoreText
+
+let arguments = CommandLine.arguments
+guard arguments.count == 3 else {
+ FileHandle.standardError.write(Data("Usage: render-background.swift FONT_DIRECTORY OUTPUT_DIRECTORY\n".utf8))
+ exit(2)
+}
+let fontDirectory = URL(fileURLWithPath: arguments[1])
+let outputDirectory = URL(fileURLWithPath: arguments[2])
+
+/// Loads one bundled static face by PostScript name, failing rather than falling back to another font.
+func bundledFont(_ name: String, size: CGFloat) -> NSFont {
+ let file = fontDirectory.appendingPathComponent("\(name).otf")
+ CTFontManagerRegisterFontsForURL(file as CFURL, .process, nil)
+ guard let font = NSFont(name: name, size: size), font.fontName == name else {
+ FileHandle.standardError.write(Data("Could not load \(name) from \(file.path).\n".utf8))
+ exit(1)
+ }
+ return font
+}
+
+let wordmarkFont = bundledFont("FTRegolaNeue-Semibold", size: 28)
+let instructionFont = bundledFont("FTRegolaNeue-Medium", size: 15)
+let footnoteFont = bundledFont("FTRegolaNeue-Regular", size: 12.5)
+
+func color(_ hex: UInt32, alpha: CGFloat = 1) -> NSColor {
+ NSColor(srgbRed: CGFloat((hex >> 16) & 0xFF) / 255, green: CGFloat((hex >> 8) & 0xFF) / 255,
+ blue: CGFloat(hex & 0xFF) / 255, alpha: alpha)
+}
+
+// AppPalette light roles: canvas #F4F4F3, ink #1C1C1E (graphite of the app icon).
+let paperTop = color(0xF6F6F5)
+let paperBottom = color(0xEFEFEE)
+let ink = color(0x1C1C1E)
+let secondaryInk = color(0x6E6E73)
+let tertiaryInk = color(0x8E8E93)
+let arrowInk = color(0x1C1C1E, alpha: 0.38)
+
+let canvas = NSSize(width: 760, height: 500)
+let appCenter = NSPoint(x: 210, y: 255)
+let applicationsCenter = NSPoint(x: 550, y: 255)
+let iconSize: CGFloat = 112
+
+func centered(_ text: NSAttributedString, centerX: CGFloat, top: CGFloat) {
+ let size = text.size()
+ text.draw(at: NSPoint(x: centerX - size.width / 2, y: top))
+}
+
+/// Five rounded bars, the WaveMark proportions used by the app icon (0.26, 0.5, 0.7, 0.44, 0.22).
+func drawWaveMark(in rect: NSRect) {
+ let heights: [CGFloat] = [0.26, 0.5, 0.7, 0.44, 0.22]
+ let barWidth = rect.width * 0.12
+ let gap = (rect.width - barWidth * 5) / 4
+ var x = rect.minX
+ ink.setFill()
+ for height in heights {
+ let barHeight = rect.height * height / 0.7
+ let bar = NSRect(x: x, y: rect.midY - barHeight / 2, width: barWidth, height: barHeight)
+ NSBezierPath(roundedRect: bar, xRadius: barWidth / 2, yRadius: barWidth / 2).fill()
+ x += barWidth + gap
+ }
+}
+
+func drawBackground() {
+ let bounds = NSRect(origin: .zero, size: canvas)
+ NSGradient(starting: paperTop, ending: paperBottom)?.draw(in: bounds, angle: 90)
+
+ // Header: WaveMark and wordmark as one centered group.
+ let wordmark = NSAttributedString(string: "GPT Voice", attributes: [
+ .font: wordmarkFont, .foregroundColor: ink, .kern: -0.4,
+ ])
+ let markSize = NSSize(width: 24, height: 24)
+ let spacing: CGFloat = 11
+ let wordmarkSize = wordmark.size()
+ let groupWidth = markSize.width + spacing + wordmarkSize.width
+ let groupLeft = canvas.width / 2 - groupWidth / 2
+ let headerMidY: CGFloat = 76
+ drawWaveMark(in: NSRect(x: groupLeft, y: headerMidY - markSize.height / 2,
+ width: markSize.width, height: markSize.height))
+ let capCenterOffset = wordmarkFont.ascender - wordmarkFont.capHeight / 2
+ wordmark.draw(at: NSPoint(x: groupLeft + markSize.width + spacing, y: headerMidY - capCenterOffset))
+
+ let instruction = NSAttributedString(string: "Drag to Applications", attributes: [
+ .font: instructionFont, .foregroundColor: secondaryInk,
+ ])
+ centered(instruction, centerX: canvas.width / 2, top: 106)
+
+ // Arrow between the icons, clear of their 112-point frames.
+ let clearance: CGFloat = 40
+ let start = NSPoint(x: appCenter.x + iconSize / 2 + clearance, y: appCenter.y)
+ let end = NSPoint(x: applicationsCenter.x - iconSize / 2 - clearance, y: applicationsCenter.y)
+ arrowInk.setStroke()
+ let shaft = NSBezierPath()
+ shaft.lineWidth = 2
+ shaft.lineCapStyle = .round
+ shaft.move(to: start)
+ shaft.line(to: NSPoint(x: end.x - 1, y: end.y))
+ shaft.stroke()
+ let head = NSBezierPath()
+ head.lineWidth = 2
+ head.lineCapStyle = .round
+ head.lineJoinStyle = .round
+ head.move(to: NSPoint(x: end.x - 9, y: end.y - 9))
+ head.line(to: end)
+ head.line(to: NSPoint(x: end.x - 9, y: end.y + 9))
+ head.stroke()
+
+ let footnote = NSAttributedString(string: "Then open GPT Voice from your Applications folder.", attributes: [
+ .font: footnoteFont, .foregroundColor: tertiaryInk,
+ ])
+ centered(footnote, centerX: canvas.width / 2, top: 446)
+}
+
+func render(scale: Int, to url: URL) {
+ let pixelsWide = Int(canvas.width) * scale
+ let pixelsHigh = Int(canvas.height) * scale
+ guard let space = CGColorSpace(name: CGColorSpace.sRGB),
+ let cgContext = CGContext(data: nil, width: pixelsWide, height: pixelsHigh, bitsPerComponent: 8,
+ bytesPerRow: 0, space: space,
+ bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue) else {
+ FileHandle.standardError.write(Data("Could not create the drawing context.\n".utf8))
+ exit(1)
+ }
+ // Flipped, top-left origin in points, so layout reads in Finder's coordinates.
+ cgContext.translateBy(x: 0, y: CGFloat(pixelsHigh))
+ cgContext.scaleBy(x: CGFloat(scale), y: -CGFloat(scale))
+ NSGraphicsContext.saveGraphicsState()
+ NSGraphicsContext.current = NSGraphicsContext(cgContext: cgContext, flipped: true)
+ drawBackground()
+ NSGraphicsContext.restoreGraphicsState()
+
+ guard let image = cgContext.makeImage() else {
+ FileHandle.standardError.write(Data("Could not finish the image.\n".utf8))
+ exit(1)
+ }
+ let bitmap = NSBitmapImageRep(cgImage: image)
+ // Point size fixes the DPI (72 at 1x, 144 at 2x), so Finder shows both at 760 x 500 points.
+ bitmap.size = canvas
+ guard let png = bitmap.representation(using: .png, properties: [:]) else {
+ FileHandle.standardError.write(Data("Could not encode the PNG.\n".utf8))
+ exit(1)
+ }
+ do {
+ try png.write(to: url)
+ } catch {
+ FileHandle.standardError.write(Data("Could not write \(url.path): \(error.localizedDescription)\n".utf8))
+ exit(1)
+ }
+}
+
+try? FileManager.default.createDirectory(at: outputDirectory, withIntermediateDirectories: true)
+render(scale: 1, to: outputDirectory.appendingPathComponent("background.png"))
+render(scale: 2, to: outputDirectory.appendingPathComponent("[email protected]"))
diff --git a/docs/media/GPT-Voice-Promo.mp4 b/docs/media/GPT-Voice-Promo.mp4
new file mode 100644
index 0000000..c6d4200
Binary files /dev/null and b/docs/media/GPT-Voice-Promo.mp4 differ
diff --git a/packaging/GPTVoice.entitlements b/packaging/GPTVoice.entitlements
new file mode 100644
index 0000000..8995a68
--- /dev/null
+++ b/packaging/GPTVoice.entitlements
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0"><dict>
+<key>com.apple.security.device.audio-input</key><true/>
+</dict></plist>
diff --git a/scripts/build.sh b/scripts/build.sh
new file mode 100755
index 0000000..da7f69f
--- /dev/null
+++ b/scripts/build.sh
@@ -0,0 +1,147 @@
+#!/bin/bash
+set -euo pipefail
+
+project_dir="$(cd "$(dirname "$0")/.." && pwd)"
+cd "$project_dir"
+install_app=false
+universal=false
+for option in "$@"; do
+ case "$option" in
+ --install) install_app=true ;;
+ --universal) universal=true ;;
+ *) echo "Usage: $0 [--install] [--universal]" >&2; exit 2 ;;
+ esac
+done
+app_version=$(cat VERSION)
+build_number=$(cat BUILD_NUMBER)
+[[ "$app_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "Invalid VERSION" >&2; exit 1; }
+[[ "$build_number" =~ ^[0-9]+$ ]] || { echo "Invalid BUILD_NUMBER" >&2; exit 1; }
+check_launch() {
+ python3 - "$1/Contents/MacOS/GPTVoice" <<'PYTHON'
+import json, subprocess, sys
+try:
+ result = subprocess.run([sys.argv[1], "--diagnose"], capture_output=True, timeout=8, check=True)
+ json.loads(result.stdout)
+except (subprocess.SubprocessError, ValueError) as error:
+ sys.exit(f"The new app did not pass its launch check. Existing apps were kept. {error}")
+PYTHON
+}
+if $universal; then
+ swift build -c release --arch arm64 --scratch-path .build/release-arm64
+ swift build -c release --arch x86_64 --scratch-path .build/release-x86_64
+ binary_dir=$(swift build -c release --arch arm64 --scratch-path .build/release-arm64 --show-bin-path)
+ intel_binary_dir=$(swift build -c release --arch x86_64 --scratch-path .build/release-x86_64 --show-bin-path)
+else
+ swift build -c release
+ binary_dir=$(swift build -c release --show-bin-path)
+fi
+build_staging_dir=$(mktemp -d "$project_dir/.build/gpt-voice-bundle.XXXXXX")
+trap 'rm -rf "$build_staging_dir"' EXIT
+app_dir="$build_staging_dir/GPT Voice.app"
+mkdir -p "$app_dir/Contents/MacOS" "$app_dir/Contents/Resources"
+if $universal; then
+ lipo -create "$binary_dir/GPTVoice" "$intel_binary_dir/GPTVoice" -output "$app_dir/Contents/MacOS/GPTVoice"
+ architectures=$(lipo -archs "$app_dir/Contents/MacOS/GPTVoice")
+ [[ " $architectures " == *" arm64 "* && " $architectures " == *" x86_64 "* ]] \
+ || { echo "The universal app is missing an architecture." >&2; exit 1; }
+else
+ cp "$binary_dir/GPTVoice" "$app_dir/Contents/MacOS/GPTVoice"
+fi
+resource_bundle="$binary_dir/GPTVoice_GPTVoice.bundle"
+if [[ -d "$resource_bundle" ]]; then
+ rm -rf "$app_dir/Contents/Resources/GPTVoice_GPTVoice.bundle"
+ ditto "$resource_bundle" "$app_dir/Contents/Resources/GPTVoice_GPTVoice.bundle"
+fi
+icon_dir="$project_dir/.build/AppIcon.iconset"
+mkdir -p "$icon_dir"
+swift scripts/generate-icon.swift "$icon_dir/[email protected]" 1024
+for icon_size in 16 32 128 256 512; do
+ sips -z "$icon_size" "$icon_size" "$icon_dir/[email protected]" --out "$icon_dir/icon_${icon_size}x${icon_size}.png" >/dev/null
+ retina_size=$((icon_size * 2))
+ if [[ "$retina_size" != "1024" ]]; then
+ sips -z "$retina_size" "$retina_size" "$icon_dir/[email protected]" --out "$icon_dir/icon_${icon_size}x${icon_size}@2x.png" >/dev/null
+ fi
+done
+iconutil -c icns "$icon_dir" -o "$app_dir/Contents/Resources/AppIcon.icns"
+cat > "$app_dir/Contents/Info.plist" <<'PLIST'
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0"><dict>
+<key>CFBundleExecutable</key><string>GPTVoice</string>
+<key>CFBundleIdentifier</key><string>com.vishesh.codex-dictation</string>
+<key>CFBundleName</key><string>GPT Voice</string>
+<key>CFBundleDisplayName</key><string>GPT Voice</string>
+<key>CFBundlePackageType</key><string>APPL</string>
+<key>CFBundleShortVersionString</key><string>0.0.0</string>
+<key>CFBundleVersion</key><string>0</string>
+<key>CFBundleIconFile</key><string>AppIcon.icns</string>
+<key>LSMinimumSystemVersion</key><string>13.0</string>
+<key>LSUIElement</key><true/>
+<key>NSHighResolutionCapable</key><true/>
+<key>NSPrincipalClass</key><string>NSApplication</string>
+<key>NSMicrophoneUsageDescription</key><string>Record your voice when you start dictation. Audio is sent to ChatGPT to convert speech to text.</string>
+</dict></plist>
+PLIST
+/usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString $app_version" "$app_dir/Contents/Info.plist"
+/usr/libexec/PlistBuddy -c "Set CFBundleVersion $build_number" "$app_dir/Contents/Info.plist"
+signing_identity="${GPT_VOICE_SIGNING_IDENTITY:-${CODEX_DICTATION_SIGNING_IDENTITY:-}}"
+if [[ -z "$signing_identity" && -f "$project_dir/.local-signing-identity" ]]; then
+ IFS= read -r signing_identity < "$project_dir/.local-signing-identity"
+fi
+signing_identity="${signing_identity:--}"
+sign_app() {
+ if [[ "$signing_identity" == "-" ]]; then
+ codesign --force --sign - --timestamp=none --identifier com.vishesh.codex-dictation "$1"
+ else
+ codesign --force --sign "$signing_identity" --options runtime --timestamp \
+ --entitlements "$project_dir/packaging/GPTVoice.entitlements" \
+ --identifier com.vishesh.codex-dictation "$1"
+ fi
+ codesign --verify --strict "$1"
+}
+sign_app "$app_dir"
+codesign --verify --strict "$app_dir"
+check_launch "$app_dir"
+release_app="$project_dir/dist/GPT Voice.app"
+mkdir -p "$project_dir/dist"
+if [[ -e "$release_app" ]]; then
+ mv "$release_app" "$build_staging_dir/Previous GPT Voice.app"
+fi
+mv "$app_dir" "$release_app"
+app_dir="$release_app"
+if $install_app; then
+ destination="$HOME/Applications/GPT Voice.app"
+ if [[ -e "$destination" ]]; then
+ previous_id=$(/usr/libexec/PlistBuddy -c 'Print CFBundleIdentifier' "$destination/Contents/Info.plist")
+ [[ "$previous_id" == "com.vishesh.codex-dictation" ]] || { echo "Another app uses this destination." >&2; exit 1; }
+ fi
+ mkdir -p "$HOME/Applications"
+ install_staging_dir=$(mktemp -d "$project_dir/.build/gpt-voice-install.XXXXXX")
+ ditto "$app_dir" "$install_staging_dir/GPT Voice.app"
+ sign_app "$install_staging_dir/GPT Voice.app"
+ check_launch "$install_staging_dir/GPT Voice.app"
+ if [[ -e "$destination" ]]; then
+ mkdir -p "$project_dir/.build/installed-app-backups"
+ ditto -c -k --sequesterRsrc --keepParent "$destination" \
+ "$project_dir/.build/installed-app-backups/GPT-Voice-$(date +%Y%m%dT%H%M%S)-$$.app.zip"
+ mv "$destination" "$build_staging_dir/Previous Installed GPT Voice.app"
+ fi
+ mv "$install_staging_dir/GPT Voice.app" "$destination"
+ rmdir "$install_staging_dir"
+ codesign --verify --strict "$destination"
+ legacy_destination="$HOME/Applications/Codex Dictation.app"
+ if [[ -d "$legacy_destination" ]]; then
+ legacy_id=$(/usr/libexec/PlistBuddy -c 'Print CFBundleIdentifier' "$legacy_destination/Contents/Info.plist")
+ if [[ "$legacy_id" == "com.vishesh.codex-dictation" ]]; then
+ backup_dir="$project_dir/.build/installed-app-backups"
+ mkdir -p "$backup_dir"
+ backup_path="$backup_dir/Codex-Dictation-$(date +%Y%m%dT%H%M%S)-$$.app.zip"
+ ditto -c -k --sequesterRsrc --keepParent "$legacy_destination" "$backup_path"
+ rm -rf "$legacy_destination"
+ echo "Previous app saved: $backup_path"
+ fi
+ fi
+ echo "Installed: $destination"
+else
+ echo "Built: $app_dir"
+fi
diff --git a/scripts/check-live.sh b/scripts/check-live.sh
new file mode 100755
index 0000000..b6b9cc8
--- /dev/null
+++ b/scripts/check-live.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+set -euo pipefail
+
+project_dir="$(cd "$(dirname "$0")/.." && pwd)"
+cd "$project_dir"
+binary_dir=$(swift build -c release --show-bin-path)
+binary="$binary_dir/GPTVoice"
+[[ -x "$binary" ]] || { echo "Build the app first with ./scripts/build.sh" >&2; exit 1; }
+sample_dir=$(mktemp -d -t codex-dictation-check)
+trap 'rm -rf "$sample_dir"' EXIT
+say -o "$sample_dir/sample.aiff" 'This is a dictation test for Codex.'
+afconvert -f WAVE -d LEI16@24000 -c 1 "$sample_dir/sample.aiff" "$sample_dir/sample.wav"
+"$binary" --transcribe "$sample_dir/sample.wav"
diff --git a/scripts/generate-icon.swift b/scripts/generate-icon.swift
new file mode 100644
index 0000000..d4fb905
--- /dev/null
+++ b/scripts/generate-icon.swift
@@ -0,0 +1,74 @@
+// Renders the GPT Voice app icon to match the in-app WaveMark:
+// a graphite tile with five rounded voice bars in soft white. Monochrome. Original paths only, no assets.
+// Transparent canvas with the native macOS icon inset.
+// Usage: swift scripts/generate-icon.swift OUTPUT.png [SIZE]
+import AppKit
+
+let arguments = CommandLine.arguments
+guard arguments.count >= 2 else {
+ FileHandle.standardError.write(Data("Usage: generate-icon.swift OUTPUT.png [SIZE]\n".utf8))
+ exit(2)
+}
+let output = URL(fileURLWithPath: arguments[1])
+let size = arguments.count >= 3 ? CGFloat(Double(arguments[2]) ?? 1024) : 1024
+
+guard let bitmap = NSBitmapImageRep(bitmapDataPlanes: nil, pixelsWide: Int(size), pixelsHigh: Int(size),
+ bitsPerSample: 8, samplesPerPixel: 4, hasAlpha: true, isPlanar: false,
+ colorSpaceName: .deviceRGB, bytesPerRow: 0, bitsPerPixel: 0),
+ let context = NSGraphicsContext(bitmapImageRep: bitmap) else {
+ FileHandle.standardError.write(Data("Could not create the bitmap.\n".utf8))
+ exit(1)
+}
+
+func color(_ hex: UInt32) -> NSColor {
+ NSColor(srgbRed: CGFloat((hex >> 16) & 0xFF) / 255, green: CGFloat((hex >> 8) & 0xFF) / 255,
+ blue: CGFloat(hex & 0xFF) / 255, alpha: 1)
+}
+
+let graphiteTop = color(0x2A2A2D)
+let graphiteBottom = color(0x1C1C1E)
+let bar = color(0xECECEC)
+
+NSGraphicsContext.saveGraphicsState()
+NSGraphicsContext.current = context
+
+// macOS icon grid: the tile is inset about 10% from the canvas edge. The rest stays transparent.
+let inset = size * 0.1
+let tile = NSRect(x: inset, y: inset, width: size - inset * 2, height: size - inset * 2)
+let tileRadius = tile.width * 0.225
+
+let shadow = NSShadow()
+shadow.shadowColor = NSColor.black.withAlphaComponent(0.22)
+shadow.shadowOffset = NSSize(width: 0, height: -size * 0.01)
+shadow.shadowBlurRadius = size * 0.02
+shadow.set()
+let tilePath = NSBezierPath(roundedRect: tile, xRadius: tileRadius, yRadius: tileRadius)
+NSGradient(starting: graphiteTop, ending: graphiteBottom)?.draw(in: tilePath, angle: -90)
+NSShadow().set()
+
+// Five rounded bars, the same proportions as WaveMark (0.26, 0.5, 0.7, 0.44, 0.22 of the tile).
+let heights: [CGFloat] = [0.26, 0.5, 0.7, 0.44, 0.22]
+let barWidth = tile.width * 0.075
+let gap = tile.width * 0.065
+let totalWidth = barWidth * CGFloat(heights.count) + gap * CGFloat(heights.count - 1)
+var x = tile.midX - totalWidth / 2
+bar.setFill()
+for height in heights {
+ let barHeight = tile.height * height * 0.78
+ let rect = NSRect(x: x, y: tile.midY - barHeight / 2, width: barWidth, height: barHeight)
+ NSBezierPath(roundedRect: rect, xRadius: barWidth / 2, yRadius: barWidth / 2).fill()
+ x += barWidth + gap
+}
+
+NSGraphicsContext.restoreGraphicsState()
+
+guard let png = bitmap.representation(using: .png, properties: [:]) else {
+ FileHandle.standardError.write(Data("Could not encode the PNG.\n".utf8))
+ exit(1)
+}
+do {
+ try png.write(to: output)
+} catch {
+ FileHandle.standardError.write(Data("Could not write \(output.path): \(error.localizedDescription)\n".utf8))
+ exit(1)
+}
diff --git a/scripts/package-dmg.py b/scripts/package-dmg.py
new file mode 100755
index 0000000..27555a7
--- /dev/null
+++ b/scripts/package-dmg.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python3
+"""Create a Finder disk image. Install dmgbuild==1.6.7 in a build environment."""
+import argparse
+import hashlib
+import json
+import plistlib
+import subprocess
+from pathlib import Path
+
+
+def run(*args):
+ return subprocess.run(args, check=True, capture_output=True, text=True).stdout
+
+
+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.')
+ args = parser.parse_args()
+ app = args.app.resolve()
+ output = args.output.resolve()
+ root = Path(__file__).resolve().parents[1]
+ background = root / 'docs/installer/background.png'
+ if not app.is_dir() or not background.is_file():
+ parser.error('Build the app and installer background first.')
+ 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:
+ 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)
+ subprocess.run(['spctl', '--assess', '--type', 'execute', '--verbose=2', str(app)], check=True)
+ import dmgbuild
+ output.parent.mkdir(parents=True, exist_ok=True)
+ dmgbuild.build_dmg(str(output), 'GPT Voice', settings={
+ 'format': 'UDZO', 'compression_level': 9, 'filesystem': 'HFS+',
+ 'files': [str(app)], 'symlinks': {'Applications': '/Applications'},
+ 'background': str(background),
+ 'badge_icon': str(app / 'Contents/Resources/AppIcon.icns'),
+ 'icon_locations': {'GPT Voice.app': (210, 255), 'Applications': (550, 255)},
+ '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,
+ })
+ subprocess.run(['hdiutil', 'verify', str(output)], 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,
+ '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))
+
+
+if __name__ == '__main__':
+ main()
diff --git a/scripts/paste-fixture.py b/scripts/paste-fixture.py
new file mode 100644
index 0000000..2b21960
--- /dev/null
+++ b/scripts/paste-fixture.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+"""Local scratch field for manual end-to-end paste checks. No external requests."""
+from http.server import BaseHTTPRequestHandler, HTTPServer
+
+PAGE = b'''<!doctype html><html lang="en"><meta charset="utf-8">
+<title>GPT Voice paste check</title>
+<style>body{font:18px system-ui;margin:48px;max-width:760px}textarea{display:block;width:100%;height:240px;font:20px system-ui;padding:16px;margin-top:16px}</style>
+<h1>Dictation paste check</h1><p>This is a local scratch field. Nothing is submitted.</p>
+<label for="transcript">Transcript</label><textarea id="transcript" autofocus spellcheck="false"></textarea>
+</html>'''
+
+
+class Handler(BaseHTTPRequestHandler):
+ def do_GET(self):
+ if self.path != "/":
+ self.send_error(404)
+ return
+ self.send_response(200)
+ self.send_header("Content-Type", "text/html; charset=utf-8")
+ self.send_header("Content-Length", str(len(PAGE)))
+ self.end_headers()
+ self.wfile.write(PAGE)
+
+
+if __name__ == "__main__":
+ HTTPServer(("127.0.0.1", 9971), Handler).serve_forever()
diff --git a/website/README.md b/website/README.md
new file mode 100644
index 0000000..17c2eeb
--- /dev/null
+++ b/website/README.md
@@ -0,0 +1,18 @@
+# GPT Voice website
+
+Static site, no build step. Everything that gets hosted is in `dist/`.
+
+- `dist/index.html`: the page (inline icon sprite).
+- `dist/styles.css`: page styles.
+- `dist/app.js`: link and release-state wiring, scroll reveals, the film player, the scripted hero demo and the accent swatches in the features grid. No microphone, clipboard or network use.
+- `dist/config.js`: the only file to edit for a release (`releaseReady`, `version`, URLs, video paths).
+- `dist/CREDITS.txt`: icon and media credits.
+
+Preview locally:
+
+ cd website/dist && python3 -m http.server 4173
+ # open http://localhost:4173
+
+Freeze the hero preview in one state for screenshots: `?demo=recording`, `transcribing`, `pasted`, `copied`, `notice`, `nospeech` or `settings`.
+
+The promo and poster are in `dist/assets/`.
diff --git a/website/dist/CREDITS.txt b/website/dist/CREDITS.txt
new file mode 100644
index 0000000..a0afe4e
--- /dev/null
+++ b/website/dist/CREDITS.txt
@@ -0,0 +1,17 @@
+GPT Voice website credits
+=========================
+
+GPT Voice source code
+ MIT License. See the LICENSE file in the GitHub repository.
+
+Phosphor Icons (inline SVG symbols in index.html)
+ MIT License, Copyright (c) 2023 Phosphor Icons.
+ Full text: assets/LICENSE-phosphor.txt
+ https://github.com/phosphor-icons/core
+
+App screenshots, app icon and promo film
+ Captured from or made for GPT Voice. Third-party material inside the
+ film (music, voice, footage) is credited separately in the repository.
+
+GPT Voice is an independent project, not affiliated with or endorsed by
+OpenAI. ChatGPT and Codex are trademarks of OpenAI.
diff --git a/website/dist/app.js b/website/dist/app.js
new file mode 100644
index 0000000..a654e98
--- /dev/null
+++ b/website/dist/app.js
@@ -0,0 +1,557 @@
+/* GPT Voice website. Plain script, no dependencies.
+ * The hero demo is scripted: no microphone, no clipboard, no network. */
+(function () {
+ "use strict";
+
+ var cfg = window.GPTV_CONFIG || {};
+ var $ = function (sel, root) { return (root || document).querySelector(sel); };
+ var $$ = function (sel, root) { return Array.prototype.slice.call((root || document).querySelectorAll(sel)); };
+ var reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)");
+
+ /* ---------- Config: links and release state ---------- */
+
+ function applyConfig() {
+ var ready = cfg.releaseReady === true;
+ // No public release until signing is done: Download stays on this page (#install),
+ // which says so and links to building from source.
+ var hrefs = {
+ download: ready ? cfg.dmgUrl : "#install",
+ repo: cfg.repoUrl,
+ release: ready ? cfg.releaseUrl : cfg.repoUrl + "/releases",
+ source: cfg.repoUrl + "#build-from-source",
+ };
+ $$("[data-link]").forEach(function (a) {
+ var href = hrefs[a.getAttribute("data-link")];
+ if (href) a.setAttribute("href", href);
+ });
+ $$("[data-when]").forEach(function (el) {
+ el.hidden = el.getAttribute("data-when") !== (ready ? "ready" : "pending");
+ });
+ $$("[data-version]").forEach(function (el) {
+ el.textContent = ready && cfg.version ? "Version " + cfg.version + " · " : "";
+ });
+ }
+
+ /* ---------- Header border on scroll ---------- */
+
+ function initHeader() {
+ var header = $(".site-header");
+ if (!header) return;
+ var onScroll = function () { header.classList.toggle("is-scrolled", window.scrollY > 4); };
+ window.addEventListener("scroll", onScroll, { passive: true });
+ onScroll();
+ }
+
+ /* ---------- Reveal on scroll (once) ---------- */
+
+ function initReveal() {
+ var items = $$(".reveal");
+ if (!("IntersectionObserver" in window)) {
+ items.forEach(function (el) { el.classList.add("is-in"); });
+ return;
+ }
+ var io = new IntersectionObserver(function (entries) {
+ entries.forEach(function (entry) {
+ if (entry.isIntersecting) {
+ entry.target.classList.add("is-in");
+ io.unobserve(entry.target);
+ }
+ });
+ }, { rootMargin: "0px 0px -8% 0px", threshold: 0.08 });
+ items.forEach(function (el) { io.observe(el); });
+ }
+
+ /* ---------- Film ---------- */
+
+ function initFilm() {
+ var frame = $("#film-frame");
+ var video = $("#film-video");
+ var play = $("#film-play");
+ var missing = $("#film-missing");
+ if (!frame || !video) return;
+ var source = $("source[data-video-src]", video);
+ var v = cfg.video || {};
+ if (v.poster) video.setAttribute("poster", v.poster);
+ if (v.src && source) {
+ source.setAttribute("src", v.src);
+ video.load();
+ }
+
+ function showMissing() {
+ if (missing) missing.hidden = false;
+ if (play) play.hidden = true;
+ }
+ if (!v.src) { showMissing(); return; }
+
+ if (source) source.addEventListener("error", showMissing);
+ // Over http, check the file exists so the play button never leads nowhere.
+ if (/^https?:/.test(location.protocol) && window.fetch) {
+ fetch(v.src, { method: "HEAD" }).then(function (r) { if (!r.ok) showMissing(); }).catch(function () {});
+ }
+
+ if (play) {
+ play.addEventListener("click", function () {
+ frame.classList.add("is-playing");
+ var p = video.play();
+ if (p && p.catch) p.catch(function () { frame.classList.remove("is-playing"); });
+ video.focus({ preventScroll: true });
+ });
+ }
+ video.addEventListener("play", function () { frame.classList.add("is-playing"); });
+ video.addEventListener("ended", function () { frame.classList.remove("is-playing"); });
+ }
+
+ /* ---------- Radio groups (roving focus) ---------- */
+
+ function radioGroup(group, onChange) {
+ var radios = $$('[role="radio"]', group);
+ function select(r, focus) {
+ radios.forEach(function (x) {
+ var on = x === r;
+ x.setAttribute("aria-checked", on ? "true" : "false");
+ x.tabIndex = on ? 0 : -1;
+ });
+ if (focus) r.focus();
+ onChange(r);
+ }
+ radios.forEach(function (r) {
+ r.tabIndex = r.getAttribute("aria-checked") === "true" ? 0 : -1;
+ r.addEventListener("click", function () { select(r, false); });
+ r.addEventListener("keydown", function (e) {
+ var i = radios.indexOf(r);
+ var next = null;
+ if (e.key === "ArrowRight" || e.key === "ArrowDown") next = radios[(i + 1) % radios.length];
+ if (e.key === "ArrowLeft" || e.key === "ArrowUp") next = radios[(i - 1 + radios.length) % radios.length];
+ if (next) { e.preventDefault(); select(next, true); }
+ });
+ });
+ return {
+ set: function (value, attr) {
+ var r = radios.filter(function (x) { return x.getAttribute(attr) === value; })[0];
+ if (r) select(r, false);
+ },
+ };
+ }
+
+ /* ---------- Hero preview ---------- */
+
+ // What the "voice" says. Deliberately full of the jargon people dictate into coding tools.
+ var SAMPLES = [
+ "Rename fetchSessionToken to refreshAccessToken, and make the retry backoff exponential with jitter. Leave the Keychain code alone.",
+ "Add a Vitest case for the no-speech path in useDictation, and mock MediaRecorder so CI stays green.",
+ "Write a migration that backfills user_id on the events table in batches of five thousand. Keep it idempotent.",
+ ];
+
+ var ICON = {
+ x: '<svg class="i" aria-hidden="true"><use href="#i-regular-x"/></svg>',
+ stop: '<svg class="i" aria-hidden="true"><use href="#i-fill-stop"/></svg>',
+ ok: '<svg class="i ok" aria-hidden="true"><use href="#i-fill-check-circle"/></svg>',
+ clip: '<svg class="i muted-icon" aria-hidden="true"><use href="#i-regular-clipboard-text"/></svg>',
+ silent: '<svg class="i muted-icon" aria-hidden="true"><use href="#i-regular-waveform-slash"/></svg>',
+ };
+ var WEIGHTS = [0.55, 0.8, 1, 0.8, 0.55]; // same bar shape as the app's level meter
+
+ function initDemo() {
+ var demo = $("#demo");
+ if (!demo) return;
+
+ var el = {
+ pill: $("#pill"),
+ inner: $("#pill-inner"),
+ keys: $("#keys"),
+ keysHint: $("#keys-hint"),
+ voice: $("#voice-text"),
+ composer: $("#composer-text"),
+ pasteBtn: $("#paste-btn"),
+ live: $("#demo-live"),
+ settingsBtn: $("#demo-settings-btn"),
+ settings: $("#demo-settings"),
+ reset: $("#demo-reset"),
+ pasteSwitch: $("#paste-switch"),
+ };
+
+ var DEFAULTS = { scenario: "talk", autoPaste: true, theme: "system", accent: "graphite" };
+ var s = {}; // runtime state, filled by reset()
+ var timers = [];
+ var ticker = null;
+
+ function later(fn, ms) { var t = setTimeout(fn, ms); timers.push(t); return t; }
+ function clearTimers() {
+ timers.forEach(clearTimeout); timers = [];
+ if (ticker) { clearInterval(ticker); ticker = null; }
+ }
+
+ function announce(text) {
+ el.live.textContent = "";
+ requestAnimationFrame(function () { el.live.textContent = text; });
+ }
+
+ function setState(name) {
+ s.state = name;
+ demo.setAttribute("data-state", name);
+ var recording = name === "recording";
+ el.keys.setAttribute("aria-label", recording
+ ? "Stop and transcribe (Control Option Space)"
+ : "Start dictation (Control Option Space)");
+ el.keysHint.textContent = recording ? "Press again" : "Try it";
+ }
+
+ /* Pill: one surface that resizes between states, like the app's overlay. */
+ function renderPill(html, opts) {
+ opts = opts || {};
+ var pill = el.pill, inner = el.inner;
+ // Visibility is class-based (.is-hidden) so the fade-out can run. Clear any stray hidden
+ // attribute first: display:none would also make the measurements below read zero.
+ pill.hidden = false;
+ var wasHidden = pill.classList.contains("is-hidden");
+ var from = pill.getBoundingClientRect();
+ inner.className = "pill-inner" + (opts.card ? " notice" : "");
+ inner.innerHTML = html;
+ pill.classList.toggle("is-card", !!opts.card);
+ var toW = inner.offsetWidth + 2;
+ var toH = inner.offsetHeight + 2;
+ if (wasHidden || reduceMotion.matches) {
+ pill.style.width = toW + "px";
+ pill.style.height = toH + "px";
+ } else {
+ pill.style.width = from.width + "px";
+ pill.style.height = from.height + "px";
+ void pill.offsetWidth; // commit the start size before animating
+ pill.style.width = toW + "px";
+ pill.style.height = toH + "px";
+ }
+ inner.classList.remove("enter");
+ void inner.offsetWidth;
+ if (!wasHidden) inner.classList.add("enter");
+ pill.classList.remove("is-hidden");
+ }
+ function hidePill() { el.pill.classList.add("is-hidden"); }
+
+ function fmt(sec) {
+ sec = Math.floor(sec);
+ return Math.floor(sec / 60) + ":" + (sec % 60 < 10 ? "0" : "") + (sec % 60);
+ }
+
+ function meterHTML() {
+ return '<span class="meter" aria-hidden="true">' + WEIGHTS.map(function () { return "<i></i>"; }).join("") + "</span>";
+ }
+
+ function renderRecording() {
+ renderPill(
+ '<span class="rec-dot" role="img" aria-label="Recording"></span>' +
+ meterHTML() +
+ '<span class="time">0:00</span>' +
+ '<button type="button" class="p-btn" data-act="cancel" aria-label="Cancel dictation">' + ICON.x + "</button>" +
+ '<button type="button" class="p-btn p-btn-stop" data-act="stop" aria-label="Stop and transcribe">' + ICON.stop + "</button>"
+ );
+ }
+
+ function renderWorking(label, cancellable) {
+ renderPill(
+ '<span class="spinner" aria-hidden="true"></span>' +
+ '<span class="label label-min">' + label + "</span>" +
+ (cancellable
+ ? '<button type="button" class="p-btn" data-act="cancel" aria-label="Cancel dictation">' + ICON.x + "</button>"
+ : '<span style="width:6px"></span>')
+ );
+ }
+
+ function renderMessage(icon, label) {
+ renderPill(icon + '<span class="label" style="padding-right:8px">' + label + "</span>");
+ }
+
+ function renderNotice() {
+ renderPill(
+ ICON.clip +
+ "<strong>Copied to clipboard</strong>" +
+ "<span>Press ⌘V to paste.</span>",
+ { card: true }
+ );
+ }
+
+ // Level meter and timer. Levels are scripted: they follow the simulated words, not a microphone.
+ function setLevels(levels) {
+ var bars = $$(".meter i", el.inner);
+ bars.forEach(function (b, i) { b.style.setProperty("--h", String(levels[i])); });
+ }
+ function tick() {
+ var t = (performance.now() - s.t0) / 1000;
+ var time = $(".time", el.inner);
+ if (time) time.textContent = fmt(t);
+ var talking = s.scenario === "talk" && s.spoken < s.words.length && s.spoken > 0;
+ var base = talking ? 0.35 + 0.6 * Math.abs(Math.sin(t * 7.3) * Math.sin(t * 2.3 + s.spoken)) : 0.06;
+ setLevels(WEIGHTS.map(function (w, i) {
+ var jitter = talking ? 0.12 * Math.sin(t * 11 + i * 1.7) : 0;
+ return Math.max(0.12, Math.min(1, w * (base + jitter)));
+ }));
+ if (t > 30) stop(); // safety cap for a forgotten preview
+ }
+
+ function renderComposer() {
+ var c = el.composer;
+ c.textContent = "";
+ if (!s.segments.length) {
+ c.insertAdjacentHTML("beforeend", '<span class="caret" aria-hidden="true"></span><span class="placeholder">Ask anything</span>');
+ return;
+ }
+ s.segments.forEach(function (seg, i) {
+ if (i > 0) c.appendChild(document.createTextNode(" "));
+ var span = document.createElement("span");
+ span.textContent = seg.text;
+ if (seg.fresh) { span.className = "pasted"; seg.fresh = false; }
+ c.appendChild(span);
+ });
+ c.insertAdjacentHTML("beforeend", '<span class="caret" aria-hidden="true"></span>');
+ c.scrollTop = c.scrollHeight;
+ }
+
+ function insertText(text) {
+ s.segments.push({ text: text, fresh: true });
+ renderComposer();
+ }
+
+ function showPasteButton(on) { el.pasteBtn.hidden = !on; }
+
+ /* Flow */
+
+ function start() {
+ clearTimers();
+ setState("recording");
+ s.words = SAMPLES[s.run % SAMPLES.length].split(" ");
+ s.spoken = 0;
+ s.t0 = performance.now();
+ el.voice.textContent = "";
+ renderRecording();
+ announce("Recording");
+ ticker = setInterval(tick, reduceMotion.matches ? 250 : 80);
+ tick();
+
+ if (s.scenario === "silent") {
+ el.voice.textContent = "…";
+ return;
+ }
+ var at = 450;
+ s.words.forEach(function (word) {
+ later(function () {
+ s.spoken += 1;
+ var span = document.createElement("span");
+ span.className = "w";
+ span.textContent = (s.spoken > 1 ? " " : "") + word;
+ el.voice.appendChild(span);
+ }, at);
+ at += 300 + (/[,.]$/.test(word) ? 260 : 0);
+ });
+ }
+
+ function stop() {
+ if (s.state !== "recording") return;
+ clearTimers();
+ var text = s.scenario === "talk" ? s.words.slice(0, s.spoken).join(" ") : "";
+ setState("transcribing");
+ renderWorking("Transcribing", true);
+ announce("Transcribing");
+ later(function () {
+ if (!text) {
+ setState("nospeech");
+ renderMessage(ICON.silent, "No speech found");
+ announce("No speech found");
+ later(finish, 2600);
+ return;
+ }
+ s.run += 1;
+ if (s.autoPaste) {
+ setState("pasting");
+ renderWorking("Pasting", false);
+ later(function () {
+ insertText(text);
+ setState("pasted");
+ renderMessage(ICON.ok, "Pasted");
+ announce("Pasted into the demo workspace. Not sent.");
+ later(finish, 1800);
+ }, 380);
+ } else {
+ s.clipboard = text;
+ showPasteButton(true);
+ setState("copied");
+ // First time: the help card stays longer. After that, the short message hides after 3s, like the app.
+ var firstHelp = !s.helpShown;
+ if (firstHelp) {
+ s.helpShown = true;
+ renderNotice();
+ } else {
+ renderMessage(ICON.clip, "Press ⌘V to paste");
+ }
+ announce("Copied to clipboard. Press Command V, or use the Paste button, to paste.");
+ later(finish, firstHelp ? 9000 : 3000);
+ }
+ }, 1050);
+ }
+
+ function cancel() {
+ if (s.state !== "recording" && s.state !== "transcribing") return;
+ clearTimers();
+ el.voice.textContent = "";
+ setState("idle");
+ hidePill();
+ announce("Dictation cancelled");
+ }
+
+ function finish() {
+ setState("idle");
+ hidePill();
+ }
+
+ function toggle() {
+ if (s.state === "recording") stop();
+ else if (s.state === "transcribing" || s.state === "pasting") return;
+ else start();
+ }
+
+ function manualPaste() {
+ if (!s.clipboard) return false;
+ insertText(s.clipboard);
+ s.clipboard = null;
+ showPasteButton(false);
+ if (s.state === "copied") { clearTimers(); finish(); }
+ announce("Pasted into the demo workspace. Not sent.");
+ return true;
+ }
+
+ /* Settings */
+
+ var scenarioGroup = radioGroup($('[aria-labelledby="lbl-scenario"]', demo), function (r) {
+ s.scenario = r.getAttribute("data-scenario");
+ });
+ var themeGroup = radioGroup($('[aria-labelledby="lbl-theme"]', demo), function (r) {
+ s.theme = r.getAttribute("data-theme-choice");
+ demo.setAttribute("data-theme", s.theme);
+ });
+ var accentGroup = radioGroup($('[aria-labelledby="lbl-accent"]', demo), function (r) {
+ s.accent = r.getAttribute("data-accent-choice");
+ document.documentElement.setAttribute("data-accent", s.accent);
+ $$("[data-accent-try]").forEach(function (b) {
+ b.setAttribute("aria-pressed", b.getAttribute("data-accent-try") === s.accent ? "true" : "false");
+ });
+ });
+ $$("[data-accent-try]").forEach(function (b) {
+ b.addEventListener("click", function () { accentGroup.set(b.getAttribute("data-accent-try"), "data-accent-choice"); });
+ });
+
+ function setAutoPaste(on) {
+ s.autoPaste = on;
+ el.pasteSwitch.setAttribute("aria-checked", on ? "true" : "false");
+ }
+ el.pasteSwitch.addEventListener("click", function () { setAutoPaste(!s.autoPaste); });
+
+ function setSettingsOpen(open) {
+ el.settings.hidden = !open;
+ el.settingsBtn.setAttribute("aria-expanded", open ? "true" : "false");
+ }
+ el.settingsBtn.addEventListener("click", function () { setSettingsOpen(el.settings.hidden); });
+ document.addEventListener("click", function (e) {
+ if (el.settings.hidden) return;
+ if (el.settings.contains(e.target) || el.settingsBtn.contains(e.target)) return;
+ setSettingsOpen(false);
+ });
+
+ function reset(quiet) {
+ clearTimers();
+ s = { state: "idle", run: 0, segments: [], clipboard: null, helpShown: false, words: [], spoken: 0, t0: 0 };
+ scenarioGroup.set(DEFAULTS.scenario, "data-scenario");
+ themeGroup.set(DEFAULTS.theme, "data-theme-choice");
+ accentGroup.set(DEFAULTS.accent, "data-accent-choice");
+ setAutoPaste(DEFAULTS.autoPaste);
+ setSettingsOpen(false);
+ el.voice.textContent = "";
+ showPasteButton(false);
+ setState("idle");
+ hidePill();
+ renderComposer();
+ if (!quiet) announce("Preview reset");
+ }
+ el.reset.addEventListener("click", function () { reset(false); });
+
+ /* Input */
+
+ el.keys.addEventListener("click", toggle);
+ el.pasteBtn.addEventListener("click", manualPaste);
+ el.pill.addEventListener("click", function (e) {
+ var b = e.target.closest("[data-act]");
+ if (!b) return;
+ if (b.getAttribute("data-act") === "stop") stop();
+ if (b.getAttribute("data-act") === "cancel") cancel();
+ });
+
+ function isTextInput(t) {
+ return t && (t.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName));
+ }
+
+ document.addEventListener("keydown", function (e) {
+ if (e.ctrlKey && e.altKey && !e.metaKey && e.code === "Space") {
+ e.preventDefault();
+ if (!e.repeat) { el.keys.classList.add("is-down"); toggle(); }
+ return;
+ }
+ if (e.key === "Escape") {
+ if (!el.settings.hidden) { setSettingsOpen(false); el.settingsBtn.focus(); return; }
+ if (s.state === "recording" || s.state === "transcribing") { e.preventDefault(); cancel(); }
+ return;
+ }
+ if ((e.metaKey || e.ctrlKey) && !e.altKey && (e.key === "v" || e.key === "V") && s.clipboard && !isTextInput(e.target)) {
+ e.preventDefault();
+ manualPaste();
+ }
+ });
+ document.addEventListener("keyup", function (e) {
+ if (e.code === "Space" || e.key === "Control" || e.key === "Alt") el.keys.classList.remove("is-down");
+ });
+ window.addEventListener("blur", function () { el.keys.classList.remove("is-down"); });
+
+ reset(true);
+
+ /* ?demo=recording|transcribing|pasted|copied|notice|nospeech|settings freezes a state for screenshots and QA. */
+ var freeze = new URLSearchParams(location.search).get("demo");
+ if (freeze) freezeState(freeze);
+
+ function freezeState(name) {
+ var words = SAMPLES[0].split(" ");
+ if (name === "settings") { setSettingsOpen(true); return; }
+ if (name === "recording") {
+ setState("recording");
+ renderRecording();
+ el.voice.textContent = words.slice(0, 9).join(" ");
+ $(".time", el.inner).textContent = "0:04";
+ setLevels([0.5, 0.75, 0.95, 0.7, 0.45]);
+ } else if (name === "transcribing") {
+ setState("transcribing");
+ renderWorking("Transcribing", true);
+ } else if (name === "pasted") {
+ s.segments.push({ text: SAMPLES[0], fresh: false });
+ renderComposer();
+ setState("pasted");
+ renderMessage(ICON.ok, "Pasted");
+ } else if (name === "copied") {
+ s.clipboard = SAMPLES[0]; s.helpShown = true;
+ showPasteButton(true);
+ setState("copied");
+ renderMessage(ICON.clip, "Press ⌘V to paste");
+ } else if (name === "notice") {
+ s.clipboard = SAMPLES[0]; s.helpShown = true;
+ showPasteButton(true);
+ setState("copied");
+ renderNotice();
+ } else if (name === "nospeech") {
+ setState("nospeech");
+ renderMessage(ICON.silent, "No speech found");
+ }
+ }
+ }
+
+ /* ---------- Boot ---------- */
+
+ applyConfig();
+ initHeader();
+ initReveal();
+ initFilm();
+ initDemo();
+})();
diff --git a/website/dist/assets/LICENSE-phosphor.txt b/website/dist/assets/LICENSE-phosphor.txt
new file mode 100644
index 0000000..78c9810
--- /dev/null
+++ b/website/dist/assets/LICENSE-phosphor.txt
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2023 Phosphor Icons
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/website/dist/assets/app-icon-512.png b/website/dist/assets/app-icon-512.png
new file mode 100644
index 0000000..117ee57
Binary files /dev/null and b/website/dist/assets/app-icon-512.png differ
diff --git a/website/dist/assets/apple-touch-icon.png b/website/dist/assets/apple-touch-icon.png
new file mode 100644
index 0000000..f50e576
Binary files /dev/null and b/website/dist/assets/apple-touch-icon.png differ
diff --git a/website/dist/assets/gpt-voice-promo.mp4 b/website/dist/assets/gpt-voice-promo.mp4
new file mode 100644
index 0000000..c6d4200
Binary files /dev/null and b/website/dist/assets/gpt-voice-promo.mp4 differ
diff --git a/website/dist/assets/promo-poster.jpg b/website/dist/assets/promo-poster.jpg
new file mode 100644
index 0000000..a671e55
Binary files /dev/null and b/website/dist/assets/promo-poster.jpg differ
diff --git a/website/dist/assets/shots/appearance-dark.png b/website/dist/assets/shots/appearance-dark.png
new file mode 100644
index 0000000..b3d856e
Binary files /dev/null and b/website/dist/assets/shots/appearance-dark.png differ
diff --git a/website/dist/assets/shots/onboarding-dark.png b/website/dist/assets/shots/onboarding-dark.png
new file mode 100644
index 0000000..c09b32e
Binary files /dev/null and b/website/dist/assets/shots/onboarding-dark.png differ
diff --git a/website/dist/assets/shots/privacy-light.png b/website/dist/assets/shots/privacy-light.png
new file mode 100644
index 0000000..68b8dea
Binary files /dev/null and b/website/dist/assets/shots/privacy-light.png differ
diff --git a/website/dist/assets/shots/shortcut-dark.png b/website/dist/assets/shots/shortcut-dark.png
new file mode 100644
index 0000000..7ed28f2
Binary files /dev/null and b/website/dist/assets/shots/shortcut-dark.png differ
diff --git a/website/dist/assets/social-preview.png b/website/dist/assets/social-preview.png
new file mode 100644
index 0000000..15214d6
Binary files /dev/null and b/website/dist/assets/social-preview.png differ
diff --git a/website/dist/config.js b/website/dist/config.js
new file mode 100644
index 0000000..fe12f47
--- /dev/null
+++ b/website/dist/config.js
@@ -0,0 +1,17 @@
+/* Enable releaseReady only after the signed, notarized DMG is published.
+ * Pending download buttons point to the install section. */
+window.GPTV_CONFIG = {
+ releaseReady: false,
+
+ // Leave empty until a public binary release is ready.
+ version: "",
+
+ repoUrl: "https://github.com/entropyconquers/gpt-voice",
+ releaseUrl: "https://github.com/entropyconquers/gpt-voice/releases/latest",
+ dmgUrl: "https://github.com/entropyconquers/gpt-voice/releases/latest/download/GPT-Voice.dmg",
+
+ video: {
+ src: "assets/gpt-voice-promo.mp4",
+ poster: "assets/promo-poster.jpg",
+ },
+};
diff --git a/website/dist/favicon.svg b/website/dist/favicon.svg
new file mode 100644
index 0000000..db91414
--- /dev/null
+++ b/website/dist/favicon.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><linearGradient id="g" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2B2B2D"/><stop offset="1" stop-color="#1D1D1F"/></linearGradient></defs><rect width="100" height="100" rx="22.6" fill="url(#g)"/><g fill="#EBEBEB"><rect x="18.3" y="39.8" width="7.45" height="20.3" rx="3.72"/><rect x="32.3" y="30.5" width="7.45" height="39" rx="3.72"/><rect x="46.4" y="22.7" width="7.45" height="54.7" rx="3.72"/><rect x="60.4" y="32.8" width="7.45" height="34.5" rx="3.72"/><rect x="74.3" y="41.4" width="7.45" height="17.2" rx="3.72"/></g></svg>
diff --git a/website/dist/fonts/FTRegolaNeue-Medium.woff2 b/website/dist/fonts/FTRegolaNeue-Medium.woff2
new file mode 100644
index 0000000..76a18dd
Binary files /dev/null and b/website/dist/fonts/FTRegolaNeue-Medium.woff2 differ
diff --git a/website/dist/fonts/FTRegolaNeue-Regular.woff2 b/website/dist/fonts/FTRegolaNeue-Regular.woff2
new file mode 100644
index 0000000..777a4ff
Binary files /dev/null and b/website/dist/fonts/FTRegolaNeue-Regular.woff2 differ
diff --git a/website/dist/fonts/FTRegolaNeue-Semibold.woff2 b/website/dist/fonts/FTRegolaNeue-Semibold.woff2
new file mode 100644
index 0000000..0177e82
Binary files /dev/null and b/website/dist/fonts/FTRegolaNeue-Semibold.woff2 differ
diff --git a/website/dist/index.html b/website/dist/index.html
new file mode 100644
index 0000000..463845d
--- /dev/null
+++ b/website/dist/index.html
@@ -0,0 +1,431 @@
+<!doctype html>
+<html lang="en" data-accent="graphite">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
+ <title>GPT Voice — Dictate into any app on your Mac</title>
+ <meta name="description" content="GPT Voice is a free, open-source Mac menu bar app. Press a shortcut, talk, and your words land where your cursor is.">
+ <meta name="color-scheme" content="light dark">
+ <meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)">
+ <meta name="theme-color" content="#111112" media="(prefers-color-scheme: dark)">
+
+ <link rel="canonical" href="https://gpt-voice.astralcod128.chatgpt.site/">
+ <meta property="og:url" content="https://gpt-voice.astralcod128.chatgpt.site/">
+ <meta property="og:type" content="website">
+ <meta property="og:site_name" content="GPT Voice">
+ <meta property="og:title" content="GPT Voice — Dictate into any app on your Mac">
+ <meta property="og:description" content="Press a shortcut, talk, press it again. Your words land where your cursor is. Free and open source.">
+ <meta property="og:image" content="https://gpt-voice.astralcod128.chatgpt.site/assets/social-preview.png">
+ <meta property="og:image:width" content="1280">
+ <meta property="og:image:height" content="640">
+ <meta name="twitter:card" content="summary_large_image">
+
+ <link rel="icon" href="favicon.svg" type="image/svg+xml">
+ <link rel="apple-touch-icon" href="assets/apple-touch-icon.png">
+ <link rel="preload" href="fonts/FTRegolaNeue-Medium.woff2" as="font" type="font/woff2" crossorigin>
+ <link rel="stylesheet" href="styles.css">
+ <script>document.documentElement.classList.add("js")</script>
+ <script src="config.js"></script>
+ <script src="app.js" defer></script>
+</head>
+<body>
+<svg width="0" height="0" class="sr-only" aria-hidden="true"><!-- Phosphor Icons 2.1.1 (MIT), see CREDITS.txt -->
+<symbol id="i-fill-check-circle" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,85.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z"/></symbol>
+<symbol id="i-fill-play" viewBox="0 0 256 256"><path d="M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z"/></symbol>
+<symbol id="i-fill-star" viewBox="0 0 256 256"><path d="M234.29,114.85l-45,38.83L203,211.75a16.4,16.4,0,0,1-24.5,17.82L128,198.49,77.47,229.57A16.4,16.4,0,0,1,53,211.75l13.76-58.07-45-38.83A16.46,16.46,0,0,1,31.08,86l59-4.76,22.76-55.08a16.36,16.36,0,0,1,30.27,0l22.75,55.08,59,4.76a16.46,16.46,0,0,1,9.37,28.86Z"/></symbol>
+<symbol id="i-fill-stop" viewBox="0 0 256 256"><path d="M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z"/></symbol>
+<symbol id="i-regular-arrow-counter-clockwise" viewBox="0 0 256 256"><path d="M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"/></symbol>
+<symbol id="i-regular-arrow-u-down-left" viewBox="0 0 256 256"><path d="M232,112a64.07,64.07,0,0,1-64,64H51.31l34.35,34.34a8,8,0,0,1-11.32,11.32l-48-48a8,8,0,0,1,0-11.32l48-48a8,8,0,0,1,11.32,11.32L51.31,160H168a48,48,0,0,0,0-96H80a8,8,0,0,1,0-16h88A64.07,64.07,0,0,1,232,112Z"/></symbol>
+<symbol id="i-regular-arrow-up" viewBox="0 0 256 256"><path d="M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z"/></symbol>
+<symbol id="i-regular-caret-down" viewBox="0 0 256 256"><path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"/></symbol>
+<symbol id="i-regular-circle-half" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm8,16.37a86.4,86.4,0,0,1,16,3V212.67a86.4,86.4,0,0,1-16,3Zm32,9.26a87.81,87.81,0,0,1,16,10.54V195.83a87.81,87.81,0,0,1-16,10.54ZM40,128a88.11,88.11,0,0,1,80-87.63V215.63A88.11,88.11,0,0,1,40,128Zm160,50.54V77.46a87.82,87.82,0,0,1,0,101.08Z"/></symbol>
+<symbol id="i-regular-clipboard-text" viewBox="0 0 256 256"><path d="M168,152a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,152Zm-8-40H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16Zm56-64V216a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V48A16,16,0,0,1,56,32H92.26a47.92,47.92,0,0,1,71.48,0H200A16,16,0,0,1,216,48ZM96,64h64a32,32,0,0,0-64,0ZM200,48H173.25A47.93,47.93,0,0,1,176,64v8a8,8,0,0,1-8,8H88a8,8,0,0,1-8-8V64a47.93,47.93,0,0,1,2.75-16H56V216H200Z"/></symbol>
+<symbol id="i-regular-cpu" viewBox="0 0 256 256"><path d="M152,96H104a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V104A8,8,0,0,0,152,96Zm-8,48H112V112h32Zm88,0H216V112h16a8,8,0,0,0,0-16H216V56a16,16,0,0,0-16-16H160V24a8,8,0,0,0-16,0V40H112V24a8,8,0,0,0-16,0V40H56A16,16,0,0,0,40,56V96H24a8,8,0,0,0,0,16H40v32H24a8,8,0,0,0,0,16H40v40a16,16,0,0,0,16,16H96v16a8,8,0,0,0,16,0V216h32v16a8,8,0,0,0,16,0V216h40a16,16,0,0,0,16-16V160h16a8,8,0,0,0,0-16Zm-32,56H56V56H200v95.87s0,.09,0,.13,0,.09,0,.13V200Z"/></symbol>
+<symbol id="i-regular-desktop" viewBox="0 0 256 256"><path d="M208,40H48A24,24,0,0,0,24,64V176a24,24,0,0,0,24,24h72v16H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16H136V200h72a24,24,0,0,0,24-24V64A24,24,0,0,0,208,40ZM48,56H208a8,8,0,0,1,8,8v80H40V64A8,8,0,0,1,48,56ZM208,184H48a8,8,0,0,1-8-8V160H216v16A8,8,0,0,1,208,184Z"/></symbol>
+<symbol id="i-regular-download-simple" viewBox="0 0 256 256"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"/></symbol>
+<symbol id="i-regular-github-logo" viewBox="0 0 256 256"><path d="M208.31,75.68A59.78,59.78,0,0,0,202.93,28,8,8,0,0,0,196,24a59.75,59.75,0,0,0-48,24H124A59.75,59.75,0,0,0,76,24a8,8,0,0,0-6.93,4,59.78,59.78,0,0,0-5.38,47.68A58.14,58.14,0,0,0,56,104v8a56.06,56.06,0,0,0,48.44,55.47A39.8,39.8,0,0,0,96,192v8H72a24,24,0,0,1-24-24A40,40,0,0,0,8,136a8,8,0,0,0,0,16,24,24,0,0,1,24,24,40,40,0,0,0,40,40H96v16a8,8,0,0,0,16,0V192a24,24,0,0,1,48,0v40a8,8,0,0,0,16,0V192a39.8,39.8,0,0,0-8.44-24.53A56.06,56.06,0,0,0,216,112v-8A58.14,58.14,0,0,0,208.31,75.68ZM200,112a40,40,0,0,1-40,40H112a40,40,0,0,1-40-40v-8a41.74,41.74,0,0,1,6.9-22.48A8,8,0,0,0,80,73.83a43.81,43.81,0,0,1,.79-33.58,43.88,43.88,0,0,1,32.32,20.06A8,8,0,0,0,119.82,64h32.35a8,8,0,0,0,6.74-3.69,43.87,43.87,0,0,1,32.32-20.06A43.81,43.81,0,0,1,192,73.83a8.09,8.09,0,0,0,1,7.65A41.72,41.72,0,0,1,200,104Z"/></symbol>
+<symbol id="i-regular-lock-simple" viewBox="0 0 256 256"><path d="M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"/></symbol>
+<symbol id="i-regular-microphone-slash" viewBox="0 0 256 256"><path d="M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z"/></symbol>
+<symbol id="i-regular-microphone" viewBox="0 0 256 256"><path d="M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"/></symbol>
+<symbol id="i-regular-moon" viewBox="0 0 256 256"><path d="M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z"/></symbol>
+<symbol id="i-regular-quotes" viewBox="0 0 256 256"><path d="M100,56H40A16,16,0,0,0,24,72v64a16,16,0,0,0,16,16h60v8a32,32,0,0,1-32,32,8,8,0,0,0,0,16,48.05,48.05,0,0,0,48-48V72A16,16,0,0,0,100,56Zm0,80H40V72h60ZM216,56H156a16,16,0,0,0-16,16v64a16,16,0,0,0,16,16h60v8a32,32,0,0,1-32,32,8,8,0,0,0,0,16,48.05,48.05,0,0,0,48-48V72A16,16,0,0,0,216,56Zm0,80H156V72h60Z"/></symbol>
+<symbol id="i-regular-sliders-horizontal" viewBox="0 0 256 256"><path d="M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z"/></symbol>
+<symbol id="i-regular-star" viewBox="0 0 256 256"><path d="M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z"/></symbol>
+<symbol id="i-regular-sun" viewBox="0 0 256 256"><path d="M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"/></symbol>
+<symbol id="i-regular-terminal-window" viewBox="0 0 256 256"><path d="M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z"/></symbol>
+<symbol id="i-regular-waveform-slash" viewBox="0 0 256 256"><path d="M56,96v64a8,8,0,0,1-16,0V96a8,8,0,0,1,16,0ZM53.92,34.62A8,8,0,1,0,42.08,45.38L80,87.09V224a8,8,0,0,0,16,0V104.69l24,26.4V192a8,8,0,0,0,16,0V148.69l66.08,72.69a8,8,0,1,0,11.84-10.76ZM88,44.43a8,8,0,0,0,8-8V32a8,8,0,0,0-16,0v4.43A8,8,0,0,0,88,44.43Zm40,44a8,8,0,0,0,8-8V64a8,8,0,0,0-16,0V80.43A8,8,0,0,0,128,88.43Zm40,44a8,8,0,0,0,8-8V96a8,8,0,0,0-16,0v28.43A8,8,0,0,0,168,132.43ZM208,72a8,8,0,0,0-8,8v88.43a8,8,0,0,0,16,0V80A8,8,0,0,0,208,72Z"/></symbol>
+<symbol id="i-regular-x" viewBox="0 0 256 256"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"/></symbol>
+</svg>
+
+<a class="skip" href="#main">Skip to content</a>
+
+<header class="site-header">
+ <div class="wrap header-row">
+ <a class="brand" href="#top" aria-label="GPT Voice home">
+ <svg class="brand-mark" viewBox="0 0 100 100" aria-hidden="true">
+ <rect width="100" height="100" rx="22.6"/>
+ <rect class="b" x="18.3" y="39.8" width="7.45" height="20.3" rx="3.72"/>
+ <rect class="b" x="32.3" y="30.5" width="7.45" height="39" rx="3.72"/>
+ <rect class="b" x="46.4" y="22.7" width="7.45" height="54.7" rx="3.72"/>
+ <rect class="b" x="60.4" y="32.8" width="7.45" height="34.5" rx="3.72"/>
+ <rect class="b" x="74.3" y="41.4" width="7.45" height="17.2" rx="3.72"/>
+ </svg>
+ <span>GPT Voice</span>
+ </a>
+ <nav class="nav" aria-label="Sections">
+ <a href="#features">Features</a>
+ <a href="#film">Film</a>
+ <a href="#install">Install</a>
+ </nav>
+ <div class="header-actions">
+ <a class="btn btn-quiet btn-sm btn-icon-sm" data-link="repo" href="https://github.com/entropyconquers/gpt-voice" aria-label="GPT Voice on GitHub">
+ <svg class="i" aria-hidden="true"><use href="#i-regular-github-logo"/></svg>
+ </a>
+ <a class="btn btn-ink btn-sm dl" data-link="download" href="#install">
+ <svg class="i dl-icon" aria-hidden="true"><use href="#i-regular-download-simple"/></svg>
+ <span>Download</span>
+ </a>
+ </div>
+ </div>
+</header>
+
+<main id="main">
+
+ <!-- Hero -->
+ <section class="hero" id="top" aria-labelledby="hero-title">
+ <div class="wrap hero-head">
+ <img class="hero-icon" src="assets/app-icon-512.png" width="88" height="88" alt="">
+ <h1 id="hero-title" class="display">Dictate into any&nbsp;app.</h1>
+ <p class="lede">Press a shortcut, talk, and your words land at the&nbsp;cursor.</p>
+
+ <div class="cta-row">
+ <a class="btn btn-ink btn-lg dl" data-link="download" href="#install">
+ <svg class="i dl-icon" aria-hidden="true"><use href="#i-regular-download-simple"/></svg>
+ <span>Download for Mac</span>
+ </a>
+ <a class="btn btn-quiet btn-lg star" data-link="repo" href="https://github.com/entropyconquers/gpt-voice">
+ <svg class="i" aria-hidden="true"><use href="#i-regular-github-logo"/></svg>
+ <span>Star on GitHub</span>
+ <span class="star-icon" aria-hidden="true">
+ <svg class="i"><use href="#i-regular-star"/></svg>
+ <svg class="i i-fill"><use href="#i-fill-star"/></svg>
+ </span>
+ </a>
+ </div>
+
+ <ul class="tokens" aria-label="Requirements">
+ <li><svg class="i" aria-hidden="true"><use href="#i-regular-desktop"/></svg>macOS 13+</li>
+ <li><svg class="i" aria-hidden="true"><use href="#i-regular-cpu"/></svg><span data-version></span>Apple Silicon &amp; Intel</li>
+ <li data-when="pending"><a href="#install"><span class="dot" aria-hidden="true"></span>Coming soon</a></li>
+ </ul>
+ </div>
+
+ <!-- Interactive demo -->
+ <div class="wrap">
+ <div class="demo" id="demo" data-theme="system" data-state="idle" role="region" aria-label="Try GPT Voice" aria-describedby="demo-desc">
+ <p class="sr-only" id="demo-desc">A scripted demo. No microphone or network is used. Press the keys below or Control Option Space to start and stop.</p>
+
+ <div class="stage">
+ <div class="menubar">
+ <span class="mb-left" aria-hidden="true"><b>scratch</b><span>File</span><span>Edit</span><span class="hide-xs">View</span></span>
+ <span class="mb-right">
+ <span class="mb-app" aria-hidden="true">
+ <svg viewBox="0 0 100 100"><rect class="b" x="14" y="38" width="10" height="24" rx="5"/><rect class="b" x="31" y="26" width="10" height="48" rx="5"/><rect class="b" x="48" y="14" width="10" height="72" rx="5"/><rect class="b" x="65" y="28" width="10" height="44" rx="5"/><rect class="b" x="82" y="40" width="10" height="20" rx="5"/></svg>
+ </span>
+ <button class="mb-btn" type="button" id="demo-settings-btn" aria-expanded="false" aria-controls="demo-settings" aria-label="Demo settings">
+ <svg class="i" aria-hidden="true"><use href="#i-regular-sliders-horizontal"/></svg>
+ </button>
+ <button class="mb-btn" type="button" id="demo-reset" aria-label="Reset demo">
+ <svg class="i" aria-hidden="true"><use href="#i-regular-arrow-counter-clockwise"/></svg>
+ </button>
+ <span class="mb-clock" aria-hidden="true">9:41</span>
+ </span>
+ </div>
+
+ <div class="settings" id="demo-settings" hidden>
+ <div class="set-row">
+ <span class="set-label" id="lbl-theme">Theme</span>
+ <div class="seg seg-icons" role="radiogroup" aria-labelledby="lbl-theme">
+ <button type="button" role="radio" aria-checked="true" data-theme-choice="system" aria-label="System"><svg class="i" aria-hidden="true"><use href="#i-regular-circle-half"/></svg></button>
+ <button type="button" role="radio" aria-checked="false" data-theme-choice="light" aria-label="Light"><svg class="i" aria-hidden="true"><use href="#i-regular-sun"/></svg></button>
+ <button type="button" role="radio" aria-checked="false" data-theme-choice="dark" aria-label="Dark"><svg class="i" aria-hidden="true"><use href="#i-regular-moon"/></svg></button>
+ </div>
+ </div>
+ <div class="set-row">
+ <span class="set-label" id="lbl-accent">Accent</span>
+ <div class="swatches" role="radiogroup" aria-labelledby="lbl-accent">
+ <button type="button" role="radio" aria-checked="true" data-accent-choice="graphite" aria-label="Graphite"></button>
+ <button type="button" role="radio" aria-checked="false" data-accent-choice="blue" aria-label="Blue"></button>
+ <button type="button" role="radio" aria-checked="false" data-accent-choice="violet" aria-label="Violet"></button>
+ <button type="button" role="radio" aria-checked="false" data-accent-choice="rose" aria-label="Rose"></button>
+ <button type="button" role="radio" aria-checked="false" data-accent-choice="amber" aria-label="Amber"></button>
+ <button type="button" role="radio" aria-checked="false" data-accent-choice="green" aria-label="Green"></button>
+ <button type="button" role="radio" aria-checked="false" data-accent-choice="teal" aria-label="Teal"></button>
+ </div>
+ </div>
+ <div class="set-row">
+ <span class="set-label" id="lbl-paste">Auto-paste</span>
+ <button type="button" class="switch" role="switch" aria-checked="true" aria-labelledby="lbl-paste" id="paste-switch"><span></span></button>
+ </div>
+ <div class="set-row">
+ <span class="set-label" id="lbl-scenario">Voice</span>
+ <div class="seg seg-icons" role="radiogroup" aria-labelledby="lbl-scenario">
+ <button type="button" role="radio" aria-checked="true" data-scenario="talk" aria-label="Talk"><svg class="i" aria-hidden="true"><use href="#i-regular-microphone"/></svg></button>
+ <button type="button" role="radio" aria-checked="false" data-scenario="silent" aria-label="Stay silent"><svg class="i" aria-hidden="true"><use href="#i-regular-microphone-slash"/></svg></button>
+ </div>
+ </div>
+ </div>
+
+ <div class="ws" role="group" aria-label="Demo chat app">
+ <div class="ws-chrome" aria-hidden="true">
+ <span class="lights"><i></i><i></i><i></i></span>
+ </div>
+ <div class="ws-body">
+ <p class="bubble">Tests pass on <code>main</code>. What next?</p>
+ <div class="composer" id="composer">
+ <div class="composer-text" id="composer-text" role="textbox" aria-readonly="true" aria-multiline="true" aria-label="Demo prompt" tabindex="0"><span class="caret" aria-hidden="true"></span><span class="placeholder">Ask anything</span></div>
+ <div class="composer-bar">
+ <button class="paste-btn" type="button" id="paste-btn" hidden>
+ <svg class="i" aria-hidden="true"><use href="#i-regular-clipboard-text"/></svg>
+ Paste <kbd>⌘V</kbd>
+ </button>
+ <span class="send-wrap">
+ <span class="send-tip" id="send-tip" role="tooltip">You send. It never does.</span>
+ <button class="send" type="button" aria-describedby="send-tip" aria-label="Send (does nothing in this demo)">
+ <svg class="i" aria-hidden="true"><use href="#i-regular-arrow-up"/></svg>
+ </button>
+ </span>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <p class="voice" id="voice" aria-hidden="true">
+ <svg class="i voice-quote" aria-hidden="true"><use href="#i-regular-quotes"/></svg>
+ <span class="voice-text" id="voice-text"></span>
+ </p>
+
+ <div class="dock">
+ <div class="pill is-hidden" id="pill" role="group" aria-label="Dictation status">
+ <div class="pill-inner" id="pill-inner"></div>
+ </div>
+ </div>
+ </div>
+
+ <div class="keys-row">
+ <button class="keys" type="button" id="keys" aria-label="Start dictation (Control Option Space)">
+ <span class="key" aria-hidden="true">⌃</span>
+ <span class="key" aria-hidden="true">⌥</span>
+ <span class="key key-space" aria-hidden="true"></span>
+ </button>
+ <p class="keys-hint" id="keys-hint" aria-hidden="true">Try it</p>
+ </div>
+
+ <p class="sr-only" id="demo-live" role="status" aria-live="polite"></p>
+ <noscript><p class="noscript">The demo needs JavaScript.</p></noscript>
+ </div>
+ </div>
+ </section>
+
+ <!-- Features: bento -->
+ <section class="features" id="features" aria-labelledby="features-title">
+ <div class="wrap">
+ <h2 id="features-title" class="display h-md section-title reveal">Small app. Careful details.</h2>
+
+ <div class="bento">
+ <article class="cell c-lands reveal">
+ <div class="cell-visual vis-lands" aria-hidden="true">
+ <div class="mini-field">
+ <span class="mini-hl">Make the retry backoff exponential, with jitter.</span><span class="mini-caret"></span>
+ </div>
+ <span class="mini-pill mini-ok">
+ <svg class="i ok"><use href="#i-fill-check-circle"/></svg>Pasted
+ </span>
+ </div>
+ <div class="cell-text">
+ <h3>Lands at your cursor</h3>
+ <p>Any app with a text field. Without Accessibility, it copies for <kbd>⌘V</kbd>.</p>
+ </div>
+ </article>
+
+ <article class="cell c-keys reveal">
+ <div class="cell-visual vis-keys" aria-hidden="true">
+ <span class="kc">⌃</span><span class="kc">⌥</span><span class="kc kc-wide"></span>
+ </div>
+ <div class="cell-text">
+ <h3>One shortcut</h3>
+ <p>Press, talk, press again. Change it anytime.</p>
+ </div>
+ </article>
+
+ <article class="cell c-enter reveal">
+ <div class="cell-visual vis-enter" aria-hidden="true">
+ <span class="kc kc-return"><svg class="i"><use href="#i-regular-arrow-u-down-left"/></svg></span>
+ </div>
+ <div class="cell-text">
+ <h3>Never hits Enter</h3>
+ <p>It pastes. You review and send.</p>
+ </div>
+ </article>
+
+ <article class="cell c-sign reveal">
+ <div class="cell-visual vis-term" aria-hidden="true">
+ <span class="term"><svg class="i"><use href="#i-regular-terminal-window"/></svg><code>codex login</code></span>
+ </div>
+ <div class="cell-text">
+ <h3>Your ChatGPT sign-in</h3>
+ <p>Reuses the Codex CLI session. No API key.</p>
+ </div>
+ </article>
+
+ <article class="cell c-private reveal">
+ <div class="cell-visual vis-icon" aria-hidden="true">
+ <span class="icon-disc"><svg class="i"><use href="#i-regular-lock-simple"/></svg></span>
+ </div>
+ <div class="cell-text">
+ <h3>No transcript history</h3>
+ <p>Recordings are temporary files on your Mac.</p>
+ </div>
+ </article>
+
+ <article class="cell c-look reveal">
+ <div class="cell-visual vis-swatches">
+ <div class="mini-swatches" role="group" aria-label="Try an accent">
+ <button type="button" data-accent-try="graphite" aria-label="Graphite" aria-pressed="true"></button>
+ <button type="button" data-accent-try="blue" aria-label="Blue" aria-pressed="false"></button>
+ <button type="button" data-accent-try="violet" aria-label="Violet" aria-pressed="false"></button>
+ <button type="button" data-accent-try="rose" aria-label="Rose" aria-pressed="false"></button>
+ <button type="button" data-accent-try="amber" aria-label="Amber" aria-pressed="false"></button>
+ <button type="button" data-accent-try="green" aria-label="Green" aria-pressed="false"></button>
+ <button type="button" data-accent-try="teal" aria-label="Teal" aria-pressed="false"></button>
+ </div>
+ </div>
+ <div class="cell-text">
+ <h3>Feels native</h3>
+ <p>Light, dark and seven accents. Try one.</p>
+ </div>
+ </article>
+
+ <article class="cell c-menubar reveal">
+ <div class="cell-text">
+ <h3>Lives in the menu bar</h3>
+ <p>Out of the way until you need it.</p>
+ </div>
+ <div class="shot-wrap">
+ <img src="assets/shots/appearance-dark.png" width="820" height="600" alt="GPT Voice settings window, Appearance page, in dark mode." loading="lazy" decoding="async">
+ </div>
+ </article>
+
+ <article class="cell c-story reveal">
+ <svg class="i story-quote" aria-hidden="true"><use href="#i-regular-quotes"/></svg>
+ <p class="story">Built after moving from the Codex app to T3 Code and missing ChatGPT dictation.</p>
+ </article>
+ </div>
+ </div>
+ </section>
+
+ <!-- Film -->
+ <section class="film" id="film" aria-labelledby="film-title">
+ <div class="wrap">
+ <h2 id="film-title" class="display h-md section-title reveal">See it in action.</h2>
+ <div class="film-frame reveal" id="film-frame">
+ <video id="film-video" preload="none" playsinline controls aria-label="GPT Voice promo film">
+ <source data-video-src type="video/mp4">
+ </video>
+ <button class="film-play" type="button" id="film-play" aria-label="Play the GPT Voice film">
+ <span class="film-play-disc"><svg class="i" aria-hidden="true"><use href="#i-fill-play"/></svg></span>
+ </button>
+ <div class="film-missing" id="film-missing" hidden>
+ <img src="assets/app-icon-512.png" width="56" height="56" alt="">
+ <p>The film isn't available right now.</p>
+ </div>
+ </div>
+ <p class="film-credit reveal">Staged demo with synthetic speech by <a href="https://elevenlabs.io/">ElevenLabs</a> · Keyboard footage: <a href="https://www.magnific.com/">Designed by Magnific</a> · <a href="https://github.com/entropyconquers/gpt-voice/blob/main/THIRD_PARTY_NOTICES.md">All media credits</a></p>
+ </div>
+ </section>
+
+ <!-- Install + FAQ -->
+ <section class="install" id="install" aria-labelledby="install-title">
+ <div class="wrap">
+ <h2 id="install-title" class="display h-md section-title reveal">Get started.</h2>
+ <div class="install-grid">
+ <ol class="steps reveal">
+ <li class="step">
+ <span class="step-icon" aria-hidden="true"><svg class="i"><use href="#i-regular-terminal-window"/></svg></span>
+ <div><h3>Sign in with Codex CLI</h3><p>Install <a href="https://github.com/openai/codex">Codex CLI</a>, then run <code>codex login</code>.</p></div>
+ </li>
+ <li class="step">
+ <span class="step-icon" aria-hidden="true"><svg class="i"><use href="#i-regular-download-simple"/></svg></span>
+ <div data-when="ready" hidden><h3>Download GPT Voice</h3><p>Drag it to Applications and allow the microphone.</p></div>
+ <div data-when="pending"><h3>Mac download coming soon</h3><p>Signing is in progress. <a data-link="source" href="https://github.com/entropyconquers/gpt-voice#build-from-source">Build from source</a> for now.</p></div>
+ </li>
+ <li class="step">
+ <span class="step-icon step-keys" aria-hidden="true">⌃⌥</span>
+ <div><h3>Press <kbd>⌃</kbd><kbd>⌥</kbd><kbd>Space</kbd></h3><p>Talk, then press it again.</p></div>
+ </li>
+ </ol>
+
+ <div class="faq reveal">
+ <details>
+ <summary>Do I need an API key?<svg class="i chev" aria-hidden="true"><use href="#i-regular-caret-down"/></svg></summary>
+ <div class="answer"><p>No. It reuses the file-backed ChatGPT session from Codex CLI.</p></div>
+ </details>
+ <details>
+ <summary>Where does my audio go?<svg class="i chev" aria-hidden="true"><use href="#i-regular-caret-down"/></svg></summary>
+ <div class="answer"><p>To ChatGPT for transcription, over a private route that can change. Recordings are temporary files on your Mac. There's no offline mode.</p></div>
+ </details>
+ <details>
+ <summary>Will my ChatGPT plan work?<svg class="i chev" aria-hidden="true"><use href="#i-regular-caret-down"/></svg></summary>
+ <div class="answer"><p>Access depends on your ChatGPT account. Limits can vary, and this private route can change.</p></div>
+ </details>
+ <details>
+ <summary>Which Macs?<svg class="i chev" aria-hidden="true"><use href="#i-regular-caret-down"/></svg></summary>
+ <div class="answer"><p>macOS 13 or later, Apple Silicon and Intel. One download covers both.</p></div>
+ </details>
+ </div>
+ </div>
+
+ <div class="outro reveal">
+ <img class="outro-icon" src="assets/app-icon-512.png" width="64" height="64" alt="">
+ <div class="cta-row">
+ <a class="btn btn-ink btn-lg dl" data-link="download" data-when="ready" hidden href="#install">
+ <svg class="i dl-icon" aria-hidden="true"><use href="#i-regular-download-simple"/></svg>
+ <span>Download for Mac</span>
+ </a>
+ <a class="btn btn-quiet btn-lg star" data-link="repo" href="https://github.com/entropyconquers/gpt-voice">
+ <svg class="i" aria-hidden="true"><use href="#i-regular-github-logo"/></svg>
+ <span>Star on GitHub</span>
+ <span class="star-icon" aria-hidden="true">
+ <svg class="i"><use href="#i-regular-star"/></svg>
+ <svg class="i i-fill"><use href="#i-fill-star"/></svg>
+ </span>
+ </a>
+ </div>
+ </div>
+ </div>
+ </section>
+</main>
+
+<footer class="site-footer">
+ <div class="wrap footer-row">
+ <p class="footer-brand">
+ <svg class="brand-mark footer-mark" viewBox="0 0 100 100" aria-hidden="true">
+ <rect width="100" height="100" rx="22.6"/>
+ <rect class="b" x="18.3" y="39.8" width="7.45" height="20.3" rx="3.72"/>
+ <rect class="b" x="32.3" y="30.5" width="7.45" height="39" rx="3.72"/>
+ <rect class="b" x="46.4" y="22.7" width="7.45" height="54.7" rx="3.72"/>
+ <rect class="b" x="60.4" y="32.8" width="7.45" height="34.5" rx="3.72"/>
+ <rect class="b" x="74.3" y="41.4" width="7.45" height="17.2" rx="3.72"/>
+ </svg>
+ GPT Voice
+ </p>
+ <nav aria-label="Project links" class="footer-links">
+ <a data-link="repo" href="https://github.com/entropyconquers/gpt-voice">GitHub</a>
+ <a data-link="release" href="https://github.com/entropyconquers/gpt-voice/releases">Releases</a>
+ <a href="CREDITS.txt">Credits</a>
+ </nav>
+ <p class="fine">Independent open-source project, not affiliated with OpenAI. Code is MIT-licensed; third-party assets keep their own terms.</p>
+ </div>
+</footer>
+</body>
+</html>
diff --git a/website/dist/styles.css b/website/dist/styles.css
new file mode 100644
index 0000000..d2f21c6
--- /dev/null
+++ b/website/dist/styles.css
@@ -0,0 +1,1005 @@
+/* GPT Voice website. Display: FT Regola Neue. Body: the visitor's system font, never bundled. */
+
+@font-face { font-family: "FT Regola Neue"; src: url("fonts/FTRegolaNeue-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
+@font-face { font-family: "FT Regola Neue"; src: url("fonts/FTRegolaNeue-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
+@font-face { font-family: "FT Regola Neue"; src: url("fonts/FTRegolaNeue-Semibold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
+
+/* ---------- Tokens ---------- */
+
+:root {
+ --font-display: "FT Regola Neue", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
+ --font-body: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
+ --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
+
+ --ease-out: cubic-bezier(.165, .84, .44, 1);
+ --ease-in-out: cubic-bezier(.77, 0, .175, 1);
+ --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
+ --d1: 120ms;
+ --d2: 180ms;
+ --d3: 240ms;
+ --d4: 420ms;
+
+ --wrap: 1120px;
+ --gutter: clamp(16px, 4vw, 32px);
+ --cell-pad: clamp(20px, 2.4vw, 28px);
+
+ /* Accent: graphite by default (the app's default). Each accent has light and dark roles. */
+ --a-fill-l: #1C1C1E; --a-fill-d: #ECECEC;
+ --a-fg-l: #1C1C1E; --a-fg-d: #ECECEC;
+ --a-on-l: #FFFFFF; --a-on-d: #1C1C1E;
+}
+
+[data-accent="blue"] { --a-fill-l:#2563EB; --a-fill-d:#2563EB; --a-fg-l:#2563EB; --a-fg-d:#60A5FA; --a-on-l:#fff; --a-on-d:#fff; }
+[data-accent="violet"] { --a-fill-l:#7C3AED; --a-fill-d:#7C3AED; --a-fg-l:#7C3AED; --a-fg-d:#A78BFA; --a-on-l:#fff; --a-on-d:#fff; }
+[data-accent="rose"] { --a-fill-l:#E11D48; --a-fill-d:#E11D48; --a-fg-l:#E11D48; --a-fg-d:#FB7185; --a-on-l:#fff; --a-on-d:#fff; }
+[data-accent="amber"] { --a-fill-l:#B45309; --a-fill-d:#B45309; --a-fg-l:#B45309; --a-fg-d:#FBBF24; --a-on-l:#fff; --a-on-d:#fff; }
+[data-accent="green"] { --a-fill-l:#15803D; --a-fill-d:#15803D; --a-fg-l:#15803D; --a-fg-d:#4ADE80; --a-on-l:#fff; --a-on-d:#fff; }
+[data-accent="teal"] { --a-fill-l:#0F766E; --a-fill-d:#0F766E; --a-fg-l:#0F766E; --a-fg-d:#2DD4BF; --a-on-l:#fff; --a-on-d:#fff; }
+
+/* Light roles (the app's palette) */
+:root,
+.demo[data-theme="light"] {
+ --bg: #FFFFFF;
+ --bg-2: #F4F4F3;
+ --surface: #FFFFFF;
+ --well: #E6E6E4;
+ --ink: #1C1C1E;
+ --ink-2: #5E5E63;
+ --ink-3: #75757A;
+ --line: rgba(0, 0, 0, .08);
+ --line-2: rgba(0, 0, 0, .14);
+ --rec: #D5432B;
+ --ok: #2C7A4B;
+ --warn: #935400;
+ --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px -8px rgba(0,0,0,.14);
+ --shadow-lg: 0 2px 4px rgba(0,0,0,.04), 0 28px 64px -24px rgba(0,0,0,.28);
+ --accent: var(--a-fill-l);
+ --accent-fg: var(--a-fg-l);
+ --on-accent: var(--a-on-l);
+ --desk: #E9E9E7;
+ --key-top: #FFFFFF;
+ --key-side: #CFCFCD;
+ color-scheme: light;
+}
+
+@media (prefers-color-scheme: dark) {
+ :root,
+ .demo[data-theme="system"] {
+ --bg: #111112;
+ --bg-2: #1A1A1C;
+ --surface: #252527;
+ --well: #303033;
+ --ink: #ECECEC;
+ --ink-2: #A1A1A6;
+ --ink-3: #8E8E93;
+ --line: rgba(255, 255, 255, .08);
+ --line-2: rgba(255, 255, 255, .15);
+ --rec: #FF6A50;
+ --ok: #62C48C;
+ --warn: #E6AE4A;
+ --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -8px rgba(0,0,0,.5);
+ --shadow-lg: 0 2px 4px rgba(0,0,0,.3), 0 28px 64px -24px rgba(0,0,0,.8);
+ --accent: var(--a-fill-d);
+ --accent-fg: var(--a-fg-d);
+ --on-accent: var(--a-on-d);
+ --desk: #19191B;
+ --key-top: #2C2C2E;
+ --key-side: #0B0B0C;
+ color-scheme: dark;
+ }
+}
+
+.demo[data-theme="dark"] {
+ --bg: #111112;
+ --bg-2: #1A1A1C;
+ --surface: #252527;
+ --well: #303033;
+ --ink: #ECECEC;
+ --ink-2: #A1A1A6;
+ --ink-3: #8E8E93;
+ --line: rgba(255, 255, 255, .08);
+ --line-2: rgba(255, 255, 255, .15);
+ --rec: #FF6A50;
+ --ok: #62C48C;
+ --warn: #E6AE4A;
+ --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -8px rgba(0,0,0,.5);
+ --shadow-lg: 0 2px 4px rgba(0,0,0,.3), 0 28px 64px -24px rgba(0,0,0,.8);
+ --accent: var(--a-fill-d);
+ --accent-fg: var(--a-fg-d);
+ --on-accent: var(--a-on-d);
+ --desk: #19191B;
+ --key-top: #2C2C2E;
+ --key-side: #0B0B0C;
+ color-scheme: dark;
+}
+
+/* ---------- Base ---------- */
+
+*, *::before, *::after { box-sizing: border-box; }
+
+html {
+ -webkit-text-size-adjust: 100%;
+ text-size-adjust: 100%;
+ scroll-behavior: smooth;
+ scroll-padding-top: 72px;
+}
+
+body {
+ margin: 0;
+ background: var(--bg);
+ color: var(--ink);
+ font-family: var(--font-body);
+ font-size: 17px;
+ line-height: 1.5;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ text-rendering: optimizeLegibility;
+}
+
+img, svg, video { display: block; max-width: 100%; }
+p { margin: 0; }
+h1, h2, h3 { margin: 0; font-weight: 600; }
+ul, ol { margin: 0; padding: 0; list-style: none; }
+a { color: inherit; }
+button { font: inherit; color: inherit; }
+code, kbd { font-family: var(--font-mono); font-size: .88em; }
+
+/* The hidden attribute must win over any authored display value. */
+[hidden] { display: none !important; }
+
+::selection { background: color-mix(in srgb, var(--accent-fg) 24%, transparent); }
+
+:focus-visible {
+ outline: 2px solid var(--accent-fg);
+ outline-offset: 2px;
+ border-radius: 8px;
+}
+
+.sr-only {
+ position: absolute !important;
+ width: 1px; height: 1px;
+ padding: 0; margin: -1px;
+ overflow: hidden; clip: rect(0 0 0 0);
+ white-space: nowrap; border: 0;
+}
+
+.skip {
+ position: absolute; left: 12px; top: -48px; z-index: 100;
+ padding: 10px 14px; border-radius: 10px;
+ background: var(--ink); color: var(--bg);
+ text-decoration: none; font-weight: 600;
+ transition: top var(--d2) var(--ease-out);
+}
+.skip:focus { top: 12px; }
+
+.wrap {
+ width: 100%;
+ max-width: var(--wrap);
+ margin: 0 auto;
+ padding-inline: var(--gutter);
+}
+
+.i { width: 1em; height: 1em; fill: currentColor; flex: none; }
+
+kbd {
+ display: inline-flex; align-items: center; justify-content: center;
+ min-width: 1.6em; height: 1.55em; padding: 0 .4em; margin-inline: .08em;
+ border-radius: 5px;
+ border: 1px solid var(--line-2);
+ border-bottom-width: 2px;
+ background: var(--surface);
+ font-family: var(--font-body);
+ font-size: .82em; font-weight: 600; line-height: 1;
+ vertical-align: .08em;
+ color: var(--ink);
+}
+
+/* ---------- Type ---------- */
+
+.display {
+ font-family: var(--font-display);
+ font-weight: 500;
+ letter-spacing: -.024em;
+ line-height: 1.04;
+ text-wrap: balance;
+}
+.h-md { font-size: clamp(32px, 4.4vw, 52px); line-height: 1.04; }
+.section-title { text-align: center; margin-bottom: clamp(32px, 5vw, 56px); }
+
+/* ---------- Buttons ---------- */
+
+.btn {
+ --h: 44px;
+ display: inline-flex; align-items: center; justify-content: center; gap: 8px;
+ height: var(--h); padding: 0 18px;
+ border-radius: 999px;
+ border: 1px solid transparent;
+ font-size: 15px; font-weight: 600; letter-spacing: -.005em;
+ text-decoration: none; white-space: nowrap;
+ cursor: pointer;
+ transition:
+ transform var(--d1) var(--ease-out),
+ background-color var(--d2) var(--ease-out),
+ border-color var(--d2) var(--ease-out);
+ -webkit-tap-highlight-color: transparent;
+}
+.btn:active { transform: scale(.97); }
+.btn .i { width: 18px; height: 18px; }
+.btn-sm { --h: 36px; padding: 0 14px; font-size: 14px; gap: 6px; }
+.btn-sm .i { width: 16px; height: 16px; }
+.btn-icon-sm { width: 36px; padding: 0; }
+.btn-icon-sm .i { width: 18px; height: 18px; }
+.btn-lg { --h: 48px; padding: 0 22px; font-size: 16px; }
+
+.btn-ink { background: var(--ink); color: var(--bg); }
+.btn-ink:hover { background: color-mix(in srgb, var(--ink) 86%, var(--bg)); }
+.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line-2); }
+.btn-quiet:hover { background: var(--bg-2); }
+
+.dl:hover .dl-icon, .dl:focus-visible .dl-icon { animation: dl-drop var(--d4) var(--ease-out); }
+@keyframes dl-drop { 45% { transform: translateY(3px); } }
+
+/* Star appears and fills on hover */
+.star-icon { position: relative; width: 0; height: 18px; display: inline-block; opacity: 0; transition: width var(--d3) var(--ease-out), opacity var(--d2) var(--ease-out); }
+.star-icon .i { position: absolute; inset: 0; width: 18px; height: 18px; transition: transform var(--d3) var(--ease-spring), opacity var(--d2) var(--ease-out); }
+.star-icon .i-fill { opacity: 0; transform: scale(.6) rotate(-30deg); color: #E8A317; }
+.star:hover .star-icon, .star:focus-visible .star-icon { width: 18px; opacity: 1; }
+.star:hover .star-icon .i-fill, .star:focus-visible .star-icon .i-fill { opacity: 1; transform: rotate(-12deg); }
+.star:hover .star-icon .i:not(.i-fill), .star:focus-visible .star-icon .i:not(.i-fill) { opacity: 0; }
+
+/* ---------- Header ---------- */
+
+.site-header {
+ position: sticky; top: 0; z-index: 50;
+ background: color-mix(in srgb, var(--bg) 82%, transparent);
+ -webkit-backdrop-filter: saturate(1.6) blur(16px);
+ backdrop-filter: saturate(1.6) blur(16px);
+ border-bottom: 1px solid transparent;
+ transition: border-color var(--d3) var(--ease-out);
+}
+.site-header.is-scrolled { border-bottom-color: var(--line); }
+@media (prefers-reduced-transparency: reduce) {
+ .site-header { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
+}
+.header-row { display: flex; align-items: center; gap: 24px; height: 60px; }
+
+.brand {
+ display: inline-flex; align-items: center; gap: 10px;
+ text-decoration: none;
+ font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -.01em;
+}
+.brand-mark { width: 26px; height: 26px; }
+.brand-mark > rect:first-child { fill: #232325; }
+.brand-mark .b { fill: #EBEBEB; transform-box: fill-box; transform-origin: center; }
+@media (prefers-color-scheme: dark) { .brand-mark > rect:first-child { fill: #2C2C2E; } }
+.brand:hover .b, .brand:focus-visible .b { animation: bar-wave 600ms var(--ease-in-out); }
+.brand .b:nth-of-type(3) { animation-delay: 60ms; }
+.brand .b:nth-of-type(4) { animation-delay: 120ms; }
+.brand .b:nth-of-type(5) { animation-delay: 180ms; }
+.brand .b:nth-of-type(6) { animation-delay: 240ms; }
+@keyframes bar-wave { 40% { transform: scaleY(.55); } 70% { transform: scaleY(1.12); } }
+
+.nav { display: flex; gap: 4px; }
+.nav a {
+ padding: 6px 10px; border-radius: 8px;
+ font-size: 14px; color: var(--ink-2); text-decoration: none;
+ transition: color var(--d2) var(--ease-out), background-color var(--d2) var(--ease-out);
+}
+.nav a:hover { color: var(--ink); background: var(--bg-2); }
+.header-actions { margin-left: auto; display: flex; gap: 8px; }
+
+/* ---------- Hero ---------- */
+
+.hero { padding: clamp(20px, 3.5vh, 40px) 0 clamp(56px, 8vw, 96px); }
+.hero-head { display: flex; flex-direction: column; align-items: center; text-align: center; }
+
+.hero-icon {
+ width: 56px; height: 56px; margin-bottom: 14px;
+ filter: drop-shadow(0 8px 16px rgba(0,0,0,.18));
+ transition: transform var(--d4) var(--ease-spring);
+}
+.hero-icon:hover { transform: rotate(-6deg) scale(1.05); }
+
+.hero h1 {
+ font-size: clamp(40px, min(6vw, 8vh), 72px);
+ line-height: 1;
+ letter-spacing: -.035em;
+}
+.lede {
+ margin-top: 12px;
+ font-size: clamp(17px, 1.5vw, 19px);
+ color: var(--ink-2);
+ max-width: 46ch;
+ text-wrap: balance;
+}
+
+.cta-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 22px; }
+
+.tokens { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
+.tokens li, .tokens a {
+ display: inline-flex; align-items: center; gap: 7px;
+ height: 28px; padding: 0 11px;
+ border-radius: 999px;
+ font-size: 13px; font-weight: 500; color: var(--ink-2);
+ text-decoration: none;
+}
+.tokens li { border: 1px solid var(--line); }
+.tokens li:has(a) { padding: 0; }
+.tokens a:hover { color: var(--ink); }
+.tokens .i { width: 15px; height: 15px; }
+.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); flex: none; }
+
+/* ---------- Demo ---------- */
+
+.demo { position: relative; max-width: 880px; margin: clamp(22px, 3.5vh, 36px) auto 0; color: var(--ink); --pill-h: 40px; }
+
+.stage {
+ position: relative;
+ display: flex; flex-direction: column;
+ border-radius: 24px;
+ border: 1px solid var(--line);
+ overflow: hidden;
+ /* The desktop picks up a hint of the chosen accent. */
+ background:
+ radial-gradient(color-mix(in srgb, var(--ink) 8%, transparent) 1px, transparent 1.2px) 0 0 / 16px 16px,
+ linear-gradient(180deg, var(--desk), color-mix(in srgb, var(--desk) 88%, var(--accent-fg)));
+ transition: background-color var(--d3) var(--ease-out);
+}
+
+/* Menu bar */
+.menubar {
+ position: relative; z-index: 3;
+ display: flex; align-items: center; justify-content: space-between;
+ height: 30px; padding: 0 10px 0 16px;
+ background: color-mix(in srgb, var(--surface) 62%, transparent);
+ -webkit-backdrop-filter: blur(20px) saturate(1.4);
+ backdrop-filter: blur(20px) saturate(1.4);
+ border-bottom: 1px solid var(--line);
+ font-size: 12.5px;
+}
+.mb-left { display: inline-flex; gap: 16px; color: var(--ink-2); }
+.mb-left b { color: var(--ink); font-weight: 700; }
+.mb-right { display: inline-flex; align-items: center; gap: 4px; }
+.mb-app { width: 26px; height: 22px; display: grid; place-items: center; border-radius: 6px; }
+.mb-app svg { width: 15px; height: 15px; }
+.mb-app .b { fill: var(--ink); transform-box: fill-box; transform-origin: center; transition: fill var(--d2) var(--ease-out); }
+.demo[data-state="recording"] .mb-app { background: color-mix(in srgb, var(--rec) 16%, transparent); }
+.demo[data-state="recording"] .mb-app .b { fill: var(--rec); animation: bar-wave 900ms var(--ease-in-out) infinite; }
+.demo[data-state="recording"] .mb-app .b:nth-child(2) { animation-delay: 90ms; }
+.demo[data-state="recording"] .mb-app .b:nth-child(3) { animation-delay: 180ms; }
+.demo[data-state="recording"] .mb-app .b:nth-child(4) { animation-delay: 270ms; }
+.demo[data-state="recording"] .mb-app .b:nth-child(5) { animation-delay: 360ms; }
+.mb-btn {
+ position: relative;
+ width: 28px; height: 22px; padding: 0; border: 0; border-radius: 6px;
+ display: inline-grid; place-items: center;
+ background: transparent; color: var(--ink);
+ cursor: pointer;
+ transition: background-color var(--d2) var(--ease-out);
+}
+.mb-btn::after { content: ""; position: absolute; inset: -10px -4px; }
+.mb-btn .i { width: 15px; height: 15px; }
+.mb-btn:hover, .mb-btn[aria-expanded="true"] { background: color-mix(in srgb, var(--ink) 12%, transparent); }
+#demo-reset .i { transition: transform var(--d4) var(--ease-out); }
+#demo-reset:hover .i { transform: rotate(-120deg); }
+.mb-clock { padding: 0 4px 0 8px; font-weight: 500; font-variant-numeric: tabular-nums; }
+
+/* Settings popover, like a menu bar extra */
+.settings {
+ position: absolute; z-index: 4;
+ top: 36px; right: 10px;
+ width: min(268px, calc(100% - 20px));
+ padding: 6px 14px;
+ border-radius: 14px;
+ border: 1px solid var(--line-2);
+ background: color-mix(in srgb, var(--surface) 92%, transparent);
+ -webkit-backdrop-filter: blur(24px);
+ backdrop-filter: blur(24px);
+ box-shadow: var(--shadow-lg);
+ transform-origin: top right;
+ animation: pop-menu var(--d3) var(--ease-out);
+}
+@keyframes pop-menu { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
+.set-row {
+ display: flex; align-items: center; justify-content: space-between; gap: 12px;
+ min-height: 46px;
+}
+.set-row + .set-row { border-top: 1px solid var(--line); }
+.set-label { font-size: 13px; font-weight: 600; }
+
+.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: 9px; background: var(--well); }
+.seg button {
+ height: 28px; min-width: 34px; padding: 0 8px;
+ border: 0; border-radius: 7px; background: transparent;
+ display: inline-grid; place-items: center;
+ color: var(--ink-2); cursor: pointer;
+ transition: background-color var(--d2) var(--ease-out), color var(--d2) var(--ease-out);
+}
+.seg .i { width: 16px; height: 16px; }
+.seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.14); }
+
+.switch {
+ position: relative; flex: none;
+ width: 38px; height: 22px; border-radius: 999px; border: 0; padding: 0;
+ background: var(--well); cursor: pointer;
+ transition: background-color var(--d2) var(--ease-out);
+}
+.switch span {
+ position: absolute; top: 2px; left: 2px;
+ width: 18px; height: 18px; border-radius: 50%;
+ background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
+ transition: transform var(--d3) var(--ease-spring);
+}
+.switch[aria-checked="true"] { background: var(--accent); }
+.switch[aria-checked="true"] span { transform: translateX(16px); background: var(--on-accent); }
+
+.swatches { display: flex; gap: 7px; }
+.swatches button, .mini-swatches button {
+ position: relative;
+ width: 20px; height: 20px; border-radius: 50%;
+ border: 0; padding: 0; cursor: pointer;
+ background: var(--sw);
+ transition: transform var(--d1) var(--ease-out), box-shadow var(--d2) var(--ease-out);
+}
+.swatches button::after { content: ""; position: absolute; inset: -6px -3px; }
+.swatches button:active, .mini-swatches button:active { transform: scale(.88); }
+.swatches button[aria-checked="true"],
+.mini-swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--sw); }
+[data-accent-choice="graphite"], [data-accent-try="graphite"] { --sw: #1C1C1E; }
+[data-accent-choice="blue"], [data-accent-try="blue"] { --sw: #2563EB; }
+[data-accent-choice="violet"], [data-accent-try="violet"] { --sw: #7C3AED; }
+[data-accent-choice="rose"], [data-accent-try="rose"] { --sw: #E11D48; }
+[data-accent-choice="amber"], [data-accent-try="amber"] { --sw: #B45309; }
+[data-accent-choice="green"], [data-accent-try="green"] { --sw: #15803D; }
+[data-accent-choice="teal"], [data-accent-try="teal"] { --sw: #0F766E; }
+@media (prefers-color-scheme: dark) {
+ .demo[data-theme="system"] [data-accent-choice="graphite"], [data-accent-try="graphite"] { --sw: #ECECEC; }
+}
+.demo[data-theme="dark"] [data-accent-choice="graphite"] { --sw: #ECECEC; }
+
+/* Window */
+.ws {
+ position: relative; z-index: 1;
+ width: min(560px, calc(100% - 32px));
+ margin: 14px auto 0;
+ background: var(--bg-2);
+ border: 1px solid var(--line-2);
+ border-radius: 14px;
+ box-shadow: var(--shadow-lg);
+ overflow: hidden;
+}
+.ws-chrome { height: 32px; padding: 0 13px; display: flex; align-items: center; background: var(--surface); border-bottom: 1px solid var(--line); }
+.lights { display: inline-flex; gap: 7px; }
+.lights i { width: 11px; height: 11px; border-radius: 50%; background: #FF5F57; }
+.lights i:nth-child(2) { background: #FEBC2E; }
+.lights i:nth-child(3) { background: #28C840; }
+
+.ws-body { padding: 12px; display: grid; gap: 10px; }
+.bubble {
+ justify-self: start;
+ max-width: 85%;
+ padding: 8px 13px;
+ border-radius: 16px 16px 16px 5px;
+ background: var(--well);
+ font-size: 14px;
+}
+.bubble code { font-size: .9em; }
+
+.composer {
+ background: var(--surface);
+ border: 1px solid var(--line-2);
+ border-radius: 14px;
+ transition: border-color var(--d2) var(--ease-out), box-shadow var(--d2) var(--ease-out);
+}
+.composer:focus-within { border-color: color-mix(in srgb, var(--accent-fg) 60%, var(--line-2)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-fg) 14%, transparent); }
+.composer-text {
+ min-height: 52px; max-height: 80px; overflow-y: auto;
+ padding: 12px 14px 4px;
+ font-size: 14.5px; line-height: 1.5;
+ white-space: pre-wrap; overflow-wrap: anywhere;
+ outline: none;
+}
+.placeholder { color: var(--ink-3); margin-left: 2px; }
+.caret {
+ display: inline-block; width: 1.5px; height: 1.1em; margin-left: 1px;
+ vertical-align: -0.18em;
+ background: var(--accent-fg);
+ animation: caret 1.1s steps(1) infinite;
+}
+@keyframes caret { 50% { opacity: 0; } }
+.pasted { border-radius: 4px; animation: pasted-flash 1.4s var(--ease-out); }
+@keyframes pasted-flash { from { background: color-mix(in srgb, var(--accent-fg) 26%, transparent); } to { background: transparent; } }
+
+.composer-bar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 6px 8px 8px; }
+.paste-btn {
+ display: inline-flex; align-items: center; gap: 6px;
+ height: 30px; padding: 0 10px 0 9px;
+ border-radius: 8px; border: 1px solid var(--line-2);
+ background: var(--bg-2);
+ font-size: 13px; font-weight: 600;
+ cursor: pointer;
+ animation: pop-in var(--d3) var(--ease-out);
+}
+.paste-btn .i { width: 15px; height: 15px; }
+.paste-btn kbd { font-size: 11px; height: 18px; }
+.paste-btn:hover { background: var(--well); }
+
+.send-wrap { position: relative; display: inline-flex; }
+.send {
+ width: 30px; height: 30px; border-radius: 50%;
+ display: inline-grid; place-items: center;
+ border: 0; cursor: not-allowed;
+ background: var(--well); color: var(--ink-3);
+}
+.send .i { width: 16px; height: 16px; }
+.send-tip {
+ position: absolute; right: 0; bottom: calc(100% + 8px);
+ width: max-content;
+ padding: 6px 9px; border-radius: 8px;
+ background: var(--ink); color: var(--bg);
+ font-size: 12px; font-weight: 600;
+ opacity: 0; transform: translateY(4px); pointer-events: none;
+ transition: opacity var(--d2) var(--ease-out), transform var(--d2) var(--ease-out);
+}
+.send-wrap:hover .send-tip, .send:focus-visible + .send-tip, .send-wrap:focus-within .send-tip { opacity: 1; transform: none; }
+
+/* What the voice is saying */
+.voice {
+ flex: none;
+ display: flex; align-items: flex-end; justify-content: center; gap: 8px;
+ /* Fixed height: the newest words stay visible and older lines slide off the top, so the stage never jumps. */
+ height: 52px; overflow: hidden;
+ padding: 8px 24px 0;
+ font-size: 15px; line-height: 1.45;
+ -webkit-mask-image: linear-gradient(to bottom, transparent, #000 45%);
+ mask-image: linear-gradient(to bottom, transparent, #000 45%);
+ opacity: 0;
+ transition: opacity var(--d3) var(--ease-out);
+}
+.demo[data-state="recording"] .voice { opacity: 1; }
+.voice-quote { width: 18px; height: 18px; color: var(--accent-fg); margin-bottom: 2px; }
+.voice-text { display: block; color: var(--ink); max-width: 46ch; text-wrap: pretty; }
+.voice-text .w { animation: word-in var(--d3) var(--ease-out); }
+@keyframes word-in { from { opacity: 0; } }
+
+/* Dock + pill (mirrors the app's recording bar) */
+.dock { position: relative; height: calc(var(--pill-h) + 24px); }
+.pill {
+ position: absolute; left: 50%; bottom: 12px;
+ translate: -50% 0;
+ height: var(--pill-h);
+ border-radius: 999px;
+ background: color-mix(in srgb, var(--surface) 97%, transparent);
+ border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
+ box-shadow: 0 8px 24px -8px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.08);
+ overflow: hidden;
+ transition:
+ width 260ms var(--ease-out),
+ height 260ms var(--ease-out),
+ border-radius 260ms var(--ease-out),
+ opacity var(--d2) var(--ease-out),
+ transform var(--d3) var(--ease-out);
+}
+.pill.is-hidden {
+ opacity: 0; transform: translateY(10px) scale(.96); visibility: hidden; pointer-events: none;
+ transition: opacity var(--d2) var(--ease-out), transform var(--d2) var(--ease-out), visibility 0s linear var(--d2);
+}
+.pill.is-card { border-radius: 16px; }
+.pill-inner {
+ display: flex; align-items: center; gap: 10px;
+ height: var(--pill-h);
+ padding: 0 8px 0 14px;
+ white-space: nowrap;
+ width: max-content;
+}
+.pill-inner.enter { animation: content-in var(--d3) var(--ease-out); }
+@keyframes content-in { from { opacity: 0; filter: blur(2px); transform: scale(.98); } }
+
+.rec-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rec); flex: none; }
+.meter { display: inline-flex; align-items: center; justify-content: center; gap: 3px; width: 36px; height: 18px; flex: none; }
+.meter i {
+ width: 3px; border-radius: 3px;
+ background: var(--accent-fg);
+ height: max(3px, calc(18px * var(--h, .2)));
+ transition: height 80ms linear;
+}
+.time { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink-2); min-width: 2.6em; }
+.label { font-size: 13.5px; font-weight: 500; color: var(--ink); }
+.label-min { min-width: 96px; }
+
+.p-btn {
+ position: relative;
+ width: 24px; height: 24px; flex: none;
+ border-radius: 50%; border: 0;
+ display: inline-grid; place-items: center;
+ background: color-mix(in srgb, var(--ink) 10%, transparent);
+ color: var(--ink);
+ cursor: pointer;
+ transition: transform var(--d1) var(--ease-out), background-color var(--d2) var(--ease-out);
+}
+.p-btn::after { content: ""; position: absolute; inset: -8px; }
+.p-btn .i { width: 11px; height: 11px; }
+.p-btn:hover { background: color-mix(in srgb, var(--ink) 16%, transparent); }
+.p-btn:active { transform: scale(.9); }
+.p-btn-stop { background: var(--accent); color: var(--on-accent); }
+.p-btn-stop:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
+.p-btn-stop .i { width: 10px; height: 10px; }
+
+.spinner {
+ width: 13px; height: 13px; margin: 1.5px; flex: none;
+ border-radius: 50%;
+ border: 2px solid color-mix(in srgb, var(--ink) 18%, transparent);
+ border-top-color: var(--ink-2);
+ animation: spin 800ms linear infinite;
+}
+@keyframes spin { to { transform: rotate(360deg); } }
+
+.ok { color: var(--ok); width: 17px; height: 17px; }
+.muted-icon { color: var(--ink-2); width: 17px; height: 17px; }
+.pill .ok { animation: pop-in 320ms var(--ease-spring); }
+@keyframes pop-in { from { transform: scale(.6); opacity: 0; } }
+
+.pill-inner.notice { height: auto; }
+.notice {
+ display: grid; grid-template-columns: auto 1fr; gap: 2px 10px;
+ padding: 11px 18px 11px 14px;
+ white-space: normal;
+}
+.notice .muted-icon { grid-row: span 2; margin-top: 1px; }
+.notice strong { font-size: 13.5px; font-weight: 600; }
+.notice span { font-size: 12.5px; color: var(--ink-2); }
+
+/* Keycaps */
+.keys-row {
+ display: flex; align-items: center; justify-content: center; gap: 14px;
+ margin-top: 14px;
+}
+.keys {
+ display: inline-flex; gap: 7px;
+ padding: 0; border: 0; background: none;
+ cursor: pointer;
+ border-radius: 14px;
+ -webkit-tap-highlight-color: transparent;
+}
+.key {
+ position: relative;
+ display: inline-grid; place-items: center;
+ width: 50px; height: 46px;
+ border-radius: 10px;
+ background: var(--key-top);
+ border: 1px solid var(--line-2);
+ box-shadow: 0 3px 0 var(--key-side), 0 6px 14px -6px rgba(0,0,0,.3);
+ font-size: 19px; color: var(--ink);
+ transition: transform 90ms var(--ease-out), box-shadow 90ms var(--ease-out), border-color var(--d2) var(--ease-out);
+}
+.key-space { width: 160px; }
+.keys:hover .key { border-color: color-mix(in srgb, var(--accent-fg) 45%, var(--line-2)); }
+.keys:active .key, .keys.is-down .key {
+ transform: translateY(3px);
+ box-shadow: 0 0 0 var(--key-side), 0 1px 3px -1px rgba(0,0,0,.25);
+}
+.demo[data-state="recording"] .key { border-color: color-mix(in srgb, var(--accent-fg) 60%, var(--line-2)); }
+.demo[data-state="recording"] .key-space::after {
+ content: ""; position: absolute; inset: -5px; border-radius: 14px;
+ border: 2px solid var(--accent-fg);
+ animation: nudge 2.2s var(--ease-out) infinite;
+}
+@keyframes nudge { 0% { opacity: .55; transform: scale(.98); } 60%, 100% { opacity: 0; transform: scale(1.06); } }
+
+.keys-hint {
+ font-size: 14px; font-weight: 600; color: var(--ink-2);
+ display: inline-flex; align-items: center; gap: 6px;
+}
+.keys-hint::before { content: "←"; font-weight: 400; color: var(--ink-3); transition: transform var(--d3) var(--ease-out); }
+.keys:hover + .keys-hint::before { transform: translateX(-3px); }
+
+.noscript { margin-top: 12px; text-align: center; font-size: 14px; color: var(--ink-2); }
+
+/* ---------- Bento ---------- */
+
+.features { padding: clamp(64px, 9vw, 120px) 0; }
+
+.bento {
+ display: grid;
+ grid-template-columns: repeat(6, minmax(0, 1fr));
+ grid-auto-rows: minmax(220px, auto);
+ gap: 16px;
+}
+.cell {
+ position: relative;
+ display: flex; flex-direction: column; justify-content: space-between; gap: 20px;
+ padding: var(--cell-pad);
+ border-radius: 26px;
+ background: var(--bg-2);
+ border: 1px solid var(--line);
+ overflow: hidden;
+ transition: border-color var(--d3) var(--ease-out), transform var(--d3) var(--ease-out);
+}
+.cell:hover { border-color: var(--line-2); }
+.cell h3 { font-family: var(--font-display); font-size: 21px; font-weight: 500; letter-spacing: -.012em; line-height: 1.2; }
+.cell-text p { margin-top: 6px; font-size: 15px; color: var(--ink-2); max-width: 38ch; text-wrap: pretty; }
+.cell-text kbd { font-size: 11.5px; }
+.cell-visual { flex: 1; display: grid; place-items: center; min-height: 96px; }
+
+.c-lands { grid-column: span 4; grid-row: span 2; }
+.c-keys, .c-enter, .c-sign, .c-private, .c-look, .c-story { grid-column: span 2; }
+.c-menubar { grid-column: span 4; }
+
+/* Lands at your cursor */
+.vis-lands {
+ gap: 22px; align-content: center;
+ background: radial-gradient(color-mix(in srgb, var(--ink) 8%, transparent) 1px, transparent 1.2px) 0 0 / 16px 16px;
+ margin: calc(var(--cell-pad) * -1) calc(var(--cell-pad) * -1) 0;
+ padding: 40px var(--cell-pad) 8px;
+}
+.mini-field {
+ width: min(440px, 100%);
+ padding: 18px 20px;
+ border-radius: 16px;
+ background: var(--surface);
+ border: 1px solid var(--line-2);
+ box-shadow: var(--shadow);
+ font-size: clamp(16px, 1.9vw, 20px); line-height: 1.45;
+}
+.mini-hl { border-radius: 5px; background: color-mix(in srgb, var(--accent-fg) 14%, transparent); box-decoration-break: clone; -webkit-box-decoration-break: clone; padding: 1px 2px; }
+.mini-caret { display: inline-block; width: 2px; height: 1.1em; margin-left: 2px; vertical-align: -.18em; background: var(--accent-fg); animation: caret 1.1s steps(1) infinite; }
+.mini-pill {
+ display: inline-flex; align-items: center; gap: 9px;
+ height: 40px; padding: 0 16px 0 14px;
+ border-radius: 999px;
+ background: var(--surface);
+ border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
+ box-shadow: 0 8px 22px -8px rgba(0,0,0,.28);
+ font-size: 13.5px; font-weight: 500;
+}
+.c-lands:hover .mini-pill .ok { animation: pop-in 320ms var(--ease-spring); }
+
+/* Keycaps */
+.vis-keys { display: flex; gap: 7px; justify-content: center; align-items: center; }
+.kc {
+ display: inline-grid; place-items: center;
+ width: 50px; height: 46px;
+ border-radius: 10px;
+ background: var(--key-top);
+ border: 1px solid var(--line-2);
+ box-shadow: 0 3px 0 var(--key-side);
+ font-size: 18px;
+ transition: transform 90ms var(--ease-out), box-shadow 90ms var(--ease-out);
+}
+.kc-wide { width: 104px; }
+.c-keys:hover .kc { animation: kc-press 520ms var(--ease-out); }
+.c-keys:hover .kc:nth-child(2) { animation-delay: 70ms; }
+.c-keys:hover .kc:nth-child(3) { animation-delay: 140ms; }
+@keyframes kc-press { 30% { transform: translateY(3px); box-shadow: 0 0 0 var(--key-side); } }
+
+/* Never hits Enter */
+.kc-return { position: relative; width: 76px; height: 56px; color: var(--ink-3); }
+.kc-return .i { width: 24px; height: 24px; }
+.kc-return::after {
+ content: ""; position: absolute; left: 10px; right: 10px; top: 50%; height: 2px;
+ border-radius: 2px; background: var(--rec);
+ transform: rotate(-24deg) scaleX(0);
+ transition: transform var(--d4) var(--ease-out);
+}
+/* The slash draws once when the cell scrolls in. */
+.c-enter.is-in .kc-return::after, html:not(.js) .kc-return::after { transform: rotate(-24deg) scaleX(1); transition-delay: 350ms; }
+
+/* Sign-in */
+.term {
+ display: inline-flex; align-items: center; gap: 10px;
+ padding: 12px 16px;
+ border-radius: 12px;
+ background: #1C1C1E; color: #ECECEC;
+ border: 1px solid rgba(255,255,255,.08);
+ box-shadow: var(--shadow);
+}
+.term .i { width: 18px; height: 18px; color: #8E8E93; }
+.term code { font-size: 15px; }
+.term code::before { content: "$ "; color: #62C48C; }
+
+/* Icon disc */
+.icon-disc {
+ width: 76px; height: 76px; border-radius: 50%;
+ display: grid; place-items: center;
+ background: var(--surface);
+ border: 1px solid var(--line);
+ box-shadow: var(--shadow);
+ transition: transform var(--d4) var(--ease-spring);
+}
+.icon-disc .i { width: 30px; height: 30px; }
+.c-private:hover .icon-disc { transform: rotate(-8deg) scale(1.04); }
+
+/* Accents */
+.mini-swatches { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; max-width: 200px; }
+.mini-swatches button { width: 28px; height: 28px; }
+.mini-swatches button::after { content: ""; position: absolute; inset: -8px; }
+.mini-swatches button:hover { transform: scale(1.12); }
+
+/* Menu bar shot */
+.c-menubar { flex-direction: row; align-items: flex-start; }
+.c-menubar .cell-text { flex: 0 0 36%; }
+.shot-wrap {
+ flex: 1;
+ margin: 8px calc(var(--cell-pad) * -1) calc(var(--cell-pad) * -1) 0;
+ align-self: flex-end;
+}
+.shot-wrap img {
+ width: 100%; height: auto;
+ border-radius: 12px 0 0 0;
+ box-shadow: var(--shadow-lg);
+ transition: transform var(--d4) var(--ease-out);
+}
+.c-menubar:hover .shot-wrap img { transform: translate(-4px, -4px); }
+
+/* Story */
+.c-story { background: var(--ink); color: var(--bg); border-color: transparent; justify-content: flex-end; }
+.story-quote { width: 28px; height: 28px; opacity: .45; }
+.story { font-family: var(--font-display); font-size: clamp(19px, 1.9vw, 22px); line-height: 1.3; letter-spacing: -.01em; text-wrap: pretty; }
+
+/* ---------- Film ---------- */
+
+.film { padding: clamp(64px, 9vw, 120px) 0; background: var(--bg-2); }
+.film-frame {
+ position: relative;
+ max-width: 980px; margin: 0 auto;
+ aspect-ratio: 16 / 9;
+ border-radius: 24px;
+ overflow: hidden;
+ background: #0E0E0F;
+ box-shadow: var(--shadow-lg);
+}
+.film-frame video { width: 100%; height: 100%; object-fit: cover; background: #0E0E0F; }
+.film-play {
+ position: absolute; inset: 0;
+ display: grid; place-items: center;
+ border: 0; cursor: pointer;
+ background: rgba(0,0,0,.18);
+}
+.film-play-disc {
+ width: 80px; height: 80px; border-radius: 50%;
+ display: grid; place-items: center;
+ background: rgba(255,255,255,.94); color: #1C1C1E;
+ box-shadow: 0 12px 32px -8px rgba(0,0,0,.5);
+ transition: transform var(--d3) var(--ease-spring);
+}
+.film-play-disc .i { width: 30px; height: 30px; margin-left: 4px; }
+.film-play:hover .film-play-disc, .film-play:focus-visible .film-play-disc { transform: scale(1.08); }
+.film-play:focus-visible { outline-offset: -6px; }
+.film-frame.is-playing .film-play { display: none; }
+.film-missing {
+ position: absolute; inset: 0;
+ display: grid; place-content: center; justify-items: center; gap: 14px;
+ color: #A1A1A6; font-size: 15px; background: #161617;
+}
+.film-credit { margin-top: 16px; text-align: center; font-size: 12.5px; color: var(--ink-3); text-wrap: balance; }
+.film-credit a { color: var(--ink-2); text-underline-offset: 3px; text-decoration-color: var(--line-2); }
+.film-credit a:hover { color: var(--ink); text-decoration-color: currentColor; }
+
+/* ---------- Install ---------- */
+
+.install { padding: clamp(64px, 9vw, 120px) 0 clamp(56px, 8vw, 96px); }
+.install-grid {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
+ gap: 16px;
+ align-items: start;
+}
+.steps { display: grid; gap: 12px; }
+.step {
+ display: grid; grid-template-columns: 44px 1fr; gap: 16px; align-items: start;
+ padding: 20px;
+ border-radius: 22px;
+ background: var(--bg-2);
+ border: 1px solid var(--line);
+}
+.step-icon {
+ width: 44px; height: 44px; border-radius: 12px;
+ display: grid; place-items: center;
+ background: var(--surface);
+ border: 1px solid var(--line);
+ font-size: 15px; font-weight: 600;
+}
+.step-icon .i { width: 22px; height: 22px; }
+.step h3 { font-size: 16.5px; font-weight: 600; line-height: 1.35; }
+.step h3 kbd { font-size: 12px; }
+.step p { margin-top: 2px; font-size: 15px; color: var(--ink-2); }
+.step a { text-underline-offset: 3px; }
+.step-note { display: flex; align-items: center; gap: 8px; margin-top: 8px !important; font-size: 13.5px !important; }
+
+.faq {
+ padding: 4px 22px;
+ border-radius: 22px;
+ background: var(--bg-2);
+ border: 1px solid var(--line);
+}
+.faq details + details { border-top: 1px solid var(--line); }
+.faq summary {
+ display: flex; align-items: center; justify-content: space-between; gap: 16px;
+ min-height: 60px;
+ font-size: 16px; font-weight: 600;
+ cursor: pointer; list-style: none;
+}
+.faq summary::-webkit-details-marker { display: none; }
+.faq .chev { width: 16px; height: 16px; color: var(--ink-3); transition: transform var(--d3) var(--ease-out); }
+.faq details[open] .chev { transform: rotate(180deg); }
+.answer { padding: 0 0 18px; }
+.answer p { color: var(--ink-2); font-size: 15px; max-width: 52ch; text-wrap: pretty; }
+@supports (interpolate-size: allow-keywords) {
+ .faq { interpolate-size: allow-keywords; }
+ .faq details::details-content {
+ height: 0; overflow: clip;
+ transition: height var(--d3) var(--ease-out), content-visibility var(--d3) allow-discrete;
+ }
+ .faq details[open]::details-content { height: auto; }
+}
+
+.outro { display: flex; flex-direction: column; align-items: center; margin-top: clamp(56px, 8vw, 96px); }
+.outro-icon { width: 64px; height: 64px; filter: drop-shadow(0 10px 20px rgba(0,0,0,.18)); transition: transform var(--d4) var(--ease-spring); }
+.outro-icon:hover { transform: rotate(-6deg) scale(1.05); }
+.outro .cta-row { margin-top: 24px; }
+
+/* ---------- Footer ---------- */
+
+.site-footer { border-top: 1px solid var(--line); padding: 28px 0 36px; }
+.footer-row { display: grid; grid-template-columns: auto 1fr; gap: 12px 24px; align-items: center; }
+.footer-brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; }
+.footer-mark { width: 20px; height: 20px; }
+.footer-links { display: flex; gap: 18px; justify-self: end; }
+.footer-links a { font-size: 14px; color: var(--ink-2); text-decoration: none; }
+.footer-links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
+.fine { grid-column: 1 / -1; font-size: 12.5px; color: var(--ink-3); }
+
+/* ---------- Reveal on scroll ---------- */
+
+.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out), border-color var(--d3) var(--ease-out); }
+.js .reveal.is-in { opacity: 1; transform: none; }
+
+/* ---------- Responsive ---------- */
+
+@media (max-width: 900px) {
+ .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
+ .c-lands, .c-menubar, .c-story { grid-column: span 2; }
+ .c-lands { grid-row: auto; }
+ .c-keys, .c-enter, .c-sign, .c-private, .c-look { grid-column: span 1; }
+ .install-grid { grid-template-columns: 1fr; }
+}
+
+@media (max-width: 640px) {
+ .nav { display: none; }
+ .bento { grid-template-columns: 1fr; grid-auto-rows: auto; }
+ .bento > .cell { grid-column: auto; }
+ .cell { min-height: 200px; }
+ .c-menubar { flex-direction: column; }
+ .c-menubar .cell-text { flex: none; }
+ .shot-wrap { width: calc(100% + var(--cell-pad)); }
+ .c-story { min-height: 0; }
+ .cta-row { width: 100%; }
+ .cta-row .btn { flex: 1 1 100%; }
+ .hide-xs { display: none; }
+ .stage { border-radius: 20px; }
+ .ws { width: calc(100% - 20px); }
+ .voice { padding-inline: 16px; font-size: 14px; }
+ .keys-row { flex-direction: column; gap: 10px; }
+ .keys { width: 100%; max-width: 360px; }
+ .key { width: 60px; height: 54px; }
+ .key-space { width: auto; flex: 1; }
+ .keys-hint::before { content: "↑"; }
+ .footer-row { grid-template-columns: 1fr; }
+ .footer-links { justify-self: start; }
+}
+
+/* ---------- Reduced motion ---------- */
+
+@media (prefers-reduced-motion: reduce) {
+ html { scroll-behavior: auto; }
+ *, *::before, *::after {
+ animation-duration: 1ms !important;
+ animation-iteration-count: 1 !important;
+ transition-duration: 1ms !important;
+ }
+ .caret, .mini-caret { animation: none; }
+ .spinner { animation: spin 1.6s linear infinite !important; }
+ .demo[data-state="recording"] .key-space::after,
+ .demo[data-state="recording"] .mb-app .b { animation: none !important; }
+ .js .reveal { opacity: 1; transform: none; }
+}