@aihu/agent-a2a
v1.0.2
Published
A2A (Agent2Agent) protocol bindings (spec v1.0.1, JSON-RPC) for @aihu/agent-service.
Readme
@aihu/agent-a2a
Aihu — agentic discovery and interaction, for human purpose.
A2A (Agent2Agent) protocol bindings (spec v1.0.1, JSON-RPC) for @aihu/agent-service.
Part of the agent surface layer of Aihu. Every Aihu component exposes its agent surface via the @agent block; this package implements one slice of the dispatch + protocol surface that connects @agent actions to live runtime signals (per the Live-Binding RFC).
Implements the Agent2Agent (A2A) Protocol Specification v1.0.1, JSON-RPC 2.0 binding. mountA2aAdapter(service, options?) wraps an AgentService with two routes:
| Method | Path | Description |
|---|---|---|
| GET | {prefix}/.well-known/agent-card.json | Agent card (spec §4.4.1) — supportedInterfaces, capabilities, skills |
| POST | {prefix}/a2a | JSON-RPC 2.0 endpoint — SendMessage, SendStreamingMessage (SSE), GetTask, ListTasks, CancelTask, SubscribeToTask, GetExtendedAgentCard |
Skill addressing: every aihu action is exposed as an A2A skill with id "<tag>/<action>". A Message invokes one with a data part — { "data": { "skill": "x-counter/increment", "params": { … } } } — or a text part whose text is the skill id (params then come from the first data part, if any).
Tasks: results are persisted to a TaskStore (in-memory by default, injectable via options.taskStore), so GetTask/ListTasks/CancelTask are real. The gate's verdict maps onto task state: 401 AUTH_REQUIRED → TASK_STATE_AUTH_REQUIRED (resumable by re-sending with message.taskId and credentials), 403 SCOPE_DENIED → TASK_STATE_REJECTED; the full gate envelope rides in a status-message data part for audit.
Attribution (thesis §4 tier 0): pass options.resolveAuth to derive a RequestContext per request; absent or throwing resolvers degrade to an explicit anonymous context, which still fails closed on scoped bindings.
⚠ v0.1.x wire is gone (semver-major): the pre-v0.2 REST paths (/a2a/tasks/send, /a2a/tasks/sendSubscribe, /.well-known/agent.json), the "tag/action" string-message hack, and the [DONE] streaming sentinel are all removed in favor of the spec wire above.
Install
npm install @aihu/agent-a2a
# or
bun add @aihu/agent-a2aAuto-generated against @aihu/[email protected].
Package facts
| | |
|---|---|
| Version | 1.0.2 |
| Tier | C — Agent surface — A2A (Agent2Agent) protocol, spec v1.0.1 JSON-RPC binding |
| Bundle size | 2.62 kB (gz) — limit 3000 B |
| Published files | 3 entries |
| License | MIT |
Auto-generated against @aihu/[email protected].
Exports
| Subpath | ESM | CJS |
|---|---|---|
| . | ./dist/index.js | — |
Auto-generated against @aihu/[email protected].
Dependencies
Dependencies:
@aihu/agent-service—workspace:*
Auto-generated against @aihu/[email protected].
See also
Auto-generated against @aihu/[email protected].
License
MIT — see LICENSE.
Auto-generated against @aihu/[email protected].
