@aramisfa/openclaw-a2a-outbound 1.0.0 → 3.0.0

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.
Files changed (40) hide show
  1. package/README.md +445 -41
  2. package/dist/capability-diagnostics.d.ts +13 -0
  3. package/dist/capability-diagnostics.d.ts.map +1 -0
  4. package/dist/capability-diagnostics.js +131 -0
  5. package/dist/capability-diagnostics.js.map +1 -0
  6. package/dist/errors.d.ts +1 -0
  7. package/dist/errors.d.ts.map +1 -1
  8. package/dist/errors.js +1 -0
  9. package/dist/errors.js.map +1 -1
  10. package/dist/request-normalization.d.ts +4 -10
  11. package/dist/request-normalization.d.ts.map +1 -1
  12. package/dist/request-normalization.js +83 -47
  13. package/dist/request-normalization.js.map +1 -1
  14. package/dist/result-shape.d.ts +66 -15
  15. package/dist/result-shape.d.ts.map +1 -1
  16. package/dist/result-shape.js +333 -85
  17. package/dist/result-shape.js.map +1 -1
  18. package/dist/schemas.d.ts +54 -5
  19. package/dist/schemas.d.ts.map +1 -1
  20. package/dist/schemas.js +275 -23
  21. package/dist/schemas.js.map +1 -1
  22. package/dist/sdk-client-pool.d.ts +0 -2
  23. package/dist/sdk-client-pool.d.ts.map +1 -1
  24. package/dist/sdk-client-pool.js +2 -22
  25. package/dist/sdk-client-pool.js.map +1 -1
  26. package/dist/service.d.ts +5 -2
  27. package/dist/service.d.ts.map +1 -1
  28. package/dist/service.js +411 -79
  29. package/dist/service.js.map +1 -1
  30. package/dist/target-catalog.d.ts +27 -5
  31. package/dist/target-catalog.d.ts.map +1 -1
  32. package/dist/target-catalog.js +164 -58
  33. package/dist/target-catalog.js.map +1 -1
  34. package/dist/task-handle-registry.d.ts +3 -2
  35. package/dist/task-handle-registry.d.ts.map +1 -1
  36. package/dist/task-handle-registry.js +37 -5
  37. package/dist/task-handle-registry.js.map +1 -1
  38. package/openclaw.plugin.json +42 -12
  39. package/package.json +10 -11
  40. package/skills/remote-agent/SKILL.md +85 -12
@@ -1,5 +1,13 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { A2AOutboundError, ERROR_CODES, } from "./errors.js";
3
+ function continuationTargetFromResolvedTarget(target) {
4
+ return {
5
+ target_url: target.baseUrl,
6
+ card_path: target.cardPath,
7
+ preferred_transports: [...target.preferredTransports],
8
+ ...(target.alias !== undefined ? { target_alias: target.alias } : {}),
9
+ };
10
+ }
3
11
  function cloneTarget(target) {
4
12
  return {
5
13
  baseUrl: target.baseUrl,
@@ -22,6 +30,7 @@ function cloneRecord(record) {
22
30
  taskHandle: record.taskHandle,
23
31
  target: cloneTarget(record.target),
24
32
  taskId: record.taskId,
33
+ ...(record.contextId !== undefined ? { contextId: record.contextId } : {}),
25
34
  createdAt: record.createdAt,
26
35
  lastAccessedAt: record.lastAccessedAt,
27
36
  expiresAt: record.expiresAt,
@@ -40,11 +49,28 @@ function unknownTaskHandleError(taskHandle) {
40
49
  suggested_action: "send",
41
50
  }));
42
51
  }
