Skip to content

feat(a2ui): load server catalog from cdn#2772

Open
Sherry-hue wants to merge 5 commits into
lynx-family:mainfrom
Sherry-hue:feat/a2ui-cdn-catalog
Open

feat(a2ui): load server catalog from cdn#2772
Sherry-hue wants to merge 5 commits into
lynx-family:mainfrom
Sherry-hue:feat/a2ui-cdn-catalog

Conversation

@Sherry-hue
Copy link
Copy Markdown
Collaborator

@Sherry-hue Sherry-hue commented Jun 2, 2026

Summary by CodeRabbit

  • New Features

    • Produces a single consolidated full A2UI catalog (exported for consumption) and a CLI flag to set its catalog ID; built-in catalog can be loaded asynchronously.
    • Async prompt builder and runtime catalog-loading helpers are exposed.
  • Bug Fixes

    • Default catalog now loads from CDN at runtime with automatic fallback to the bundled catalog.
    • Streaming, generation and validation flows consistently use the resolved catalog.
  • Documentation

    • CLI and package docs updated for the catalog-id option, output artifacts, and async usage.
  • Tests

    • Tests updated to validate the full catalog and functions output.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 2, 2026

⚠️ No Changeset found

Latest commit: dd10782

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 83afe160-3ac4-46a3-a03d-7523b595f046

📥 Commits

Reviewing files that changed from the base of the PR and between e96314d and dd10782.

📒 Files selected for processing (1)
  • packages/genui/server/agent/a2ui-catalog.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/genui/server/agent/a2ui-catalog.ts

📝 Walkthrough

Walkthrough

Consolidates per-component catalog artifacts into a generated full catalog; adds BASIC_CATALOG_ID and runtime loader with CDN fetch + local fallback; updates extractor CLI/API, tests, prompt API (async), agent/service, routes, CLI wiring, docs, and a consolidated server catalog JSON.

Changes

Dynamic A2UI Catalog Loading Migration

