feat(ag-ui): @cacheplane/ag-ui adapter wrapping @ag-ui/client#139
Merged
Conversation
New @cacheplane/ag-ui package wraps @ag-ui/client AbstractAgent into
the runtime-neutral Agent contract. Scope B: messages + lifecycle +
tool calls + state. toAgent(source) primitive + provideAgUiAgent({url})
DI convenience. Pure-function reducer; conformance test against shared
suite. Cockpit demo proves end-to-end decoupling.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
6 tasks: scaffold @cacheplane/ag-ui lib, pure-function reducer with table-driven spec, toAgent + conformance test, provideAgUiAgent DI convenience, cockpit streaming demo, final verify + PR. Pinned to @ag-ui/client and fast-json-patch (RFC 6902 for StateDelta). Co-Authored-By: Claude Opus 4.7 <[email protected]>
Mirror libs/langgraph/ structure. Stubbed toAgent and provideAgUiAgent will be implemented in subsequent commits. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Implements reduceEvent(event, store) covering RUN_STARTED/FINISHED/ERROR, TEXT_MESSAGE_START/CONTENT/END, TOOL_CALL_START/ARGS/END/RESULT, STATE_SNAPSHOT/DELTA, MESSAGES_SNAPSHOT, and CUSTOM. Discriminates state_update CustomEvents into AgentStateUpdateEvent. Table-driven tests cover every variant. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Subscribes to source via AgentSubscriber.onEvent and reduces every event into the produced Agent's signals. submit() optimistically appends user message to both our signals and source.addMessage(), then calls source.runAgent(). stop() calls source.abortRun(). Conformance suite validates the AG-UI adapter passes the same contract assertions as the LangGraph adapter. Also fixes reducer.ts type casts (as unknown as) required by @ag-ui/client 0.0.52 which uses Zod-inferred BaseEvent types that do not overlap with narrower cast targets without the intermediate unknown step. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Constructs HttpAgent from config and wires it through toAgent into the AG_UI_AGENT injection token. Convenience entry point for the common case; custom transports go through toAgent(customAgent) directly. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Mirrors cockpit/langgraph/streaming/angular/ structure. Demonstrates the chat-runtime decoupling: same <chat> composition, AG-UI runtime instead of LangGraph. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
blove
added a commit
that referenced
this pull request
Jun 9, 2026
* docs: AG-UI adapter design
New @cacheplane/ag-ui package wraps @ag-ui/client AbstractAgent into
the runtime-neutral Agent contract. Scope B: messages + lifecycle +
tool calls + state. toAgent(source) primitive + provideAgUiAgent({url})
DI convenience. Pure-function reducer; conformance test against shared
suite. Cockpit demo proves end-to-end decoupling.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
* docs: AG-UI adapter implementation plan
6 tasks: scaffold @cacheplane/ag-ui lib, pure-function reducer with
table-driven spec, toAgent + conformance test, provideAgUiAgent DI
convenience, cockpit streaming demo, final verify + PR. Pinned to
@ag-ui/client and fast-json-patch (RFC 6902 for StateDelta).
Co-Authored-By: Claude Opus 4.7 <[email protected]>
* feat(ag-ui): scaffold @cacheplane/ag-ui library
Mirror libs/langgraph/ structure. Stubbed toAgent and provideAgUiAgent
will be implemented in subsequent commits.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
* feat(ag-ui): pure-function reducer mapping AG-UI events to Agent signals
Implements reduceEvent(event, store) covering RUN_STARTED/FINISHED/ERROR,
TEXT_MESSAGE_START/CONTENT/END, TOOL_CALL_START/ARGS/END/RESULT,
STATE_SNAPSHOT/DELTA, MESSAGES_SNAPSHOT, and CUSTOM. Discriminates
state_update CustomEvents into AgentStateUpdateEvent. Table-driven tests
cover every variant.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
* feat(ag-ui): toAgent wraps AbstractAgent into Agent contract
Subscribes to source via AgentSubscriber.onEvent and reduces every event
into the produced Agent's signals. submit() optimistically appends user
message to both our signals and source.addMessage(), then calls
source.runAgent(). stop() calls source.abortRun(). Conformance suite
validates the AG-UI adapter passes the same contract assertions as the
LangGraph adapter.
Also fixes reducer.ts type casts (as unknown as) required by @ag-ui/client
0.0.52 which uses Zod-inferred BaseEvent types that do not overlap with
narrower cast targets without the intermediate unknown step.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
* feat(ag-ui): provideAgUiAgent DI convenience for HttpAgent
Constructs HttpAgent from config and wires it through toAgent into the
AG_UI_AGENT injection token. Convenience entry point for the common case;
custom transports go through toAgent(customAgent) directly.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
* feat(cockpit): AG-UI streaming demo using @cacheplane/ag-ui
Mirrors cockpit/langgraph/streaming/angular/ structure. Demonstrates
the chat-runtime decoupling: same <chat> composition, AG-UI runtime
instead of LangGraph.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
---------
Co-authored-by: Claude Opus 4.7 <[email protected]>
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.
Summary
Motivation
Validates the chat-runtime decoupling shipped in #131..#138 by adding a second adapter on a fundamentally different protocol. `@cacheplane/chat` remains independent of both adapters.
Notable adaptations from plan
Test Plan
Design + plan
🤖 Generated with Claude Code