crabot 0.1.1 → 0.1.3

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
@@ -5,11 +5,10 @@ Local-first AI agent runtime with a gateway, operator console, and CLI.
5
5
  ## Requirements
6
6
 
7
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.
8
+ the program itself needs no Bun or Node install. The package ships no install
9
+ script; on the first `crabot` run a small launcher (running under the Node that
10
+ npm already provides) downloads the prebuilt binary matching your platform from
11
+ the matching GitHub release, verifies its checksum, and caches it for later runs.
13
12
 
14
13
  Supported platforms: Linux (x64, arm64), macOS (x64, arm64), Windows (x64).
15
14
 
package/bin/crabot.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env node
2
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.
3
+ // runtime is embedded) downloaded from the matching GitHub release lazily here on first run (the
4
+ // package ships no install script). No Bun or Node runtime is required to run crabot.
5
5
  import { spawn } from "node:child_process";
6
+ import { fileURLToPath } from "node:url";
6
7
  import { ensureBinary } from "../scripts/install.mjs";
7
8
 
8
9
  let binaryPath;
@@ -13,7 +14,18 @@ try {
13
14
  process.exit(1);
14
15
  }
15
16
 
16
- const child = spawn(binaryPath, process.argv.slice(2), { stdio: "inherit" });
17
+ // The downloaded binary lives at a version-pinned cache path that `npm update` orphans, so its own
18
+ // process.execPath is not a stable launch target. Expose the stable command that re-launches crabot —
19
+ // this launcher under Node, which re-resolves the matching binary on demand — so `crabot service
20
+ // install` writes a service unit that survives upgrades. This launcher path is stable across upgrades
21
+ // (npm replaces the package in place).
22
+ const child = spawn(binaryPath, process.argv.slice(2), {
23
+ stdio: "inherit",
24
+ env: {
25
+ ...process.env,
26
+ CRABOT_LAUNCH_VECTOR: JSON.stringify([process.execPath, fileURLToPath(import.meta.url)])
27
+ }
28
+ });
17
29
 
18
30
  // Forward termination signals so `crabot serve` shuts the gateway down gracefully when a process
19
31
  // manager signals this wrapper. Unsupported signal names throw on registration; ignore those.
package/package.json CHANGED
@@ -1,14 +1,11 @@
1
1
  {
2
2
  "name": "crabot",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Local-first AI agent runtime with a gateway, operator console, and CLI.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "crabot": "bin/crabot.mjs"
8
8
  },
9
- "scripts": {
10
- "postinstall": "node scripts/install.mjs"
11
- },
12
9
  "files": [
13
10
  "bin",
14
11
  "scripts",
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
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.
3
+ // this package's version, verifies its SHA-256, and caches it. Invoked by the launcher on first run
4
+ // when the binary is not cached yet; the package ships no install script, so nothing runs at install
5
+ // time. The binary embeds the Bun runtime, so running crabot needs no Bun or Node install.
6
6
  import { createHash } from "node:crypto";
7
7
  import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
8
8
  import { homedir } from "node:os";
@@ -74,11 +74,3 @@ export async function ensureBinary() {
74
74
  renameSync(temporary, target);
75
75
  return target;
76
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
- }