@botbotgo/agent-harness 0.0.218 → 0.0.219

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/README.md CHANGED
@@ -1024,7 +1024,7 @@ ACP transport notes:
1024
1024
  - `serveAcpHttp(runtime)` exposes JSON-RPC over HTTP plus SSE runtime events so remote operator surfaces can connect without importing the runtime in-process.
1025
1025
  - ACP transport validation now covers the reference-client core flow: capability discovery, request submit, session lookup, request lookup, invalid-JSON handling, notification calls without response ids, stdio JSON-RPC, and HTTP plus SSE runtime notifications.
1026
1026
  - For the thinnest editor or CLI starter, begin with `agent-harness acp serve --workspace . --transport stdio` and mirror the `examples/protocol-hello-world/app/acp-stdio-hello-world.mjs` wire shape. Applications that want an in-process reference client can use `createAcpStdioClient(...)` to issue JSON-RPC requests and route runtime notifications without hand-rolling line parsing.
1027
- - `serveA2aHttp(runtime)` exposes an A2A-compatible HTTP JSON-RPC bridge plus agent card discovery, mapping both existing methods such as `message/send` and A2A v1.0 PascalCase methods such as `SendMessage`, `GetTask`, `ListTasks`, `CancelTask`, `SubscribeToTask`, and `GetExtendedAgentCard` onto the existing session/request runtime surface. The v1.0 path publishes `supportedInterfaces`, `TASK_STATE_*` statuses, the `{ task }` `SendMessage` wrapper, an extended agent card with runtime discovery metadata, and explicit unsupported errors for streaming or push notifications.
1027
+ - `serveA2aHttp(runtime)` exposes an A2A-compatible HTTP JSON-RPC bridge plus agent card discovery, mapping both existing methods such as `message/send` and A2A v1.0 PascalCase methods such as `SendMessage`, `GetTask`, `ListTasks`, `CancelTask`, `SubscribeToTask`, and `GetExtendedAgentCard` onto the existing session/request runtime surface. The bridge now advertises both `1.0` and `0.3` JSON-RPC interfaces, validates `A2A-Version`, records `A2A-Extensions` into runtime invocation metadata, publishes `TASK_STATE_*` statuses plus the `{ task }` `SendMessage` wrapper, and still returns explicit unsupported errors for streaming or push notifications.
1028
1028
  - `serveAgUiHttp(runtime)` exposes an AG-UI-compatible HTTP SSE bridge that projects runtime lifecycle, text output, upstream thinking, step progress, and tool calls onto `RUN_*`, `TEXT_MESSAGE_*`, `THINKING_TEXT_MESSAGE_*`, `STEP_*`, and `TOOL_CALL_*` events for UI clients.
1029
1029
  - `createRuntimeMcpServer(runtime)` and `serveRuntimeMcpOverStdio(runtime)` expose the persisted runtime control surface itself as MCP tools, including sessions, requests, approvals, artifacts, events, and package export helpers.
1030
1030
  - `listRequestEvents(...)` and `exportRequestPackage(...)` are the request-first inspection helpers.
package/README.zh.md CHANGED
@@ -982,7 +982,7 @@ ACP transport 说明:
982
982
  - `serveAcpHttp(runtime)` 提供基于 HTTP 的 JSON-RPC 与 SSE runtime events,适合远程界面或独立控制面接入。
983
983
  - ACP transport 现已覆盖核心参考客户端流程验证:capability discovery、request submit、session lookup、request lookup、invalid JSON 处理、无 id notification 不返回响应,以及 stdio JSON-RPC 与 HTTP + SSE runtime notifications。
984
984
  - 如果要从最薄的一层 editor / CLI starter 开始,优先用 `agent-harness acp serve --workspace . --transport stdio`,并直接参考 `examples/protocol-hello-world/app/acp-stdio-hello-world.mjs` 的 wire shape。需要在应用内使用 reference client 时,可直接用 `createAcpStdioClient(...)` 发起 JSON-RPC 请求并分流 runtime notifications,避免每个 sidecar 自己重写 line parsing。
