@botbotgo/agent-harness 0.0.216 → 0.0.218
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 +1 -1
- package/README.zh.md +1 -1
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/protocol/a2a/http.d.ts +22 -0
- package/dist/protocol/a2a/http.js +41 -14
- package/package.json +1 -1
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`, and `
|
|
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.
|
|
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` 这类 A2A v1.0 PascalCase 方法,并统一映射到现有 session/request 运行记录。v1.0 路径会发布 `supportedInterfaces`、`TASK_STATE_*` 状态、`SendMessage` 的 `{ task }` wrapper,并对 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 运行记录。v1.0 路径会发布 `supportedInterfaces`、`TASK_STATE_*` 状态、`SendMessage` 的 `{ task }` wrapper、带 runtime discovery metadata 的 extended agent card,并对 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.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.217";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.217";
|
|
@@ -46,6 +46,28 @@ export type A2aAgentCard = {
|
|
|
46
46
|
examples: string[];
|
|
47
47
|
}>;
|
|
48
48
|
};
|
|
49
|
+
export type A2aExtendedAgentCard = A2aAgentCard & {
|
|
50
|
+
metadata: {
|
|
51
|
+
agentHarness: {
|
|
52
|
+
runtime: {
|
|
53
|
+
product: "agent-harness";
|
|
54
|
+
protocolSurface: "a2a-http";
|
|
55
|
+
defaultAgentId?: string;
|
|
56
|
+
};
|
|
57
|
+
protocolSurfaces: string[];
|
|
58
|
+
inventory: {
|
|
59
|
+
agentCount: number;
|
|
60
|
+
subagentCount: number;
|
|
61
|
+
};
|
|
62
|
+
agents: Array<{
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
65
|
+
description: string;
|
|
66
|
+
kind: "agent" | "subagent";
|
|
67
|
+
}>;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
49
71
|
export type A2aTaskState = "TASK_STATE_SUBMITTED" | "TASK_STATE_WORKING" | "TASK_STATE_INPUT_REQUIRED" | "TASK_STATE_COMPLETED" | "TASK_STATE_FAILED" | "TASK_STATE_CANCELED";
|
|
50
72
|
type A2aTaskStatus = {
|
|
51
73
|
state: A2aTaskState;
|
|
@@ -357,11 +357,41 @@ function buildAgentCard(runtime, options) {
|
|
|
357
357
|
capabilities: {
|
|
358
358
|
streaming: false,
|
|
359
359
|
pushNotifications: false,
|
|
360
|
-
extendedAgentCard:
|
|
360
|
+
extendedAgentCard: true,
|
|
361
361
|
},
|
|
362
362
|
defaultInputModes: ["text/plain"],
|
|
363
363
|
defaultOutputModes: ["text/plain"],
|
|
364
364
|
skills,
|
|
365
|
+
...(options.documentationUrl ? { documentationUrl: options.documentationUrl } : {}),
|
|
366
|
+
...(options.provider ? { provider: options.provider } : {}),
|
|
367
|
+
...(options.defaultAgentId ? { defaultAgentId: options.defaultAgentId } : {}),
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function buildExtendedAgentCard(runtime, options) {
|
|
371
|
+
const inventory = runtime.describeWorkspaceInventory();
|
|
372
|
+
const card = buildAgentCard(runtime, options);
|
|
373
|
+
return {
|
|
374
|
+
...card,
|
|
375
|
+
metadata: {
|
|
376
|
+
agentHarness: {
|
|
377
|
+
runtime: {
|
|
378
|
+
product: "agent-harness",
|
|
379
|
+
protocolSurface: "a2a-http",
|
|
380
|
+
...(options.defaultAgentId ? { defaultAgentId: options.defaultAgentId } : {}),
|
|
381
|
+
},
|
|
382
|
+
protocolSurfaces: ["A2A", "ACP", "AG-UI", "runtime MCP"],
|
|
383
|
+
inventory: {
|
|
384
|
+
agentCount: inventory.agents.length,
|
|
385
|
+
subagentCount: inventory.agents.filter((agent) => Boolean(agent.parentAgentId)).length,
|
|
386
|
+
},
|
|
387
|
+
agents: inventory.agents.map((agent) => ({
|
|
388
|
+
id: agent.id,
|
|
389
|
+
name: agent.id,
|
|
390
|
+
description: agent.description || `Agent ${agent.id}`,
|
|
391
|
+
kind: agent.parentAgentId ? "subagent" : "agent",
|
|
392
|
+
})),
|
|
393
|
+
},
|
|
394
|
+
},
|
|
365
395
|
};
|
|
366
396
|
}
|
|
367
397
|
function isV1Method(method) {
|
|
@@ -378,22 +408,19 @@ export async function serveA2aOverHttp(runtime, options = {}) {
|
|
|
378
408
|
const port = typeof options.port === "number" && Number.isFinite(options.port) ? options.port : 0;
|
|
379
409
|
const rpcPath = normalizePath(options.rpcPath, "/a2a");
|
|
380
410
|
const agentCardPath = normalizePath(options.agentCardPath, "/.well-known/agent-card.json");
|
|
411
|
+
const buildCardOptions = () => ({
|
|
412
|
+
agentName: options.agentName ?? "agent-harness-runtime",
|
|
413
|
+
agentDescription: options.agentDescription ?? "Agent-harness A2A bridge over the persisted runtime surface.",
|
|
414
|
+
rpcUrl: `http://${hostname}:${resolvedPort}${rpcPath}`,
|
|
415
|
+
...(options.documentationUrl ? { documentationUrl: options.documentationUrl } : {}),
|
|
416
|
+
...(options.provider ? { provider: options.provider } : {}),
|
|
417
|
+
...(options.defaultAgentId ? { defaultAgentId: options.defaultAgentId } : {}),
|
|
418
|
+
});
|
|
381
419
|
const httpServer = createServer(async (request, response) => {
|
|
382
420
|
try {
|
|
383
421
|
const requestUrl = new URL(request.url ?? "/", `http://${hostname}`);
|
|
384
422
|
if (request.method === "GET" && (requestUrl.pathname === agentCardPath || requestUrl.pathname === "/.well-known/agent.json")) {
|
|
385
|
-
|
|
386
|
-
agentName: options.agentName ?? "agent-harness-runtime",
|
|
387
|
-
agentDescription: options.agentDescription ?? "Agent-harness A2A bridge over the persisted runtime surface.",
|
|
388
|
-
cardUrl: `http://${hostname}:${resolvedPort}${agentCardPath}`,
|
|
389
|
-
rpcUrl: `http://${hostname}:${resolvedPort}${rpcPath}`,
|
|
390
|
-
});
|
|
391
|
-
writeJson(response, 200, {
|
|
392
|
-
...card,
|
|
393
|
-
...(options.documentationUrl ? { documentationUrl: options.documentationUrl } : {}),
|
|
394
|
-
...(options.provider ? { provider: options.provider } : {}),
|
|
395
|
-
...(options.defaultAgentId ? { defaultAgentId: options.defaultAgentId } : {}),
|
|
396
|
-
});
|
|
423
|
+
writeJson(response, 200, buildAgentCard(runtime, buildCardOptions()));
|
|
397
424
|
return;
|
|
398
425
|
}
|
|
399
426
|
if (request.method === "POST" && (requestUrl.pathname === rpcPath || requestUrl.pathname === agentCardPath)) {
|
|
@@ -480,7 +507,7 @@ export async function serveA2aOverHttp(runtime, options = {}) {
|
|
|
480
507
|
return;
|
|
481
508
|
}
|
|
482
509
|
if (payload.method === "GetExtendedAgentCard") {
|
|
483
|
-
writeJson(response, 200,
|
|
510
|
+
writeJson(response, 200, toSuccess(payload.id ?? null, buildExtendedAgentCard(runtime, buildCardOptions())));
|
|
484
511
|
return;
|
|
485
512
|
}
|
|
486
513
|
writeJson(response, 200, toError(payload.id ?? null, -32601, `Unknown A2A method: ${payload.method}`));
|