From 580c2352b59bb28a989157b0f74fdc93697505eb Mon Sep 17 00:00:00 2001 From: Kinflou <149606337+Kinflou@users.noreply.github.com> Date: Thu, 3 Sep 2026 01:10:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(sim):=20the=20simulate=20view=20=E2=80=94?= =?UTF-8?q?=20canvas,=20inspector,=20call=20form?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Milestone 1d (docs: design/playground-simulation.md). Everything 1c does, now through the UI. - header gains an edit / simulate toggle; simulate takes the full width (generation controls hide). Entering it runs describe_project on the current schemas and (re)builds the view's session. - sim/ui/view.ts — palette of protocol × role (drag onto the canvas), a two-lane canvas with an SVG wire between the connected pair, and an inspector: instance facts + ir_hash (click to copy), a "connect to …" select of valid partners, per-function behaviour pickers (kind + a JSON config box, applied live), and — for a connected client — the call form. - sim/ui/argsform.ts — a form from a function's args: typed input per primitive, a fieldset per struct, a select per enum, a JSON textarea for arrays / unions / unresolved, and a whole-form raw-JSON toggle. - sim/ui/framelog.ts — the frame list under the canvas, fed by the tap. - sim/view.test.ts (linkedom) — the 1d acceptance driven through the DOM: drop a server + client, connect via the inspector, send from the call form, see the reply and the frames; then flip the server to Raise error and see the mapped error. 14/14 sim tests pass. Main bundle +~8 KB gz (the sim is imported now). --- app/index.html | 8 +- app/package-lock.json | 302 +++++++++++++++++++++++ app/package.json | 1 + app/src/main.ts | 27 +++ app/src/sim/index.ts | 6 + app/src/sim/ui/argsform.ts | 181 ++++++++++++++ app/src/sim/ui/framelog.ts | 74 ++++++ app/src/sim/ui/view.ts | 482 +++++++++++++++++++++++++++++++++++++ app/src/sim/view.test.ts | 149 ++++++++++++ app/src/style.css | 343 ++++++++++++++++++++++++++ 10 files changed, 1572 insertions(+), 1 deletion(-) create mode 100644 app/src/sim/index.ts create mode 100644 app/src/sim/ui/argsform.ts create mode 100644 app/src/sim/ui/framelog.ts create mode 100644 app/src/sim/ui/view.ts create mode 100644 app/src/sim/view.test.ts diff --git a/app/index.html b/app/index.html index c392583..14a9123 100644 --- a/app/index.html +++ b/app/index.html @@ -9,7 +9,11 @@