@botbotgo/agent-harness 0.0.268 → 0.0.270
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 +3 -2
- package/README.zh.md +3 -2
- package/dist/acp.js +2 -2
- package/dist/api.d.ts +6 -11
- package/dist/api.js +20 -23
- package/dist/contracts/runtime.d.ts +42 -70
- package/dist/flow/build-flow-graph.js +29 -45
- package/dist/flow/types.d.ts +0 -6
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/persistence/file-store.js +24 -17
- package/dist/persistence/sqlite-run-context-store.js +2 -2
- package/dist/persistence/sqlite-store.js +18 -16
- package/dist/protocol/a2a/http.js +69 -46
- package/dist/protocol/ag-ui/http.js +9 -9
- package/dist/runtime/adapter/invocation-result.js +2 -2
- package/dist/runtime/adapter/tool/tool-hitl.d.ts +3 -1
- package/dist/runtime/adapter/tool/tool-hitl.js +75 -6
- package/dist/runtime/harness/events/listener-runtime.d.ts +2 -2
- package/dist/runtime/harness/events/streaming.d.ts +8 -8
- package/dist/runtime/harness/events/streaming.js +10 -10
- package/dist/runtime/harness/events/timeline.js +4 -4
- package/dist/runtime/harness/run/governance.js +33 -4
- package/dist/runtime/harness/run/helpers.js +2 -2
- package/dist/runtime/harness/run/operator-overview.js +6 -0
- package/dist/runtime/harness/run/recovery.js +20 -20
- package/dist/runtime/harness/run/resume.js +3 -3
- package/dist/runtime/harness/run/run-lifecycle.js +5 -5
- package/dist/runtime/harness/run/run-operations.d.ts +2 -2
- package/dist/runtime/harness/run/run-operations.js +21 -21
- package/dist/runtime/harness/run/start-run.d.ts +3 -3
- package/dist/runtime/harness/run/start-run.js +3 -3
- package/dist/runtime/harness/run/startup-runtime.js +1 -1
- package/dist/runtime/harness/run/stream-run.js +37 -27
- package/dist/runtime/harness/run/thread-records.js +12 -33
- package/dist/runtime/harness/system/mem0-ingestion-sync.js +2 -2
- package/dist/runtime/harness/system/runtime-memory-manager.js +4 -4
- package/dist/runtime/harness/system/runtime-memory-records.js +6 -6
- package/dist/runtime/harness/system/runtime-memory-sync.js +6 -4
- package/dist/runtime/harness/system/thread-memory-sync.js +7 -5
- package/dist/runtime/harness.d.ts +2 -2
- package/dist/runtime/harness.js +161 -156
- package/dist/runtime/support/harness-support.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -147,6 +147,7 @@ The public API spans a full product runtime—persistent records, memory and evi
|
|
|
147
147
|
- **Runtime memory and evidence:** `memorize`, `recall`, `listMemories`, memory policy hooks, `listArtifacts`, `getArtifact`, `exportEvaluationBundle`, `replayEvaluationBundle`, and request/session evidence export helpers.
|
|
148
148
|
- **Protocol and transport surfaces:** `createAcpServer`, `createAcpStdioClient`, `serveAcpStdio`, `serveAcpHttp`, `serveA2aHttp`, `serveAgUiHttp`, and `createRuntimeMcpServer` / `serveRuntimeMcpOverStdio`.
|
|
149
149
|
- **Governed workspace runtime:** YAML-owned routing, concurrency, maintenance, MCP policy, runtime governance bundles, and approval defaults for sensitive memory or write-like MCP side effects.
|
|
150
|
+
- **Policy-shaped approvals:** governed tools can stay on manual review, auto-approve, or auto-reject / deny-and-continue modes while the runtime keeps one inspectable governance decision surface.
|
|
150
151
|
|
|
151
152
|
If you integrate external clients, treat `deepagents-acp` as the primary protocol direction: clients connect through that surface while `agent-harness` keeps persistence, recovery, approvals, and operator control on the runtime side.
|
|
152
153
|
Keep the standard stack split explicit: MCP connects agents to resources and tools, A2A bridges task exchange between agent platforms, ACP is the client-to-runtime boundary, AG-UI is the UI event surface, and runtime MCP exposes the operator control plane.
|
|
@@ -1059,12 +1060,12 @@ ACP transport notes:
|
|
|
1059
1060
|
- `serveAcpHttp(runtime)` exposes JSON-RPC over HTTP plus SSE runtime events so remote operator surfaces can connect without importing the runtime in-process.
|
|
1060
1061
|
- 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.
|
|
1061
1062
|
- 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.
|
|
1062
|
-
- `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`, `SendStreamingMessage`, `GetTask`, `ListTasks`, `CancelTask`, `SubscribeToTask`, `GetExtendedAgentCard`, and task push-notification config methods onto the existing session/request runtime surface. The bridge now advertises both `1.0` and `0.3` JSON-RPC interfaces,
|
|
1063
|
+
- `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`, `SendStreamingMessage`, `GetTask`, `ListTasks`, `CancelTask`, `SubscribeToTask`, `GetAgentCard`, `GetExtendedAgentCard`, and task push-notification config methods onto the existing session/request runtime surface. The bridge now advertises both `1.0` and `0.3` JSON-RPC interfaces, answers `HEAD` / `OPTIONS` discovery on the agent-card path, sets supported-version discovery headers, validates `A2A-Version`, records `A2A-Extensions` into runtime invocation metadata, publishes `TASK_STATE_*` statuses plus the `{ task }` `SendMessage` wrapper, streams an initial `{ task }` snapshot plus later `{ statusUpdate }` payloads over SSE for v1 streaming methods, and can send best-effort webhook task snapshots for configured push notification receivers.
|
|
1063
1064
|
- `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.
|
|
1064
1065
|
- `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.
|
|
1065
1066
|
- `listRequestEvents(...)`, `listRequestTraceItems(...)`, and `exportRequestPackage(...)` are the request-first inspection helpers.
|
|
1066
1067
|
- `exportRequestPackage(...)` and `exportSessionPackage(...)` package stable runtime records, transcript, approvals, events, artifacts, and governance evidence for operator tooling without reaching into persistence internals.
|
|
1067
|
-
- `runtime/default.governance.remoteMcp` can now deny or allow specific MCP servers, raise approval requirements by transport, and stamp transport-based risk tiers into runtime governance bundles. MCP server catalogs can also declare trust tier, access mode, tenant scope, approval policy, prompt-injection risk, and OAuth scope metadata so governance bundles capture why one remote tool is treated as high-risk.
|
|
1068
|
+
- `runtime/default.governance.remoteMcp` can now deny or allow specific MCP servers, raise approval requirements by transport, and stamp transport-based risk tiers into runtime governance bundles. MCP server catalogs can also declare trust tier, access mode, tenant scope, approval policy, prompt-injection risk, and OAuth scope metadata so governance bundles capture why one remote tool is treated as high-risk. Tool policy overrides can also set `decisionMode: manual | auto-approve | auto-reject | deny-and-continue` so operator evidence and execution behavior stay aligned.
|
|
1068
1069
|
- Protocol responsibilities stay split on purpose: ACP is the primary editor/client runtime boundary, A2A is the streaming-capable agent-platform bridge with polling compatibility, AG-UI is the UI event surface, and runtime MCP is the operator-facing control plane exported as MCP tools.
|
|
1069
1070
|
- `runtime/default.observability.tracing` can now describe exporter metadata such as OTLP endpoints and propagation mode, so frozen runtime snapshots keep trace-correlation plus operator-visible export context without exposing backend-private span internals.
|
|
1070
1071
|
- `agent-harness runtime overview`, `agent-harness runtime health`, `agent-harness runtime approvals list|watch`, `agent-harness runtime runs list|tail`, and `agent-harness runtime export request|session` provide a thin operator CLI over persisted runtime health, queue pressure, governance risk, approval queues, active run state, and audit-ready evidence packages.
|
package/README.zh.md
CHANGED
|
@@ -143,6 +143,7 @@ try {
|
|
|
143
143
|
- **运行时 memory 与证据能力:** `memorize`、`recall`、`listMemories`、memory policy hooks、`listArtifacts`、`getArtifact`、`exportEvaluationBundle`、`replayEvaluationBundle`,以及 request / session 级证据导出辅助函数。
|
|
144
144
|
- **协议与传输层:** `createAcpServer`、`createAcpStdioClient`、`serveAcpStdio`、`serveAcpHttp`、`serveA2aHttp`、`serveAgUiHttp`,以及 `createRuntimeMcpServer` / `serveRuntimeMcpOverStdio`。
|
|
145
145
|
- **受治理的工作区运行时:** 由 YAML 持有的路由、并发、维护、MCP 策略、runtime governance bundles,以及针对敏感 memory 或写类 MCP 副作用的默认审批门槛。
|
|
146
|
+
- **策略化审批:** 受治理工具现在既可以走人工审批,也可以走 `auto-approve`、`auto-reject` 或 `deny-and-continue`,同时继续保留统一可检查的治理决策面。
|
|
146
147
|
|
|
147
148
|
若你的产品需要对接外部客户端,可从本节理解边界:`deepagents-acp` 是主要的外部协议接入方向;持久化、恢复、审批与运行控制仍由 `agent-harness` 在运行时侧承担。
|
|
148
149
|
协议栈分工也要保持明确:MCP 连接资源和工具,A2A 承接 agent 平台之间的 task exchange,ACP 是 client-to-runtime 边界,AG-UI 是 UI 事件面,runtime MCP 则把 operator control plane 以 MCP tools 暴露出去。
|
|
@@ -1016,12 +1017,12 @@ ACP transport 说明:
|
|
|
1016
1017
|
- `serveAcpHttp(runtime)` 提供基于 HTTP 的 JSON-RPC 与 SSE runtime events,适合远程界面或独立控制面接入。
|
|
1017
1018
|
- ACP transport 现已覆盖核心参考客户端流程验证:capability discovery、request submit、session lookup、request lookup、invalid JSON 处理、无 id notification 不返回响应,以及 stdio JSON-RPC 与 HTTP + SSE runtime notifications。
|
|
1018
1019
|
- 如果要从最薄的一层 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。
|
|
1019
|
-
- `serveA2aHttp(runtime)` 提供 A2A HTTP JSON-RPC bridge 与 agent card discovery,同时兼容 `message/send` 这类旧方法,以及 `SendMessage`、`SendStreamingMessage`、`GetTask`、`ListTasks`、`CancelTask`、`SubscribeToTask`、`GetExtendedAgentCard` 与 task push-notification config 这类 A2A v1.0 方法,并统一映射到现有 session/request 运行记录。bridge 现在会同时声明 `1.0` 与 `0.3` 两个 JSON-RPC interface
|
|
1020
|
+
- `serveA2aHttp(runtime)` 提供 A2A HTTP JSON-RPC bridge 与 agent card discovery,同时兼容 `message/send` 这类旧方法,以及 `SendMessage`、`SendStreamingMessage`、`GetTask`、`ListTasks`、`CancelTask`、`SubscribeToTask`、`GetAgentCard`、`GetExtendedAgentCard` 与 task push-notification config 这类 A2A v1.0 方法,并统一映射到现有 session/request 运行记录。bridge 现在会同时声明 `1.0` 与 `0.3` 两个 JSON-RPC interface、在 agent card 路径上响应 `HEAD` / `OPTIONS` discovery、写出支持版本的 discovery headers、校验 `A2A-Version`、把 `A2A-Extensions` 记录进 runtime invocation metadata、发布 `TASK_STATE_*` 状态与 `SendMessage` 的 `{ task }` wrapper、在 v1 streaming 方法上先通过 SSE 输出 `{ task }` 初始快照,再输出 `{ statusUpdate }` 增量状态,并可向已配置的 webhook receiver 发送 best-effort task push notifications。
|
|
1020
1021
|
- `serveAgUiHttp(runtime)` 提供 AG-UI HTTP SSE bridge,把 runtime 生命周期、文本输出、upstream thinking、step 进度与 tool call 投影成 `RUN_*`、`TEXT_MESSAGE_*`、`THINKING_TEXT_MESSAGE_*`、`STEP_*` 与 `TOOL_CALL_*` 事件,便于 UI 客户端直接接入。
|
|
1021
1022
|
- `createRuntimeMcpServer(runtime)` 与 `serveRuntimeMcpOverStdio(runtime)` 会把持久化 runtime 控制面本身暴露成 MCP tools,包括 sessions、requests、approvals、artifacts、events 与 package export helpers。
|
|
1022
1023
|
- `listRequestEvents(...)`、`listRequestTraceItems(...)` 与 `exportRequestPackage(...)` 是 request-first 的检查 helper。
|
|
1023
1024
|
- `exportRequestPackage(...)` 与 `exportSessionPackage(...)` 可把稳定 runtime 记录、transcript、approvals、events、artifacts 与 governance evidence 一起打包给管理工具,而不必直接访问 persistence 内部实现。
|
|
1024
|
-
- `runtime/default.governance.remoteMcp` 现在可以按 MCP server 或 transport 做 allow/deny、审批升级,并把 transport 风险等级写进 runtime governance bundles。MCP server catalog 也可以声明 trust tier、access mode、tenant scope、approval policy、prompt-injection risk 与 OAuth scope 元数据,让治理快照能解释为什么某个远端工具被视为高风险。
|
|
1025
|
+
- `runtime/default.governance.remoteMcp` 现在可以按 MCP server 或 transport 做 allow/deny、审批升级,并把 transport 风险等级写进 runtime governance bundles。MCP server catalog 也可以声明 trust tier、access mode、tenant scope、approval policy、prompt-injection risk 与 OAuth scope 元数据,让治理快照能解释为什么某个远端工具被视为高风险。tool policy override 也可以声明 `decisionMode: manual | auto-approve | auto-reject | deny-and-continue`,让治理快照与实际执行路径保持一致。
|
|
1025
1026
|
- 协议分工要继续保持清晰:ACP 是 editor / client 的主运行时边界,A2A 是支持 streaming 且兼容轮询的 agent-platform bridge,AG-UI 是 UI 事件面,runtime MCP 是以 MCP tools 暴露的 operator control plane。
|
|
1026
1027
|
- `runtime/default.observability.tracing` 现在可描述 OTLP endpoint 和 propagation mode 这类 exporter 元数据,使冻结的 runtime snapshot 在保留 trace correlation 的同时,也能保留有用的导出上下文,而不暴露 backend 私有 span 细节。
|
|
1027
1028
|
- `agent-harness runtime overview`、`agent-harness runtime health`、`agent-harness runtime approvals list|watch`、`agent-harness runtime runs list|tail` 与 `agent-harness runtime export request|session` 提供了一层轻量 CLI,可直接查看 runtime health、queue pressure、governance risk、审批队列、运行状态与可审计证据包。
|
package/dist/acp.js
CHANGED
|
@@ -31,8 +31,8 @@ function toNotification(event) {
|
|
|
31
31
|
eventId: event.eventId,
|
|
32
32
|
eventType: event.eventType,
|
|
33
33
|
timestamp: event.timestamp,
|
|
34
|
-
sessionId: event.
|
|
35
|
-
requestId: event.
|
|
34
|
+
sessionId: event.sessionId,
|
|
35
|
+
requestId: event.requestId,
|
|
36
36
|
sequence: event.sequence,
|
|
37
37
|
source: event.source,
|
|
38
38
|
payload: event.payload,
|
package/dist/api.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export type Approval = {
|
|
|
55
55
|
allowedDecisions: Array<"approve" | "edit" | "reject">;
|
|
56
56
|
inputPreview: Record<string, unknown>;
|
|
57
57
|
};
|
|
58
|
-
export type RequestArtifactListing = Omit<ArtifactListing, "
|
|
58
|
+
export type RequestArtifactListing = Omit<ArtifactListing, "sessionId" | "requestId"> & {
|
|
59
59
|
sessionId: string;
|
|
60
60
|
requestId: string;
|
|
61
61
|
};
|
|
@@ -97,17 +97,17 @@ type PublicApprovalFilter = {
|
|
|
97
97
|
sessionId?: string;
|
|
98
98
|
requestId?: string;
|
|
99
99
|
};
|
|
100
|
-
type PublicRequestStartOptions = Omit<RunStartOptions, "
|
|
100
|
+
type PublicRequestStartOptions = Omit<RunStartOptions, "sessionId" | "listeners"> & {
|
|
101
101
|
sessionId?: string;
|
|
102
102
|
listeners?: PublicRunListeners;
|
|
103
103
|
};
|
|
104
|
-
type PublicRequestDecisionOptions = Omit<RunDecisionOptions, "
|
|
104
|
+
type PublicRequestDecisionOptions = Omit<RunDecisionOptions, "sessionId" | "requestId" | "listeners"> & {
|
|
105
105
|
sessionId: string;
|
|
106
106
|
requestId?: string;
|
|
107
107
|
listeners?: PublicRunListeners;
|
|
108
108
|
};
|
|
109
109
|
type PublicRequestOptions = PublicRequestStartOptions | PublicRequestDecisionOptions;
|
|
110
|
-
type PublicRequestResult = Omit<RunResult, "
|
|
110
|
+
type PublicRequestResult = Omit<RunResult, "sessionId" | "requestId"> & {
|
|
111
111
|
sessionId: string;
|
|
112
112
|
requestId: string;
|
|
113
113
|
};
|
|
@@ -188,13 +188,8 @@ export declare function describeInventory(runtime: AgentHarnessRuntime, options?
|
|
|
188
188
|
workspaceRoot: string;
|
|
189
189
|
agents: InventoryAgentRecord[];
|
|
190
190
|
};
|
|
191
|
-
export declare function resolveApproval(runtime: AgentHarnessRuntime, options: ResumeOptions
|
|
192
|
-
|
|
193
|
-
requestId?: string;
|
|
194
|
-
}): Promise<PublicRunResult>;
|
|
195
|
-
export declare function cancelRun(runtime: AgentHarnessRuntime, options: CancelOptions & {
|
|
196
|
-
requestId?: string;
|
|
197
|
-
}): Promise<PublicRunResult>;
|
|
191
|
+
export declare function resolveApproval(runtime: AgentHarnessRuntime, options: ResumeOptions): Promise<PublicRunResult>;
|
|
192
|
+
export declare function cancelRun(runtime: AgentHarnessRuntime, options: CancelOptions): Promise<PublicRunResult>;
|
|
198
193
|
export declare function stop(runtime: AgentHarnessRuntime): Promise<void>;
|
|
199
194
|
export declare function createToolMcpServer(runtime: AgentHarnessRuntime, options: ToolMcpServerOptions): Promise<import("@modelcontextprotocol/sdk/server/mcp").McpServer>;
|
|
200
195
|
export declare function serveToolsOverStdio(runtime: AgentHarnessRuntime, options: ToolMcpServerOptions): Promise<import("@modelcontextprotocol/sdk/server/mcp").McpServer>;
|
package/dist/api.js
CHANGED
|
@@ -15,8 +15,8 @@ function toApprovalRecord(record) {
|
|
|
15
15
|
return {
|
|
16
16
|
approvalId: record.approvalId,
|
|
17
17
|
pendingActionId: record.pendingActionId,
|
|
18
|
-
sessionId: record.
|
|
19
|
-
requestId: record.
|
|
18
|
+
sessionId: record.sessionId,
|
|
19
|
+
requestId: record.requestId,
|
|
20
20
|
toolName: record.toolName,
|
|
21
21
|
...(record.approvalReason ? { approvalReason: record.approvalReason } : {}),
|
|
22
22
|
status: record.status,
|
|
@@ -47,8 +47,8 @@ function toPublicEvent(event) {
|
|
|
47
47
|
eventId: event.eventId,
|
|
48
48
|
eventType: toPublicEventType(event.eventType),
|
|
49
49
|
timestamp: event.timestamp,
|
|
50
|
-
sessionId: event.
|
|
51
|
-
requestId: event.
|
|
50
|
+
sessionId: event.sessionId,
|
|
51
|
+
requestId: event.requestId,
|
|
52
52
|
sequence: event.sequence,
|
|
53
53
|
source: event.source,
|
|
54
54
|
payload: event.payload,
|
|
@@ -77,8 +77,8 @@ function toPublicRunListeners(listeners) {
|
|
|
77
77
|
onUpstreamEvent: listeners.onUpstreamEvent,
|
|
78
78
|
onTraceItem: listeners.onTraceItem
|
|
79
79
|
? async (item) => listeners.onTraceItem({
|
|
80
|
-
sessionId: item.
|
|
81
|
-
requestId: item.
|
|
80
|
+
sessionId: item.sessionId,
|
|
81
|
+
requestId: item.requestId,
|
|
82
82
|
surfaceItem: item.surfaceItem,
|
|
83
83
|
event: item.event,
|
|
84
84
|
})
|
|
@@ -87,8 +87,8 @@ function toPublicRunListeners(listeners) {
|
|
|
87
87
|
}
|
|
88
88
|
function toRequestArtifactListing(listing) {
|
|
89
89
|
return {
|
|
90
|
-
sessionId: listing.
|
|
91
|
-
requestId: listing.
|
|
90
|
+
sessionId: listing.sessionId,
|
|
91
|
+
requestId: listing.requestId,
|
|
92
92
|
items: listing.items,
|
|
93
93
|
};
|
|
94
94
|
}
|
|
@@ -106,8 +106,8 @@ function toRequestPackage(pkg) {
|
|
|
106
106
|
}
|
|
107
107
|
function toPublicRunResult(result) {
|
|
108
108
|
return {
|
|
109
|
-
sessionId: result.
|
|
110
|
-
requestId: result.
|
|
109
|
+
sessionId: result.sessionId,
|
|
110
|
+
requestId: result.requestId,
|
|
111
111
|
state: result.state,
|
|
112
112
|
output: result.output,
|
|
113
113
|
finalMessageText: result.finalMessageText,
|
|
@@ -130,8 +130,8 @@ function toInternalRunOptions(options) {
|
|
|
130
130
|
decision: options.decision,
|
|
131
131
|
editedInput: options.editedInput,
|
|
132
132
|
listeners: toPublicRunListeners(options.listeners),
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
requestId: options.requestId,
|
|
134
|
+
sessionId: options.sessionId,
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
return {
|
|
@@ -140,7 +140,7 @@ function toInternalRunOptions(options) {
|
|
|
140
140
|
invocation: options.invocation,
|
|
141
141
|
listeners: toPublicRunListeners(options.listeners),
|
|
142
142
|
priority: options.priority,
|
|
143
|
-
|
|
143
|
+
sessionId: options.sessionId,
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
146
|
function toInternalResumeOptions(options) {
|
|
@@ -148,14 +148,14 @@ function toInternalResumeOptions(options) {
|
|
|
148
148
|
approvalId: options.approvalId,
|
|
149
149
|
decision: options.decision,
|
|
150
150
|
editedInput: options.editedInput,
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
requestId: options.requestId,
|
|
152
|
+
sessionId: options.sessionId,
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
155
|
function toPublicRequestSummary(run) {
|
|
156
156
|
return {
|
|
157
|
-
requestId: run.
|
|
158
|
-
sessionId: run.
|
|
157
|
+
requestId: run.requestId,
|
|
158
|
+
sessionId: run.sessionId,
|
|
159
159
|
agentId: run.agentId,
|
|
160
160
|
parentRunId: run.parentRunId,
|
|
161
161
|
executionMode: run.executionMode,
|
|
@@ -270,9 +270,9 @@ export async function deleteSession(runtime, sessionId) {
|
|
|
270
270
|
}
|
|
271
271
|
export async function listApprovals(runtime, filter) {
|
|
272
272
|
return (await runtime.listApprovals({
|
|
273
|
-
|
|
273
|
+
requestId: filter?.requestId,
|
|
274
274
|
status: filter?.status,
|
|
275
|
-
|
|
275
|
+
sessionId: filter?.sessionId,
|
|
276
276
|
})).map(toApprovalRecord);
|
|
277
277
|
}
|
|
278
278
|
export async function getApproval(runtime, approvalId) {
|
|
@@ -363,10 +363,7 @@ export async function resolveApproval(runtime, options) {
|
|
|
363
363
|
return toPublicRunResult(await runtime.resume(toInternalResumeOptions(options)));
|
|
364
364
|
}
|
|
365
365
|
export async function cancelRun(runtime, options) {
|
|
366
|
-
return toPublicRunResult(await runtime.cancelRun(
|
|
367
|
-
...options,
|
|
368
|
-
runId: options.requestId ?? options.runId,
|
|
369
|
-
}));
|
|
366
|
+
return toPublicRunResult(await runtime.cancelRun(options));
|
|
370
367
|
}
|
|
371
368
|
export async function stop(runtime) {
|
|
372
369
|
return runtime.stop();
|
|
@@ -25,17 +25,8 @@ export type SessionListSummary = SessionSummary & {
|
|
|
25
25
|
title?: string;
|
|
26
26
|
snippet?: string;
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*/
|
|
31
|
-
export type ThreadSummary = Omit<SessionSummary, "sessionId" | "latestRequestId"> & {
|
|
32
|
-
threadId: string;
|
|
33
|
-
latestRunId: string;
|
|
34
|
-
};
|
|
35
|
-
export type ThreadListSummary = Omit<SessionListSummary, "sessionId" | "latestRequestId"> & {
|
|
36
|
-
threadId: string;
|
|
37
|
-
latestRunId: string;
|
|
38
|
-
};
|
|
28
|
+
export type ThreadSummary = SessionSummary;
|
|
29
|
+
export type ThreadListSummary = SessionListSummary;
|
|
39
30
|
export type KnownHarnessEventType = "run.created" | "run.queued" | "run.dequeued" | "run.state.changed" | "run.resumed" | "approval.requested" | "approval.resolved" | "artifact.created" | "output.delta" | "runtime.health.changed" | "runtime.synthetic_fallback";
|
|
40
31
|
export type HarnessEventType = KnownHarnessEventType | (string & {});
|
|
41
32
|
/**
|
|
@@ -47,8 +38,8 @@ export type HarnessEvent = {
|
|
|
47
38
|
eventId: string;
|
|
48
39
|
eventType: HarnessEventType;
|
|
49
40
|
timestamp: string;
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
sessionId: string;
|
|
42
|
+
requestId: string;
|
|
52
43
|
sequence: number;
|
|
53
44
|
source: "runtime" | "policy" | "surface" | "worker";
|
|
54
45
|
payload: Record<string, unknown>;
|
|
@@ -65,8 +56,8 @@ export type HarnessEventProjection = {
|
|
|
65
56
|
*/
|
|
66
57
|
export type RuntimeTimelineItem = {
|
|
67
58
|
eventId: string;
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
sessionId: string;
|
|
60
|
+
requestId: string;
|
|
70
61
|
eventType: HarnessEventType;
|
|
71
62
|
timestamp: string;
|
|
72
63
|
sequence: number;
|
|
@@ -75,8 +66,8 @@ export type RuntimeTimelineItem = {
|
|
|
75
66
|
payload: Record<string, unknown>;
|
|
76
67
|
};
|
|
77
68
|
export type RuntimeTimelineProjectionOptions = {
|
|
78
|
-
|
|
79
|
-
|
|
69
|
+
sessionId?: string;
|
|
70
|
+
requestId?: string;
|
|
80
71
|
};
|
|
81
72
|
/**
|
|
82
73
|
* Ordered upstream/runtime execution trace projected from persisted upstream events.
|
|
@@ -128,6 +119,8 @@ export type RuntimeGovernanceDiagnostics = {
|
|
|
128
119
|
runsWithGovernance: number;
|
|
129
120
|
highRiskTools: number;
|
|
130
121
|
approvalRequiredTools: number;
|
|
122
|
+
autoApprovedTools: number;
|
|
123
|
+
autoRejectedTools: number;
|
|
131
124
|
untrustedMcpTools: number;
|
|
132
125
|
crossTenantTools: number;
|
|
133
126
|
writeAccessMcpTools: number;
|
|
@@ -178,6 +171,7 @@ export type RuntimeSnapshotTracing = {
|
|
|
178
171
|
metadata?: Record<string, unknown>;
|
|
179
172
|
};
|
|
180
173
|
export type RuntimeGovernanceRiskLevel = "low" | "medium" | "high";
|
|
174
|
+
export type RuntimeGovernanceDecisionMode = "none" | "manual" | "auto-approve" | "auto-reject" | "deny-and-continue";
|
|
181
175
|
export type RuntimeGovernanceToolPolicy = {
|
|
182
176
|
toolName: string;
|
|
183
177
|
toolId: string;
|
|
@@ -194,6 +188,7 @@ export type RuntimeGovernanceToolPolicy = {
|
|
|
194
188
|
risk: RuntimeGovernanceRiskLevel;
|
|
195
189
|
requiresApproval: boolean;
|
|
196
190
|
approvalPolicy: "explicit-hitl" | "runtime-default" | "none";
|
|
191
|
+
decisionMode: RuntimeGovernanceDecisionMode;
|
|
197
192
|
hasInputSchema: boolean;
|
|
198
193
|
inputRiskHints: string[];
|
|
199
194
|
};
|
|
@@ -281,8 +276,6 @@ export type MemorizeInput = {
|
|
|
281
276
|
records: MemorizeInputRecord[];
|
|
282
277
|
sessionId?: string;
|
|
283
278
|
requestId?: string;
|
|
284
|
-
threadId?: string;
|
|
285
|
-
runId?: string;
|
|
286
279
|
agentId?: string;
|
|
287
280
|
userId?: string;
|
|
288
281
|
projectId?: string;
|
|
@@ -299,7 +292,6 @@ export type RecallInput = {
|
|
|
299
292
|
topK?: number;
|
|
300
293
|
includeStale?: boolean;
|
|
301
294
|
sessionId?: string;
|
|
302
|
-
threadId?: string;
|
|
303
295
|
agentId?: string;
|
|
304
296
|
workspaceId?: string;
|
|
305
297
|
userId?: string;
|
|
@@ -313,7 +305,6 @@ export type ListMemoriesInput = {
|
|
|
313
305
|
kinds?: MemoryKind[];
|
|
314
306
|
status?: MemoryRecordStatus[];
|
|
315
307
|
sessionId?: string;
|
|
316
|
-
threadId?: string;
|
|
317
308
|
agentId?: string;
|
|
318
309
|
workspaceId?: string;
|
|
319
310
|
userId?: string;
|
|
@@ -411,8 +402,8 @@ export type RuntimeHealthSnapshot = {
|
|
|
411
402
|
};
|
|
412
403
|
};
|
|
413
404
|
export type RunResult = {
|
|
414
|
-
|
|
415
|
-
|
|
405
|
+
sessionId: string;
|
|
406
|
+
requestId: string;
|
|
416
407
|
state: RunState;
|
|
417
408
|
output: string;
|
|
418
409
|
finalMessageText?: string;
|
|
@@ -429,8 +420,8 @@ export type RunResult = {
|
|
|
429
420
|
};
|
|
430
421
|
export type UpstreamRuntimeEvent = unknown;
|
|
431
422
|
export type UpstreamRuntimeEventItem = {
|
|
432
|
-
|
|
433
|
-
|
|
423
|
+
sessionId: string;
|
|
424
|
+
requestId: string;
|
|
434
425
|
surfaceItem: RuntimeSurfaceItem;
|
|
435
426
|
event: UpstreamRuntimeEvent;
|
|
436
427
|
};
|
|
@@ -457,14 +448,14 @@ export type InvocationEnvelope = {
|
|
|
457
448
|
export type RunStartOptions = {
|
|
458
449
|
agentId?: string;
|
|
459
450
|
input: MessageContent;
|
|
460
|
-
|
|
451
|
+
sessionId?: string;
|
|
461
452
|
priority?: number;
|
|
462
453
|
invocation?: InvocationEnvelope;
|
|
463
454
|
listeners?: RunListeners;
|
|
464
455
|
};
|
|
465
456
|
export type RunDecisionOptions = {
|
|
466
|
-
|
|
467
|
-
|
|
457
|
+
sessionId: string;
|
|
458
|
+
requestId?: string;
|
|
468
459
|
approvalId?: string;
|
|
469
460
|
decision: "approve" | "edit" | "reject";
|
|
470
461
|
editedInput?: Record<string, unknown>;
|
|
@@ -476,28 +467,28 @@ export type HarnessStreamItem = {
|
|
|
476
467
|
event: HarnessEvent;
|
|
477
468
|
} | {
|
|
478
469
|
type: "content";
|
|
479
|
-
|
|
480
|
-
|
|
470
|
+
sessionId: string;
|
|
471
|
+
requestId: string;
|
|
481
472
|
agentId: string;
|
|
482
473
|
content: string;
|
|
483
474
|
} | {
|
|
484
475
|
type: "content-blocks";
|
|
485
|
-
|
|
486
|
-
|
|
476
|
+
sessionId: string;
|
|
477
|
+
requestId: string;
|
|
487
478
|
agentId: string;
|
|
488
479
|
contentBlocks: unknown[];
|
|
489
480
|
} | {
|
|
490
481
|
type: "tool-result";
|
|
491
|
-
|
|
492
|
-
|
|
482
|
+
sessionId: string;
|
|
483
|
+
requestId: string;
|
|
493
484
|
agentId: string;
|
|
494
485
|
toolName: string;
|
|
495
486
|
output: unknown;
|
|
496
487
|
isError?: boolean;
|
|
497
488
|
} | {
|
|
498
489
|
type: "upstream-event";
|
|
499
|
-
|
|
500
|
-
|
|
490
|
+
sessionId: string;
|
|
491
|
+
requestId: string;
|
|
501
492
|
surfaceItem?: RuntimeSurfaceItem;
|
|
502
493
|
event: UpstreamRuntimeEvent;
|
|
503
494
|
} | {
|
|
@@ -507,12 +498,12 @@ export type HarnessStreamItem = {
|
|
|
507
498
|
export type TranscriptMessage = {
|
|
508
499
|
role: "user" | "assistant";
|
|
509
500
|
content: MessageContent;
|
|
510
|
-
|
|
501
|
+
requestId: string;
|
|
511
502
|
createdAt: string;
|
|
512
503
|
};
|
|
513
504
|
export type ThreadRunRecord = {
|
|
514
|
-
|
|
515
|
-
|
|
505
|
+
requestId: string;
|
|
506
|
+
sessionId: string;
|
|
516
507
|
agentId: string;
|
|
517
508
|
parentRunId?: string;
|
|
518
509
|
executionMode: string;
|
|
@@ -533,25 +524,13 @@ export type ThreadRunRecord = {
|
|
|
533
524
|
* Persisted request summary projected from upstream execution state plus runtime lifecycle metadata.
|
|
534
525
|
* This is the canonical runtime-facing execution record.
|
|
535
526
|
*/
|
|
536
|
-
export type RequestSummary =
|
|
537
|
-
sessionId: string;
|
|
538
|
-
requestId: string;
|
|
539
|
-
};
|
|
527
|
+
export type RequestSummary = ThreadRunRecord;
|
|
540
528
|
export type RequestRecord = RequestSummary & {
|
|
541
529
|
traceItems?: unknown[];
|
|
542
530
|
runtimeTimeline?: RuntimeTimelineItem[];
|
|
543
531
|
};
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
*/
|
|
547
|
-
export type RunSummary = Omit<RequestSummary, "sessionId" | "requestId"> & {
|
|
548
|
-
threadId: string;
|
|
549
|
-
runId: string;
|
|
550
|
-
};
|
|
551
|
-
export type RunRecord = RunSummary & {
|
|
552
|
-
traceItems?: unknown[];
|
|
553
|
-
runtimeTimeline?: RuntimeTimelineItem[];
|
|
554
|
-
};
|
|
532
|
+
export type RunSummary = RequestSummary;
|
|
533
|
+
export type RunRecord = RequestRecord;
|
|
555
534
|
/**
|
|
556
535
|
* Persisted session inspection record assembled from runtime records.
|
|
557
536
|
* This is an inspectable projection, not a second session semantic model.
|
|
@@ -574,27 +553,20 @@ export type SessionRecord = {
|
|
|
574
553
|
requestedAt: string;
|
|
575
554
|
};
|
|
576
555
|
};
|
|
577
|
-
|
|
578
|
-
* Backward-compatible alias for older thread/run terminology.
|
|
579
|
-
*/
|
|
580
|
-
export type ThreadRecord = Omit<SessionRecord, "sessionId" | "latestRequestId" | "requests"> & {
|
|
581
|
-
threadId: string;
|
|
582
|
-
latestRunId: string;
|
|
583
|
-
runs: RunRecord[];
|
|
584
|
-
};
|
|
556
|
+
export type ThreadRecord = SessionRecord;
|
|
585
557
|
export type ResumeOptions = {
|
|
586
|
-
|
|
587
|
-
|
|
558
|
+
sessionId?: string;
|
|
559
|
+
requestId?: string;
|
|
588
560
|
approvalId?: string;
|
|
589
561
|
decision?: "approve" | "edit" | "reject";
|
|
590
562
|
editedInput?: Record<string, unknown>;
|
|
591
563
|
};
|
|
592
564
|
export type CancelOptions = {
|
|
593
|
-
|
|
565
|
+
requestId: string;
|
|
594
566
|
reason?: string;
|
|
595
567
|
};
|
|
596
568
|
export type RestartConversationOptions = {
|
|
597
|
-
|
|
569
|
+
sessionId: string;
|
|
598
570
|
mode: "restart-in-thread" | "restart-new-thread";
|
|
599
571
|
input: string;
|
|
600
572
|
};
|
|
@@ -606,8 +578,8 @@ export type RestartConversationOptions = {
|
|
|
606
578
|
export type ApprovalRecord = {
|
|
607
579
|
approvalId: string;
|
|
608
580
|
pendingActionId: string;
|
|
609
|
-
|
|
610
|
-
|
|
581
|
+
sessionId: string;
|
|
582
|
+
requestId: string;
|
|
611
583
|
toolName: string;
|
|
612
584
|
approvalReason?: string;
|
|
613
585
|
status: "pending" | "approved" | "edited" | "rejected" | "expired";
|
|
@@ -628,8 +600,8 @@ export type ArtifactRecord = {
|
|
|
628
600
|
createdAt: string;
|
|
629
601
|
};
|
|
630
602
|
export type ArtifactListing = {
|
|
631
|
-
|
|
632
|
-
|
|
603
|
+
sessionId: string;
|
|
604
|
+
requestId: string;
|
|
633
605
|
items: ArtifactRecord[];
|
|
634
606
|
};
|
|
635
607
|
export type RuntimeToolResolver = (toolIds: string[], binding?: CompiledAgentBinding) => unknown[];
|