Commit Graph
11 Commits
Author SHA1 Message Date
Kit Langton b303fd1246 scripts/check: name the root package without its checkout path (#1419) 2026-11-05 12:36:51 -08:00
Dax b07b1a2083 fix(nix): follow Cargo.lock fragments in the pin check (#1405)
Read the resolved commit from the fragment, so branch, tag, short-rev, and
bare Git sources all work. Parse Cargo.lock's package stanzas with re so the
check runs on macOS's Python 3.9, reject lib.fakeHash, and normalize a .git
suffix when grouping repositories.

Add tests for each source form, a multi-crate repository, a stale revision,
and a fake hash. Flag the pin check itself in the agent policy.
2026-11-05 14:15:57 -05:00
Dax 83dcd3943b fix(nix): hash Rune's current revision and guard git pins (#1399)
The Rune 7d3ee6ca bump updated the Nix pin but not its output hash, so
nix build failed with a fixed-output mismatch.

cargoGitDependencies now records each Git dependency's revision beside its
output hash, and scripts/check-nix-git-pins.py fails when Cargo.lock names a
different revision. compile.yml runs it for Cargo.lock and nix changes.

Fixes #1397.
2026-11-05 13:03:19 -05:00
Kit Langton e0a55b4d5f Add code-shape gate and ratcheted exception lists 2026-10-31 18:57:51 -07:00
Dax 2962074bfa Captures on Linux (portal, PipeWire, VA-API); capture compiled into macOS and Linux builds (#320)
* Captures on Linux: portal, PipeWire and VA-API behind the engine's platform seam; capture compiled into macOS and Linux builds

The capture engine's OS adapter gains capture/linux.rs: the screen-cast
portal (zbus) picks the screen (remembered with its restore token) or a
window, libpipewire and libva are loaded at run time, frames are imported
as DMA-BUFs and scaled and H.264-encoded on the GPU, and ffmpeg muxes and
reads movies back. Software x264 is the fallback.

capture_host, the capsule, the pane, routing and the CLI are shared; the
Linux listener feeds a ListenerTimeline, its portal or X11 grabs bind the
capture shortcut, and the summary goes through Hex's Linux clipboard.
The capture feature flag is gone: macOS and Linux always compile the
experiment, off by default.

* Docs: captures on Linux, the experiment in every macOS and Linux build; token path from Hex

* Capture portal: register Hex's app id so the desktop keeps its screen choice

* Fix macOS test build after the capture seam

* Linux: size X11 shortcut state for the capture shortcut; keep macOS-layout capsule tests on macOS

* Windows: the capture word timestamps field is Linux's
2026-10-28 20:58:27 -04:00
Dax 3434eb5f35 Rename voice-control to hex everywhere, without migrations (#293)
* Rename voice-control to hex everywhere, without migrations

The Cargo package and binary are now hex, every OS keeps its data in a
hex folder, and VOICE_CONTROL_* variables are HEX_*. Hex is a fresh
app: the macOS voice-control rename, its symlink, and the Windows and
Linux beta settings imports are gone. The Windows installer gets a new
AppId so it never takes over an old voice-control install's entry.

* Format

* Drop the Windows paste-last default only the beta import used
2026-10-28 13:08:44 -04:00
Kit Langton bb2f56263c feat(capture-core): shared macOS screen-recording library (#255)
* feat(capture-core): add shared macOS screen capture core

Records displays and windows with ScreenCaptureKit, one MP4 per source,
on one host clock, and writes a versioned capture.json manifest.

- stop() returns at once; finishing runs on the recording's own thread
- each stream keeps running until its detached recording output finishes
  or fails, then stops within 10 s
- a system stream stop is not an output failure; a finished MP4 is kept
- the final video frame is held to the recorded end
- external microphone PCM through a bounded sink, written as a WAV with
  recorded gaps; the core never opens a microphone in that mode
- host input through a bounded queue or an optional event tap, chord-only
  keys, dropped while secure input is on; ~240 Hz cursor sampling
- optional system audio file and low-rate RGBA frame tap

Kept outside the workspace and built only by the capture feature.

* feat(capture-core): regions, output size, screenshots, nanosecond clock

- Source::Region { display, rect }: a display-local rect applied as the
  stream's sourceRect, trimmed to the display, with exclusions
- SourcePlan::long_edge caps a source's longest side in pixels, keeping
  the aspect and never upscaling; sizes come from points and the
  filter's pixel scale
- screenshot(&Source, &Exclusions, long_edge) through SCScreenshotManager
  with the recording's filter construction
- every timestamp is Mach host time in nanoseconds: the manifest records
  "clock": "mach_host_ns" and anchor_ns; stream starts, audio file starts
  and gaps, cursor samples and clicks, and input events carry *_ns
- objc2-av-foundation and objc2-avf-audio use only the features in use, so
  the lockfile gains no registry crates
2026-10-27 20:08:40 -07:00
Kit Langton fb617e5082 Import scrawl-capture into crates/capture
Copy Scrawl's `crates/capture` from kitlangton/scrawl, branch
`engine/split`, commit e351ddb28be47c77481cb6821cc72d7f8fe7c769 (e351ddb),
without history, keeping the package name `scrawl-capture`, and its
`docs/app-handover-spec.md` as `docs/plans/capture-handover-spec.md`. Hex
depends on it by path instead of the Git pin at 86d7d6c; the Nix
`outputHashes."scrawl-capture-0.3.13"` entry goes.

Workspace: `crates/capture` is in `[workspace] exclude`, so `cargo build`,
`cargo test`, and `--workspace` never build it (Linux, Windows, and Nix
included). It compiles only as the `capture` feature's macOS dependency,
sharing the root Cargo.lock and target/. The root package stays a member
without being listed, since listing "." defeats `exclude`. On macOS
`scripts/check` and the macOS workflow name it (`-p voice-control
-p scrawl-capture --features capture`) to lint and test its 257 tests.

API adaptations in capture_host:
- `Finished` gains `gaps` and `missing_transcript`; the host records them
  and `hex capture status` (human and JSON `last`) shows them.
- `Engine::new` bridges the crate's log to `Host::log` when no sink is
  set, so Hex's own `TracingLog` sink goes and each line is logged once.
- Scrawl now writes its bundle files 0600; Hex still tightens
  recording.mp4, the window log, and folders.
- Nothing on Hex's path reads ~/.config/scrawl or writes under
  Application Support/scrawl: the crate does that only after
  `enable_scrawl_host_defaults`/`enable_file_log`, which Hex never calls.

Scrubbed (synthetic values): a file:///Users/<name> path in ax.rs, the
com.kitlangton.UpDown / dev.kitlangton.UpDown test bundle IDs in
handoff.rs and phone.rs (now com.example.UpDown), and a personal device
name in a phone.rs test. Kept: Scrawl's own product IDs
(dev.kitlangton.scrawl, .helper) and its public GitHub releases URL.

fmt and clippy -D warnings, no behaviour change: `cargo fmt` on five
files; `chunks_exact(N)` to `as_chunks::<N>()` (19 sites); collapsed
`if let` chains in capture/macos.rs and pipeline.rs and a `match` in
page.rs; `type` aliases for a drag start and two ingest hooks; explicit
lower bounds on two test `match` range arms in keyframes.rs;
`slice::from_ref` for two one-element slices; `and_then` for
`map().flatten()`; a dropped `to_owned`; `#[allow]` for one
`too_many_arguments` and one `single_range_in_vec_init`.
2026-10-25 19:14:23 -07:00
Kit Langton ef6fe3df10 Import Scrawl's router crate
Copies crates/router (crate scrawl-router) from kitlangton/scrawl, branch
routing/jev, at 24797c0 (24797c0ae598d1ff4fd44d3395fbceab52740f66), with no
history. Hex becomes a workspace with the router as a member; nothing in Hex
depends on it yet, and plain cargo commands still select only Hex.

Changes from the source:
- rustfmt, and thirteen fixes for lints the newer clippy reports
  (sort_by_key, as_chunks, a collapsed if, and similar).
- The replay fixtures and tests use synthetic session IDs (same shape and
  order), /Users/example, a placeholder tailnet name, com.example bundle
  IDs, and neutral names for private projects and session titles.
- OpenCode's database is no longer looked for in a private profile folder;
  $OPENCODE_DB, the running server, and ~/.local/share/opencode remain.

scripts/check lints and tests the whole workspace, Check Linux runs the
router's tests and clippy, both check workflows watch crates/, and the Nix
source includes crates/.
2026-10-25 15:07:14 -07:00
Kit Langton ac64b9450c Host Scrawl's real capture engine behind the capture experiment
Replace capture_host's stand-in engine and bundle writer with the
scrawl-capture crate (kitlangton/scrawl engine/split @ ce741ee), features
screen + helper only. Hex owns the audio (AudioIn::External with the
dictation timeline's start offset and gaps), transcribes on the dictation
engine's loaded model, runs the engine with SharedResources::none(), routes
its log to tracing, and writes owner-only .scrawl bundles to its own
captures folder.

One capture exists at a time, including its finish: Scrawl's engine stops
recording the screen only inside Capture::finish and shares its input
telemetry across captures, so a start while the previous capture is
starting, writing, or cancelling is refused `busy`. Every capture is
tracked from its start until its collector or the finisher settles it, so
a failed start raced by stop can't leak and wedge later starts. The
engine's log sink and keyboard-layout map (TIS, read by Engine::new) are
claimed on the main thread before any engine is built.

The dependency is optional and macOS-only behind a new `capture` Cargo
feature; build.rs sets cfg(hex_capture) only for macOS debug builds with
the feature, so release, Linux, Windows and Nix never compile the crate.
scripts/check and macOS CI test with the feature.
2026-10-25 12:15:14 -07:00
Kit Langton 7c180101bf Add scripts/check with nextest timeouts; make hanging tests deterministic
scripts/check runs fmt, clippy and nextest (falls back to cargo test).
.config/nextest.toml kills a test after 30 s (60 s for GPU scenes) and
reports it by name; CI uses the ci profile.

Fixes tests that hung or depended on the host: HID modifier queries and
Carbon layout lookups off the main thread, the leaked i18n language,
the stale 2.3.0 driver version, CoreAudio in the startup-failure test,
unbounded accept/recv waits, a 20 ms sleep race in local_api, and
keyboard_layout under --list.
2026-10-23 20:03:00 -07:00