Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more
// Read-only, bounded diagnostic. Run with: xcrun swift scripts/trace_clipboard.swift 120
// Logs changes only. Foreground app is context, not proof of which process wrote.
import AppKit
import Foundation
let duration = min(600, max(1, Double(CommandLine.arguments.dropFirst().first ?? "120") ?? 120))
let deadline = ProcessInfo.processInfo.systemUptime + duration
let board = NSPasteboard.general
var previousCount = -1
let formatter = ISO8601DateFormatter()
formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
while ProcessInfo.processInfo.systemUptime < deadline {
autoreleasepool {
let changeCount = board.changeCount
guard changeCount != previousCount else { return }
previousCount = changeCount
let items = board.pasteboardItems ?? []
let types = items.first?.types ?? []
func has(_ name: String) -> Bool { types.contains(NSPasteboard.PasteboardType(name)) }
// Classify known public origins without writing full source URLs to the log.
let sourceURL = board.string(forType: NSPasteboard.PasteboardType("org.chromium.source-url"))
let host = sourceURL.flatMap { URL(string: $0)?.host }
let knownHost = host ?? ""
let origin = ["claude.ai", "chatgpt.com", "chat.openai.com"].contains(knownHost) ? knownHost : "other-or-unavailable"
let event: [String: Any] = [
"wallTime": formatter.string(from: Date()),
"uptime": ProcessInfo.processInfo.systemUptime,
"changeCount": changeCount,
"stable": changeCount == board.changeCount,
"items": items.count,
"text": types.contains(.string),
"html": types.contains(.html),
"transient": has("org.nspasteboard.TransientType"),
"concealed": has("org.nspasteboard.ConcealedType"),
"generated": has("org.nspasteboard.AutoGeneratedType"),
"chromium": has("org.chromium.internal.source-rfh-token") || has("org.chromium.source-url"),
"knownOrigin": origin,
"frontmostAppNotWriter": NSWorkspace.shared.frontmostApplication?.bundleIdentifier ?? "unknown",
]
if let data = try? JSONSerialization.data(withJSONObject: event, options: [.sortedKeys]),
let line = String(data: data, encoding: .utf8)
{
print(line)
fflush(stdout)
}
}
Thread.sleep(forTimeInterval: 0.05)
}