Skip to content

feat(home): browser terminal for the sandbox; herdr as its own aggregate; aspects charter - #2957

Draft
cameronraysmith wants to merge 9 commits into
mainfrom
devin/1788554945-a-sandbox-terminal
Draft

feat(home): browser terminal for the sandbox; herdr as its own aggregate; aspects charter#2957
cameronraysmith wants to merge 9 commits into
mainfrom
devin/1788554945-a-sandbox-terminal

Conversation

@cameronraysmith

Copy link
Copy Markdown
Owner

Summary

PR-A of a three-PR stack (A: sandbox terminal → B: dissolve packages → C: module adoption). Tracked in Linear as CAM-44.

The Devin sandbox's built-in editor hangs in the browser-to-VM tunnel while the VM-side server stays healthy, so the sandbox needs an interactive terminal that does not depend on it. This PR provides one declaratively and, in doing so, fixes two aggregate-boundary defects it exposed.

  • modules/home/README.md (new): the home-manager aspects index and the aggregate contract that PR-B and PR-C are verified against — one directory = one user-facing capability, one secret posture; module over raw package; configure at the consumer; per-user exceptions are lib.mkForce overrides, not omitted aggregates; no Den/flake-file, no _*.nix escape modules.
  • herdr split out of ai into modules/home/herdr/ (git mv, aggregate key aiherdr): it reads no secret, so a user without the AI secrets can import it. crs58 imports both; its package set is unchanged except +browser-terminal.
  • modules/home/herdr/browser-terminal.nix: writeShellApplication around ttyd -W … herdr, port 7681, bind 127.0.0.1 (override BROWSER_TERMINAL_INTERFACE/BROWSER_TERMINAL_PORT), COLORTERM=truecolor. It lives in herdr because it consumes both herdr and ttyd. The xterm.js fontFamily list is pinned in the wrapper because the browser resolves it against the client's fonts; Nerd Font glyphs are private-use codepoints and never come from fonts installed in this profile.
  • modules/home/terminal/ttyd.nix: raw pkgs.ttyd, unconditional, replacing the line in packages/development-packages.nix so users importing terminal without herdr keep it (verified: christophersmith, tara package sets identical to main).
  • users/ubuntu imports core + herdr and overrides what the sandbox cannot run: services.ssh-agent.enable = mkForce false (no systemd user manager) and LANG/LC_ALL/LC_CTYPE = mkForce "C.UTF-8" (the image's glibc has only C.utf8; core's en_US.UTF-8 made every shell warn).
  • .devin/blueprint.yaml knowledge item terminal: a session starts browser-terminal and exposes 7681 through the authenticated preview tunnel; initialize/maintenance never do (no tunnel during image builds); the tunnel is the access control.

Verification: nix flake check, just lint, statix/deadnix, browser-terminal derivation built (shellcheck), ubuntu@x86_64-linux activationPackage built; sorted home.packages names vs main: crs58 +browser-terminal; ubuntu +browser-terminal +htab +herdr +ttyd +2 fontconfig dirs; christophersmith/tara no change. Activated on the Devin VM and confirmed through the preview tunnel: ttyd → herdr → fish, Nerd Font glyphs render, nvim works.

Link to Devin session: https://app.devin.ai/sessions/a940684e0e14430f82ed19713c2d0385
Open in Devin Desktop: https://app.devin.ai/desktop/session/a940684e0e14430f82ed19713c2d0385?variant=devin
Requested by: @cameronraysmith

herdr reads no sops secret, so under the one-aggregate-one-secret-posture contract it is its own aggregate rather than part of ai. The module and its htab helper move unchanged; crs58 imports both aggregates, so its evaluated package set is the same.
The sandbox profile gains the core aggregate (fontconfig, XDG, Catppuccin, session variables, SSH, Bitwarden) and herdr. core/bitwarden.nix enables the systemd user ssh-agent on Linux, which the sandbox has no user manager to run, so that one module is overridden with lib.mkForce as the aggregate contract prescribes.
browser-terminal serves herdr over ttyd on ${BROWSER_TERMINAL_PORT:-7681}, bound to every interface with writable input, for the Devin sandbox where the built-in editor terminal is not always available. The wrapper's flags live in the wrapper's module, so ttyd moves out of the shared development package list into terminal/ttyd.nix, guarded on programs.herdr.enable so terminal still evaluates without herdr.
A terminal knowledge item tells the sandbox agent to start browser-terminal after activating the ubuntu profile and to expose port 7681 through the app-preview tunnel, so the user has a shell whatever the state of the built-in editor.
@devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant