@botbotgo/agent-harness 0.0.8 → 0.0.10
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 +269 -0
- package/dist/config/orchestra.yaml +3 -5
- package/dist/contracts/types.d.ts +4 -1
- package/dist/extensions.js +5 -5
- package/dist/resource/builtins.d.ts +1 -0
- package/dist/resource/builtins.js +1 -0
- package/dist/resource/resource-impl.d.ts +30 -0
- package/dist/resource/resource-impl.js +250 -0
- package/dist/resource/resource.d.ts +1 -0
- package/dist/resource/resource.js +1 -0
- package/dist/{vendor → resource}/sources.d.ts +3 -0
- package/dist/{vendor → resource}/sources.js +53 -0
- package/dist/runtime/agent-runtime-adapter.js +3 -2
- package/dist/runtime/file-checkpoint-saver.js +17 -2
- package/dist/runtime/harness.js +3 -3
- package/dist/runtime/support/vector-stores.js +1 -1
- package/dist/workspace/compile.js +44 -19
- package/dist/workspace/object-loader.d.ts +5 -0
- package/dist/workspace/object-loader.js +180 -36
- package/dist/workspace/resource-compilers.js +1 -0
- package/dist/workspace/support/discovery.js +19 -14
- package/dist/workspace/support/source-collectors.js +2 -2
- package/package.json +27 -5
- package/dist/vendor/builtins.d.ts +0 -24
- package/dist/vendor/builtins.js +0 -118
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isExternalSourceLocator } from "../../
|
|
1
|
+
import { isExternalSourceLocator } from "../../resource/sources.js";
|
|
2
2
|
export function collectToolSourceRefs(tools, agents, options) {
|
|
3
|
-
const refs = new Set(options.builtinSources ?? []);
|
|
3
|
+
const refs = new Set(options.resourceSources ?? options.builtinSources ?? []);
|
|
4
4
|
for (const tool of tools.values()) {
|
|
5
5
|
for (const ref of tool.bundleRefs) {
|
|
6
6
|
if (isExternalSourceLocator(ref)) {
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botbotgo/agent-harness",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Agent Harness framework package",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"packageManager": "npm@10.9.2",
|
|
6
7
|
"main": "./dist/index.js",
|
|
7
8
|
"module": "./dist/index.js",
|
|
8
9
|
"types": "./dist/index.d.ts",
|
|
@@ -14,8 +15,7 @@
|
|
|
14
15
|
},
|
|
15
16
|
"repository": {
|
|
16
17
|
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/botbotgo/agent-harness.git"
|
|
18
|
-
"directory": "packages/framework"
|
|
18
|
+
"url": "git+https://github.com/botbotgo/agent-harness.git"
|
|
19
19
|
},
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
@@ -25,10 +25,32 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@
|
|
28
|
+
"@langchain/anthropic": "^1.1.0",
|
|
29
|
+
"@langchain/community": "^1.1.24",
|
|
30
|
+
"@langchain/core": "^1.1.33",
|
|
31
|
+
"@langchain/google": "^0.1.7",
|
|
32
|
+
"@langchain/langgraph": "^1.2.3",
|
|
33
|
+
"@langchain/langgraph-checkpoint-sqlite": "^1.0.1",
|
|
34
|
+
"@langchain/ollama": "^1.2.6",
|
|
35
|
+
"@langchain/openai": "^1.1.0",
|
|
36
|
+
"@libsql/client": "^0.17.0",
|
|
37
|
+
"@llamaindex/ollama": "^0.1.24",
|
|
38
|
+
"deepagents": "1.8.4",
|
|
39
|
+
"langchain": "1.2.34",
|
|
40
|
+
"llamaindex": "^0.12.1",
|
|
41
|
+
"mustache": "^4.2.0",
|
|
42
|
+
"yaml": "^2.8.1"
|
|
29
43
|
},
|
|
30
44
|
"scripts": {
|
|
31
45
|
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json && cp -R config dist/",
|
|
32
|
-
"check": "tsc -p tsconfig.json --noEmit"
|
|
46
|
+
"check": "tsc -p tsconfig.json --noEmit",
|
|
47
|
+
"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",
|
|
48
|
+
"release:pack": "npm pack --dry-run",
|
|
49
|
+
"release:publish": "npm publish --access public --registry https://registry.npmjs.org/"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/node": "^24.6.0",
|
|
53
|
+
"typescript": "^5.9.3",
|
|
54
|
+
"vitest": "^3.2.4"
|
|
33
55
|
}
|
|
34
56
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { RuntimeAdapterOptions, WorkspaceBundle } from "../contracts/types.js";
|
|
2
|
-
export declare function resolveLocalBuiltinsEntry(currentVendorDir: string, resolveInstalledEntry?: () => string | null): string;
|
|
3
|
-
type BuiltinToolInfo = {
|
|
4
|
-
builtinPath: string;
|
|
5
|
-
backendOperation: string;
|
|
6
|
-
name: string;
|
|
7
|
-
description: string;
|
|
8
|
-
hitl?: {
|
|
9
|
-
enabled: boolean;
|
|
10
|
-
allow: Array<"approve" | "edit" | "reject">;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export declare function ensureBuiltinSources(sources?: string[], workspaceRoot?: string): Promise<void>;
|
|
14
|
-
export declare const builtinSkillsRoot: () => string;
|
|
15
|
-
export declare const builtinConfigRoot: () => string;
|
|
16
|
-
export declare function listBuiltinTools(sources?: string[], workspaceRoot?: string): Promise<BuiltinToolInfo[]>;
|
|
17
|
-
export declare function listBuiltinToolsForSource(source: string, workspaceRoot?: string): Promise<BuiltinToolInfo[]>;
|
|
18
|
-
export declare function createBuiltinBackendResolver(workspace: WorkspaceBundle): NonNullable<RuntimeAdapterOptions["backendResolver"]>;
|
|
19
|
-
export declare function createBuiltinToolResolver(workspace: WorkspaceBundle, options?: {
|
|
20
|
-
getStore?: (_binding?: WorkspaceBundle["bindings"] extends Map<any, infer T> ? T : never) => unknown;
|
|
21
|
-
getEmbeddingModel?: (embeddingModelRef?: string, _binding?: WorkspaceBundle["bindings"] extends Map<any, infer T> ? T : never) => Promise<unknown>;
|
|
22
|
-
getVectorStore?: (vectorStoreRef?: string, _binding?: WorkspaceBundle["bindings"] extends Map<any, infer T> ? T : never) => Promise<unknown>;
|
|
23
|
-
}): NonNullable<RuntimeAdapterOptions["toolResolver"]>;
|
|
24
|
-
export {};
|
package/dist/vendor/builtins.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { readFile } from "node:fs/promises";
|
|
5
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
|
-
import { ensureExternalSource, isExternalSourceLocator, parseExternalSourceLocator } from "./sources.js";
|
|
7
|
-
const vendorDir = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
const require = createRequire(import.meta.url);
|
|
9
|
-
function installedBuiltinsEntry() {
|
|
10
|
-
try {
|
|
11
|
-
return require.resolve("@botbotgo/agent-harness-builtin");
|
|
12
|
-
}
|
|
13
|
-
catch {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export function resolveLocalBuiltinsEntry(currentVendorDir, resolveInstalledEntry = installedBuiltinsEntry) {
|
|
18
|
-
const candidates = [
|
|
19
|
-
path.resolve(currentVendorDir, "../../../builtins/dist/src/index.js"),
|
|
20
|
-
resolveInstalledEntry(),
|
|
21
|
-
path.resolve(currentVendorDir, "../../../builtins/src/index.ts"),
|
|
22
|
-
].filter((candidate) => typeof candidate === "string" && candidate.length > 0);
|
|
23
|
-
for (const candidate of candidates) {
|
|
24
|
-
if (existsSync(candidate)) {
|
|
25
|
-
return candidate;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return candidates.at(-1) ?? path.resolve(currentVendorDir, "../../../builtins/src/index.ts");
|
|
29
|
-
}
|
|
30
|
-
const builtinsEntry = resolveLocalBuiltinsEntry(vendorDir);
|
|
31
|
-
const localBuiltins = await import(pathToFileURL(builtinsEntry).href);
|
|
32
|
-
const remoteProviderCache = new Map();
|
|
33
|
-
function resolvePackageEntry(packageRoot, pkg) {
|
|
34
|
-
const exportsField = pkg.exports;
|
|
35
|
-
if (typeof exportsField === "string") {
|
|
36
|
-
return path.resolve(packageRoot, exportsField);
|
|
37
|
-
}
|
|
38
|
-
if (exportsField && typeof exportsField === "object" && "." in exportsField) {
|
|
39
|
-
const rootExport = exportsField["."];
|
|
40
|
-
if (typeof rootExport === "string") {
|
|
41
|
-
return path.resolve(packageRoot, rootExport);
|
|
42
|
-
}
|
|
43
|
-
if (rootExport && typeof rootExport === "object") {
|
|
44
|
-
const importEntry = rootExport.import ?? rootExport.default;
|
|
45
|
-
if (typeof importEntry === "string") {
|
|
46
|
-
return path.resolve(packageRoot, importEntry);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (typeof pkg.module === "string") {
|
|
51
|
-
return path.resolve(packageRoot, pkg.module);
|
|
52
|
-
}
|
|
53
|
-
if (typeof pkg.main === "string") {
|
|
54
|
-
return path.resolve(packageRoot, pkg.main);
|
|
55
|
-
}
|
|
56
|
-
return path.resolve(packageRoot, "index.js");
|
|
57
|
-
}
|
|
58
|
-
async function loadRemoteProvider(source, workspaceRoot) {
|
|
59
|
-
const cached = remoteProviderCache.get(source);
|
|
60
|
-
if (cached) {
|
|
61
|
-
return cached;
|
|
62
|
-
}
|
|
63
|
-
if (!isExternalSourceLocator(source)) {
|
|
64
|
-
throw new Error(`Unsupported builtin source ${source}. Use npm:, tgz:, or file:.`);
|
|
65
|
-
}
|
|
66
|
-
const parsed = parseExternalSourceLocator(source);
|
|
67
|
-
if (parsed.subpath) {
|
|
68
|
-
throw new Error(`Builtin source ${source} must point at a package root, not a subpath`);
|
|
69
|
-
}
|
|
70
|
-
const packageRoot = await ensureExternalSource(source, workspaceRoot);
|
|
71
|
-
const pkg = JSON.parse(await readFile(path.join(packageRoot, "package.json"), "utf8"));
|
|
72
|
-
const entry = resolvePackageEntry(packageRoot, pkg);
|
|
73
|
-
const imported = await import(pathToFileURL(entry).href);
|
|
74
|
-
const provider = (imported.default ?? imported);
|
|
75
|
-
if (typeof provider.listBuiltinTools !== "function" || typeof provider.createBuiltinToolResolver !== "function") {
|
|
76
|
-
throw new Error(`Remote builtin source ${source} must export listBuiltinTools() and createBuiltinToolResolver().`);
|
|
77
|
-
}
|
|
78
|
-
const typedProvider = provider;
|
|
79
|
-
remoteProviderCache.set(source, typedProvider);
|
|
80
|
-
return typedProvider;
|
|
81
|
-
}
|
|
82
|
-
export async function ensureBuiltinSources(sources = [], workspaceRoot = process.cwd()) {
|
|
83
|
-
await Promise.all(sources.map((source) => loadRemoteProvider(source, workspaceRoot)));
|
|
84
|
-
}
|
|
85
|
-
export const builtinSkillsRoot = localBuiltins.builtinSkillsRoot;
|
|
86
|
-
export const builtinConfigRoot = (localBuiltins.builtinConfigRoot ?? localBuiltins.builtinDefaultsRoot);
|
|
87
|
-
export async function listBuiltinTools(sources = [], workspaceRoot = process.cwd()) {
|
|
88
|
-
await ensureBuiltinSources(sources, workspaceRoot);
|
|
89
|
-
const deduped = new Map();
|
|
90
|
-
const local = localBuiltins.listBuiltinTools;
|
|
91
|
-
for (const tool of local()) {
|
|
92
|
-
deduped.set(tool.builtinPath, tool);
|
|
93
|
-
}
|
|
94
|
-
for (const source of sources) {
|
|
95
|
-
for (const tool of remoteProviderCache.get(source)?.listBuiltinTools() ?? []) {
|
|
96
|
-
deduped.set(tool.builtinPath, tool);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return Array.from(deduped.values());
|
|
100
|
-
}
|
|
101
|
-
export async function listBuiltinToolsForSource(source, workspaceRoot = process.cwd()) {
|
|
102
|
-
await ensureBuiltinSources([source], workspaceRoot);
|
|
103
|
-
return remoteProviderCache.get(source)?.listBuiltinTools() ?? [];
|
|
104
|
-
}
|
|
105
|
-
export function createBuiltinBackendResolver(workspace) {
|
|
106
|
-
return localBuiltins.createBuiltinBackendResolver(workspace);
|
|
107
|
-
}
|
|
108
|
-
export function createBuiltinToolResolver(workspace, options = {}) {
|
|
109
|
-
const localResolver = localBuiltins.createBuiltinToolResolver(workspace, options);
|
|
110
|
-
const remoteResolvers = workspace.builtinSources
|
|
111
|
-
.map((source) => remoteProviderCache.get(source))
|
|
112
|
-
.filter((provider) => Boolean(provider))
|
|
113
|
-
.map((provider) => provider.createBuiltinToolResolver(workspace));
|
|
114
|
-
return (toolIds, binding) => [
|
|
115
|
-
...localResolver(toolIds, binding),
|
|
116
|
-
...remoteResolvers.flatMap((resolver) => resolver(toolIds, binding)),
|
|
117
|
-
];
|
|
118
|
-
}
|