@botbotgo/agent-harness 0.0.251 → 0.0.253

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 (46) hide show
  1. package/README.md +13 -14
  2. package/README.zh.md +11 -12
  3. package/dist/api.d.ts +13 -6
  4. package/dist/api.js +70 -6
  5. package/dist/config/agents/direct.yaml +3 -3
  6. package/dist/config/agents/orchestra.yaml +3 -3
  7. package/dist/config/catalogs/stores.yaml +3 -9
  8. package/dist/config/runtime/workspace.yaml +1 -2
  9. package/dist/contracts/runtime.d.ts +9 -14
  10. package/dist/flow/build-flow-graph.js +198 -67
  11. package/dist/flow/export-mermaid.js +314 -4
  12. package/dist/flow/export-sequence-mermaid.js +149 -2
  13. package/dist/flow/types.d.ts +11 -1
  14. package/dist/index.d.ts +2 -3
  15. package/dist/index.js +1 -1
  16. package/dist/package-version.d.ts +1 -1
  17. package/dist/package-version.js +1 -1
  18. package/dist/persistence/file-store.d.ts +3 -2
  19. package/dist/persistence/file-store.js +34 -8
  20. package/dist/persistence/sqlite-store.d.ts +2 -2
  21. package/dist/persistence/sqlite-store.js +64 -11
  22. package/dist/persistence/types.d.ts +3 -3
  23. package/dist/protocol/a2a/http.js +2 -4
  24. package/dist/resource/isolation.js +30 -2
  25. package/dist/runtime/harness/events/streaming.js +8 -8
  26. package/dist/runtime/harness/run/inspection.d.ts +2 -0
  27. package/dist/runtime/harness/run/inspection.js +91 -46
  28. package/dist/runtime/harness/run/stream-run.d.ts +2 -2
  29. package/dist/runtime/harness/run/stream-run.js +34 -23
  30. package/dist/runtime/harness/run/surface-semantics.d.ts +14 -0
  31. package/dist/runtime/harness/run/surface-semantics.js +106 -0
  32. package/dist/runtime/harness/run/thread-records.js +2 -34
  33. package/dist/runtime/harness/system/store.d.ts +6 -4
  34. package/dist/runtime/harness/system/store.js +76 -42
  35. package/dist/runtime/harness.js +5 -7
  36. package/dist/runtime/maintenance/checkpoint-maintenance.js +4 -119
  37. package/dist/runtime/maintenance/index.d.ts +0 -1
  38. package/dist/runtime/maintenance/index.js +0 -1
  39. package/dist/runtime/support/runtime-factories.js +2 -42
  40. package/dist/upstream-events.js +14 -0
  41. package/dist/utils/fs.js +3 -0
  42. package/package.json +1 -3
  43. package/dist/runtime/maintenance/sqlite-maintained-checkpoint-saver.d.ts +0 -9
  44. package/dist/runtime/maintenance/sqlite-maintained-checkpoint-saver.js +0 -39
  45. package/dist/runtime/support/sqlite-drivers.d.ts +0 -12
  46. package/dist/runtime/support/sqlite-drivers.js +0 -24
package/README.md CHANGED
@@ -580,14 +580,14 @@ const result = await request(runtime, {
580
580
  onUpstreamEvent(event) {
581
581
  console.log("raw upstream event", event);
582
582
  },
583
- onUpstreamItem(item) {
583
+ onTraceItem(item) {
584
584
  console.log("upstream agent", item.agentId, item.event);
585
585
  },
586
586
  },
587
587
  });
