@b3labs/b3iq-cli 0.0.0-stage → 0.0.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/AGENTS.md +319 -0
- package/ERROR_PATHS.md +63 -0
- package/LICENSE +202 -0
- package/README.md +207 -2
- package/dist/commands/claude-desktop.js +323 -0
- package/dist/commands/codex-desktop.js +118 -0
- package/dist/commands/commands.js +39 -0
- package/dist/commands/logs.js +41 -0
- package/dist/commands/machines.js +104 -0
- package/dist/commands/media-mcp.js +19 -0
- package/dist/commands/misc.js +257 -0
- package/dist/commands/models.js +141 -0
- package/dist/commands/native-agents.js +291 -0
- package/dist/commands/opencode.js +161 -0
- package/dist/commands/plugins.js +67 -0
- package/dist/commands/runtimes.js +76 -0
- package/dist/commands/ssh.js +156 -0
- package/dist/index.js +194 -0
- package/dist/lib/api.js +149 -0
- package/dist/lib/args.js +35 -0
- package/dist/lib/commands-wait.js +41 -0
- package/dist/lib/config.js +85 -0
- package/dist/lib/desktop-server-lifecycle.js +19 -0
- package/dist/lib/diagnosis.js +678 -0
- package/dist/lib/inference.js +272 -0
- package/dist/lib/machines.js +120 -0
- package/dist/lib/management-probe.js +36 -0
- package/dist/lib/media-download.js +50 -0
- package/dist/lib/output.js +151 -0
- package/dist/lib/ssh-session.js +280 -0
- package/dist/lib/ssh-target.js +28 -0
- package/dist/lib/stdin.js +16 -0
- package/dist/lib/version.js +1 -0
- package/package.json +58 -4
package/AGENTS.md
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
# Drive B3IQ machines from an agent
|
|
2
|
+
|
|
3
|
+
Official B3IQ instructions for a coding agent that manages a customer's GPU
|
|
4
|
+
machines through the `b3iq` CLI. This file ships inside the npm package
|
|
5
|
+
`@b3labs/b3iq-cli`, so you can check where it came from: after install it is at
|
|
6
|
+
`$(pnpm root -g)/@b3labs/b3iq-cli/AGENTS.md`. The human docs are at
|
|
7
|
+
`https://docs.b3iq.org/developers/cli`, and every docs page has a Markdown
|
|
8
|
+
version at the same URL plus `.md`.
|
|
9
|
+
|
|
10
|
+
## Rules for the agent
|
|
11
|
+
|
|
12
|
+
1. Run the commands yourself. The exceptions are marked **User step**: they need
|
|
13
|
+
a browser or the dashboard, so ask the user and wait.
|
|
14
|
+
2. Never run a command that waits on a prompt or never exits. See
|
|
15
|
+
[Commands that block](#commands-that-block).
|
|
16
|
+
3. Reads are safe to run at any time. Ask the user before anything under
|
|
17
|
+
[Change a machine](#change-a-machine): it installs, removes or restarts
|
|
18
|
+
software on a real box that may be serving traffic.
|
|
19
|
+
4. Report what you verified. Don't mark a step done that you could not confirm.
|
|
20
|
+
|
|
21
|
+
## Set up
|
|
22
|
+
|
|
23
|
+
Every command here is safe to re-run.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pnpm add -g @b3labs/b3iq-cli # Node 22.23.4+ (22.x) or 24.22.1+ (24.x)
|
|
27
|
+
b3iq --version
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
> **User step.** Ask the user to create an API key in the dashboard under
|
|
31
|
+
> **Keys → API keys** with **Machines & SSH** access, and put it in your
|
|
32
|
+
> environment as `B3IQ_TOKEN`. Don't run `b3iq login` yourself: it opens a
|
|
33
|
+
> browser and waits.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
export B3IQ_TOKEN=...
|
|
37
|
+
b3iq doctor --json # {"checks":[{"name","ok","detail"}]}
|
|
38
|
+
b3iq machines list --json # an array; [] is a pass on an account with no machines
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`doctor` checks `config`, `auth`, `cloudflared` and `api`, and exits `2` when any
|
|
42
|
+
check fails. A failed `cloudflared` check only matters for `b3iq ssh`.
|
|
43
|
+
|
|
44
|
+
Three token facts that cost time:
|
|
45
|
+
|
|
46
|
+
- An API key with only inference access is for `inference` and `mcp media` requests.
|
|
47
|
+
Machine-management commands need a Machines & SSH key or the key `b3iq login`
|
|
48
|
+
saves. A CLI token (`b3iq_pat_`) was retired: it gets a `401` with
|
|
49
|
+
`diagnostic` `token_retired`.
|
|
50
|
+
- A personal key sees the user's own account. Setting `B3IQ_ORG_ID`
|
|
51
|
+
with one is refused (exit `3`, `diagnostic` `org_scope_unsupported`). Unset it.
|
|
52
|
+
That does not grant organization machines. If another account manages the
|
|
53
|
+
machine, B3IQ support (hello@b3iq.org) can grant this account owner access. A
|
|
54
|
+
missing match is not itself proof that grant is the problem.
|
|
55
|
+
- An organization's machines need an organization login. **User step:** ask the user to
|
|
56
|
+
run `b3iq login` in their own terminal (it opens a browser and waits) and pick
|
|
57
|
+
the organization on the approval page, or to give you the token it saved. That
|
|
58
|
+
token is an API key (`b3iq_key_`) bound to the org. `b3iq whoami --json` then shows
|
|
59
|
+
`organization`. The key reaches only its organization, carries the user's
|
|
60
|
+
org role for machines and nothing else, and expires after 90 days or when the
|
|
61
|
+
user leaves the org (then a `401`). `models list` without `--machine` and `logs`
|
|
62
|
+
need a personal login; `status` then shows the machines alone.
|
|
63
|
+
|
|
64
|
+
Report the result in this shape, one line per check, `✓` verified, `⚠` needs the
|
|
65
|
+
user, `✗` failed. Follow it with the next action for every line that is not `✓`.
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
B3IQ agent setup
|
|
69
|
+
✓ cli b3iq 0.1.0
|
|
70
|
+
✓ auth reachable as user@example.com
|
|
71
|
+
⚠ cloudflared not installed, needed for b3iq ssh
|
|
72
|
+
✓ machines 2 found
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Contract
|
|
76
|
+
|
|
77
|
+
Native coding clients use `b3iq inference codex|claude|opencode --model <exact-served-id>`
|
|
78
|
+
from the user's chosen project directory. Read the native-client section in
|
|
79
|
+
[README.md](./README.md) before setup. Inference uses `B3IQ_GATEWAY_API_KEY` or
|
|
80
|
+
the private saved API key, not `B3IQ_TOKEN`. Never invoke
|
|
81
|
+
`b3iq inference credential` in an agent-captured command: it deliberately writes the
|
|
82
|
+
secret to a native client's private pipe.
|
|
83
|
+
|
|
84
|
+
- **stdout is data, stderr is logs.** Parse stdout. Progress lines and hints never
|
|
85
|
+
touch it.
|
|
86
|
+
- **JSON is automatic when piped.** If stdout is not a TTY, every command emits
|
|
87
|
+
JSON. `--json` forces it, `--pretty` forces the table, and the two together
|
|
88
|
+
exit `1`.
|
|
89
|
+
- **`--quiet` prints only ids**, one per line.
|
|
90
|
+
- **Exit codes are stable:** `0` ok · `1` usage · `2` api · `3` auth ·
|
|
91
|
+
`4` rate-limited. Branch on these, not on message text.
|
|
92
|
+
- **Errors are JSON too.** In JSON mode a failure writes one line to stderr:
|
|
93
|
+
`{"error","code","request_id","diagnostic","cause","observed","recovery","limitation","command_id"}`.
|
|
94
|
+
`error`, `code`, and `request_id` are the old keys. Branch on `code` and the
|
|
95
|
+
exit code, not on message text. `cause` is only what that command checked.
|
|
96
|
+
`recovery` is copyable next steps. Give `request_id` or `command_id` to the
|
|
97
|
+
user when they contact support. Do not treat a missing machine as proof the
|
|
98
|
+
id does not exist: `diagnostic` `machine_not_visible` means it was not in this
|
|
99
|
+
account's list. Do not set `B3IQ_ORG_ID` to widen that list. A personal key
|
|
100
|
+
cannot take organization scope; an org login's API key (an organization picked
|
|
101
|
+
at `b3iq login`) lists only its organization's machines.
|
|
102
|
+
- **Rate limits retry once.** A `429` is retried after 1 s, then exits `4`.
|
|
103
|
+
- **Env beats the config file.** `B3IQ_TOKEN`, `B3IQ_API_URL` and `B3IQ_ORG_ID`
|
|
104
|
+
override `~/.b3iq/config.json`. The saved org goes with the saved token only: with
|
|
105
|
+
`B3IQ_TOKEN` set, no saved `org_id` is sent. `B3IQ_CONFIG_DIR` replaces `~/.b3iq`; anything the
|
|
106
|
+
CLI saves goes through `configDir()`, never `homedir()` directly.
|
|
107
|
+
- **The login link follows the control plane.** The approval link opens the
|
|
108
|
+
dashboard that belongs to `B3IQ_API_URL`, or `B3IQ_DASHBOARD_URL` when set.
|
|
109
|
+
|
|
110
|
+
## Read a machine
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
b3iq status --json | jq '{machines_total, machines_online, models_servable}'
|
|
114
|
+
b3iq machines list --quiet # node ids, one per line
|
|
115
|
+
b3iq machines list --json | jq -r '.[] | select(.serving == "not_serving") | .node_id'
|
|
116
|
+
b3iq machines get my-box --json | jq '{id: .node.node_id, liveness, state, serving,
|
|
117
|
+
reasons: .health.qualification.reasons, plugins, blockers: .routing.blockers}'
|
|
118
|
+
b3iq plugins list --machine my-box --json # [] on a machine with monitoring only
|
|
119
|
+
b3iq commands list --machine my-box --json # what was asked of it, newest first
|
|
120
|
+
b3iq machines guests my-box --json | jq '.guests[] | {guest_id, kind, state}'
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`machines guests` reads a KVM host, where each rental runs in its own virtual
|
|
124
|
+
machine (a guest) holding every GPU. Its owner sees every card and the guests
|
|
125
|
+
on it now (`access: machine`); the renter sees their own guest and the way in
|
|
126
|
+
(`access: guest`, with `ssh_user` and `ssh_hostname`). Any other machine
|
|
127
|
+
answers `host_role: host` and no guests.
|
|
128
|
+
|
|
129
|
+
`machines get --json` nests the node record: the id is `.node.node_id`, not
|
|
130
|
+
`.node_id`. The list rows carry `node_id` at the top level.
|
|
131
|
+
|
|
132
|
+
| Field | Values | Meaning |
|
|
133
|
+
|---|---|---|
|
|
134
|
+
| `liveness` | `online` `degraded` `offline` | whether the machine is reporting |
|
|
135
|
+
| `state` | `NEW` `QUALIFYING` `HEALTHY` `SUSPECT` `FAIL` or `null` | the machine's own hardware verdict |
|
|
136
|
+
| `serving` | `serving` `serving_with_warnings` `not_serving` `no_verdict` | whether that verdict lets it take traffic |
|
|
137
|
+
| `health.qualification.reasons` | strings, for example `xid_critical`, `floor_uplink` | why the state is not `HEALTHY` |
|
|
138
|
+
| `provisioning` | `{failed, stage, reason, at}` | first-boot outcome; `stage` is `done` once provisioned |
|
|
139
|
+
| `plugins` | `[{name, version, state, reason?}]` | `[]` on a machine with monitoring only |
|
|
140
|
+
| `rental` | `{active}` or `null` | non-null while a rental holds the machine |
|
|
141
|
+
| `ssh_lane` | `{enabled, hostname}` | detail only; `b3iq ssh` needs `enabled: true` |
|
|
142
|
+
| `ssh_direct` | `{addresses, port}`, `null` or absent | detail only, not served yet; where the box's own sshd takes connections. `b3iq ssh` uses it only with the `cli_direct_ssh` feature |
|
|
143
|
+
|
|
144
|
+
Check `serving` before you trust a benchmark or a training run on a machine.
|
|
145
|
+
`serving_with_warnings` means a slow uplink, a slow disk or a hot card: the
|
|
146
|
+
machine works, and `reasons` names what to look at. `not_serving` means a fault
|
|
147
|
+
such as an ECC error, a critical Xid or a missing card.
|
|
148
|
+
|
|
149
|
+
A machine boots with monitoring only. Models and runtimes belong to the
|
|
150
|
+
`inference` plugin, so until it is installed `models list --machine` and
|
|
151
|
+
`runtimes list` return `[]`. A plugin's `state` is one of `installing`,
|
|
152
|
+
`starting`, `ready`, `paused`, `degraded`, `down` or `failed`.
|
|
153
|
+
|
|
154
|
+
## Run a command on the box
|
|
155
|
+
|
|
156
|
+
An agent's stdout is never a TTY, so `b3iq ssh` **prints** the `ssh` invocation
|
|
157
|
+
and runs nothing. Run it yourself:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
b3iq ssh my-box --json -- nvidia-smi > ssh.json
|
|
161
|
+
jq '{transport, hostname, user}' ssh.json
|
|
162
|
+
log=$(mktemp)
|
|
163
|
+
eval "ssh -E $log -o LogLevel=DEBUG1 -o ControlPath=none -o BatchMode=yes $(jq -r '.ssh_args | @sh' ssh.json)"
|
|
164
|
+
rc=$?
|
|
165
|
+
grep -Ev '^(debug|Authenticated to|Transferred|Bytes per second)' "$log" >&2
|
|
166
|
+
if [ "$rc" = 255 ] && ! grep -q '^Authenticated to' "$log" && jq -e .fallback ssh.json >/dev/null; then
|
|
167
|
+
eval "ssh -o BatchMode=yes $(jq -r '.fallback.ssh_args | @sh' ssh.json)"
|
|
168
|
+
rc=$?
|
|
169
|
+
fi
|
|
170
|
+
rm -f "$log"
|
|
171
|
+
(exit "$rc")
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
The block exits with the remote command's code, or `255` when `ssh` itself failed;
|
|
175
|
+
`ssh`'s own messages (`Permission denied`, `Host key verification failed.`) go
|
|
176
|
+
to stderr. A `255` also comes from a remote command that exits `255`, or a link
|
|
177
|
+
that drops after the command started. The log tells them apart: run `fallback`
|
|
178
|
+
only when the first run never logged in, or the command runs twice.
|
|
179
|
+
`ControlPath=none` keeps a `ControlMaster` in your SSH config from turning the
|
|
180
|
+
first run into a mux client, which never logs `Authenticated to`.
|
|
181
|
+
|
|
182
|
+
`BatchMode=yes` makes `ssh` fail instead of asking for a password. Everything
|
|
183
|
+
after `--` is the remote command and is already inside `ssh_args`. Always name
|
|
184
|
+
the machine: with no machine and no default, a piped `b3iq ssh` exits `1`
|
|
185
|
+
instead of asking.
|
|
186
|
+
|
|
187
|
+
`b3iq ssh` exits `1` with the reason when the machine is not ready for it:
|
|
188
|
+
|
|
189
|
+
> **User step.** The SSH lane is off until the user enables it on the machine's
|
|
190
|
+
> dashboard page, and their public key has to be listed under
|
|
191
|
+
> **Keys → SSH keys**.
|
|
192
|
+
|
|
193
|
+
`transport` is `cloudflared` or `bastion`, or `direct` when the account has
|
|
194
|
+
the `cli_direct_ssh` feature. `cloudflared` needs `cloudflared` on your side
|
|
195
|
+
(`b3iq doctor` checks it); `bastion` is plain `ssh` with a jump host. `direct`
|
|
196
|
+
is plain `ssh` to an address the machine reported, chosen only when its sshd
|
|
197
|
+
answered a probe just now; `fallback` then holds the tunnel invocation to run
|
|
198
|
+
only when the first run exits `255` before it logged in, and is `null`
|
|
199
|
+
otherwise. `--tunnel` skips the direct path. `--direct` uses nothing else and
|
|
200
|
+
exits `1` (`diagnostic` `ssh_direct_not_enabled`, `ssh_direct_unavailable`,
|
|
201
|
+
`ssh_direct_unreachable` or `ssh_direct_not_for_guests`) when it can't.
|
|
202
|
+
Connect once without `--direct` first: the direct path only accepts a host key
|
|
203
|
+
the tunnel already saved.
|
|
204
|
+
`cli_direct_ssh` is not available to a `b3iq login` yet: every login saves an
|
|
205
|
+
API key, and `/v1/public/features` answers an API key as signed out, so a
|
|
206
|
+
per-account grant does not reach the CLI.
|
|
207
|
+
`user` is the account `ssh_args` logs in as: `b3iq` on a machine you hold. On a
|
|
208
|
+
KVM host you rent, `b3iq ssh` opens your guest instead: `user` is the guest's
|
|
209
|
+
(`renter`), the JSON adds `guest_id`, and it exits `1` while the guest is not
|
|
210
|
+
ready yet.
|
|
211
|
+
|
|
212
|
+
### On the box, `b3iq` is a different program
|
|
213
|
+
|
|
214
|
+
The box has its own CLI, `b3iq-host`, also installed there under the name `b3iq`.
|
|
215
|
+
It manages that one machine and knows nothing about your token. Call it
|
|
216
|
+
`b3iq-host` in remote commands so the two never get mixed up.
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
b3iq-host status --json # identity, enrollment, paths
|
|
220
|
+
b3iq-host doctor --json # local service and each plugin's state
|
|
221
|
+
sudo b3iq-host plugin list # installed plugins, version, state
|
|
222
|
+
nvidia-smi --query-gpu=index,name,temperature.gpu,power.draw --format=csv
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Those four read. To change a plugin, use `b3iq plugins` from your side (next
|
|
226
|
+
section) so the change is queued, tracked and visible in the dashboard.
|
|
227
|
+
|
|
228
|
+
## Change a machine
|
|
229
|
+
|
|
230
|
+
Ask the user before any of these.
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
b3iq plugins list --json # what a machine can install
|
|
234
|
+
b3iq plugins install inference --machine my-box # adds the inference API, no engine or model
|
|
235
|
+
b3iq plugins remove inference --machine my-box # removes it with its engines and models
|
|
236
|
+
|
|
237
|
+
b3iq models list --machine my-box --json # each profile's status
|
|
238
|
+
b3iq models install <model> --machine my-box
|
|
239
|
+
b3iq models context <model> --machine my-box # allocate/verify coding context; changes runtime memory
|
|
240
|
+
b3iq models remove <model> --machine my-box
|
|
241
|
+
b3iq runtimes restart <runtime> --machine my-box
|
|
242
|
+
|
|
243
|
+
b3iq machines qualify my-box # re-run the hardware qualification
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
`models install` takes a model whose status is `ready_to_install`, `models
|
|
247
|
+
remove` one that is `installed`. Any other status exits `1` and names the status
|
|
248
|
+
it found.
|
|
249
|
+
|
|
250
|
+
A plugin change is refused (exit `2`) when the caller does not control the
|
|
251
|
+
machine. In `earn` mode nobody does, and during a rental the renter does.
|
|
252
|
+
|
|
253
|
+
`machines qualify` reports that the run finished, not what it found. Read the
|
|
254
|
+
verdict afterwards from `state`, `serving` and the reasons on `machines get`.
|
|
255
|
+
|
|
256
|
+
## Commands that block
|
|
257
|
+
|
|
258
|
+
| Command | What it does | Use instead |
|
|
259
|
+
|---|---|---|
|
|
260
|
+
| `b3iq login` with no token | waits for a browser approval on a TTY, exits `1` without one | `B3IQ_TOKEN` |
|
|
261
|
+
| `b3iq logs --follow` | never exits | `b3iq logs --limit 200 --json` |
|
|
262
|
+
| `b3iq ssh <machine>` on a TTY with no command | opens an interactive shell | the recipe above |
|
|
263
|
+
| `b3iq models install` | waits up to 45 minutes | `--no-wait` |
|
|
264
|
+
| `b3iq plugins install` | waits up to 25 minutes | `--no-wait` |
|
|
265
|
+
| `b3iq plugins remove`, `b3iq machines qualify` | wait up to 10 minutes | `--no-wait` |
|
|
266
|
+
| `b3iq models remove`, `b3iq runtimes restart` | wait up to 5 minutes | `--no-wait` |
|
|
267
|
+
| `b3iq models context` | waits up to 6 minutes for allocation and verification | `--no-wait` |
|
|
268
|
+
|
|
269
|
+
`--no-wait` returns `{"command_id","type","status":"queued"}` at once. Read it
|
|
270
|
+
back until `status` is `completed`, `failed` or `cancelled`:
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
b3iq commands get <command-id> --machine my-box --json | jq '{status, error, progress}'
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Machine selectors
|
|
277
|
+
|
|
278
|
+
Any `<machine>` accepts a node id, an id prefix, or a case-insensitive substring
|
|
279
|
+
of the machine's name. An exact id or name wins. A selector that matches more
|
|
280
|
+
than one machine exits `1` and lists the candidates. `b3iq config
|
|
281
|
+
default-machine <id>` sets the machine used when the argument is left out. A KVM
|
|
282
|
+
host you rent is not in `machines list`; `ssh` and `machines guests` look in
|
|
283
|
+
your rentals when no machine you hold matches.
|
|
284
|
+
|
|
285
|
+
## Native inference and media
|
|
286
|
+
|
|
287
|
+
Inference uses a dashboard API key supplied as `B3IQ_GATEWAY_API_KEY` (or saved
|
|
288
|
+
privately with `b3iq inference key-save`), separate from the machine-management
|
|
289
|
+
token. `b3iq inference models` discovers the exact served ids available to that
|
|
290
|
+
key; use one of those, never a guess. `b3iq inference codex|claude|opencode
|
|
291
|
+
--model <id>` launches the terminal client from the user's project directory, and
|
|
292
|
+
`inference setup <client> --model <id>` only writes private configuration and
|
|
293
|
+
reports the paths. Never invoke `b3iq inference credential` in a captured
|
|
294
|
+
command: it deliberately writes the secret to a native client's private pipe.
|
|
295
|
+
|
|
296
|
+
Desktop setups are experimental and opt-in. `setup codex --desktop --install`
|
|
297
|
+
saves a separate macOS Codex instance with its own settings and history;
|
|
298
|
+
`setup claude --desktop --install` saves an inactive Claude desktop connection;
|
|
299
|
+
`setup opencode --desktop --install` merges persistent OpenCode settings with a
|
|
300
|
+
backup. OpenCode setup targets major version 2 by default; pass `--client-version 1`
|
|
301
|
+
for version 1. Only `--activate` switches a desktop client over, and
|
|
302
|
+
`inference restore claude --desktop` switches it back. Never merge a setup's
|
|
303
|
+
exports into a client's global settings or change the user's normal model or
|
|
304
|
+
provider defaults yourself.
|
|
305
|
+
|
|
306
|
+
Setup needs a served text model with `tool_calling` and a verified context window
|
|
307
|
+
of at least 32K for Codex and OpenCode or 100K for Claude Code. `b3iq models
|
|
308
|
+
context` sets the window; it changes runtime memory on the machine, so it belongs
|
|
309
|
+
under [Change a machine](#change-a-machine) and needs the user's go-ahead.
|
|
310
|
+
|
|
311
|
+
`b3iq mcp media` exposes model discovery, image and video generation and video
|
|
312
|
+
status over stdio. It uses the same API key and requires a served model of the
|
|
313
|
+
requested modality. The API key does not authenticate GitHub or authorize local
|
|
314
|
+
coding tools; those use the native client's own settings and permissions.
|
|
315
|
+
|
|
316
|
+
## Not covered here
|
|
317
|
+
|
|
318
|
+
- **A burn test.** `machines qualify` re-reads the hardware. It does not load
|
|
319
|
+
the GPUs, so it cannot clear a finding from a burn.
|
package/ERROR_PATHS.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# CLI failure map
|
|
2
|
+
|
|
3
|
+
A failure prints what the CLI checked, the values that check actually saw, and a
|
|
4
|
+
next step. In JSON mode it writes one object to stderr with `error`, `code` and
|
|
5
|
+
`request_id`, plus `diagnostic`, `cause`, `observed`, `recovery` and `limitation`
|
|
6
|
+
when a path has them. No color and no `✗` in that object. Exit codes stay `0` ok,
|
|
7
|
+
`1` usage, `2` api, `3` auth, `4` rate-limited.
|
|
8
|
+
|
|
9
|
+
`cause` is only a check this process made. A failed follow-up lookup is noted
|
|
10
|
+
and does not replace the original error. Nothing in these paths changes context,
|
|
11
|
+
permissions or defaults, or restarts a service.
|
|
12
|
+
|
|
13
|
+
| `diagnostic` | What the CLI checked | Next step |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| `context_window_insufficient` | Gateway `context_window_tokens` is an integer below 32768 (Codex, OpenCode) or 100000 (Claude Code). Tool calling and input modalities are reported beside that. | `b3iq models context` only when the personal machine list contains exactly one match. Otherwise `b3iq whoami` and `b3iq machines list`. |
|
|
16
|
+
| `context_metadata_missing` | `context_window_tokens` was absent, null, or not a safe integer. The minimum is not applied. | Same management check as a short window. This is not described as a small window. |
|
|
17
|
+
| `modality_metadata_missing` | `modality` was absent. Window and tool-calling checks are not applied. | `b3iq inference models` |
|
|
18
|
+
| `modality_unsupported` | `modality` was present and not `text`. | `b3iq inference models`. Not `models context`. |
|
|
19
|
+
| `tool_calling_missing` | Window meets the minimum and `tool_calling` was not in `capabilities`. | `b3iq inference models`. Context configuration does not add tool calling. |
|
|
20
|
+
| `model_not_served` | The id was not in the discovery list. Count is the list length. | `b3iq inference models` |
|
|
21
|
+
| `machine_not_visible` | Personal machine list, and for ssh the rental list, had no match. Account email is included when settings answered. | `b3iq whoami`, `b3iq machines list`. Support can grant owner access; the message does not assert that is the cause. |
|
|
22
|
+
| `machine_ambiguous` | More than one personal-list match. | Full node id, or `b3iq machines get` for a short candidate list. |
|
|
23
|
+
| `machine_selector_missing` | No argument and no `default_machine`. | `b3iq machines list`, `b3iq config default-machine` |
|
|
24
|
+
| `model_not_on_machine` | Catalog had profiles and none matched. | `b3iq models list --machine` |
|
|
25
|
+
| `model_ambiguous` | More than one profile on the machine matched the selector with the status the command needs. | Pass the full profile id. |
|
|
26
|
+
| `model_not_ready` | Catalog status was none of the rows below for a command that needs `installed` or `ready_to_install` (for example `installing` or `failed`). | `b3iq models list --machine`, then `b3iq machines get` |
|
|
27
|
+
| `model_catalog_offline` | Catalog was empty and list liveness was `offline`. No command was queued. | `b3iq machines get`, then `b3iq models list` |
|
|
28
|
+
| `model_not_installed` | Status was `ready_to_install` for a command that needs `installed`. | `b3iq models install` |
|
|
29
|
+
| `model_already_installed` | Status was `installed` for install. | `b3iq models list` |
|
|
30
|
+
| `runtime_missing` | Catalog status `runtime_missing`. | `b3iq runtimes list` |
|
|
31
|
+
| `hardware_unsupported` | Catalog status `hardware_unsupported`. | No hardware command exists here. |
|
|
32
|
+
| `modality_unsupported` on a catalog row | Catalog status `modality_unsupported`. Distinct from the gateway modality check above. | `b3iq models list` |
|
|
33
|
+
| `runtime_not_on_machine` | Runtime id was not on the machine. | `b3iq runtimes list` |
|
|
34
|
+
| `ssh_lane_disabled` | `ssh_lane.enabled` or hostname was missing. Hostname value is not printed. | Enable the lane on the machine dashboard page. |
|
|
35
|
+
| `cloudflared_missing` | `cloudflared --version` did not exit 0. | `brew install cloudflared`, `b3iq doctor` |
|
|
36
|
+
| `ssh_missing` | Starting `ssh` failed with ENOENT. | Install an OpenSSH client, `b3iq doctor` |
|
|
37
|
+
| `ssh_direct_not_enabled` | `--direct` was given and `cli_direct_ssh` was not among the account's features, or they could not be read. The feature is not available to a `b3iq login` yet. | `b3iq ssh <machine>`, or `--tunnel` |
|
|
38
|
+
| `ssh_direct_unavailable` | `--direct` was given and machine detail had no `ssh_direct` addresses. | `b3iq ssh <machine>` |
|
|
39
|
+
| `ssh_direct_unreachable` | `--direct` was given and no reported address answered with an SSH banner. | `b3iq ssh <machine>` |
|
|
40
|
+
| `ssh_target_invalid` | A hostname, address, user or port the control plane returned is not plain (ssh would hand it to a shell). Nothing was started. | `b3iq machines get <machine> --json`; report the `request_id` to support. |
|
|
41
|
+
| `ssh_direct_not_for_guests` | `--direct` was given for a rented guest, which is only reachable over its host's tunnel. | `b3iq ssh <machine>` |
|
|
42
|
+
| `auth_missing` | No token in `B3IQ_TOKEN` or `~/.b3iq/config.json`. | `b3iq login` |
|
|
43
|
+
| `auth_rejected` | HTTP 401. Body is redacted. | `b3iq login`. An inference-only API key does not log machine commands in. |
|
|
44
|
+
| `token_retired` | HTTP 401 whose detail says CLI tokens (`b3iq_pat_`) were retired. | `b3iq login` |
|
|
45
|
+
| `login_expired` | HTTP 401 after the saved login's `expires_at`. | `b3iq login` |
|
|
46
|
+
| `org_scope_unsupported` | HTTP 403 whose detail says the personal key is personal-scope. | Unset `B3IQ_ORG_ID` and config `org_id`. Unsetting does not grant organization machines; `b3iq login` with the organization chosen in the browser does. |
|
|
47
|
+
| `org_token_mismatch` | HTTP 403 whose detail says the API key is bound to a different organization. | Unset `B3IQ_ORG_ID`, or `b3iq login` and choose the other org. |
|
|
48
|
+
| `auth_forbidden` | Other HTTP 403. Not relabeled as the personal-scope refusal. | `b3iq whoami` |
|
|
49
|
+
| `network_failed` | `fetch` threw before a status. The transport message is omitted. | `b3iq doctor` |
|
|
50
|
+
| `request_timeout` | `TimeoutError` or `AbortError` before a status. | Retry. This is not a failed remote command. |
|
|
51
|
+
| `rate_limited` | HTTP 429 after the one control-plane retry. | Wait and retry the same command. |
|
|
52
|
+
| `api_rejected` | Other control-plane HTTP error. Structured `detail` only. | Retry. Include `request_id` for support. |
|
|
53
|
+
| `gateway_auth_rejected` | Inference HTTP 401 or 403. Body not printed. | API key, not `B3IQ_TOKEN`. |
|
|
54
|
+
| `gateway_machine_not_found` | Inference HTTP 404 with a machine pin. | `b3iq inference models`, `b3iq machines list`. The status is not treated as proof the id is wrong. |
|
|
55
|
+
| `gateway_rate_limited` | Inference HTTP 429. This call is not retried. | Wait and retry. |
|
|
56
|
+
| `gateway_http_error` | Other inference HTTP status. Body not printed. | `b3iq inference models` |
|
|
57
|
+
| `command_timeout` | Poll ended with no `completed`, `failed`, or `cancelled` status. Last seen status is included when a row was seen. | `b3iq commands get <id> --machine <id>`. Do not submit a duplicate yet. |
|
|
58
|
+
| `command_failed` | Status `failed`, plus the server error text when present. | `b3iq commands get` before another submit. |
|
|
59
|
+
| `command_cancelled` | Status `cancelled`. | `b3iq commands get` |
|
|
60
|
+
|
|
61
|
+
An offline machine that still has an eligible profile is not refused: the CLI
|
|
62
|
+
warns and still submits the command. JSON and human rendering redact
|
|
63
|
+
`b3iq_key_…`, `b3iq_pat_…`, `sk-…` and `Bearer` values.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|