Repository navigation
[iFrame] Add the @a2ui/catalog-iframe package and frame bridge - #2797
josemontespg wants to merge 1 commit into
Conversation
963297d to
88e7b37
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces the @a2ui/catalog-iframe package, which implements the A2UI iframe catalog for web renderers. It includes the sandbox proxy assets, configuration utilities, and the WebAppFrameBridge host-side protocol bridge that manages data model synchronization, allowlist validation, function calls, and frame sizing. Feedback on the changes highlights a correctness bug in DataModelSync where deleted properties or removed array elements are ignored, potentially causing state desynchronization. Additionally, it is recommended to replace the multi-pass string replacements used for unescaping JSON Pointer escape sequences in both payload_validation.ts and fake_frame_host.ts with a single-pass regex to prevent order-of-operations bugs.
88e7b37 to
6ec8017
Compare
695e3fc to
a30511e
Compare
a30511e to
7e497bd
Compare
7e497bd to
86a2e7b
Compare
86a2e7b to
5f1cc69
Compare
5f1cc69 to
ba0153a
Compare
ba0153a to
5988e56
Compare
### Summary `ResolveA2uiProp` turns every prop whose type matches `ActionLike` into a `() => Promise<void>` thunk. Since #2859 added `V1Action` to `ActionLike`, whose function-call variant infers as the weak type `{functionCall?: any}`, every object type matches it, so props declared as `z.record(z.unknown())` (or any `Record<string, ...>`) now resolve to an action thunk instead of their data type. The runtime binder is unaffected (it reads the zod schema), so this is a type-only regression, but it breaks `tsc` for catalogs that read such props, for example the iframe and MCP catalogs in #2797 and #2799. Object types with a string index signature now resolve as data, as before #2859. Props shaped like an action (`{event: ...}`, `{functionCall: ...}`, `V1Action`) still resolve to the thunk. ### Changes * `typescript/web_core/src/resolution/generic-binder.ts`: add `HasStringIndex<T>` and check it inside the `ActionLike` branch of `ResolveA2uiProp` before producing the thunk type. * `typescript/web_core/CHANGELOG.md`: Unreleased entry. ### Verification * `yarn --cwd typescript/web_core test` (842 tests) and `./scripts/fix_format.sh --check` pass locally. * The iframe and MCP catalog packages of the stack above typecheck again with this change.
5988e56 to
ec968bd
Compare
ec968bd to
4dd00a0
Compare
bbf025e to
77599be
Compare
77599be to
a56a4d4
Compare
a56a4d4 to
e08c4d2
Compare
e08c4d2 to
eff4666
Compare
eff4666 to
5dd2e62
Compare
5dd2e62 to
6d7b8c9
Compare
6d7b8c9 to
a802168
Compare
a802168 to
143f826
Compare
143f826 to
4ece69e
Compare
4ece69e to
a79f181
Compare
Summary
Adds the
@a2ui/catalog-iframepackage (typescript/catalogs/iframe/) for the v1.0 iframe catalog, building ontypescript/catalogs/shared/sandbox/to implement the host side of thea2ui_*message protocol (WebAppFrameBridge,payload_validation,messages) and bundle the sandbox proxy intodist/sandbox/. TheWebAppFrameUrlandWebAppFrameSrcdoccomponents follow in #2798.Changes
typescript/catalogs/iframe/: the@a2ui/catalog-iframeworkspace. Copiescatalogs/iframe/catalog.jsonandtypescript/catalogs/shared/intosrc/at build time, bundles the proxy intodist/sandbox/with esbuild, and exportsIFRAME_CATALOG_ID, the sandbox configuration API,FrameHost, andWebAppFrameBridge.typescript/catalogs/iframe/src/bridge/:WebAppFrameBridge,messages.ts, andpayload_validation.tsvalidating actions, data changes, and function calls against the component allowlists and JSON Schemas, with Karma unit tests.typescript/catalogs/iframe/README.md&CHANGELOG.md: documents sandbox asset deployment (/a2ui-sandbox/andconfigureSandbox) and the bridge API.Verification
yarn --cwd typescript/catalogs/iframe test: Karma reports192 SUCCESS.yarn --cwd typescript/catalogs/iframe lint,./scripts/fix_format.sh --check, andpython3 scripts/fix_licenses.py --checkpass.Related to #3157