@botbotgo/agent-harness 0.0.298 → 0.0.299
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 +77 -37
- package/README.zh.md +79 -30
- package/dist/acp.d.ts +3 -0
- package/dist/acp.js +10 -2
- package/dist/api.d.ts +14 -2
- package/dist/api.js +19 -3
- package/dist/cli.d.ts +18 -1
- package/dist/cli.js +1408 -319
- package/dist/client/acp.d.ts +9 -3
- package/dist/client/acp.js +55 -1
- package/dist/client/in-process.d.ts +5 -2
- package/dist/client/in-process.js +4 -6
- package/dist/client/index.d.ts +1 -1
- package/dist/client/types.d.ts +6 -5
- package/dist/config/agents/direct.yaml +7 -17
- package/dist/config/agents/orchestra.yaml +9 -65
- package/dist/config/catalogs/embedding-models.yaml +1 -1
- package/dist/config/catalogs/stores.yaml +1 -1
- package/dist/config/knowledge/knowledge-runtime.yaml +36 -2
- package/dist/config/knowledge/procedural-memory-runtime.yaml +78 -0
- package/dist/config/{catalogs/models.yaml → models.yaml} +2 -2
- package/dist/config/prompts/direct-system.md +16 -0
- package/dist/config/prompts/orchestra-system.md +62 -0
- package/dist/config/prompts/routing-system.md +14 -0
- package/dist/config/runtime/runtime-memory.yaml +39 -5
- package/dist/config/runtime/workspace.yaml +7 -16
- package/dist/contracts/runtime.d.ts +242 -1
- package/dist/contracts/workspace.d.ts +2 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +2 -1
- package/dist/init-project.js +178 -33
- package/dist/knowledge/contracts.d.ts +5 -0
- package/dist/knowledge/module.d.ts +5 -0
- package/dist/knowledge/module.js +340 -18
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/persistence/file-store.d.ts +5 -1
- package/dist/persistence/file-store.js +16 -0
- package/dist/persistence/sqlite-store.d.ts +4 -1
- package/dist/persistence/sqlite-store.js +88 -14
- package/dist/persistence/types.d.ts +4 -1
- package/dist/procedural/config.d.ts +63 -0
- package/dist/procedural/config.js +125 -0
- package/dist/procedural/index.d.ts +2 -0
- package/dist/procedural/index.js +1 -0
- package/dist/protocol/ag-ui/http.d.ts +3 -0
- package/dist/protocol/ag-ui/http.js +10 -0
- package/dist/request-events.d.ts +63 -0
- package/dist/request-events.js +400 -0
- package/dist/resource/isolation.js +11 -0
- package/dist/resource/resource-impl.d.ts +1 -0
- package/dist/resource/resource-impl.js +103 -12
- package/dist/resources/init-templates/agent-context/deep-research.md +5 -0
- package/dist/resources/init-templates/prompts/research-analyst-basic.md +1 -0
- package/dist/resources/init-templates/prompts/research-analyst-web-search.md +1 -0
- package/dist/resources/init-templates/prompts/research-host-deep-research-basic.md +1 -0
- package/dist/resources/init-templates/prompts/research-host-deep-research-web-search.md +1 -0
- package/dist/resources/init-templates/prompts/research-host-single-agent-basic.md +1 -0
- package/dist/resources/init-templates/prompts/research-host-single-agent-web-search.md +1 -0
- package/dist/resources/prompts/runtime/browser-capability-disclaimer-recovery.md +1 -0
- package/dist/resources/prompts/runtime/default-subagent.md +2 -0
- package/dist/resources/prompts/runtime/durable-memory-context.md +7 -0
- package/dist/resources/prompts/runtime/execution-with-tool-evidence-retry.md +1 -0
- package/dist/resources/prompts/runtime/execution-with-tool-evidence.md +1 -0
- package/dist/resources/prompts/runtime/invalid-tool-selection-recovery.md +1 -0
- package/dist/resources/prompts/runtime/memory-manager.md +31 -0
- package/dist/resources/prompts/runtime/memory-mutation-reconciliation.md +22 -0
- package/dist/resources/prompts/runtime/slash-command-skill.md +6 -0
- package/dist/resources/prompts/runtime/strict-tool-json.md +1 -0
- package/dist/resources/prompts/runtime/workspace-boundary-guidance.md +3 -0
- package/dist/resources/prompts/runtime/workspace-relative-path.md +1 -0
- package/dist/resources/prompts/runtime/write-todos-descriptive-content.md +1 -0
- package/dist/resources/prompts/runtime/write-todos-full-entry.md +1 -0
- package/dist/resources/prompts/runtime/write-todos-non-empty-initial-list.md +1 -0
- package/dist/resources/tools/_runtime_tool_helpers.mjs +152 -0
- package/dist/resources/tools/cancel_request.mjs +21 -0
- package/dist/resources/tools/fetch_url.mjs +23 -0
- package/dist/resources/tools/http_request.mjs +30 -0
- package/dist/resources/tools/inspect_approvals.mjs +27 -0
- package/dist/resources/tools/inspect_artifacts.mjs +21 -0
- package/dist/resources/tools/inspect_events.mjs +21 -0
- package/dist/resources/tools/inspect_requests.mjs +27 -0
- package/dist/resources/tools/inspect_sessions.mjs +21 -0
- package/dist/resources/tools/list_files.mjs +27 -0
- package/dist/resources/tools/read_artifact.mjs +22 -0
- package/dist/resources/tools/request_approval.mjs +27 -0
- package/dist/resources/tools/run_command.mjs +21 -0
- package/dist/resources/tools/schedule_task.mjs +76 -0
- package/dist/resources/tools/search_files.mjs +47 -0
- package/dist/resources/tools/send_message.mjs +23 -0
- package/dist/runtime/adapter/direct-builtin-utility.d.ts +1 -0
- package/dist/runtime/adapter/direct-builtin-utility.js +90 -0
- package/dist/runtime/adapter/flow/execution-context.d.ts +1 -1
- package/dist/runtime/adapter/flow/execution-context.js +1 -1
- package/dist/runtime/adapter/flow/invocation-flow.d.ts +1 -0
- package/dist/runtime/adapter/flow/invocation-flow.js +9 -1
- package/dist/runtime/adapter/flow/invoke-runtime.d.ts +1 -1
- package/dist/runtime/adapter/flow/stream-runtime.d.ts +5 -1
- package/dist/runtime/adapter/flow/stream-runtime.js +556 -35
- package/dist/runtime/adapter/invocation-result.js +3 -2
- package/dist/runtime/adapter/local-tool-invocation.d.ts +1 -1
- package/dist/runtime/adapter/local-tool-invocation.js +28 -4
- package/dist/runtime/adapter/middleware-assembly.js +3 -1
- package/dist/runtime/adapter/model/invocation-request.d.ts +4 -1
- package/dist/runtime/adapter/model/invocation-request.js +138 -16
- package/dist/runtime/adapter/model/message-assembly.js +2 -6
- package/dist/runtime/adapter/model/model-providers.js +103 -5
- package/dist/runtime/adapter/resilience.js +17 -2
- package/dist/runtime/adapter/runtime-adapter-support.d.ts +11 -7
- package/dist/runtime/adapter/runtime-adapter-support.js +39 -5
- package/dist/runtime/adapter/tool/builtin-middleware-tools.d.ts +63 -1
- package/dist/runtime/adapter/tool/builtin-middleware-tools.js +193 -21
- package/dist/runtime/adapter/tool/tool-arguments.d.ts +3 -1
- package/dist/runtime/adapter/tool/tool-arguments.js +52 -17
- package/dist/runtime/adapter/tool-resolution.d.ts +1 -0
- package/dist/runtime/adapter/tool-resolution.js +4 -2
- package/dist/runtime/agent-runtime-adapter.d.ts +27 -0
- package/dist/runtime/agent-runtime-adapter.js +163 -11
- package/dist/runtime/harness/events/event-bus.d.ts +1 -0
- package/dist/runtime/harness/events/event-bus.js +3 -0
- package/dist/runtime/harness/events/event-sink.d.ts +3 -0
- package/dist/runtime/harness/events/event-sink.js +16 -7
- package/dist/runtime/harness/events/streaming.d.ts +18 -1
- package/dist/runtime/harness/events/streaming.js +23 -10
- package/dist/runtime/harness/run/inspection.js +26 -5
- package/dist/runtime/harness/run/stream-run.d.ts +13 -4
- package/dist/runtime/harness/run/stream-run.js +448 -4
- package/dist/runtime/harness/run/surface-semantics.js +7 -34
- package/dist/runtime/harness/system/runtime-memory-manager.d.ts +3 -0
- package/dist/runtime/harness/system/runtime-memory-manager.js +384 -69
- package/dist/runtime/harness/system/runtime-memory-policy.d.ts +20 -1
- package/dist/runtime/harness/system/runtime-memory-policy.js +65 -17
- package/dist/runtime/harness/system/runtime-memory-records.js +100 -0
- package/dist/runtime/harness/system/runtime-memory-sync.js +2 -2
- package/dist/runtime/harness/system/store.d.ts +4 -0
- package/dist/runtime/harness/system/store.js +153 -0
- package/dist/runtime/harness.d.ts +9 -1
- package/dist/runtime/harness.js +141 -7
- package/dist/runtime/maintenance/sqlite-checkpoint-saver.d.ts +8 -3
- package/dist/runtime/maintenance/sqlite-checkpoint-saver.js +152 -53
- package/dist/runtime/parsing/output-parsing.d.ts +10 -2
- package/dist/runtime/parsing/output-parsing.js +223 -16
- package/dist/runtime/parsing/stream-event-parsing.d.ts +7 -0
- package/dist/runtime/parsing/stream-event-parsing.js +51 -1
- package/dist/runtime/scheduling/system-schedule-manager.d.ts +41 -0
- package/dist/runtime/scheduling/system-schedule-manager.js +532 -0
- package/dist/runtime/support/embedding-models.d.ts +1 -1
- package/dist/runtime/support/embedding-models.js +5 -2
- package/dist/runtime/support/runtime-factories.js +1 -1
- package/dist/runtime/support/runtime-layout.d.ts +3 -0
- package/dist/runtime/support/runtime-layout.js +10 -1
- package/dist/runtime/support/runtime-prompts.d.ts +30 -0
- package/dist/runtime/support/runtime-prompts.js +55 -0
- package/dist/runtime/support/vector-stores.d.ts +1 -1
- package/dist/runtime/support/vector-stores.js +5 -2
- package/dist/upstream-events.js +8 -7
- package/dist/utils/bundled-text.d.ts +3 -0
- package/dist/utils/bundled-text.js +25 -0
- package/dist/utils/id.js +3 -2
- package/dist/workspace/agent-binding-compiler.js +53 -13
- package/dist/workspace/object-loader.js +64 -2
- package/dist/workspace/support/workspace-ref-utils.d.ts +2 -1
- package/dist/workspace/support/workspace-ref-utils.js +24 -5
- package/dist/workspace/yaml-object-reader.d.ts +1 -0
- package/dist/workspace/yaml-object-reader.js +95 -17
- package/package.json +11 -5
|
@@ -1,29 +1,103 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
3
|
import { readdir } from "node:fs/promises";
|
|
3
4
|
import { parseAllDocuments } from "yaml";
|
|
4
5
|
import { fileExists, listFilesRecursive, readYamlOrJson } from "../utils/fs.js";
|
|
5
|
-
const ENV_PLACEHOLDER_PATTERN = /\$\{env:([A-Za-z_][A-Za-z0-9_]*)
|
|
6
|
+
const ENV_PLACEHOLDER_PATTERN = /\$\{env:([A-Za-z_][A-Za-z0-9_]*)(?::-(.*?))?\}/g;
|
|
7
|
+
const DOTENV_LINE_PATTERN = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)?\s*$/;
|
|
6
8
|
function asObject(value) {
|
|
7
9
|
return typeof value === "object" && value ? value : undefined;
|
|
8
10
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
function stripMatchingQuotes(value) {
|
|
12
|
+
const trimmed = value.trim();
|
|
13
|
+
if (trimmed.length >= 2 &&
|
|
14
|
+
((trimmed.startsWith("\"") && trimmed.endsWith("\"")) || (trimmed.startsWith("'") && trimmed.endsWith("'")))) {
|
|
15
|
+
return trimmed.slice(1, -1);
|
|
16
|
+
}
|
|
17
|
+
return trimmed;
|
|
18
|
+
}
|
|
19
|
+
function parseDotenvFile(content) {
|
|
20
|
+
const parsed = {};
|
|
21
|
+
for (const rawLine of content.split(/\r?\n/u)) {
|
|
22
|
+
const line = rawLine.trim();
|
|
23
|
+
if (!line || line.startsWith("#")) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
const match = DOTENV_LINE_PATTERN.exec(rawLine);
|
|
27
|
+
if (!match) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const [, key, rawValue = ""] = match;
|
|
31
|
+
parsed[key] = stripMatchingQuotes(rawValue);
|
|
32
|
+
}
|
|
33
|
+
return parsed;
|
|
34
|
+
}
|
|
35
|
+
function readNearestDotenvSync(startDirectory) {
|
|
36
|
+
const normalizedStart = path.resolve(startDirectory);
|
|
37
|
+
let current = normalizedStart;
|
|
38
|
+
while (true) {
|
|
39
|
+
const dotenvPath = path.join(current, ".env");
|
|
40
|
+
if (existsSync(dotenvPath)) {
|
|
41
|
+
return Object.freeze(parseDotenvFile(readFileSync(dotenvPath, "utf8")));
|
|
42
|
+
}
|
|
43
|
+
const parent = path.dirname(current);
|
|
44
|
+
if (parent === current) {
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
current = parent;
|
|
48
|
+
}
|
|
49
|
+
return Object.freeze({});
|
|
50
|
+
}
|
|
51
|
+
function resolveInterpolationEnv(sourcePath, envOverrides) {
|
|
52
|
+
const merged = { ...readNearestDotenvSync(path.dirname(sourcePath)) };
|
|
53
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
54
|
+
if (typeof value === "string") {
|
|
55
|
+
merged[key] = value;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (envOverrides) {
|
|
59
|
+
for (const [key, value] of Object.entries(envOverrides)) {
|
|
60
|
+
if (typeof value === "string") {
|
|
61
|
+
merged[key] = value;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
delete merged[key];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return merged;
|
|
69
|
+
}
|
|
70
|
+
function interpolateEnvString(value, sourcePath, envValues) {
|
|
71
|
+
return value.replaceAll(ENV_PLACEHOLDER_PATTERN, (_match, envName, defaultValue) => {
|
|
72
|
+
const resolved = envValues[envName];
|
|
73
|
+
if (typeof resolved === "string" && resolved.length > 0) {
|
|
74
|
+
return resolved;
|
|
75
|
+
}
|
|
76
|
+
if (typeof defaultValue === "string") {
|
|
77
|
+
return defaultValue;
|
|
78
|
+
}
|
|
12
79
|
if (typeof resolved !== "string" || resolved.length === 0) {
|
|
13
80
|
throw new Error(`YAML document ${sourcePath} references missing environment variable ${envName}`);
|
|
14
81
|
}
|
|
15
82
|
return resolved;
|
|
16
83
|
});
|
|
17
84
|
}
|
|
18
|
-
function interpolateEnvPlaceholders(value, sourcePath) {
|
|
85
|
+
export function interpolateEnvPlaceholders(value, sourcePath, envOverrides) {
|
|
86
|
+
const envValues = resolveInterpolationEnv(sourcePath, envOverrides);
|
|
87
|
+
return interpolateEnvPlaceholdersWithEnv(value, sourcePath, envValues);
|
|
88
|
+
}
|
|
89
|
+
function interpolateEnvPlaceholdersWithEnv(value, sourcePath, envValues) {
|
|
19
90
|
if (typeof value === "string") {
|
|
20
|
-
return interpolateEnvString(value, sourcePath);
|
|
91
|
+
return interpolateEnvString(value, sourcePath, envValues);
|
|
21
92
|
}
|
|
22
93
|
if (Array.isArray(value)) {
|
|
23
|
-
return value.map((entry) =>
|
|
94
|
+
return value.map((entry) => interpolateEnvPlaceholdersWithEnv(entry, sourcePath, envValues));
|
|
24
95
|
}
|
|
25
96
|
if (typeof value === "object" && value !== null) {
|
|
26
|
-
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [
|
|
97
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [
|
|
98
|
+
key,
|
|
99
|
+
interpolateEnvPlaceholdersWithEnv(entry, sourcePath, envValues),
|
|
100
|
+
]));
|
|
27
101
|
}
|
|
28
102
|
return value;
|
|
29
103
|
}
|
|
@@ -95,6 +169,8 @@ function normalizeKind(kind) {
|
|
|
95
169
|
return "runtime";
|
|
96
170
|
case "RuntimeMemory":
|
|
97
171
|
return "runtime-memory";
|
|
172
|
+
case "ProceduralMemoryRuntime":
|
|
173
|
+
return "procedural-memory";
|
|
98
174
|
case "Prompt":
|
|
99
175
|
return "prompt";
|
|
100
176
|
case "McpServer":
|
|
@@ -141,15 +217,17 @@ async function objectItemsFromDocument(document, sourcePath) {
|
|
|
141
217
|
? normalizeCatalogSpec(document, { defaultKind: "Model" })
|
|
142
218
|
: catalogKind === "EmbeddingModels"
|
|
143
219
|
? normalizeCatalogSpec(document, { defaultKind: "EmbeddingModel" })
|
|
144
|
-
: catalogKind === "
|
|
145
|
-
? normalizeCatalogSpec(document)
|
|
146
|
-
: catalogKind === "
|
|
147
|
-
? normalizeCatalogSpec(document
|
|
148
|
-
: catalogKind === "
|
|
149
|
-
? normalizeCatalogSpec(document, { defaultKind: "
|
|
150
|
-
: catalogKind === "
|
|
151
|
-
? normalizeCatalogSpec(document, { defaultKind: "
|
|
152
|
-
:
|
|
220
|
+
: catalogKind === "VectorStores"
|
|
221
|
+
? normalizeCatalogSpec(document, { defaultKind: "VectorStore" })
|
|
222
|
+
: catalogKind === "Stores"
|
|
223
|
+
? normalizeCatalogSpec(document)
|
|
224
|
+
: catalogKind === "Backends"
|
|
225
|
+
? normalizeCatalogSpec(document, { defaultKind: "Backend" })
|
|
226
|
+
: catalogKind === "Tools" || catalogKind === "ToolSets"
|
|
227
|
+
? normalizeCatalogSpec(document, { defaultKind: "Tool" })
|
|
228
|
+
: catalogKind === "McpServers"
|
|
229
|
+
? normalizeCatalogSpec(document, { defaultKind: "McpServer" })
|
|
230
|
+
: [];
|
|
153
231
|
if (catalogItems.length > 0) {
|
|
154
232
|
return catalogItems;
|
|
155
233
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botbotgo/agent-harness",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.299",
|
|
4
4
|
"description": "Workspace runtime for multi-agent applications",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"main": "./dist/index.js",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"bin": {
|
|
11
|
-
"agent-harness": "./dist/cli.js"
|
|
11
|
+
"agent-harness": "./dist/cli.js",
|
|
12
|
+
"botbotgo": "./dist/cli.js"
|
|
12
13
|
},
|
|
13
14
|
"files": [
|
|
14
15
|
"dist"
|
|
@@ -68,11 +69,16 @@
|
|
|
68
69
|
"scripts": {
|
|
69
70
|
"agent-harness": "npm run build --silent && node dist/cli.js",
|
|
70
71
|
"chat": "npm run build --silent && node dist/cli.js chat",
|
|
71
|
-
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json && cp -R config resources dist/",
|
|
72
|
+
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json && cp -R config resources dist/ && chmod +x dist/cli.js",
|
|
72
73
|
"check": "tsc -p tsconfig.json --noEmit",
|
|
73
74
|
"test": "vitest run $(find test -name '*.test.ts' -print | sort)",
|
|
75
|
+
"test:ci:runtime": "node ./scripts/run-vitest-suite.mjs ci-runtime",
|
|
76
|
+
"test:ci:public-api": "node ./scripts/run-vitest-suite.mjs ci-public-api",
|
|
77
|
+
"test:ci:docs-examples": "node ./scripts/run-vitest-suite.mjs ci-docs-examples",
|
|
78
|
+
"test:release": "node ./scripts/run-vitest-suite.mjs release",
|
|
79
|
+
"test:providers": "node ./scripts/run-vitest-suite.mjs providers",
|
|
74
80
|
"test:upstream-ab-real": "vitest run test/benchmark/upstream-runtime-ab-real.test.ts",
|
|
75
|
-
"test:real-providers": "
|
|
81
|
+
"test:real-providers": "npm run test:providers",
|
|
76
82
|
"security:ci": "npm audit --omit=dev --audit-level=high",
|
|
77
83
|
"security:report": "npm audit --omit=dev --json > security-audit-report.json || true",
|
|
78
84
|
"docs:sync-dev-nav": "node ./scripts/sync-developer-docs-nav.mjs",
|
|
@@ -86,7 +92,7 @@
|
|
|
86
92
|
"@types/node": "^25.5.2",
|
|
87
93
|
"typescript": "^6.0.2",
|
|
88
94
|
"vite": "^7.3.2",
|
|
89
|
-
"vitest": "^
|
|
95
|
+
"vitest": "^4.1.4"
|
|
90
96
|
},
|
|
91
97
|
"overrides": {
|
|
92
98
|
"axios": "^1.15.0",
|