985
- - `serveA2aHttp(runtime)` 提供 A2A HTTP JSON-RPC bridge 与 agent card discovery,同时兼容 `message/send` 这类旧方法,以及 `SendMessage`、`GetTask`、`ListTasks`、`CancelTask`、`SubscribeToTask`、`GetExtendedAgentCard` 这类 A2A v1.0 PascalCase 方法,并统一映射到现有 session/request 运行记录。v1.0 路径会发布 `supportedInterfaces`、`TASK_STATE_*` 状态、`SendMessage` 的 `{ task }` wrapper、带 runtime discovery metadata 的 extended agent card,并对 streaming 或 push notification 返回明确 unsupported error。
985
+ - `serveA2aHttp(runtime)` 提供 A2A HTTP JSON-RPC bridge 与 agent card discovery,同时兼容 `message/send` 这类旧方法,以及 `SendMessage`、`GetTask`、`ListTasks`、`CancelTask`、`SubscribeToTask`、`GetExtendedAgentCard` 这类 A2A v1.0 PascalCase 方法,并统一映射到现有 session/request 运行记录。bridge 现在会同时声明 `1.0` `0.3` 两个 JSON-RPC interface、校验 `A2A-Version`、把 `A2A-Extensions` 记录进 runtime invocation metadata、发布 `TASK_STATE_*` 状态与 `SendMessage` 的 `{ task }` wrapper,并继续对 streaming 或 push notification 返回明确 unsupported error。
986
986
  - `serveAgUiHttp(runtime)` 提供 AG-UI HTTP SSE bridge,把 runtime 生命周期、文本输出、upstream thinking、step 进度与 tool call 投影成 `RUN_*`、`TEXT_MESSAGE_*`、`THINKING_TEXT_MESSAGE_*`、`STEP_*` 与 `TOOL_CALL_*` 事件,便于 UI 客户端直接接入。
987
987
  - `createRuntimeMcpServer(runtime)` 与 `serveRuntimeMcpOverStdio(runtime)` 会把持久化 runtime 控制面本身暴露成 MCP tools,包括 sessions、requests、approvals、artifacts、events 与 package export helpers。
988
988
  - `listRequestEvents(...)` 与 `exportRequestPackage(...)` 是 request-first 的检查 helper。
