a2acalling 0.6.73 → 0.6.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.a2a-manifest.json +2 -2
- package/ARCHITECTURE.md +29 -16
- package/CONVENTIONS.md +30 -6
- package/biome.json +27 -0
- package/docs/assessments/2026-02-27-google-a2a-protocol-assessment.md +292 -0
- package/docs/plans/2026-03-01-a2a-68-openclaw-integration-tests.md +676 -0
- package/docs/plans/2026-03-01-a2a-77-invoke-security-tests.md +661 -0
- package/eslint.config.js +16 -0
- package/knip.json +17 -0
- package/package.json +11 -2
- package/scripts/install-openclaw.js +3 -5
- package/src/lib/agent-card.js +111 -0
- package/src/lib/client.js +290 -49
- package/src/lib/conversations.js +2 -0
- package/src/lib/local-request.js +69 -0
- package/src/lib/logger.js +2 -0
- package/src/lib/runtime-adapter.js +41 -1
- package/src/routes/a2a.js +393 -66
- package/src/routes/dashboard.js +1 -27
- package/src/server.js +19 -0
package/.a2a-manifest.json
CHANGED
package/ARCHITECTURE.md
CHANGED
|
@@ -7,14 +7,15 @@ A2A Calling enables agent-to-agent communication across OpenClaw instances. Agen
|
|
|
7
7
|
```
|
|
8
8
|
┌──────────────────────────────────────────────────────────────────┐
|
|
9
9
|
│ CLI (bin/cli.js) │
|
|
10
|
-
│ Commands: create
|
|
10
|
+
│ Commands: create/list/revoke/call + ops commands (quickstart, gui, update, app, skills) │
|
|
11
11
|
└───────────┬──────────────────────────────────────────────────────┘
|
|
12
12
|
│
|
|
13
13
|
┌───────────▼──────────────────────────────────────────────────────┐
|
|
14
14
|
│ Express Server (src/server.js) │
|
|
15
|
-
│ ├─ /api/a2a/*
|
|
16
|
-
│ ├─ /api/callbook/* → src/routes/callbook.js
|
|
17
|
-
│
|
|
15
|
+
│ ├─ /api/a2a/* (invoke/end/message:send/agent-card/tokens/admin) → src/routes/a2a.js │
|
|
16
|
+
│ ├─ /api/a2a/callbook/* + /callbook/* → src/routes/callbook.js │
|
|
17
|
+
│ ├─ /api/a2a/dashboard/* + /dashboard/* → src/routes/dashboard.js │
|
|
18
|
+
│ └─ /.well-known/a2a-agent-card → src/lib/agent-card.js │
|
|
18
19
|
└───────────┬──────────────────────────────────────────────────────┘
|
|
19
20
|
│
|
|
20
21
|
┌───────────▼──────────────────────────────────────────────────────┐
|
|
@@ -26,22 +27,24 @@ A2A Calling enables agent-to-agent communication across OpenClaw instances. Agen
|
|
|
26
27
|
│ ├─ summarizer.js Call summary generation │
|
|
27
28
|
│ ├─ summary-prompt.js Unified summary prompt builder │
|
|
28
29
|
│ ├─ summary-formatter.js Format summaries for display │
|
|
29
|
-
│ ├─ disclosure.js Disclosure
|
|
30
|
+
│ ├─ disclosure.js Disclosure manifest loading + tier merging │
|
|
30
31
|
│ ├─ config.js Config file management │
|
|
31
32
|
│ ├─ crypto.js Ed25519 identity keypair + signing │
|
|
33
|
+
│ ├─ agent-card.js Google A2A Agent Card generation │
|
|
32
34
|
│ ├─ logger.js Structured logger (SQLite + stdout) │
|
|
33
35
|
│ ├─ call-monitor.js Active call monitoring │
|
|
34
36
|
│ ├─ callbook.js Contact/callbook management │
|
|
35
37
|
│ ├─ claude-subagent.js Claude API integration for summaries │
|
|
36
38
|
│ ├─ openclaw-integration.js OpenClaw runtime hooks │
|
|
37
39
|
│ ├─ prompt-template.js Prompt template utilities │
|
|
38
|
-
│ ├─ runtime-adapter.js Runtime mode detection (
|
|
40
|
+
│ ├─ runtime-adapter.js Runtime mode detection (openclaw/claude/test) │
|
|
39
41
|
│ ├─ dashboard-events.js SSE event broadcasting │
|
|
40
42
|
│ ├─ external-ip.js External IP/hostname detection │
|
|
41
43
|
│ ├─ invite-host.js Invite URL construction │
|
|
42
44
|
│ ├─ port-scanner.js Available port detection │
|
|
43
45
|
│ ├─ pid-file.js PID file management │
|
|
44
46
|
│ ├─ turn-timeout.js Conversation turn timeout handling │
|
|
47
|
+
│ ├─ local-request.js Proxy-aware local request detection (A2A-73) │
|
|
45
48
|
│ ├─ update-checker.js Version update detection │
|
|
46
49
|
│ └─ update-manager.js Self-update orchestration │
|
|
47
50
|
└──────────────────────────────────────────────────────────────────┘
|
|
@@ -50,8 +53,10 @@ A2A Calling enables agent-to-agent communication across OpenClaw instances. Agen
|
|
|
50
53
|
## Data Storage
|
|
51
54
|
|
|
52
55
|
- **Tokens**: JSON file at `~/.config/openclaw/a2a.json`
|
|
53
|
-
- **Conversations**: SQLite via `better-sqlite3` at `~/.config/openclaw/a2a-conversations.db`
|
|
54
|
-
- **Logs**: SQLite via `better-sqlite3` at `~/.config/openclaw/a2a-logs.db`
|
|
56
|
+
- **Conversations**: SQLite via `better-sqlite3` at `~/.config/openclaw/a2a-conversations.db` (WAL mode, A2A-71)
|
|
57
|
+
- **Logs**: SQLite via `better-sqlite3` at `~/.config/openclaw/a2a-logs.db` (WAL mode, A2A-71)
|
|
58
|
+
- **Callbook**: SQLite via `better-sqlite3` at `~/.config/openclaw/a2a-callbook.db`
|
|
59
|
+
- **Dashboard Events**: SQLite via `better-sqlite3` at `~/.config/openclaw/a2a-events.db`
|
|
55
60
|
- **Config**: JSON at `~/.config/openclaw/a2a-config.json`
|
|
56
61
|
- **Disclosure**: JSON at `~/.config/openclaw/a2a-disclosure.json`
|
|
57
62
|
|
|
@@ -72,20 +77,20 @@ Three tiers with escalating capabilities:
|
|
|
72
77
|
- **friends**: `context-read`, `calendar.read`, `email.read`, `search`
|
|
73
78
|
- **family**: `context-read`, `calendar`, `email`, `search`, `tools`, `memory`
|
|
74
79
|
|
|
75
|
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
80
|
+
Disclosure policy is manifest-driven (`~/.config/openclaw/a2a-disclosure.json`), not a token/tier `disclosure` field:
|
|
81
|
+
- Per-tier `topics`, `objectives`, and `do_not_discuss` are loaded from the disclosure manifest
|
|
82
|
+
- Global `never_disclose` always applies
|
|
83
|
+
- Tier inheritance is enforced in prompt construction (`friends` includes `public`; `family` includes `friends` + `public`)
|
|
79
84
|
|
|
80
85
|
## Dependencies
|
|
81
86
|
|
|
82
87
|
Only two runtime dependencies (intentionally minimal):
|
|
83
88
|
- `express` — HTTP server and routing
|
|
84
|
-
- `better-sqlite3` — SQLite for conversations and
|
|
89
|
+
- `better-sqlite3` — SQLite for conversations, logs, callbook, and dashboard events
|
|
85
90
|
|
|
86
91
|
## Dashboard
|
|
87
92
|
|
|
88
|
-
Single-page app served from `src/dashboard/public/`. Uses Shoelace web components. Communicates with the API via `/dashboard
|
|
93
|
+
Single-page app served from `src/dashboard/public/`. Uses Shoelace web components. Communicates with the API via `/api/a2a/dashboard/*` routes. UI is served at both `/api/a2a/dashboard/*` and legacy `/dashboard/*` mounts. Includes panels: Contacts, Calls, Permissions, Invites, Logs, Health (E2E test results), and Settings.
|
|
89
94
|
|
|
90
95
|
## Native macOS App
|
|
91
96
|
|
|
@@ -95,6 +100,14 @@ Tauri v2 app at `native/macos/` wrapping the dashboard SPA. Provides native menu
|
|
|
95
100
|
|
|
96
101
|
Ed25519 cryptographic identity for agents. Each instance generates a keypair on first run (stored in config). Outbound calls sign messages; inbound calls verify signatures. Uses Node.js built-in `crypto.sign`/`crypto.verify` — no external dependencies. See `src/lib/crypto.js`.
|
|
97
102
|
|
|
103
|
+
## Google A2A Compatibility
|
|
104
|
+
|
|
105
|
+
Inbound compatibility endpoints are implemented in `src/routes/a2a.js`:
|
|
106
|
+
- `POST /api/a2a/message:send` (Google A2A wire format ingress mapped into internal invoke flow)
|
|
107
|
+
- `GET /api/a2a/agent-card` and `GET /.well-known/a2a-agent-card` (Agent Card discovery via `src/lib/agent-card.js`)
|
|
108
|
+
|
|
109
|
+
Outbound calls auto-detect Google A2A remotes via Agent Card (`GET /.well-known/a2a-agent-card`, cached 5 min with prune-on-access eviction). When detected, `A2AClient.call()` sends via `message:send` format with response translation to the internal `{ response, conversation_id, can_continue }` shape; `end()` returns a synthetic `{ ended: true, summary: null }`. See `src/lib/client.js` (A2A-80).
|
|
110
|
+
|
|
98
111
|
## Testing
|
|
99
112
|
|
|
100
113
|
Zero-dependency test runner at `test/run.js` with custom assert API. Three test tiers:
|
|
@@ -104,8 +117,8 @@ Zero-dependency test runner at `test/run.js` with custom assert API. Three test
|
|
|
104
117
|
|
|
105
118
|
Test profiles at `test/profiles/` represent real personas with distinct permission tiers.
|
|
106
119
|
|
|
107
|
-
E2E test results are persisted to `~/.config/openclaw/
|
|
120
|
+
E2E test results are persisted to `~/.config/openclaw/test-results/` via `test/e2e/persist.js` (timestamped `result-*.json` plus `latest.json`) and surfaced in the dashboard Health tab. The `scripts/run-e2e.sh` orchestrator runs E2E suites and stores results.
|
|
108
121
|
|
|
109
122
|
## Network Resilience
|
|
110
123
|
|
|
111
|
-
The outbound A2A client (`src/lib/client.js`) retries transient network failures (ECONNRESET, ECONNREFUSED, EPIPE, ENOTFOUND, EAI_AGAIN, timeouts) with exponential backoff (0s, 1s, 2s). HTTP 4xx/5xx errors are not retried. All response accumulation is capped at 2MB to prevent OOM from malicious remotes.
|
|
124
|
+
The outbound A2A client (`src/lib/client.js`) retries transient network failures (ECONNRESET, ECONNREFUSED, EPIPE, ENOTFOUND, EAI_AGAIN, timeouts) with exponential backoff (0s, 1s, 2s). HTTP 4xx/5xx errors are not retried. All response accumulation is capped at 2MB to prevent OOM from malicious remotes. These retry and size-cap mechanisms apply equally to Google A2A outbound calls via the same `withRetry()` and `handleSizeCappedResponse()` functions (A2A-80).
|
package/CONVENTIONS.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Logging
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
For runtime/server code under `src/`, use the structured logger from `src/lib/logger.js`. Keep bare `console.log`/`console.error` limited to CLI/setup/test entrypoints (for user-facing terminal output) and the logger sink implementation in `src/lib/logger.js`.
|
|
6
6
|
|
|
7
7
|
```js
|
|
8
8
|
const { createLogger } = require('./logger');
|
|
@@ -46,7 +46,7 @@ Do NOT add new npm dependencies without explicit justification. Use Node.js buil
|
|
|
46
46
|
|
|
47
47
|
## Module Pattern
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Runtime/server modules use CommonJS (`require`/`module.exports`). Each lib file exports a focused API. Large modules export a class (e.g., `TokenStore`, `ConversationStore`, `A2AClient`). Utility modules export functions. Tooling scripts in this repo currently use CommonJS as well; only introduce ESM if a host integration requires it, and keep module style consistent within a file.
|
|
50
50
|
|
|
51
51
|
## Naming
|
|
52
52
|
|
|
@@ -61,10 +61,10 @@ All modules use CommonJS (`require`/`module.exports`). Each lib file exports a f
|
|
|
61
61
|
|
|
62
62
|
- Single-page app in `src/dashboard/public/`
|
|
63
63
|
- Uses Shoelace web components (`<sl-*>` elements)
|
|
64
|
-
- Communicates via fetch to `/dashboard
|
|
64
|
+
- Communicates via fetch to `/api/a2a/dashboard/*` endpoints
|
|
65
65
|
- SSE for real-time updates via `src/lib/dashboard-events.js`
|
|
66
66
|
- Dark theme is the default; uses CSS custom properties for theming
|
|
67
|
-
- Sidebar navigation with
|
|
67
|
+
- Sidebar navigation with panel switching (Contacts, Calls, Permissions, Invites, Logs, Health, Settings)
|
|
68
68
|
- Permissions tab uses tier cards with tool toggles and auto-save
|
|
69
69
|
- Drag-and-drop uses event delegation on stable parent containers (`.perm-sidebar` for sidebar items, zone containers for drop targets) — do NOT bind listeners directly to innerHTML-generated elements (A2A-61)
|
|
70
70
|
|
|
@@ -105,7 +105,13 @@ close() {
|
|
|
105
105
|
|
|
106
106
|
## Permission Tiers
|
|
107
107
|
|
|
108
|
-
Tokens
|
|
108
|
+
Tokens carry a permissions tier (`public`, `friends`, `family`, `custom`). Disclosure policy is manifest-driven via `src/lib/disclosure.js` and tier inheritance in prompt/runtime paths.
|
|
109
|
+
|
|
110
|
+
Do not add new logic that depends on `tier.disclosure` or `token.disclosure` fields; those fields were removed from the core tier/token model.
|
|
111
|
+
|
|
112
|
+
## Local Request Detection (A2A-73)
|
|
113
|
+
|
|
114
|
+
Use `isDirectLocalRequest(req)` from `src/lib/local-request.js` for admin/dashboard local-only checks. This helper validates loopback socket origin, localhost Host header, and absence of proxy-forwarding headers. Do NOT use raw `req.ip` comparison behind reverse proxies. The module also exports `isLoopbackAddress(ip)` for IP-only checks.
|
|
109
115
|
|
|
110
116
|
## Route Hardening (A2A-53)
|
|
111
117
|
|
|
@@ -126,9 +132,27 @@ All data stores implement retention cleanup following the `dashboard-events.js`
|
|
|
126
132
|
- **Config defaults**: `A2AConfig.getRetention()` merges partial config with defaults — never writes defaults to disk
|
|
127
133
|
- **Token grace period**: Expired tokens are kept for 1 hour after expiry (in-flight call protection)
|
|
128
134
|
|
|
135
|
+
## Test Runtime (A2A-66)
|
|
136
|
+
|
|
137
|
+
`A2A_RUNTIME=test` provides a minimal runtime for CI and headless environments:
|
|
138
|
+
- `runTurn()`: if `A2A_AGENT_COMMAND` env var is set, spawns it with `shell: true` and JSON payload on stdin; otherwise echoes the message
|
|
139
|
+
- `summarize()`: returns canned `{ summary, ownerSummary }` — no LLM required
|
|
140
|
+
- `notify()`: no-op (same as claude mode)
|
|
141
|
+
- Non-zero exit from `A2A_AGENT_COMMAND` throws an error with stderr context
|
|
142
|
+
- The CI smoke lane (`a2atesting/a2acalling/scenarios/smoke-lane.js`) uses this mode
|
|
143
|
+
|
|
144
|
+
## In-Memory Map Eviction (A2A-69)
|
|
145
|
+
|
|
146
|
+
For in-memory Maps that accumulate entries over time (e.g., `claudeSessions` in `runtime-adapter.js`), use the prune-on-access pattern:
|
|
147
|
+
- TTL eviction: delete entries older than a configurable threshold (checked via `updatedAt` timestamp)
|
|
148
|
+
- Max-entry eviction: delete oldest entries first when Map exceeds a configurable max size
|
|
149
|
+
- Prune runs at the start of the next operation (not on a timer) — zero overhead when idle
|
|
150
|
+
- Both thresholds configurable via environment variables
|
|
151
|
+
- Refresh `updatedAt` on every access to prevent evicting active entries
|
|
152
|
+
|
|
129
153
|
## Anti-Patterns
|
|
130
154
|
|
|
131
|
-
- Do NOT use `console.log`
|
|
155
|
+
- Do NOT use `console.log` outside the logger sink in `src/lib/logger.js`
|
|
132
156
|
- Do NOT add npm dependencies for things Node.js builtins handle
|
|
133
157
|
- Do NOT create new error classes — use existing patterns
|
|
134
158
|
- Do NOT hardcode config paths — use config resolution
|
package/biome.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.4.4/schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": true,
|
|
5
|
+
"clientKind": "git",
|
|
6
|
+
"useIgnoreFile": true
|
|
7
|
+
},
|
|
8
|
+
"files": {
|
|
9
|
+
"ignoreUnknown": false,
|
|
10
|
+
"includes": ["src/**/*.js"]
|
|
11
|
+
},
|
|
12
|
+
"formatter": {
|
|
13
|
+
"enabled": false
|
|
14
|
+
},
|
|
15
|
+
"linter": {
|
|
16
|
+
"enabled": true,
|
|
17
|
+
"rules": {
|
|
18
|
+
"recommended": true,
|
|
19
|
+
"correctness": {
|
|
20
|
+
"noUnusedVariables": "warn"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"assist": {
|
|
25
|
+
"enabled": false
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# Google A2A Protocol — Adoption & Adaptation Assessment
|
|
2
|
+
|
|
3
|
+
**Ticket:** A2A-75
|
|
4
|
+
**Date:** 2026-02-27
|
|
5
|
+
**Status:** Assessment Complete
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Executive Summary
|
|
10
|
+
|
|
11
|
+
The Google A2A Protocol (a2a-protocol.org) is an open standard for agent-to-agent communication built on JSON-RPC 2.0 with HTTP, gRPC, and SSE bindings. It shares significant conceptual overlap with our A2A Calling protocol — both solve the same fundamental problem of enabling opaque agents to communicate. However, the two protocols diverge substantially in philosophy: Google's spec is enterprise-grade infrastructure (task-oriented, schema-heavy, multi-transport), while ours is relationship-oriented (token-scoped, disclosure-aware, conversation-first).
|
|
12
|
+
|
|
13
|
+
**Recommendation:** Adopt Google A2A as the wire protocol and discovery layer while preserving our permission tiers, disclosure levels, conversation model, and "first meeting" workflow as an extension layer on top. This gives us interoperability with the emerging ecosystem without losing the social trust features that define our product.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 2. Protocol Comparison
|
|
18
|
+
|
|
19
|
+
### 2.1 Core Concepts Mapping
|
|
20
|
+
|
|
21
|
+
| Our Concept | Google A2A Equivalent | Gap Analysis |
|
|
22
|
+
|---|---|---|
|
|
23
|
+
| Token (`fed_xxx`) | SecurityScheme (apiKey / OAuth2 / bearer) | Google is more flexible — supports OAuth2 flows. Our tokens are simpler (bearer only) but richer (tier, disclosure, topics, max_calls). |
|
|
24
|
+
| `POST /invoke` | `a2a.SendMessage` | Direct mapping. Google returns Task or Message; we return response text + `can_continue`. |
|
|
25
|
+
| `conversation_id` | `contextId` | Same concept — group related interactions. Google also has `taskId` for individual work units within a context. |
|
|
26
|
+
| Multi-turn conversation | `input-required` task state | Google models this as task state machine; we model it as conversation continuation with `can_continue`. |
|
|
27
|
+
| `POST /end` | Task reaches terminal state (`completed`/`canceled`) | Google has richer terminal states (failed, rejected, canceled). We have `concluded`/`timeout`. |
|
|
28
|
+
| Permission tiers (public/friends/family) | Agent Card `skills` + OAuth scopes | **No equivalent.** Google has no concept of relationship-based capability gating. This is our key differentiator. |
|
|
29
|
+
| Disclosure levels (public/minimal/none) | **No equivalent** | Google assumes agents share freely. No information-sharing policy model. |
|
|
30
|
+
| `GET /status` | `GET /.well-known/a2a-agent-card` | Google's Agent Card is far richer — declares skills, auth requirements, capabilities, provider info. Our `/status` is minimal. |
|
|
31
|
+
| Token `allowed_topics` | AgentSkill `inputSchema` | Loose mapping. Google uses JSON Schema for skill inputs; we use topic strings. |
|
|
32
|
+
| Owner notifications | Push Notifications (webhooks) | Google's push notifications are for task updates to the *caller*, not owner awareness. Our notifications inform the *agent owner* about incoming calls. |
|
|
33
|
+
| Ed25519 signatures | AgentCardSignature + TLS mutual auth | Google supports card signing. We have per-message Ed25519 signing. |
|
|
34
|
+
| Rate limits (per-token) | API Management layer | Google delegates to infrastructure; we enforce per-token in-app. |
|
|
35
|
+
| Caller context (`caller.name`, `caller.instance`) | Message `role` + metadata | Google messages don't carry caller identity — that's at the transport layer. |
|
|
36
|
+
|
|
37
|
+
### 2.2 What Google A2A Has That We Don't
|
|
38
|
+
|
|
39
|
+
1. **Agent Card / Discovery** — `/.well-known/a2a-agent-card` for automated agent discovery. Declares skills, capabilities, auth requirements. We have nothing comparable.
|
|
40
|
+
2. **Task State Machine** — Seven states (`working`, `completed`, `failed`, `canceled`, `rejected`, `input-required`, `auth-required`) vs. our two (`active`, `concluded`/`timeout`).
|
|
41
|
+
3. **Artifacts** — Structured output objects with MIME types, separate from conversational messages. We only have text responses.
|
|
42
|
+
4. **Streaming** — SSE-based streaming for real-time task updates. We're request/response only.
|
|
43
|
+
5. **gRPC Binding** — For high-performance inter-service communication.
|
|
44
|
+
6. **Extension System** — Versioned, URI-identified extensions for capability expansion.
|
|
45
|
+
7. **OpenTelemetry** — W3C Trace Context propagation for distributed tracing.
|
|
46
|
+
|
|
47
|
+
### 2.3 What We Have That Google A2A Doesn't
|
|
48
|
+
|
|
49
|
+
1. **Permission Tiers** — public/friends/family capability gating based on relationship trust level. This is our core value proposition.
|
|
50
|
+
2. **Disclosure Levels** — public/minimal/none information-sharing policy. Controls *how much* the agent reveals, not just *what* it can do.
|
|
51
|
+
3. **Owner Notifications** — Real-time alerts to the human owner when their agent is called. Google has no concept of human-in-the-loop awareness.
|
|
52
|
+
4. **"First Meeting" Workflow** — Our conversation model is designed for agents meeting for the first time — exploratory, collaborative, with progressive trust building. Google's model is transactional.
|
|
53
|
+
5. **Topic/Goal Scoping** — Per-token `allowed_topics` and `allowed_goals` constrain what a caller can discuss. Google has skill-level access but no per-session topic constraints.
|
|
54
|
+
6. **Token Economics** — `max_calls`, `calls_made`, expiration, revocation — rate-limited trust delegation. Google delegates this to infrastructure.
|
|
55
|
+
7. **Conversation Driver** — Multi-turn orchestration with min/max turns, idle timeout, auto-conclusion, and summary generation. Google leaves conversation management to the implementation.
|
|
56
|
+
8. **Contact Book** — Persistent directory of known agents with metadata, linked tokens, and ping status.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 3. Adoption Strategy
|
|
61
|
+
|
|
62
|
+
### 3.1 Approach: "Google Wire, OpenClaw Soul"
|
|
63
|
+
|
|
64
|
+
Adopt the Google A2A wire protocol (JSON-RPC 2.0, Agent Card, Task model) as the transport layer while preserving our permission, disclosure, and conversation semantics as an extension layer.
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
┌─────────────────────────────────────────────────┐
|
|
68
|
+
│ OpenClaw Extension Layer │
|
|
69
|
+
│ ├─ Permission tiers (public/friends/family) │
|
|
70
|
+
│ ├─ Disclosure levels (public/minimal/none) │
|
|
71
|
+
│ ├─ Owner notifications │
|
|
72
|
+
│ ├─ Token economics (max_calls, expiry) │
|
|
73
|
+
│ ├─ "First meeting" conversation driver │
|
|
74
|
+
│ └─ Contact book + trust history │
|
|
75
|
+
├─────────────────────────────────────────────────┤
|
|
76
|
+
│ Google A2A Protocol (Wire Format) │
|
|
77
|
+
│ ├─ Agent Card (/.well-known/a2a-agent-card) │
|
|
78
|
+
│ ├─ JSON-RPC 2.0 (a2a.SendMessage, etc.) │
|
|
79
|
+
│ ├─ Task state machine │
|
|
80
|
+
│ ├─ Artifacts + Parts │
|
|
81
|
+
│ └─ Streaming (SSE) │
|
|
82
|
+
├─────────────────────────────────────────────────┤
|
|
83
|
+
│ Transport (HTTPS + optional gRPC) │
|
|
84
|
+
└─────────────────────────────────────────────────┘
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3.2 Phase Plan
|
|
88
|
+
|
|
89
|
+
#### Phase 1: Agent Card (Discovery Layer)
|
|
90
|
+
|
|
91
|
+
Serve a Google A2A-compatible Agent Card at `/.well-known/a2a-agent-card`. This is the lowest-cost, highest-value adoption step — it makes our agents discoverable by any A2A-compatible system.
|
|
92
|
+
|
|
93
|
+
**Agent Card contents:**
|
|
94
|
+
- `name`, `description`, `provider` — from `a2a-config.json`
|
|
95
|
+
- `skills` — derived from our disclosure manifest topics
|
|
96
|
+
- `securitySchemes` — declare bearer token auth (our existing `fed_xxx` tokens)
|
|
97
|
+
- `capabilities` — `streaming: false`, `pushNotifications: false` initially
|
|
98
|
+
- `extensions` — declare our custom extension for permission tiers and disclosure
|
|
99
|
+
|
|
100
|
+
**OpenClaw Extension in Agent Card:**
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"extensions": [
|
|
104
|
+
{
|
|
105
|
+
"uri": "https://openclaw.dev/a2a/extensions/trust-tiers",
|
|
106
|
+
"version": "1.0.0",
|
|
107
|
+
"required": false,
|
|
108
|
+
"data": {
|
|
109
|
+
"tiers": ["public", "friends", "family"],
|
|
110
|
+
"disclosure_levels": ["public", "minimal", "none"],
|
|
111
|
+
"owner_notifications": true,
|
|
112
|
+
"contact_book": true
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### Phase 2: Dual-Protocol Inbound
|
|
120
|
+
|
|
121
|
+
Accept both our current `POST /api/a2a/invoke` format AND the Google A2A `a2a.SendMessage` JSON-RPC format on a new `POST /api/a2a/rpc` endpoint.
|
|
122
|
+
|
|
123
|
+
**Mapping:**
|
|
124
|
+
- Google `a2a.SendMessage` → our `invoke` handler
|
|
125
|
+
- Google `contextId` → our `conversation_id`
|
|
126
|
+
- Google `input-required` → our `can_continue: true`
|
|
127
|
+
- Google `completed` → our conversation conclusion
|
|
128
|
+
- Message `parts[].text` → our `message` string
|
|
129
|
+
- Task `artifacts` → (new) structured response attachments
|
|
130
|
+
|
|
131
|
+
**Token auth unchanged:** Google callers still need a valid `fed_xxx` bearer token. The token's tier and disclosure settings apply regardless of wire format.
|
|
132
|
+
|
|
133
|
+
#### Phase 3: Dual-Protocol Outbound
|
|
134
|
+
|
|
135
|
+
Update `A2AClient` to detect whether a remote agent serves a Google A2A Agent Card. If so, use `a2a.SendMessage` JSON-RPC format; otherwise, fall back to our current `POST /invoke`.
|
|
136
|
+
|
|
137
|
+
**Detection:**
|
|
138
|
+
1. `GET /.well-known/a2a-agent-card` — if 200 with valid card, use Google format
|
|
139
|
+
2. `GET /api/a2a/status` — if 200 with `"a2a": true`, use our format
|
|
140
|
+
3. Fall back to our format as default
|
|
141
|
+
|
|
142
|
+
#### Phase 4: Task State Machine
|
|
143
|
+
|
|
144
|
+
Adopt the Google task state machine internally, mapping to our conversation states:
|
|
145
|
+
|
|
146
|
+
| Google Task State | Our Current State | Migration |
|
|
147
|
+
|---|---|---|
|
|
148
|
+
| `working` | `active` | Direct mapping |
|
|
149
|
+
| `completed` | `concluded` | Direct mapping |
|
|
150
|
+
| `failed` | (new) | Add `failed` status to conversations |
|
|
151
|
+
| `canceled` | (new) | Add `canceled` status |
|
|
152
|
+
| `rejected` | (implicit — 403 response) | Formalize as conversation state |
|
|
153
|
+
| `input-required` | `active` + `can_continue: true` | Already modeled, just need state label |
|
|
154
|
+
| `auth-required` | (new) | Add for re-auth scenarios |
|
|
155
|
+
|
|
156
|
+
#### Phase 5: Streaming & Artifacts
|
|
157
|
+
|
|
158
|
+
Add SSE streaming support for long-running responses and artifact support for structured outputs. This is the most complex phase and can be deferred until there's ecosystem demand.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## 4. Preserving Our Differentiators
|
|
163
|
+
|
|
164
|
+
### 4.1 Permission Tiers as Extension
|
|
165
|
+
|
|
166
|
+
Google A2A has no concept of relationship-based trust. Our tiers are modeled as an extension that enriches the standard auth flow:
|
|
167
|
+
|
|
168
|
+
1. Standard Google A2A: client authenticates → agent processes request
|
|
169
|
+
2. Our extension: client authenticates → **token tier determines capabilities** → **disclosure level constrains responses** → agent processes within scope
|
|
170
|
+
|
|
171
|
+
This is transparent to Google-only callers — they authenticate normally and get `public` tier behavior by default. Callers that understand our extension can negotiate higher trust levels.
|
|
172
|
+
|
|
173
|
+
### 4.2 "First Meeting" Conversation Model
|
|
174
|
+
|
|
175
|
+
Google A2A's `a2a.SendMessage` is transactional — send a message, get a response. Our "first meeting" model is exploratory:
|
|
176
|
+
|
|
177
|
+
1. Agents introduce themselves (caller context)
|
|
178
|
+
2. Progressive topic exploration within allowed bounds
|
|
179
|
+
3. Collaborative discovery of shared interests
|
|
180
|
+
4. Trust building over multiple turns
|
|
181
|
+
5. Summary generation at conclusion
|
|
182
|
+
|
|
183
|
+
This maps cleanly onto Google's `contextId` + `input-required` pattern. The conversation driver orchestrates the multi-turn flow while the wire format is standard A2A.
|
|
184
|
+
|
|
185
|
+
### 4.3 Owner Awareness
|
|
186
|
+
|
|
187
|
+
Google A2A has push notifications for the *caller* to track task progress. We add owner notifications — the *callee's human* is informed about incoming calls. This is orthogonal to the protocol and requires no wire format changes. It remains a server-side feature.
|
|
188
|
+
|
|
189
|
+
### 4.4 Contact Book & Trust History
|
|
190
|
+
|
|
191
|
+
The contact book (persistent directory of known agents) is a local-only feature with no wire format implications. We can enhance it with Agent Card data — when we discover a remote agent's card, we can auto-populate contact metadata.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 5. Migration Risks
|
|
196
|
+
|
|
197
|
+
### 5.1 Low Risk
|
|
198
|
+
- **Agent Card adoption** — additive, no breaking changes
|
|
199
|
+
- **Dual-protocol inbound** — new endpoint, existing endpoint unchanged
|
|
200
|
+
- **Contact book enrichment** — local-only enhancement
|
|
201
|
+
|
|
202
|
+
### 5.2 Medium Risk
|
|
203
|
+
- **Outbound protocol detection** — need robust fallback when remote agents serve partial or malformed Agent Cards
|
|
204
|
+
- **Task state machine migration** — our conversation store schema needs new states; existing conversations need migration
|
|
205
|
+
- **Response format change** — moving from flat `{ response: "..." }` to `{ parts: [...], artifacts: [...] }` requires dashboard and CLI updates
|
|
206
|
+
|
|
207
|
+
### 5.3 High Risk
|
|
208
|
+
- **Streaming** — fundamentally changes the response model from request/response to event stream. Requires significant changes to the conversation driver, dashboard, and CLI.
|
|
209
|
+
- **gRPC binding** — would add a substantial dependency. Recommend deferring unless ecosystem demand materializes.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## 6. Specification: OpenClaw Trust Tiers Extension
|
|
214
|
+
|
|
215
|
+
### 6.1 Extension URI
|
|
216
|
+
|
|
217
|
+
`https://openclaw.dev/a2a/extensions/trust-tiers`
|
|
218
|
+
|
|
219
|
+
### 6.2 Extension Data in Agent Card
|
|
220
|
+
|
|
221
|
+
```json
|
|
222
|
+
{
|
|
223
|
+
"uri": "https://openclaw.dev/a2a/extensions/trust-tiers",
|
|
224
|
+
"version": "1.0.0",
|
|
225
|
+
"required": false,
|
|
226
|
+
"data": {
|
|
227
|
+
"tiers": ["public", "friends", "family"],
|
|
228
|
+
"default_tier": "public",
|
|
229
|
+
"disclosure_levels": ["public", "minimal", "none"],
|
|
230
|
+
"default_disclosure": "minimal",
|
|
231
|
+
"supports_topics": true,
|
|
232
|
+
"supports_goals": true,
|
|
233
|
+
"owner_notifications": true,
|
|
234
|
+
"max_calls_enforced": true
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### 6.3 Extension Headers
|
|
240
|
+
|
|
241
|
+
Callers that understand the extension can include:
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
X-OpenClaw-Tier-Request: friends
|
|
245
|
+
X-OpenClaw-Disclosure-Preference: public
|
|
246
|
+
X-OpenClaw-Caller-Context: {"name": "Alice", "instance": "alice.example.com", "reason": "Collaboration request"}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
The server validates these against the token's actual tier — a `public` token cannot request `friends` tier access.
|
|
250
|
+
|
|
251
|
+
### 6.4 Extension Response Metadata
|
|
252
|
+
|
|
253
|
+
```json
|
|
254
|
+
{
|
|
255
|
+
"metadata": {
|
|
256
|
+
"openclaw:tier": "friends",
|
|
257
|
+
"openclaw:disclosure": "minimal",
|
|
258
|
+
"openclaw:topics_allowed": ["chat", "search"],
|
|
259
|
+
"openclaw:calls_remaining": 95,
|
|
260
|
+
"openclaw:token_expires": "2026-03-06T17:54:00Z"
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## 7. Implementation Priority
|
|
268
|
+
|
|
269
|
+
| Priority | Item | Effort | Value |
|
|
270
|
+
|---|---|---|---|
|
|
271
|
+
| **P0** | Agent Card at `/.well-known/a2a-agent-card` | Small | High — instant ecosystem visibility |
|
|
272
|
+
| **P1** | Dual-protocol inbound (`POST /api/a2a/rpc`) | Medium | High — accept calls from any A2A agent |
|
|
273
|
+
| **P2** | Outbound protocol detection + Google format | Medium | Medium — call any A2A agent |
|
|
274
|
+
| **P3** | Task state machine adoption | Medium | Medium — richer conversation lifecycle |
|
|
275
|
+
| **P4** | Trust Tiers extension spec (formal) | Small | Medium — standardize our differentiator |
|
|
276
|
+
| **P5** | Streaming support (SSE) | Large | Low — defer until ecosystem demand |
|
|
277
|
+
| **P6** | Artifact support | Medium | Low — our use case is conversational |
|
|
278
|
+
| **P7** | gRPC binding | Large | Low — defer indefinitely |
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## 8. Conclusion
|
|
283
|
+
|
|
284
|
+
The Google A2A Protocol and our A2A Calling protocol are complementary, not competing. Google provides the infrastructure layer (discovery, wire format, task management, enterprise features) while we provide the social layer (trust tiers, disclosure, owner awareness, relationship management).
|
|
285
|
+
|
|
286
|
+
By adopting Google A2A as the wire protocol and extending it with our trust model, we get:
|
|
287
|
+
- **Interoperability** with the broader A2A ecosystem (any Google A2A-compatible agent can call us)
|
|
288
|
+
- **Preservation** of our unique features (permission tiers, disclosure, first-meeting workflow)
|
|
289
|
+
- **Credibility** from aligning with an industry standard
|
|
290
|
+
- **Future-proofing** as the ecosystem grows (streaming, artifacts, gRPC — all available when needed)
|
|
291
|
+
|
|
292
|
+
The key architectural principle: **Google A2A is the envelope; OpenClaw is the letter inside.**
|