feat(wasm): add combined sysml-wasm command - #870
Merged
Merged
Conversation
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Contributor
Author
Co-Authored-By: jason.han <hanhuijun@gmail.com>
This was referenced Oct 4, 2026
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.
What and why
Adds
sysml-wasm, a single WebAssembly-friendly command that serves the union ofsysml-core(parsing, diagnostics, symbol facts) andsysml-engine(evaluation, instantiation, execution) behind onecall(method, paramsJSON). This is the first step toward letting the Node/browser client run against WASM instead of a nativesysml-grpc.Building both into one module avoids duplicating the parser, semantics, runtime and embedded standard library: the combined
js/wasmbuild is 7.79 MB gzipped (5.48 MB Brotli), compared with 12.7 MB gzipped forsysml-engine+sysml-coreshipped as separate modules.internal/frontend/combined.Server:ParseSources/ParseFileparse through the core, then through the engine, and fail with Internal if the two model hashes differ. The core response (roots + diagnostics) is returned, so a hash from either parse works with every later method.GetDiagnostics/GetSymbolgo to the core;Evaluate,Instantiate,ExecuteActionandExecuteStatego to the engine.GetServerInforeturns the build version and a fixed list of capabilities for the surface it serves, so the client's existing capability checks refuse unsupported calls cleanly.sysml-grpc.engine.NewWithLibrary/core.NewWithLibrarylet both frontends share one frozen standard-library snapshot and take a model bound (0 = unbounded, with explicitEvict).engine.Newnow loads the library at construction instead of on the first parse.cmd/sysml-wasm: thejsbuild installsglobalThis.sysmlWasm = { version, call };-stdio, native andwasip1builds serve theContent-Length-framed JSON-RPC pipe.sysml-wasmjoinsWASM_COMMANDS, and there is a new opt-in nativebuild-sysml-wasmtarget. It isn't released yet; publishing comes in a follow-up PR.The existing
sysml-engine,sysml-coreandsysml-syntaxcommands are unchanged. The docs site still loadssysml-engine.How it was verified
tests/wasm:sysml-wasmbuilds for both targets.combinedSubtestsrun a stdio session on wasip1 and js, covering ParseFile → Evaluate/GetSymbol/GetDiagnostics/Instantiate on that hash, GetServerInfo, an unserved method, and malformed params followed by a working call.globalThis.sysmlWasmhost surface is exercised from Node.TestCombinedWireParitycompares JSON answers withsysmlgrpc.Service, in process, for ParseSources, ParseFile (inline and filePath), GetDiagnostics, GetSymbol, Evaluate, Instantiate, ExecuteAction and ExecuteState. It also checks that a ParseFile hash is accepted by both Evaluate and GetSymbol, and that every advertised capability is onesysml-grpcreports. Retention tests ininternal/frontend/combinedcover core-only access, engine-only access and re-parsing at the 16-model boundary.TestCombinedDependencies: neither wasm target links protobuf, Connect, gRPC,internal/frontend/grpc, protoconv, stdiorpc orinternal/doc/.internal/frontend/combined. Hygiene layering registers the new packages.make docs-checkand a strictmake docs.Checklist
make testandmake lintpass locally (targeted packages, lint and the wasm gate run locally; full suite left to CI)changes/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (compliance rows need nothing: the census is counted at docs build)F4,K5) in the body, docs, or changelog