agent-director 0.4.5 → 0.5.1

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,80 +0,0 @@
1
- /**
2
- * platform — native library resolver for agent-director.
3
- *
4
- * Implements the five-step resolution sequence:
5
- * 1. Check Bun.version against MIN_BUN_VERSION → ErrBunVersionTooOld
6
- * 2. Map process.platform + process.arch to an npm sub-package name →
7
- * ErrUnsupportedPlatform for unknown tuples
8
- * 3. Locate the sub-package on disk via import.meta.resolve →
9
- * ErrPlatformPackageMissing when not installed
10
- * 4. Compute binary path inside the package and verify existence →
11
- * ErrPlatformPackageMissing when binary absent (e.g. CI host mismatch)
12
- * 5. dlopen with the full binding spec → return { lib: symbols, libPath }
13
- *
14
- * resolveNativePath() exports just the path (used by bootstrapFfi.ts which
15
- * keeps its own minimal dlopen).
16
- *
17
- * loadNative() / _loadNativeInternal() dlopen the full binding spec and return
18
- * the symbols object together with the resolved path.
19
- *
20
- * _loadNativeInternal() accepts a PlatformLoadOpts bag for test injection
21
- * (override platform, arch, bunVersion without monkey-patching globals).
22
- *
23
- * Internal — NOT re-exported from src/index.ts.
24
- */
25
- /** Minimum Bun runtime version required by this package (from T1). */
26
- export declare const MIN_BUN_VERSION = "1.0.21";
27
- /**
28
- * PlatformLoadOpts — dependency-injection bag for loadNative / resolveNativePath.
29
- *
30
- * All fields are optional; missing fields fall back to the real process
31
- * globals. Pass these in unit tests to exercise error branches without
32
- * monkey-patching process.platform or Bun.version.
33
- */
34
- export interface PlatformLoadOpts {
35
- /** Override process.platform (e.g. "linux", "darwin"). */
36
- platform?: string;
37
- /** Override process.arch (e.g. "x64", "arm64"). */
38
- arch?: string;
39
- /** Override Bun.version (e.g. "1.0.0" to trigger ErrBunVersionTooOld). */
40
- bunVersion?: string;
41
- }
42
- /**
43
- * resolveNativePath performs the platform check and sub-package lookup,
44
- * returning the absolute path to the native shared library.
45
- *
46
- * If process.env.AD_CABI_DIR is set, the binary is loaded from
47
- * "${AD_CABI_DIR}/libagent_director.{so,dylib}" instead of the npm
48
- * sub-package. release.sh's verify_phase exports this so smoke tests
49
- * can run before the cabi artifacts have been staged into platforms/.
50
- *
51
- * Throws one of:
52
- * ErrBunVersionTooOld — Bun version < MIN_BUN_VERSION
53
- * ErrUnsupportedPlatform — platform/arch tuple not in SUPPORTED_TUPLES
54
- * ErrPlatformPackageMissing — sub-package not installed or binary absent
55
- */
56
- export declare function resolveNativePath(opts?: PlatformLoadOpts): string;
57
- /** Symbols returned by dlopen with the full binding spec. */
58
- export type NativeLib = Record<string, unknown>;
59
- /**
60
- * _loadNativeInternal is the testable core of loadNative().
61
- *
62
- * Accepts PlatformLoadOpts for dependency injection of platform / arch /
63
- * Bun.version so tests can exercise every error branch without live binaries.
64
- *
65
- * @returns { lib, libPath } — lib is the dlopen symbols object; libPath is the
66
- * absolute path to the .so/.dylib that was loaded (useful for logging).
67
- */
68
- export declare function _loadNativeInternal(opts?: PlatformLoadOpts): {
69
- lib: NativeLib;
70
- libPath: string;
71
- };
72
- /**
73
- * loadNative is the public entry point called by worker.ts at startup.
74
- *
75
- * Uses the real process.platform, process.arch, and Bun.version.
76
- */
77
- export declare function loadNative(): {
78
- lib: NativeLib;
79
- libPath: string;
80
- };