588
588
  ```
589
589
 
590
- `onUpstreamEvent(...)` preserves the raw upstream event payload. `onUpstreamItem(...)` adds runtime correlation metadata such as `sessionId`, `requestId`, and the current `agentId`, which is useful for flow-graph capture and delegated sub-agent inspection.
590
+ `onUpstreamEvent(...)` preserves the raw upstream event payload. `onTraceItem(...)` adds runtime correlation metadata such as `sessionId`, `requestId`, and the current `agentId`, which is useful for flow-graph capture and delegated sub-agent inspection.
591
591
 
592
592
  `subscribe(...)` is the read-only observer surface over stored lifecycle events.
593
593
 
@@ -703,6 +703,8 @@ Discovery rules:
703
703
  Example workspaces:
704
704
 
705
705
  - `examples/hello-skill-app/` keeps the smallest local tool + skill workspace
706
+ - `examples/multimodal-app/` keeps the smallest image-plus-PDF example and sends both through one `request(...)` call
707
+ - `examples/plan-and-run-app/` keeps the smallest public-API planning example and prints both the plan and the observed execution steps
706
708
  - `examples/runtime-flow-demo/` runs one real hosted-model request and exports a Mermaid flowchart from runtime plus upstream events
707
709
  - `examples/protocol-hello-world/` shows the same minimal direct agent wired to ACP, A2A, and AG-UI hello-world transport samples
708
710
 
@@ -835,11 +837,8 @@ spec:
835
837
  path: store.sqlite
836
838
  - kind: Checkpointer
837
839
  name: default
838
- checkpointerKind: MemorySaver
839
- - kind: Checkpointer
840
- name: sqlite
841
- checkpointerKind: SqliteSaver
842
- path: checkpoints.sqlite
840
+ checkpointerKind: FileCheckpointer
841
+ path: checkpoints.json
843
842
  ```
844
843
 
845
844
  ### `config/runtime/runtime-memory.yaml`
@@ -1017,6 +1016,7 @@ Primary exports:
1017
1016
  - `listArtifacts`
1018
1017
  - `getArtifact`
1019
1018
  - `listRequestEvents`
1019
+ - `listRequestTraceItems`
1020
1020
  - `exportRequestPackage`
1021
1021
  - `exportSessionPackage`
1022
1022
  - `exportEvaluationBundle`
@@ -1033,16 +1033,15 @@ Primary exports:
1033
1033
  - `serveToolsOverStdio`
1034
1034
  - `stop`
1035
1035
  - `createUpstreamTimelineReducer`
1036
- - `buildFlowGraph`
1037
- - `exportFlowGraphToMermaid`
1038
- - `exportFlowGraphToSequenceMermaid`
1036
+ - `exportFlow`
1037
+ - `exportSequence`
1039
1038
 
1040
1039
  Inspection helpers:
1041
1040
 
1042
1041
  - `createUpstreamTimelineReducer()` reduces raw upstream model/tool/chain events into ordered step-like projections for inspection and visualization.
1043
- - `buildFlowGraph(...)` combines persisted runtime timeline items with optional upstream projections into a detailed flow graph utility shape, including best-effort delegated subagent transitions when raw upstream events are available.
1044
- - `exportFlowGraphToMermaid(...)` renders that inspection graph as Mermaid flowchart text. By default it emits the product view: agent and sub-agent delegation plus user-defined model, tool, and skill calls. Use `view: "debug"` to include runtime inspection detail.
1045
- - `exportFlowGraphToSequenceMermaid(...)` renders the same inspection graph as a Mermaid sequence diagram. By default it emits only user-defined participants and calls, while `view: "debug"` includes runtime participants and lifecycle messages.
1042
+ - `listRequestTraceItems(runtime, { sessionId, requestId })` returns the persisted request trace items that back runtime diagrams and post-run inspection. Each trace item carries the normalized runtime surface record plus the source upstream event.
1043
+ - `exportFlow(runtime, { sessionId, requestId })` loads one persisted request record from the runtime and renders it as Mermaid flowchart text. It uses the built-in product view defaults for direction, grouping, and visible kinds so callers do not need to carry visualization options in normal product code.
1044
+ - `exportSequence(runtime, { sessionId, requestId })` loads the same persisted request record and renders it as a Mermaid sequence diagram for the same persisted trace-backed request.
1046
1045
 
1047
1046
  These helpers are visualization and inspection utilities. They do not introduce a canonical harness-owned execution protocol.
1048
1047
 
