@xelexis/x-broker 0.0.0-stage → 0.9.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.
package/README.md CHANGED
@@ -1,3 +1,34 @@
1
- # Temporary Holding Version
1
+ # @xelexis/x-broker
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `npx` launcher for `asb-client`, the local MCP client of the Agent Session Broker. The package contains the prebuilt `asb-client` 0.9.2 for every supported platform (about 15 MB to download, 38 MB installed, no install scripts); the launcher starts the one for this computer and passes all arguments, standard input and output through unchanged.
4
+
5
+ Supported: macOS Apple Silicon and Intel, Linux x64, Windows x64. Node.js 18 or later and npm are required. Other platforms, including Linux ARM64, are not supported.
6
+
7
+ ## MCP configuration
8
+
9
+ Pin the version to match your broker server, so the first start does not resolve a different release.
10
+
11
+ `.mcp.json` (Claude Code, macOS/Linux):
12
+
13
+ ```json
14
+ {
15
+ "mcpServers": {
16
+ "x-broker": {
17
+ "command": "npx",
18
+ "args": ["-y", "@xelexis/x-broker@0.9.2", "--broker-url", "https://broker.example/mcp?project=brk", "--token", "<project token>"]
19
+ }
20
+ }
21
+ }
22
+ ```
23
+
24
+ `.codex/config.toml` (Codex, macOS/Linux):
25
+
26
+ ```toml
27
+ [mcp_servers.x-broker]
28
+ command = "npx"
29
+ args = ["-y", "@xelexis/x-broker@0.9.2", "--broker-url", "https://broker.example/mcp?project=brk", "--token", "<project token>"]
30
+ ```
31
+
32
+ On Windows use `"command": "cmd"` and put `"/c", "npx"` before the other arguments. The first start downloads the package; if your MCP host times out, run `npx -y @xelexis/x-broker@0.9.2 --version` once beforehand or install it with `npm install -g @xelexis/x-broker@0.9.2` and use `x-broker` as the command.
33
+
34
+ `x-broker --help` shows the client options. Session credentials are kept in the client's usual user configuration directory, independent of the npm cache.
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // npm launcher for asb-client. It writes nothing to stdout (the MCP stdio
5
+ // channel) and relays stdin/stdout through pipes rather than inheriting them:
6
+ // if this process is killed, the client's stdin closes and it exits on EOF
7
+ // instead of outliving its host. Diagnostics go to stderr only.
8
+ const { spawn } = require("node:child_process");
9
+ const fs = require("node:fs");
10
+ const path = require("node:path");
11
+
12
+ const binaries = {
13
+ "darwin-arm64": "asb-client",
14
+ "darwin-x64": "asb-client",
15
+ "linux-x64": "asb-client",
16
+ "win32-x64": "asb-client.exe",
17
+ };
18
+
19
+ // Every supported client is bundled under bin/<platform>/ next to this file.
20
+ function binaryPath({ platform = process.platform, arch = process.arch, dir = __dirname } = {}) {
21
+ const key = `${platform}-${arch}`;
22
+ if (!Object.hasOwn(binaries, key)) {
23
+ throw new Error(`unsupported platform ${key}; supported: ${Object.keys(binaries).join(", ")}`);
24
+ }
25
+ return path.join(dir, key, binaries[key]);
26
+ }
27
+
28
+ // A missing or non-executable client means a damaged installation; say so
29
+ // before spawning so stdout stays empty.
30
+ function checkBinary(file) {
31
+ const { name, version } = require("../package.json");
32
+ const reinstall = `reinstall ${name}@${version}`;
33
+ if (!fs.statSync(file, { throwIfNoEntry: false })?.isFile()) throw new Error(`${file} is missing; ${reinstall}`);
34
+ if (process.platform !== "win32") {
35
+ try {
36
+ fs.accessSync(file, fs.constants.X_OK);
37
+ } catch {
38
+ throw new Error(`${file} is not executable; ${reinstall}`);
39
+ }
40
+ }
41
+ }
42
+
43
+ function main() {
44
+ let file;
45
+ try {
46
+ file = binaryPath();
47
+ checkBinary(file);
48
+ } catch (err) {
49
+ process.stderr.write(`x-broker: ${err.message}\n`);
50
+ process.exit(1);
51
+ }
52
+ const child = spawn(file, process.argv.slice(2), { stdio: ["pipe", "pipe", "inherit"], windowsHide: true });
53
+ const signals = process.platform === "win32" ? ["SIGINT", "SIGTERM", "SIGBREAK"] : ["SIGINT", "SIGTERM", "SIGHUP"];
54
+ const forward = (signal) => {
55
+ if (child.exitCode === null && child.signalCode === null) child.kill(signal);
56
+ };
57
+ for (const signal of signals) process.on(signal, forward);
58
+
59
+ process.stdin.pipe(child.stdin);
60
+ child.stdout.pipe(process.stdout, { end: false });
61
+ // The client may exit before reading everything, and the host may close
62
+ // our stdout; neither is a launcher error.
63
+ child.stdin.on("error", () => {});
64
+ process.stdout.on("error", () => forward("SIGTERM"));
65
+
66
+ child.on("error", (err) => {
67
+ process.stderr.write(`x-broker: cannot start ${file}: ${err.message}\n`);
68
+ process.exit(1);
69
+ });
70
+ child.on("close", (code, signal) => {
71
+ process.stdin.unpipe(child.stdin);
72
+ process.stdin.destroy();
73
+ for (const s of signals) process.removeListener(s, forward);
74
+ // Flush relayed output before mirroring the client's exit.
75
+ process.stdout.write("", () => {
76
+ if (signal) process.kill(process.pid, signal);
77
+ process.exit(code ?? 1);
78
+ });
79
+ });
80
+ }
81
+
82
+ if (require.main === module) main();
83
+ module.exports = { binaryPath };
package/package.json CHANGED
@@ -1,6 +1,27 @@
1
1
  {
2
2
  "name": "@xelexis/x-broker",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.9.2",
4
+ "description": "npx launcher and bundled clients for the Agent Session Broker MCP client (asb-client)",
5
+ "bin": {
6
+ "x-broker": "bin/x-broker.js"
7
+ },
8
+ "files": [
9
+ "bin/x-broker.js",
10
+ "bin/darwin-arm64/asb-client",
11
+ "bin/darwin-x64/asb-client",
12
+ "bin/linux-x64/asb-client",
13
+ "bin/win32-x64/asb-client.exe"
14
+ ],
15
+ "engines": {
16
+ "node": ">=18"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/xelexis-dev/agent-session-broker-deploy.git"
21
+ },
22
+ "homepage": "https://github.com/xelexis-dev/agent-session-broker-deploy#readme",
23
+ "bugs": {
24
+ "url": "https://github.com/xelexis-dev/agent-session-broker-deploy#readme"
25
+ },
26
+ "xBrokerClientInputs": "sha256:ac0be4608711eb30a44cd12c1d748671c4edf1b489e704bd3e09a34c402b308c"
27
+ }