Repository navigation
ADR 0014 phase 2: an app's Rust components in the wasm service - #445
Merged
2 commits merged intoOct 10, 2026
Merged
2 commits merged into
2 commits merged into
Conversation
…orage quota The shell's wasm service loads components from fns/ beside modules, keeps one instance per component between calls, gives it the app's storage folder by the engines' rules, and charges what each write adds against what is left of the app's quota (wasm-host component/files.rs). Writes run on the worker thread. Typed JSON accepts a one-item positional array. Measurements, docs (en, zh-CN) and tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
App Hub #186 admits WebAssembly components when the manifest requires wasm-components-v1, validates their imports (only the WASI packages a host scopes to the app) and tells reviewers what each reaches. With the store on it, a component shipped as a system app goes through admission, and the new service test calls it as the app's script would: typed JSON, the instance's state from one request to the next, no folder without storage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ADR 0014 phase 2, OctoSense's part: the shell's
wasmservice runs an app's own components. A component is an ordinary Rust crate built withcargo build --target wasm32-wasip2, or with App Flow'stools/octo wasm build. The app's script calls each function aswasm.<function>with JSON, with no glue. Stacked on #436 (phase 1, the runtime); merge that first.What changes
crates/shell/src/wasm_service.rs):fns/beside core modules.wasm.functionsdescribes components: their exports with WIT signatures, and the instance's state.fs.*sees, is the component's/. The service decides it per call by the engines' rules (areas::app_area): none withoutstorage, and none without a signed-in account for an app with accounts.crates/wasm-host/src/component/files.rs):769e9ee3(shell: a hosted module may refuse a close and ask first (makepad#65) #186): the store admits components underwasm-components-v1.cargo run --release -p octosense-wasm-host --example measure_componentmeasures a component against a module and native Rust.docs/wasm.md(en, zh-CN) gains a Components section.Verified (macOS, Apple M5 Max, Rust 1.97.1)
cargo test --locked -p octosense-wasm-hostcd phone && cargo test --locked --features mobile-apps -p octosense-shell wasm_service::testsa_components_instance_keeps_state_and_its_files_stay_in_the_apps_storage(typed JSON, state, the app's folder, the quota, no folder withoutstorage) anda_shipped_component_answers_its_apps_script(a system app through App Hub's admission).python3 tools/setup.py --check --cargoocto new+octo wasm new+octo wasm build(App Flow #180), the bundle shipped through admission, called as the script wouldwasm.greet("Ada")→"Hello, Ada!";wasm.count→{words: 3, lines: 2};wasm.parse_number("two")→ error"two" is not a number;wasm.calls→ 1, then 2;save_note/read_noteuse the app's foldermeasure_componentUnverified: components on a phone (Android links the same runtime, but nothing has run on a device yet), and a desktop run with a component app.
🤖 Generated with Claude Code