Skip to content

feat(render): per-component fallback API + readiness gate#252

Merged
blove merged 8 commits into
mainfrom
claude/render-fallback-gate
May 12, 2026
Merged

feat(render): per-component fallback API + readiness gate#252
blove merged 8 commits into
mainfrom
claude/render-fallback-gate

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 11, 2026

Summary

Adds first-class per-component fallback rendering to @ngaf/render. Registry entries now accept an object shape:

const reg = views({
  button: { component: ButtonCmp, fallback: ButtonSkeletonCmp },
  card:   CardCmp,  // legacy bare shape still supported
});

<render-element> mounts the fallback whenever any state-bound prop resolves to undefined. Once the real component mounts, a monotonic latch prevents future reversion to fallback — subsequent state changes flow through as reactive input updates.

DefaultFallbackComponent ships as the implicit fallback for entries that omit one.

This is the rendering primitive that unlocks progressive GenUI rendering in <a2ui-surface> — each A2UI component's data bindings resolve at their own pace, and each slot transitions skeleton → real in place as its bindings populate.

Spec: docs/superpowers/specs/2026-05-11-progressive-genui-bubble-coalescing-design.md.

Test plan

  • nx test render green (registry tests, render-element fallback tests, default-fallback tests)
  • nx build render + nx lint render green
  • CI green

blove added 5 commits May 11, 2026 16:44
Card-shaped placeholder mounted when a registered component is
not yet ready to render (any state-bound prop unresolved). Used
as the fallback for registry entries that don't declare their
own, and as the top-level surface fallback for empty specs.
Registry entries now accept either a bare Type (legacy) or a
{ component, fallback? } object. defineAngularRegistry normalizes
both shapes; bare entries get DefaultFallbackComponent. The
AngularRegistry interface gains getFallback(name) for downstream
consumers (render-element) to look up the fallback class.
Per-element readiness check: if any state-bound prop resolves
to undefined, mount the registry's fallback component instead
of the real one. Once real mounts, a latched mountedReal flag
prevents future reversion — subsequent re-renders only push
new input values via Angular's reactive system.

