Lines 1-62javascript
4// Launcher for the `kimetsu-remote` npm package — the server-hosted Kimetsu
5// brain (HTTP MCP). It is a SEPARATE package from `kimetsu-ai` (the CLI); the
6// remote server is intentionally not bundled with the CLI.
8// The native binary ships through per-platform optionalDependencies
9// (@kimetsu-ai/remote-<platform>-<arch>) built with `--features embeddings,tls`.
10// npm installs only the one matching the host; this launcher execs its binary,
11// forwarding all args, stdio, and the exit code.
13const { spawnSync } = require("child_process");
15// key = `${process.platform}-${process.arch}`. Only the targets with an ONNX
16// Runtime prebuilt get an embeddings+tls server binary (mirrors the embeddings
17// flavor in release.yml). Elsewhere: `cargo install kimetsu-remote`.
19 "linux-x64": { pkg: "@kimetsu-ai/remote-linux-x64", bin: "kimetsu-remote" },
20 "darwin-arm64": { pkg: "@kimetsu-ai/remote-darwin-arm64", bin: "kimetsu-remote" },
21 "win32-x64": { pkg: "@kimetsu-ai/remote-win32-x64", bin: "kimetsu-remote.exe" },
24const REPO_URL = "https://github.com/RodCor/kimetsu";
26function fail(message) {
27 process.stderr.write(`kimetsu-remote: ${message}\n`);
31const key = `${process.platform}-${process.arch}`;
32const entry = PLATFORMS[key];
35 `no prebuilt kimetsu-remote binary for ${key} (${process.platform}/${process.arch}).\n` +
36 `Prebuilt npm binaries cover: ${Object.keys(PLATFORMS).join(", ")}.\n` +
37 `Install another way:\n` +
38 ` - cargo install kimetsu-remote --features embeddings\n` +
39 ` - grab a kimetsu-remote archive from ${REPO_URL}/releases`
45 binPath = require.resolve(`${entry.pkg}/bin/${entry.bin}`);
48 `the platform package ${entry.pkg} is not installed.\n` +
49 `npm may have skipped optional dependencies (e.g. --no-optional or\n` +
50 `--ignore-scripts). Reinstall with optional deps enabled:\n` +
51 ` npm install -g kimetsu-remote\n` +
52 `Or: cargo install kimetsu-remote --features embeddings, or an archive\n` +
53 `from ${REPO_URL}/releases`
57const result = spawnSync(binPath, process.argv.slice(2), { stdio: "inherit" });
58if (result.error) {
HighRuntime Package Install
Package source invokes a package manager install command at runtime.
bin/cli.jsView on unpkg · L50 59 fail(`failed to launch the server binary: ${result.error.message}`);
61process.exit(result.status === null ? 1 : result.status);