Skip to content

add A2A transport to agent-core - #31

Open
talktogina-developer wants to merge 1 commit into
genspark-ai:mainfrom
talktogina-developer:feat/a2a-transport
Open

add A2A transport to agent-core#31
talktogina-developer wants to merge 1 commit into
genspark-ai:mainfrom
talktogina-developer:feat/a2a-transport

Conversation

@talktogina-developer

Copy link
Copy Markdown

Summary

  • Adds createA2ATransport — an AgentTransport implementation that routes the GenOffice AI panel to any A2A-protocol-compatible remote agent over HTTP SSE (tasks/sendSubscribe)
  • The full conversation context (system prompt + message history) is encoded into a single A2A user message per call; streamed artifact text parts map to onDelta events; cancellation uses AbortController
  • Exports createA2ATransport and A2ATransportOptions from @genoffice/agent-core alongside the existing createIpcTransport

Test plan

  • npm run test -w @genoffice/agent-core — 11 new unit tests (57 total, all pass); covers JSON-RPC wire format, auth/session headers, SSE streaming deltas, status-completion, error paths (HTTP, JSON-RPC, task failed/canceled, network), abort, multi-turn history encoding, and URL normalisation
  • npm run typecheck -w @genoffice/agent-core — clean
  • npm run format:check — clean (Prettier)
  • npm run lint — 0 errors (pre-existing warnings only, none in new files)

Implements `createA2ATransport` — an `AgentTransport` that routes the
GenOffice AI panel to any A2A-protocol-compatible agent over HTTP SSE
(https://github.com/a2aproject/A2A).

The full conversation context (system prompt + message history) is
encoded into a single A2A user message on each `tasks/sendSubscribe`
call; streamed artifact text parts are forwarded as `onDelta` events.
Error paths — HTTP errors, JSON-RPC error objects, task failed/canceled
status, and network failures — all surface via `onError`. Cancellation
aborts the in-flight fetch via `AbortController`.

Exports `createA2ATransport` and `A2ATransportOptions` from the package
root alongside the existing `createIpcTransport`.

11 unit tests cover: correct JSON-RPC wire format, auth/session headers,
SSE streaming deltas, status-completion, error paths, abort, multi-turn
history encoding, and URL normalisation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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