bots-garden/razorbillpublic Fork
⑂ v1.0.0
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/razorbill.git
git clone ssh://git@rickub.com/bots-garden/razorbill.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
README.md · 52 lines · 2.4 KBmarkdown
Blame HistoryOpen raw

host-runner — build, test and run razorbill on the Mac from the Linux sandbox

MLX needs Metal, so razorbill's MLX engine and the experiments build and run only on the Mac. host_runner.py is a tiny HTTP service that runs on the Mac. The sandbox calls it through the sbx proxy (http://host.docker.internal:7777), and it runs xcodebuild (or the built binary) in a project — . (the razorbill package at the repository root) or experiments/<name> — streaming the output back.

The repository is mounted at the same path on the Mac and in the sandbox, so files
edited in the sandbox are what the Mac builds.

On the Mac (once per session)

cd /Users/k33g/kDrive/Rickub/bots-garden/razorbill
python3 tools/host-runner/host_runner.py          # Ctrl-C to stop; --port to change 7777

If the sandbox gets an HTTP 403 from the proxy, allow the port in the sandbox network
policy (on the Mac): sbx policy allow network localhost:7777.

From the sandbox

tools/host-runner/host.sh health

# the razorbill package
tools/host-runner/host.sh list  .
tools/host-runner/host.sh build . razorbill     # the package's only Xcode scheme
tools/host-runner/host.sh test  . razorbill     # Debug configuration
tools/host-runner/host.sh run   . rzb run "Why is the sky blue?"

# an experiment
tools/host-runner/host.sh build experiments/01-query-model query-model
tools/host-runner/host.sh run   experiments/01-query-model query-model "Why is the sky blue?"
tools/host-runner/host.sh clean experiments/01-query-model query-model

The script's exit code is the command's exit code on the Mac. run cannot provide an interactive terminal: use it for rzb run, not for rzb chat or rzb tui.

Tests

python3 -m unittest discover -s tools/host-runner

What it allows (and does not)

  • Actions: list (xcodebuild -list), build, test, run, resolve, clean, plus GET /health. Nothing else.
  • Only the repository root (.) and directories directly under experiments/ that contain a Package.swift.
  • Commands are executed without a shell (arguments are passed as a list), one at a
    time (a second request gets HTTP 409).
  • It listens on 127.0.0.1 only: it is not reachable from the network, only from
    processes on the Mac, including the sbx proxy.
  • run executes the binary the experiment builds, so it runs code from this repository
    on the Mac, as your user. Stop the service when you do not need it.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# host-runner — build, test and run razorbill on the Mac from the Linux sandbox

MLX needs Metal, so razorbill's MLX engine and the experiments build and run only on the Mac. `host_runner.py` is a tiny HTTP service that runs **on the Mac**. The sandbox calls it through the sbx proxy (`http://host.docker.internal:7777`), and it runs `xcodebuild` (or the built binary) in a *project* — `.` (the razorbill package at the repository root) or `experiments/<name>` — streaming the output back.

The repository is mounted at the same path on the Mac and in the sandbox, so files
edited in the sandbox are what the Mac builds.

## On the Mac (once per session)

```bash
cd /Users/k33g/kDrive/Rickub/bots-garden/razorbill
python3 tools/host-runner/host_runner.py          # Ctrl-C to stop; --port to change 7777
```

If the sandbox gets an HTTP 403 from the proxy, allow the port in the sandbox network
policy (on the Mac): `sbx policy allow network localhost:7777`.

## From the sandbox

```bash
tools/host-runner/host.sh health

# the razorbill package
tools/host-runner/host.sh list  .
tools/host-runner/host.sh build . razorbill     # the package's only Xcode scheme
tools/host-runner/host.sh test  . razorbill     # Debug configuration
tools/host-runner/host.sh run   . rzb run "Why is the sky blue?"

# an experiment
tools/host-runner/host.sh build experiments/01-query-model query-model
tools/host-runner/host.sh run   experiments/01-query-model query-model "Why is the sky blue?"
tools/host-runner/host.sh clean experiments/01-query-model query-model
```

The script's exit code is the command's exit code on the Mac. `run` cannot provide an interactive terminal: use it for `rzb run`, not for `rzb chat` or `rzb tui`.

## Tests

```bash
python3 -m unittest discover -s tools/host-runner
```

## What it allows (and does not)

- Actions: `list` (xcodebuild -list), `build`, `test`, `run`, `resolve`, `clean`, plus `GET /health`. Nothing else.
- Only the repository root (`.`) and directories directly under `experiments/` that contain a `Package.swift`.
- Commands are executed without a shell (arguments are passed as a list), one at a
  time (a second request gets HTTP 409).
- It listens on `127.0.0.1` only: it is not reachable from the network, only from
  processes on the Mac, including the sbx proxy.
- `run` executes the binary the experiment builds, so it runs code from this repository
  on the Mac, as your user. Stop the service when you do not need it.