@@ -1 +1 @@
1
- export declare const AGENT_HARNESS_VERSION = "0.0.217";
1
+ export declare const AGENT_HARNESS_VERSION = "0.0.218";
@@ -1 +1 @@
1
- export const AGENT_HARNESS_VERSION = "0.0.217";
1
+ export const AGENT_HARNESS_VERSION = "0.0.218";
@@ -29,7 +29,7 @@ export type A2aAgentCard = {
29
29
  supportedInterfaces: Array<{
30
30
  url: string;
31
31
  protocolBinding: "JSONRPC";
32
- protocolVersion: "1.0";
32
+ protocolVersion: string;
33
33
  }>;
34
34
  capabilities: {
35
35
  streaming: boolean;
@@ -1,4 +1,5 @@
1
1
  import { createServer } from "node:http";
2
+ const SUPPORTED_A2A_VERSIONS = ["1.0", "0.3"];
2
3
  function normalizePath(value, fallback) {
3
4
  const source = typeof value === "string" && value.trim().length > 0 ? value.trim() : fallback;
4
5
  return source.startsWith("/") ? source : `/${source}`;
@@ -36,6 +37,31 @@ function toSuccess(id, result) {
36
37
  result,
37
38
  };
38
39
  }
40
+ function readServiceParameter(requestUrl, request, name) {
41
+ const headerValue = request.headers[name.toLowerCase()];
42
+ if (typeof headerValue === "string") {
43
+ return headerValue;
44
+ }
45
+ if (Array.isArray(headerValue)) {
46
+ return headerValue.join(",");
47
+ }
48
+ return requestUrl.searchParams.get(name) ?? undefined;
49
+ }
50
+ function parseA2aServiceParameters(requestUrl, request) {
51
+ const requestedVersion = readServiceParameter(requestUrl, request, "A2A-Version")?.trim() ?? "";
52
+ const normalizedVersion = requestedVersion.length === 0 ? "0.3" : requestedVersion;
53
+ if (!SUPPORTED_A2A_VERSIONS.includes(normalizedVersion)) {
54
+ return null;
55
+ }
56
+ const requestedExtensions = readServiceParameter(requestUrl, request, "A2A-Extensions") ?? "";
57
+ return {
58
+ version: normalizedVersion,
59
+ extensions: requestedExtensions
60
+ .split(",")
61
+ .map((entry) => entry.trim())
62
+ .filter((entry) => entry.length > 0),
63
+ };
64
+ }
39
65
  function parseTextPart(part) {
40
66
  if (!part || typeof part !== "object" || Array.isArray(part)) {
41
67
  return null;
@@ -89,6 +115,20 @@ function parseMessageSendParams(params) {
89
115
  ...(invocation ? { invocation } : {}),
90
116
  };
91
117
  }
118
+ function attachServiceParameters(invocation, serviceParameters) {
119
+ return {
120
+ ...(invocation ?? {}),
121
+ protocol: {
122
+ ...(invocation?.protocol && typeof invocation.protocol === "object" && !Array.isArray(invocation.protocol)
123
+ ? invocation.protocol
124
+ : {}),
125
+ a2a: {
126
+ version: serviceParameters.version,
127
+ ...(serviceParameters.extensions.length > 0 ? { extensions: serviceParameters.extensions } : {}),
128
+ },
129
+ },
130
+ };
131
+ }
92
132
  function parseTaskLocatorParams(params) {
93
133
  if (!params || typeof params !== "object" || Array.isArray(params)) {
94
134
  throw new Error("A2A task lookup requires params object.");
@@ -353,6 +393,11 @@ function buildAgentCard(runtime, options) {
353
393
  protocolBinding: "JSONRPC",
354
394
  protocolVersion: "1.0",
355
395
  },
396
+ {
397
+ url: options.rpcUrl,
398
+ protocolBinding: "JSONRPC",
399
+ protocolVersion: "0.3",
400
+ },
356
401
  ],
357
402
  capabilities: {
358
403
  streaming: false,
@@ -419,6 +464,16 @@ export async function serveA2aOverHttp(runtime, options = {}) {
419
464
  const httpServer = createServer(async (request, response) => {
420
465
  try {
421
466
  const requestUrl = new URL(request.url ?? "/", `http://${hostname}`);
467
+ const serviceParameters = parseA2aServiceParameters(requestUrl, request);
468
+ if (!serviceParameters) {
469
+ writeJson(response, 400, {
470
+ error: {
471
+ code: -32009,
472
+ message: `A2A version not supported. Supported versions: ${SUPPORTED_A2A_VERSIONS.join(", ")}.`,
473
+ },
474
+ });
475
+ return;
476
+ }
422
477
  if (request.method === "GET" && (requestUrl.pathname === agentCardPath || requestUrl.pathname === "/.well-known/agent.json")) {
423
478
  writeJson(response, 200, buildAgentCard(runtime, buildCardOptions()));
424
479
  return;
@@ -443,7 +498,7 @@ export async function serveA2aOverHttp(runtime, options = {}) {
443
498
  agentId: parsed.agentId ?? options.defaultAgentId,
444
499
  input: parsed.input,
445
500
  ...(parsed.sessionId ? { threadId: parsed.sessionId } : {}),
446
- ...(parsed.invocation ? { invocation: parsed.invocation } : {}),
501
+ invocation: attachServiceParameters(parsed.invocation, serviceParameters),
447
502
  });
448
503
  const session = await runtime.getThread(result.threadId);
449
504
  const requestRecord = await runtime.getRun(result.runId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbotgo/agent-harness",
3
- "version": "0.0.218",
3
+ "version": "0.0.219",
4
4
  "description": "Workspace runtime for multi-agent applications",
5
5
  "license": "MIT",
6
6
  "type": "module",