Expand description
wasm-capability-contract — the capability-sandbox contract (ADR-001):
trait/DTO surface only. See wasm-capability-core (this repo) for this
pattern’s own default implementation, and
docs/3-architecture/adr/ADR-001-capability-layer-design.md at the
repo root for the full design this crate is a direct contract for.
No api/ wrapper directory: a contract crate has exactly one real
layer by construction (swearchitect#388) — its own src/ already
is that layer, so nesting everything one level deeper under a
same-purpose api/ folder is redundant, not a second, distinct SEA
layer being introduced.
CapabilityDispatcher/CapabilityRegistry keep their real, deliberate
signatures (a multi-parameter dispatch, a non-Result descriptor
lookup) rather than being forced into arch’s generic *Request/
*Response shape — see docs/known-exceptions.md for why.
Structs§
- Capability
Descriptor - What a
CapabilityRegistryreturns for one capability name: the host import name a granted, structurally-present capability wires to. - Capability
Grant - One capability granted to a component’s route, by name and scope.
- Capability
Scope - A granted capability’s own allowlist, carried on a
crate::CapabilityGrant. - Component
Handle - Opaque handle to a loaded component instance.
- Component
Invoke Request - Request to invoke a loaded component’s handler export once.
- Component
Invoke Response - Response from a successful
crate::CapabilityEngine::invokecall. - Component
Load Request - Request to load an already-validated component artifact into the engine.
- Component
Load Response - Response from a successful
crate::CapabilityEngine::loadcall. - Component
Manifest - Declares what a Wasm component is, what it declares it needs to run.
- Resource
Limits - Resource bounds a component’s host must enforce on every invocation.
- Validate
Component Request - Everything a
ComponentValidatorneeds to check one component before its route is registered: the manifest it claims, the real bytes it ships, and what the route was actually granted.
Enums§
- Capability
Error - Everything
ComponentValidator::validateor a realCapabilityEnginecan fail with, named so the message alone tells the caller what to fix.
Traits§
- Capability
Dispatcher - Executes one capability call: decode
payload, call the real implementor injected behind this dispatcher, encode the result back to bytes. A leaf operation (ADR-001) — never triggers a second capability call on the guest’s behalf. - Capability
Engine - Loads a validated component and invokes its handler export.
- Capability
Registry - Resolves a capability name (e.g.
"http-egress", or a deployer-scoped instance like"grpc-egress:inventory-svc") to the descriptor describing how it dispatches. - Component
Validator - Checks a Wasm component’s manifest and real bytes before its route is registered. A real implementor enforces two gates, per ADR-001: