@botbotgo/agent-harness 0.0.54 → 0.0.56
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 +70 -43
- package/dist/config/agents/direct.yaml +18 -0
- package/dist/config/agents/orchestra.yaml +10 -0
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/runtime/agent-runtime-adapter.js +10 -0
- package/dist/runtime/declared-middleware.d.ts +5 -0
- package/dist/runtime/declared-middleware.js +38 -2
- package/dist/workspace/validate.js +3 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ That means:
|
|
|
18
18
|
- runtime lifecycle stays stable even if backend implementations change
|
|
19
19
|
- backend internals stay behind adapters
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
The runtime provides:
|
|
22
22
|
|
|
23
23
|
- `createAgentHarness(workspaceRoot)`, `run(...)`, `resolveApproval(...)`, `subscribe(...)`, inspection methods, and `stop(...)`
|
|
24
24
|
- YAML-defined workspace assembly for routing, models, tools, stores, backends, MCP, recovery, and maintenance
|
|
@@ -26,6 +26,19 @@ What the runtime provides:
|
|
|
26
26
|
- local `resources/tools/` and `resources/skills/` discovery
|
|
27
27
|
- persisted threads, runs, approvals, events, queue state, and recovery metadata
|
|
28
28
|
|
|
29
|
+
The repository-owned default config layer is intentionally full-shaped. The shipped YAML keeps explicit defaults for the important runtime and agent knobs so teams can start from concrete config instead of reverse-engineering adapter behavior from source.
|
|
30
|
+
|
|
31
|
+
The default rule is:
|
|
32
|
+
|
|
33
|
+
- if LangChain v1 or DeepAgents already has the feature, map it in YAML and adapt it internally
|
|
34
|
+
- do not add a new public runtime API unless the problem is truly runtime-owned
|
|
35
|
+
|
|
36
|
+
Boundary documents live in:
|
|
37
|
+
|
|
38
|
+
- `docs/upstream-feature-matrix.md`
|
|
39
|
+
- `docs/product-boundary.md`
|
|
40
|
+
- `docs/feature-checklist.md`
|
|
41
|
+
|
|
29
42
|
## Quick Start
|
|
30
43
|
|
|
31
44
|
Install:
|
|
@@ -100,7 +113,7 @@ import { AgentHarnessRuntime, createAgentHarness } from "@botbotgo/agent-harness
|
|
|
100
113
|
const runtime: AgentHarnessRuntime = await createAgentHarness("/absolute/path/to/workspace");
|
|
101
114
|
```
|
|
102
115
|
|
|
103
|
-
`createAgentHarness(...)` loads
|
|
116
|
+
`createAgentHarness(...)` loads the workspace, resolves `resources/`, initializes persistence under `runRoot`, and starts runtime maintenance.
|
|
104
117
|
|
|
105
118
|
### Run A Request
|
|
106
119
|
|
|
@@ -124,7 +137,7 @@ const result = await run(runtime, {
|
|
|
124
137
|
});
|
|
125
138
|
```
|
|
126
139
|
|
|
127
|
-
`run(runtime, { ... })` creates or continues a persisted thread and returns `threadId`, `runId`, `state`, and
|
|
140
|
+
`run(runtime, { ... })` creates or continues a persisted thread and returns `threadId`, `runId`, `state`, and compact text `output`. Richer upstream result shapes stay available through `outputContent`, `contentBlocks`, and `structuredResponse`.
|
|
128
141
|
|
|
129
142
|
Use `invocation` as the runtime-facing request envelope:
|
|
130
143
|
|
|
@@ -163,7 +176,7 @@ const result = await run(runtime, {
|
|
|
163
176
|
});
|
|
164
177
|
```
|
|
165
178
|
|
|
166
|
-
`subscribe(...)` is
|
|
179
|
+
`subscribe(...)` is the read-only observer surface over stored lifecycle events.
|
|
167
180
|
|
|
168
181
|
The runtime event stream includes:
|
|
169
182
|
|
|
@@ -199,9 +212,11 @@ if (approval) {
|
|
|
199
212
|
}
|
|
200
213
|
```
|
|
201
214
|
|
|
202
|
-
These methods return runtime-facing records, not raw
|
|
215
|
+
These methods return runtime-facing records, not raw checkpoint or backend objects.
|
|
216
|
+
|
|
217
|
+
### Expose And Consume MCP
|
|
203
218
|
|
|
204
|
-
|
|
219
|
+
Bridge MCP servers into agents:
|
|
205
220
|
|
|
206
221
|
```yaml
|
|
207
222
|
apiVersion: agent-harness/v1alpha1
|
|
@@ -218,9 +233,7 @@ spec:
|
|
|
218
233
|
args: ["./mcp-browser-server.mjs"]
|
|
219
234
|
```
|
|
220
235
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
### Expose Runtime Tools As An MCP Server
|
|
236
|
+
Expose harness tools as an MCP server:
|
|
224
237
|
|
|
225
238
|
```ts
|
|
226
239
|
import { createToolMcpServer, serveToolsOverStdio } from "@botbotgo/agent-harness";
|
|
@@ -242,7 +255,7 @@ await stop(runtime);
|
|
|
242
255
|
Use Kubernetes-style YAML:
|
|
243
256
|
|
|
244
257
|
- collection files use `apiVersion`, plural `kind`, and `spec: []`
|
|
245
|
-
-
|
|
258
|
+
- singleton files use `apiVersion`, singular `kind`, `metadata`, and `spec`
|
|
246
259
|
|
|
247
260
|
Core workspace files:
|
|
248
261
|
|
|
@@ -260,19 +273,17 @@ Core workspace files:
|
|
|
260
273
|
- `resources/tools/`
|
|
261
274
|
- `resources/skills/`
|
|
262
275
|
|
|
263
|
-
There are three configuration layers:
|
|
276
|
+
There are three main configuration layers:
|
|
264
277
|
|
|
265
278
|
- runtime policy in `config/workspace.yaml`
|
|
266
279
|
- reusable object catalogs in `config/*.yaml`
|
|
267
280
|
- agent assembly in `config/agents/*.yaml`
|
|
268
281
|
|
|
269
|
-
The repository-owned default config layer is intentionally full-shaped. The shipped YAML keeps explicit default values for the main runtime knobs so teams can start from concrete config instead of reconstructing adapter defaults from code.
|
|
270
|
-
|
|
271
282
|
### `config/workspace.yaml`
|
|
272
283
|
|
|
273
|
-
Use this file for
|
|
284
|
+
Use this file for workspace-wide runtime policy.
|
|
274
285
|
|
|
275
|
-
|
|
286
|
+
Important fields:
|
|
276
287
|
|
|
277
288
|
- `runRoot`
|
|
278
289
|
- `concurrency.maxConcurrentRuns`
|
|
@@ -285,13 +296,36 @@ Primary fields:
|
|
|
285
296
|
- `recovery.resumeResumingRunsOnStartup`
|
|
286
297
|
- `recovery.maxRecoveryAttempts`
|
|
287
298
|
|
|
288
|
-
|
|
299
|
+
`recovery.resumeResumingRunsOnStartup` keeps checkpoint resume a runtime-owned lifecycle behavior instead of exposing checkpoint orchestration as public API.
|
|
300
|
+
|
|
301
|
+
Example:
|
|
302
|
+
|
|
303
|
+
```yaml
|
|
304
|
+
apiVersion: agent-harness/v1alpha1
|
|
305
|
+
kind: Runtime
|
|
306
|
+
metadata:
|
|
307
|
+
name: default
|
|
308
|
+
spec:
|
|
309
|
+
runRoot: ./.agent
|
|
310
|
+
concurrency:
|
|
311
|
+
maxConcurrentRuns: 3
|
|
312
|
+
routing:
|
|
313
|
+
defaultAgentId: orchestra
|
|
314
|
+
modelRouting: false
|
|
315
|
+
maintenance:
|
|
316
|
+
checkpoints:
|
|
317
|
+
enabled: true
|
|
318
|
+
recovery:
|
|
319
|
+
enabled: true
|
|
320
|
+
resumeResumingRunsOnStartup: true
|
|
321
|
+
maxRecoveryAttempts: 3
|
|
322
|
+
```
|
|
289
323
|
|
|
290
324
|
### `config/agent-context.md`
|
|
291
325
|
|
|
292
|
-
Use this file for shared bootstrap
|
|
326
|
+
Use this file for shared bootstrap memory loaded at agent construction time.
|
|
293
327
|
|
|
294
|
-
|
|
328
|
+
Keep stable project context here. Treat it as startup context, not mutable long-term memory.
|
|
295
329
|
|
|
296
330
|
### `config/models.yaml`
|
|
297
331
|
|
|
@@ -340,7 +374,7 @@ spec:
|
|
|
340
374
|
|
|
341
375
|
### `config/backends.yaml`
|
|
342
376
|
|
|
343
|
-
Use reusable
|
|
377
|
+
Use reusable DeepAgents backend presets so filesystem and `/memories/*` topology stays in YAML:
|
|
344
378
|
|
|
345
379
|
```yaml
|
|
346
380
|
apiVersion: agent-harness/v1alpha1
|
|
@@ -363,9 +397,7 @@ spec:
|
|
|
363
397
|
|
|
364
398
|
Use this file for reusable tool objects.
|
|
365
399
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
Provider-native tools are declared in YAML and resolved directly to upstream provider tool factories.
|
|
400
|
+
Built-in tool families include function tools, backend tools, MCP tools, bundles, and provider-native tools. Provider-native tools are declared in YAML and resolved directly to upstream factories.
|
|
369
401
|
|
|
370
402
|
### `config/mcp.yaml`
|
|
371
403
|
|
|
@@ -373,16 +405,14 @@ Use this file for named MCP server presets.
|
|
|
373
405
|
|
|
374
406
|
### `config/agents/*.yaml`
|
|
375
407
|
|
|
376
|
-
Agents
|
|
408
|
+
Agents always use `kind: Agent` plus `spec.execution.backend`.
|
|
377
409
|
|
|
378
|
-
Use two nested sections
|
|
410
|
+
Use two nested sections:
|
|
379
411
|
|
|
380
412
|
- `spec.runtime` for harness-owned runtime placement such as `spec.runtime.runRoot`
|
|
381
413
|
- `spec.execution` for upstream execution semantics and adapter-facing config
|
|
382
414
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
Example lightweight host:
|
|
415
|
+
Example direct host:
|
|
386
416
|
|
|
387
417
|
```yaml
|
|
388
418
|
apiVersion: agent-harness/v1alpha1
|
|
@@ -406,11 +436,15 @@ spec:
|
|
|
406
436
|
store:
|
|
407
437
|
ref: store/default
|
|
408
438
|
interruptOn: {}
|
|
439
|
+
filesystem:
|
|
440
|
+
rootDir: .
|
|
441
|
+
virtualMode: true
|
|
442
|
+
maxFileSizeMb: 10
|
|
409
443
|
middleware: []
|
|
410
444
|
systemPrompt: Answer simple requests directly.
|
|
411
445
|
```
|
|
412
446
|
|
|
413
|
-
Example
|
|
447
|
+
Example orchestra host:
|
|
414
448
|
|
|
415
449
|
```yaml
|
|
416
450
|
apiVersion: agent-harness/v1alpha1
|
|
@@ -439,36 +473,29 @@ spec:
|
|
|
439
473
|
interruptOn: {}
|
|
440
474
|
middleware: []
|
|
441
475
|
generalPurposeAgent: true
|
|
442
|
-
taskDescription: Complete delegated sidecar work and return concise results.
|
|
476
|
+
taskDescription: Complete delegated sidecar work and return concise results without bloating the parent context.
|
|
443
477
|
```
|
|
444
478
|
|
|
445
|
-
For backend-specific
|
|
446
|
-
|
|
447
|
-
### `resources/`
|
|
448
|
-
|
|
449
|
-
Use `resources/` for executable local extensions:
|
|
450
|
-
|
|
451
|
-
- `resources/tools/` for tool modules
|
|
452
|
-
- `resources/skills/` for SKILL packages
|
|
453
|
-
|
|
454
|
-
Tool modules are discovered from `resources/tools/*.js`, `resources/tools/*.mjs`, and `resources/tools/*.cjs`.
|
|
479
|
+
For backend-specific options, prefer the upstream concept directly inside `spec.execution.config`. Upstream feature coverage is tracked in [docs/upstream-feature-matrix.md](docs/upstream-feature-matrix.md).
|
|
455
480
|
|
|
456
481
|
## Design Notes
|
|
457
482
|
|
|
483
|
+
- `agent-harness` is not a third agent framework
|
|
458
484
|
- public runtime contract stays generic and small
|
|
459
485
|
- application-level orchestration and lifecycle management stays in the harness
|
|
460
486
|
- upstream LangChain v1 and DeepAgents concepts should be expressed as directly as possible in YAML
|
|
461
|
-
-
|
|
462
|
-
-
|
|
463
|
-
- new LangChain v1 or DeepAgents
|
|
487
|
+
- when a feature can be expressed in YAML, prefer YAML over expanding the public API
|
|
488
|
+
- recovery, approvals, threads, runs, and events are runtime concepts, not backend escape hatches
|
|
489
|
+
- new LangChain v1 or DeepAgents config should land in YAML mapping and tests before adding public runtime APIs
|
|
464
490
|
|
|
465
|
-
In short
|
|
491
|
+
In short, the product model stays stable while the execution semantics remain upstream-owned.
|
|
466
492
|
|
|
467
493
|
## API Summary
|
|
468
494
|
|
|
469
495
|
Primary exports:
|
|
470
496
|
|
|
471
497
|
- `createAgentHarness`
|
|
498
|
+
- `AgentHarnessRuntime`
|
|
472
499
|
- `run`
|
|
473
500
|
- `resolveApproval`
|
|
474
501
|
- `subscribe`
|
|
@@ -46,7 +46,25 @@ spec:
|
|
|
46
46
|
ref: store/default
|
|
47
47
|
# Upstream execution feature: no declarative HITL tool routing by default.
|
|
48
48
|
interruptOn: {}
|
|
49
|
+
# Upstream execution feature: filesystem middleware settings for LangChain v1 agents.
|
|
50
|
+
# This only becomes active when `middleware` includes `{ kind: filesystem }`, or when
|
|
51
|
+
# automatic upstream middleware such as skills or memory need a filesystem backend.
|
|
52
|
+
# Keep the default root inside the workspace so file-aware middleware stays bounded.
|
|
53
|
+
filesystem:
|
|
54
|
+
rootDir: .
|
|
55
|
+
virtualMode: true
|
|
56
|
+
maxFileSizeMb: 10
|
|
49
57
|
# Upstream execution feature: no extra declarative middleware beyond the runtime's automatic injections.
|
|
58
|
+
# Common upstream middleware kinds that this harness can compile directly from YAML:
|
|
59
|
+
# - `filesystem`
|
|
60
|
+
# - `patchToolCalls`
|
|
61
|
+
# - `summarization`
|
|
62
|
+
# - `dynamicSystemPrompt`
|
|
63
|
+
# - `humanInTheLoop`
|
|
64
|
+
# - `todoList`
|
|
65
|
+
# - `pii`, `piiRedaction`
|
|
66
|
+
#
|
|
67
|
+
# Keep the default empty so the lightweight direct host stays minimal.
|
|
50
68
|
middleware: []
|
|
51
69
|
# Upstream execution feature: system prompt for the lightweight direct-response host.
|
|
52
70
|
# This prompt should keep the agent focused on:
|
|
@@ -66,6 +66,16 @@ spec:
|
|
|
66
66
|
# Upstream execution feature: no extra declarative HITL rules by default.
|
|
67
67
|
interruptOn: {}
|
|
68
68
|
# Upstream execution feature: no extra declarative middleware beyond upstream deepagents defaults by default.
|
|
69
|
+
# Common upstream middleware kinds that this harness can compile directly from YAML:
|
|
70
|
+
# - `patchToolCalls`
|
|
71
|
+
# - `summarization`
|
|
72
|
+
# - `dynamicSystemPrompt`
|
|
73
|
+
# - `humanInTheLoop`
|
|
74
|
+
# - `todoList`
|
|
75
|
+
# - `pii`, `piiRedaction`
|
|
76
|
+
#
|
|
77
|
+
# DeepAgents already includes its own filesystem, planning, subagent, and memory semantics.
|
|
78
|
+
# Keep this list empty unless you are intentionally adding extra upstream middleware on top.
|
|
69
79
|
middleware: []
|
|
70
80
|
# Upstream execution feature: keep the built-in general-purpose subagent enabled.
|
|
71
81
|
generalPurposeAgent: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.55";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.55";
|
|
@@ -525,6 +525,8 @@ export class AgentRuntimeAdapter {
|
|
|
525
525
|
async resolveMiddleware(binding, interruptOn) {
|
|
526
526
|
const declarativeMiddleware = await resolveDeclaredMiddleware(getBindingMiddlewareConfigs(binding), {
|
|
527
527
|
resolveModel: (model) => this.resolveModel(model),
|
|
528
|
+
resolveBackend: (resolvedBinding) => this.options.backendResolver?.(resolvedBinding ?? binding),
|
|
529
|
+
resolveFilesystemBackend: (resolvedBinding) => this.resolveFilesystemBackend(resolvedBinding ?? binding),
|
|
528
530
|
resolveCustom: this.options.declaredMiddlewareResolver,
|
|
529
531
|
binding,
|
|
530
532
|
});
|
|
@@ -575,6 +577,14 @@ export class AgentRuntimeAdapter {
|
|
|
575
577
|
contextSchema: subagent.contextSchema,
|
|
576
578
|
middleware: (await resolveDeclaredMiddleware(subagent.middleware, {
|
|
577
579
|
resolveModel: (model) => this.resolveModel(model),
|
|
580
|
+
resolveBackend: (resolvedBinding) => {
|
|
581
|
+
const targetBinding = resolvedBinding ?? binding;
|
|
582
|
+
return targetBinding ? this.options.backendResolver?.(targetBinding) : undefined;
|
|
583
|
+
},
|
|
584
|
+
resolveFilesystemBackend: (resolvedBinding) => {
|
|
585
|
+
const targetBinding = resolvedBinding ?? binding;
|
|
586
|
+
return targetBinding ? this.resolveFilesystemBackend(targetBinding) : undefined;
|
|
587
|
+
},
|
|
578
588
|
resolveCustom: this.options.declaredMiddlewareResolver,
|
|
579
589
|
binding,
|
|
580
590
|
})),
|
|
@@ -3,12 +3,17 @@ type MiddlewareConfig = Record<string, unknown>;
|
|
|
3
3
|
type MiddlewareFactoryContext = {
|
|
4
4
|
config: MiddlewareConfig;
|
|
5
5
|
resolveModel: (model: CompiledModel) => Promise<unknown>;
|
|
6
|
+
resolveBackend?: () => unknown;
|
|
7
|
+
resolveFilesystemBackend?: () => unknown;
|
|
8
|
+
binding?: CompiledAgentBinding;
|
|
6
9
|
};
|
|
7
10
|
type MiddlewareFactory = (context: MiddlewareFactoryContext) => Promise<unknown | unknown[] | null | undefined>;
|
|
8
11
|
export declare const DECLARATIVE_MIDDLEWARE_REGISTRY: Record<string, MiddlewareFactory>;
|
|
9
12
|
export declare const SUPPORTED_DECLARATIVE_MIDDLEWARE_KINDS: readonly string[];
|
|
10
13
|
export declare function resolveDeclaredMiddleware(middlewareConfigs: unknown[] | undefined, options: {
|
|
11
14
|
resolveModel: (model: CompiledModel) => Promise<unknown>;
|
|
15
|
+
resolveBackend?: (binding?: CompiledAgentBinding) => unknown;
|
|
16
|
+
resolveFilesystemBackend?: (binding?: CompiledAgentBinding) => unknown;
|
|
12
17
|
resolveCustom?: (input: {
|
|
13
18
|
kind: string;
|
|
14
19
|
config: Record<string, unknown>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { anthropicPromptCachingMiddleware, contextEditingMiddleware, humanInTheLoopMiddleware, llmToolSelectorMiddleware, modelCallLimitMiddleware, modelFallbackMiddleware, modelRetryMiddleware, openAIModerationMiddleware, piiMiddleware, summarizationMiddleware, todoListMiddleware, toolCallLimitMiddleware, toolEmulatorMiddleware, toolRetryMiddleware, } from "langchain";
|
|
1
|
+
import { anthropicPromptCachingMiddleware, contextEditingMiddleware, dynamicSystemPromptMiddleware, humanInTheLoopMiddleware, llmToolSelectorMiddleware, modelCallLimitMiddleware, modelFallbackMiddleware, modelRetryMiddleware, openAIModerationMiddleware, piiMiddleware, piiRedactionMiddleware, summarizationMiddleware, todoListMiddleware, toolCallLimitMiddleware, toolEmulatorMiddleware, toolRetryMiddleware, } from "langchain";
|
|
2
|
+
import { createFilesystemMiddleware, createPatchToolCallsMiddleware, createSummarizationMiddleware as createDeepAgentSummarizationMiddleware, } from "deepagents";
|
|
2
3
|
function asMiddlewareConfig(value) {
|
|
3
4
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? { ...value } : null;
|
|
4
5
|
}
|
|
@@ -26,6 +27,18 @@ async function resolveReferencedModelList(values, options) {
|
|
|
26
27
|
return Promise.all(values.map((value) => resolveReferencedModel(value, options)));
|
|
27
28
|
}
|
|
28
29
|
async function createSummarizationMiddleware({ config, resolveModel }) {
|
|
30
|
+
if (config.provider === "deepagents") {
|
|
31
|
+
const runtimeConfig = { ...config };
|
|
32
|
+
runtimeConfig.model = await resolveReferencedModel(runtimeConfig.model, { resolveModel });
|
|
33
|
+
if (runtimeConfig.model === undefined) {
|
|
34
|
+
throw new Error("deepagents summarization middleware requires model or modelRef");
|
|
35
|
+
}
|
|
36
|
+
if (runtimeConfig.backend === undefined) {
|
|
37
|
+
throw new Error("deepagents summarization middleware requires backend");
|
|
38
|
+
}
|
|
39
|
+
delete runtimeConfig.provider;
|
|
40
|
+
return createDeepAgentSummarizationMiddleware(runtimeConfig);
|
|
41
|
+
}
|
|
29
42
|
const runtimeConfig = { ...config };
|
|
30
43
|
runtimeConfig.model = await resolveReferencedModel(runtimeConfig.model, { resolveModel });
|
|
31
44
|
if (runtimeConfig.model === undefined) {
|
|
@@ -33,6 +46,17 @@ async function createSummarizationMiddleware({ config, resolveModel }) {
|
|
|
33
46
|
}
|
|
34
47
|
return summarizationMiddleware(runtimeConfig);
|
|
35
48
|
}
|
|
49
|
+
async function createBindingAwareSummarizationMiddleware(context) {
|
|
50
|
+
const runtimeConfig = { ...context.config };
|
|
51
|
+
if (context.binding?.agent.executionMode === "deepagent") {
|
|
52
|
+
runtimeConfig.provider = "deepagents";
|
|
53
|
+
runtimeConfig.backend ??= context.resolveBackend?.() ?? context.resolveFilesystemBackend?.();
|
|
54
|
+
}
|
|
55
|
+
return createSummarizationMiddleware({
|
|
56
|
+
...context,
|
|
57
|
+
config: runtimeConfig,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
36
60
|
async function createLlmToolSelectorMiddleware({ config, resolveModel }) {
|
|
37
61
|
const runtimeConfig = { ...config };
|
|
38
62
|
runtimeConfig.model = await resolveReferencedModel(runtimeConfig.model, { resolveModel });
|
|
@@ -54,8 +78,15 @@ async function createPiiDeclarativeMiddleware({ config }) {
|
|
|
54
78
|
const { piiType: _piiType, ...piiOptions } = config;
|
|
55
79
|
return piiMiddleware(piiType, piiOptions);
|
|
56
80
|
}
|
|
81
|
+
async function createFilesystemDeclarativeMiddleware({ config, resolveFilesystemBackend }) {
|
|
82
|
+
const runtimeConfig = { ...config };
|
|
83
|
+
runtimeConfig.backend ??= resolveFilesystemBackend?.();
|
|
84
|
+
return createFilesystemMiddleware(runtimeConfig);
|
|
85
|
+
}
|
|
57
86
|
export const DECLARATIVE_MIDDLEWARE_REGISTRY = {
|
|
58
|
-
|
|
87
|
+
filesystem: createFilesystemDeclarativeMiddleware,
|
|
88
|
+
patchToolCalls: async () => createPatchToolCallsMiddleware(),
|
|
89
|
+
summarization: createBindingAwareSummarizationMiddleware,
|
|
59
90
|
llmToolSelector: createLlmToolSelectorMiddleware,
|
|
60
91
|
modelRetry: async ({ config }) => modelRetryMiddleware(config),
|
|
61
92
|
modelFallback: createModelFallbackDeclarativeMiddleware,
|
|
@@ -64,10 +95,12 @@ export const DECLARATIVE_MIDDLEWARE_REGISTRY = {
|
|
|
64
95
|
modelCallLimit: async ({ config }) => modelCallLimitMiddleware(config),
|
|
65
96
|
todoList: async ({ config }) => todoListMiddleware(config),
|
|
66
97
|
contextEditing: async ({ config }) => contextEditingMiddleware(config),
|
|
98
|
+
dynamicSystemPrompt: async ({ config }) => dynamicSystemPromptMiddleware(config),
|
|
67
99
|
toolEmulator: async ({ config }) => toolEmulatorMiddleware(config),
|
|
68
100
|
humanInTheLoop: async ({ config }) => humanInTheLoopMiddleware(config),
|
|
69
101
|
openAIModeration: async ({ config }) => openAIModerationMiddleware(config),
|
|
70
102
|
pii: createPiiDeclarativeMiddleware,
|
|
103
|
+
piiRedaction: async ({ config }) => piiRedactionMiddleware(config),
|
|
71
104
|
anthropicPromptCaching: async ({ config }) => anthropicPromptCachingMiddleware(config),
|
|
72
105
|
};
|
|
73
106
|
export const SUPPORTED_DECLARATIVE_MIDDLEWARE_KINDS = Object.freeze(Object.keys(DECLARATIVE_MIDDLEWARE_REGISTRY).sort());
|
|
@@ -85,6 +118,9 @@ export async function resolveDeclaredMiddleware(middlewareConfigs, options) {
|
|
|
85
118
|
const resolvedBuiltin = await registeredFactory({
|
|
86
119
|
config: runtimeConfig,
|
|
87
120
|
resolveModel: options.resolveModel,
|
|
121
|
+
resolveBackend: () => options.resolveBackend?.(options.binding),
|
|
122
|
+
resolveFilesystemBackend: () => options.resolveFilesystemBackend?.(options.binding),
|
|
123
|
+
binding: options.binding,
|
|
88
124
|
});
|
|
89
125
|
if (Array.isArray(resolvedBuiltin)) {
|
|
90
126
|
resolved.push(...resolvedBuiltin);
|
|
@@ -41,6 +41,9 @@ function validateMiddlewareConfig(agent) {
|
|
|
41
41
|
if (kind === "humanInTheLoop" && typeof typed.interruptOn !== "object") {
|
|
42
42
|
throw new Error(`Agent ${agent.id} humanInTheLoop middleware requires interruptOn`);
|
|
43
43
|
}
|
|
44
|
+
if (kind === "filesystem" && agent.executionMode === "deepagent") {
|
|
45
|
+
throw new Error(`Agent ${agent.id} cannot use filesystem middleware with DeepAgents; configure filesystem behavior through the deepagent backend instead`);
|
|
46
|
+
}
|
|
44
47
|
if (kind === "pii" && typeof typed.piiType !== "string") {
|
|
45
48
|
throw new Error(`Agent ${agent.id} pii middleware requires piiType`);
|
|
46
49
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botbotgo/agent-harness",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.56",
|
|
4
4
|
"description": "Workspace runtime for multi-agent applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "npm@10.9.2",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json && cp -R config dist/",
|
|
52
52
|
"check": "tsc -p tsconfig.json --noEmit",
|
|
53
|
-
"test": "vitest run test/public-api.test.ts test/resource-optional-provider.test.ts test/resource-isolation.test.ts test/stock-research-app-load-harness.test.ts test/stock-research-app-run.test.ts test/stock-research-app-config.test.ts test/release-workflow.test.ts test/release-version.test.ts test/gitignore.test.ts test/package-lock.test.ts test/readme.test.ts test/runtime-adapter-regressions.test.ts test/runtime-capabilities.test.ts test/runtime-recovery.test.ts test/tool-extension-gaps.test.ts test/checkpoint-maintenance.test.ts test/llamaindex-dependency-compat.test.ts test/skill-standard.test.ts test/routing-config.test.ts test/workspace-compat-regressions.test.ts test/upstream-compat-regressions.test.ts test/yaml-format.test.ts",
|
|
53
|
+
"test": "vitest run test/public-api.test.ts test/resource-optional-provider.test.ts test/resource-isolation.test.ts test/stock-research-app-load-harness.test.ts test/stock-research-app-run.test.ts test/stock-research-app-config.test.ts test/release-workflow.test.ts test/release-version.test.ts test/gitignore.test.ts test/package-lock.test.ts test/readme.test.ts test/product-boundary-docs.test.ts test/runtime-adapter-regressions.test.ts test/runtime-capabilities.test.ts test/runtime-recovery.test.ts test/tool-extension-gaps.test.ts test/checkpoint-maintenance.test.ts test/llamaindex-dependency-compat.test.ts test/skill-standard.test.ts test/routing-config.test.ts test/workspace-compat-regressions.test.ts test/upstream-compat-regressions.test.ts test/yaml-format.test.ts",
|
|
54
54
|
"test:real-providers": "vitest run test/real-provider-harness.test.ts",
|
|
55
55
|
"release:prepare": "npm version patch --no-git-tag-version && node ./scripts/sync-example-version.mjs",
|
|
56
56
|
"release:pack": "npm pack --dry-run",
|