[Blazor] Add Components.AI client tool rendering - #68325
Open
javiercn wants to merge 4 commits into
Open
Conversation
Register browser-owned functions as declaration-only chat tools and map matching model calls into UIActionBlock instances that custom Blazor renderers can invoke exactly once. The product remains provider-neutral and does not expose executable client functions to the server transport. Continue the same conversation turn after every client action completes by sending one tool-result message back through IChatClient. AwaitingInput and Streaming transitions make the pause observable while preserving tool-name matching and per-agent action isolation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 323b0ef8-7905-4041-8388-a08586c0bd34
Register the canonical change_background declaration in the Agentic Chat UI and render its UIActionBlock with a circuit-local auto-invoker. The action updates only the owning Blazor circuit and returns a tool result so the agent can continue with confirmation text. Teach the credential-free API model to request the same sunset-gradient action and confirm its result. DojoClient still reaches AGUIDojoApi through AGUI.Client 0.0.5 over HTTP/SSE, with no in-process model shortcut. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 323b0ef8-7905-4041-8388-a08586c0bd34
Cover ordinal tool-name matching, declaration-only registration, preservation of configured tools, single invocation, AwaitingInput transitions, and exactly one continuation result in focused product tests. Extend API-side replay to validate tool declarations and continuation results, then exercise change_background through the real dual-host AG-UI transport. The browser coverage verifies the action completes with confirmation text and cannot mutate a second Blazor circuit; its generated recording remains separate. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 323b0ef8-7905-4041-8388-a08586c0bd34
Record the declaration-validated change_background call and the single-result continuation used by the Agentic Chat client-tool browser tests. Replay still replaces only the API model, leaving AGUI.Server, HTTP/SSE, AGUI.Client, and the Blazor circuit action on the real path. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 323b0ef8-7905-4041-8388-a08586c0bd34
javiercn
force-pushed
the
javiercn-components-ai-03-client-tools
branch
from
August 11, 2026 06:54
48be083 to
0c83d0c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Position 3 in native stack #68340, this layer depends on #68324 and adds browser-owned tool execution to the chat/rich-text foundation. Across four commits and 17 files, it introduces a provider-neutral client-action contract, continues the same conversation after the browser returns a tool result, and lights up the canonical Agentic Chat
change_backgroundaction. The cross-cutting constraint is that executable client functions stay inside the Blazor circuit: the model receives declarations only, while DojoClient still reaches AGUIDojoApi through AGUI.Client 0.0.5, HTTP/SSE, and AGUI.Server 0.0.5.Design
The action name dictionary uses ordinal matching, so
change_backgroundis claimed whileCHANGE_BACKGROUNDremains unhandled; this avoids accidentally dispatching a different tool. Registered actions are added to clonedChatOptionswithAsDeclarationOnly(), preserving any existing server tools without exposing browser closures to the API. All client actions share this one contract and handler pattern;change_backgroundis the representative canonical use rather than a special-purpose product API.Implementation
The deterministic browser fixture replaces only the API's underlying model client. Its recording asserts the
change_backgrounddeclaration on the first request and exactly one matching tool-result call ID on the continuation; AGUI.Server serialization, HTTP/SSE transport, AGUI.Client parsing, product mapping, and Blazor invocation remain real. Test cases are compressed into two equivalence classes: product tests cover registration/matching/single execution/continuation, while browser tests cover visible completion and isolation between two circuits.Outcome
Streaming → AwaitingInput → Streaming → Idle, and resume with one correlated result.change_backgroundupdates the owning circuit, streams confirmation text after the continuation, and leaves a second circuit unchanged.Review guidance: read the declaration-only option construction, exact-name handler,
UIActionBlocksingle-invocation gate, andAgentContextcontinuation loop closely. The action styling and generated recording need only a spot-check for scenario identity and sensitive-data absence.Acceptance criteria: one circuit changes only its own background; the model receives the declared
change_backgroundtool and exactly one result with the original call ID; confirmation text arrives after that continuation.Validation: dependency-aware build 0 warnings / 0 errors;
AgentContextUIActionTests4/4 passed;AgenticChatScenarioTests5/5 passed.