feat: SimView on the wasm engine - #37
Merged
Merged
Conversation
`ui/view.ts` and `ui/framelog.ts` now drive `comline-simulator` (Rust → WASM) instead of the TypeScript `Wires` / `Session` / `Clock` / `Recorder`. - `createSim` holds a `Sim`, mirrors `sim.session_json()` for rendering, and drives it: a call is `sim.call()` → advance the clock (`run` in real mode, `step` / `advance` in stepped) → poll `sim.result()`. - the frame log polls `sim.frames()` / `sim.describe_frame()` after each advance instead of subscribing to a `Tap`; `poll()` appends new rows. - the play loop is a `setInterval` calling `sim.advance(32 × speed)`. - record / replay: `sim.record_start` / `record_stop` / `load_replay` (input capture is automatic in the facade); `Recorder` gone from the view. - behaviours: `sim.behavior_catalog()` for the picker; the `script` kind is filtered out until the scripted wasm is lazy-loaded. - version-skew resync: `sim.resync_instance()`. `shape.ts` and `argsform.ts` are unchanged — pure form-building over the `describe_project` JSON. The `SimView` interface, DOM structure and CSS classes are unchanged; the app builds, both wasms bundle (editor 932 KB + sim 523 KB). Two `view.test.ts` cases rewritten for the discrete-event clock: "idle separator" is now a *virtual*-time gap (a `delay` behaviour), and the stepped-clock test steps per event (request delivery, then the delayed response) rather than once. 44 tests green. The dead TS engine modules + their tests + the drift guard go in the next PR.
This was referenced Sep 3, 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.
Stage 2 of the playground rewire.
ui/view.ts(1148 lines) andui/framelog.tsnow drive thecomline-simulatorwasm instead of the TypeScriptWires/Session/Clock/Recorder.How it maps
Wires.get().call/setBehavior/tap/error/dead()sim.call()+ advance +sim.result(),sim.set_behavior,sim.frames(),sim.connection_error/deadmodel.tsopssim.add_instance/add_connection/move_node/rename_node/remove_*/set_shape/resync_instanceSteppedClock/RealClocksim.step/advance/run/now/pending+ asetIntervalplay loop in the viewRecorder/replayRecordingsim.record_start/record_stop/load_replay(input capture is automatic in the facade)encode/decodeSessionnew Sim(shape, link)/sim.link()BEHAVIORS/BEHAVIOR_KINDSsim.behavior_catalog()session-codec·faults·generic·framedecodeSimcreateSimmirrorssim.session_json()into a plain object for rendering and re-reads it after each mutation. The frame log pollssim.frames()/sim.describe_frame()after the clock advances (poll()appends the new rows) rather than subscribing to aTap.shape.tsandargsform.tsare untouched — pure form-building over thedescribe_projectJSON. TheSimViewinterface, DOM structure and CSS classes are unchanged; the app builds (editor wasm 932 KB + sim wasm 523 KB bundled).Tests
44 green. Two
view.test.tscases rewritten for the discrete-event clock (both genuine wall-clock → virtual-clock shifts):delaybehaviour), since in real mode virtual time only advances during arun()and wall-clock idle doesn't register.Not yet
scriptbehaviour kind is filtered out of the picker until the scripted wasm is lazy-loaded (Stage 4)engine.ts/generic.ts/transport.ts/model.ts/faults.ts/clock.ts/rng.ts/behavior.ts/session-codec.ts/record.ts/framedecode.ts) +runtime/(vendored) + the drift-guard test are deleted in Stage 3