README Source History Refs Reviews Compare Notes Search Review guide Name the multi-frontend boundary and anchor RPC on EngineEvent 2e868210a4edd4e8b32e578eb124d7f475da06e7
Claude <noreply@anthropic.com > · 17 Jul 2026
SSH signature · not checked
Browse files Compare with HEAD
The spec never said how a second UI would attach, so future work would
have to reverse-engineer it. State it: frontends consume the EngineEvent
stream and submit intents; the TUI is the in-process default; smith rpc
is the out-of-process boundary for web/native/mobile, which link no
smith code; and the terminal render model is deliberately not a
cross-UI abstraction. Anchoring matters — a frontend is a peer of the
TUI, not a plugin, so the RPC event surface adapts EngineEvent (§6.3),
not the plugin bridge, and it is an adapter not a mirror: blocking
events invert to requests and TUI-private events are omitted. Whether
that adapter is complete for a real UI is left prototype-gated rather
than asserted.
Edits SPEC §6.3/§8/§10.4 and adds the p28 plan to prototypes/PLAN.md.
Changed files (2) Diff layout Auto Unified Split
+26 / −1 text lines
742 742 - provider/model changes,- provider/model changes,743 743 - errors and shutdown.- errors and shutdown.745 - `EngineEvent` is consumed by `smith-harness` and `smith-tui`.745 + `EngineEvent` is consumed by `smith-harness` and `smith-tui`. It is the 746 + frontend stream: every frontend (the built-in TUI in-process, §8; any RPC747 + client out-of-process, §10.4) consumes `EngineEvent` and submits intents back.748 + Some variants — TUI-internal UI state changes — are in-process-frontend-private749 + and are not exposed out-of-process.747 751 ### 6.4 Hooks ### 6.4 Hooks 1288 1292 `smith-tui` owns terminal primitives, normalized events, widgets, themes, and`smith-tui` owns terminal primitives, normalized events, widgets, themes, and1289 1293 render loop. It depends only on `smith`.render loop. It depends only on `smith`.
1295 + **Frontend boundary.** `smith-tui` is the built-in *in-process frontend* — one1296 + consumer of the `EngineEvent` stream (§6.3) that renders it and feeds intents1297 + (prompt submit, steer, command, abort) back. It is not privileged as *the* UI:1298 + the same event-out/intent-in surface is exposed out-of-process by `smith rpc`1299 + (§10.4), which is the canonical boundary for additional frontends (web, native,1300 + mobile). Those are RPC clients and link no smith Rust code. The render model1301 + below — cells, borders, ratatui `Rect`s — is deliberately terminal-specific and1302 + is **not** a cross-UI abstraction: a browser or GPU frontend brings its own1303 + rendering and consumes only the event/intent surface, never smith's widgets.1291 1305 ### 8.1 Backend ### 8.1 Backend 1293 1307 Rendering uses:Rendering uses:2407 2421 Framing (line-delimited JSON vs `Content-Length`) is an implementation choiceFraming (line-delimited JSON vs `Content-Length`) is an implementation choice2408 2422 settled when `smith rpc` is built.settled when `smith rpc` is built.
2424 + **RPC is the multi-frontend boundary.** An RPC client is a frontend peer of the2425 + built-in TUI (§8), so its event surface is an adapter over the `EngineEvent`2426 + stream (§6.3) — the same source the TUI consumes — not the plugin bridge2427 + (§9.8). It is an adapter, not a mirror, by three rules: non-blocking events2428 + project to notifications; blocking events (`tool_call`, `session_before_*`)2429 + project to server→client requests the client answers; and frontend-private2430 + `EngineEvent` variants (TUI-internal UI state) are omitted. Whether this2431 + adapter is *complete* — every externally-meaningful `EngineEvent` reaching a2432 + frontend that needs it — is prototype-gated (p28); p24 proved the projection2433 + mechanics, not sufficiency for a full alternative UI.2410 2435 ## 11. Security Model ## 11. Security Model prototypes/PLAN.md Modified +64 / −0 text lines
1936 1936 §8.7 and §17.6. Spec issues: P1 resolution contract, P2 property target, P2§8.7 and §17.6. Spec issues: P1 resolution contract, P2 property target, P21937 1937 composition rules.composition rules.
1939 + ## Campaign 6 — Multi-frontend readiness 1941 + ## P28 — `p28-rpc-frontend-sufficiency` 1945 + - §8 frontend boundary / §10.4: `smith rpc` is the multi-frontend boundary; an1946 + RPC client is a frontend peer of the TUI, consuming an adapter over the1947 + `EngineEvent` stream (§6.3) — non-blocking → notifications, blocking →1948 + requests, frontend-private omitted.1949 + - Implicit sufficiency claim: a full alternative UI (web/native/mobile) can be1950 + built on the RPC surface alone.1954 + p24 proved the projection *mechanics*, not *sufficiency*. An `EngineEvent`1955 + variant may carry state a real frontend must render that is unreachable over1956 + the §10.4 surface — a completeness gap that would only surface when someone1957 + actually builds a web UI.1959 + ### Minimal artifact 1962 + p28-rpc-frontend-sufficiency/1963 + Cargo.toml (serde, serde_json)1967 + A mock engine emits the full `EngineEvent` stream over the RPC adapter during a1968 + scripted complete session; a headless mock frontend client (no smith-tui code,1969 + no Lua) consumes only the RPC surface and reconstructs everything a UI renders.1974 + cd prototypes/p28-rpc-frontend-sufficiency1975 + cargo run -- classify1976 + cargo run -- reconstruct1977 + cargo run -- blocking-roundtrip1983 + - `classify`: every `EngineEvent` variant (§6.2 AgentEvent + §6.3 harness1984 + events: session lifecycle, steering/follow-up, UI-state, provider/model1985 + change, error, shutdown) tagged `notification` / `request` /1986 + `frontend-private-omitted` / `MISSING`; the MISSING set is the finding,1987 + - `reconstruct`: a scripted session (turns, streaming text/thinking deltas,1988 + tool calls incl. a blocking `tool_call`, steering queue, compaction/fold,1989 + leaf switch/tree, secret placeholders, model change, error) drives the mock1990 + client, whose reconstructed UI state (transcript, tool views, steering queue,1991 + leaf/tree, cost/context, active model) deep-equals the engine's ground truth,1992 + built from the RPC stream ALONE,1993 + - `blocking-roundtrip`: a blocking `tool_call` reaches the client as a request1994 + and the client's reply flows back into the engine,1995 + - verdict: the RPC surface is sufficient for a full frontend, or the exact1996 + MISSING variants/state are listed.2000 + Upgrade the §10.4 completeness claim from p28-gated to proven, or add the2001 + missing driver methods / event projections the spike finds.1939 2003 ## Reporting Template ## Reporting Template 1941 2005 Each completed prototype updates this plan with a result block in theEach completed prototype updates this plan with a result block in the