Skip to content

feat(ag-ui): injectAgent() returns AgUiAgent (no cast for customEvents)#648

Merged
blove merged 1 commit into
mainfrom
ag-ui-inject-agent-return-type
Jun 9, 2026
Merged

feat(ag-ui): injectAgent() returns AgUiAgent (no cast for customEvents)#648
blove merged 1 commit into
mainfrom
ag-ui-inject-agent-return-type

Conversation

@blove

@blove blove commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

injectAgent() was typed as the neutral Agent, so reaching the AG-UI-specific customEvents signal required a cast (injectAgent() as AgUiAgent) — awkward for the feature the custom-events guide promotes.

Both provideAgent and provideFakeAgent register toAgent(...) (always an AgUiAgent) under the AGENT token, so this is sound: widen the AGENT token + injectAgent() return type from AgentAgUiAgent. customEvents is now reachable directly.

  • libs/ag-ui/src/lib/provide-agent.ts: token + return type → AgUiAgent.
  • Drop the cast from the custom-events guide and the injectAgent API page.
  • Regen ag-ui/api/api-docs.json (injectAgent(): AgUiAgent).

Backward compatible (AgUiAgent extends Agent). No version bump — libs version in lockstep, bumped by the release process. nx lint ag-ui + nx test ag-ui green locally.

Test Plan

  • CI Library job: nx lint/test/build ag-ui green.
  • CI Website job: nx lint, api-docs no-drift, nx build website green.

🤖 Generated with Claude Code

… cast

Both provideAgent and provideFakeAgent register toAgent(...) (always an
AgUiAgent) under the AGENT token, so widen the token + injectAgent() return
type from Agent to AgUiAgent. customEvents is now reachable directly; drop the
cast from the custom-events guide + injectAgent API page and regen api-docs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
threadplane Ready Ready Preview, Comment Jun 9, 2026 8:20pm

Request Review

@blove blove enabled auto-merge (squash) June 9, 2026 20:19
@blove blove merged commit 32f66f9 into main Jun 9, 2026
19 checks passed
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