@@ -1055,7 +1054,7 @@ ACP transport notes:
1055
1054
  - `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, sets `capabilities.streaming = true` plus `capabilities.pushNotifications = true`, 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.
1056
1055
  - `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.
1057
1056
  - `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.
1058
- - `listRequestEvents(...)` and `exportRequestPackage(...)` are the request-first inspection helpers.
1057
+ - `listRequestEvents(...)`, `listRequestTraceItems(...)`, and `exportRequestPackage(...)` are the request-first inspection helpers.
1059
1058
  - `exportRequestPackage(...)` and `exportSessionPackage(...)` package stable runtime records, transcript, approvals, events, artifacts, and governance evidence for operator tooling without reaching into persistence internals.
1060
1059
  - `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.
1061
1060
  - 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.
package/README.zh.md CHANGED
@@ -666,6 +666,8 @@ await stop(runtime);
666
666
  示例工作区:
667
667
 
668
668
  - `examples/hello-skill-app/` 保留最小的本地 tool + skill 工作区
669
+ - `examples/multimodal-app/` 保留最小的图片 + PDF 示例,并通过一次 `request(...)` 调用发送
670
+ - `examples/plan-and-run-app/` 保留最小的公开 API 规划示例,并同时打印规划步骤和真实执行步骤
669
671
  - `examples/runtime-flow-demo/` 会跑一次真实 hosted model 请求,并把 runtime 与 upstream events 导出为 Mermaid flowchart
670
672
  - `examples/protocol-hello-world/` 展示同一个最小 direct agent 的 ACP、A2A 与 AG-UI 三种 hello-world 传输示例
671
673
 
@@ -795,11 +797,8 @@ spec:
795
797
  path: store.sqlite
796
798
  - kind: Checkpointer
797
799
  name: default
798
- checkpointerKind: MemorySaver
799
- - kind: Checkpointer
800
- name: sqlite
801
- checkpointerKind: SqliteSaver
802
- path: checkpoints.sqlite
800
+ checkpointerKind: FileCheckpointer
801
+ path: checkpoints.json
803
802
  ```
804
803
 
805
804
  ### `config/runtime/runtime-memory.yaml`
@@ -975,6 +974,7 @@ spec:
975
974
  - `listArtifacts`
976
975
  - `getArtifact`
977
976
  - `listRequestEvents`
977
+ - `listRequestTraceItems`
978
978
  - `exportRequestPackage`
979
979
  - `exportSessionPackage`
980
980
  - `exportEvaluationBundle`
@@ -991,16 +991,15 @@ spec:
991
991
  - `serveToolsOverStdio`
992
992
  - `stop`
993
993
  - `createUpstreamTimelineReducer`
994
- - `buildFlowGraph`
995
- - `exportFlowGraphToMermaid`
996
- - `exportFlowGraphToSequenceMermaid`
994
+ - `exportFlow`
995
+ - `exportSequence`
997
996
 
998
997
  Inspection 辅助工具:
999
998
 
1000
999
  - `createUpstreamTimelineReducer()` 可把上游 model/tool/chain 原始事件归约成有序的 step-like 投影,便于检查和可视化。
1001
- - `buildFlowGraph(...)` 可把持久化 runtime timeline 与可选的 upstream projections 组合成详细 flow graph utility 数据结构;当提供原始 upstream events 时,也会尽力补出 subagent delegation 转移。
1002
- - `exportFlowGraphToMermaid(...)` 可把该 inspection graph 导出为 Mermaid flowchart 文本。默认输出 product 视图,只保留 agent / sub-agent delegation 以及用户定义的 model、tool、skill 调用;传 `view: "debug"` 才会带上 runtime 检查细节。
1003
- - `exportFlowGraphToSequenceMermaid(...)` 可把同一份 inspection graph 导出为 Mermaid sequence diagram。默认只输出用户定义的参与者与调用;传 `view: "debug"` 才会包含 runtime participant 与生命周期消息。
1000
+ - `listRequestTraceItems(runtime, { sessionId, requestId })` 可直接读取持久化的 request trace items。这些 trace item 是运行图和运行后检查的基础数据,每条记录都同时带有规范化后的 runtime surface 与来源 upstream event。
1001
+ - `exportFlow(runtime, { sessionId, requestId })` 可直接从 runtime 读取单个持久化 request record,并导出成 Mermaid flowchart 文本。它内建产品视图默认值,直接固定方向、分组与可见 kind,调用方不需要再额外传一套可视化参数。
1002
+ - `exportSequence(runtime, { sessionId, requestId })` 可从同一份持久化 request record 导出 Mermaid sequence diagram,并与同一份持久化 trace 对齐。
1004
1003
 
1005
1004
  这些 helper 只用于可视化与检查,不代表新的 harness 官方执行协议。
1006
1005
 
@@ -1013,7 +1012,7 @@ ACP transport 说明:
1013
1012
  - `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、把 `capabilities.streaming` 和 `capabilities.pushNotifications` 都设为 `true`、校验 `A2A-Version`、把 `A2A-Extensions` 记录进 runtime invocation metadata、发布 `TASK_STATE_*` 状态与 `SendMessage` 的 `{ task }` wrapper、在 v1 streaming 方法上先通过 SSE 输出 `{ task }` 初始快照,再输出 `{ statusUpdate }` 增量状态,并可向已配置的 webhook receiver 发送 best-effort task push notifications。
