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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
Mirror libs/langgraph/ structure. Stubbed toAgent and provideAgUiAgent will be implemented in subsequent commits. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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