Skip to content
11 changes: 10 additions & 1 deletion desktop/scripts/smoke-package.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// folder: Herdr reports the pinned version, the device helper and the hook
// helper start, and the bundled
// `hide connect` starts the bundled daemon, which serves the web shell it
// embeds, installs the CLI and holds both agents for the first-run choice
// embeds, installs the CLI and holds both installed agents for the first-run choice
// (their files untouched), installs both hooks once that choice is answered
// over the daemon's socket, and is replaced by a second
// package fixture with a changed daemon hash, before `hide stop` ends it. Every process runs with a private home
Expand Down Expand Up @@ -135,6 +135,15 @@ try {
});
delete isolated.XDG_STATE_HOME;

// Both runtimes are installed: an agent counts only when its program is
// found, and the kit searches `~/.local/bin` on every system. The stand-ins
// answer nothing, and a version Hide cannot read does not hold a hook back.
const programs = path.join(home, ".local", "bin");
fs.mkdirSync(programs, { recursive: true });
for (const name of ["claude", "codex"]) {
if (process.platform === "win32") fs.writeFileSync(path.join(programs, `${name}.cmd`), "@exit /b 0\r\n");
else fs.writeFileSync(path.join(programs, name), "#!/bin/sh\nexit 0\n", { mode: 0o755 });
}
// Both runtimes are configured, with an unrelated hook we must preserve.
for (const [folder, file] of [[".claude", "settings.json"], [".codex", "hooks.json"]]) {
fs.mkdirSync(path.join(home, folder));
Expand Down
7 changes: 4 additions & 3 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ macOS and Linux are watched through `notify`; Windows is watched with `ReadDirec
The Git watch in `herdr-core/src/worktrees.rs` is the caller: it keeps only Git's facts (`HEAD`, `index`, `packed-refs`, `FETCH_HEAD`, `refs/`), drains the queue on the coordinator's tick outside the runtime lock, and turns an overflow into a `git_watch.overflow` diagnostic and a re-read of every watched project, where an inotify overflow used to be dropped without a word.
No watch event wakes the core: the coordinator's tick reads the queue, as it read the callback's map before, so the notifier's fan-out is unchanged.

`host` is the fifth module and answers where the account's things live and what the machine is called: `home_dir` (`HOME`, `USERPROFILE` on Windows), `state_dir` (`~/Library/Application Support`, `$XDG_STATE_HOME` or `~/.local/state`, `%LOCALAPPDATA%`) and `state_dir_under` for a caller whose state follows a home it was handed, `herdr_socket_default` (Herdr's own order for the pinned release: `$XDG_CONFIG_HOME/herdr`, then `%APPDATA%\herdr` on Windows, then `~/.config/herdr`, each with `herdr.sock`, which `real_herdr.rs` checks against what the pinned Herdr reports), `login_path` and `find_program` (an execute bit on Unix, `PATHEXT` on Windows), `default_shell`, `trash` (`NSFileManager` on macOS, the Recycle Bin, the freedesktop trash), `tailscale_cli` (the app's CLI on macOS and Windows; `Unsupported` on Linux, which has no fixed place), `name` and `machine_id` (`IOPlatformUUID`, `/etc/machine-id`, the `MachineGuid` the Windows registry keeps).
`host` is the fifth module and answers where the account's things live and what the machine is called: `home_dir` (`HOME`, `USERPROFILE` on Windows), `state_dir` (`~/Library/Application Support`, `$XDG_STATE_HOME` or `~/.local/state`, `%LOCALAPPDATA%`) and `state_dir_under` for a caller whose state follows a home it was handed, `herdr_socket_default` (Herdr's own order for the pinned release: `$XDG_CONFIG_HOME/herdr`, then `%APPDATA%\herdr` on Windows, then `~/.config/herdr`, each with `herdr.sock`, which `real_herdr.rs` checks against what the pinned Herdr reports), `login_path` (this process's `PATH`, which starts no shell) and `find_program` (an execute bit on Unix, `PATHEXT` on Windows), `login_shell_path` (the `PATH` the account's login shell sets up: `$SHELL -ilc` prints it between two marks, past whatever the startup files print, under a deadline and a stop flag; `Unsupported` on Windows, whose processes already get the account's `Path`), `default_shell`, `trash` (`NSFileManager` on macOS, the Recycle Bin, the freedesktop trash), `tailscale_cli` (the app's CLI on macOS and Windows; `Unsupported` on Linux, which has no fixed place), `name` and `machine_id` (`IOPlatformUUID`, `/etc/machine-id`, the `MachineGuid` the Windows registry keeps).
Each refuses with `NotFound`, `InvalidInput` or `Unsupported` rather than guessing; hided's environment registry hands its own values to the `_from` forms, so the variables it depends on stay listed in `hided/src/env.rs`.
The Windows check builds the whole workspace, tests included.
`listeners` observes Windows TCP owners through the native IPv4 and IPv6 listener tables and reads each owner's cwd from bounded process-parameter memory, while the core's Unix reader retains `lsof`.
Expand Down Expand Up @@ -1359,7 +1359,7 @@ Another tool's hook entries, a `hide` that is not Hide's link, and Herdr's per-p
Every apply also retires the agent labels Herdr plugin `hide.agent-context-labels`, which the core's label worker replaced (PRD labels-in-hided D-12; `hide-kit/src/labels.rs`), before it installs any part: its Herdr link is taken out (a GitHub install with the machine's `herdr plugin uninstall`, any other link with `plugin.unlink`), a watcher found by the lock it holds under `<home>/.local/state/hide.agent-context-labels/watcher.lock` is sent `SIGTERM` and, after five seconds, `SIGKILL` for it and its descendants, and the kit's copy `~/.hide/kit/plugins/agent-context-labels` and the plugin's state folder are removed once the link is gone, so a pass that could not unlink (Herdr down) keeps them and tries again on the next.
What was removed and what stayed is `KitReport.labels_retirement`, which the core logs as `plugin.retired` or `plugin.retire_incomplete`; it is not a kit part, so Settings shows no row for it.
On this Mac the core imports the plugin's state before the kit first runs.
Every child the kit starts (`herdr plugin uninstall`, `codex features`) runs with a cleared environment, as an owned child that leads its own tree, under a deadline, and ends when the kit's owner raises its stop flag (`hide-kit/src/process.rs`, `hide-agent-hooks/src/codex_daemon.rs`, both over `hide_platform::process::run_to_end`).
Every child the kit starts (`herdr plugin uninstall`, `codex features`, the login shell asked for its `PATH`) runs with a cleared environment, as an owned child that leads its own tree, under a deadline, and ends when the kit's owner raises its stop flag (`hide-kit/src/process.rs`, `hide-agent-hooks/src/codex_daemon.rs`, both over `hide_platform::process::run_to_end`).
The one-release retirement stage first performs bounded, read-only checks of the former coordinator and Hide ledgers, sasu registry and registered checkout run state.
An active run, open request, active watch, unreadable record or capacity failure leaves every installation and folder unchanged and reports why.
For a device, `remote::retirement` reads that account's state and its registered checkout roots through the existing SSH/SFTP connection before any helper upload, folder creation or current-link update, with the existing 15-second operation deadline.
Expand All @@ -1384,7 +1384,8 @@ It is the one part with a switch (`ComponentId::can_turn_off`, the `kit_componen
Every other agent is a row of `hide_kit::agents::ADAPTERS`, and a per-agent layer (`hide-kit/src/agent_kit.rs`) sits beside the parts: `Scope` carries `agent_on` and `agent_off`, `KitReport.agents` answers one `AgentReport` per adapter, the record keeps the operator's choice and the pieces installed, and the core's `kit_agent_set` event, `KitSnapshot.agents` and the host protocol's `reinstall` (`agents_on`, `agents_off`, both defaulted so a helper that predates them ignores them) carry the same choice to a device.
Claude Code's and Codex's hook parts stay kit parts, because Memory, the pane diagnosis and `device_hook_status` read them, and their agent switch gates the part: off, the part is neither installed nor replaced, and switched off now it is taken out.
The other agents' hooks are `hide_agent_hooks::guidance`, a smaller module with its own marker and per-agent file shape, so the five-event runtime code and its counters never take a meaningless arm for an agent that does not feed them.
Detection runs only on the kit worker and the helper, never on the render path, and under test it searches only the fixture's `~/.local/bin`, so a developer's own agents cannot decide a result.
An agent is installed when one of its programs is found on the login shell's `PATH`, the daemon's own or the usual install folders; a folder it creates does not count, and an agent that is on and whose program is gone keeps its pieces and its switch until the operator switches it off ([agent-hooks.md: Installed means the program is found](agent-hooks.md#installed-means-the-program-is-found)).
Detection, and the login shell it asks (once, then again only when a startup file changed), run only on the kit worker and the helper, never on the render path, and under test the search is the fixture's `~/.local/bin` and a stand-in shell's answer, so a developer's own agents cannot decide a result.
`hide_kit::Scope` carries both choices, `restore` and `turn_off`, and two queued requests for one machine merge with the later choice winning for a part both name; the device helper receives them in `kit` `reinstall` (helper protocol 14).
Removing a machine leaves the setting as it is, since Hide cannot tell its own switch from the operator's choice.
Every Codex start Hide makes passes `--no-daemon` first when that machine's kit read a Codex that has the setting, whichever way the switch stands: `wire::agent_start_params` takes the machine's `codex_launch::CodexDaemon`, which every start path (a task's agent, a reopen, a fork, a wake) carries from the runtime, so no path can leave it out; a missing, failed, outdated or pending capability refuses the start with an instruction to recheck the target machine’s kit in Settings.
Expand Down
2 changes: 1 addition & 1 deletion docs/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ An acquisition failure blocks the suite at that prerequisite and retains the ups
| `pnpm --dir desktop typecheck`, `lint`, `test` | The desktop CI lane |
| `pnpm --dir desktop e2e` | Playwright `_electron` against a private hided and pinned Herdr; needs `web/dist`, `target/debug/hide` and `hided`, and the pinned `herdr` as the web e2e does |
| `pnpm --dir desktop package` | `desktop/scripts/package.mjs`: builds the release binaries and fetches the pinned Herdr, bundles `hided`, `hide`, `hide-agent-hooks`, `hide-host-helper-macos-<arch>` and `herdr` into `Contents/Resources`, ad-hoc signs `desktop/out/hide-darwin-<arch>/hide.app` (bundle id `me.grab.hide.desktop`), and archives it to `desktop/out/hide-v<version>-macos-<arch>.zip` beside a `.sha256` checksum; nothing is notarized or installed. On Windows x64 and Linux x64 the same command builds that system's package, unsigned: the folder `desktop/out/hide-win32-x64/` or `hide-linux-x64/` with the same binaries (`.exe` on Windows, with Herdr's `conpty/` beside `herdr.exe`) and `hide-host-helper-<windows\|linux>-x86_64` in its `resources/`, archived to `hide-v<version>-windows-x64.zip` (the system's `tar.exe`) or `hide-v<version>-linux-x64.tar.gz` beside a `.sha256`. Each system packages only itself, and a machine of another architecture than its pinned Herdr asset is refused |
| `node desktop/scripts/smoke-package.mjs <archive>` | On Windows or Linux only: checks a package against its `.sha256`, unpacks it into a temporary folder, and with a private home and state folder runs the bundled `herdr --version`, the device helper, `hide-agent-hooks doctor`, and `hide connect`, `/health`, the embedded shell, first-launch CLI and hooks, a command from a fresh shell, the completed retirement row, replacement by a second package fixture, refreshed paths, same-build reuse, standalone refusal and `hide stop`, then waits for each daemon pid it started to end (ten seconds, a named failure beyond that) before it removes the folder, with no removal retry; `.github/workflows/package.yml` runs it after each package. It refuses macOS, where first-launch kit behavior is covered by the isolated desktop suite |
| `node desktop/scripts/smoke-package.mjs <archive>` | On Windows or Linux only: checks a package against its `.sha256`, unpacks it into a temporary folder, and with a private home (stand-in `claude` and `codex` programs in `~/.local/bin`, so both agents are installed) and state folder runs the bundled `herdr --version`, the device helper, `hide-agent-hooks doctor`, and `hide connect`, `/health`, the embedded shell, first-launch CLI and hooks, a command from a fresh shell, the completed retirement row, replacement by a second package fixture, refreshed paths, same-build reuse, standalone refusal and `hide stop`, then waits for each daemon pid it started to end (ten seconds, a named failure beyond that) before it removes the folder, with no removal retry; `.github/workflows/package.yml` runs it after each package. It refuses macOS, where first-launch kit behavior is covered by the isolated desktop suite |

The app attaches to whatever daemon the environment names: without `HIDE_STATE_DIR` it is the operator's own at `~/.hide/state`.
For QA, set `HIDE_STATE_DIR`, `HOME`, `HERDR_SOCKET_PATH` and `HIDE_DESKTOP_USER_DATA_DIR` to private paths, as `desktop/e2e/fixture.ts` does and refuses to launch without.
Expand Down
5 changes: 3 additions & 2 deletions docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Every launch of the installed app installs Hide's kit on this Mac without asking
The one exception is a Mac the kit has never run on: it holds Claude Code's and Codex's hook entries and skills, and Codex's per-pane daemon setting, until the operator answers the first-run agent choice (UI_BEHAVIOR.md, Settings > Agents); both agents are recorded off in the hold, installed or not, so an agent installed later also starts off, and the rest below is installed as usual:

- `~/.local/bin/hide`, a link to the app's `hide` command, unless a `hide` that is not Hide's is already there;
- Hide's entries in `~/.claude/settings.json` and `~/.codex/hooks.json`, for each of Claude Code and Codex that is set up on this Mac, next to whatever other tools put there;
- Hide's entries in `~/.claude/settings.json` and `~/.codex/hooks.json`, for each of Claude Code and Codex whose folder (`~/.claude`, `~/.codex`) is on this Mac, next to whatever other tools put there;
- A one-release retirement stage removes the former coordination installation after its read-only preflight succeeds; see Coordination retirement below;
- `Codex를 pane마다 실행`: when this Mac's Codex has the shared app-server daemon turned on, `codex features disable daemon_auto_start`, so each Codex runs in its own pane and Hide can read it. A daemon already running keeps running, and the setting reaches each Codex started after it. Settings > Devices turns it back on (`codex features enable daemon_auto_start`), and Hide then leaves it on.

Expand Down Expand Up @@ -266,7 +266,8 @@ The first launch of a newer app moves them once:
Settings > Devices shows each of these on This Mac's row, with where it is or why it is not.
A part you remove by hand stays removed; Reinstall on that row puts it back.
Each agent Hide knows also has a switch on that row, and Claude Code and Codex are on until you turn them off.
An agent that is on gets a `hide-browser` skill stub in the folder it reads skills from, and, where its documentation supports one, a `SessionStart` hook entry; every other agent is off until you switch it on, and an agent that is not set up on the machine has no switch there.
An agent that is on gets a `hide-browser` skill stub in the folder it reads skills from, and, where its documentation supports one, a `SessionStart` hook entry; every other agent is off until you switch it on, and an agent that is not installed on the machine has no switch there.
An agent is installed when Hide finds its program where your terminal would: on your login shell's `PATH` and in the usual install folders; a folder the agent creates does not count.
Switching an agent off takes out only the entries and stubs Hide wrote, and [agent-hooks.md](agent-hooks.md#other-agents-skill-and-guidance-hook) lists every agent, its skill folder, and why a hook is or is not written for it.
A `hided` run outside the installed app, such as a development build, installs nothing on this Mac and says so there.
Agent labels are made by hide's own daemon, so there is no labels part to install.
Expand Down
Loading
Loading