@botbotgo/agent-harness 0.0.148 → 0.0.150
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
|
@@ -43,6 +43,8 @@ What you get on day one:
|
|
|
43
43
|
|
|
44
44
|
- a runtime that keeps `runs`, `threads`, `approvals`, and `events` as inspectable product records
|
|
45
45
|
- a recovery path that survives interruption, restart, and operator decisions
|
|
46
|
+
- stable run correlation and continuity metadata so operators can join one persisted run to logs, traces, and fallback transitions
|
|
47
|
+
- approval defaults for sensitive durable memory writes and write-like MCP calls instead of relying on each tool definition to remember governance
|
|
46
48
|
- one workspace-shaped assembly model instead of app-specific runtime glue
|
|
47
49
|
- one stable runtime contract even when execution backends change underneath
|
|
48
50
|
|
|
@@ -75,7 +77,9 @@ Concretely, that means:
|
|
|
75
77
|
|
|
76
78
|
- a product-facing approval and operator surface instead of backend-specific middleware state
|
|
77
79
|
- persisted `runs`, `threads`, `approvals`, and `events` as stable runtime records
|
|
80
|
+
- runtime-owned inspection fields such as tracing correlation ids and continuity metadata instead of provider-private observability handles
|
|
78
81
|
- restart-safe recovery and continuation as system-managed behavior
|
|
82
|
+
- default runtime governance for high-risk memory and MCP side effects
|
|
79
83
|
- YAML-owned routing, concurrency, maintenance, and recovery policy
|
|
80
84
|
- adapter isolation so backend replacement does not redefine the public runtime model
|
|
81
85
|
|
|
@@ -115,6 +119,7 @@ In practice, the harness exists for the parts that are painful to rebuild inside
|
|
|
115
119
|
|
|
116
120
|
- approval inboxes and human decision flow
|
|
117
121
|
- persisted runs, threads, and inspectable event history
|
|
122
|
+
- run correlation, continuity, and recovery inspection that still works after a stream fallback or restart
|
|
118
123
|
- runtime-managed recovery after interrupts, failures, or process restart
|
|
119
124
|
- queueing, concurrency, maintenance, and operational policy
|
|
120
125
|
- stable runtime records that stay usable even if the backend changes
|
|
@@ -173,6 +178,7 @@ Real products need a runtime that can answer harder questions:
|
|
|
173
178
|
|
|
174
179
|
- It treats `runs`, `threads`, `approvals`, `events`, and recovery as first-class product records
|
|
175
180
|
- It gives operators a runtime control surface instead of exposing raw backend internals
|
|
181
|
+
- It keeps observability and governance runtime-owned with trace correlation, continuity metadata, and approval defaults for sensitive side effects
|
|
176
182
|
- It keeps checkpoint resume system-managed instead of promoting checkpoint internals into the primary API
|
|
177
183
|
- It lets YAML own assembly and operating policy while code keeps a tiny surface
|
|
178
184
|
- It goes deep on runtime concerns that upstream libraries do not fully productize
|
package/README.zh.md
CHANGED
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
|
|
44
44
|
- 把 `runs`、`threads`、`approvals`、`events` 作为可查询产品记录保存下来的 runtime
|
|
45
45
|
- 能跨中断、重启和人工决策继续推进的恢复路径
|
|
46
|
+
- 稳定的 run 关联与连续性元数据,让一次持久化运行能和日志、trace、fallback 过程对齐
|
|
47
|
+
- 对敏感 durable memory 写入和写类 MCP 调用默认走审批,而不是把治理责任留给每个工具定义自己记住
|
|
46
48
|
- 一个工作区形态的装配模型,而不是每个应用各写一套运行时胶水
|
|
47
49
|
- 即使底层 execution backend 变化,也尽量保持稳定的 runtime 契约
|
|
48
50
|
|
|
@@ -75,7 +77,9 @@ AI 让 agent 逻辑、工具调用和工作流代码更容易生成,真正变
|
|
|
75
77
|
|
|
76
78
|
- 面向产品的审批与运维控制面,而不是 backend 专属的中间件状态
|
|
77
79
|
- 稳定持久化的 `runs`、`threads`、`approvals` 与 `events` 记录
|
|
80
|
+
- 由运行时持有的 tracing correlation id 与 continuity metadata,而不是 provider 私有观测句柄
|
|
78
81
|
- 由系统托管的重启恢复与中断续跑
|
|
82
|
+
- 面向高风险 memory / MCP 副作用的默认治理策略
|
|
79
83
|
- 由 YAML 持有的路由、并发、维护与恢复策略
|
|
80
84
|
- 通过适配器隔离 backend 变化,不让公共运行时模型漂移
|
|
81
85
|
|
|
@@ -115,6 +119,7 @@ AI 让 agent 逻辑、工具调用和工作流代码更容易生成,真正变
|
|
|
115
119
|
|
|
116
120
|
- 审批收件箱与人工决策流
|
|
117
121
|
- 持久化的 runs、threads 与可查询事件历史
|
|
122
|
+
- 即使发生 stream fallback 或进程重启也还能成立的 run 关联、连续性与恢复观测
|
|
118
123
|
- 中断、失败或进程重启后的运行时托管恢复
|
|
119
124
|
- 队列、并发、维护与运维策略
|
|
120
125
|
- 即使后端变更也保持稳定的运行时记录模型
|
|
@@ -170,6 +175,7 @@ AI 让 agent 逻辑、工具调用和工作流代码更容易生成,真正变
|
|
|
170
175
|
|
|
171
176
|
- 将 `runs`、`threads`、`approvals`、`events` 与恢复视为一等产品记录
|
|
172
177
|
- 给运维侧提供运行时控制面,而不是暴露原始后端内部结构
|
|
178
|
+
- 将可观测性与治理留在运行时:包括 trace correlation、continuity metadata,以及高风险副作用的默认审批
|
|
173
179
|
- 将 checkpoint 恢复作为系统管理的行为,而不是把 checkpoint 细节抬成主 API
|
|
174
180
|
- 复杂装配与运行策略交给 YAML,代码面保持极小
|
|
175
181
|
- 在上游库未充分产品化的运行时问题上做深做透
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.149";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.149";
|
|
@@ -59,8 +59,16 @@ export async function requestApprovalAndEmitEvent(runtime, threadId, runId, inpu
|
|
|
59
59
|
return { approval, event };
|
|
60
60
|
}
|
|
61
61
|
export async function emitSyntheticFallbackEvent(runtime, threadId, runId, selectedAgentId, error, sequence = 3) {
|
|
62
|
+
const payload = typeof error === "object" && error !== null && "reason" in error
|
|
63
|
+
? {
|
|
64
|
+
...error,
|
|
65
|
+
selectedAgentId,
|
|
66
|
+
}
|
|
67
|
+
: {
|
|
68
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
69
|
+
selectedAgentId,
|
|
70
|
+
};
|
|
62
71
|
await emitHarnessEvent(runtime, threadId, runId, sequence, "runtime.synthetic_fallback", {
|
|
63
|
-
|
|
64
|
-
selectedAgentId,
|
|
72
|
+
...payload,
|
|
65
73
|
});
|
|
66
74
|
}
|
|
@@ -46,6 +46,7 @@ export async function* streamHarnessRun(options) {
|
|
|
46
46
|
let nonUpstreamStreamActivityObserved = false;
|
|
47
47
|
let currentAgentId = options.selectedAgentId;
|
|
48
48
|
let delegationChain = [options.selectedAgentId];
|
|
49
|
+
let syntheticFallback;
|
|
49
50
|
try {
|
|
50
51
|
const [priorHistory, acquiredReleaseRunSlot] = await Promise.all([
|
|
51
52
|
priorHistoryPromise,
|
|
@@ -237,6 +238,13 @@ export async function* streamHarnessRun(options) {
|
|
|
237
238
|
return;
|
|
238
239
|
}
|
|
239
240
|
try {
|
|
241
|
+
syntheticFallback = {
|
|
242
|
+
strategy: "stream-to-invoke",
|
|
243
|
+
sourceStage: "stream",
|
|
244
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
245
|
+
outcome: "recovered",
|
|
246
|
+
};
|
|
247
|
+
await options.emitSyntheticFallback(options.threadId, options.runId, options.selectedAgentId, syntheticFallback);
|
|
240
248
|
const actual = await options.invokeWithHistory(options.binding, options.input, options.threadId, options.runId);
|
|
241
249
|
await options.appendAssistantMessage(options.threadId, options.runId, actual.output);
|
|
242
250
|
if (Array.isArray(actual.contentBlocks) && actual.contentBlocks.length > 0) {
|
|
@@ -249,6 +257,10 @@ export async function* streamHarnessRun(options) {
|
|
|
249
257
|
threadId: options.threadId,
|
|
250
258
|
runId: options.runId,
|
|
251
259
|
agentId: currentAgentId,
|
|
260
|
+
metadata: {
|
|
261
|
+
...(actual.metadata ?? {}),
|
|
262
|
+
syntheticFallback,
|
|
263
|
+
},
|
|
252
264
|
},
|
|
253
265
|
};
|
|
254
266
|
yield {
|
|
@@ -260,7 +272,13 @@ export async function* streamHarnessRun(options) {
|
|
|
260
272
|
return;
|
|
261
273
|
}
|
|
262
274
|
catch (invokeError) {
|
|
263
|
-
|
|
275
|
+
syntheticFallback = {
|
|
276
|
+
strategy: "stream-to-invoke",
|
|
277
|
+
sourceStage: "stream",
|
|
278
|
+
reason: invokeError instanceof Error ? invokeError.message : String(invokeError),
|
|
279
|
+
outcome: "failed",
|
|
280
|
+
};
|
|
281
|
+
await options.emitSyntheticFallback(options.threadId, options.runId, options.selectedAgentId, syntheticFallback);
|
|
264
282
|
const runtimeFailure = renderRuntimeFailure(invokeError);
|
|
265
283
|
yield {
|
|
266
284
|
type: "event",
|
|
@@ -285,6 +303,9 @@ export async function* streamHarnessRun(options) {
|
|
|
285
303
|
state: "failed",
|
|
286
304
|
output: runtimeFailure,
|
|
287
305
|
finalMessageText: runtimeFailure,
|
|
306
|
+
metadata: {
|
|
307
|
+
syntheticFallback,
|
|
308
|
+
},
|
|
288
309
|
},
|
|
289
310
|
};
|
|
290
311
|
return;
|