Expand description
In-memory host context for yosh-plugin run / yosh-plugin test.
Mirrors the precedent of metadata_extract::MetadataCtx: a
self-contained wasmtime store data type with an empty WasiCtx
plus per-capability yosh:plugin/* import implementations backed
by TestState. Per-capability impls live in submodules.
See docs/superpowers/specs/2026-05-12-plugin-dev-test-runner-design.md
§3 for the architectural rationale (third host context alongside
HostContext and MetadataCtx).
Modules§
- commands
- In-memory
yosh:plugin/commandshost import — spawns real subprocesses, gated by CAP_COMMANDS_EXEC and an allowlist ofCommandPattern(reused from yosh-plugin-api). - files
- In-memory and sandboxed
yosh:plugin/fileshost imports. - filesystem
- In-memory
yosh:plugin/filesystemhost imports backed byTestState.cwd. Gated on CAP_FILESYSTEM. The cwd is virtual — changing it does not callstd::env::set_current_dir. - io
- In-memory
yosh:plugin/iohost import backed byTestState.stdout/TestState.stderr. Gated on CAP_IO. - variables
- In-memory
yosh:plugin/variableshost imports backed byTestState.vars/TestState.exported. Gated on CAP_VARIABLES_READ and CAP_VARIABLES_WRITE.
Structs§
- Exec
Record - Record of one external command spawn (commands:exec). One entry per host call, in invocation order.
- TestCtx
- Per-store wrapper.
stateis the shared in-memory backend;wasiis an emptyWasiCtxto absorb cargo-component’s transitive WASI imports (same rationale asMetadataCtx§Sandboxing). - Test
State - In-memory state behind every TestCtx host import. The runner constructs this from CLI flags or a scenario file, then reads it back after the guest call to format results / evaluate expectations.
Functions§
- build_
linker - Construct a
Linker<TestCtx>with WASI registered. Per-capabilityyosh:plugin/*imports are added byregister_imports(Task 9). - register_
imports - Register every
yosh:plugin/*import. The per-capability host functions enforce their own capability checks; the linker unconditionally points each WIT name at its real implementation.