Expand description
Host operations the Python kernel API calls (RLM-first core), served as a kernel::HostHandler.
Ported from the TypeScript session worker’s host handler (experimental/session-worker.ts), its blocking
bash (ultron/rlm/host-bash.ts over core/bash-executor.ts) and host-owned shell jobs (ultron/rlm/shell-jobs.ts).
read, write and edit run inside runtime.py; the host only answers their files.before_write check.
Requests that need a model, subagents or durable stores are refused with not_available.
Shell jobs are durable (Host::with_journal): each runs under a small keeper shell in its own process group that
writes the raw output to <id>.out and the exit status to <id>.exit, so the job does not depend on the worker
that started it. The host follows those files into the cleaned, bounded spill file <id>.log and journals every
start and end. A reopened worker settles each job the journal lists as running from what really happened: still
running (the keeper is alive: it is followed again), completed with the status the keeper wrote, or lost (the
process ended without one); never silently gone.
Modules§
- bash_
notes - Result conventions of the model’s
bash(wave 38, from Mirror’s tools/bash_tool.rs): - cell
- One cell’s tool result text:
UltronRlmKernel.executeCell(experimental/session-worker.ts) overtruncateToolOutput(ultron/rlm/output-truncation.ts) andmaskCellOutputCounted(ultron/rlm/output-secrets.ts). - cell_
writes - The files a cell wrote through the checked
write()/edit()(files.before_write), with their text before and after, so the cell’s result can carry a diff of what it changed (the interactive mode’s expanded rlm cell). The text before is read when the write is proposed, while the file still holds it; at the cell’s end a write counts only when the file holds what was proposed. Files changed by other means (bash) are not seen here. - file_
hooks - Generic file-write hooks for the RLM REPL (ultron/file-hooks.ts):
- journal
- The shell job journal (session value
ultron.module/jobs) and job-done events, ported from ultron/rlm/shell-jobs.ts (#load,#persist,jobSummary,#fileTail) and experimental/session-worker.tsjobEvent. - loki_
guard - Ultron’s built-in Loki guardrails (ultron/loki.ts
LokiGuard), running the Rust Loki engine in-process instead ofpython loki.py: - sandboxed
- Isolation for the host’s operations, from the
sandboxcrate. - secrets
- Secret masking of cell output, ported from ultron/secrets.ts (SecretDetector over rlm/secret-patterns.json),
ultron/rlm/output-secrets.ts (known secret values,
ULTRON_MASK_SECRETS) and ultron/sensitive.ts. - shell
- The shell commands run under (utils/shell.ts
getShellConfigon Unix): theshellPathsetting when it names an existing file (else the command fails with “Custom shell path not found:”), else /bin/bash, elsebashfound on PATH, elsesh. Every shell runs the command as<shell> -c <command>. - text
- Output text handling shared by the blocking bash and shell jobs, ported from utils/ansi.ts (stripAnsi), utils/shell.ts (sanitizeBinaryOutput), core/tools/truncate.ts (truncateTail) and the streaming TextDecoder.
- view_
image rlm.view_imagehost side, ported from ultron/rlm/view-image.ts over utils/image-process.ts, utils/image-resize-core.ts and utils/mime.ts: content-sniffed type, conversion of BMP to PNG, auto-resize to the model’s limits (Lanczos3, then the smaller of PNG and JPEG under the byte budget, then 3/4 steps), and the kernel’s short description. Photon (WASM) is replaced by theimagecrate, so resized or converted bytes differ from TypeScript’s; dimensions, type choice and limits do not.
Structs§
- Allow
All - Host
- JobEnd
- A job that ended, as
ShellJobsonEndreports it: its record, whether a caller was waiting on it (the result came inline, so nothing is announced) and whether its root turn’s abort stopped it.
Constants§
- JOB_
MAX_ ACTIVE - JOB_
MAX_ RETAINED - JOB_
RETAINED_ BYTES - JOB_
TEXT_ BYTES - PARENT_
TOKEN_ ENV - The verdict token of an
ultron mcp --childserver (ULTRON_PARENT_TOKEN), removed from every command’s environment.
Traits§
- Guard
- The before-write and before-shell guards (Loki). The default allows everything.
Functions§
- not_
available - sandboxed_
argv argvas it runs inside a sandbox: every sandbox clears the environment to its allowlist (bwrap--clearenv,env -iunder unshare and in a Docker container), so the command’s own variables (a worktree subagent’sULTRON_WORKTREE,ULTRON_PARENT_REPO,ULTRON_WORKTREE_BRANCH,PWD) are set inside, byenv.