feat(apps): lane-3 surface runtime — shared renderer for web/PWA and desktop, personal DMs only

Aperta
#175 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript, react, web-dev
Ambito
frontend

Direzione di ricerca

Start with the lane-3 security design note, docs/PRD.md's mini-app direction, and the D23 amendment in DECISIONS.md; then locate the shared renderer in app-core. The issue describes a cross-platform renderer, security controls, Gateway integration, and extensive test coverage, but gives no implementation file paths. Done means meeting the acceptance criteria and passing typecheck, Biome, focused tests, and the specified staging checks.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

Wave 2 of 4 for the mini-app lane-3 build. This is the host half of lane 3: one shared React renderer in app-core that draws agent-authored A2UI 1.0 surfaces on web/PWA and in the desktop WebViews, holds each surface's data model as the Gateway sends it, and turns user gestures into versioned actions. The Gateway is the authority for every check. A host check is defence in depth and UX, never authorization.

Scope: in beta, lane 3 runs only in personal DMs. The Gateway decides which rooms are personal. Shared rooms do not open until the controls pass a separate independent re-QA, and until then the host shows the Gateway's room_not_personal refusal as an unavailable state.

Design and contract

  • Lane-3 security controls (gate 4, merged in #165; round 6 approved): note. The host halves are in §2 (envelope, versions, actions, streaming, scopes), B1, B6, B7, B8, B10, S2, S3, S4, S6, S7 and S8. Appendix §D gives the test layers.
  • Contract of record: an upstream item (tracked privately), items 1 to 7, the item-3 correction and items 8 to 12. The host-facing items are 8 (row ids in pending writes), 9 (versions from the last committed paint), 10 (action-line labels), 11 (picker values) and 12 (renderer errors).
  • docs/PRD.md "Mini-app direction: generative UI" (lane-3 trust rules, rendering) and the D23 amendment in DECISIONS.md.
  • The Gateway half is wave 1, an upstream item (tracked privately).
  • The note's header line ("awaits a delta check") predates the closure: round 6 approved it, and gate 4 closed in an upstream item (tracked privately).

Only the A2UI 1.0 messages, the four catalog function names and the envelope's textFallback, revision and catalog pin are fixed. Every other key, reason code, delay and limit is a proposal until staging measures it.

Catalog input. The function table and component rules come from core catalog v1 (wave 3). Until wave 3 pins the signed catalog, tests run against a clearly marked test catalog with the same four functions, and the staging end-to-end item counts only once the signed v1 pin is in place. The wave order (catalog after runtime) is an open question for the coordinator.

Acceptance criteria

Data model and envelope

  • The host consumes the envelope {a2ui, textFallback, revision, catalogPin, dataVersions?, rowKeys?, denial?} and applies createSurface, updateComponents, updateDataModel (path and value; null deletes) and deleteSurface.
  • The model is stored in null-prototype objects or Map. The host refuses the JSON Pointer segments __proto__, constructor and prototype after ~ decoding, repeating the Gateway check.
  • Ephemeral values stay in the tab and are never sent.
  • All host state is keyed by (server, workspace, principal, room, surfaceId). A workspace switch and sign-out purge it; a mismatched key is a cache miss, never a fallback.

Binding to the drawn version (note §2; items 8 and 9)

  • Every action sends dewee_revision, dewee_sourceVersions, dewee_rowKey, dewee_pendingWrites and dewee_idempotencyKey, and no arguments.
  • Every version the host sends comes from its last committed paint, never from an update it has received but not drawn.
  • Pending writes inside a list template name their row as {listPath, rowId, relativePath, value, baseVersion}, never an index.
  • On stale, the host keeps the typed text in its inputs, rebases the pending writes on the returned versions, re-renders under the dwell, and lets the user click again. After 3 consecutive stale results on one control, it shows "This content keeps changing" beside it.
  • Render-affecting updates are coalesced to at most 2 per second per surface.

The dwell and gesture integrity (B8)

  • Only isTrusted events count. The host never moves focus into a composition.
  • An actionable control ignores input for 500 ms after a change to itself, its ancestor chain or any value it renders or reads (label, visibility, source paths, resolved against its row); after it enters the viewport; and while a host overlay is open or within 500 ms of it closing. The dwell starts at paint. Updates elsewhere on the surface start no dwell.
  • A control ignores input while off-screen (IntersectionObserver). At pointer-down, a move of its box against its box 500 ms earlier refuses the click.
  • Lane-3 controls ignore input while the main window is not the active window (the activating click is dropped), and while any lane-4 window or view intersects the surface.
  • Trusted confirmations arm after 500 ms. A press that started before arming is ignored, Allow is never default-focused, and Enter never activates it.
  • Each surface has its own error boundary. Host chrome and the stop control sit outside every surface subtree, and a surface that throws twice is replaced by its textFallback.
  • Early input is dropped silently and counted. The host reports dwell-reject counts only to the Gateway's refusal span.

Rendering rules (B1, B7, B10, S2, S8)

  • Rendering produces React text nodes only: no HTML, no Markdown and no autolinks. Expressions are evaluated in one pass, and a bound value is never re-parsed, so ${...} in data stays text.
  • The host function table is compiled code. An unknown function name renders the control disabled, reports INVALID_FUNCTION_CALL, and never produces an outbound message. The host never emits callAgentFunction or callRendererFunction.
  • For actionable controls, the accessible name is the visible label, plus @accessibility.label only when it contains the visible label. live regions are polite only and capped at one announcement per 5 s per surface.
  • Bidi and zero-width characters in labels are stripped.
  • A composition over the S2 caps shows textFallback.

Errors relayed to the agent (item 12)

  • An A2UI error the renderer sends carries only the error code, the surface id, the component id and the data path. It carries no free-text message and no evaluated value.

Stale, denied and unavailable states

  • Each typed refusal maps to a human message with one next action, in English and Vietnamese: stale (re-rendered, click again), delegation, nav_refused, media_unsupported, media_unavailable, not_authorized, room_not_personal, lane4_not_allowed, and a frozen surface after the room became shared.
  • A bad, unknown, older or denylisted catalog pin shows textFallback and "This app needs a newer Dewee". The host never downgrades to an older or basic catalog.
  • Flag off or a kill switch shows every surface as textFallback, labelled as agent-written. textFallback is never quoted in a confirmation.

Trusted host chrome (B5, S3, S4, S6, S9)

  • Prompted writes, navOpen and "Share with room" confirmations render only from the Gateway's confirmation content, as trusted host chrome no composition can reproduce.
  • navOpen shows the full URL with the full origin prominent, in Unicode and punycode when they differ, flags a query built from data, and opens only in the external browser (a noopener tab on web). The main WebView never navigates.
  • The media widget shows a placeholder and makes no network request until mediaPlay.
  • The host verifies the catalog pin against the build's allowlist, Dewee's built-in catalog key, the minimum version and the signed denylist (purpose denylist, monotonic sequence, expiry). It refuses a denylist older than the one it holds, and disables effects while its list is expired.
  • A published composition shows a provenance frame naming its source. A workspace or self-hosted review reads "Reviewed by {workspace}", never "official". A composition signature verifies only with the current server's composition key and issuer; an edited copy renders as an unsigned personal copy with no "always allow".

The action line

  • The Gateway-written action line renders as a quoted, non-user item in the conversation, as plain text, never as the clicker's message.

Hosts and accessibility

  • The same renderer runs on web/PWA and in desktop WebView2, WKWebView and WebKitGTK.
  • Checked at 390, 768, 1024 and 1440 widths, light, dark and system, keyboard-only, with screen-reader names, focus order and reduced motion, in English and Vietnamese.

Tests: the design's B fixtures, host side

  • B1: a host unit test shows an unknown function never produces an outbound message.
  • B6: the catalog-authority fixtures are owned by wave 3; this wave runs them through the host's pin check. A replayed older denylist is refused.
  • B7: data "${constructor.constructor('x')()}" renders literally; /a/__proto__/polluted, /a/constructor/prototype/x and a ~-encoded variant are refused, and ({}).polluted stays undefined in the main WebView; a URL-looking string is not a link.
  • B8 gesture: an agent update swaps a button under a pending click, and Enter right after the swap, give no effect; a sibling inserted above the control and a scroll-into-view under a resting pointer refuse the click within the dwell; a double-click whose second press lands on a new Allow is ignored; a synthetic dispatchEvent click is ignored; a throwing widget leaves the stop control usable.
  • B8 versions and paint: an update received but not painted, then a click, sends the painted versions and gets stale; typed input clicked within the sync cap runs; after an agent-caused stale the typed text is still in the field; a row inserted at the top while a typed write in row B is pending names row B by id.
  • B8 streaming: a live ticker at 5 updates per second elsewhere never blocks a control that does not read it; an append to a 50-row keyed list keeps row 10 clickable; three consecutive stale results show "This content keeps changing".
  • B8 windows: with the main window inactive, the first click is dropped; with a lane-4 window or view intersecting the surface, input is ignored.
  • B10: a burst of updates yields at most the capped announcements in a screen-reader snapshot.
  • S3: javascript:, http: and a homograph host never navigate the main WebView; S4: no network request before the mediaPlay click; S7: switching workspace and back shows no stale surface, and a second account sees no cache.
  • Item 12: a renderer error carrying an evaluated value in its message sends only code, surface, component and path.
  • Denied, cancel, recovery and concurrency paths, at the integration layer against clearly marked Gateway fakes on both hosts: each typed refusal renders its state; a declined confirmation sends nothing; reauth and Back restore the surface after the current authority check; an agent write racing a click gives stale and the retry runs.
  • End to end on staging, in a personal DM, on web/PWA and on desktop WebView2, WKWebView and WebKitGTK, wired to the wave-1 routes.
  • Release checks in plans/EVIDENCE.md: lane3-dm-run-visibility and lane3-toolcall-outside-run stay NOT TESTED until a staging run and an independent reviewer record them. The host's part of lane3-toolcall-outside-run is that the action line carries no toolCall result. Adding relayed renderer errors to that row is a proposed addition to plans/EVIDENCE.md.
  • Typecheck, Biome and focused unit tests pass. Mock fixtures are marked and unreachable in production.

Surface parity

Surface Evidence
Gateway API/RPC Consumes the wave-1 routes and envelope (proposals); no Gateway change here
CLI N/A: interactive rendering in the client, no operator action
MCP N/A: lane 3 is A2UI, not an MCP App; MCP Apps stay lane 4
CCP / RGD / ACP N/A for views. Refusal and dwell-reject counts appear in the wave-1 spans in RGD and CCP
Dewee client Web/PWA and desktop render the same surfaces in personal DMs; denied, stale, frozen, unavailable and newer-Dewee states; shared rooms show the unavailable state
Conversation The agent posts a composition in a personal DM; the user acts; prompted effects confirm in trusted UI; the quoted action line appears; private outcomes stay in the DM
Docs Gate-6 docs PR (#167) for the PRD and D23 corrections; the user-facing explanation of lane-3 states when the flag first ships
Traces Host reports dwell-reject counts only; every other record is the wave-1 Gateway span

Blocked by

  • An upstream item (tracked privately) (wave 1, the Gateway contract).
  • #111 and #135: the lane-3 capability id and the capability map. None exists today.
  • Open question: PRD pre-build gate 2 (#158) is still open. The lane-3 appendix §B says lane 3 waits on it only for lane-4 participation, while the PRD gate list still names it for lanes 2 and 3. Whether this wave waits on it is the coordinator's call.
  • The gate-6 docs PR (#167), which the round-6 QA names as a lane-3 shipping dependency.

Rules

  • Opened on 2026-12-02 on the coordinator's authorization, after gates 4 and 5 closed. Not claimed or assigned. One lane at a time: this wave starts after wave 1.
  • Done means wired. This issue closes only on a slice wired to the real wave-1 routes, behind its dark capability id, and verified on staging. Fixtures are for tests only.
  • One relay integrator. Only the relay-integrator lane adds ClientMethod entries, the BFF allowlist entry and the desktop host command. This lane does not edit protocol.ts or capabilities.ts.
  • Files. A new feature folder in app-core (proposal: packages/app-core/src/features/apps/composition/). It does not touch features/apps/panel/*, which the lane-4 bridge owns.
  • An independent review runs before the PR leaves draft. No auto-merge.
Lingua principale
Nessun dato sulla lingua
Stelle
1
Fork
2
Merge medio
1h 51m
PR unite (30g)
103

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nextlevelbuilder/dewee-desktop-app

Tutte le issue di nextlevelbuilder/dewee-desktop-app

Issue simili

Altre issue su Web Dev

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.