--- applyTo: "packages/genui/a2ui*/**" --- When maintaining A2UI component catalogs, keep the catalog-facing contract in a TypeScript interface marked with `@a2uiCatalog `. The extractor consumes TypeDoc reflection data and does not parse TS/TSX source itself, so inline the JSON-schema-facing property shape instead of relying on aliases or external interfaces. When working on multi-theme A2UI styling, keep shared token definitions in `packages/genui/a2ui/styles/theme.css` `:root`, and put theme-specific differences in the `.a2ui-light` and `.a2ui-dark` blocks. Prefer light/dark overrides for colors such as surface, text, border, overlay, and icon colors. Avoid reintroducing layout tokens like spacing, size, or radius as global CSS variables unless the component contract truly needs them; those should generally be handled by component CSS overrides instead. Keep `--a2ui-icon-font-family` configurable when icon glyph fonts need to vary by theme or embedding host. Only `@a2uiCatalog` is a custom tag. Use standard TypeDoc-supported comments and tags for metadata: summaries for descriptions, `@remarks` for additional description, `@defaultValue` for schema defaults, and `@deprecated` for deprecated fields. Do not write JSON Schema in comments. Preserve existing enum order when regenerating catalog JSON, because catalog snapshots and LLM prompts can depend on deterministic option ordering. Avoid adding `@defaultValue` for string defaults in A2UI catalog component props until the extractor normalizes TypeDoc code-span output; otherwise generated `catalog.json` may contain a rendered code fragment instead of the intended plain string. Prefer documenting the default in surrounding docs and keeping the runtime default in code. Keep built-in catalog CSS assets in `packages/genui/a2ui/styles/catalog/*.css`, not under `src/catalog`. Catalog component TSX files should import those assets through paths that stay valid after TypeScript emits `dist/catalog//index.jsx`, for example `../../../styles/catalog/Button.css`. When styling A2UI catalog `DialogView` overlays that should be page-centered, give the overlay view page-filling bounds such as `width: 100%`, `height: 100%`, and explicit `top` / `right` / `bottom` / `left` offsets before relying on flex centering. Avoid `inset`, because the Lynx template encoder drops it. For compact picker dialogs in A2UI phone previews, keep the natural content height below the small preview viewport; `max-height` is useful as a fallback, but dense controls such as calendar rows and time steppers may need smaller row heights so the dialog visually leaves top and bottom breathing room. When implementing leaf input components in `packages/genui/a2ui/src/catalog`, import `Input`/`TextArea` from `@lynx-js/lynx-ui-input` directly and let the host decide whether to wrap the surface in keyboard-aware layout. Do not wrap individual catalog leaf components in `KeyboardAwareTrigger` unless the component owns the surrounding keyboard-aware responder/root contract. For the `` shell, treat `className` and `wrapSurface` as complementary theming hooks. `className` belongs on the `surface-${surfaceId}` view itself, while `wrapSurface` is the outer wrapper for layout or theme shells. Prefer `className` when the theme lives on the surface root, and `wrapSurface` when you need an additional enclosing element. When adding a built-in A2UI catalog component, update the component export chain (`src/catalog/index.ts`, `src/index.ts`, and the package `exports` map), refresh the all-builtins README recipe, and add the component plus its generated manifest to the playground `ALL_BUILTINS` list so official gallery examples can render it. When adding a built-in A2UI catalog component that should be available to the GenUI server agent, regenerate the complete server catalog at `packages/genui/server/agent/a2ui/catalog.json` and provide a `COMPONENT_SUMMARIES` entry in `packages/genui/server/agent/a2ui/a2ui-catalog.ts`. The server prompt catalog should read components and functions from the complete catalog file instead of importing per-component manifests or function files separately. The complete generated A2UI catalog contains both `components` and `functions`, so keep it outside the per-component catalog directory. For `packages/genui/a2ui`, per-component manifests live under `dist/catalog//catalog.json`, while the complete catalog lives at `dist/catalog.json`. Keep the legacy package export `./catalog/catalog.json` as a compatibility alias to the complete `dist/catalog.json` rather than generating a second full catalog under `dist/catalog/`. When evolving `packages/genui/playground`, treat protocol-prefixed hashes such as `#/a2ui/...` and `#/openui/...` as the canonical routes, and preserve the current mainline tab names (`create`, `examples`, `components`) when adding protocol-aware routing. If you keep compatibility aliases for older or transitional paths such as `#/demos` or `#/chat`, parse them into the canonical route model instead of letting a rebase silently rename the mainline routes. For catalog navigation, keep `components` and `catalog` as route aliases that resolve to the same catalog page for a given protocol. Prefer one canonical tab label per protocol in the UI, but ensure legacy and new entrypoints both land on the same content so links and bookmarks stay valid during route renames. When a GenUI package builds a CLI or other generated artifact that another workspace package executes during its own build, declare that package's `dist/**` (or equivalent generated directory) as Turbo `build.outputs`. Without explicit outputs, cache hits can skip restoring the built CLI and leave downstream workspace bins pointing at missing files. When `packages/genui/a2ui` generates its catalog, ensure `packages/genui/a2ui-catalog-extractor` has been built first. The `genui a2ui generate catalog` command delegates through `@lynx-js/genui-cli`, which imports `../a2ui-catalog-extractor/dist/cli.js`; clean CI runs will fail if that dist CLI is not produced before A2UI's build or API extractor script. Keep `packages/genui/a2ui-catalog-extractor/src/index.ts` as a narrow public facade. Put CLI-only artifact writers, TypeDoc JSON helpers, and other extractor internals in non-exported source modules, and have `src/cli.ts` import those internals directly instead of importing from `src/index.ts`. When implementing A2UI v1.0 functions in `packages/genui/a2ui`, keep function resolution scoped to the registered catalog identified by the component, function call, or surface. Dynamic component props, checks, and function-call actions should all go through the same `resolveDynamicValue` / `executeFunctionCall` path so data bindings, nested function calls, catalog-declared argument validation and DynamicBoolean coercion, and `formatString` data-context interpolation stay consistent. When maintaining the A2UI `LazyComponent` catalog component, load ReactLynx standalone lazy bundle URLs with dynamic import attributes such as `import(url, { with: { type: 'component' } })` and avoid importing `loadLazyBundle` from `@lynx-js/react/internal`. When verifying `packages/genui/playground`, remember that `pnpm -F @lynx-js/genui-a2ui build` first runs `tsc --project tsconfig.build.json` and then regenerates catalog JSON through `build:catalog`. The playground consumes `@lynx-js/genui/a2ui` through package exports under `dist/**`, so you normally do not need a separate `tsc` step unless you intentionally skipped the package `build` step. When streaming A2UI server responses, emit a root `Loading` component immediately after `createSurface` so the new surface has visible content before the model streams real components. For an image that lacks a user-provided loadable URL, the A2UI agent must first emit a complete independently renderable array with the theme/body and a same-id `Loading` image placeholder, then call its suspendable server-side `generate_image` tool. When the asynchronous tool result resumes the agent, the agent must copy the returned URL into a minimal existing-surface patch that replaces the placeholder; the tool and route must not generate that patch. Reject unresolved search-query strings and model-invented URLs during validation. Stream an `Image` only when its source came from the user/host or the current request's resumed image tool; otherwise keep a same-id `Loading` component. The stream parser must not resolve image searches or invent placeholder URLs. When verifying `packages/genui/playground`, remember that `pnpm -F @lynx-js/a2ui-reactlynx build` regenerates catalog JSON only. The playground consumes `@lynx-js/a2ui-reactlynx` through package exports under `dist/**`, so run `pnpm -F @lynx-js/a2ui-reactlynx exec tsc -p tsconfig.build.json` before rebuilding the playground if runtime TypeScript changed. For known GenUI playground examples, keep the web preview URL on `?demo=` instead of swapping it to the payload-store `messagesUrl`. `render.html` intentionally fetches known demo JSON in the browser shell and passes resolved messages into Lynx, avoiding fetch differences in the Lynx worker runtime; use payload-store URLs for custom edited JSON. When restoring GenUI playground Create previews after a page refresh, boot the render iframe separately from restored message delivery. Send restored messages through an idempotent replay event that `render.html` can queue until `.sendGlobalEvent` and the Lynx `MessageStore` are both available; do not rely on a single eager `postMessage` during iframe startup. For interactive GenUI playground component examples, bind mutable props through `{ '@path': ... }` and provide matching example data so the component preview emits an initial `updateDataModel` before `updateComponents`. Literal values render the initial state but cannot be changed by `setValue`, which only writes back to data-bound props. For the built-in `DateTimeInput`, keep date-enabled default output as `YYYY-MM-DD` unless `outputFormat` is explicitly provided. Implement calendar behavior inside `packages/genui/a2ui` with local helpers that borrow the `lynx-ui-calendar` windowing/date patterns as needed, because `@lynx-js/lynx-ui-calendar` is not an available package dependency here. When changing A2UI README content under `packages/genui/a2ui` or `packages/genui/playground/examples`, keep the corresponding Chinese README in sync. Keep the `packages/genui/a2ui` entry READMEs focused on first-time developers, and move deeper package material into topic docs under `docs/` with matching Chinese versions. Keep the playground examples README self-contained unless a split is explicitly requested. The Chinese docs should preserve the same technical boundaries as the English docs: `@lynx-js/genui/a2ui` is the client renderer/store/catalog runtime, `genui a2ui` is build/setup tooling, and the Agent service plus transport adapter are owned by the embedding app. When adding A2UI website README link rewrites in `website/sidebars/genui.ts`, put longer relative paths before shorter substrings such as `./src/catalog/README.md`, otherwise `../src/catalog/README.md` can become a broken `./guide/...` URL. Keep generated README links to the `/genui` playground as external `https://lynxjs.org/genui` Markdown links; the toolbar/nav item should point at `/genui`, but Rspress dead-link checking treats Markdown `/genui` links as docs pages. When embedding an MCP App inside A2UI on Lynx, use the built-in `McpApp` frame wrapper: select `webUrl` or `url` from `SystemInfo.platform`, pass `mcpAppData` through frame `data` (with `global-props` only as compatibility input), and render the nested host with its embedded layout. Lynx `frame` hosts another Lynx bundle; it is not an HTML iframe sandbox, so bundle URLs and data must come from a host-registered trusted MCP Apps resource rather than agent-generated input. Do not rely on Web block layout to make a frame fill its container: make the wrapper an explicit column Flex container with stretched children, set `align-self: stretch` for Flex parents and `linear-layout-gravity: stretch` for Lynx Linear parents, keep `min-width: 0` on both the wrapper and frame, and retain an explicit inline `width: 100%` on the frame. Enable `auto-width` and `auto-height` when the frame should follow the nested page's reported content size; these attributes do not replace the parent-width stretch constraint. Lynx template encoding does not support the `inset` box-shadow keyword; use a real border with border-box sizing and account for its content-box reduction (for example, a 288 px wrapper with 1 px borders provides 286 px to the frame). Escape component and function names as JSON Pointer segments when creating catalog union references in both the extractor and runtime serializer. Component-level function-call types must allow omitted args; let the selected catalog function schema enforce its own required arguments.