Files
sausage/host/js/README.md
T
surma ec6e20a9d7 host: sausage run with the userland bundle, real shell and services (T13)
- userland/bundle.nu builds the userland and assembles target/userland/bin
  (bin names, tools.txt aliases, brush as sh and bash).
- run and sh take --userland (default SAUSAGE_USERLAND); /bin is read-only.
- The console's bash tool runs through the process table with the
  conversation id; large output spills to the world's /tmp.
- sausage run starts the services supervisor.

P1 exit session (openai/gpt-6.1-sol, fresh world): write, read, edit, git
init/add/commit/diff/log, grep -rn, rg, find and a sed|sort|uniq|wc pipeline.
2026-11-06 17:34:11 +00:00

41 lines
2.2 KiB
Markdown

# Host JavaScript
The console uses pi-durable in V8. Rust owns the SQLite connection.
The console runs V8 on a dedicated current-thread Tokio runtime.
This satisfies Deno's runtime requirement without a change to the CLI runtime.
The database lives at `<dir>/host/harness.sqlite`, outside the world.
WAL preserves atomic transactions after SIGKILL. `synchronous=FULL` flushes each commit before SQLite reports success.
The coding tools access the shared VFS through Rust operations.
The shell sends commands to the host's `Exec` implementation.
The adapter supplies the filesystem operations that the four coding tools use.
It does not implement the other portable filesystem capabilities.
The console uses the real process table and passes the conversation id to each command.
Large shell output spills to `/tmp/bash-<uuid>.log` inside the world.
The tool result names the file and retains pi's limited output window.
Build the userland with `nix develop -c nu userland/bundle.nu`.
The script discovers binaries through Cargo metadata and reads each package's optional `tools.txt`.
It mounts through `sausage run <world> --userland target/userland/bin`.
The `sh` subcommand accepts the same option. Both commands default to `SAUSAGE_USERLAND`.
The bundle appears read-only at `/bin`. Agents can install tools in `/usr/local/bin`.
## Reproduce the bundles
```sh
npm ci --prefix host/js
npm run --prefix host/js bundle
CARGO_TARGET_DIR=target/harness nix develop -c cargo test -p sausage --test harness
```
The lock file pins npm dependencies. The checked-in bundles let Cargo build without npm or network access for JavaScript.
Cargo still needs its normal Rust dependencies and the V8 archive.
For Nix, use a separate npm derivation with `importNpmLock` and the checked-in lock file.
Run the bundle script there. Pass its output to the Rust source derivation before Crane builds the host.
The Rust build must not execute npm or download JavaScript packages.
The console reads `PI_PROXY_BASE_URL` and `PI_PROXY_API_KEY` from the host environment.
It selects `openai/gpt-6.1-sol` with low reasoning effort.
This model rejects disabled reasoning. Tests use the faux provider without credentials.