Task 3: Bundle the pinned Herdr sidecar
Summary
Make the pinned Herdr v0.9.0 executable available in development and packaged 2code builds, as required by parent plan #394. Acquisition must be reproducible and checksum-verified. This task packages and discovers the binary; it must not start a Herdr server, switch the default runtime, or own terminals or worktrees.
Reuse the Task 1 pin in docs/herdr-integration.md and src-tauri/crates/infra/tests/fixtures/herdr/pin.json. Do not introduce a second version pin or download latest.
Dependencies: Parent plan #394. Prerequisite: #395 (Task 1, accepted on issue-395-herdr-integration-contract). Checkout base: #402 (Task 2, accepted on task-2-runtime-boundary). Open contract-gap issues #396–#401 and Task 2 gap #403 do not block this task.
Work to complete
-
Checksum-verified acquisition
- Add a script that downloads the v0.9.0 GitHub Release assets listed in
pin.json, verifies SHA-256 (GitHub asset digests; no detached GPG/cosign exists for this tag), and places executables where Tauri expects sidecars (src-tauri/binaries/, already gitignored). - Map Herdr asset names onto Tauri sidecar filenames for the supported triples:
x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,aarch64-apple-darwin,x86_64-apple-darwin,x86_64-pc-windows-msvc. The Linux binaries are static-pie ELFs; Windows is a zip whose digest is of the archive, then extractherdr.exe. - There is no Windows ARM64 stable asset; do not invent one. Fail closed on checksum mismatch or an unknown triple.
- Reuse the Task 1 cache layout when present (
${XDG_CACHE_HOME:-$HOME/.cache}/2code/herdr/v0.9.0) so developers and CI do not re-download blindly. Never commit binaries. - Wire the fetch into
tauri dev/tauri build(seescripts/tauri-before.mjs) and into.github/workflows/release.ymland.github/workflows/tauri-smoke.ymlsoexternalBincannot break existing packaged or smoke builds.
- Add a script that downloads the v0.9.0 GitHub Release assets listed in
-
Tauri sidecar configuration and license
- Register the pinned binary in
src-tauri/tauri.conf.jsonbundle.externalBin. Updatesrc-tauri/build.rsonly if sidecar path/target wiring requires it. - Add the minimum shell/sidecar capability in
src-tauri/capabilities/default.jsonif the chosen discovery API needs it. Do not grant a frontend-spawnable Herdr server. Do not auto-start Herdr on app launch. - Vendor Apache-2.0 license/NOTICE text for Herdr v0.9.0 next to the app (not the binary). Record the pin (version, tag, commit
b99002ac99b09e00b4ca692436cb15a6b0d676f1, asset URLs, checksums) so packaging does not depend on the website. - Sidecar packaging must not tie Herdr server lifetime to the GUI process.
externalBinis for locating and bundling the file. Do not spawnherdr servervia Tauri's sidecar Command / process manager.--versionas a short-lived child is allowed. Task 4 will spawn a detached server from the resolved path.
- Register the pinned binary in
-
Discovery and version reporting
- Add a Rust helper that resolves the bundled or fetched executable for the current target (dev:
src-tauri/binaries/; packaged: Tauri sidecar/resource path) and runsherdr --version, expectingherdr 0.9.0. - Keep this helper out of the Local PTY path and out of
HerdrStubAdapter. Do not replace the stub, changeRuntimeSelectordefault, or talk to a Herdr socket. - Verify discovery against a packaged layout (a real Linux
tauri buildbundle or an equivalent fixture). Inspecting the bundle for the sidecar and running--versionis enough; do not add a new Selenium suite. - If an IPC command is added for version/path reporting, it must be read-only, must not start a server, and requires
bun run typegen(never hand-editsrc/generated/). Prefer no frontend UI.
- Add a Rust helper that resolves the bundled or fetched executable for the current target (dev:
-
Prove packaging without changing runtime behavior
- Tests: pin mapping and checksum failure; Windows zip extracts
herdr.exeafter the zip digest matches; resolved sidecar--versionisherdr 0.9.0when the binary is present; app startup still defaults to Local and does not spawnherdr server. - Missing binary: skip optional live checks unless an explicit required flag is set. Production/dev/package paths that declare
externalBinmust fetch first rather than skip. - Existing PTY and Task 2 routing tests keep passing.
- Tests: pin mapping and checksum failure; Windows zip extracts
Likely files and directories
- New:
scripts/fetch helper (or equivalent undersrc-tauri/) — download, verify, rename/extract intosrc-tauri/binaries/. - New:
src-tauri/crates/infra/src/herdr/(or similar) — path discovery and--versionreporting; no socket client. - New: Herdr Apache-2.0 license/NOTICE text for the bundled third-party binary.
- Update:
src-tauri/tauri.conf.json—bundle.externalBin. - Update:
src-tauri/capabilities/default.json— sidecar permission only if required. - Update if needed:
src-tauri/build.rs,scripts/tauri-before.mjs,src-tauri/crates/infra/src/lib.rs. - Update:
.github/workflows/release.yml,.github/workflows/tauri-smoke.yml— fetch the host sidecar before packaging. - Reuse, do not duplicate:
src-tauri/crates/infra/tests/fixtures/herdr/pin.json,docs/herdr-integration.md. - Do not rewrite:
src-tauri/crates/service/src/pty.rs,src-tauri/crates/infra/src/pty.rs, Task 2 runtime routing, frontend terminal code.
Estimated changes: 150–300 lines total, additions plus deletions, including tests and license text; excluding generated files, lockfile churn, and downloaded binaries. Material scope growth should become a separate issue.
Acceptance criteria
- [ ] Development and packaged builds can resolve a checksum-verified Herdr v0.9.0 sidecar for each supported triple in
pin.json; acquisition never useslatest. - [ ] SHA-256 mismatch refuses to install the binary. Windows uses the zip digest, then
herdr.exe. Windows ARM64 is explicitly unsupported. - [ ] Binaries stay gitignored; Apache-2.0 license/NOTICE for Herdr v0.9.0 is tracked in source.
- [ ] Tauri
externalBin(and capabilities if needed) register the sidecar without auto-starting a server and without making Herdr a child of the GUI process tree. - [ ] A discovery helper reports
herdr 0.9.0from the resolved executable, including a packaged-app or equivalent bundle-layout check. - [ ]
tauri dev/tauri build/ Linux smoke / release packaging fetch the sidecar soexternalBindoes not break existing CI. - [ ] Default runtime remains Local. Existing PTY/agent path still works. The Herdr stub stays fail-closed. No session or worktree is owned by both backends.
- [ ] No
herdr serveris started; no JSON socket client or terminal-session attach is implemented. - [ ]
cargo test --workspacefromsrc-tauri(orcargo test --workspace --exclude codewhere GTK is unavailable). If frontend or scripts in lint scope change:bun run lint:check,bun run typecheck,bun run test. IPC changes usebun run typegen; do not editsrc/generated/by hand.
Out of scope
- Server discovery, namespace resolution, detached startup, readiness timeouts, or GUI-exit lifetime (Task 4).
- Socket request client, snapshot sync, DB mapping, profile adoption, terminal create/attach, xterm transport, or agent-state from Herdr (Tasks 5–13).
- User-facing runtime health UI or making Herdr the default (Tasks 18/21).
- Closing or implementing contract-gap issues #396–#401, line-count tracker #400, or Task 2 gap #403.
- Removing the local PTY runtime or agent detector.
- Changing frontend terminal rendering, restoration, or detection.
- Remote Herdr operation.
- Re-signing or notarizing the Herdr binary itself; app signing/notarization stays as it is in release.yml.