null counts as ready (it's a meaningful resolved value);
only undefined triggers fallback.

Adds @analogjs/vite-plugin-angular to the render lib's vitest
config + a tsconfig.spec.json so component tests with inline
templates JIT-compile. Pre-existing pipeline-logic tests still
pass; new fallback-gate tests use TestBed.createComponent.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cacheplane Ready Ready Preview, Comment May 12, 2026 4:07am

Request Review

Signal writes inside computed are an anti-pattern even when deferred via
queueMicrotask. Move the monotonic mount latch into a constructor effect
that watches notReady + the resolved component class. Behavior unchanged;
fixes the signal-graph hazard flagged in PR review.
PR A widened ViewRegistry entries to Type | RenderViewEntry. The
markdown-children resolver indexes the registry directly (not via
defineAngularRegistry) and was implicitly typed as Type. Narrow at
the call site by checking 'typeof entry === function' (bare Type)
vs object form ({ component, fallback? }), returning the component
in either case.
@blove blove merged commit a12c060 into main May 12, 2026
14 checks passed
blove added a commit that referenced this pull request May 12, 2026
* feat(chat): A2UI envelope-args shape normalizer

Accepts four argument shapes observed in the streaming-envelope-tool
spike: canonical {envelopes:[...]}, singular {envelope:[...]}, positional
keys {0,1,...}, and flat single envelope. Returns a canonical envelope
list or null. Shared shape with the Python normalizer in PR 2.

* feat(chat): A2UI surface-store applyPartialArgs entry point

Adds a live-stream feed alongside apply(). Records the tool_call_id so
downstream consumers (content classifier) can short-circuit duplicate
envelope dispatch when the final wrapped AIMessage arrives carrying the
same content the live stream already applied.

* feat(chat): A2UI partial-args bridge for streaming envelopes

Subscribes to LangGraph custom events ('a2ui-partial') and feeds the
A2UI surface store envelope-by-envelope as the parent LLM streams its
tool_call.arguments JSON. Uses @cacheplane/partial-json to extract
structurally-complete envelopes from the growing args string.

Safety net: synthesises beginRendering immediately after the first
surfaceUpdate (targeting component id='root' or the first component),
so the surface mounts and the per-component fallback gate (PR #252)
fires while dataModelUpdates stream in — without waiting for the LLM
to emit beginRendering at the end of its envelope list. Repeated
beginRendering on the same surface is idempotent in the store.

Poison detection: a JSON-prefix validator runs ahead of the partial
parser to detect structurally invalid streams (the partial-json parser
silently halts on bad input rather than throwing), so malformed
arg streams are dropped and subsequent valid pushes are ignored.

* feat(chat): wire partial-args bridge to agent.customEvents

The chat composition subscribes to LangGraph custom events of name
a2ui-partial and forwards the cumulative args strings to the bridge.
Effect tracks last-processed index so re-renders don't re-dispatch.

Adapters that don't expose a customEvents signal (the runtime-neutral
Agent contract makes it optional) are tolerated via feature detection;
those continue to rely on the wrapped final-message classifier path.

* feat(chat): export partial-args bridge + normalizer

* chore: regenerate api-docs for partial-args bridge
blove added a commit that referenced this pull request May 12, 2026
…dler (#262)

* feat(examples-chat): A2uiPartialHandler sidebands streaming envelopes

Async callback handler tracking per-tool_call_id cumulative arguments
from on_chat_model_stream events. Each growth in the cumulative string
dispatches an a2ui-partial custom event carrying {tool_call_id,
args_so_far}; the frontend partial-args-bridge consumes these and feeds
envelopes into the A2UI surface store as they parse.

* feat(examples-chat): wire A2uiPartialHandler to generate node

Attached only when gen_ui_mode='a2ui'. Sidebands the parent LLM's
tool_call_chunks for render_a2ui_surface as a2ui-partial custom events.
Together with the frontend partial-args bridge (claude/genui-streaming-
frontend-bridge) and the envelope-tool refactor (claude/genui-streaming-
envelope-tool), this realises the per-component fallback transition
wired by PR #252 — surface mounts on first surfaceUpdate, components
flip from fallback to real as dataModelUpdates stream in.
blove added a commit that referenced this pull request May 12, 2026
…rk (#271)

Brings the canonical smoke checklist current with 29 PRs that landed
between Phase 7 (#239) and today without checklist updates. Specifically:

Updated sections:
- chat-debug devtools — replaced bottom-drawer model with floating
  launcher + status pill + switch (PRs #249, #251)
- Control palette — palette v2 (status pill, shadcn-styled panel, PR #244)
- Generative UI / A2UI surfaces — single-bubble invariant (PR #255),
  parent-emits-envelopes architecture (PR #259), wrapped-content +
  tool_calls coexistence (PR #255), envelope reorder
- Server-side wire format — tool_calls preserved on the final AI
- Replaced 'Multi-thread' section with 'Sidenav (thread management)'
  reflecting the permanent semantic <nav> + Active/Archived sections
  (PR #253) and removing the old palette-toggled drawer model

Added sections:
- Cmd+K history search — palette open/search/select/close, archived
  result subtitle, keyboard navigation (PR #253)
- Per-row thread actions — kebab menu order per state (active, pinned,
  archived), rename + pin/unpin + archive/unarchive + delete flows
  (PRs #258, #260, #267)
- Thread titles — first-user-message derivation, idempotent writes,
  manual rename precedence (PR #242)
- Progressive A2UI streaming — per-component fallback transition
  observable during streaming window (PRs #252, #261, #262, #268, #269)
- Inline checkpoint markers — render between messages during multi-step
  runs (PR #243)
- Responsive sidenav — viewport breakpoints, auto-collapse behavior (PR #240)

Total: ~58 new check items across 6 new sections, plus rewrites to 5
existing sections. Original 333-line checklist → 391 lines / 237 check
items.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant