@botbotgo/agent-harness 0.0.121 → 0.0.123

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.
@@ -1 +1 @@
1
- export declare const AGENT_HARNESS_VERSION = "0.0.120";
1
+ export declare const AGENT_HARNESS_VERSION = "0.0.122";
@@ -1 +1 @@
1
- export const AGENT_HARNESS_VERSION = "0.0.120";
1
+ export const AGENT_HARNESS_VERSION = "0.0.122";
@@ -3,7 +3,7 @@ import os from "node:os";
3
3
  import path from "node:path";
4
4
  import { createHash } from "node:crypto";
5
5
  import { existsSync } from "node:fs";
6
- import { cp, mkdir, readFile, rm, symlink } from "node:fs/promises";
6
+ import { cp, mkdir, readFile, rm, stat, symlink } from "node:fs/promises";
7
7
  const isolatedResourceRootCache = new Map();
8
8
  function isolationCacheRoot() {
9
9
  return path.join(os.tmpdir(), "agent-harness-resource-isolation");
@@ -64,16 +64,39 @@ async function buildIsolatedResourceRoot(packageRoot) {
64
64
  await linkDeclaredDependencies(isolatedRoot, packageRoot, manifest);
65
65
  return isolatedRoot;
66
66
  }
67
+ async function rebuildIsolatedResourcePackageRoot(packageRoot) {
68
+ const loading = buildIsolatedResourceRoot(packageRoot);
69
+ isolatedResourceRootCache.set(packageRoot, loading);
70
+ return loading;
71
+ }
67
72
  export async function ensureIsolatedResourcePackageRoot(packageRoot) {
68
73
  const cached = isolatedResourceRootCache.get(packageRoot);
69
74
  if (cached) {
70
75
  return cached;
71
76
  }
72
- const loading = buildIsolatedResourceRoot(packageRoot);
73
- isolatedResourceRootCache.set(packageRoot, loading);
74
- return loading;
77
+ return rebuildIsolatedResourcePackageRoot(packageRoot);
75
78
  }
76
79
  export async function resolveIsolatedResourceModulePath(packageRoot, sourcePath) {
77
- const isolatedRoot = await ensureIsolatedResourcePackageRoot(packageRoot);
78
- return path.join(isolatedRoot, path.relative(packageRoot, sourcePath));
80
+ const relativeSourcePath = path.relative(packageRoot, sourcePath);
81
+ let isolatedRoot = await ensureIsolatedResourcePackageRoot(packageRoot);
82
+ let isolatedSourcePath = path.join(isolatedRoot, relativeSourcePath);
83
+ if (await isIsolatedModuleSnapshotCurrent(sourcePath, isolatedSourcePath)) {
84
+ return isolatedSourcePath;
85
+ }
86
+ isolatedRoot = await rebuildIsolatedResourcePackageRoot(packageRoot);
87
+ isolatedSourcePath = path.join(isolatedRoot, relativeSourcePath);
88
+ if (await isIsolatedModuleSnapshotCurrent(sourcePath, isolatedSourcePath)) {
89
+ return isolatedSourcePath;
90
+ }
91
+ throw new Error(`Isolated resource module ${relativeSourcePath} is missing from ${isolatedRoot}. Rebuild completed but the source package snapshot is still incomplete.`);
92
+ }
93
+ async function isIsolatedModuleSnapshotCurrent(sourcePath, isolatedSourcePath) {
94
+ if (!existsSync(isolatedSourcePath)) {
95
+ return false;
96
+ }
97
+ const [sourceStat, isolatedStat] = await Promise.all([
98
+ stat(sourcePath),
99
+ stat(isolatedSourcePath),
100
+ ]);
101
+ return isolatedStat.size === sourceStat.size && isolatedStat.mtimeMs >= sourceStat.mtimeMs;
79
102
  }
@@ -10,7 +10,7 @@ import { createRuntimeEnv } from "../runtime/support/runtime-env.js";
10
10
  import { isSupportedToolModulePath, loadToolModuleDefinition } from "../tool-modules.js";
11
11
  import { createMcpToolResolver, } from "./mcp-tool-support.js";
12
12
  import { resolveIsolatedResourceModulePath } from "./isolation.js";
13
- import { ensureExternalResourceSource, ensureExternalSource, isExternalSourceLocator, parseExternalSourceLocator } from "./sources.js";
13
+ import { ensureExternalResourceSource, ensureExternalSource, isExternalSourceLocator, parseExternalSourceLocator, resolveResourcePackageRoot, } from "./sources.js";
14
14
  export { getOrCreateMcpClient, listRemoteMcpTools, readMcpServerConfig, } from "./mcp-tool-support.js";
15
15
  const resourceDir = path.dirname(fileURLToPath(import.meta.url));
16
16
  const require = createRequire(import.meta.url);
@@ -219,6 +219,10 @@ function requireLocalResource(feature) {
219
219
  }
220
220
  const remoteResourceCache = new Map();
221
221
  async function findPackageRoot(startPath) {
222
+ const resourcePackageRoot = findEnclosingResourcePackageRoot(startPath);
223
+ if (resourcePackageRoot) {
224
+ return resourcePackageRoot;
225
+ }
222
226
  let current = path.dirname(startPath);
223
227
  for (;;) {
224
228
  try {
@@ -233,6 +237,24 @@ async function findPackageRoot(startPath) {
233
237
  current = parent;
234
238
  }
235
239
  }
240
+ function findEnclosingResourcePackageRoot(startPath) {
241
+ let current = path.dirname(startPath);
242
+ for (;;) {
243
+ const resourcePackageRoot = resolveResourcePackageRoot(current);
244
+ if (resourcePackageRoot && isPathWithinRoot(startPath, resourcePackageRoot)) {
245
+ return resourcePackageRoot;
246
+ }
247
+ const parent = path.dirname(current);
248
+ if (parent === current) {
249
+ return null;
250
+ }
251
+ current = parent;
252
+ }
253
+ }
254
+ function isPathWithinRoot(targetPath, rootPath) {
255
+ const relative = path.relative(rootPath, targetPath);
256
+ return relative === "" || (!relative.startsWith("..") && !path.isAbsolute(relative));
257
+ }
236
258
  const functionToolModuleCache = new Map();
237
259
  function readStringRecord(value) {
238
260
  if (typeof value !== "object" || !value) {
@@ -22,9 +22,9 @@ export function resolveStreamIdleTimeout(binding) {
22
22
  }
23
23
  const invokeTimeout = resolveBindingTimeout(binding);
24
24
  if (invokeTimeout) {
25
- return Math.min(invokeTimeout, 15_000);
25
+ return Math.min(invokeTimeout, 60_000);
26
26
  }
27
- return 15_000;
27
+ return 60_000;
28
28
  }
29
29
  export function resolveProviderRetryPolicy(binding) {
30
30
  const resilience = typeof binding.harnessRuntime.resilience === "object" && binding.harnessRuntime.resilience
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbotgo/agent-harness",
3
- "version": "0.0.121",
3
+ "version": "0.0.123",
4
4
  "description": "Workspace runtime for multi-agent applications",
5
5
  "type": "module",
6
6
  "packageManager": "npm@10.9.2",
@@ -15,6 +15,9 @@
15
15
  "publishConfig": {
16
16
  "access": "public"
17
17
  },
18
+ "engines": {
19
+ "node": ">=24 <25"
20
+ },
18
21
  "repository": {
19
22
  "type": "git",
20
23
  "url": "git+https://github.com/botbotgo/agent-harness.git"