@lumi.ai/runner 0.1.0

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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +138 -0
  3. package/dist/cli.js +3432 -0
  4. package/package.json +64 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CodeBridger
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,138 @@
1
+ # @lumi.ai/runner
2
+
3
+ The **runner daemon** for [Lumi Crew](https://lumi-crew.web.app) — your agentic organization
4
+ workspace.
5
+
6
+ Crew agents don't run in the cloud. They run **on your machine**, in your checkouts, with your
7
+ tools. This daemon is what makes that happen: it watches the job queues of the Ships you assign it
8
+ to, claims work one job at a time, and executes each as a headless Claude session.
9
+
10
+ ```bash
11
+ npm i -g @lumi.ai/runner
12
+ lumi-runner setup
13
+ ```
14
+
15
+ ## Requirements
16
+
17
+ | | |
18
+ |---|---|
19
+ | **Node.js** | 20 or newer |
20
+ | **Claude Code** | the `claude` CLI on your `PATH` ([install](https://claude.com/claude-code)) |
21
+ | **git / gh** | only if your agents work on GitHub repositories |
22
+ | **A Lumi Crew account** | with at least one Ship — [lumi-crew.web.app](https://lumi-crew.web.app) |
23
+
24
+ The daemon is a *client*. It signs in as you, and every write it makes is checked server-side
25
+ against your Ship membership. No service-account key ever touches your machine.
26
+
27
+ ## Connect a machine
28
+
29
+ ```bash
30
+ lumi-runner setup
31
+ ```
32
+
33
+ That's the whole thing. It opens your browser at Crew's `/connect` page, where you pick which Ships
34
+ this machine should serve and approve it in one click. The CLI is polling and collects its session,
35
+ runner id and Ship list from the approval — nothing is copied or pasted. If you approve as a
36
+ **captain**, the machine is authorized on your Ships immediately.
37
+
38
+ `setup` then runs `doctor` and offers to install the background service.
39
+
40
+ For CI or headless provisioning there is a non-interactive path:
41
+
42
+ ```bash
43
+ lumi-runner login --token <customToken> --api-key <key> --project <projectId>
44
+ ```
45
+
46
+ ## Commands
47
+
48
+ | Command | What it does |
49
+ |---|---|
50
+ | `setup` | One-time onboarding: login → pick Ships → doctor → background service |
51
+ | `login` | Connect this machine (browser approval, or `--token` for CI) |
52
+ | `ship add [ids…]` / `remove` / `list` | Which Ships this machine serves (omit ids to pick from a list) |
53
+ | `doctor` | **Preflight** — can this machine actually run a job? Non-zero exit if not |
54
+ | `service install` / `uninstall` / `restart` / `status` | Run the daemon in the background, always |
55
+ | `start` | Run the daemon in the foreground |
56
+ | `status` | Ships, approval state, current job, queue depth, today's tokens |
57
+ | `logs [-f]` | The daemon's own rotating log file |
58
+ | `config list` / `set <key> <on\|off>` | `notifications`, `keepAwake` |
59
+
60
+ Global flags: `--json` (machine-readable stdout, and never prompts), `-y/--yes`, `--no-color`.
61
+
62
+ Without a TTY the CLI does not prompt at all — it fails naming the flag that would have answered the
63
+ question, because a wizard blocking on a hidden stdin inside a systemd unit is indistinguishable
64
+ from a hang.
65
+
66
+ ### `doctor`
67
+
68
+ Run this first when something isn't working. Everything it checks used to be discovered *inside a
69
+ running job*, surfacing as a failed task on your board minutes later: a missing `claude` binary,
70
+ unsaved Ship credentials, a machine no captain approved. It checks Node ≥ 20, your stored session,
71
+ per-Ship approval and credentials, the engine binary, `git`/`gh` when an agent uses GitHub, server
72
+ reachability, and the background service.
73
+
74
+ ### Background service
75
+
76
+ `lumi-runner service install` writes a real OS service — **no root required**:
77
+
78
+ | OS | Mechanism | Note |
79
+ |---|---|---|
80
+ | macOS | `~/Library/LaunchAgents/com.lumi.runner.plist` (`RunAtLoad` + `KeepAlive`) | |
81
+ | Linux | `~/.config/systemd/user/lumi-runner.service` (`Restart=always`) | run `sudo loginctl enable-linger $USER` or it stops at logout |
82
+ | Windows | Task Scheduler, at logon | no auto-restart; use pm2 for a true always-on box |
83
+
84
+ Your `PATH` is captured into the unit at install time. launchd and systemd start processes with a
85
+ minimal environment, so without that `claude`, `git` and `gh` would not be found.
86
+
87
+ ## While a job runs
88
+
89
+ - **Idle sleep is inhibited** (`caffeinate` / `systemd-inhibit`, best-effort on Windows), so a
90
+ laptop doesn't suspend mid-session. It cannot veto you choosing Shut Down — no background process
91
+ gets that veto on macOS, and it shouldn't.
92
+ - **A desktop notification** fires on job start, finish and terminal failure, and when the daemon is
93
+ stopped with work in flight. Silence it with `lumi-runner config set notifications off`.
94
+ - **SIGTERM releases the job.** The daemon aborts the session, hands the job back to the queue with
95
+ its retry budget **unspent**, and only then writes itself offline. Stopping the daemon never costs
96
+ you an attempt.
97
+
98
+ ## Credentials
99
+
100
+ Agent-session credentials — the Claude token and, if your agents use GitHub, a token for that — are
101
+ **not** stored on this machine. A captain saves them once per Ship in the Crew app's Ship Settings,
102
+ and the daemon fetches them at job time, injects them into the session environment, and redacts them
103
+ from the transcript before upload. `lumi-runner doctor` tells you when a Ship is missing them.
104
+
105
+ The only thing stored locally is your own session, in `~/.lumi-runner/config.json` (mode `0600`).
106
+
107
+ ## Upgrading from `crew-runner`
108
+
109
+ This package was previously distributed inside the Lumi monorepo as `@lumi/crew-runner`, with a
110
+ `crew-runner` command. If that's what you have:
111
+
112
+ ```bash
113
+ crew-runner service uninstall
114
+ npm rm -g @lumi/crew-runner
115
+ npm i -g @lumi.ai/runner
116
+ lumi-runner service install
117
+ ```
118
+
119
+ You do **not** need to log in again. `~/.crew-runner` is migrated to `~/.lumi-runner` automatically
120
+ on the first run, which keeps your machine's identity — and therefore the approvals your captain
121
+ already granted it. `service install` also removes the old `com.lumi.crew-runner` /
122
+ `crew-runner.service` unit if the uninstall above was skipped, so you never end up with two daemons
123
+ claiming from one queue.
124
+
125
+ ## Environment variables
126
+
127
+ | Var | Effect |
128
+ |---|---|
129
+ | `LUMI_RUNNER_HOME` | Config + log directory (default `~/.lumi-runner`) |
130
+ | `CREW_CLAUDE_BIN` | Path to the Claude binary (default: `claude` from `PATH`) |
131
+ | `CREW_NO_NOTIFY` | Disable desktop notifications |
132
+ | `CREW_NO_POWER` | Disable sleep inhibition |
133
+
134
+ `CREW_RUNNER_HOME` is still honoured as a fallback for machines configured before the rename.
135
+
136
+ ## License
137
+
138
+ MIT — see [LICENSE](./LICENSE).