43
- function expiredTaskHandleError(taskHandle, expiresAt) {
44
- return new A2AOutboundError(ERROR_CODES.EXPIRED_TASK_HANDLE, `task handle "${taskHandle}" has expired`, recoveryDetails(taskHandle, {
45
- expiresAt,
52
+ function expiredTaskHandleError(record) {
53
+ return new A2AOutboundError(ERROR_CODES.EXPIRED_TASK_HANDLE, `task handle "${record.taskHandle}" has expired`, recoveryDetails(record.taskHandle, {
54
+ expiresAt: record.expiresAt,
55
+ task_id: record.taskId,
56
+ ...(record.contextId !== undefined
57
+ ? { context_id: record.contextId }
58
+ : {}),
59
+ continuation: {
60
+ target: continuationTargetFromResolvedTarget(record.target),
61
+ task: {
62
+ task_id: record.taskId,
63
+ },
64
+ ...(record.contextId !== undefined
65
+ ? {
66
+ conversation: {
67
+ context_id: record.contextId,
68
+ },
69
+ }
70
+ : {}),
71
+ },
46
72
  suggested_actions: ["status", "send"],
47
- hint: "Retry with target_alias + task_id, or send a new request.",
73
+ hint: "Retry with the persisted continuation, or resend the original request after a restart to obtain a new handle.",
48
74
  }));
49
75
  }
50
76
  export class TaskHandleRegistry {
@@ -64,6 +90,7 @@ export class TaskHandleRegistry {
64
90
  taskHandle: `rah_${randomUUID()}`,
65
91
  target: cloneTarget(input.target),
66
92
  taskId: input.taskId,
93
+ ...(input.contextId !== undefined ? { contextId: input.contextId } : {}),
67
94
  createdAt: now,
68
95
  lastAccessedAt: now,
69
96
  expiresAt: now + this.ttlMs,
@@ -90,6 +117,11 @@ export class TaskHandleRegistry {
90
117
  taskHandle: entry.taskHandle,
91
118
  target: cloneTarget(input.target ?? entry.target),
92
119
  taskId: input.taskId ?? entry.taskId,
120
+ ...(input.contextId !== undefined
121
+ ? { contextId: input.contextId }
122
+ : entry.contextId !== undefined
123
+ ? { contextId: entry.contextId }
124
+ : {}),
93
125
  createdAt: entry.createdAt,
94
126
  lastAccessedAt: now,
95
127
  expiresAt: now + this.ttlMs,
@@ -103,7 +135,7 @@ export class TaskHandleRegistry {
103
135
  const wasExpired = existing !== undefined && existing.expiresAt <= now;
104
136
  this.pruneExpired(now);
105
137
  if (wasExpired && existing) {
106
- throw expiredTaskHandleError(taskHandle, existing.expiresAt);
138
+ throw expiredTaskHandleError(existing);
107
139
  }
108
140
  const live = this.entries.get(taskHandle);
109
141
  if (!live) {
@@ -1 +1 @@
1
- {"version":3,"file":"task-handle-registry.js","sourceRoot":"","sources":["../src/task-handle-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,gBAAgB,EAChB,WAAW,GACZ,MAAM,aAAa,CAAC;AAkBrB,SAAS,WAAW,CAAC,MAAsB;IACzC,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,mBAAmB,EAAE,CAAC,GAAG,MAAM,CAAC,mBAAmB,CAAC;QACpD,GAAG,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KA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C,CAAC;QACH,CAAC;IACH,CAAC;IAEO,sBAAsB;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YAC3C,IAAI,eAAmC,CAAC;YACxC,IAAI,YAAY,GAAG,MAAM,CAAC,iBAAiB,CAAC;YAE5C,KAAK,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBAC/C,IAAI,KAAK,CAAC,cAAc,GAAG,YAAY,EAAE,CAAC;oBACxC,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC;oBACpC,eAAe,GAAG,UAAU,CAAC;gBAC/B,CAAC;YACH,CAAC;YAED,IAAI,CAAC,eAAe,EAAE,CAAC;gBACrB,OAAO;YACT,CAAC;YAED,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;CACF;AAED,MAAM,UAAU,wBAAwB,CACtC,OAAkC;IAElC,OAAO,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC"}
@@ -1,15 +1,20 @@
1
1
  {
2
2
  "id": "openclaw-a2a-outbound",
3
3
  "name": "External A2A Delegation",
4
- "version": "1.0.0",
4
+ "version": "3.0.0",
5
5
  "entry": "./dist/index.js",
6
6
  "description": "Delegate requests to external A2A agents and manage delegated tasks.",
7
- "skills": ["./skills"],
7
+ "skills": [
8
+ "./skills"
9
+ ],
8
10
  "configSchema": {
9
11
  "type": "object",
10
12
  "additionalProperties": false,
11
13
  "properties": {
12
- "enabled": { "type": "boolean", "default": false },
14
+ "enabled": {
15
+ "type": "boolean",
16
+ "default": false
17
+ },
13
18
  "defaults": {
14
19
  "type": "object",
15
20
  "additionalProperties": false,
@@ -27,13 +32,22 @@
27
32
  "type": "array",
28
33
  "items": {
29
34
  "type": "string",
30
- "enum": ["JSONRPC", "HTTP+JSON", "GRPC"]
35
+ "enum": [
36
+ "JSONRPC",
37
+ "HTTP+JSON",
38
+ "GRPC"
39
+ ]
31
40
  },
32
- "default": ["JSONRPC", "HTTP+JSON"]
41
+ "default": [
42
+ "JSONRPC",
43
+ "HTTP+JSON"
44
+ ]
33
45
  },
34
46
  "serviceParameters": {
35
47
  "type": "object",
36
- "additionalProperties": { "type": "string" },
48
+ "additionalProperties": {
49
+ "type": "string"
50
+ },
37
51
  "default": {}
38
52
  }
39
53
  }
@@ -44,7 +58,10 @@
44
58
  "items": {
45
59
  "type": "object",
46
60
  "additionalProperties": false,
47
- "required": ["alias", "baseUrl"],
61
+ "required": [
62
+ "alias",
63
+ "baseUrl"
64
+ ],
48
65
  "properties": {
49
66
  "alias": {
50
67
  "type": "string"
@@ -57,7 +74,9 @@
57
74
  },
58
75
  "tags": {
59
76
  "type": "array",
60
- "items": { "type": "string" },
77
+ "items": {
78
+ "type": "string"
79
+ },
61
80
  "default": []
62
81
  },
63
82
  "cardPath": {
@@ -68,13 +87,22 @@
68
87
  "type": "array",
69
88
  "items": {
70
89
  "type": "string",
71
- "enum": ["JSONRPC", "HTTP+JSON", "GRPC"]
90
+ "enum": [
91
+ "JSONRPC",
92
+ "HTTP+JSON",
93
+ "GRPC"
94
+ ]
72
95
  },
73
- "default": ["JSONRPC", "HTTP+JSON"]
96
+ "default": [
97
+ "JSONRPC",
98
+ "HTTP+JSON"
99
+ ]
74
100
  },
75
101
  "examples": {
76
102
  "type": "array",
77
- "items": { "type": "string" },
103
+ "items": {
104
+ "type": "string"
105
+ },
78
106
  "default": []
79
107
  },
80
108
  "default": {
@@ -106,7 +134,9 @@
106
134
  "properties": {
107
135
  "acceptedOutputModes": {
108
136
  "type": "array",
109
- "items": { "type": "string" },
137
+ "items": {
138
+ "type": "string"
139
+ },
110
140
  "default": []
111
141
  },
112
142
  "normalizeBaseUrl": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aramisfa/openclaw-a2a-outbound",
3
- "version": "1.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Outbound A2A delegation plugin for OpenClaw agents",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -41,15 +41,6 @@
41
41
  "./dist/index.js"
42
42
  ]
43
43
  },
44
- "scripts": {
45
- "build": "tsc -b",
46
- "typecheck:src": "tsc -b --pretty false",
47
- "typecheck:tests": "tsc -p tsconfig.tests.json --pretty false",
48
- "typecheck": "corepack pnpm run typecheck:src && corepack pnpm run typecheck:tests",
49
- "test": "corepack pnpm run build && node --import tsx --test tests/*.test.ts",
50
- "clean": "rm -rf dist",
51
- "prepublishOnly": "node ../../scripts/publish-guard.cjs package --package=@aramisfa/openclaw-a2a-outbound"
52
- },
53
44
  "dependencies": {
54
45
  "@a2a-js/sdk": "^0.3.10",
55
46
  "ajv": "^8.18.0",
@@ -68,5 +59,13 @@
68
59
  },
69
60
  "publishConfig": {
70
61
  "access": "public"
62
+ },
63
+ "scripts": {
64
+ "build": "tsc -b",
65
+ "typecheck:src": "tsc -b --pretty false",
66
+ "typecheck:tests": "tsc -p tsconfig.tests.json --pretty false",
67
+ "typecheck": "corepack pnpm run typecheck:src && corepack pnpm run typecheck:tests",
68
+ "test": "corepack pnpm run build && node --import tsx --test tests/*.test.ts",
69
+ "clean": "rm -rf dist"
71
70
  }
72
- }
71
+ }
@@ -1,12 +1,14 @@
1
1
  ---
2
2
  name: remote-agent
3
3
  description: Delegate work to external A2A agents using the remote_agent tool.
4
- metadata: {"openclaw": {"requires": {"config": ["plugins.entries.openclaw-a2a-outbound.enabled"]}}}
4
+ metadata: {"openclaw": {"requires": {"config": ["plugins.entries.openclaw-a2a-outbound.enabled", "plugins.entries.openclaw-a2a-outbound.config.enabled"]}}}
5
5
  ---
6
6
 
7
7
  # Remote Agent Delegation
8
8
 
9
- Use the `remote_agent` tool to delegate work to external A2A-compatible agents and manage delegated tasks.
9
+ If the plugin is not installed or configured yet, use the `a2a-delegation-setup` skill first.
10
+
11
+ Use the `remote_agent` tool to delegate work to external A2A-compatible agents and manage delegated tasks. `send` is the only action to start a new remote turn or continue an existing one.
10
12
 
11
13
  ## When to delegate
12
14
 
@@ -38,28 +40,99 @@ Discover configured targets.
38
40
 
39
41
  ### send
40
42
 
41
- Send a request to a remote agent.
43
+ Send a request to a remote agent. Use it for:
44
+
45
+ - a brand-new remote task
46
+ - a follow-up turn on an existing remote task
47
+ - a related new task that references prior work
48
+ - a new task inside an existing remote conversation
42
49
 
43
50
  ```json
44
51
  {
45
52
  "action": "send",
46
53
  "target_alias": "my-agent",
47
- "input": "Summarize the latest quarterly report.",
54
+ "parts": [
55
+ {
56
+ "kind": "text",
57
+ "text": "Summarize the latest quarterly report."
58
+ }
59
+ ],
48
60
  "follow_updates": true
49
61
  }
50
62
  ```
51
63
 
52
- - `input` (required): the user text to send.
64
+ - `parts` (required): non-empty array of `text`, `file`, or `data` parts.
53
65
  - `target_alias`: configured target name. Omit when a default target exists.
54
- - `follow_updates`: when `true`, streams updates and returns the full event log.
55
- - `attachments`: optional array of file or data attachments.
66
+ - `continuation`: canonical persisted follow-up contract from `summary.continuation`. Round-trip this subtree verbatim for `send`, `watch`, `status`, and `cancel`.
67
+ - `task_handle`: manual compatibility input for follow-up actions when you are not replaying a persisted `continuation`.
68
+ - `task_id`: manual compatibility continuation id for `send`; for follow-up actions it identifies the remote task only when no `task_handle` is available inside a persisted `continuation`. `task_id` continues an existing task.
69
+ - `context_id`: manual compatibility conversation continuation id for `send`. Use it with `task_id`, or by itself to start a new task in the same conversation, only when you are not replaying a persisted `continuation`.
70
+ - `reference_task_ids`: optional related task ids for `send`. `reference_task_ids` references prior tasks without continuing them.
71
+ - `task_requirement`: optional durability contract. `task_requirement="required"` forces explicit task creation or fails fast.
72
+ - `follow_updates`: when `true`, streams updates and returns the full event log. `follow_updates=true` means “stream the initial send”; it does not guarantee task creation unless `task_requirement="required"`.
73
+ - `blocking`: only for non-stream `send`; do not combine it with `follow_updates=true`.
74
+
75
+ Preferred continuation forms:
76
+
77
+ ```json
78
+ { "action": "send", "continuation": { "target": { "target_url": "https://my-agent.example/", "card_path": "/.well-known/agent-card.json", "preferred_transports": ["JSONRPC", "HTTP+JSON"], "target_alias": "my-agent" }, "task": { "task_handle": "rah_abc123", "task_id": "task-123" } }, "parts": [{ "kind": "text", "text": "Approved. Continue." }] }
79
+ ```
80
+
81
+ ```json
82
+ { "action": "send", "continuation": { "target": { "target_url": "https://my-agent.example/", "card_path": "/.well-known/agent-card.json", "preferred_transports": ["JSONRPC", "HTTP+JSON"], "target_alias": "my-agent" }, "task": { "task_id": "task-123" } }, "parts": [{ "kind": "text", "text": "Continue the task." }] }
83
+ ```
84
+
85
+ ```json
86
+ { "action": "send", "continuation": { "target": { "target_url": "https://my-agent.example/", "card_path": "/.well-known/agent-card.json", "preferred_transports": ["JSONRPC", "HTTP+JSON"], "target_alias": "my-agent" }, "conversation": { "context_id": "ctx-123", "can_send": true } }, "parts": [{ "kind": "text", "text": "Start a new task in the same conversation." }] }
87
+ ```
88
+
89
+ Manual compatibility only:
90
+
91
+ ```json
92
+ { "action": "send", "target_alias": "my-agent", "context_id": "ctx-123", "reference_task_ids": ["task-1", "task-2"], "parts": [{ "kind": "text", "text": "Start related work without continuing those tasks." }] }
93
+ ```
94
+
95
+ ## Continuation safety
96
+
97
+ Interpret follow-up capability from `result.summary.continuation`, not from prompt text, message text, or other inferred context.
98
+
99
+ - `response_kind` is descriptive only. Keep follow-up logic anchored to `summary.continuation`.
100
+ - `summary.continuation.target`: canonical persisted routing contract. Persist `summary.continuation` verbatim and pass it back directly for machine follow-up.
101
+ - `summary.continuation.task`: trackable task continuity. Use it for follow-up `send`, `watch`, `status`, and `cancel`.
102
+ - `summary.continuation.conversation`: conversation continuity only. Use it only with `send` to start a new task in the same conversation.
103
+ - `summary.target_*` is descriptive only and no longer part of the machine follow-up recipe.
104
+ - Top-level compatibility aliases stay descriptive only. Do not infer task continuity from flat `task_id`, flat `context_id`, or other top-level summary fields.
105
+ - Branch on `summary.continuation.task` vs `summary.continuation.conversation` before choosing the next action.
106
+ - Never infer or synthesize `summary.continuation.task` from `summary.continuation.conversation`, session ids, run ids, prior prompts, or summary text.
107
+ - Do not call `watch`, `status`, or `cancel` from a result that has only `summary.continuation.conversation`.
108
+ - Do not poll from conversation continuity.
109
+ - If lifecycle tracking is required, fail fast when the peer returns only `summary.continuation.conversation`.
110
+
111
+ ```ts
112
+ const task = result.summary.continuation?.task
113
+ const conversation = result.summary.continuation?.conversation
114
+
115
+ if (task) {
116
+ // Trackable task lifecycle.
117
+ } else if (conversation) {
118
+ // Send-only conversation continuity.
119
+ }
120
+ ```
121
+
122
+ Invalid follow-up example:
123
+
124
+ ```json
125
+ { "action": "status", "context_id": "ctx-123" }
126
+ ```
127
+
128
+ That is invalid because `status`, `watch`, and `cancel` require task continuity, not just conversation continuity.
56
129
 
57
130
  ### status
58
131
 
59
132
  Poll the current state of a delegated task.
60
133
 
61
134
  ```json
62
- { "action": "status", "task_handle": "rah_abc123" }
135
+ { "action": "status", "continuation": { "target": { "target_url": "https://my-agent.example/", "card_path": "/.well-known/agent-card.json", "preferred_transports": ["JSONRPC", "HTTP+JSON"], "target_alias": "my-agent" }, "task": { "task_handle": "rah_abc123", "task_id": "task-123" } } }
63
136
  ```
64
137
 
65
138
  ### watch
@@ -67,7 +140,7 @@ Poll the current state of a delegated task.
67
140
  Subscribe to live updates from a running task.
68
141
 
69
142
  ```json
70
- { "action": "watch", "task_handle": "rah_abc123" }
143
+ { "action": "watch", "continuation": { "target": { "target_url": "https://my-agent.example/", "card_path": "/.well-known/agent-card.json", "preferred_transports": ["JSONRPC", "HTTP+JSON"], "target_alias": "my-agent" }, "task": { "task_handle": "rah_abc123", "task_id": "task-123" } } }
71
144
  ```
72
145
 
73
146
  ### cancel
@@ -75,12 +148,12 @@ Subscribe to live updates from a running task.
75
148
  Cancel a running task.
76
149
 
77
150
  ```json
78
- { "action": "cancel", "task_handle": "rah_abc123" }
151
+ { "action": "cancel", "continuation": { "target": { "target_url": "https://my-agent.example/", "card_path": "/.well-known/agent-card.json", "preferred_transports": ["JSONRPC", "HTTP+JSON"], "target_alias": "my-agent" }, "task": { "task_handle": "rah_abc123", "task_id": "task-123" } } }
79
152
  ```
80
153
 
81
154
  ## Task handles
82
155
 
83
- After a successful `send`, the result includes a `task_handle` (prefixed `rah_`). Always prefer `task_handle` over `target_alias + task_id` for follow-up actions the handle encodes the target and task identity in one opaque token. Handles are process-local and expire after restart or TTL. If a handle expires, fall back to `target_alias` + `task_id`.
156
+ After a successful `send`, the result usually includes `summary.continuation.task.task_handle` (prefixed `rah_`) when the remote peer exposes task continuity. `task_handle` is returned only when the peer actually created a task. Persist `summary.continuation` verbatim and pass it back directly for follow-up `send`/`watch`/`status`/`cancel` actions. Handles are process-local and expire after restart or TTL, but nested `continuation` still round-trips safely because it also carries durable `summary.continuation.target` plus `summary.continuation.task.task_id`. Treat flat `send.task_id`, `send.context_id`, and `target_alias` as manual compatibility inputs, not as a replacement for nested continuation round-tripping. If the result includes only `summary.continuation.conversation`, there is no task lifecycle to poll, watch, or cancel.
84
157
 
85
158
  ## watch vs status
86
159
 
@@ -88,6 +161,6 @@ Use `watch` when the remote agent supports streaming and you want live increment
88
161
 
89
162
  ## Errors
90
163
 
91
- - `UNKNOWN_TASK_HANDLE` — the handle is expired or invalid. Retry with `target_alias` + `task_id`, or re-send.
164
+ - `UNKNOWN_TASK_HANDLE` — the handle is expired or invalid. Retry with the same nested `continuation`, or re-send. Manual callers may fall back to flat `task_id` plus target routing only when they do not have a persisted `continuation`.
92
165
  - `TARGET_RESOLUTION_ERROR` — the alias or URL did not resolve. Call `list_targets` to check available targets.
93
166
  - `VALIDATION_ERROR` — invalid parameters. Check required fields for the action.