@botbotgo/agent-harness 0.0.41 → 0.0.43
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 +105 -86
- package/dist/config/agents/direct.yaml +8 -7
- package/dist/config/agents/orchestra.yaml +8 -6
- package/dist/contracts/types.d.ts +35 -2
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/persistence/file-store.d.ts +8 -6
- package/dist/persistence/file-store.js +2 -0
- package/dist/runtime/agent-runtime-adapter.d.ts +1 -1
- package/dist/runtime/agent-runtime-adapter.js +68 -80
- package/dist/runtime/checkpoint-maintenance.js +1 -1
- package/dist/runtime/declared-middleware.d.ts +8 -1
- package/dist/runtime/declared-middleware.js +18 -1
- package/dist/runtime/harness.d.ts +6 -0
- package/dist/runtime/harness.js +390 -256
- package/dist/runtime/inventory.js +2 -1
- package/dist/runtime/support/compiled-binding.d.ts +15 -0
- package/dist/runtime/support/compiled-binding.js +56 -0
- package/dist/runtime/support/harness-support.d.ts +2 -2
- package/dist/runtime/support/harness-support.js +14 -12
- package/dist/runtime/support/runtime-factories.d.ts +1 -1
- package/dist/runtime/support/runtime-factories.js +3 -0
- package/dist/workspace/agent-binding-compiler.js +61 -33
- package/dist/workspace/object-loader.js +50 -4
- package/dist/workspace/support/agent-capabilities.d.ts +7 -0
- package/dist/workspace/support/agent-capabilities.js +30 -0
- package/dist/workspace/support/workspace-ref-utils.d.ts +4 -0
- package/dist/workspace/support/workspace-ref-utils.js +15 -1
- package/dist/workspace/validate.js +14 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,36 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
## Product Overview
|
|
4
4
|
|
|
5
|
-
`@botbotgo/agent-harness`
|
|
5
|
+
`@botbotgo/agent-harness` is a workspace-shaped application runtime for real agent products.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
It is not a new agent framework. It is the layer that sits around LangChain v1 and DeepAgents so an application can be assembled, configured, operated, and recovered as one runtime.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- execution frameworks can run agents, but they do not give you a workspace-shaped product runtime by themselves
|
|
11
|
-
- applications need persisted threads, resumability, approvals, and operational control, not just model calls
|
|
9
|
+
The package is built for the gap between:
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
- agent execution semantics owned by LangChain v1 and DeepAgents
|
|
12
|
+
- application runtime concerns such as persisted threads, approvals, recovery, routing, maintenance, and local resource loading
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
- YAML-defined agents, models, routing, and maintenance policy
|
|
17
|
-
- local tools and SKILL packages loaded from `resources/`
|
|
18
|
-
- DeepAgents-first execution with LangChain v1 compatibility
|
|
19
|
-
- feature-level runtime APIs for runs, threads, approvals, and events
|
|
14
|
+
What it provides:
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
- `
|
|
25
|
-
-
|
|
26
|
-
- `listThreads(...)`
|
|
27
|
-
- `getThread(...)`
|
|
28
|
-
- `listApprovals(...)`
|
|
29
|
-
- `getApproval(...)`
|
|
30
|
-
- `stop(...)`
|
|
16
|
+
- a small runtime API centered on `createAgentHarness(...)`, `run(...)`, `subscribe(...)`, inspection methods, and `stop(...)`
|
|
17
|
+
- YAML-defined runtime assembly for hosts, models, routing, recovery, concurrency, MCP, and maintenance policy
|
|
18
|
+
- backend-adapted execution with current DeepAgents-first defaults and LangChain v1 compatibility
|
|
19
|
+
- local `resources/tools/` and `resources/skills/` loading
|
|
20
|
+
- persisted runs, threads, approvals, events, and resumable checkpoints
|
|
31
21
|
|
|
32
22
|
## Quick Start
|
|
33
23
|
|
|
34
|
-
Install
|
|
24
|
+
Install:
|
|
35
25
|
|
|
36
26
|
```bash
|
|
37
27
|
npm install @botbotgo/agent-harness
|
|
@@ -54,19 +44,17 @@ your-workspace/
|
|
|
54
44
|
skills/
|
|
55
45
|
```
|
|
56
46
|
|
|
57
|
-
Use the standard layout only. Agent entry files must live under `config/agents/`.
|
|
58
|
-
|
|
59
47
|
Minimal usage:
|
|
60
48
|
|
|
61
49
|
```ts
|
|
62
50
|
import { createAgentHarness, run, stop } from "@botbotgo/agent-harness";
|
|
63
51
|
|
|
64
|
-
const runtime = await createAgentHarness("/absolute/path/to/
|
|
52
|
+
const runtime = await createAgentHarness("/absolute/path/to/workspace");
|
|
65
53
|
|
|
66
54
|
try {
|
|
67
55
|
const result = await run(runtime, {
|
|
68
56
|
agentId: "auto",
|
|
69
|
-
input: "
|
|
57
|
+
input: "Explain what this workspace is for.",
|
|
70
58
|
});
|
|
71
59
|
|
|
72
60
|
console.log(result.output);
|
|
@@ -77,13 +65,16 @@ try {
|
|
|
77
65
|
|
|
78
66
|
## Feature List
|
|
79
67
|
|
|
80
|
-
- Workspace runtime
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
- MCP
|
|
85
|
-
-
|
|
68
|
+
- Workspace runtime for multi-agent applications
|
|
69
|
+
- Generic runtime contract with backend-adapted execution
|
|
70
|
+
- YAML-defined host routing
|
|
71
|
+
- Auto-discovered local tools and SKILL packages
|
|
72
|
+
- MCP bridge support for agent-declared MCP servers
|
|
73
|
+
- MCP server support for exposing harness tools outward
|
|
74
|
+
- Persisted threads, runs, approvals, and lifecycle events
|
|
75
|
+
- Recovery policy and resumable checkpoints
|
|
86
76
|
- Background checkpoint maintenance
|
|
77
|
+
- Runtime-level concurrency control
|
|
87
78
|
|
|
88
79
|
## How To Use
|
|
89
80
|
|
|
@@ -95,13 +86,9 @@ import { AgentHarnessRuntime, createAgentHarness } from "@botbotgo/agent-harness
|
|
|
95
86
|
const runtime: AgentHarnessRuntime = await createAgentHarness("/absolute/path/to/workspace");
|
|
96
87
|
```
|
|
97
88
|
|
|
98
|
-
|
|
89
|
+
You can also create a runtime from a precompiled `WorkspaceBundle`.
|
|
99
90
|
|
|
100
|
-
|
|
101
|
-
const runtime = await createAgentHarness(workspaceBundle);
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
`createAgentHarness(workspaceRoot)` loads one `WorkspaceBundle`, resolves `resources/`, initializes persistence under `runRoot`, and starts runtime maintenance.
|
|
91
|
+
`createAgentHarness(...)` loads one workspace, resolves `resources/`, initializes persistence under `runRoot`, and starts runtime maintenance.
|
|
105
92
|
|
|
106
93
|
### Run A Request
|
|
107
94
|
|
|
@@ -110,7 +97,7 @@ import { run } from "@botbotgo/agent-harness";
|
|
|
110
97
|
|
|
111
98
|
const result = await run(runtime, {
|
|
112
99
|
agentId: "orchestra",
|
|
113
|
-
input: "
|
|
100
|
+
input: "Summarize the runtime design.",
|
|
114
101
|
context: {
|
|
115
102
|
requestId: "req-123",
|
|
116
103
|
},
|
|
@@ -120,24 +107,26 @@ const result = await run(runtime, {
|
|
|
120
107
|
});
|
|
121
108
|
```
|
|
122
109
|
|
|
123
|
-
Each run creates or continues a persisted thread
|
|
110
|
+
Each run creates or continues a persisted thread and returns `threadId`, `runId`, `state`, and the final user-facing output text.
|
|
124
111
|
|
|
125
|
-
|
|
112
|
+
The preferred runtime-facing way to pass execution metadata is `invocation`:
|
|
126
113
|
|
|
127
|
-
- `context
|
|
128
|
-
- `
|
|
129
|
-
- `
|
|
114
|
+
- `invocation.context` for request-scoped context
|
|
115
|
+
- `invocation.inputs` for additional structured runtime inputs
|
|
116
|
+
- `invocation.attachments` for attachment-like payloads that the active backend can interpret
|
|
117
|
+
|
|
118
|
+
For compatibility, `context`, `state`, and `files` are still accepted as existing aliases and are normalized into the same runtime invocation envelope.
|
|
130
119
|
|
|
131
120
|
### Let The Runtime Route
|
|
132
121
|
|
|
133
122
|
```ts
|
|
134
123
|
const result = await run(runtime, {
|
|
135
124
|
agentId: "auto",
|
|
136
|
-
input: "Inspect
|
|
125
|
+
input: "Inspect the repository and explain the release flow.",
|
|
137
126
|
});
|
|
138
127
|
```
|
|
139
128
|
|
|
140
|
-
`agentId: "auto"` evaluates ordered `routing.rules
|
|
129
|
+
`agentId: "auto"` evaluates ordered `routing.rules`, then `routing.defaultAgentId`, and only falls back to model routing when `routing.modelRouting: true`.
|
|
141
130
|
|
|
142
131
|
### Stream Output And Events
|
|
143
132
|
|
|
@@ -156,9 +145,9 @@ const result = await run(runtime, {
|
|
|
156
145
|
});
|
|
157
146
|
```
|
|
158
147
|
|
|
159
|
-
|
|
148
|
+
`subscribe(...)` is a read-only observer surface over stored lifecycle events.
|
|
160
149
|
|
|
161
|
-
###
|
|
150
|
+
### Inspect Threads And Approvals
|
|
162
151
|
|
|
163
152
|
```ts
|
|
164
153
|
import {
|
|
@@ -174,21 +163,7 @@ const approvals = await listApprovals(runtime, { status: "pending" });
|
|
|
174
163
|
const approval = approvals[0] ? await getApproval(runtime, approvals[0].approvalId) : null;
|
|
175
164
|
```
|
|
176
165
|
|
|
177
|
-
These methods return
|
|
178
|
-
|
|
179
|
-
### Use Skills And Local Tools
|
|
180
|
-
|
|
181
|
-
`agent-harness` treats `resources/skills/` as SKILL packages and `resources/tools/` as executable local tools.
|
|
182
|
-
|
|
183
|
-
```yaml
|
|
184
|
-
spec:
|
|
185
|
-
skills:
|
|
186
|
-
- path: resources/skills/reviewer
|
|
187
|
-
tools:
|
|
188
|
-
- ref: tool/local-toolset
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
Tool modules are discovered from `resources/tools/*.js`, `resources/tools/*.mjs`, and `resources/tools/*.cjs`. The preferred format is exporting `tool({...})`.
|
|
166
|
+
These methods return runtime-facing records, not raw persistence or backend checkpoint objects.
|
|
192
167
|
|
|
193
168
|
### Bridge MCP Servers Into Agents
|
|
194
169
|
|
|
@@ -201,10 +176,9 @@ spec:
|
|
|
201
176
|
- name: docs
|
|
202
177
|
transport: http
|
|
203
178
|
url: https://example.com/mcp
|
|
204
|
-
token: ${DOCS_MCP_TOKEN}
|
|
205
179
|
```
|
|
206
180
|
|
|
207
|
-
The runtime discovers MCP tools, filters them through agent
|
|
181
|
+
The runtime discovers MCP tools, filters them through agent configuration, and exposes them like other tools.
|
|
208
182
|
|
|
209
183
|
### Expose Runtime Tools As An MCP Server
|
|
210
184
|
|
|
@@ -227,35 +201,60 @@ await stop(runtime);
|
|
|
227
201
|
|
|
228
202
|
Core workspace files:
|
|
229
203
|
|
|
230
|
-
- `config/workspace.yaml
|
|
231
|
-
- `config/agent-context.md
|
|
232
|
-
- `config/models.yaml
|
|
233
|
-
- `config/agents/direct.yaml
|
|
234
|
-
- `config/agents/orchestra.yaml
|
|
235
|
-
- `resources/package.json
|
|
236
|
-
- `resources/tools
|
|
237
|
-
- `resources/skills
|
|
204
|
+
- `config/workspace.yaml`
|
|
205
|
+
- `config/agent-context.md`
|
|
206
|
+
- `config/models.yaml`
|
|
207
|
+
- `config/agents/direct.yaml`
|
|
208
|
+
- `config/agents/orchestra.yaml`
|
|
209
|
+
- `resources/package.json`
|
|
210
|
+
- `resources/tools/`
|
|
211
|
+
- `resources/skills/`
|
|
238
212
|
|
|
239
213
|
### `config/workspace.yaml`
|
|
240
214
|
|
|
241
|
-
Use this file for:
|
|
215
|
+
Use this file for runtime-level policy:
|
|
242
216
|
|
|
243
217
|
- `runRoot`
|
|
244
|
-
-
|
|
218
|
+
- `routing.rules`
|
|
219
|
+
- `routing.defaultAgentId`
|
|
245
220
|
- `routing.systemPrompt`
|
|
221
|
+
- `routing.modelRouting`
|
|
222
|
+
- `concurrency.maxConcurrentRuns`
|
|
223
|
+
- `recovery.enabled`
|
|
224
|
+
- `recovery.resumeOnStartup`
|
|
225
|
+
- `recovery.maxRecoveryAttempts`
|
|
246
226
|
- `maintenance.checkpoints.*`
|
|
247
227
|
|
|
248
228
|
If `runRoot` is omitted, the runtime defaults to `<workspace-root>/run-data`.
|
|
249
229
|
|
|
250
230
|
### `config/agent-context.md`
|
|
251
231
|
|
|
252
|
-
Use this file for shared
|
|
232
|
+
Use this file for shared startup context loaded into agents at construction time.
|
|
233
|
+
|
|
234
|
+
Put stable project context here. Do not use it as mutable long-term memory.
|
|
235
|
+
|
|
236
|
+
### `config/agents/*.yaml`
|
|
237
|
+
|
|
238
|
+
Prefer the generic agent form and declare the current execution backend explicitly:
|
|
239
|
+
|
|
240
|
+
```yaml
|
|
241
|
+
apiVersion: agent-harness/v1alpha1
|
|
242
|
+
kind: Agent
|
|
243
|
+
metadata:
|
|
244
|
+
name: orchestra
|
|
245
|
+
spec:
|
|
246
|
+
modelRef: model/default
|
|
247
|
+
execution:
|
|
248
|
+
backend: deepagent
|
|
249
|
+
systemPrompt: Coordinate the request.
|
|
250
|
+
```
|
|
253
251
|
|
|
254
|
-
|
|
252
|
+
`kind: DeepAgent` and `kind: LangChainAgent` remain supported as compatibility forms, but `kind: Agent` is the recommended product-facing entry point.
|
|
255
253
|
|
|
256
|
-
|
|
254
|
+
Common fields include:
|
|
257
255
|
|
|
258
256
|
- `modelRef`
|
|
257
|
+
- `execution.backend`
|
|
259
258
|
- `systemPrompt`
|
|
260
259
|
- `tools`
|
|
261
260
|
- `skills`
|
|
@@ -263,19 +262,39 @@ Use `config/agents/*.yaml` to configure agents. Common fields include:
|
|
|
263
262
|
- `checkpointer`
|
|
264
263
|
- `store`
|
|
265
264
|
- `backend`
|
|
265
|
+
- `middleware`
|
|
266
266
|
- `subagents`
|
|
267
|
+
- `mcpServers`
|
|
267
268
|
|
|
268
|
-
###
|
|
269
|
+
### `resources/`
|
|
269
270
|
|
|
270
|
-
Use `resources/` for executable extensions:
|
|
271
|
+
Use `resources/` for executable local extensions:
|
|
271
272
|
|
|
272
|
-
- `resources/tools/` for
|
|
273
|
+
- `resources/tools/` for tool modules
|
|
273
274
|
- `resources/skills/` for SKILL packages
|
|
274
275
|
|
|
275
|
-
|
|
276
|
+
Tool modules are discovered from `resources/tools/*.js`, `resources/tools/*.mjs`, and `resources/tools/*.cjs`.
|
|
277
|
+
|
|
278
|
+
The preferred tool module format is exporting `tool({...})`.
|
|
279
|
+
|
|
280
|
+
Keep runtime extension source under `resources/`. Keep tests outside the published source tree, for example under repository `test/`.
|
|
276
281
|
|
|
277
|
-
|
|
282
|
+
## Design Notes
|
|
278
283
|
|
|
279
|
-
-
|
|
280
|
-
-
|
|
281
|
-
-
|
|
284
|
+
- `agent-harness` should keep the public runtime contract generic while mapping cleanly onto current backend capabilities
|
|
285
|
+
- agent-level execution behavior stays upstream
|
|
286
|
+
- application-level orchestration and lifecycle management stays in the harness
|
|
287
|
+
- checkpoint resume is treated as a system-managed runtime behavior, not a primary public abstraction
|
|
288
|
+
|
|
289
|
+
## API Summary
|
|
290
|
+
|
|
291
|
+
- `createAgentHarness(...)`
|
|
292
|
+
- `run(...)`
|
|
293
|
+
- `subscribe(...)`
|
|
294
|
+
- `listThreads(...)`
|
|
295
|
+
- `getThread(...)`
|
|
296
|
+
- `listApprovals(...)`
|
|
297
|
+
- `getApproval(...)`
|
|
298
|
+
- `createToolMcpServer(...)`
|
|
299
|
+
- `serveToolsOverStdio(...)`
|
|
300
|
+
- `stop(...)`
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
# agent-harness feature: schema version for this declarative config object.
|
|
2
2
|
apiVersion: agent-harness/v1alpha1
|
|
3
3
|
# agent-harness feature: object type discriminator.
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
# rather than the upstream `createDeepAgent(...)` runtime.
|
|
7
|
-
kind: LangChainAgent
|
|
4
|
+
# Prefer the generic `Agent` form and select the concrete execution backend under `spec.execution`.
|
|
5
|
+
kind: Agent
|
|
8
6
|
metadata:
|
|
9
7
|
# agent-harness feature: stable object id used for refs and host-agent selection.
|
|
10
8
|
name: direct
|
|
11
9
|
# agent-harness feature: human-readable summary for inventory and UI.
|
|
12
10
|
description: Manual low-latency host for direct answers and lightweight inventory lookup. Do not use it as the default executor for tool-heavy or specialist-shaped tasks.
|
|
13
11
|
spec:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
execution:
|
|
13
|
+
# Current backend adapter for this host profile.
|
|
14
|
+
backend: langchain-v1
|
|
15
|
+
# =====================
|
|
16
|
+
# Runtime Agent Features
|
|
17
|
+
# =====================
|
|
17
18
|
# Shared LangChain v1 / DeepAgents feature: model ref for the underlying LLM used by the
|
|
18
19
|
# direct-response agent. This should point at a cheap, fast, general-purpose chat model,
|
|
19
20
|
# because `direct` is intended to be the low-latency path for simple requests.
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
# agent-harness feature: schema version for this declarative config object.
|
|
2
2
|
apiVersion: agent-harness/v1alpha1
|
|
3
3
|
# agent-harness feature: object type discriminator.
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
kind: DeepAgent
|
|
4
|
+
# Prefer the generic `Agent` form and select the concrete execution backend under `spec.execution`.
|
|
5
|
+
kind: Agent
|
|
7
6
|
metadata:
|
|
8
7
|
# agent-harness feature: stable object id used for refs and default DeepAgents name inference.
|
|
9
8
|
name: orchestra
|
|
10
9
|
# agent-harness feature: human-readable summary for inventory and UI.
|
|
11
10
|
description: Default execution host. Answer directly when possible, use local tools and skills first, and delegate only when a specialist is a better fit. Not a reflex delegation-only planner.
|
|
12
11
|
spec:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
execution:
|
|
13
|
+
# Current backend adapter for this host profile.
|
|
14
|
+
backend: deepagent
|
|
15
|
+
# =====================
|
|
16
|
+
# Runtime Agent Features
|
|
17
|
+
# =====================
|
|
16
18
|
# DeepAgents aligned feature: model ref for the underlying LLM used by `createDeepAgent(...)`.
|
|
17
19
|
modelRef: model/default
|
|
18
20
|
# Shared LangChain v1 / DeepAgents feature: checkpointer config passed into the upstream runtime.
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
export type ExecutionMode = "deepagent" | "langchain-v1";
|
|
2
2
|
export declare const AUTO_AGENT_ID = "auto";
|
|
3
|
+
export type RuntimeCapabilities = {
|
|
4
|
+
delegation?: boolean;
|
|
5
|
+
memory?: boolean;
|
|
6
|
+
};
|
|
3
7
|
export type RunState = "running" | "waiting_for_approval" | "resuming" | "completed" | "failed";
|
|
4
8
|
export type ParsedAgentObject = {
|
|
5
9
|
id: string;
|
|
6
10
|
executionMode: ExecutionMode;
|
|
11
|
+
capabilities?: RuntimeCapabilities;
|
|
7
12
|
description: string;
|
|
8
13
|
modelRef: string;
|
|
9
14
|
runRoot?: string;
|
|
@@ -175,6 +180,10 @@ export type CompiledTool = {
|
|
|
175
180
|
};
|
|
176
181
|
export type CompiledAgentBinding = {
|
|
177
182
|
agent: ParsedAgentObject;
|
|
183
|
+
adapter?: {
|
|
184
|
+
kind: string;
|
|
185
|
+
config: Record<string, unknown>;
|
|
186
|
+
};
|
|
178
187
|
langchainAgentParams?: LangChainAgentParams;
|
|
179
188
|
directAgentParams?: LangChainAgentParams;
|
|
180
189
|
deepAgentParams?: DeepAgentParams;
|
|
@@ -182,7 +191,8 @@ export type CompiledAgentBinding = {
|
|
|
182
191
|
runRoot: string;
|
|
183
192
|
workspaceRoot?: string;
|
|
184
193
|
hostFacing: boolean;
|
|
185
|
-
|
|
194
|
+
capabilities?: RuntimeCapabilities;
|
|
195
|
+
checkpointer?: Record<string, unknown> | boolean;
|
|
186
196
|
store?: Record<string, unknown>;
|
|
187
197
|
};
|
|
188
198
|
};
|
|
@@ -239,11 +249,14 @@ export type RunResult = {
|
|
|
239
249
|
runId: string;
|
|
240
250
|
state: RunState;
|
|
241
251
|
output: string;
|
|
252
|
+
finalMessageText?: string;
|
|
242
253
|
interruptContent?: string;
|
|
243
254
|
agentId?: string;
|
|
244
255
|
approvalId?: string;
|
|
245
256
|
pendingActionId?: string;
|
|
246
257
|
delegationId?: string;
|
|
258
|
+
artifacts?: ArtifactRecord[];
|
|
259
|
+
metadata?: Record<string, unknown>;
|
|
247
260
|
};
|
|
248
261
|
export type RunListeners = {
|
|
249
262
|
onChunk?: (chunk: string) => void | Promise<void>;
|
|
@@ -264,10 +277,17 @@ export type MessageContentPart = {
|
|
|
264
277
|
image_url: string;
|
|
265
278
|
};
|
|
266
279
|
export type MessageContent = string | MessageContentPart[];
|
|
280
|
+
export type InvocationEnvelope = {
|
|
281
|
+
context?: Record<string, unknown>;
|
|
282
|
+
inputs?: Record<string, unknown>;
|
|
283
|
+
attachments?: Record<string, unknown>;
|
|
284
|
+
capabilities?: Record<string, unknown>;
|
|
285
|
+
};
|
|
267
286
|
export type RunStartOptions = {
|
|
268
287
|
agentId?: string;
|
|
269
288
|
input: MessageContent;
|
|
270
289
|
threadId?: string;
|
|
290
|
+
invocation?: InvocationEnvelope;
|
|
271
291
|
context?: Record<string, unknown>;
|
|
272
292
|
state?: Record<string, unknown>;
|
|
273
293
|
files?: Record<string, unknown>;
|
|
@@ -285,6 +305,9 @@ export type RunOptions = RunStartOptions | RunDecisionOptions;
|
|
|
285
305
|
export type HarnessStreamItem = {
|
|
286
306
|
type: "event";
|
|
287
307
|
event: HarnessEvent;
|
|
308
|
+
} | {
|
|
309
|
+
type: "result";
|
|
310
|
+
result: RunResult;
|
|
288
311
|
} | {
|
|
289
312
|
type: "content";
|
|
290
313
|
threadId: string;
|
|
@@ -322,6 +345,7 @@ export type ThreadRunRecord = {
|
|
|
322
345
|
runId: string;
|
|
323
346
|
agentId: string;
|
|
324
347
|
executionMode: string;
|
|
348
|
+
adapterKind?: string;
|
|
325
349
|
createdAt: string;
|
|
326
350
|
updatedAt: string;
|
|
327
351
|
state: RunState;
|
|
@@ -362,13 +386,15 @@ export type ApprovalRecord = {
|
|
|
362
386
|
pendingActionId: string;
|
|
363
387
|
threadId: string;
|
|
364
388
|
runId: string;
|
|
365
|
-
toolCallId: string;
|
|
366
389
|
toolName: string;
|
|
367
390
|
status: "pending" | "approved" | "edited" | "rejected" | "expired";
|
|
368
391
|
requestedAt: string;
|
|
369
392
|
resolvedAt: string | null;
|
|
370
393
|
allowedDecisions: Array<"approve" | "edit" | "reject">;
|
|
371
394
|
inputPreview: Record<string, unknown>;
|
|
395
|
+
};
|
|
396
|
+
export type InternalApprovalRecord = ApprovalRecord & {
|
|
397
|
+
toolCallId: string;
|
|
372
398
|
checkpointRef: string;
|
|
373
399
|
eventRefs: string[];
|
|
374
400
|
};
|
|
@@ -405,6 +431,12 @@ export type RuntimeModelResolver = (modelId: string) => unknown;
|
|
|
405
431
|
export type RuntimeEmbeddingModelResolver = (embeddingModelId: string) => unknown;
|
|
406
432
|
export type RuntimeVectorStoreResolver = (vectorStoreId: string) => unknown;
|
|
407
433
|
export type RuntimeMiddlewareResolver = (binding: CompiledAgentBinding) => unknown[];
|
|
434
|
+
export type RuntimeDeclaredMiddlewareResolver = (input: {
|
|
435
|
+
kind: string;
|
|
436
|
+
config: Record<string, unknown>;
|
|
437
|
+
binding?: CompiledAgentBinding;
|
|
438
|
+
resolveModel: (model: CompiledModel) => Promise<unknown>;
|
|
439
|
+
}) => unknown | unknown[] | null | undefined | Promise<unknown | unknown[] | null | undefined>;
|
|
408
440
|
export type RuntimeCheckpointerResolver = (binding: CompiledAgentBinding) => unknown;
|
|
409
441
|
export type RuntimeStoreResolver = (binding: CompiledAgentBinding) => unknown;
|
|
410
442
|
export type RuntimeBackendResolver = (binding: CompiledAgentBinding) => unknown;
|
|
@@ -414,6 +446,7 @@ export type RuntimeAdapterOptions = {
|
|
|
414
446
|
embeddingModelResolver?: RuntimeEmbeddingModelResolver;
|
|
415
447
|
vectorStoreResolver?: RuntimeVectorStoreResolver;
|
|
416
448
|
middlewareResolver?: RuntimeMiddlewareResolver;
|
|
449
|
+
declaredMiddlewareResolver?: RuntimeDeclaredMiddlewareResolver;
|
|
417
450
|
checkpointerResolver?: RuntimeCheckpointerResolver;
|
|
418
451
|
storeResolver?: RuntimeStoreResolver;
|
|
419
452
|
backendResolver?: RuntimeBackendResolver;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.42";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.42";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ArtifactListing, ArtifactRecord, DelegationRecord, HarnessEvent, InternalApprovalRecord, RunState, ThreadSummary, ThreadRunRecord, TranscriptMessage } from "../contracts/types.js";
|
|
2
2
|
type ThreadMeta = {
|
|
3
3
|
threadId: string;
|
|
4
4
|
workspaceId: string;
|
|
@@ -13,6 +13,7 @@ type RunMeta = {
|
|
|
13
13
|
threadId: string;
|
|
14
14
|
agentId: string;
|
|
15
15
|
executionMode: string;
|
|
16
|
+
adapterKind?: string;
|
|
16
17
|
createdAt: string;
|
|
17
18
|
updatedAt: string;
|
|
18
19
|
};
|
|
@@ -56,6 +57,7 @@ export declare class FilePersistence {
|
|
|
56
57
|
runId: string;
|
|
57
58
|
agentId: string;
|
|
58
59
|
executionMode: string;
|
|
60
|
+
adapterKind?: string;
|
|
59
61
|
createdAt: string;
|
|
60
62
|
}): Promise<void>;
|
|
61
63
|
setRunState(threadId: string, runId: string, state: RunState, checkpointRef?: string | null): Promise<void>;
|
|
@@ -66,14 +68,14 @@ export declare class FilePersistence {
|
|
|
66
68
|
getThreadMeta(threadId: string): Promise<ThreadMeta | null>;
|
|
67
69
|
listThreadRuns(threadId: string): Promise<ThreadRunRecord[]>;
|
|
68
70
|
listRunEvents(threadId: string, runId: string): Promise<HarnessEvent[]>;
|
|
69
|
-
listApprovals(): Promise<
|
|
70
|
-
getApproval(approvalId: string): Promise<
|
|
71
|
-
getRunApprovals(threadId: string, runId: string): Promise<
|
|
71
|
+
listApprovals(): Promise<InternalApprovalRecord[]>;
|
|
72
|
+
getApproval(approvalId: string): Promise<InternalApprovalRecord | null>;
|
|
73
|
+
getRunApprovals(threadId: string, runId: string): Promise<InternalApprovalRecord[]>;
|
|
72
74
|
getRunMeta(threadId: string, runId: string): Promise<RunMeta>;
|
|
73
75
|
getRunLifecycle(threadId: string, runId: string): Promise<Lifecycle>;
|
|
74
76
|
listDelegations(): Promise<DelegationRecord[]>;
|
|
75
|
-
createApproval(record:
|
|
76
|
-
resolveApproval(threadId: string, runId: string, approvalId: string, status:
|
|
77
|
+
createApproval(record: InternalApprovalRecord): Promise<void>;
|
|
78
|
+
resolveApproval(threadId: string, runId: string, approvalId: string, status: InternalApprovalRecord["status"]): Promise<InternalApprovalRecord>;
|
|
77
79
|
createDelegation(record: DelegationRecord): Promise<void>;
|
|
78
80
|
updateDelegation(threadId: string, runId: string, delegationId: string, patch: Partial<DelegationRecord>): Promise<DelegationRecord>;
|
|
79
81
|
createArtifact(threadId: string, runId: string, artifact: ArtifactRecord, content: unknown): Promise<ArtifactRecord>;
|
|
@@ -54,6 +54,7 @@ export class FilePersistence {
|
|
|
54
54
|
threadId: input.threadId,
|
|
55
55
|
agentId: input.agentId,
|
|
56
56
|
executionMode: input.executionMode,
|
|
57
|
+
adapterKind: input.adapterKind ?? input.executionMode,
|
|
57
58
|
createdAt: input.createdAt,
|
|
58
59
|
updatedAt: input.createdAt,
|
|
59
60
|
};
|
|
@@ -218,6 +219,7 @@ export class FilePersistence {
|
|
|
218
219
|
runId: meta.runId,
|
|
219
220
|
agentId: meta.agentId,
|
|
220
221
|
executionMode: meta.executionMode,
|
|
222
|
+
adapterKind: meta.adapterKind ?? meta.executionMode,
|
|
221
223
|
createdAt: meta.createdAt,
|
|
222
224
|
updatedAt: meta.updatedAt,
|
|
223
225
|
state: lifecycle.state,
|
|
@@ -15,7 +15,6 @@ declare class RuntimeOperationTimeoutError extends Error {
|
|
|
15
15
|
export declare class AgentRuntimeAdapter {
|
|
16
16
|
private readonly options;
|
|
17
17
|
constructor(options?: RuntimeAdapterOptions);
|
|
18
|
-
private canUseSimpleDeepAgentFastPath;
|
|
19
18
|
private resolveBindingTimeout;
|
|
20
19
|
private resolveStreamIdleTimeout;
|
|
21
20
|
private withTimeout;
|
|
@@ -28,6 +27,7 @@ export declare class AgentRuntimeAdapter {
|
|
|
28
27
|
private buildToolNameMapping;
|
|
29
28
|
private buildAgentMessages;
|
|
30
29
|
private buildInvocationRequest;
|
|
30
|
+
private buildStateSnapshot;
|
|
31
31
|
private buildRawModelMessages;
|
|
32
32
|
private resolveTools;
|
|
33
33
|
private normalizeInterruptPolicy;
|