Layer / File(s) Summary
Extractor CLI, writer, tests, docs
packages/genui/a2ui-catalog-extractor/src/{cli,index}.ts, packages/genui/a2ui-catalog-extractor/{README.md,readme.zh_cn.md,etc/*}, packages/genui/a2ui-catalog-extractor/test/*
Adds --catalog-id, introduces writeA2UICatalog and catalogId option, emits full dist/catalog/catalog.json alongside per-component files, normalizes function entries, and updates tests to assert full catalog contents.
Prompt API, docs, and build wiring
packages/genui/a2ui-prompt/{README.md,etc/*}, packages/genui/a2ui-prompt/tsconfig.{json,build.json}, packages/genui/a2ui-prompt/turbo.json, packages/genui/etc/genui.api.md
Make buildA2UISystemPrompt require opts, add buildA2UISystemPromptAsync and loadBasicCatalog, update BASIC_CATALOG_ID, include a2ui-catalog-id in TS and Turbo inputs, and update API/docs to reflect async-first surface.
Catalog ID, artifact, and loader
packages/genui/server/agent/a2ui-catalog-id.ts, packages/genui/server/agent/a2ui-catalog.ts, packages/genui/server/agent/catalog/catalog.json
Add exported BASIC_CATALOG_ID, replace compile-time per-component assembly with runtime fetch+validation (loadBasicCatalog/fetchBasicCatalog) plus module-level caching/deduplication, require catalogId in createA2UICatalogFromManifests, and add consolidated catalog/catalog.json.
Agent & service changes
packages/genui/server/agent/{a2ui-agent.ts,a2ui-examples.ts}, packages/genui/server/service/a2ui-agent.ts, packages/genui/index.ts
Make createA2UIAgent async and load catalog at runtime; A2UIAgentService resolves catalog async, uses resolved catalog.id for cache keys, and passes resolved catalog for validation/agent creation; update re-exports.
Routes & CLI consumer wiring
packages/genui/server/app/a2ui/{stream,action/stream}/route.ts, packages/genui/cli/bin/cli.js
Routes and CLI prompt generation now load the default catalog at runtime when opts.catalog is absent, thread optsWithCatalog through streaming, validation, and repair; on load failure routes log and return 502 JSON errors.
Maintainer instructions & packaging
.github/a2ui-catalog.instructions.md, packages/genui/a2ui/package.json
Broaden applyTo to include server agent paths and update instructions to prefer extractor-generated full catalog, runtime BASIC_CATALOG_ID loading, and CDN-failure fallback to committed catalog/catalog.json; expose ./catalog/catalog.json in package exports.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • HuJean
  • PupilTong
  • gaoachao

Poem

🐰
I stitched the pieces into one bright sheet,
A single JSON road beneath my feet.
Fetch from the clouds, or open the door,
The catalog hops in, and rabbits explore. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 3.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(a2ui): load server catalog from cdn' clearly and concisely describes the main objective of this pull request: migrating the server catalog loading mechanism to use a CDN source instead of static local files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
5450 1 5449 126
View the top 1 failed test(s) by shortest run time
packages/genui/a2ui-catalog-extractor/test/extractor.test.ts::extractCatalogComponents > writes catalog.json files from TSX catalog fixtures
Stack Traces | 0.632s run time
ENOENT: no such file or directory, open '.../tmp/a2ui-catalog-out-rvQnOB/catalog.json'
at readFullCatalogJson (.../a2ui-catalog-extractor/test/extractor.test.ts:280:5)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

🧹 Nitpick comments (1)
.github/a2ui-catalog.instructions.md (1)

2-2: ⚡ Quick win

Expand applyTo to cover the server catalog files.

This new rule is meant to guide changes in packages/genui/server/agent/** as well, but the current glob only matches packages/genui/a2ui*/**, so the instruction will not be applied where the runtime loader and fallback snapshot actually live. As per coding guidelines, ".github/*.instructions.md: Update or create .github/*.instructions.md files with natural language instructions, using applyTo frontmatter with glob syntax to specify applicable files or directories."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/a2ui-catalog.instructions.md at line 2, The applyTo glob in
.github/a2ui-catalog.instructions.md currently only targets
packages/genui/a2ui*/**, so update the frontmatter applyTo entry to also include
the server catalog paths (e.g., add packages/genui/server/agent/** or
packages/genui/server/**) so the instructions apply to the runtime loader and
fallback snapshot files; ensure the final applyTo value is a comma- or
newline-separated list of globs covering both packages/genui/a2ui*/** and the
server catalog directory.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/genui/a2ui-catalog-extractor/src/index.ts`:
- Around line 332-339: The full catalog write is currently passing
CatalogFunction[] (which contains internal filePath) into
createA2UICatalog/writeA2UICatalog, leaking local build paths; before calling
createA2UICatalog (and likewise when producing the --typedoc-json output) map
each CatalogFunction to a plain FunctionDefinition by copying all public fields
and omitting filePath (e.g., transform functions => functions.map(f => ({ /* all
fields except filePath */ }))), then pass that normalized array into
createA2UICatalog and the typedoc-json builder so the top-level catalog and
typedoc export match the per-function files and do not include filePath.

In `@packages/genui/a2ui-catalog-extractor/test/extractor.test.ts`:
- Around line 214-229: The test file is using `@rstest/core` but the repo requires
Vitest; replace any imports from '`@rstest/core`' with Vitest equivalents and
ensure the file uses Vitest's globals (import { test, expect, beforeEach,
afterEach, vi } from 'vitest' as needed). Update usages of rstest-specific
decorators or helpers (e.g., rstest, before, fixture utilities) to Vitest
patterns and adapters, keeping the existing helper functions runCli,
createTempDir, catalogFixtureDir, fixtureDir, and readFullCatalogJson unchanged;
run the test file with the Vitest runner to confirm it resolves to the same
assertions. Ensure no `@rstest/core` remains in the file or imports.

In `@packages/genui/a2ui/package.json`:
- Line 144: The build script "build:catalog" is embedding a non-immutable
catalogId (the bare unpkg URL) which can change across releases; change the
script that generates the catalogId so it includes the package version (or
another immutable identifier) rather than pointing to the latest tag — update
the "build:catalog" npm script in package.json (the command string for
build:catalog) to construct an immutable URL that includes the package version
(for example by injecting the package.json version or using an env var) before
passing it to the generator so the generated catalog.json contains a stable
catalog-id.

In `@packages/genui/server/agent/a2ui-catalog-id.ts`:
- Around line 5-6: The exported constant BASIC_CATALOG_ID currently points at an
unversioned moving URL; change it to a release-pinned catalog URL or make it
build-time injectable so the server always fetches a catalog that matches its
packaged code. Update the export BASIC_CATALOG_ID in a2ui-catalog-id.ts to
either hardcode the exact release path (e.g. include the published package
version in the unpkg path) or read a build-time injected variable (e.g.
process.env.PUBLISHED_VERSION or a generated constant) that your build/publish
step sets; ensure any cache keys or logs that use BASIC_CATALOG_ID will now
reflect the stable, versioned URL.

In `@packages/genui/server/agent/a2ui-catalog.ts`:
- Around line 257-261: The manifest is currently trusted without validating
manifest.functions, so extend the guard to ensure manifest.functions is an array
of well-formed function-spec objects before passing it to
createA2UICatalogFromExtractedManifest; update the validation used by
isExtractedCatalogManifest (or add a small helper like
isExtractedCatalogManifestWithFunctions) to check that manifest.functions is
either absent or an array where each item has a string name, a string
returnType, and a parameters array whose items have string name and type (or the
minimal shape renderCatalogReference expects), and throw an error if validation
fails; apply the same stricter check at both call sites that currently call
createA2UICatalogFromExtractedManifest so malformed CDN payloads are rejected
early.
- Around line 243-247: The current loadBasicCatalog implementation only dedupes
concurrent fetches because pendingBasicCatalog is cleared in finally, which
causes every subsequent call to refetch; change it to maintain a persistent
cached result (e.g., cachedBasicCatalog) that is returned immediately when
present, set cachedBasicCatalog to the resolved A2UICatalog when
fetchBasicCatalog() succeeds, and only clear pendingBasicCatalog after the fetch
completes (or clear cached on explicit refresh/error as appropriate). Update
loadBasicCatalog, pendingBasicCatalog handling, and the fetchBasicCatalog
success/error flow so that pendingBasicCatalog is used for in-flight dedupe
while cachedBasicCatalog holds the last-good result (also apply the same change
to the similar block around lines 250-252).

In `@packages/genui/server/agent/a2ui-prompt.ts`:
- Around line 180-189: In buildA2UISystemPrompt, guard against opts being
null/undefined before destructuring: check if opts is falsy and throw the same
Error used for missing catalog (or route into that error path) so callers
passing undefined get the guided migration error; then safely destructure const
{ catalog } = opts and retain the existing catalog-null check and thrown
message; update BuildSystemPromptOptions usage accordingly.

In `@packages/genui/server/app/a2ui/action/stream/route.ts`:
- Around line 200-201: The catalog resolution using loadBasicCatalog() should be
wrapped in a try/catch before constructing the SSE/ReadableStream so failures
produce a controlled CORS-safe response; modify the code around the const
catalog = opts.catalog ?? await loadBasicCatalog() and optsWithCatalog = {
...opts, catalog } to try to resolve opts.catalog or await loadBasicCatalog()
inside a try block and on catch return a jsonWithCors(...) error response (or
alternatively move the await loadBasicCatalog() into the stream's error path),
ensuring downstream logging/repair paths are invoked and clients receive the
expected error contract.

In `@packages/genui/server/app/a2ui/stream/route.ts`:
- Around line 143-144: The code calls await loadBasicCatalog() outside the
route's try/catch, so failures produce an unhandled 500; wrap the catalog load
in its own try/catch inside the route handler where opts.catalog is resolved
(before building optsWithCatalog) and on error return the route's CORS-safe
error using jsonWithCors(...) with an appropriate message/status. Specifically,
when computing const catalog = opts.catalog ?? await loadBasicCatalog(), instead
first check opts.catalog and if missing call loadBasicCatalog() inside a
try/catch, assign to catalog on success, and on failure return jsonWithCors(...)
so the handler keeps its normal error response behavior; then construct
optsWithCatalog = { ...opts, catalog } and continue.

---

Nitpick comments:
In @.github/a2ui-catalog.instructions.md:
- Line 2: The applyTo glob in .github/a2ui-catalog.instructions.md currently
only targets packages/genui/a2ui*/**, so update the frontmatter applyTo entry to
also include the server catalog paths (e.g., add packages/genui/server/agent/**
or packages/genui/server/**) so the instructions apply to the runtime loader and
fallback snapshot files; ensure the final applyTo value is a comma- or
newline-separated list of globs covering both packages/genui/a2ui*/** and the
server catalog directory.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7cf9e3ce-568b-4551-8154-5a1da5b0b3b7

📥 Commits

Reviewing files that changed from the base of the PR and between 3794d0c and d16b059.

📒 Files selected for processing (44)
  • .github/a2ui-catalog.instructions.md
  • packages/genui/a2ui-catalog-extractor/README.md
  • packages/genui/a2ui-catalog-extractor/etc/genui-a2ui-catalog-extractor.api.md
  • packages/genui/a2ui-catalog-extractor/readme.zh_cn.md
  • packages/genui/a2ui-catalog-extractor/src/cli.ts
  • packages/genui/a2ui-catalog-extractor/src/index.ts
  • packages/genui/a2ui-catalog-extractor/test/extractor.test.ts
  • packages/genui/a2ui-prompt/README.md
  • packages/genui/a2ui-prompt/etc/genui-a2ui-prompt.api.md
  • packages/genui/a2ui-prompt/tsconfig.build.json
  • packages/genui/a2ui-prompt/tsconfig.json
  • packages/genui/a2ui-prompt/turbo.json
  • packages/genui/a2ui/package.json
  • packages/genui/cli/bin/cli.js
  • packages/genui/etc/genui.api.md
  • packages/genui/index.ts
  • packages/genui/server/agent/a2ui-agent.ts
  • packages/genui/server/agent/a2ui-catalog-id.ts
  • packages/genui/server/agent/a2ui-catalog.ts
  • packages/genui/server/agent/a2ui-examples.ts
  • packages/genui/server/agent/a2ui-prompt.ts
  • packages/genui/server/agent/catalog/Button/catalog.json
  • packages/genui/server/agent/catalog/Card/catalog.json
  • packages/genui/server/agent/catalog/CheckBox/catalog.json
  • packages/genui/server/agent/catalog/ChoicePicker/catalog.json
  • packages/genui/server/agent/catalog/Column/catalog.json
  • packages/genui/server/agent/catalog/DateTimeInput/catalog.json
  • packages/genui/server/agent/catalog/Divider/catalog.json
  • packages/genui/server/agent/catalog/Icon/catalog.json
  • packages/genui/server/agent/catalog/Image/catalog.json
  • packages/genui/server/agent/catalog/LineChart/catalog.json
  • packages/genui/server/agent/catalog/List/catalog.json
  • packages/genui/server/agent/catalog/Loading/catalog.json
  • packages/genui/server/agent/catalog/Modal/catalog.json
  • packages/genui/server/agent/catalog/RadioGroup/catalog.json
  • packages/genui/server/agent/catalog/Row/catalog.json
  • packages/genui/server/agent/catalog/Slider/catalog.json
  • packages/genui/server/agent/catalog/Tabs/catalog.json
  • packages/genui/server/agent/catalog/Text/catalog.json
  • packages/genui/server/agent/catalog/TextField/catalog.json
  • packages/genui/server/agent/catalog/catalog.json
  • packages/genui/server/app/a2ui/action/stream/route.ts
  • packages/genui/server/app/a2ui/stream/route.ts
  • packages/genui/server/service/a2ui-agent.ts
💤 Files with no reviewable changes (19)
  • packages/genui/server/agent/catalog/ChoicePicker/catalog.json
  • packages/genui/server/agent/catalog/Loading/catalog.json
  • packages/genui/server/agent/catalog/CheckBox/catalog.json
  • packages/genui/server/agent/catalog/Slider/catalog.json
  • packages/genui/server/agent/catalog/Card/catalog.json
  • packages/genui/server/agent/catalog/LineChart/catalog.json
  • packages/genui/server/agent/catalog/Button/catalog.json
  • packages/genui/server/agent/catalog/DateTimeInput/catalog.json
  • packages/genui/server/agent/catalog/Image/catalog.json
  • packages/genui/server/agent/catalog/Tabs/catalog.json
  • packages/genui/server/agent/catalog/RadioGroup/catalog.json
  • packages/genui/server/agent/catalog/List/catalog.json
  • packages/genui/server/agent/catalog/Icon/catalog.json
  • packages/genui/server/agent/catalog/Text/catalog.json
  • packages/genui/server/agent/catalog/Divider/catalog.json
  • packages/genui/server/agent/catalog/Modal/catalog.json
  • packages/genui/server/agent/catalog/TextField/catalog.json
  • packages/genui/server/agent/catalog/Row/catalog.json
  • packages/genui/server/agent/catalog/Column/catalog.json

Comment thread packages/genui/a2ui-catalog-extractor/src/index.ts
Comment thread packages/genui/a2ui-catalog-extractor/test/extractor.test.ts
Comment thread packages/genui/a2ui/package.json
Comment thread packages/genui/server/agent/a2ui-catalog-id.ts
Comment thread packages/genui/server/agent/a2ui-catalog.ts Outdated
Comment thread packages/genui/server/agent/a2ui-catalog.ts
Comment thread packages/genui/server/agent/a2ui-prompt.ts
Comment thread packages/genui/server/app/a2ui/action/stream/route.ts Outdated
Comment thread packages/genui/server/app/a2ui/stream/route.ts Outdated
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jun 2, 2026

Merging this PR will not alter performance

✅ 81 untouched benchmarks
⏩ 26 skipped benchmarks1


Comparing Sherry-hue:feat/a2ui-cdn-catalog (dd10782) with main (536cbca)

Open in CodSpeed

Footnotes

  1. 26 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/genui/a2ui-catalog-extractor/test/extractor-functions.test.ts (1)

86-95: ⚡ Quick win

Assert catalogId and filePath structurally here.

This new coverage still misses the new catalogId contract, and JSON.stringify(fullCatalog)).not.toContain('filePath') is brittle because any string value containing that substring will fail the test for the wrong reason. Since writeCatalogArtifacts now serializes catalogId into catalog.json and the CLI threads --catalog-id through that path, assert fullCatalog.catalogId directly and check each function object lacks a filePath key instead of scanning the whole JSON string.

Suggested test shape
     const fullCatalog = readFullCatalogJson(outDir);
+    expect(fullCatalog['catalogId']).toBe('catalog.json');
     const fullCatalogFunctions = fullCatalog['functions'];
     expect(Array.isArray(fullCatalogFunctions)).toBe(true);
     const fullCatalogFunctionList = fullCatalogFunctions as unknown[];
     expect([...fullCatalogFunctionList].sort(compareByName)).toEqual([
       readExpectedFunctionJson('formatString')['formatString'],
       readExpectedFunctionJson('required')['required'],
     ]);
-    expect(JSON.stringify(fullCatalog)).not.toContain('filePath');
+    expect(
+      fullCatalogFunctionList.every(
+        value =>
+          typeof value === 'object' &&
+          value !== null &&
+          !('filePath' in value),
+      ),
+    ).toBe(true);

As per coding guidelines: "Keep README examples tied to tests. If a documented component contract, generated schema, CLI flow, or API example changes, update or add a test fixture or test case in this package so the documented behavior is checked."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/genui/a2ui-catalog-extractor/test/extractor-functions.test.ts`
around lines 86 - 95, Assert the new catalogId field and check for filePath keys
structurally: in the test using readFullCatalogJson and fullCatalog (and
existing symbols fullCatalogFunctions, fullCatalogFunctionList, compareByName,
readExpectedFunctionJson), add an assertion that fullCatalog.catalogId equals
the expected catalog id value (the value the test fixture/CLI should provide),
and replace the brittle
expect(JSON.stringify(fullCatalog)).not.toContain('filePath') with a structural
check that iterates fullCatalogFunctions and asserts each function object does
not have a filePath property (e.g., for each func:
expect(Object.prototype.hasOwnProperty.call(func, 'filePath')).toBe(false));
keep the existing function comparison by name intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/genui/a2ui-catalog-extractor/test/extractor-functions.test.ts`:
- Around line 86-95: Assert the new catalogId field and check for filePath keys
structurally: in the test using readFullCatalogJson and fullCatalog (and
existing symbols fullCatalogFunctions, fullCatalogFunctionList, compareByName,
readExpectedFunctionJson), add an assertion that fullCatalog.catalogId equals
the expected catalog id value (the value the test fixture/CLI should provide),
and replace the brittle
expect(JSON.stringify(fullCatalog)).not.toContain('filePath') with a structural
check that iterates fullCatalogFunctions and asserts each function object does
not have a filePath property (e.g., for each func:
expect(Object.prototype.hasOwnProperty.call(func, 'filePath')).toBe(false));
keep the existing function comparison by name intact.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cd8e3770-6d7d-47da-8100-8e5dcc533a89

📥 Commits

Reviewing files that changed from the base of the PR and between d16b059 and fa92a16.

📒 Files selected for processing (8)
  • .github/a2ui-catalog.instructions.md
  • packages/genui/a2ui-catalog-extractor/src/index.ts
  • packages/genui/a2ui-catalog-extractor/test/extractor-functions.test.ts
  • packages/genui/a2ui-catalog-extractor/test/extractor.test.ts
  • packages/genui/server/agent/a2ui-catalog.ts
  • packages/genui/server/agent/a2ui-prompt.ts
  • packages/genui/server/app/a2ui/action/stream/route.ts
  • packages/genui/server/app/a2ui/stream/route.ts
✅ Files skipped from review due to trivial changes (1)
  • .github/a2ui-catalog.instructions.md
🚧 Files skipped from review as they are similar to previous changes (6)
  • packages/genui/server/app/a2ui/stream/route.ts
  • packages/genui/a2ui-catalog-extractor/test/extractor.test.ts
  • packages/genui/server/app/a2ui/action/stream/route.ts
  • packages/genui/server/agent/a2ui-prompt.ts
  • packages/genui/server/agent/a2ui-catalog.ts
  • packages/genui/a2ui-catalog-extractor/src/index.ts

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/genui/server/agent/a2ui-prompt.ts (1)

180-223: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Public sync prompt construction is now a breaking API change.

This change makes the exported sync builder require opts.catalog, while the zero-config path moved to buildA2UISystemPromptAsync(). packages/genui/etc/genui.api.md also reflects the removed eager prompt export, so existing consumers that called buildA2UISystemPrompt() or imported A2UI_SYSTEM_PROMPT will break on upgrade. Please either preserve a compatibility path/deprecation shim or ship this behind an explicit breaking-change release and migration note.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/genui/server/agent/a2ui-prompt.ts` around lines 180 - 223, Restore
backward compatibility by providing the old zero-config sync path: add an
exported A2UI_SYSTEM_PROMPT constant (populated by starting loadBasicCatalog()
at module init and storing the rendered prompt when the promise resolves) and
update buildA2UISystemPrompt to, when called with no opts or no opts.catalog,
return that A2UI_SYSTEM_PROMPT while emitting a deprecation warning; keep
buildA2UISystemPromptAsync as the recommended async path. Reference
buildA2UISystemPrompt, buildA2UISystemPromptAsync, A2UI_SYSTEM_PROMPT,
loadBasicCatalog, and renderCatalogReference/renderCatalogExamples when making
the changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@packages/genui/server/agent/a2ui-prompt.ts`:
- Around line 180-223: Restore backward compatibility by providing the old
zero-config sync path: add an exported A2UI_SYSTEM_PROMPT constant (populated by
starting loadBasicCatalog() at module init and storing the rendered prompt when
the promise resolves) and update buildA2UISystemPrompt to, when called with no
opts or no opts.catalog, return that A2UI_SYSTEM_PROMPT while emitting a
deprecation warning; keep buildA2UISystemPromptAsync as the recommended async
path. Reference buildA2UISystemPrompt, buildA2UISystemPromptAsync,
A2UI_SYSTEM_PROMPT, loadBasicCatalog, and
renderCatalogReference/renderCatalogExamples when making the changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c1586dff-289a-4ed5-a276-c9fa9639e651

📥 Commits

Reviewing files that changed from the base of the PR and between fa92a16 and e048632.

📒 Files selected for processing (3)
  • packages/genui/a2ui-prompt/etc/genui-a2ui-prompt.api.md
  • packages/genui/etc/genui.api.md
  • packages/genui/server/agent/a2ui-prompt.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/genui/a2ui-prompt/etc/genui-a2ui-prompt.api.md

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