Port Angular Restaurant Sample to 0.9 and Stabilize Tests#1189
Port Angular Restaurant Sample to 0.9 and Stabilize Tests#1189josemontespg merged 10 commits intogoogle:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request migrates the Angular renderer and the restaurant finder sample to version 0.9. Key updates include the implementation of reactive property updates and weight support in ComponentHostComponent, the addition of stable change detection in ListComponent, and a specialized path resolution logic in DataContext. The restaurant finder agent was also updated with a monkey patch for ADK compatibility and refined LLM instructions. Feedback focuses on ensuring the weight signal is updated during property changes, improving type safety by replacing any with specific models, addressing the impact of the new path resolution logic on global state access, and correcting the action handling in the client to ensure the backend receives the expected event format.
| private resolvePath(path: string): string { | ||
| if (path.startsWith('/')) { | ||
| return path; | ||
| } | ||
| if (path === '' || path === '.') { | ||
| // In A2UI v0.9, all paths generated by the prompt-first LLM must begin with a leading `/` | ||
| // to satisfy RFC 6901 JSON Pointer validation. | ||
| // Thus, paths like `/imageUrl` are effectively relative to this DataContext. | ||
| let relPath = path.startsWith('/') ? path.substring(1) : path; |
There was a problem hiding this comment.
This change to resolvePath effectively disables absolute path resolution (paths starting with /) by treating them as relative to the current DataContext. While the comment explains this is to accommodate LLM behavior in v0.9, it breaks standard JSON Pointer expectations and prevents components from accessing global state outside their nested scope. This might lead to issues if a component genuinely needs to reference data at the root of the model.
There was a problem hiding this comment.
I'm not sure about this one. @jacobsimionato is the assumption in code here correct?
jacobsimionato
left a comment
There was a problem hiding this comment.
Wow, you worked through a lot of issues to get this running. Thank you so much for going on the journey - looks great and will really help our users figure out how to use A2UI!
Let's sync about the relative/absolute path thing tomorrow!
|
@josemontespg I landed the styling changes for angular. You could potentially rebase this PR and apply this stylesheet to make the sample look more like the Lit one? And see what I ended up messing up in the Angular theming :P |
This PR got big enough already. Created #1200 to track this work |
…d is no longer needed
26d74e1 to
7df12f8
Compare
jacobsimionato
left a comment
There was a problem hiding this comment.
Nice work, @josemontespg !!
| private processParts(parts: any[]): Types.ServerToClientMessage[] { | ||
| const messages: Types.ServerToClientMessage[] = []; | ||
| for (const item of parts) { | ||
| if (item.kind === 'text') continue; |
There was a problem hiding this comment.
Ha, this looks way better
This PR ports the Angular restaurant sample app to version 0.9.
Credits to @gspencergoog for the first port attempt in #1101, I reused most of his work to create this PR.
Key Changes
ComponentHostComponentto handle property updates reactively using Angular Signals.renderers/angularto use the realComponentBinderservice and formalComponentModelinstances instead of object-literal mocks.data-context.Fixes #701
Screenshots