@botbotgo/agent-harness 0.0.17 → 0.0.19
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 +95 -387
- package/dist/api.d.ts +3 -0
- package/dist/api.js +7 -0
- package/dist/config/agent-context.md +8 -0
- package/dist/config/orchestra.yaml +11 -8
- package/dist/config/{runtime.yaml → workspace.yaml} +23 -0
- package/dist/contracts/types.d.ts +14 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/mcp.d.ts +12 -0
- package/dist/mcp.js +112 -0
- package/dist/resource/isolation.d.ts +2 -0
- package/dist/resource/isolation.js +79 -0
- package/dist/resource/resource-impl.d.ts +18 -0
- package/dist/resource/resource-impl.js +179 -11
- package/dist/resource/sources.d.ts +3 -0
- package/dist/resource/sources.js +105 -25
- package/dist/runtime/checkpoint-maintenance.d.ts +36 -0
- package/dist/runtime/checkpoint-maintenance.js +223 -0
- package/dist/runtime/harness.d.ts +10 -1
- package/dist/runtime/harness.js +38 -2
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +2 -0
- package/dist/runtime/sqlite-maintained-checkpoint-saver.d.ts +9 -0
- package/dist/runtime/sqlite-maintained-checkpoint-saver.js +39 -0
- package/dist/runtime/support/runtime-factories.js +3 -1
- package/dist/tool-modules.d.ts +17 -0
- package/dist/tool-modules.js +143 -0
- package/dist/tools.d.ts +20 -0
- package/dist/tools.js +17 -0
- package/dist/workspace/compile.js +124 -5
- package/dist/workspace/object-loader.js +90 -24
- package/dist/workspace/resource-compilers.d.ts +3 -1
- package/dist/workspace/resource-compilers.js +72 -5
- package/package.json +10 -3
|
@@ -13,6 +13,15 @@ function asRefArray(value) {
|
|
|
13
13
|
function toArray(value) {
|
|
14
14
|
return Array.isArray(value) ? value : [];
|
|
15
15
|
}
|
|
16
|
+
function mergeObjects(base, extra) {
|
|
17
|
+
if (!base && !extra) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
...(base ?? {}),
|
|
22
|
+
...(extra ?? {}),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
16
25
|
function parseHitlPolicy(value) {
|
|
17
26
|
const record = asObject(value);
|
|
18
27
|
if (!record) {
|
|
@@ -81,6 +90,27 @@ export function parseVectorStoreObject(object) {
|
|
|
81
90
|
sourcePath: object.sourcePath,
|
|
82
91
|
};
|
|
83
92
|
}
|
|
93
|
+
export function parseMcpServerObject(object) {
|
|
94
|
+
const value = object.value;
|
|
95
|
+
const env = asObject(value.env);
|
|
96
|
+
const headers = asObject(value.headers);
|
|
97
|
+
const transport = String(value.transport ??
|
|
98
|
+
(typeof value.url === "string" && value.url.trim() ? "http" : undefined) ??
|
|
99
|
+
(typeof value.command === "string" && value.command.trim() ? "stdio" : undefined) ??
|
|
100
|
+
"stdio").trim();
|
|
101
|
+
return {
|
|
102
|
+
id: object.id,
|
|
103
|
+
transport,
|
|
104
|
+
url: typeof value.url === "string" ? value.url : undefined,
|
|
105
|
+
command: typeof value.command === "string" ? value.command : undefined,
|
|
106
|
+
args: asStringArray(value.args),
|
|
107
|
+
env: env ? Object.fromEntries(Object.entries(env).filter((entry) => typeof entry[1] === "string")) : undefined,
|
|
108
|
+
cwd: typeof value.cwd === "string" ? value.cwd : undefined,
|
|
109
|
+
token: typeof value.token === "string" ? value.token : undefined,
|
|
110
|
+
headers: headers ? Object.fromEntries(Object.entries(headers).filter((entry) => typeof entry[1] === "string")) : undefined,
|
|
111
|
+
sourcePath: object.sourcePath,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
84
114
|
export function validateModelObject(model, models) {
|
|
85
115
|
if (!model.provider) {
|
|
86
116
|
throw new Error(`Model ${model.id} provider must not be empty`);
|
|
@@ -111,6 +141,20 @@ export function validateVectorStoreObject(vectorStore) {
|
|
|
111
141
|
throw new Error(`Vector store ${vectorStore.id} url must not be empty for ${vectorStore.kind}`);
|
|
112
142
|
}
|
|
113
143
|
}
|
|
144
|
+
export function validateMcpServerObject(server) {
|
|
145
|
+
if (!server.id.trim()) {
|
|
146
|
+
throw new Error("MCP server id must not be empty");
|
|
147
|
+
}
|
|
148
|
+
if (server.transport === "stdio") {
|
|
149
|
+
if (!server.command?.trim()) {
|
|
150
|
+
throw new Error(`MCP server ${server.id} command must not be empty for stdio transport`);
|
|
151
|
+
}
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (!server.url?.trim()) {
|
|
155
|
+
throw new Error(`MCP server ${server.id} url must not be empty for ${server.transport} transport`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
114
158
|
export function compileModel(model) {
|
|
115
159
|
return {
|
|
116
160
|
id: model.id,
|
|
@@ -148,28 +192,51 @@ export function parseToolObject(object) {
|
|
|
148
192
|
const value = object.value;
|
|
149
193
|
const backend = asObject(value.backend);
|
|
150
194
|
const mcp = asObject(value.mcp);
|
|
195
|
+
const mcpReferenceConfig = mcp
|
|
196
|
+
? {
|
|
197
|
+
...(typeof mcp.serverRef === "string"
|
|
198
|
+
? { serverRef: mcp.serverRef }
|
|
199
|
+
: typeof mcp.server === "string"
|
|
200
|
+
? { serverRef: mcp.server }
|
|
201
|
+
: {}),
|
|
202
|
+
}
|
|
203
|
+
: undefined;
|
|
204
|
+
const mcpServerConfig = mcp
|
|
205
|
+
? Object.fromEntries(Object.entries(mcp).filter(([key]) => key !== "ref" && key !== "serverRef" && key !== "tool"))
|
|
206
|
+
: undefined;
|
|
151
207
|
const bundleRefs = asRefArray(value.refs ?? value.bundle);
|
|
152
208
|
const inferredType = typeof value.type === "string"
|
|
153
209
|
? value.type
|
|
154
210
|
: bundleRefs.length > 0
|
|
155
211
|
? "bundle"
|
|
156
|
-
:
|
|
157
|
-
? "
|
|
158
|
-
:
|
|
212
|
+
: mcp
|
|
213
|
+
? "mcp"
|
|
214
|
+
: backend
|
|
215
|
+
? "backend"
|
|
216
|
+
: "function";
|
|
159
217
|
return {
|
|
160
218
|
id: object.id,
|
|
161
219
|
type: String(inferredType),
|
|
162
220
|
name: String(value.name ?? "").trim(),
|
|
163
221
|
description: String(value.description ?? "").trim(),
|
|
164
222
|
implementationName: typeof value.implementationName === "string" ? value.implementationName : undefined,
|
|
165
|
-
config: asObject(value.config),
|
|
223
|
+
config: mergeObjects(asObject(value.config), (mcpReferenceConfig && Object.keys(mcpReferenceConfig).length > 0) || (mcpServerConfig && Object.keys(mcpServerConfig).length > 0)
|
|
224
|
+
? {
|
|
225
|
+
mcp: mcpReferenceConfig,
|
|
226
|
+
...(mcpServerConfig && Object.keys(mcpServerConfig).length > 0 ? { mcpServer: mcpServerConfig } : {}),
|
|
227
|
+
}
|
|
228
|
+
: undefined),
|
|
166
229
|
inputSchemaRef: typeof asObject(value.inputSchema)?.ref === "string" ? String(asObject(value.inputSchema)?.ref) : undefined,
|
|
167
230
|
backendOperation: typeof backend?.operation === "string"
|
|
168
231
|
? backend.operation
|
|
169
232
|
: typeof value.operation === "string"
|
|
170
233
|
? value.operation
|
|
171
234
|
: undefined,
|
|
172
|
-
mcpRef: typeof mcp?.
|
|
235
|
+
mcpRef: typeof mcp?.tool === "string"
|
|
236
|
+
? mcp.tool
|
|
237
|
+
: typeof mcp?.ref === "string"
|
|
238
|
+
? mcp.ref
|
|
239
|
+
: undefined,
|
|
173
240
|
bundleRefs,
|
|
174
241
|
hitl: parseHitlPolicy(value.hitl),
|
|
175
242
|
sourcePath: object.sourcePath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botbotgo/agent-harness",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "Agent Harness framework package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "npm@10.9.2",
|
|
@@ -21,9 +21,15 @@
|
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
22
|
"import": "./dist/index.js",
|
|
23
23
|
"default": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./tools": {
|
|
26
|
+
"types": "./dist/tools.d.ts",
|
|
27
|
+
"import": "./dist/tools.js",
|
|
28
|
+
"default": "./dist/tools.js"
|
|
24
29
|
}
|
|
25
30
|
},
|
|
26
31
|
"dependencies": {
|
|
32
|
+
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
27
33
|
"@langchain/anthropic": "^1.1.0",
|
|
28
34
|
"@langchain/community": "^1.1.24",
|
|
29
35
|
"@langchain/core": "^1.1.33",
|
|
@@ -38,12 +44,13 @@
|
|
|
38
44
|
"langchain": "1.2.34",
|
|
39
45
|
"llamaindex": "^0.12.1",
|
|
40
46
|
"mustache": "^4.2.0",
|
|
41
|
-
"yaml": "^2.8.1"
|
|
47
|
+
"yaml": "^2.8.1",
|
|
48
|
+
"zod": "^3.25.67"
|
|
42
49
|
},
|
|
43
50
|
"scripts": {
|
|
44
51
|
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json && cp -R config dist/",
|
|
45
52
|
"check": "tsc -p tsconfig.json --noEmit",
|
|
46
|
-
"test": "vitest run test/public-api.test.ts test/resource-optional-provider.test.ts test/stock-research-app-load-harness.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",
|
|
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/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/tool-extension-gaps.test.ts test/checkpoint-maintenance.test.ts",
|
|
47
54
|
"release:prepare": "npm version patch --no-git-tag-version && node ./scripts/sync-example-version.mjs",
|
|
48
55
|
"release:pack": "npm pack --dry-run",
|
|
49
56
|
"release:publish": "npm publish --access public --registry https://registry.npmjs.org/"
|