@botbotgo/agent-harness 0.0.130 → 0.0.132
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 +2 -0
- package/README.zh.md +2 -0
- package/dist/contracts/runtime.d.ts +40 -0
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/runtime/harness/bindings.d.ts +6 -1
- package/dist/runtime/harness/bindings.js +31 -0
- package/dist/runtime/harness/index.d.ts +2 -0
- package/dist/runtime/harness/index.js +2 -0
- package/dist/runtime/harness/run/queue-diagnostics.d.ts +2 -0
- package/dist/runtime/harness/run/queue-diagnostics.js +15 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,6 +114,8 @@ Boundary documents live in:
|
|
|
114
114
|
- `docs/acp-support-plan.md`
|
|
115
115
|
- `docs/recovery-policy-matrix.md`
|
|
116
116
|
- `docs/operator-timeline.md`
|
|
117
|
+
- `docs/queue-concurrency-inspection.md`
|
|
118
|
+
- `docs/tool-execution-policy.md`
|
|
117
119
|
- `docs/feature-checklist.md`
|
|
118
120
|
- `docs/long-term-memory.md`
|
|
119
121
|
- `docs/app-task-pattern.md`
|
package/README.zh.md
CHANGED
|
@@ -114,6 +114,8 @@ AI 让 agent 逻辑、工具调用和工作流代码更容易生成,真正变
|
|
|
114
114
|
- `docs/acp-support-plan.md`
|
|
115
115
|
- `docs/recovery-policy-matrix.md`
|
|
116
116
|
- `docs/operator-timeline.md`
|
|
117
|
+
- `docs/queue-concurrency-inspection.md`
|
|
118
|
+
- `docs/tool-execution-policy.md`
|
|
117
119
|
- `docs/feature-checklist.md`
|
|
118
120
|
- `docs/long-term-memory.md`
|
|
119
121
|
- `docs/app-task-pattern.md`
|
|
@@ -59,6 +59,46 @@ export type RuntimeTimelineProjectionOptions = {
|
|
|
59
59
|
threadId?: string;
|
|
60
60
|
runId?: string;
|
|
61
61
|
};
|
|
62
|
+
export type RuntimeQueueDiagnostics = {
|
|
63
|
+
status: HealthStatus;
|
|
64
|
+
activeRunSlots: number;
|
|
65
|
+
pendingRunSlots: number;
|
|
66
|
+
stuckRuns: number;
|
|
67
|
+
queueEvents: RuntimeTimelineItem[];
|
|
68
|
+
summary: string;
|
|
69
|
+
};
|
|
70
|
+
export type RuntimeToolExecutionToolPolicy = {
|
|
71
|
+
toolId: string;
|
|
72
|
+
name: string;
|
|
73
|
+
retryable: boolean;
|
|
74
|
+
hasInputSchema: boolean;
|
|
75
|
+
requiresApproval: boolean;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Operator-facing projection of tool execution policy already compiled into a binding.
|
|
79
|
+
* This summarizes existing timeout, retry, validation, and retry-safety hints without
|
|
80
|
+
* introducing a second tool framework or stronger guarantees than the runtime provides.
|
|
81
|
+
*/
|
|
82
|
+
export type RuntimeToolExecutionPolicy = {
|
|
83
|
+
agentId: string;
|
|
84
|
+
invokeTimeoutMs?: number;
|
|
85
|
+
streamIdleTimeoutMs: number;
|
|
86
|
+
providerRetries: {
|
|
87
|
+
maxAttempts: number;
|
|
88
|
+
backoffMs: number;
|
|
89
|
+
retryableMessages: string[];
|
|
90
|
+
};
|
|
91
|
+
validation: {
|
|
92
|
+
schemaBoundToolCount: number;
|
|
93
|
+
allToolsHaveSchemas: boolean;
|
|
94
|
+
};
|
|
95
|
+
idempotencyHints: {
|
|
96
|
+
replayEligible: boolean;
|
|
97
|
+
retryableToolCount: number;
|
|
98
|
+
nonRetryableToolCount: number;
|
|
99
|
+
};
|
|
100
|
+
tools: RuntimeToolExecutionToolPolicy[];
|
|
101
|
+
};
|
|
62
102
|
export type RuntimeEventSink = {
|
|
63
103
|
publish: (event: HarnessEvent) => void;
|
|
64
104
|
subscribe: (listener: HarnessEventListener) => () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.131";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.131";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CompiledTool, RuntimeAdapterOptions, WorkspaceBundle } from "../../contracts/types.js";
|
|
1
|
+
import type { CompiledTool, RuntimeAdapterOptions, RuntimeToolExecutionPolicy, WorkspaceBundle } from "../../contracts/types.js";
|
|
2
2
|
type Binding = WorkspaceBundle["bindings"] extends Map<any, infer T> ? T : never;
|
|
3
3
|
export declare function getWorkspaceBinding(workspace: WorkspaceBundle, agentId: string): Binding | undefined;
|
|
4
4
|
export declare function getRequiredWorkspaceBinding(workspace: WorkspaceBundle, agentId: string): Binding;
|
|
@@ -11,4 +11,9 @@ export declare function resolveWorkspaceAgentTools(input: {
|
|
|
11
11
|
resolvedTool: unknown;
|
|
12
12
|
}>;
|
|
13
13
|
export declare function bindingSupportsRunningReplay(binding: Binding): boolean;
|
|
14
|
+
export declare function projectBindingToolExecutionPolicy(binding: Binding): RuntimeToolExecutionPolicy;
|
|
15
|
+
export declare function projectWorkspaceAgentToolExecutionPolicy(input: {
|
|
16
|
+
workspace: WorkspaceBundle;
|
|
17
|
+
agentId: string;
|
|
18
|
+
}): RuntimeToolExecutionPolicy;
|
|
14
19
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveBindingTimeout, resolveProviderRetryPolicy, resolveStreamIdleTimeout } from "../adapter/resilience.js";
|
|
1
2
|
import { getBindingPrimaryTools } from "../support/compiled-binding.js";
|
|
2
3
|
export function getWorkspaceBinding(workspace, agentId) {
|
|
3
4
|
return workspace.bindings.get(agentId);
|
|
@@ -21,3 +22,33 @@ export function resolveWorkspaceAgentTools(input) {
|
|
|
21
22
|
export function bindingSupportsRunningReplay(binding) {
|
|
22
23
|
return getBindingPrimaryTools(binding).every((tool) => tool.retryable === true);
|
|
23
24
|
}
|
|
25
|
+
export function projectBindingToolExecutionPolicy(binding) {
|
|
26
|
+
const tools = getBindingPrimaryTools(binding);
|
|
27
|
+
const projectedTools = tools.map((tool) => ({
|
|
28
|
+
toolId: tool.id,
|
|
29
|
+
name: tool.name,
|
|
30
|
+
retryable: tool.retryable === true,
|
|
31
|
+
hasInputSchema: typeof tool.inputSchemaRef === "string" && tool.inputSchemaRef.trim().length > 0,
|
|
32
|
+
requiresApproval: tool.hitl?.enabled === true,
|
|
33
|
+
}));
|
|
34
|
+
const retryableToolCount = projectedTools.filter((tool) => tool.retryable).length;
|
|
35
|
+
return {
|
|
36
|
+
agentId: binding.agent.id,
|
|
37
|
+
invokeTimeoutMs: resolveBindingTimeout(binding),
|
|
38
|
+
streamIdleTimeoutMs: resolveStreamIdleTimeout(binding) ?? 60_000,
|
|
39
|
+
providerRetries: resolveProviderRetryPolicy(binding),
|
|
40
|
+
validation: {
|
|
41
|
+
schemaBoundToolCount: projectedTools.filter((tool) => tool.hasInputSchema).length,
|
|
42
|
+
allToolsHaveSchemas: projectedTools.length > 0 && projectedTools.every((tool) => tool.hasInputSchema),
|
|
43
|
+
},
|
|
44
|
+
idempotencyHints: {
|
|
45
|
+
replayEligible: bindingSupportsRunningReplay(binding),
|
|
46
|
+
retryableToolCount,
|
|
47
|
+
nonRetryableToolCount: projectedTools.length - retryableToolCount,
|
|
48
|
+
},
|
|
49
|
+
tools: projectedTools,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export function projectWorkspaceAgentToolExecutionPolicy(input) {
|
|
53
|
+
return projectBindingToolExecutionPolicy(getRequiredWorkspaceBinding(input.workspace, input.agentId));
|
|
54
|
+
}
|
|
@@ -2,8 +2,10 @@ export * from "./events/event-bus.js";
|
|
|
2
2
|
export * from "./events/event-sink.js";
|
|
3
3
|
export * from "./events/events.js";
|
|
4
4
|
export * from "./events/timeline.js";
|
|
5
|
+
export * from "./bindings.js";
|
|
5
6
|
export * from "./system/health-monitor.js";
|
|
6
7
|
export * from "./run/helpers.js";
|
|
8
|
+
export * from "./run/queue-diagnostics.js";
|
|
7
9
|
export * from "./system/inventory.js";
|
|
8
10
|
export * from "./system/policy-engine.js";
|
|
9
11
|
export * from "./run/resources.js";
|
|
@@ -2,8 +2,10 @@ export * from "./events/event-bus.js";
|
|
|
2
2
|
export * from "./events/event-sink.js";
|
|
3
3
|
export * from "./events/events.js";
|
|
4
4
|
export * from "./events/timeline.js";
|
|
5
|
+
export * from "./bindings.js";
|
|
5
6
|
export * from "./system/health-monitor.js";
|
|
6
7
|
export * from "./run/helpers.js";
|
|
8
|
+
export * from "./run/queue-diagnostics.js";
|
|
7
9
|
export * from "./system/inventory.js";
|
|
8
10
|
export * from "./system/policy-engine.js";
|
|
9
11
|
export * from "./run/resources.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function projectQueueDiagnostics(snapshot, timeline) {
|
|
2
|
+
const queueEvents = timeline.filter((item) => item.kind === "queue" || item.kind === "recovery");
|
|
3
|
+
const summary = `active=${snapshot.stats.activeRunSlots} ` +
|
|
4
|
+
`pending=${snapshot.stats.pendingRunSlots} ` +
|
|
5
|
+
`stuck=${snapshot.stats.stuckRuns} ` +
|
|
6
|
+
`workload=${snapshot.checks.workload.status}`;
|
|
7
|
+
return {
|
|
8
|
+
status: snapshot.checks.workload.status,
|
|
9
|
+
activeRunSlots: snapshot.stats.activeRunSlots,
|
|
10
|
+
pendingRunSlots: snapshot.stats.pendingRunSlots,
|
|
11
|
+
stuckRuns: snapshot.stats.stuckRuns,
|
|
12
|
+
queueEvents,
|
|
13
|
+
summary,
|
|
14
|
+
};
|
|
15
|
+
}
|