Commit 1e8f5d6
feat(a2a): spec-compliant A2A v0.3 implementation (#1)
* docs: add CognitiveVault to Memory Backends and MessageBoard sections in README
* feat(a2a): spec-compliant A2A v0.3 implementation
Rewrites the A2A module to align with the Agent2Agent v0.3 specification.
Server:
- JSON-RPC 2.0 dispatch on single endpoint (replaces REST-style URL routing)
- Agent card at /.well-known/agent-card.json (with legacy path fallback)
- All spec methods: message/send, message/stream, tasks/get, tasks/cancel,
tasks/resubscribe, push notification config CRUD, getAuthenticatedExtendedCard
- SSE streaming with heartbeat and subscriber management
- Authentication middleware support
- contextFactory for wiring real AgentContext into task execution
- Push notifications with Bearer/Basic auth
- Multi-turn via input-required state and task resume
- Proper JSON-RPC error codes (1001-1009)
- CORS support
Client:
- Agent card discovery with canonical + legacy path fallback
- Polling and SSE streaming execution modes
- Multi-turn with onInputRequired callback
- Bearer and API key authentication
- cancelA2ATask helper
- onStreamEvent callback for streaming updates
Types:
- Full spec-compliant type definitions in dedicated types.ts
- AgentCard with kind, protocolVersion, provider, securitySchemes, security
- All Part types: TextPart, FilePart (bytes + uri), DataPart
- All task states: submitted, working, input-required, auth-required,
completed, failed, canceled, rejected
- Artifact schema with id, name, description, parts, metadata
- contextId for conversation grouping
- A2A error codes enum
Agent Card:
- ToAgentCardOptions for provider, security, streaming, push notifications
- Spec-compliant card generation with all optional fields
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(a2a): address review findings — stream leak, timeout, skill routing
- Fix resource leak in client SSE streaming: rewrite recursive .then()
chain as async while loop with reader.cancel() in finally block (#2, #5)
- Add timeout enforcement in server executeTask via Promise.race using
agent.timeoutMs (default 5min), prevents tasks hanging forever (#3)
- Add skillId-based agent resolution: when MessageSendParams includes
skillId, server matches against agent capabilities; returns
UNSUPPORTED_SKILL (1004) error if no match (#4)
- Add test for multi-agent skill routing (correct dispatch + error case)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent c51c2fc commit 1e8f5d6
8 files changed
Lines changed: 1987 additions & 232 deletions
File tree
- src
- a2a
- tests/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | | - | |
341 | | - | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
342 | 362 | | |
343 | 363 | | |
344 | 364 | | |
345 | 365 | | |
346 | 366 | | |
347 | 367 | | |
348 | | - | |
| 368 | + | |
349 | 369 | | |
350 | 370 | | |
351 | 371 | | |
| |||
440 | 460 | | |
441 | 461 | | |
442 | 462 | | |
| 463 | + | |
| 464 | + | |
443 | 465 | | |
444 | 466 | | |
445 | 467 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
| 24 | + | |
21 | 25 | | |
| 26 | + | |
22 | 27 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
36 | | - | |
37 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
38 | 44 | | |
39 | 45 | | |
40 | | - | |
| 46 | + | |
41 | 47 | | |
| 48 | + | |
42 | 49 | | |
43 | | - | |
44 | | - | |
45 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
46 | 53 | | |
47 | 54 | | |
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
52 | 59 | | |
53 | | - | |
54 | | - | |
| 60 | + | |
| 61 | + | |
55 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
56 | 72 | | |
| 73 | + | |
| 74 | + | |
0 commit comments