Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
191 commits
Select commit Hold shift + click to select a range
e793206
feat: US-001 - Extract state types from service.rs and expand protoco…
NathanFlurry Apr 6, 2026
a8c73a5
feat: US-002 - Extract vm.rs from service.rs
NathanFlurry Apr 6, 2026
71a32d7
feat: US-003 - Extract bootstrap.rs and bridge.rs from service.rs
NathanFlurry Apr 7, 2026
0383ec2
feat: US-004 - Extract filesystem.rs from service.rs
NathanFlurry Apr 7, 2026
01c255f
feat: US-005 - Extract execution.rs from service.rs
NathanFlurry Apr 7, 2026
5ea6a0d
feat: US-006 - Reorganize existing plugin files into plugins/ directory
NathanFlurry Apr 7, 2026
deaaf50
feat: US-007 - Move inline service.rs tests to crates/sidecar/tests/
NathanFlurry Apr 7, 2026
7fe8635
feat: US-008 - Convert sidecar main loop from nix::poll to tokio::sel…
NathanFlurry Apr 7, 2026
f469412
chore: scope test commands in PRD to avoid pre-existing failures, add…
NathanFlurry Apr 7, 2026
ea909c2
docs: clarify Node.js execution model in crates/CLAUDE.md
NathanFlurry Apr 7, 2026
935d12f
docs: add critical no-host-escape invariant to all CLAUDE.md files, f…
NathanFlurry Apr 7, 2026
6e348ba
docs: add recovery reference for secure-exec polyfill code to CLAUDE.…
NathanFlurry Apr 7, 2026
3db99ae
chore: add US-008a - restore V8 isolate execution engine as next prio…
NathanFlurry Apr 7, 2026
c3c7161
feat: US-008a - Restore V8 isolate execution engine with kernel-backe…
NathanFlurry Apr 7, 2026
e3ab9e2
feat: US-009 - Add bidirectional frame support to wire protocol and T…
NathanFlurry Apr 7, 2026
25506da
chore: add US-009a - register missing V8 bridge functions and clean u…
NathanFlurry Apr 7, 2026
31ba086
chore: add US-028a - fix V8 dgram/UDP bridge wiring
NathanFlurry Apr 7, 2026
dd14cce
docs: absolute no-host-execution rule in all CLAUDE.md - no fallbacks…
NathanFlurry Apr 7, 2026
ed026b1
feat: US-009a - Register missing V8 bridge functions, remove dead nod…
NathanFlurry Apr 7, 2026
e0ce9fd
feat: US-010 - Implement declarative permissions in Rust and replace …
NathanFlurry Apr 7, 2026
c15113e
feat: [US-011] - Add layer RPCs and native module access
NathanFlurry Apr 7, 2026
b91f82b
feat: US-030 - Fix timer scheduling so setTimeout/setInterval actuall…
NathanFlurry Apr 7, 2026
967af9f
chore: fix prd story status
NathanFlurry Apr 7, 2026
07d5d3f
chore: fix prd story statuses
NathanFlurry Apr 7, 2026
d69b35d
feat: US-031 - Wire stdin reads to kernel process stdin
NathanFlurry Apr 7, 2026
79b6e53
feat: US-032 - Implement crypto basic handlers (randomFill, randomUUI…
NathanFlurry Apr 7, 2026
701db5a
feat: US-012 - Add JS-bridge mount plugin for TypeScript VirtualFileS…
NathanFlurry Apr 7, 2026
260d0a7
feat: US-034 - Add TCP socket advanced ops to sidecar dispatch
NathanFlurry Apr 7, 2026
0c7c8c4
feat: US-035 - Add TLS support to sidecar dispatch
NathanFlurry Apr 7, 2026
42f6400
feat: US-036 - Add HTTP/1 server request/respond handlers to sidecar
NathanFlurry Apr 7, 2026
df1c863
feat: US-033 - Implement crypto advanced handlers (ciphers, keys, sig…
NathanFlurry Apr 7, 2026
bdcd393
feat: US-039 - Wire PTY raw mode to kernel
NathanFlurry Apr 7, 2026
7650197
feat: US-039 - Wire PTY raw mode to kernel
NathanFlurry Apr 7, 2026
2311d1e
feat: US-038 - Add upgrade socket and dgram extras to sidecar
NathanFlurry Apr 7, 2026
4b2f63c
chore: mark US-038 passed in prd
NathanFlurry Apr 7, 2026
bd398fc
feat: US-040 - Triage and fix failing execution tests for V8 path
NathanFlurry Apr 7, 2026
2f641a4
feat: US-037 - Add HTTP/2 full stack to sidecar
NathanFlurry Apr 7, 2026
790f8d1
feat: US-017 - Move command resolution and path mapping to sidecar
NathanFlurry Apr 7, 2026
6574fc3
feat: US-018 - Delete TypeScript command resolution and path mapping …
NathanFlurry Apr 7, 2026
af6661a
feat: US-019 - Implement virtual process support in kernel process table
NathanFlurry Apr 7, 2026
2664323
feat: US-020 - Implement tool dispatch, shim gen, prompt gen, and arg…
NathanFlurry Apr 7, 2026
faf9d13
feat: US-021 - Delete TypeScript host-tools files and add zodToJsonSc…
NathanFlurry Apr 7, 2026
244b302
feat: US-022 - Implement JSON-RPC 2.0 NDJSON codec and ACP client in …
NathanFlurry Apr 7, 2026
5de7105
feat: US-023 - Implement session state machine and agent compatibilit…
NathanFlurry Apr 7, 2026
1a65e3a
feat: US-024 - Implement inbound ACP request handling in Rust
NathanFlurry Apr 7, 2026
804914e
feat: US-025 - Delete TypeScript ACP/session files and wire to sideca…
NathanFlurry Apr 7, 2026
142152d
feat: US-026 - Embed rusqlite and expose SQLite RPCs in sidecar
NathanFlurry Apr 7, 2026
ec05678
feat: US-027 - Consolidate sidecar/ TypeScript files and eliminate na…
NathanFlurry Apr 7, 2026
c5033dd
feat: US-028 - Gut runtime.ts to types.ts and verify final target arc…
NathanFlurry Apr 7, 2026
5baa9ef
feat: US-028a - Fix V8 bridge dgram/UDP wiring so guest UDP packets r…
NathanFlurry Apr 7, 2026
0959d21
feat: US-029 - Fix all remaining test failures and get full pnpm test…
NathanFlurry Apr 8, 2026
b6723df
feat: US-048 - Comprehensive module resolution test suite for V8 Loca…
NathanFlurry Apr 8, 2026
175924e
feat: US-049 - Fix module resolution bugs found by test suite
NathanFlurry Apr 8, 2026
301aac1
feat: US-050 - Pi SDK boot probe — require Pi SDK in V8 and log all f…
NathanFlurry Apr 8, 2026
caaaca2
feat: US-051 - Node.js builtin conformance tests scoped to Pi SDK dep…
NathanFlurry Apr 8, 2026
781969d
feat: US-056 - Replace hand-written polyfill stubs with node-stdlib-b…
NathanFlurry Apr 8, 2026
d07bb94
feat: US-057 - Replace _networkFetchRaw with undici over kernel TCP s…
NathanFlurry Apr 8, 2026
2d2bc56
feat: US-054 - Comprehensive CJS/ESM interop and edge case test suite
NathanFlurry Apr 8, 2026
511abc6
feat: US-054 - Comprehensive CJS/ESM interop and edge case test suite
NathanFlurry Apr 8, 2026
6cdecfa
feat: US-055 - Fix CJS/ESM interop gaps found by test suite
NathanFlurry Apr 8, 2026
582a012
feat: US-055 - Fix CJS/ESM interop gaps found by test suite
NathanFlurry Apr 8, 2026
942f63b
feat: US-058 - Add formal bridge contract and restore _loadPolyfill m…
NathanFlurry Apr 8, 2026
c651452
feat: US-051 - Node.js builtin conformance tests scoped to Pi SDK dep…
NathanFlurry Apr 8, 2026
261f0dd
feat: US-052 - Fix V8 polyfill conformance gaps found by boot probe a…
NathanFlurry Apr 8, 2026
1f71bb6
feat: US-059 - Add missing Node.js builtin polyfills: os, tty, perf_h…
NathanFlurry Apr 8, 2026
dbae1c2
feat: US-053 - Pi agent E2E with full SDK — boot, prompt, tool use, r…
NathanFlurry Apr 8, 2026
db6d038
feat: US-046 - Port signal handling to V8 bridge
NathanFlurry Apr 8, 2026
028989e
feat: US-047 - CI pipeline for V8 runtime binary
NathanFlurry Apr 8, 2026
6305d87
feat: US-060 - Deny dangerous builtins explicitly: vm, worker_threads…
NathanFlurry Apr 8, 2026
3023524
feat: US-061 - Implement fs.watch/fs.watchFile and createReadStream/c…
NathanFlurry Apr 8, 2026
f7dcabf
feat: US-062 - Add HTTP/2 secure server/client support and fix stub h…
NathanFlurry Apr 8, 2026
3d9e00c
feat: US-063 - Python/Pyodide: Add network access through kernel and …
NathanFlurry Apr 8, 2026
6961cdd
feat: US-069 - Builtin completeness gate test — every Node.js builtin…
NathanFlurry Apr 8, 2026
1e4a820
feat: US-070 - Fix WASM command PATH resolution so agents find sh, gr…
NathanFlurry Apr 8, 2026
831fb2a
feat: US-071 - Test and fix require.resolve() for guest code
NathanFlurry Apr 8, 2026
62d5918
feat: US-072 - CJS export extraction runtime fallback via Object.keys()
NathanFlurry Apr 8, 2026
53fd7ba
docs: record CJS fallback guidance
NathanFlurry Apr 8, 2026
1afdc61
feat: US-073 - AbortSignal/AbortController completeness for fetch and…
NathanFlurry Apr 8, 2026
d23ae40
feat: US-074 - fs.promises true async behavior — don't block on concu…
NathanFlurry Apr 8, 2026
af9b1e1
feat: US-064 - Python/Pyodide: Add micropip support and dynamic packa…
NathanFlurry Apr 8, 2026
df26af3
feat: US-075 - Verify unmodified Pi CLI (pi-acp) works E2E via create…
NathanFlurry Apr 9, 2026
4ada748
feat: US-079 - Test session cleanup and resource leak prevention for …
NathanFlurry Apr 9, 2026
7f778df
feat: US-066 - Add POSIX compliance tests for /proc, /dev, signals, a…
NathanFlurry Apr 9, 2026
741af00
feat: US-080 - Test suite for POSIX path edge cases from agent-os-pos…
NathanFlurry Apr 9, 2026
a30a584
feat: US-109 - Commit and verify Claude adapter configuration changes…
NathanFlurry Apr 9, 2026
8227cce
feat: US-110 - Fix Claude SDK CLI patching for V8 runtime (build-patc…
NathanFlurry Apr 9, 2026
326643a
feat: US-111 - Claude agent E2E: text response, xu command, nested no…
NathanFlurry Apr 9, 2026
f51cc9f
feat: US-076 - Verify Claude agent (claude-agent-sdk) works E2E via c…
NathanFlurry Apr 9, 2026
2724b2e
feat: US-CC-001 - Fix @rivet-dev/agent-os workspace name → @rivet-dev…
NathanFlurry Apr 9, 2026
b12c6cb
feat: US-CC-002 - Fix node:events module shape — EventEmitter must be…
NathanFlurry Apr 9, 2026
4bedb79
feat: US-CC-003 - Fix stream async iterator — Symbol.asyncIterator fo…
NathanFlurry Apr 9, 2026
c637b7c
feat: US-CC-004 - Fix WASM child process stdout relay
NathanFlurry Apr 9, 2026
ec3e848
feat: US-CC-005 - Fix Claude adapter shell default and environment flags
NathanFlurry Apr 9, 2026
0f982f0
feat: US-CC-006 - Fix Claude SDK CLI patching for V8 runtime
NathanFlurry Apr 9, 2026
c2b3163
feat: US-CC-007 - Claude agent full E2E — text, xu command, nested no…
NathanFlurry Apr 9, 2026
289e394
feat: US-CC-008 - Quickstart agent-session.ts works E2E with Claude w…
NathanFlurry Apr 9, 2026
2ff10bd
feat: US-001 - Restore root workspace install and lockfile consistency
NathanFlurry Apr 9, 2026
12514f7
feat: US-002 - Restore package-local Vitest resolution and pnpm exec …
NathanFlurry Apr 9, 2026
c108fbb
feat: US-003 - Archive stale Ralph artifacts and reset test-policy docs
NathanFlurry Apr 9, 2026
80517b2
feat: US-004 - Fix execution WASM tests for SyncRpcRequest events
NathanFlurry Apr 9, 2026
9feafea
feat: US-005 - Fix V8 bridge registration drift from the canonical br…
NathanFlurry Apr 9, 2026
dedfbfd
feat: US-006 - Restore the full agent-os-v8-runtime suite and isolate…
NathanFlurry Apr 9, 2026
f956e88
feat: US-007 - Fix sidecar VM dispose and kill cleanup semantics for …
NathanFlurry Apr 9, 2026
41dc24f
feat: US-008 - Restore moduleAccessCwd visibility for projected node_…
NathanFlurry Apr 9, 2026
90b778d
feat: US-009 - Restore OpenCode package projection and headless packa…
NathanFlurry Apr 9, 2026
5906dae
feat: US-010 - Restore Claude Code package projection and investigati…
NathanFlurry Apr 9, 2026
9a42d2a
feat: US-011 - Restore listAgents surface and add agent launch-enviro…
NathanFlurry Apr 9, 2026
60b1ab8
feat: US-012 - Restore read-only base-filesystem behavior for preseed…
NathanFlurry Apr 9, 2026
37a4e3a
feat: US-013 - Restore /etc/agentos instructions readability from ins…
NathanFlurry Apr 9, 2026
998b430
feat: US-014 - Restore vm.exec cwd handling and simple shell pipelines
NathanFlurry Apr 9, 2026
c8e850c
feat: [US-015] - [Restore shell redirect, command-substitution, and h…
NathanFlurry Apr 9, 2026
dd1eff5
feat: US-016 - Restore cron exec actions that write inside the VM
NathanFlurry Apr 9, 2026
74a7ca1
feat: US-017 - Restore coreutils command resolution and basic file-op…
NathanFlurry Apr 9, 2026
09dcf2f
feat: US-018 - Restore grep and sed command-package parity
NathanFlurry Apr 9, 2026
b5420e5
feat: US-019 - Restore awk, jq, and yq command-package parity
NathanFlurry Apr 9, 2026
ccec7fe
feat: US-020 - Restore find, xargs, and diff command-package parity
NathanFlurry Apr 9, 2026
91244da
feat: US-021 - Restore tar and gzip command-package parity
NathanFlurry Apr 9, 2026
1798ec9
feat: US-022 - Restore rg, fd, and tree command-package parity
NathanFlurry Apr 9, 2026
8fe1061
feat: US-023 - Restore curl package availability and local HTTP round…
NathanFlurry Apr 9, 2026
751a25d
feat: US-024 - Restore permission, stat, chmod, and ls command parity
NathanFlurry Apr 9, 2026
9459a2a
feat: US-025 - Restore cross-package pipeline coverage in the command…
NathanFlurry Apr 9, 2026
45aeab2
feat: US-CC-009 - Fix VFS layer visibility: vm.writeFile() must be vi…
NathanFlurry Apr 9, 2026
af77193
feat: US-CC-010 - Fix VFS layer visibility: agent session writes (Cla…
NathanFlurry Apr 9, 2026
c025848
feat: US-026 - Restore shell invocation of agentos tools from guest s…
NathanFlurry Apr 9, 2026
eb568dc
docs: note tool shell dispatch pattern
NathanFlurry Apr 9, 2026
b59acdf
feat: US-027 - Fix Pi SDK bash-tool output persistence in end-to-end …
NathanFlurry Apr 10, 2026
f1875f4
feat: US-028 - Fix Pi CLI bash-tool output persistence in end-to-end …
NathanFlurry Apr 10, 2026
412e323
feat: US-029 - Re-verify full Pi SDK end-to-end flow including write,…
NathanFlurry Apr 10, 2026
0d7cb75
feat: US-030 - Re-verify full Pi CLI end-to-end flow including write,…
NathanFlurry Apr 10, 2026
4cdbd9b
feat: US-031 - Fix OpenCode ACP session-new handshake failures
NathanFlurry Apr 10, 2026
87bcf2d
feat: US-032 - Restore OpenCode write-tool end-to-end coverage
NathanFlurry Apr 10, 2026
e7aa1d4
feat: US-033 - Restore OpenCode bash-tool end-to-end coverage
NathanFlurry Apr 10, 2026
2049058
feat: US-034 - Restore OpenCode lifecycle, mode, permission, and rawS…
NathanFlurry Apr 10, 2026
b81fd77
feat: US-035 - Fix Codex WASM host_net imports and runner startup
NathanFlurry Apr 10, 2026
6f08ce6
feat: US-036 - Restore Codex session config state for model and thoug…
NathanFlurry Apr 10, 2026
830b618
feat: US-037 - Restore Codex single-turn shell tool end-to-end coverage
NathanFlurry Apr 10, 2026
68a68e4
feat: US-038 - Restore Codex multi-turn history, cancel, and destroy …
NathanFlurry Apr 10, 2026
8c29172
feat: US-039 - Implement synthetic session-update coverage for agents…
NathanFlurry Apr 10, 2026
b019335
feat: US-040 - Add ACP timeout diagnostics with process exit code and…
NathanFlurry Apr 10, 2026
88b2d6e
feat: US-041 - Restore session cleanup and leak-prevention coverage a…
NathanFlurry Apr 10, 2026
2302460
feat: US-042 - Add kernel socket-table scaffolding and resource accou…
NathanFlurry Apr 10, 2026
bdec51d
feat: US-043 - Implement kernel TCP listener lifecycle
NathanFlurry Apr 10, 2026
94cbba1
feat: US-044 - Implement kernel TCP connect, read, write, shutdown, a…
NathanFlurry Apr 10, 2026
0b06d89
feat: US-045 - Implement kernel loopback routing for guest-owned TCP …
NathanFlurry Apr 10, 2026
d2617bd
feat: US-046 - Implement kernel DNS resolver and policy hooks
NathanFlurry Apr 10, 2026
2449dec
feat: US-047 - Implement kernel UDP datagram sockets
NathanFlurry Apr 10, 2026
f4ffd0a
feat: US-048 - Implement kernel Unix domain sockets
NathanFlurry Apr 10, 2026
487a66c
feat: US-049 - Implement kernel poll across pipes, PTYs, and sockets
NathanFlurry Apr 10, 2026
e97bbf7
feat: US-049a - Wire kernel poll to V8 bridge and WASM runtime surfaces
NathanFlurry Apr 10, 2026
908d437
feat: US-050 - Wire V8 net, dns, and dgram bridge calls through kerne…
NathanFlurry Apr 10, 2026
10787cd
feat: US-051 - Wire V8 http, https, and http2 flows through kernel so…
NathanFlurry Apr 10, 2026
6b44322
feat: US-052 - Wire WASM networking imports through kernel socket state
NathanFlurry Apr 10, 2026
45d520b
feat: US-053 - Add cross-runtime networking conformance suites and ma…
NathanFlurry Apr 10, 2026
a443efb
feat: US-054 - Remove sidecar-managed socket state that duplicates ke…
NathanFlurry Apr 10, 2026
16a6021
feat: US-055 - Implement LayerStore create, seal, import, and export …
NathanFlurry Apr 10, 2026
22e1147
feat: US-056 - Implement multi-layer overlay composition for VM roots
NathanFlurry Apr 10, 2026
bc86ccb
feat: US-057 - Add multi-layer snapshot lifecycle and per-VM isolatio…
NathanFlurry Apr 10, 2026
580b649
feat: US-058 - Implement kernel user and group identity syscalls and …
NathanFlurry Apr 10, 2026
32b31a5
feat: US-059 - Add guest-visible JS, WASM, and Python identity tests
NathanFlurry Apr 10, 2026
b7939ed
feat: US-060 - Add bootstrap suppression for kernel-reserved director…
NathanFlurry Apr 10, 2026
e153563
feat: US-061 - Add fcntl support to the kernel FD table
NathanFlurry Apr 10, 2026
a4c72c5
feat: US-062 - Add pwrite support to HostDirFilesystem
NathanFlurry Apr 10, 2026
b3a4bb6
feat: US-063 - Enforce maximum tool-description length in Rust tool r…
NathanFlurry Apr 10, 2026
97deca4
feat: US-064 - Restore missing public type exports in packages/core i…
NathanFlurry Apr 10, 2026
d95f0a5
feat: US-065 - Verify guest V8 SQLite works through the sidecar sqlit…
NathanFlurry Apr 10, 2026
cc8d017
feat: US-066 - Filter AGENT_OS env vars and virtualize host identity …
NathanFlurry Apr 10, 2026
2546dcc
feat: US-067 - Restore nested child-process visibility in allProcesse…
NathanFlurry Apr 10, 2026
fe5a4e9
feat: US-068 - Remove legacy feature-gated JS host-Node execution paths
NathanFlurry Apr 10, 2026
c8f7547
feat: US-069 - Migrate Python execution and prewarm off host node_bin…
NathanFlurry Apr 10, 2026
4ec215a
feat: US-070 - Migrate WASM execution and prewarm off host node_binar…
NathanFlurry Apr 10, 2026
73e92ba
feat: US-071 - Delete node_process.rs and remaining host-Node runtime…
NathanFlurry Apr 11, 2026
df9c737
feat: US-072 - Unignore and pass the sidecar guest env and escape har…
NathanFlurry Apr 11, 2026
a97f723
feat: US-073 - Unignore and pass sidecar JS filesystem and fd-stream …
NathanFlurry Apr 11, 2026
667347e
feat: US-074 - Unignore and pass sidecar transport, TCP, DNS, Unix, T…
NathanFlurry Apr 11, 2026
217924d
feat: US-075 - Unignore and pass sidecar network policy, listener, an…
NathanFlurry Apr 11, 2026
69b5d8f
feat: US-076 - Unignore and pass nested child-process, stdio-binary, …
NathanFlurry Apr 11, 2026
0e29621
feat: US-077 - Unignore and pass execution javascript_v8 child-proces…
NathanFlurry Apr 11, 2026
a82b6d3
feat: US-078 - Convert pi-tool-llmock to llmock-only coverage or move…
NathanFlurry Apr 11, 2026
0aadabd
feat: US-079 - Make the registry node-binary behavior suite fully green
NathanFlurry Apr 11, 2026
c24f009
feat: US-080 - Make the registry cross-runtime network suite runnable…
NathanFlurry Apr 11, 2026
6ccdcb2
feat: US-081 - Make packages/core investigation suites green
NathanFlurry Apr 11, 2026
79411d4
feat: US-082 - Define a BARE sidecar IPC schema and compatibility plan
NathanFlurry Apr 11, 2026
33ee2ca
feat: US-083 - Implement Rust BARE codec and framing behind the new s…
NathanFlurry Apr 11, 2026
5d3ceb8
feat: US-084 - Migrate the TypeScript sidecar client and bridge trans…
NathanFlurry Apr 11, 2026
228e0a9
feat: US-085 - Add an end-to-end migration parity suite covering ever…
NathanFlurry Apr 11, 2026
9cdf6bd
feat: US-086 - Remove duplicate quickstart filesystem examples and st…
NathanFlurry Apr 11, 2026
0d48da9
feat: US-087 - Clear first-party dead-code and unused-import warnings…
NathanFlurry Apr 11, 2026
7f641fd
feat: US-307 - US-079 WASI fd_write fast-path bypasses kernel VM-scop…
NathanFlurry Apr 12, 2026
78c4660
feat: US-297 - LoopbackTlsEndpoint::read() panics on concurrent drain…
NathanFlurry Apr 12, 2026
d74fd5c
feat: US-295 - Allow WebAssembly code generation inside guest V8 isol…
NathanFlurry Apr 12, 2026
1c39a55
feat: US-201 - Replace timeout shim 1ms busy-wait loop with blocking …
NathanFlurry Apr 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
28 changes: 28 additions & 0 deletions .agent/notes/pi-sdk-boot-gaps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Pi SDK Boot Gaps

Last probe: 2026-04-08
Command: `pnpm --dir packages/core exec vitest run tests/pi-sdk-boot-probe.test.ts`

## Scope

This probe runs focused guest `node` scripts inside fresh VMs on the V8 path. Each action gets its own VM so one wedged import does not poison later results.

## Current Results

- `@mariozechner/pi-coding-agent` is projected into `/root/node_modules` correctly.
- `import("@mariozechner/pi-coding-agent")` succeeds.
- `import("/root/node_modules/@mariozechner/pi-coding-agent/dist/index.js")` succeeds.
- `createCodingTools()` succeeds.
- `createAgentSession()` succeeds.
- `import("@mariozechner/jiti")` succeeds.
- `import("node:fs/promises")` succeeds.
- `import("@anthropic-ai/sdk")` succeeds.
- `import("zod")` succeeds.
- `import("node:child_process")` succeeds and exposes `spawn`/`spawnSync`.
- `import("node:module")` succeeds and exposes `createRequire`.

## Closed Gaps

1. Inline V8 builtin wrappers for `node:fs/promises` must not recurse through `_requireFrom("node:fs/promises")`; they need a direct `node:fs`-backed wrapper instead.
2. Changing generated builtin asset source requires a `NODE_IMPORT_CACHE_ASSET_VERSION` bump or stale materialized assets will keep serving the old code.
3. Guest CommonJS builtins need both `Module.builtinModules` registration and a `loadBuiltinModule()` implementation; `node:v8` was missing the latter, which blocked `@mariozechner/jiti` and therefore the Pi SDK boot chain.
125 changes: 125 additions & 0 deletions .agent/recovery/secure-exec/kernel/command-registry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/**
* Command registry.
*
* Maps command names to runtime drivers. When a process calls
* spawn("grep", ...), the registry resolves "grep" to the WasmVM driver.
* Also populates /bin in the VFS so shell PATH lookup succeeds.
*/

import type { RuntimeDriver } from "./types.js";
import type { VirtualFileSystem } from "./vfs.js";

export class CommandRegistry {
/** command name → RuntimeDriver */
private commands: Map<string, RuntimeDriver> = new Map();

/** Warning log for command overrides. */
private warnings: string[] = [];

/**
* Register all commands from a driver.
* Last-mounted driver wins on conflicts (allows override with warning).
*/
register(driver: RuntimeDriver): void {
for (const cmd of driver.commands) {
const existing = this.commands.get(cmd);
if (existing) {
const msg = `command "${cmd}" overridden: ${existing.name} → ${driver.name}`;
this.warnings.push(msg);
console.warn(`[CommandRegistry] ${msg}`);
}
this.commands.set(cmd, driver);
}
}

/** Get recorded warnings (for testing). */
getWarnings(): readonly string[] {
return this.warnings;
}

/**
* Register a single command to a driver.
* Used for on-demand dynamic registration (e.g. after tryResolve).
*/
registerCommand(command: string, driver: RuntimeDriver): void {
const existing = this.commands.get(command);
if (existing) {
const msg = `command "${command}" overridden: ${existing.name} → ${driver.name}`;
this.warnings.push(msg);
console.warn(`[CommandRegistry] ${msg}`);
}
this.commands.set(command, driver);
}

/**
* Resolve a command name to a driver. Returns null if unknown.
* Supports path-based lookup: '/bin/ls' resolves to the driver for 'ls'.
*/
resolve(command: string): RuntimeDriver | null {
// Direct name lookup
const direct = this.commands.get(command);
if (direct) return direct;

// Path-based: extract basename and retry
if (command.includes("/")) {
const basename = command.split("/").pop()!;
if (basename) return this.commands.get(basename) ?? null;
}

return null;
}

/** List all registered commands. Returns command → driver name. */
list(): Map<string, string> {
const result = new Map<string, string>();
for (const [cmd, driver] of this.commands) {
result.set(cmd, driver.name);
}
return result;
}

/**
* Create a single /bin stub entry for a command.
* Used for on-demand registration after tryResolve discovers a new command.
*/
async populateBinEntry(vfs: VirtualFileSystem, command: string): Promise<void> {
if (!(await vfs.exists("/bin"))) {
await vfs.mkdir("/bin", { recursive: true });
}
const path = `/bin/${command}`;
if (!(await vfs.exists(path))) {
const stub = new TextEncoder().encode("#!/bin/sh\n# kernel command stub\n");
await vfs.writeFile(path, stub);
try {
await vfs.chmod(path, 0o755);
} catch {
// chmod may not be supported by all VFS backends
}
}
}

/**
* Populate /bin in the VFS with stub entries for all registered commands.
* This enables brush-shell's PATH lookup to find commands.
*/
async populateBin(vfs: VirtualFileSystem): Promise<void> {
// Ensure /bin exists
if (!(await vfs.exists("/bin"))) {
await vfs.mkdir("/bin", { recursive: true });
}

// Create a stub file for each command
const stub = new TextEncoder().encode("#!/bin/sh\n# kernel command stub\n");
for (const cmd of this.commands.keys()) {
const path = `/bin/${cmd}`;
if (!(await vfs.exists(path))) {
await vfs.writeFile(path, stub);
try {
await vfs.chmod(path, 0o755);
} catch {
// chmod may not be supported by all VFS backends
}
}
}
}
}
Loading
Loading