macOS support: capture resampling, private runtime directory, Metal and MLX engines #1
Labels
No labels
ready-for-agent
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
piersdd/herdr-dictate#1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem Statement
herdr-dictate gives local speech-to-text dictation into the focused Herdr pane, but it runs on Linux only. The plugin manifest declares Linux as its one platform, and the microphone capture asks the device for 16 kHz mono directly, which CoreAudio devices do not offer. The four Apple Silicon Macs in the fleet (viper, viking, voyager, vega) therefore cannot dictate into a pane.
Two more problems appear as soon as the plugin runs on macOS:
XDG_RUNTIME_DIR. The model server socket and its pid file then fall back to a predictable directory under/tmpthat is created without an ownership or mode check. Another local user can own that directory first, receive the raw audio, and return text that is typed into the pane.toggle-sendpresses Enter without a check that an agent holds the pane. At a shell prompt the transcript runs as a command. The remote path already makes this check.The operator also wants to know whether an MLX engine gives better latency or accuracy on Apple Silicon than the transcribe.cpp Metal backend that the crate already exposes as a feature.
Solution
A fork of herdr-dictate, at
git.gen3.dev/piersdd/herdr-dictate, that runs on Apple Silicon macOS:/tmpfallback on any platform.toggle-sendpresses Enter on the local path only while an agent holds the pane, as the remote path does.doctorreports the macOS-specific dependencies: microphone permission, the runtime directory, the Metal backend, and the MLX runtime when that engine is selected.Linux behaviour does not change, except for the runtime directory fallback and the local submit check.
User Stories
doctorto tell me that microphone permission is missing and to name the System Settings pane, so that a silent recording is not a mystery.doctorto say which process macOS attributes the microphone to, so that I grant the permission to the right application.doctorto check the MLX runtime only when the MLX engine is selected, so that the default engine has no extra dependency.doctorto name the engine, the model, and the backend that answered, so that I can confirm which engine a measurement used.watchoutput to work on macOS, so that my status line shows the dictation phase.serve-stopto signal only a pid read from the verified runtime directory, so that a planted pid file cannot make the plugin signal an arbitrary process.toggle-sendat a local shell prompt to type the words and not press Enter, so that a misheard phrase cannot run as a command.toggle --from-wavto accept a WAV at any sample rate and channel count, so that I can drive a whole macOS-shaped dictation without a microphone.upstreamremote, so that upstream fixes can be merged and nothing is pushed to GitHub by accident.Implementation Decisions
Platform
Capture and resampling
Runtime directory
$XDG_RUNTIME_DIR/<plugin id>whenXDG_RUNTIME_DIRis set and absolute. Otherwise it is arundirectory inside the plugin state directory. The/tmpfallback is removed on every platform.doctorfails the check. The ssh control socket keeps its present rule: sharing is dropped and each call still works.Local submit guard
Engine selection
MLX engine
forbid(unsafe_code)and gains no FFI.uvwith a lock file.uvis already on the fleet. This breaks the upstream "self-sufficient" rule, so the MLX engine is fork-only and is not offered upstream.doctor
uv, the locked environment, the model files and their digests, and server readiness.Scripts and CI
upstreamremote that points at GitHub with pushing disabled, and anoriginremote on gen3.Measurement
Testing Decisions
A good test here checks external behaviour: what is typed, what is refused, what a file or directory looks like afterwards, what a socket answers. It does not assert internal call order or private state. Tests stay inline in each module, as upstream requires. No test needs a microphone or a running Herdr server.
toggle --from-wav. A whole dictation is driven from a 48 kHz stereo WAV and from a 44.1 kHz mono WAV, with the Herdr socket pointed at a stub and the config, state, and runtime directories pointed at scratch directories. The test asserts what the stub was asked to type. Prior art: the upstream procedure for verifying without a microphone, and the existing--from-wavpath.XDG_RUNTIME_DIR; mode 0700 after creation; refusal of a directory with group or other access; a path over the platform bound is reported. Prior art: the existing watcher directory tests, which assert mode 0700 on the directory and its parent.scripts/check.shpasses on a fleet Mac with nothing skipped except the container step.toggle-sendat a shell prompt types and does not submit.doctorpasses, and fails with the correct remedy after microphone permission is revoked.Out of Scope
Further Notes
5bb42ca), captured in the vault as2026-11-16-herdr-dictate-secops-devops-analysis.metalfeature of the transcribe.cpp crate builds and runs on Apple Silicon. Nobody has built it in this work.herdr plugin installmay accept only GitHub shorthand. If so, hosts install the fork by linking a checkout.doctormust make that state obvious.upstream/mainbefore the work starts and again before the measurement.doctor, CI and scripts, then the MLX engine, then the measurement. The first five items are independent of MLX.Correction, 2026-11-16: the host platform assumption in this spec is false for the fleet.
herdr-dictate is a plugin for the legacy
herdrTUI (manifestmin_herdr_version = 0.9.0; it needsherdr plugin install,HERDR_SOCKET_PATH, the plugin action and pane system, andherdr machine list).The fleet no longer runs that program. dotfiles removed it in #704 and #717. The Macs run herdr-core (
hc, 0.1.x) and the Herdr app. Checked on voyager: noherdron PATH, andhc --helplists no plugin command.Consequences:
ipc,sink,machine,setup,indicator, the manifest) targets an API the fleet does not have. It needs either a port to thehcAPI (hc send,hc keys,hc ls,hc connect,hc schema) or a decision to reinstall legacy herdr.Decision: port the delivery layer to herdr-core (
hc), or bring legacyherdr0.9 back on the Macs? Do not dispatch this issue until that is ruled.