@botbotgo/agent-harness 0.0.1 → 0.0.2

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,4 +1,5 @@
1
1
  import type { RuntimeAdapterOptions, WorkspaceBundle } from "../contracts/types.js";
2
+ export declare function resolveLocalBuiltinsEntry(currentVendorDir: string, resolveInstalledEntry?: () => string | null): string;
2
3
  type BuiltinToolInfo = {
3
4
  builtinPath: string;
4
5
  backendOperation: string;
@@ -1,18 +1,33 @@
1
1
  import { existsSync } from "node:fs";
2
+ import { createRequire } from "node:module";
2
3
  import path from "node:path";
3
4
  import { readFile } from "node:fs/promises";
4
5
  import { fileURLToPath, pathToFileURL } from "node:url";
5
6
  import { ensureExternalSource, isExternalSourceLocator, parseExternalSourceLocator } from "./sources.js";
6
7
  const vendorDir = path.dirname(fileURLToPath(import.meta.url));
7
- const builtinsDist = path.resolve(vendorDir, "../../../builtins/dist/src/index.js");
8
- const builtinsSource = path.resolve(vendorDir, "../../../builtins/src/index.ts");
9
- function preferSourceWhenAvailable(distPath, sourcePath) {
10
- if (!existsSync(sourcePath)) {
11
- return distPath;
8
+ const require = createRequire(import.meta.url);
9
+ function installedBuiltinsEntry() {
10
+ try {
11
+ return require.resolve("@botbotgo/agent-harness-builtin");
12
12
  }
13
- return sourcePath;
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");
14
29
  }
15
- const builtinsEntry = preferSourceWhenAvailable(builtinsDist, builtinsSource);
30
+ const builtinsEntry = resolveLocalBuiltinsEntry(vendorDir);
16
31
  const localBuiltins = await import(pathToFileURL(builtinsEntry).href);
17
32
  const remoteProviderCache = new Map();
18
33
  function resolvePackageEntry(packageRoot, pkg) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbotgo/agent-harness",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Agent Harness framework package",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -23,7 +23,7 @@
23
23
  }
24
24
  },
25
25
  "dependencies": {
26
- "@botbotgo/agent-harness-builtin": "workspace:*"
26
+ "@botbotgo/agent-harness-builtin": "0.0.2"
27
27
  },
28
28
  "scripts": {
29
29
  "build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json && cp -R config dist/",