1014
1013
  - `serveAgUiHttp(runtime)` 提供 AG-UI HTTP SSE bridge,把 runtime 生命周期、文本输出、upstream thinking、step 进度与 tool call 投影成 `RUN_*`、`TEXT_MESSAGE_*`、`THINKING_TEXT_MESSAGE_*`、`STEP_*` 与 `TOOL_CALL_*` 事件,便于 UI 客户端直接接入。
1015
1014
  - `createRuntimeMcpServer(runtime)` 与 `serveRuntimeMcpOverStdio(runtime)` 会把持久化 runtime 控制面本身暴露成 MCP tools,包括 sessions、requests、approvals、artifacts、events 与 package export helpers。
1016
- - `listRequestEvents(...)` 与 `exportRequestPackage(...)` 是 request-first 的检查 helper。
1015
+ - `listRequestEvents(...)`、`listRequestTraceItems(...)` 与 `exportRequestPackage(...)` 是 request-first 的检查 helper。
1017
1016
  - `exportRequestPackage(...)` 与 `exportSessionPackage(...)` 可把稳定 runtime 记录、transcript、approvals、events、artifacts 与 governance evidence 一起打包给管理工具,而不必直接访问 persistence 内部实现。
1018
1017
  - `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 元数据,让治理快照能解释为什么某个远端工具被视为高风险。
1019
1018
  - 协议分工要继续保持清晰:ACP 是 editor / client 的主运行时边界,A2A 是支持 streaming 且兼容轮询的 agent-platform bridge,AG-UI 是 UI 事件面,runtime MCP 是以 MCP tools 暴露的 operator control plane。
package/dist/api.d.ts CHANGED
@@ -7,7 +7,6 @@ export { AgentHarnessAcpServer, createAcpServer } from "./acp.js";
7
7
  export { createAcpStdioClient } from "./protocol/acp/client.js";
8
8
  export type { AcpApproval, AcpArtifact, AcpEventNotification, AcpJsonRpcError, AcpJsonRpcRequest, AcpJsonRpcResponse, AcpJsonRpcSuccess, AcpRequestRecord, AcpRunRequestParams, AcpServerCapabilities, AcpSessionRecord, } from "./acp.js";
9
9
  export { AgentHarnessRuntime } from "./runtime/harness.js";
10
- export { buildFlowGraph, exportFlowGraphToMermaid, exportFlowGraphToSequenceMermaid } from "./flow/index.js";
11
10
  export { createUpstreamTimelineReducer } from "./upstream-events.js";
12
11
  export type { ListMemoriesInput, ListMemoriesResult, MemoryDecision, MemoryKind, MemoryRecord, MemoryScope, MemorizeInput, MemorizeResult, RecallInput, RecallResult, RemoveMemoryInput, RuntimeEvaluationExport, RuntimeEvaluationExportInput, RuntimeEvaluationReplayInput, SessionListSummary, RuntimeSessionPackageInput, RuntimeSessionPackage, UpdateMemoryInput, } from "./contracts/types.js";
13
12
  export type { AcpHttpServer, AcpHttpServerOptions } from "./protocol/acp/http.js";
@@ -28,18 +27,20 @@ export type RequestEvent = {
28
27
  source: "runtime" | "policy" | "surface" | "worker";
29
28
  payload: Record<string, unknown>;
30
29
  };
31
- export type RequestUpstreamEventItem = {
30
+ export type RequestTraceItem = {
32
31
  sessionId: string;
33
32
  requestId: string;
34
- agentId: string;
35
- agentName?: string;
36
- surfaceItems?: import("./contracts/types.js").RuntimeSurfaceItem[];
33
+ surfaceItem: import("./contracts/types.js").RuntimeSurfaceItem;
37
34
  event: unknown;
38
35
  };
36
+ export type RequestFlowGraphInput = {
37
+ sessionId: string;
38
+ requestId: string;
39
+ };
39
40
  export type PublicRunListeners = {
40
41
  onEvent?: (event: RequestEvent) => void | Promise<void>;
41
42
  onUpstreamEvent?: RunListeners["onUpstreamEvent"];
42
- onUpstreamItem?: (item: RequestUpstreamEventItem) => void | Promise<void>;
43
+ onTraceItem?: (item: RequestTraceItem) => void | Promise<void>;
43
44
  };
44
45
  export type Approval = {
45
46
  approvalId: string;
@@ -147,6 +148,8 @@ export declare function listRequests(runtime: AgentHarnessRuntime, filter?: {
147
148
  }): Promise<RequestSummary[]>;
148
149
  export declare function getSession(runtime: AgentHarnessRuntime, sessionId: string): Promise<SessionRecord | null>;
149
150
  export declare function getRequest(runtime: AgentHarnessRuntime, requestId: string): Promise<RequestRecord | null>;
151
+ export declare function exportFlow(runtime: AgentHarnessRuntime, input: RequestFlowGraphInput): Promise<string>;
152
+ export declare function exportSequence(runtime: AgentHarnessRuntime, input: RequestFlowGraphInput): Promise<string>;
150
153
  export declare function deleteSession(runtime: AgentHarnessRuntime, sessionId: string): Promise<boolean>;
151
154
  export declare function listApprovals(runtime: AgentHarnessRuntime, filter?: PublicApprovalFilter): Promise<Approval[]>;
152
155
  export declare function getApproval(runtime: AgentHarnessRuntime, approvalId: string): Promise<Approval | null>;
@@ -163,6 +166,10 @@ export declare function listRequestEvents(runtime: AgentHarnessRuntime, input: {
163
166
  sessionId: string;
164
167
  requestId: string;
165
168
  }): Promise<RequestEvent[]>;
169
+ export declare function listRequestTraceItems(runtime: AgentHarnessRuntime, input: {
170
+ sessionId: string;
171
+ requestId: string;
172
+ }): Promise<RequestTraceItem[]>;
166
173
  export declare function getHealth(runtime: AgentHarnessRuntime): Promise<RuntimeHealthSnapshot>;
167
174
  export declare function getOperatorOverview(runtime: AgentHarnessRuntime, options?: {
168
175
  limit?: number;
package/dist/api.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { AgentHarnessRuntime } from "./runtime/harness.js";
2
+ import { buildFlowGraph, exportFlowGraphToMermaid as exportFlowGraphFromGraph, exportFlowGraphToSequenceMermaid as exportSequenceGraphFromGraph, } from "./flow/index.js";
2
3
  import { serveA2aOverHttp } from "./protocol/a2a/http.js";
3
4
  import { serveAgUiOverHttp } from "./protocol/ag-ui/http.js";
4
5
  import { serveAcpOverHttp } from "./protocol/acp/http.js";
@@ -8,7 +9,6 @@ import { loadWorkspace } from "./workspace/compile.js";
8
9
  export { AgentHarnessAcpServer, createAcpServer } from "./acp.js";
9
10
  export { createAcpStdioClient } from "./protocol/acp/client.js";
10
11
  export { AgentHarnessRuntime } from "./runtime/harness.js";
11
- export { buildFlowGraph, exportFlowGraphToMermaid, exportFlowGraphToSequenceMermaid } from "./flow/index.js";
12
12
  export { createUpstreamTimelineReducer } from "./upstream-events.js";
13
13
  function toApprovalRecord(record) {
14
14
  return {
@@ -53,6 +53,20 @@ function toPublicEvent(event) {
53
53
  payload: event.payload,
54
54
  };
55
55
  }
56
+ function toPublicTraceItem(input) {
57
+ const typed = typeof input.item === "object" && input.item !== null
58
+ ? input.item
59
+ : null;
60
+ if (!typed?.surfaceItem) {
61
+ return null;
62
+ }
63
+ return {
64
+ sessionId: input.sessionId,
65
+ requestId: input.requestId,
66
+ surfaceItem: typed.surfaceItem,
67
+ event: typed.event,
68
+ };
69
+ }
56
70
  function toPublicRunListeners(listeners) {
57
71
  if (!listeners) {
58
72
  return undefined;
@@ -60,13 +74,11 @@ function toPublicRunListeners(listeners) {
60
74
  return {
61
75
  onEvent: listeners.onEvent ? async (event) => listeners.onEvent(toPublicEvent(event)) : undefined,
62
76
  onUpstreamEvent: listeners.onUpstreamEvent,
63
- onUpstreamItem: listeners.onUpstreamItem
64
- ? async (item) => listeners.onUpstreamItem({
77
+ onTraceItem: listeners.onTraceItem
78
+ ? async (item) => listeners.onTraceItem({
65
79
  sessionId: item.threadId,
66
80
  requestId: item.runId,
67
- agentId: item.agentId,
68
- agentName: item.agentName,
69
- surfaceItems: item.surfaceItems,
81
+ surfaceItem: item.surfaceItem,
70
82
  event: item.event,
71
83
  })
72
84
  : undefined,
@@ -210,6 +222,42 @@ export async function getSession(runtime, sessionId) {
210
222
  export async function getRequest(runtime, requestId) {
211
223
  return runtime.getRequest(requestId);
212
224
  }
225
+ async function buildRequestFlowGraph(runtime, input) {
226
+ const request = await runtime.getRequest(input.requestId);
227
+ if (!request) {
228
+ throw new Error(`Request ${input.requestId} was not found.`);
229
+ }
230
+ if (request.sessionId !== input.sessionId) {
231
+ throw new Error(`Request ${input.requestId} belongs to session ${request.sessionId}, not ${input.sessionId}.`);
232
+ }
233
+ const traceItems = (request.traceItems ?? [])
234
+ .map((item) => toPublicTraceItem({
235
+ sessionId: input.sessionId,
236
+ requestId: input.requestId,
237
+ item,
238
+ }))
239
+ .filter((item) => item !== null);
240
+ return buildFlowGraph({
241
+ sessionId: input.sessionId,
242
+ requestId: input.requestId,
243
+ runtimeTimeline: request.runtimeTimeline,
244
+ upstreamEvents: traceItems,
245
+ metadata: {
246
+ state: request.state,
247
+ ...(request.runtimeSnapshot ? { runtimeSnapshot: request.runtimeSnapshot } : {}),
248
+ },
249
+ });
250
+ }
251
+ export async function exportFlow(runtime, input) {
252
+ return exportFlowGraphFromGraph(await buildRequestFlowGraph(runtime, input), {
253
+ direction: "TD",
254
+ includeGroups: false,
255
+ includeKinds: ["agent", "llm", "tool", "skill", "memory"],
256
+ });
257
+ }
258
+ export async function exportSequence(runtime, input) {
259
+ return exportSequenceGraphFromGraph(await buildRequestFlowGraph(runtime, input));
260
+ }
213
261
  export async function deleteSession(runtime, sessionId) {
214
262
  return runtime.deleteSession(sessionId);
215
263
  }
@@ -233,6 +281,22 @@ export async function getArtifact(runtime, input) {
233
281
  export async function listRequestEvents(runtime, input) {
234
282
  return (await runtime.listRequestEvents(input.sessionId, input.requestId)).map(toPublicEvent);
235
283
  }
284
+ export async function listRequestTraceItems(runtime, input) {
285
+ const request = await runtime.getRequest(input.requestId);
286
+ if (!request) {
287
+ throw new Error(`Request ${input.requestId} was not found.`);
288
+ }
289
+ if (request.sessionId !== input.sessionId) {
290
+ throw new Error(`Request ${input.requestId} belongs to session ${request.sessionId}, not ${input.sessionId}.`);
291
+ }
292
+ return (request.traceItems ?? [])
293
+ .map((item) => toPublicTraceItem({
294
+ sessionId: input.sessionId,
295
+ requestId: input.requestId,
296
+ item,
297
+ }))
298
+ .filter((item) => item !== null);
299
+ }
236
300
  export async function getHealth(runtime) {
237
301
  return runtime.getHealth();
238
302
  }
@@ -36,9 +36,9 @@ spec:
36
36
  mcpServers: []
37
37
  # Runtime execution feature: checkpointer config passed into the selected backend adapter.
38
38
  # Even the lightweight direct path can benefit from resumable state during interactive use.
39
- # Available `kind` options in this harness: `FileCheckpointer`, `MemorySaver`, `SqliteSaver`.
40
- # `path` is only used by `FileCheckpointer` and `SqliteSaver`; omit it for `MemorySaver`.
41
- checkpointer: sqlite
39
+ # Available `kind` options in this harness: `FileCheckpointer`, `MemorySaver`.
40
+ # The repository default uses the file-backed preset so durable checkpoint state does not require native sqlite bindings.
41
+ checkpointer: default
42
42
  # Upstream execution feature: LangGraph store available to middleware and runtime context hooks.
43
43
  # The default direct host keeps this enabled so middleware can use the same durable store surface as other hosts.
44
44
  store: default
@@ -43,9 +43,9 @@ spec:
43
43
  mcpServers: []
44
44
  # Runtime execution feature: checkpointer config passed into the selected backend adapter.
45
45
  # This persists resumable graph state for this agent.
46
- # Available `kind` options in this harness: `FileCheckpointer`, `MemorySaver`, `SqliteSaver`.
47
- # `path` is only used by `FileCheckpointer` and `SqliteSaver`; omit it for `MemorySaver`.
48
- checkpointer: sqlite
46
+ # Available `kind` options in this harness: `FileCheckpointer`, `MemorySaver`.
47
+ # The repository default uses the file-backed preset so durable checkpoint state does not require native sqlite bindings.
48
+ checkpointer: default
49
49
  # Upstream execution feature: store config passed into the selected backend adapter.
50
50
  # In the default deepagent adapter this is the LangGraph store used by `StoreBackend` routes.
51
51
  # Built-in kinds in this harness today: `FileStore`, `InMemoryStore`.
@@ -13,12 +13,6 @@ spec:
13
13
  # agent-harness feature: reusable checkpointer preset for resumable execution state.
14
14
  - kind: Checkpointer
15
15
  name: default
16
- description: Default in-memory checkpointer preset for lightweight local development.
17
- checkpointerKind: MemorySaver
18
-
19
- # agent-harness feature: reusable sqlite checkpointer preset for longer-lived local runs.
20
- - kind: Checkpointer
21
- name: sqlite
22
- description: Default sqlite-backed checkpointer preset for durable local graph state and maintenance sweeps.
23
- checkpointerKind: SqliteSaver
24
- path: checkpoints.sqlite
16
+ description: Default file-backed checkpointer preset for durable local graph state without native sqlite bindings.
17
+ checkpointerKind: FileCheckpointer
18
+ path: checkpoints.json
@@ -91,14 +91,13 @@ spec:
91
91
  # coupling cleanup to user-triggered checkpoint reads or writes.
92
92
  #
93
93
  # Current support:
94
- # - checkpoint cleanup for `SqliteSaver` checkpointers only
95
94
  # - terminal runtime-record cleanup for structured thread/run metadata in `runtime.sqlite`
96
95
  # - oldest-first deletion by time policy and/or size policy
97
96
  # - background scheduling inside the harness lifecycle
98
97
  #
99
98
  maintenance:
100
99
  checkpoints:
101
- enabled: true
100
+ enabled: false
102
101
  schedule:
103
102
  intervalSeconds: 3600
104
103
  runOnStartup: true
@@ -103,11 +103,14 @@ export type RuntimeSurfaceItem = {
103
103
  kind: RuntimeSurfaceKind;
104
104
  id: string;
105
105
  name: string;
106
- label: string;
106
+ action: string;
107
107
  status: "started" | "completed" | "failed";
108
+ agentId?: string;
109
+ agentName?: string;
108
110
  ownerAgentId?: string;
109
111
  ownerAgentName?: string;
110
112
  sourceEventId?: string;
113
+ detail?: Record<string, unknown>;
111
114
  };
112
115
  export type AgentReference = {
113
116
  id: string;
@@ -428,15 +431,13 @@ export type UpstreamRuntimeEvent = unknown;
428
431
  export type UpstreamRuntimeEventItem = {
429
432
  threadId: string;
430
433
  runId: string;
431
- agentId: string;
432
- agentName?: string;
433
- surfaceItems?: RuntimeSurfaceItem[];
434
+ surfaceItem: RuntimeSurfaceItem;
434
435
  event: UpstreamRuntimeEvent;
435
436
  };
436
437
  export type RuntimeListeners = {
437
438
  onEvent?: (event: HarnessEvent) => void | Promise<void>;
438
439
  onUpstreamEvent?: (event: UpstreamRuntimeEvent) => void | Promise<void>;
439
- onUpstreamItem?: (item: UpstreamRuntimeEventItem) => void | Promise<void>;
440
+ onTraceItem?: (item: UpstreamRuntimeEventItem) => void | Promise<void>;
440
441
  };
441
442
  export type RunListeners = RuntimeListeners;
442
443
  export type MessageContentPart = {
@@ -477,9 +478,7 @@ export type HarnessStreamItem = {
477
478
  type: "upstream-event";
478
479
  threadId: string;
479
480
  runId: string;
480
- agentId: string;
481
- agentName?: string;
482
- surfaceItems?: RuntimeSurfaceItem[];
481
+ surfaceItem?: RuntimeSurfaceItem;
483
482
  event: UpstreamRuntimeEvent;
484
483
  } | {
485
484
  type: "result";
@@ -519,9 +518,7 @@ export type RequestSummary = Omit<ThreadRunRecord, "threadId" | "runId"> & {
519
518
  requestId: string;
520
519
  };
521
520
  export type RequestRecord = RequestSummary & {
522
- history?: RuntimeHistoryItem[];
523
- runtimeSurface?: RuntimeSurfaceItem[];
524
- upstreamEvents?: unknown[];
521
+ traceItems?: unknown[];
525
522
  runtimeTimeline?: RuntimeTimelineItem[];
526
523
  };
527
524
  /**
@@ -532,9 +529,7 @@ export type RunSummary = Omit<RequestSummary, "sessionId" | "requestId"> & {
532
529
  runId: string;
533
530
  };
534
531
  export type RunRecord = RunSummary & {
535
- history?: RuntimeHistoryItem[];
536
- runtimeSurface?: RuntimeSurfaceItem[];
537
- upstreamEvents?: unknown[];
532
+ traceItems?: unknown[];
538
533
  runtimeTimeline?: RuntimeTimelineItem[];
539
534
  };
540
535
  /**