@agentbus/agentbus-client 0.11.2 → 0.16.0
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/goBin.d.ts +6 -0
- package/dist/goBin.js +57 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -1
- package/package.json +9 -3
package/dist/goBin.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function platformKey(platform?: NodeJS.Platform, arch?: string): string;
|
|
2
|
+
export declare function optionalPackageName(plat?: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Path to agentbus-go-worker from optionalDependency, or null if not installed.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveGoWorkerPath(): string | null;
|
package/dist/goBin.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.platformKey = platformKey;
|
|
7
|
+
exports.optionalPackageName = optionalPackageName;
|
|
8
|
+
exports.resolveGoWorkerPath = resolveGoWorkerPath;
|
|
9
|
+
/**
|
|
10
|
+
* Resolve platform Go helper packages (esbuild-style optionalDependencies).
|
|
11
|
+
* No runtime download — npm installs the matching optional package when available.
|
|
12
|
+
*/
|
|
13
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
14
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
15
|
+
const PLAT_MAP = {
|
|
16
|
+
"linux x64": "linux-x64",
|
|
17
|
+
"linux arm64": "linux-arm64",
|
|
18
|
+
"darwin x64": "darwin-x64",
|
|
19
|
+
"darwin arm64": "darwin-arm64",
|
|
20
|
+
"win32 x64": "win32-x64",
|
|
21
|
+
};
|
|
22
|
+
function platformKey(platform = process.platform, arch = process.arch) {
|
|
23
|
+
const key = `${platform} ${arch}`;
|
|
24
|
+
const plat = PLAT_MAP[key];
|
|
25
|
+
if (!plat) {
|
|
26
|
+
throw new Error(`unsupported platform for Go worker: ${platform}/${arch}`);
|
|
27
|
+
}
|
|
28
|
+
return plat;
|
|
29
|
+
}
|
|
30
|
+
function optionalPackageName(plat = platformKey()) {
|
|
31
|
+
return `@agentbus/go-worker-${plat}`;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Path to agentbus-go-worker from optionalDependency, or null if not installed.
|
|
35
|
+
*/
|
|
36
|
+
function resolveGoWorkerPath() {
|
|
37
|
+
if (process.env.AGENTBUS_GO_WORKER && node_fs_1.default.existsSync(process.env.AGENTBUS_GO_WORKER)) {
|
|
38
|
+
return process.env.AGENTBUS_GO_WORKER;
|
|
39
|
+
}
|
|
40
|
+
const plat = platformKey();
|
|
41
|
+
const pkg = optionalPackageName(plat);
|
|
42
|
+
try {
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
44
|
+
const pkgJson = require.resolve(`${pkg}/package.json`);
|
|
45
|
+
const root = node_path_1.default.dirname(pkgJson);
|
|
46
|
+
const exe = process.platform === "win32"
|
|
47
|
+
? "agentbus-go-worker.exe"
|
|
48
|
+
: "agentbus-go-worker";
|
|
49
|
+
const bin = node_path_1.default.join(root, "bin", exe);
|
|
50
|
+
if (node_fs_1.default.existsSync(bin))
|
|
51
|
+
return bin;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// optional dep missing
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { AgentBusOptions, BusEvent } from "./types";
|
|
|
3
3
|
export { getDatabasePath } from "./locator";
|
|
4
4
|
export { DatabaseWatcher } from "./watcher";
|
|
5
5
|
export { createStdioMcpClient } from "./stdio";
|
|
6
|
+
export { platformKey, optionalPackageName, resolveGoWorkerPath, } from "./goBin";
|
|
6
7
|
export type { AgentBusOptions, BusEvent, McpToolClient, } from "./types";
|
|
7
8
|
export type { StdioMcpOptions } from "./stdio";
|
|
8
9
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AgentBus = exports.createStdioMcpClient = exports.DatabaseWatcher = exports.getDatabasePath = void 0;
|
|
3
|
+
exports.AgentBus = exports.resolveGoWorkerPath = exports.optionalPackageName = exports.platformKey = exports.createStdioMcpClient = exports.DatabaseWatcher = exports.getDatabasePath = void 0;
|
|
4
4
|
exports.unwrapToolResult = unwrapToolResult;
|
|
5
5
|
exports.parsePollPage = parsePollPage;
|
|
6
6
|
exports.normalizePollResult = normalizePollResult;
|
|
@@ -14,6 +14,10 @@ var watcher_2 = require("./watcher");
|
|
|
14
14
|
Object.defineProperty(exports, "DatabaseWatcher", { enumerable: true, get: function () { return watcher_2.DatabaseWatcher; } });
|
|
15
15
|
var stdio_2 = require("./stdio");
|
|
16
16
|
Object.defineProperty(exports, "createStdioMcpClient", { enumerable: true, get: function () { return stdio_2.createStdioMcpClient; } });
|
|
17
|
+
var goBin_1 = require("./goBin");
|
|
18
|
+
Object.defineProperty(exports, "platformKey", { enumerable: true, get: function () { return goBin_1.platformKey; } });
|
|
19
|
+
Object.defineProperty(exports, "optionalPackageName", { enumerable: true, get: function () { return goBin_1.optionalPackageName; } });
|
|
20
|
+
Object.defineProperty(exports, "resolveGoWorkerPath", { enumerable: true, get: function () { return goBin_1.resolveGoWorkerPath; } });
|
|
17
21
|
const DEFAULT_POLL_LIMIT = 50;
|
|
18
22
|
/**
|
|
19
23
|
* Idiomatic Node client: EventEmitter + publish/poll over AgentBus MCP tools,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentbus/agentbus-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "TypeScript/Node EventEmitter client for AgentBus (MCP + fs.watch poll)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,6 +8,13 @@
|
|
|
8
8
|
"dist",
|
|
9
9
|
"README.md"
|
|
10
10
|
],
|
|
11
|
+
"optionalDependencies": {
|
|
12
|
+
"@agentbus/go-worker-linux-x64": "0.16.0",
|
|
13
|
+
"@agentbus/go-worker-linux-arm64": "0.16.0",
|
|
14
|
+
"@agentbus/go-worker-darwin-x64": "0.16.0",
|
|
15
|
+
"@agentbus/go-worker-darwin-arm64": "0.16.0",
|
|
16
|
+
"@agentbus/go-worker-win32-x64": "0.16.0"
|
|
17
|
+
},
|
|
11
18
|
"scripts": {
|
|
12
19
|
"build": "tsc",
|
|
13
20
|
"prepublishOnly": "npm run build",
|
|
@@ -34,8 +41,7 @@
|
|
|
34
41
|
"url": "https://github.com/onicarps/agentbus/issues"
|
|
35
42
|
},
|
|
36
43
|
"publishConfig": {
|
|
37
|
-
"access": "public"
|
|
38
|
-
"provenance": true
|
|
44
|
+
"access": "public"
|
|
39
45
|
},
|
|
40
46
|
"dependencies": {
|
|
41
47
|
"@modelcontextprotocol/sdk": "^1.12.1"
|