Description
Context
Second dependency-ordered foundation for #13 and #14. It depends on #15 and implements the selected owned private core-Wasm kernal-api ABI generator from #13, before concrete browser, file, or blob capabilities exist.
Depends on
- feat(wasm): prove a streamed kernal-api Rust sketch runtime with zccache and extension2 cores #13 selects exactly one private binding/runtime implementation.
- feat(wasm): establish threaded sketch build, import validation, and lifecycle substrate #15 provides validated threaded module execution, import policy, and lifecycle containment.
This issue extends that one ABI. Do not add a temporary RPC format, hand-written parallel guest API, fallback engine, or speculative public abstraction trait.
Proposal
Implement a private, versioned generated ABI capable of representing:
- asynchronous kernel operations and typed semantic errors;
- opaque generation-safe resource handles;
- capability-scoped host state;
- guest suspension/resumption from native completions;
- cancellation, timeouts, close/drop/trap/thread-exit/sketch-teardown cleanup; and
- resource/operation instrumentation.
The first concrete operations remain intentionally synthetic: an async kernel clock/yield operation and a create/use/close test resource. They prove the protocol before choosing Tauri, filesystem, or blob API shapes.
Guest calls suspend only their own execution and resume through the selected generated ABI. Native work runs on the existing kernal_api::async_engine; completion must respect Store/Instance ownership and avoid illegal concurrent re-entry.
Handles must be (instance scope, slot, generation) or equivalent opaque identity. A resource belongs to one sketch capability context; copied numeric values do not convey authority. Cancellation can race completion, close, trap, and teardown, but exactly one terminal outcome is observable and cleanup is idempotent.
Backpressure boundary
This issue defines lifecycle and quota rules but does not yet ship arbitrary-byte streaming. It reserves the required policy: explicit resource quotas, bounded pending operations, cancellation, and no ABI operation that implies an unbounded serialized payload. The opaque bounded blob/output implementation follows in #17.
Invariants
- Guest-facing Rust APIs are versioned, semantic, and facade-owned. WIT, MessagePack, fp-bindgen, Wasmtime, Tokio, and generated support types are not public API.
- Native host APIs do not publicly re-export engine, binding, Store, task, resource-table, or platform backend types.
default = []must not resolve or compile engine, generator, generated guest support, or parser dependencies.kernal_api::async_engineremains the only host executor. Guest operations cannot construct or bypass another kernel/Tokio runtime.- ABI version/capability mismatch fails before sketch entrypoint or effect.
Non-goals
- Arbitrary filesystem access, raw paths, blobs, streams, Tauri, screenshots, WebDriver, or GUI dependencies.
- Supporting every existing
kernal-apioperation through the first generated ABI. - Guest-thread bootstrap beyond consuming feat(wasm): establish threaded sketch build, import validation, and lifecycle substrate #15.
Acceptance criteria
- RED: checked-in evidence proves the validated threaded sketch has no generated async kernel operation, resource lifecycle protocol, or cross-instance-handle defense.
- RED: regression fixtures prove stale, raw/forged, double-closed, and cross-instance handles are rejected.
- GREEN: one selected, generated, versioned guest facade and private native adapter are checked in.
- GREEN: a guest calls an async kernel clock/yield operation through the generated ABI, suspends/resumes, and returns without blocking the host event loop or creating another runtime.
- GREEN: a guest creates, uses, and closes a synthetic opaque resource through the real generated ABI.
- GREEN: handles are generation-safe and instance/capability-scoped; stale, forged, cross-instance, and double-close use returns deterministic facade-owned typed errors.
- GREEN: configured per-sketch limits bound live resources and pending ABI operations.
- GREEN: cancelling a pending operation wakes guest and host with a typed result; terminal races do not leak resources or double-complete.
- GREEN: close, guest-thread exit, trap, timeout, and teardown return live-resource/pending-operation counters to zero.
- GREEN: two concurrent operations, including separate guest threads, complete without illegal Store re-entry, deadlock, or another kernel runtime.
- GREEN: ABI/capability mismatch fails before host effects.
- GREEN: tracing records operation ID, scope, handle generation, suspend/resume, terminal reason, and resource count without exposing backend types.
- GREEN: default-feature checks remain free of Wasm engine/generator/generated support dependency resolution.
Platform matrix and deliverables
Compile host/generated support on Linux, macOS, and Windows x86-64/ARM64. Run focused lifecycle proof on native supported hosts where available, including a multi-thread guest path, and report target, ABI/engine versions, limits, suspend/resume counts, and teardown counters.
Deliver the generated facade/private adapter, semantic handle/error surface, capability/resource/operation registries, cancellation/race/lifecycle tests, focused Soldr documentation, and an ABI compatibility note reserving opaque-resource/bounded-transfer rules.
Decisions
- This is P1 because feat(wasm): drive a Tauri screenshot task through the async kernal API #14 needs every webview action to cross one generated async kernel ABI.
- Start with synthetic operations to isolate ABI/lifecycle correctness from browser and filesystem behavior.
- Keep byte transport out of this issue so capacity policy is proven independently in feat(wasm): add generated async kernel ABI and generation-safe resources #16.
Related issues
- feat(wasm): prove a streamed kernal-api Rust sketch runtime with zccache and extension2 cores #13 owns the overall runtime, backpressure, cancellation, and generated-boundary contract.
- feat(wasm): establish threaded sketch build, import validation, and lifecycle substrate #15 establishes the required threaded execution substrate.
- feat(wasm): drive a Tauri screenshot task through the async kernal API #14 will consume this ABI for webview open/load/capture/close operations.
Activity
zackees commentedon Sep 12, 2026
Closed as completed. The dependency-ordered foundations #36, #37, and #38 now provide one generated private Core-Wasm ABI, caller-owned async lifecycle, and generation-safe resource authority. PR #151 resolved the final real-artifact close/cancellation ordering defect. Local verification includes generator/drift checks, focused real threaded artifact proof, and soldr cargo test --locked --no-default-features (166 unit tests plus integration/doc tests). #17 remains the intentional bounded opaque blob/exact-output follow-on.