@botbotgo/agent-harness 0.0.260 → 0.0.262
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/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/runtime/harness/run/startup-runtime.d.ts +1 -0
- package/dist/runtime/harness/run/startup-runtime.js +7 -1
- package/dist/runtime/harness.d.ts +1 -0
- package/dist/runtime/harness.js +5 -1
- package/dist/utils/fs.d.ts +1 -0
- package/dist/utils/fs.js +4 -1
- package/dist/workspace/compile.js +22 -4
- package/dist/workspace/object-loader.js +5 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.261";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.261";
|
|
@@ -8,6 +8,7 @@ type Startable = {
|
|
|
8
8
|
export declare function initializeHarnessRuntime(input: {
|
|
9
9
|
persistence: RuntimePersistence;
|
|
10
10
|
healthMonitor: Startable | null;
|
|
11
|
+
scheduleBackgroundTask?: (task: Promise<void>) => void;
|
|
11
12
|
}): Promise<void>;
|
|
12
13
|
export declare function recoverStartupRuns(input: {
|
|
13
14
|
recoveryConfig: RecoveryConfig;
|
|
@@ -3,7 +3,13 @@ import { traceStartupStage } from "../../startup-tracing.js";
|
|
|
3
3
|
export async function initializeHarnessRuntime(input) {
|
|
4
4
|
await traceStartupStage("runtime.initialize.persistence", () => input.persistence.initialize());
|
|
5
5
|
if (input.healthMonitor) {
|
|
6
|
-
|
|
6
|
+
const healthMonitorStartTask = traceStartupStage("runtime.initialize.healthMonitor", () => input.healthMonitor.start());
|
|
7
|
+
if (input.scheduleBackgroundTask) {
|
|
8
|
+
input.scheduleBackgroundTask(healthMonitorStartTask);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
await healthMonitorStartTask;
|
|
12
|
+
}
|
|
7
13
|
}
|
|
8
14
|
}
|
|
9
15
|
export async function recoverStartupRuns(input) {
|
|
@@ -127,6 +127,7 @@ export declare class AgentHarnessRuntime {
|
|
|
127
127
|
}): Promise<string>;
|
|
128
128
|
private emit;
|
|
129
129
|
private trackBackgroundTask;
|
|
130
|
+
private scheduleBackgroundStartupTask;
|
|
130
131
|
private resolveToolMcpServerTools;
|
|
131
132
|
private loadPriorHistory;
|
|
132
133
|
private loadRunInput;
|
package/dist/runtime/harness.js
CHANGED
|
@@ -332,8 +332,9 @@ export class AgentHarnessRuntime {
|
|
|
332
332
|
await initializeHarnessRuntime({
|
|
333
333
|
persistence: this.persistence,
|
|
334
334
|
healthMonitor: this.healthMonitor,
|
|
335
|
+
scheduleBackgroundTask: (task) => this.scheduleBackgroundStartupTask(task),
|
|
335
336
|
});
|
|
336
|
-
|
|
337
|
+
this.scheduleBackgroundStartupTask(traceStartupStage("runtime.initialize.startupRecovery", () => this.recoverStartupRuns()));
|
|
337
338
|
this.initialized = true;
|
|
338
339
|
}
|
|
339
340
|
subscribe(listener) {
|
|
@@ -962,6 +963,9 @@ export class AgentHarnessRuntime {
|
|
|
962
963
|
this.backgroundTasks.delete(task);
|
|
963
964
|
});
|
|
964
965
|
}
|
|
966
|
+
scheduleBackgroundStartupTask(task) {
|
|
967
|
+
this.trackBackgroundTask(task.then(() => undefined).catch(() => undefined));
|
|
968
|
+
}
|
|
965
969
|
resolveToolMcpServerTools(agentId) {
|
|
966
970
|
return resolveWorkspaceAgentTools({
|
|
967
971
|
workspace: this.workspace,
|
package/dist/utils/fs.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare function shouldSkipScanDirectory(entryName: string): boolean;
|
|
1
2
|
export declare function ensureDir(dirPath: string): Promise<void>;
|
|
2
3
|
export declare function readYamlOrJson(filePath: string): Promise<string>;
|
|
3
4
|
export declare function writeJson(filePath: string, value: unknown): Promise<void>;
|
package/dist/utils/fs.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { mkdir, readFile, readdir, stat, writeFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
export function shouldSkipScanDirectory(entryName) {
|
|
4
|
+
return entryName === "node_modules";
|
|
5
|
+
}
|
|
3
6
|
export async function ensureDir(dirPath) {
|
|
4
7
|
await mkdir(dirPath, { recursive: true });
|
|
5
8
|
}
|
|
@@ -28,7 +31,7 @@ export async function listFilesRecursive(root, suffix) {
|
|
|
28
31
|
for (const item of items) {
|
|
29
32
|
const fullPath = path.join(root, item.name);
|
|
30
33
|
if (item.isDirectory()) {
|
|
31
|
-
if (item.name
|
|
34
|
+
if (shouldSkipScanDirectory(item.name)) {
|
|
32
35
|
continue;
|
|
33
36
|
}
|
|
34
37
|
results.push(...(await listFilesRecursive(fullPath, suffix)));
|
|
@@ -13,6 +13,7 @@ import { collectAgentDiscoverySourceRefs, collectToolSourceRefs } from "./suppor
|
|
|
13
13
|
import { getRoutingDefaultAgentId, getRuntimeResources, getRoutingRules, resolveRefId, } from "./support/workspace-ref-utils.js";
|
|
14
14
|
import { hydrateAgentMcpTools, hydrateResourceAndExternalTools } from "./tool-hydration.js";
|
|
15
15
|
import { traceStartupStage } from "../runtime/startup-tracing.js";
|
|
16
|
+
import { shouldSkipScanDirectory } from "../utils/fs.js";
|
|
16
17
|
function collectParsedResources(refs) {
|
|
17
18
|
const embeddings = new Map();
|
|
18
19
|
const mcpServers = new Map();
|
|
@@ -151,7 +152,7 @@ async function collectSkillRoots(root) {
|
|
|
151
152
|
return [root];
|
|
152
153
|
}
|
|
153
154
|
const nested = await Promise.all(entries
|
|
154
|
-
.filter((entry) => entry.isDirectory())
|
|
155
|
+
.filter((entry) => entry.isDirectory() && !shouldSkipScanDirectory(entry.name))
|
|
155
156
|
.map((entry) => collectSkillRoots(path.join(root, entry.name))));
|
|
156
157
|
return nested.flat();
|
|
157
158
|
}
|
|
@@ -267,8 +268,25 @@ export async function loadWorkspace(workspaceRoot, options = {}) {
|
|
|
267
268
|
...(localResourceRoot ? [localResourceRoot] : []),
|
|
268
269
|
...collectedResources,
|
|
269
270
|
]));
|
|
270
|
-
|
|
271
|
-
|
|
271
|
+
await traceStartupStage("workspace.validate.resources", async () => {
|
|
272
|
+
validateWorkspaceResources(embeddings, mcpServers, models, vectorStores, tools, loaded.agents);
|
|
273
|
+
}, {
|
|
274
|
+
workspaceRoot,
|
|
275
|
+
agentCount: loaded.agents.length,
|
|
276
|
+
toolCount: tools.size,
|
|
277
|
+
modelCount: models.size,
|
|
278
|
+
mcpServerCount: mcpServers.size,
|
|
279
|
+
});
|
|
280
|
+
await traceStartupStage("workspace.validate.routingTargets", async () => {
|
|
281
|
+
validateRoutingTargets(loaded.refs, loaded.agents);
|
|
282
|
+
}, {
|
|
283
|
+
workspaceRoot,
|
|
284
|
+
agentCount: loaded.agents.length,
|
|
285
|
+
});
|
|
286
|
+
const bindings = await traceStartupStage("workspace.compile.bindings", async () => compileBindings(workspaceRoot, loaded.refs, loaded.agents, models, tools), {
|
|
287
|
+
workspaceRoot,
|
|
288
|
+
agentCount: loaded.agents.length,
|
|
289
|
+
});
|
|
272
290
|
return {
|
|
273
291
|
workspaceRoot,
|
|
274
292
|
resources,
|
|
@@ -279,6 +297,6 @@ export async function loadWorkspace(workspaceRoot, options = {}) {
|
|
|
279
297
|
vectorStores,
|
|
280
298
|
tools,
|
|
281
299
|
agents: new Map(loaded.agents.map((agent) => [agent.id, agent])),
|
|
282
|
-
bindings
|
|
300
|
+
bindings,
|
|
283
301
|
};
|
|
284
302
|
}
|
|
@@ -5,7 +5,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
5
5
|
import { resolveIsolatedResourceModulePath } from "../resource/isolation.js";
|
|
6
6
|
import { isExternalSourceLocator, resolveResourcePackageRoot } from "../resource/sources.js";
|
|
7
7
|
import { discoverToolModuleDefinitions, isSupportedToolModulePath, loadToolModuleDefinition } from "../tool-modules.js";
|
|
8
|
-
import { fileExists } from "../utils/fs.js";
|
|
8
|
+
import { fileExists, shouldSkipScanDirectory } from "../utils/fs.js";
|
|
9
9
|
import { readNamedYamlItems, readYamlItems, } from "./yaml-object-reader.js";
|
|
10
10
|
export { normalizeYamlItem, readYamlItems } from "./yaml-object-reader.js";
|
|
11
11
|
const CONVENTIONAL_OBJECT_DIRECTORIES = ["tools"];
|
|
@@ -645,7 +645,7 @@ async function readYamlItemsIgnoringNodeModules(root) {
|
|
|
645
645
|
for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
|
|
646
646
|
const entryPath = path.join(current, entry.name);
|
|
647
647
|
if (entry.isDirectory()) {
|
|
648
|
-
if (entry.name
|
|
648
|
+
if (shouldSkipScanDirectory(entry.name)) {
|
|
649
649
|
continue;
|
|
650
650
|
}
|
|
651
651
|
pending.push(entryPath);
|
|
@@ -796,6 +796,9 @@ export async function readToolModuleItems(root) {
|
|
|
796
796
|
for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
|
|
797
797
|
const entryPath = path.join(current, entry.name);
|
|
798
798
|
if (entry.isDirectory()) {
|
|
799
|
+
if (shouldSkipScanDirectory(entry.name)) {
|
|
800
|
+
continue;
|
|
801
|
+
}
|
|
799
802
|
pending.push(entryPath);
|
|
800
803
|
continue;
|
|
801
804
|
}
|