crabot 0.1.0 → 0.1.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.
- package/README.md +17 -4
- package/bin/crabot.mjs +45 -0
- package/package.json +8 -8
- package/scripts/install.mjs +84 -0
- package/dist/chunks/index-12hd6tq8.css +0 -1
- package/dist/chunks/index-kv3fcqks.js +0 -216
- package/dist/index.html +0 -31
- package/dist/main.js +0 -3315
package/README.md
CHANGED
|
@@ -4,17 +4,30 @@ Local-first AI agent runtime with a gateway, operator console, and CLI.
|
|
|
4
4
|
|
|
5
5
|
## Requirements
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
`crabot` runs as a self-contained standalone binary with the runtime embedded —
|
|
8
|
+
the program itself needs no Bun or Node install. On install, the package
|
|
9
|
+
downloads the prebuilt binary matching your platform from the matching GitHub
|
|
10
|
+
release and caches it; a small launcher hands off to it (the launcher runs under
|
|
11
|
+
the Node that npm already provides). If the download is skipped at install time,
|
|
12
|
+
it happens automatically on first run.
|
|
13
|
+
|
|
14
|
+
Supported platforms: Linux (x64, arm64), macOS (x64, arm64), Windows (x64).
|
|
9
15
|
|
|
10
16
|
## Install
|
|
11
17
|
|
|
12
18
|
```sh
|
|
19
|
+
npm install -g crabot
|
|
20
|
+
# or with bun
|
|
13
21
|
bun install -g crabot
|
|
14
|
-
#
|
|
15
|
-
|
|
22
|
+
# run once without installing
|
|
23
|
+
npx crabot update status
|
|
16
24
|
```
|
|
17
25
|
|
|
26
|
+
For an install that fetches nothing, download the standalone binary for your
|
|
27
|
+
platform directly from the
|
|
28
|
+
[GitHub releases](https://github.com/gotry-io/Crabot/releases) and put it on
|
|
29
|
+
your `PATH`.
|
|
30
|
+
|
|
18
31
|
## Usage
|
|
19
32
|
|
|
20
33
|
```sh
|
package/bin/crabot.mjs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Launcher for the `crabot` distribution. The real program is a standalone executable (the Bun
|
|
3
|
+
// runtime is embedded) downloaded from the matching GitHub release by the postinstall hook, or
|
|
4
|
+
// lazily here on first run if that was skipped. No Bun or Node runtime is required to run crabot.
|
|
5
|
+
import { spawn } from "node:child_process";
|
|
6
|
+
import { ensureBinary } from "../scripts/install.mjs";
|
|
7
|
+
|
|
8
|
+
let binaryPath;
|
|
9
|
+
try {
|
|
10
|
+
binaryPath = await ensureBinary();
|
|
11
|
+
} catch (error) {
|
|
12
|
+
process.stderr.write(`${error.message}\n`);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const child = spawn(binaryPath, process.argv.slice(2), { stdio: "inherit" });
|
|
17
|
+
|
|
18
|
+
// Forward termination signals so `crabot serve` shuts the gateway down gracefully when a process
|
|
19
|
+
// manager signals this wrapper. Unsupported signal names throw on registration; ignore those.
|
|
20
|
+
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP", "SIGQUIT", "SIGBREAK"]) {
|
|
21
|
+
try {
|
|
22
|
+
process.on(signal, () => {
|
|
23
|
+
if (child.exitCode === null) {
|
|
24
|
+
child.kill(signal);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
} catch {
|
|
28
|
+
// signal not available on this platform
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
child.on("error", (error) => {
|
|
33
|
+
process.stderr.write(`crabot: failed to launch ${binaryPath}: ${error.message}\n`);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
child.on("exit", (code, signal) => {
|
|
38
|
+
if (signal) {
|
|
39
|
+
// Re-raise the same signal so this wrapper reports the child's termination cause.
|
|
40
|
+
process.removeAllListeners();
|
|
41
|
+
process.kill(process.pid, signal);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
process.exit(code ?? 0);
|
|
45
|
+
});
|
package/package.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "crabot",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Local-first AI agent runtime with a gateway, operator console, and CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"crabot": "
|
|
7
|
+
"crabot": "bin/crabot.mjs"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"postinstall": "node scripts/install.mjs"
|
|
8
11
|
},
|
|
9
12
|
"files": [
|
|
10
|
-
"
|
|
13
|
+
"bin",
|
|
14
|
+
"scripts",
|
|
11
15
|
"README.md",
|
|
12
16
|
"LICENSE"
|
|
13
17
|
],
|
|
14
|
-
"engines": {
|
|
15
|
-
"bun": ">=1.3.10"
|
|
16
|
-
},
|
|
17
18
|
"license": "MIT",
|
|
18
19
|
"author": "Kyle",
|
|
19
20
|
"homepage": "https://github.com/gotry-io/Crabot#readme",
|
|
@@ -29,7 +30,6 @@
|
|
|
29
30
|
"agent",
|
|
30
31
|
"ai",
|
|
31
32
|
"automation",
|
|
32
|
-
"cli"
|
|
33
|
-
"bun"
|
|
33
|
+
"cli"
|
|
34
34
|
]
|
|
35
35
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Downloads the crabot standalone binary for the host platform from the GitHub release that matches
|
|
3
|
+
// this package's version, verifies its SHA-256, and caches it. Run by the postinstall hook and
|
|
4
|
+
// lazily by the launcher if the binary is not present yet (e.g. install ran with --ignore-scripts).
|
|
5
|
+
// The binary embeds the Bun runtime, so running crabot needs no Bun or Node install.
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
7
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
8
|
+
import { homedir } from "node:os";
|
|
9
|
+
import { dirname, join } from "node:path";
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
11
|
+
|
|
12
|
+
const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
13
|
+
const { version } = JSON.parse(readFileSync(join(packageRoot, "package.json"), "utf8"));
|
|
14
|
+
const repository = "gotry-io/Crabot";
|
|
15
|
+
|
|
16
|
+
// process.platform-process.arch -> GitHub release asset name.
|
|
17
|
+
const assets = {
|
|
18
|
+
"linux-x64": "crabot-linux-x64",
|
|
19
|
+
"linux-arm64": "crabot-linux-arm64",
|
|
20
|
+
"darwin-x64": "crabot-macos-x64",
|
|
21
|
+
"darwin-arm64": "crabot-macos-arm64",
|
|
22
|
+
"win32-x64": "crabot-windows-x64.exe"
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function cachedBinaryPath() {
|
|
26
|
+
const base = process.platform === "win32"
|
|
27
|
+
? process.env.LOCALAPPDATA || join(homedir(), "AppData", "Local")
|
|
28
|
+
: process.env.XDG_CACHE_HOME || join(homedir(), ".cache");
|
|
29
|
+
const name = process.platform === "win32" ? "crabot.exe" : "crabot";
|
|
30
|
+
return join(base, "crabot", `v${version}`, name);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function fetchBuffer(url) {
|
|
34
|
+
const response = await fetch(url, { redirect: "follow" });
|
|
35
|
+
if (!response.ok) {
|
|
36
|
+
throw new Error(`request failed (${response.status}) for ${url}`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return Buffer.from(await response.arrayBuffer());
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export async function ensureBinary() {
|
|
43
|
+
const target = cachedBinaryPath();
|
|
44
|
+
if (existsSync(target)) {
|
|
45
|
+
return target;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const key = `${process.platform}-${process.arch}`;
|
|
49
|
+
const asset = assets[key];
|
|
50
|
+
if (asset === undefined) {
|
|
51
|
+
throw new Error(`crabot: no prebuilt binary for ${key}. See https://github.com/${repository}/releases`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const base = `https://github.com/${repository}/releases/download/v${version}`;
|
|
55
|
+
process.stderr.write(`crabot: downloading ${asset} (v${version})...\n`);
|
|
56
|
+
const [binary, checksum] = await Promise.all([
|
|
57
|
+
fetchBuffer(`${base}/${asset}`),
|
|
58
|
+
fetchBuffer(`${base}/${asset}.sha256`).then((buffer) => buffer.toString("utf8"))
|
|
59
|
+
]);
|
|
60
|
+
|
|
61
|
+
const expected = checksum.trim().split(/\s+/u)[0];
|
|
62
|
+
const actual = createHash("sha256").update(binary).digest("hex");
|
|
63
|
+
if (expected !== actual) {
|
|
64
|
+
throw new Error(`crabot: checksum mismatch for ${asset} (expected ${expected}, got ${actual})`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
68
|
+
// Write to a sibling temp file then rename, so a concurrent install never sees a partial binary.
|
|
69
|
+
const temporary = `${target}.${process.pid}.download`;
|
|
70
|
+
writeFileSync(temporary, binary);
|
|
71
|
+
if (process.platform !== "win32") {
|
|
72
|
+
chmodSync(temporary, 0o755);
|
|
73
|
+
}
|
|
74
|
+
renameSync(temporary, target);
|
|
75
|
+
return target;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
79
|
+
// postinstall: pre-warm the cache but never fail the install; the launcher retries on first run.
|
|
80
|
+
ensureBinary().then(
|
|
81
|
+
(path) => process.stdout.write(`crabot: ready at ${path}\n`),
|
|
82
|
+
(error) => process.stderr.write(`crabot: will download on first run (${error.message})\n`)
|
|
83
|
+
);
|
|
84
|
+
}
|