OR-1 dataflow CPU sketch

monitor and control interface for emulator master

6 phase files covering observability hooks, simulation backend, CLI REPL, frontend-common extraction, web server, and monitor frontend. Includes Playwright validation tasks in phases 4 and 6 to catch frontend integration issues during execution. feat(emu): add typed event system with PE/SM observability hooks - Add emu/events.py with frozen event dataclasses (TokenReceived, Matched, Executed, Emitted, IRAMWritten, CellWritten, DeferredRead, DeferredSatisfied, ResultSent) - Add on_event callback field to PEConfig and SMConfig - Wire callbacks into PE and SM SimPy processes - Wire callbacks through build_topology - Export event types from emu package feat(monitor): add simulation backend with state snapshot capture - Promote asm.run_pipeline to public API - Add monitor/snapshot.py with frozen StateSnapshot dataclasses (PESnapshot, SMSnapshot, SMCellSnapshot) - Add monitor/commands.py with typed command/result protocol (LoadCmd, StepTickCmd, StepEventCmd, RunUntilCmd, InjectCmd, SendCmd, ResetCmd, StopCmd) - Add monitor/backend.py SimulationBackend with threaded SimPy execution and command queue - Export public API from monitor/__init__.py feat(monitor): add CLI REPL for interactive simulation control - Add monitor/formatting.py with ANSI colour helpers and NO_COLOUR flag for testing - Add monitor/repl.py with cmd.Cmd-based REPL (load, step, stepe, run, send, inject, state, pe, sm, log, time, reset, quit) - Add monitor/__main__.py CLI entry point with --cli/--web/--port flags refactor: extract frontend-common shared TypeScript library from dfgraph - Create frontend-common/ package with shared layout, style, export, and type modules - Refactor dfgraph/frontend to import from @common/ alias - Update build.mjs files with esbuild path aliases - Both dfgraph and monitor frontends consume frontend-common as workspace dependency feat(monitor): add FastAPI WebSocket server and graph JSON serialization - Add monitor/graph_json.py with execution overlay (active/matched/executed/token_flow flags) - Add monitor/server.py with FastAPI, bidirectional WebSocket, REST endpoints - Add --web mode to CLI entry point - Extend graph_loaded_json and graph_to_monitor_json with full state serialization feat(monitor): add browser frontend with Cytoscape.js graph visualization - Create monitor/frontend/ package with esbuild, TypeScript, Cytoscape.js - Add TypeScript types matching server protocol (MonitorNode, MonitorEdge, SystemState, etc.) - Add execution overlay styles (active, matched, executed, half-matched, token-flow) - Add event log panel with component/type filtering - Add state inspector panel with PE/SM tree view and node click matching store display - Add WebSocket client with exponential backoff reconnection - Add main.ts with graph rendering, execution state overlay, control handlers - Add dark-themed three-panel HTML layout docs: add human test plan for OR1 Monitor fix(asm): generate SMConfigs for all declared SMs, not just those with data defs generate_direct only created SMConfigs from @val data definitions, ignoring the sm_count from @system pragma. Programs with SM operations but no @val directives got zero SMConfigs, causing KeyError at runtime when PE tried to route to a nonexistent SM. Now ensures at least max(1, system.sm_count) SMConfigs are always created. fix(monitor): sanitize float('inf') in JSON serialization for browser compatibility Python's json.dumps serializes float('inf') as 'Infinity' which is not valid JSON. The browser's JSON.parse would fail silently on monitor_update messages when the simulation finished (next_time=inf). Convert non-finite floats to null via _safe_time() helper. fix(monitor): use 'presence' not 'pres' for SM cell state in frontend The Python serializer uses 'presence' as the JSON key but the frontend renderer was reading 'pres' (the dataclass field name from sm_mod.py), resulting in 'undefined' in the cell display.


Author Orual Date Commit 27ce6605 Parent 04d59b73 Change ID ruoktylo