@parcha/agentrun 0.4.11 → 0.4.13

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
@@ -13,10 +13,74 @@ It starts [AgentRun Server](https://github.com/Parcha-ai/agentrun/tree/main/pack
13
13
  it in your browser (`--no-open`, a CI run or a machine with no display skips that). The server,
14
14
  `@parcha/agentrun-serve`, is this package's one dependency, at its exact version, so `npx` installs the two together and
15
15
  each version of this command runs the server it was released with. Node.js 24.22.3 or newer, on macOS or Linux; an older
16
- Node gets one line naming that floor.
16
+ Node gets one line naming that floor and the installer's command.
17
17
 
18
- A start that fails says why on stderr: the step that failed, how the server ended (its exit code or signal, or still
19
- running after 60 seconds without printing its address, and stopped), its last lines on stderr and stdout, and
18
+ No Node.js on the machine, or an older one? The installer brings its own and keeps AgentRun running after the terminal
19
+ closes:
20
+
21
+ ```sh
22
+ curl -fsSL https://agentrun.ai/install | sh
23
+ ```
24
+
25
+ It downloads a Node.js from nodejs.org: the newest release on the major line of the version this AgentRun needs, so
26
+ later security releases come with the next install. It checks the download against that release's `SHASUMS256.txt`
27
+ and installs it and AgentRun under `~/.agentrun` (`node/`, `lib/`, `bin/agentrun`). Any other Node, nvm or Homebrew is
28
+ left alone, and nothing needs sudo. When no line in your shell's startup file puts `~/.agentrun/bin` on `PATH`, it adds
29
+ one and says so. Then it starts AgentRun as a service of your user, a LaunchAgent on macOS or a systemd user unit on
30
+ Linux, which starts again at login and after a crash and logs to `~/.agentrun/logs/agentrun.log`. Where there is no
31
+ service manager (a container, say), it starts AgentRun in the background, logging to the same file. It runs until the
32
+ machine or container stops, and `agentrun stop` stops it (a SIGTERM, then a SIGKILL to the launcher and its server
33
+ after 45 seconds). Either way the installer returns once AgentRun answers, and prints its address. `sh -s -- --no-start`
34
+ installs only, `--version V` installs another version, `--node-version V` installs that Node.js (at least the floor),
35
+ and `--service` fails where there is no service manager. Running it again upgrades, or installs an older version, and
36
+ first stops the AgentRun it started in the background itself, whatever version that is.
37
+
38
+ `agentrun service status` prints the console's address and its health. `start`, `stop`, `restart`, `logs [--follow]`,
39
+ `upgrade [--version V]` (the installer again, then a restart) and `uninstall` (the data stays) do what they say, and
40
+ `agentrun service install [--port N] [--data DIR]` installs the service after a `--no-start`. For a local model, such
41
+ as Ollama's, `agentrun service install --env AGENT_MODEL_BASE_URL=<its /v1 address> --env AGENT_MODEL_GATEWAY_IDS=bare --env
42
+ AGENT_MODEL=<tag> --env AGENT_MODEL_PRICE=0,0,0` writes those variables into the
43
+ service and restarts it. They stay through restarts, upgrades and later installs, and `--env KEY=` removes one. `--env`
44
+ takes those four names alone: model keys go in the console, never in a service file. On Linux, a user's
45
+ services stop at logout unless lingering is on: `install` and `status` print the one `sudo loginctl enable-linger` line
46
+ when it is off. To remove AgentRun, run `agentrun service uninstall`, then delete `~/.agentrun/bin`, `~/.agentrun/lib`,
47
+ `~/.agentrun/node` and the `PATH` line; the rest of `~/.agentrun` is your data.
48
+
49
+ On a machine you keep on (a Mac mini, a home server, a VPS), `--tailscale` also puts AgentRun on your own
50
+ [Tailscale](https://tailscale.com) network, at `https://<machine>.<your tailnet's DNS name>/`, which only your devices
51
+ on that network open:
52
+
53
+ ```sh
54
+ curl -fsSL https://agentrun.ai/install | sh -s -- --tailscale
55
+ ```
56
+
57
+ It runs `tailscale serve --bg --https=443` to AgentRun's port, 7340, where AgentRun keeps listening on loopback only,
58
+ and prints the address from `tailscale status --json`. The server is told that address (`AGENTRUN_PUBLIC_URL`), so its
59
+ first visit asks for the setup code in `~/.agentrun/logs/agentrun.log`. It never uses Funnel, which would put the
60
+ address on the public internet: where Funnel is already on for that address, or the address serves something else, it
61
+ changes nothing and says so. It never installs Tailscale, logs in or runs sudo. With Tailscale missing or logged out,
62
+ it starts AgentRun on this machine and prints the steps and the command to run again. On Linux, where only root or
63
+ Tailscale's operator may change what it serves, it prints the one `sudo tailscale set --operator=$USER` line.
64
+ `agentrun service install --tailscale` does the same for an installed service, `--no-tailscale` takes it off, and
65
+ `agentrun service uninstall` removes the serve entry it added and no other. Tailscale's Personal plan is free: up to 6
66
+ users, unlimited user devices ([pricing](https://tailscale.com/pricing)). The https address needs MagicDNS and HTTPS
67
+ certificates turned on in your tailnet's [DNS settings](https://login.tailscale.com/admin/dns).
68
+
69
+ On a Linux server you rent (Ubuntu or Debian, as root), `--vps` sets up AgentRun in Docker Compose instead, with a
70
+ shell for its agents in Docker sandboxes, on your tailnet when Tailscale is logged in and on the server's loopback
71
+ otherwise:
72
+
73
+ ```sh
74
+ curl -fsSL https://agentrun.ai/install | sh -s -- --vps
75
+ ```
76
+
77
+ [Deploying AgentRun](https://github.com/Parcha-ai/agentrun/blob/main/deploy/README.md#one-command-on-a-server-you-rent)
78
+ says what it installs and writes, and what `--public` exposes.
79
+
80
+ The server binds its port first and says so; this command then names the address on stderr at once, and prints its line
81
+ on stdout once the server is ready, which on a cold, slow disk can take minutes. A start that fails says why on stderr:
82
+ the step that failed, how the server ended (its exit code or signal, or still running after 60 seconds without printing
83
+ any address, and stopped; `AGENTRUN_START_TIMEOUT_MS` sets that wait, in milliseconds), its last lines on stderr and stdout, and
20
84
  `~/.agentrun/start.log` (in the folder `--data` names), which holds everything the server wrote in that start. Each start
21
85
  overwrites that log; it is private to you, as the server's first lines name its API token. A log the disk could not hold
22
86
  all of is named with the error that cut it short.
@@ -37,10 +101,10 @@ this app uses your ChatGPT plan. Manage usage in your ChatGPT settings. The sign
37
101
  agents on this server with it.
38
102
 
39
103
  Or add a model key. With no `AGENT_MODEL`, the server runs a current model of the first provider it has a key for,
40
- Anthropic, then OpenAI, then OpenRouter: `ANTHROPIC_API_KEY`, `OPENAI_API_KEY` or `OPENROUTER_API_KEY` in your
41
- environment, or a key saved in the console's Settings → Model keys, which counts from the save on. Signed in with
42
- ChatGPT, pi and Codex run on the plan's model by default, key or not, unless `AGENT_MODEL` names another. Other
43
- commands are the server's:
104
+ Anthropic, then OpenAI, then Particle (pi only), then OpenRouter: `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`,
105
+ `PARTICLE_API_KEY` or `OPENROUTER_API_KEY` in your environment, or a key saved in the console's Settings → Model
106
+ keys, which counts from the save on. Signed in with ChatGPT, pi and Codex run on the plan's model by default, key or
107
+ not, unless `AGENT_MODEL` names another. Other commands are the server's:
44
108
  `npx @parcha/agentrun import` brings in your local Claude Code, Codex and pi sessions, and
45
109
  `npx @parcha/agentrun reset-password` clears the console's password. `--data DIR` and `--port N` change where it keeps
46
110
  its data and the port it takes.
package/bin/agentrun.mjs CHANGED
@@ -2,17 +2,23 @@
2
2
  // npx @parcha/agentrun: AgentRun Server on this machine with one command. Node first, in syntax any Node reads, so an old one
3
3
  // gets one plain line rather than a parse error; the repository's own rule (scripts/check-node.mjs). The floor is read from
4
4
  // this package's own engines field (">=MAJOR.MINOR.PATCH"), so the line never names another version than npm's. The patch
5
- // counts: the floor is a security release, and the releases before it on the same minor lack its fixes.
5
+ // counts: the floor is a security release, and the releases before it on the same minor lack its fixes. The line ends
6
+ // with the installer's command, which brings a Node of its own (install.sh). `--version` alone prints this package's version.
6
7
  import { readFileSync } from "node:fs";
7
8
 
8
- const engines = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).engines.node;
9
+ const own = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
10
+ const engines = own.engines.node;
9
11
  const floor = /^>=(\d+)\.(\d+)\.(\d+)$/.exec(engines);
10
12
  if (!floor) throw new Error(`this package's engines.node is ${JSON.stringify(engines)}, not ">=MAJOR.MINOR.PATCH"`);
11
13
  const need = floor.slice(1).map(Number);
12
14
  const have = process.versions.node.split(".").map(Number);
13
15
  const at = need.findIndex((part, i) => have[i] !== part);
14
16
  if (at !== -1 && !(have[at] > need[at])) {
15
- console.error(`AgentRun needs Node.js ${need.join(".")} or newer; you have v${process.versions.node}.`);
17
+ console.error(`AgentRun needs Node.js ${need.join(".")} or newer; you have v${process.versions.node}. To install AgentRun with a Node.js of its own, run: curl -fsSL https://agentrun.ai/install | sh`);
16
18
  process.exit(1);
17
19
  }
20
+ if (process.argv[2] === "--version" && process.argv.length === 3) {
21
+ console.log(own.version);
22
+ process.exit(0);
23
+ }
18
24
  import("../lib/start.mjs").then(({ main }) => main(process.argv.slice(2))).then((code) => { process.exitCode = code; });