@fibteq/myrel-runner 0.0.0-stage → 0.5.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 CHANGED
@@ -1,3 +1,145 @@
1
- # Temporary Holding Version
1
+ # myrel-runner
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Connects your computer to a Myrel server, so a project can work in one of your
4
+ local folders with the coding CLI you already use: Claude Code, Codex CLI or
5
+ Gemini CLI.
6
+
7
+ - It opens an **outbound** WebSocket to the server. No port is opened, and it works behind NAT.
8
+ - The server sends a task (a folder, a CLI and a prompt). The runner starts the CLI in that folder, streams its
9
+ progress back and returns its final answer.
10
+ - The CLI runs with **your own login on your computer**. myrel-runner never reads, sends or stores your Claude,
11
+ OpenAI or Google credentials. The only secret it keeps is its own Myrel runner token, in
12
+ `~/.altair-runner/config.json` (readable by you only).
13
+ - It only works in folders you shared, from Myrel > Devices or with `myrel-runner share`. A path from the server that is not one of them
14
+ (after resolving symlinks) is refused.
15
+
16
+ ## Use
17
+
18
+ Requires Node 22+ and at least one of `claude`, `codex` or `gemini` on your `PATH`, already signed in.
19
+
20
+ ```sh
21
+ npx myrel-runner pair ABCD-1234 --server https://altair.example.com # code from Myrel > Devices
22
+ npx myrel-runner service install # runs now and at every login
23
+ npx myrel-runner@latest update # later: update and restart it
24
+ ```
25
+
26
+ Then add folders in Myrel > Devices with **Add folder**: it browses this computer's folders through the runner
27
+ (folder names only, never files) and shares the one you pick. The home folder itself and the disk root cannot be
28
+ shared. From a terminal, `myrel-runner share [folder]` and `myrel-runner unshare <folder>` do the same.
29
+
30
+ Other commands: `myrel-runner status`, `myrel-runner logout`, and `myrel-runner start` to run it in a terminal
31
+ instead of in the background (Ctrl+C stops it).
32
+
33
+ ### In the background
34
+
35
+ `myrel-runner service install` copies the runner to `~/.altair-runner/bin` (so it keeps working after npx clears its
36
+ cache) and registers it to start at login:
37
+
38
+ | OS | How | Logs |
39
+ |---|---|---|
40
+ | macOS | launchd agent `~/Library/LaunchAgents/io.fibteq.altair-runner.plist` | `~/.altair-runner/runner.log` |
41
+ | Linux | systemd user service `altair-runner.service` | `journalctl --user -u myrel-runner` |
42
+ | Windows | `altair-runner.vbs` in the Startup folder | `~/.altair-runner/runner.log` |
43
+
44
+ It keeps the `PATH` of the terminal you install it from, which is where it finds `claude`, `codex` and `gemini`.
45
+ On macOS and Linux it restarts after a crash, but not after a clean stop (the computer was removed in Myrel, or
46
+ `myrel-runner start` was run somewhere else with the same pairing). `myrel-runner update` installs the newest version
47
+ from npm and restarts the background runner on it (`service install` again also restarts it); `service status` shows its state and
48
+ `service uninstall` removes it. On Linux it starts when you log in; to start at boot without logging in, run
49
+ `loginctl enable-linger`.
50
+
51
+ ### Threads working at the same time
52
+
53
+ When a shared folder is a git repository, each thread works in its own
54
+ [git worktree](https://git-scm.com/docs/git-worktree) on its own branch, `altair/thr-…`, made from the repository's
55
+ current commit on the thread's first task. Two threads can then work in the same project at once without changing
56
+ each other's files or switching each other's branch, and your own checkout is left alone. Each task's result says
57
+ which branch and folder the work is in; merge or open a PR from that branch as usual.
58
+
59
+ Worktrees live in `~/.altair-runner/worktrees`. They start without your uncommitted changes and without ignored files
60
+ such as `node_modules` or `.env`, so a task may need to install dependencies first. A worktree that has not been used
61
+ for a day, has no uncommitted changes and whose branch is merged into your checkout's branch is removed
62
+ automatically, with its branch. `myrel-runner worktrees` lists them, `worktrees prune` cleans up now,
63
+ `worktrees remove <path or branch>` removes one, and `worktrees off` makes threads work in the folder itself again.
64
+ Read-only tasks (`--access read`) always run in the folder itself.
65
+
66
+ ### What the CLI may do
67
+
68
+ `myrel-runner start --access <level>` or `myrel-runner service install --access <level>` (saved for next time):
69
+
70
+ | level | Claude Code | Codex | Gemini CLI |
71
+ |---|---|---|---|
72
+ | `read` | `--permission-mode plan` | `--sandbox read-only` | `--approval-mode default` |
73
+ | `edit` (default) | `--permission-mode acceptEdits` | `--sandbox workspace-write` | `--approval-mode auto_edit` |
74
+ | `full` | `--permission-mode bypassPermissions` | `--sandbox danger-full-access` | `--approval-mode yolo` |
75
+
76
+ With `edit`, the CLI can change files in the folder but cannot run commands that would need your approval. Use
77
+ `full` only for folders and projects you trust: it lets the CLI run any command without asking.
78
+
79
+ Tasks in the same Myrel thread continue the same Claude Code session (`--resume`), so follow-ups keep context.
80
+
81
+ ### Your CLI as the thread's agent
82
+
83
+ When a project works in one of your folders, your CLI does not just run tasks: it is the thread's agent. Each turn of
84
+ a thread is one run of the CLI (Claude Code resumes the thread's previous session), with Myrel's tools (reply, plan,
85
+ decisions, artifacts, memory, routines) added over MCP:
86
+
87
+ | CLI | How the MCP server is added |
88
+ |---|---|
89
+ | Claude Code | `--mcp-config <file>`, allowed with `--allowedTools mcp__altair` |
90
+ | Codex CLI | `-c mcp_servers.altair.url=…` and `-c mcp_servers.altair.bearer_token_env_var="ALTAIR_MCP_TOKEN"` |
91
+ | Gemini CLI | its own settings file, through `GEMINI_CLI_SYSTEM_SETTINGS_PATH` |
92
+
93
+ The MCP endpoint is `<server>/api/agent-mcp/<thread>` and its token is valid only for that turn. Config files holding
94
+ it are readable only by you and deleted when the run ends; Codex gets it in its environment instead. The whole turn
95
+ uses your own CLI login. Needs myrel-runner 0.4.0 or later for Claude Code, 0.5.0 or later for Codex and Gemini CLI.
96
+ Projects without a local folder are worked in the cloud by OpenCode, in the thread's own sandbox.
97
+
98
+ ### For apps that run it (the desktop app)
99
+
100
+ - `ALTAIR_SERVER` and `ALTAIR_RUNNER_TOKEN` override the saved pairing, and an env token is never written to disk.
101
+ An app that already has the user's session can pair without a code: `POST /api/runners/pairing` (as the user)
102
+ returns a code, and `POST /api/runner/pair` trades it for the runner token.
103
+ - `ALTAIR_RUNNER_HOME` moves the config folder.
104
+ - `myrel-runner start --json` prints one status object per line (`connecting`, `online`, `offline`, `task`,
105
+ `stopped`); `myrel-runner status --json` prints the config without the token.
106
+ - The build is a single JavaScript file with no native dependencies (`dist/cli.js`), so it can be packed into one
107
+ binary with Node SEA or `bun build --compile`.
108
+
109
+ ## Packages
110
+
111
+ The CLI is published as [`@fibteq/myrel-runner`](https://www.npmjs.com/package/@fibteq/myrel-runner).
112
+ [`myrel-runner`](https://www.npmjs.com/package/myrel-runner) (in `packages/myrel-runner-alias`) is a short name that
113
+ depends on it, so `npx myrel-runner` works. `npx @fibteq/myrel-runner` runs the same CLI.
114
+
115
+ `startRunner()` and `pair()` are exported too, for the desktop app to bundle the runner instead of shelling out to it.
116
+
117
+ ## From this repository
118
+
119
+ ```sh
120
+ pnpm install
121
+ pnpm --filter @fibteq/myrel-runner build
122
+ node packages/myrel-runner/dist/cli.js --help
123
+ ```
124
+
125
+ ## Releasing
126
+
127
+ 1. Bump `version` in `package.json` here and in `packages/myrel-runner-alias/package.json`, and `RUNNER_VERSION`
128
+ in `src/runner.ts` (a test checks they match). Bump `RUNNER_PROTOCOL_VERSION` in `@altair/protocol` only when the
129
+ wire format changes; the server refuses runners on another protocol version and tells them to update.
130
+ 2. Merge it. The [Release myrel-runner](../../.github/workflows/release-runner.yml) workflow then tests, builds and
131
+ publishes both packages whose version is not on npm yet (it can also be run by hand from the Actions tab).
132
+ It uses npm trusted publishing: once, on npmjs.com, open each package's **Settings > Trusted publishing**, choose
133
+ GitHub Actions and enter `Fibteq-Inc`, `altair` and `release-runner.yml`.
134
+
135
+ By hand instead (needs an npm account in the `fibteq` npm organization), runner first, then the short name, with
136
+ `pnpm` (it replaces `workspace:` versions and uses the built files from `publishConfig`):
137
+
138
+ ```sh
139
+ npm login
140
+ pnpm --filter @fibteq/myrel-runner publish --access public
141
+ pnpm --filter myrel-runner publish --access public
142
+ ```
143
+
144
+ `prepublishOnly` builds and tests the runner before it is published. Check the contents first with
145
+ `pnpm --filter @fibteq/myrel-runner pack` if in doubt.