barebox 0.13.0 → 0.15.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.
- package/CHANGELOG.md +22 -0
- package/README.md +58 -127
- package/barebox.context.md +32 -4
- package/package.json +1 -1
- package/primitives.json +1 -1
- package/src/cli.js +20 -10
- package/src/config.js +21 -2
- package/src/holds.js +63 -20
- package/src/launcher.js +1 -1
- package/src/lists.js +1 -1
- package/src/policy.js +5 -1
- package/src/prompt.js +39 -2
- package/src/proxy.js +330 -44
- package/src/run.js +10 -4
- package/types/config.d.ts +12 -2
- package/types/holds.d.ts +24 -4
- package/types/lists.d.ts +1 -0
- package/types/policy.d.ts +2 -0
- package/types/prompt.d.ts +19 -1
- package/types/proxy.d.ts +17 -3
- package/types/run.d.ts +21 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
6
6
|
|
|
7
|
+
## [0.15.0] - 2026-12-01
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `hosts` config key (`allow`, `deny`, `unknown`): a `deny` host is refused in every mode before any DNS lookup; an `allow` host never gets the first-contact question; any other host asks once on first contact in `ask` and `auto` (allow for this run, or deny) and passes in `trust`. With no terminal (CI, `--json`, piped) `sbx run` refuses such a host at once with `403 denied: host not in hosts.allow`. Answers last for the run only: nothing is stored, and a typed deny is kept while a hold-timeout deny is not. `sbx run` prints a `hosts:` summary line at the start and, at the end, the hosts you allowed (to paste into `hosts.allow`) and the hosts refused; `--json` gives one `hosts` event. The question shows the host, the method and the URL (userinfo and card numbers masked) cut to 200 characters with the full length. Model endpoint hosts, hosts bound to a secret and `localLlm` hosts are exempt. When a first-contact question ends by the hold timeout, every request waiting on that host is denied at once (`403 denied: hold timeout`) and nothing is remembered, so the next request asks again. `run({ hosts })` and `createProxy({ hosts })` take the same shape; `run()` returns `hosts: { allowed, refused }`.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- `run()` now asks on first contact with a new host by default (`hosts.unknown` ask); `createProxy` still lets every host pass unless you pass `hosts`.
|
|
16
|
+
|
|
17
|
+
### Security
|
|
18
|
+
|
|
19
|
+
- The first request to a host you never chose no longer leaves unasked in `ask` and `auto`, and its name is not resolved before the decision (a tunnel to it opens with no DNS and asks on its first request). Data sent to a host you allowed, and every host in `trust`, is still unchecked.
|
|
20
|
+
- Every refused request's audit `deny` line names its method and URL, refusals before the gate included (a bad target, a host deny, the wall, a hold timeout, a full hold queue). In barebox's own audit lines the URL has userinfo masked whole and card numbers masked to their last 4 digits. bareguard's gate decision lines still keep the URL as sent.
|
|
21
|
+
|
|
22
|
+
## [0.14.0] - 2026-11-30
|
|
23
|
+
|
|
24
|
+
### Security
|
|
25
|
+
|
|
26
|
+
- A call to a built-in model endpoint (Anthropic, OpenAI) is free only with this run's key: a key header holding a bound secret placeholder, or a key a human allowed in this run. Any other key, or none, is a plain `POST` that asks in `ask` and `auto` (the question shows only the key's last 4 characters), passes in `trust` and keeps the card floor. An allow is remembered by SHA-256 in the proxy's memory for this run only; a deny is not remembered, and parallel calls with one unknown key share one ask (at most 16 waiting per agent, then 429; only a person's answer or the hold timeout denies them, a client that goes lets the next one ask). The question says `no key` or `not this run's` when there is no last 4 to show. A floor question says when the body was read but no recipient, amount or currency field was recognised. `localLlm` endpoints stay free. Key bytes are never logged or written to the audit.
|
|
27
|
+
- A request with an `Upgrade` header (WebSocket, h2c) and a `CONNECT` inside a tunnel are refused at once with `403 denied: upgrade` / `403 denied: connect`, in every mode and for every host, and never resolved or dialed. Before, an upgrade was forwarded as a `GET` and an inner `CONNECT` closed the socket with no reason and no log line. WebSocket is not supported.
|
|
28
|
+
|
|
7
29
|
## [0.13.0] - 2026-11-30
|
|
8
30
|
|
|
9
31
|
### Docs
|
package/README.md
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
barebox
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
> A lightweight sandbox
|
|
12
|
-
>
|
|
11
|
+
> A safe, lightweight sandbox for agents that spawns in under a second. Reads pass, file writes can be undone, and anything that can't be undone (pay, send, publish, push) waits for your yes.
|
|
12
|
+
> For solo devs and small teams: up to 40 sandboxes share one proxy, one gate and one audit file.
|
|
13
13
|
|
|
14
14
|
<p align="center">
|
|
15
15
|
<img src="https://img.shields.io/github/package-json/v/hamr0/barebox?label=version&color=2a4f8c" alt="version (auto from package.json)">
|
|
@@ -19,165 +19,96 @@
|
|
|
19
19
|
|
|
20
20
|
<img src="assets/demo.gif" width="800" alt="A scripted agent books a trip inside barebox: the search goes out free, a payment asks and gets the real key only after a yes, an email is allowed, a second payment is denied and never leaves, an unanswered upload is denied after 8 s, then the report of what barebox decided">
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
## What you get
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
- **Spawn in 0.7 s,** about 8 MB per sandbox. No root, no daemon, no image: the agent uses your installed tools.
|
|
25
|
+
- **Three modes, one flag:** `ask`, `auto` (default), `trust`.
|
|
26
|
+
- **Your payment and email domains ask in every mode,** `trust` included. List them once in the config file.
|
|
27
|
+
- **Keys the agent never holds:** it gets a placeholder, and the real key goes in only after the gate allows the request.
|
|
28
|
+
- **Up to 40 sandboxes share one proxy,** in about 95-245 MB for all of them.
|
|
29
|
+
- **One config file** (`~/.config/barebox/config.json`) and **one audit file** (`gate.jsonl`).
|
|
25
30
|
|
|
26
|
-
**
|
|
31
|
+
**[The guide](https://github.com/hamr0/barebox/blob/main/docs/wiki/guide.md)** covers every setting, what is and isn't blocked, how asks work, and all the numbers.
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
git clone https://github.com/hamr0/barebox && cd barebox && npm install
|
|
30
|
-
bash examples/demo-a/run.sh # Demo A scripted: book a trip, all three modes, every cell asserted
|
|
31
|
-
bash examples/demo-a/run.sh --driver muse --live --mode auto # the live run above; needs BASETEN_API_KEY, you answer the holds
|
|
32
|
-
bash examples/demo-b/run.sh # Demo B: a prompt-injected agent tries 3 exfiltrations in every mode
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## How it works
|
|
33
|
+
## Quick start
|
|
36
34
|
|
|
37
35
|
```
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
| locked: ~/.ssh, cloud creds, token files -> empty |
|
|
43
|
-
| network: none of its own; 127.0.0.1:3128 -> its unix socket |
|
|
44
|
-
+-----+-------------------------------------------------------------+
|
|
45
|
-
| one unix socket per agent (the socket is the identity, not a header)
|
|
46
|
-
v
|
|
47
|
-
ONE proxy, HTTP and HTTPS -> ONE gate (bareguard) -> world
|
|
48
|
-
| |
|
|
49
|
-
| '-> gate.jsonl, one audit line per decision
|
|
50
|
-
'-> held request: asks you in the terminal, forwards or 403
|
|
36
|
+
npm install -g barebox
|
|
37
|
+
sbx run -- claude # auto mode: reads and model calls pass, sends ask
|
|
38
|
+
sbx run --mode ask --overlay -- node agent.js
|
|
39
|
+
sbx diff && sbx commit # keep the file changes, or: sbx rollback
|
|
51
40
|
```
|
|
52
41
|
|
|
53
|
-
|
|
54
|
-
- **One proxy for all sandboxes**, plain HTTP and HTTPS. HTTPS is read through a local CA that exists only inside the sandbox, so the gate sees method, URL, headers and body.
|
|
55
|
-
- **One gate decides every request** by its letter and the mode (below). It is a simple policy for spawning sandboxed agents on the fly: one flag, no rule files.
|
|
56
|
-
- **One audit file**, `<runtime>/gate.jsonl`, one JSON line per decision in [bareguard](https://github.com/hamr0/bareguard)'s shape. It is append-only, so `tail -f` it, pipe it to `jq`, or ship it to your log stack.
|
|
57
|
-
|
|
58
|
-
## r, w, x and the three modes
|
|
59
|
-
|
|
60
|
-
Every request gets one letter:
|
|
61
|
-
|
|
62
|
-
| Letter | What | How barebox gets the letter |
|
|
63
|
-
|---|---|---|
|
|
64
|
-
| `r` | reads, changes nothing | `GET`, `HEAD`, and calls to model APIs (Anthropic, OpenAI, a `localLlm`) |
|
|
65
|
-
| `w` | a change that can be set back | only where an [rwxmap](https://github.com/hamr0/rwxmap) label for that API says so |
|
|
66
|
-
| `x` | can't be undone: send, pay, publish, push, delete | every other `POST`, `PUT`, `PATCH`, `DELETE`; any other method is denied |
|
|
67
|
-
|
|
68
|
-
File writes are a separate layer: with `--overlay` every change lands on an undo layer, and at the end you `sbx diff`, `sbx commit` or `sbx rollback`.
|
|
42
|
+
## Modes
|
|
69
43
|
|
|
70
|
-
|
|
44
|
+
| Mode | `r` read<br>GET, HEAD, model calls | `w` reversible<br>where an [rwxmap](https://github.com/hamr0/rwxmap) label says so | `x` can't be undone<br>every other POST, PUT, PATCH, DELETE |
|
|
45
|
+
|---|---|---|---|
|
|
46
|
+
| `ask` | free | asks | asks |
|
|
47
|
+
| `auto` (default) | free | free | asks |
|
|
48
|
+
| `trust` | free | free | free |
|
|
71
49
|
|
|
72
|
-
|
|
73
|
-
|---|---|---|
|
|
74
|
-
| `ask` | `r` | `w`, `x` |
|
|
75
|
-
| `auto` (default) | `r`, `w` | `x` |
|
|
76
|
-
| `trust` | `r`, `w`, `x` | nothing |
|
|
77
|
-
|
|
78
|
-
**The floor asks in every mode, `trust` included:** a card number (Luhn) in a body of 64 KB or less, or a payment path (`/checkout`, `/payment`, `/orders`, `/purchase`).
|
|
79
|
-
|
|
80
|
-
**Your own pay and send domains ask too.** List the payment and email or chat domains you use under `floor` in `~/.config/barebox/config.json`. Any write (a method other than `GET` or `HEAD`) to a listed domain asks in every mode, `trust` included; reads keep their letter and mode. barebox ships **no built-in entries**: it promises only what you list.
|
|
50
|
+
**Asks in every mode, `trust` included:** a card number in the body, a payment path (`/checkout`, `/payment`, `/orders`, `/purchase`), and any write to a domain you listed under `floor`:
|
|
81
51
|
|
|
82
52
|
```json
|
|
83
53
|
{
|
|
84
54
|
"floor": {
|
|
85
|
-
"pay":
|
|
86
|
-
"send": ["api.sendgrid.com", "
|
|
87
|
-
"POST slack.com/api/chat.postMessage",
|
|
88
|
-
"POST gmail.googleapis.com/gmail/v1/users/{userId}/messages/send",
|
|
89
|
-
"POST api.twilio.com/2010-04-01/Accounts/{sid}/Messages.json"]
|
|
55
|
+
"pay": ["api.stripe.com", "*.paypal.com"],
|
|
56
|
+
"send": ["api.sendgrid.com", "POST slack.com/api/chat.postMessage"]
|
|
90
57
|
}
|
|
91
58
|
}
|
|
92
59
|
```
|
|
93
60
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
## What it blocks by default
|
|
97
|
-
|
|
98
|
-
| Blocked | How |
|
|
99
|
-
|---|---|
|
|
100
|
-
| Keys and credentials: `~/.ssh`, `~/.gnupg`, `~/.password-store`, `~/secrets`, keyrings, browser profiles, `~/.aws`, `~/.azure`, `~/.config/gcloud`, `~/.kube`, `~/.docker`, `~/.config/gh`, `~/.config/op`, `~/.netrc`, `~/.npmrc`, `~/.pypirc`, `~/.git-credentials`, `~/.cargo/credentials.toml` | masked inside the sandbox: they read as empty |
|
|
101
|
-
| Your environment | cleared; only a short safe list (`TERM`, `LANG`, `LC_*`, `TZ`, `USER`, `SHELL`, ...) and names you list in `env.pass` get in (names like `*_TOKEN`, `*_KEY` are refused; set a harmless one such as `XKB_KEYMAP` with `env.set`) |
|
|
102
|
-
| Any network but the proxy | the sandbox has no network of its own. `--noproxy`, unset proxy env, a direct IP or a raw socket fail closed; UDP and non-HTTP traffic are denied |
|
|
103
|
-
| Private and local addresses | the proxy checks every resolved IP (IPv6 spellings of IPv4 included) and refuses private ranges and names that don't resolve |
|
|
104
|
-
| Real API keys | the agent holds a per-run placeholder; the proxy swaps in the real key after the gate allows the request, over HTTPS, and only for the key's bound hosts (see below) |
|
|
105
|
-
| Answering its own questions | the ask and answer files live outside the sandbox and are masked from it |
|
|
106
|
-
|
|
107
|
-
## What you see
|
|
108
|
-
|
|
109
|
-
A held request asks in the terminal where you ran `sbx run` (`y` allows, anything else denies):
|
|
61
|
+
Then a payment stops like this, with the recipient, amount and currency pulled from the body:
|
|
110
62
|
|
|
111
63
|
```
|
|
112
|
-
⏸
|
|
113
|
-
Why:
|
|
114
|
-
URL: POST https://
|
|
115
|
-
|
|
64
|
+
⏸ agent wants to SEND data to api.stripe.com
|
|
65
|
+
Why: a payment to a domain you listed (api.stripe.com)
|
|
66
|
+
URL: POST https://api.stripe.com/v1/payment_intents
|
|
67
|
+
To: customer.email=buyer@example.com
|
|
68
|
+
Amount: amount=35000
|
|
69
|
+
Currency: currency=usd
|
|
116
70
|
Allow? [y/N] (hold h1)
|
|
117
|
-
y
|
|
118
|
-
→ sent ✓ allowed
|
|
119
71
|
```
|
|
120
72
|
|
|
121
|
-
|
|
73
|
+
`y` allows it, anything else denies it (403, nothing leaves). An answer counts for that one request; nothing is saved. The exceptions last for the run only: a model key you allow, and a host you allow or deny on first contact. One held request per agent at a time; up to 16 more wait in line, plus up to 16 model calls waiting behind one new-key question; past either, `429`.
|
|
122
74
|
|
|
123
|
-
|
|
75
|
+
## Blocked by default
|
|
124
76
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
model calls 18 free (labelled read-only)
|
|
133
|
-
key swaps 1 (the real test key went into the header only after your yes; the agent only ever had the placeholder)
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
An audit line from `gate.jsonl` (a POST held, then denied on timeout):
|
|
77
|
+
- **Credential files** (`~/.ssh`, `~/.aws`, `~/.kube`, `~/.docker`, `~/.config/gh`, `~/.netrc`, `~/.npmrc`, keyrings, browser profiles, ...) read as empty.
|
|
78
|
+
- **Your environment** is cleared; only names you pass get in, and names like `*_TOKEN` and `*_KEY` are refused.
|
|
79
|
+
- **Any network but the proxy:** a direct IP, a raw socket or `--noproxy` fails. UDP is denied.
|
|
80
|
+
- **Private and local addresses,** checked after DNS on every resolved IP.
|
|
81
|
+
- **Real API keys,** swapped in only after a yes, only over HTTPS, only to the key's own hosts.
|
|
82
|
+
- **The agent answering its own asks,** and reading the config file.
|
|
83
|
+
- **A host you never chose:** the first request to it asks (`ask` and `auto`), before its name is resolved; `hosts.deny` refuses a host in every mode. With no terminal an unknown host is refused at once.
|
|
137
84
|
|
|
138
|
-
|
|
139
|
-
{"ts":"2026-11-03T21:41:04.869Z","seq":8,"aid":"1a541f36","phase":"gate","action":{"type":"net","tool":"http.POST","url":"https://httpbin.org/post","method":"POST","agent":"rdme","rid":"r2"},"decision":"deny","rule":"rwx.ask","reason":"hold timeout"}
|
|
140
|
-
```
|
|
85
|
+
## Not blocked yet
|
|
141
86
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
```json
|
|
145
|
-
{
|
|
146
|
-
"secrets": {
|
|
147
|
-
"STRIPE_API_KEY": { "fromEnv": "REAL_STRIPE_KEY", "hosts": ["api.stripe.com"] }
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
```
|
|
87
|
+
barebox is a guardrail against mistakes and prompt-injected agents, not a VM. Known gaps (details in [the guide](https://github.com/hamr0/barebox/blob/main/docs/wiki/guide.md#what-it-does-not-block)):
|
|
151
88
|
|
|
152
|
-
|
|
89
|
+
- data in a `GET` URL, and data hidden in a hostname, to a host you allowed or in `trust` (DNS resolves before the gate there);
|
|
90
|
+
- bodies over 64 KB are not scanned for card numbers;
|
|
91
|
+
- `~/.claude` stays readable.
|
|
153
92
|
|
|
154
93
|
## Numbers
|
|
155
94
|
|
|
156
|
-
Measured
|
|
157
|
-
|
|
158
|
-
| | barebox | [srt](https://github.com/anthropic-experimental/sandbox-runtime) 0.0.81 |
|
|
159
|
-
|---|---|---|
|
|
160
|
-
| Memory per sandbox | **7.8 MB** mean, 8.0 MB max | ~100 MB (a proxy per sandbox) |
|
|
161
|
-
| Shared proxy, normal use (HTTPS, 10-40 agents) | **95-160 MB** | one per sandbox |
|
|
162
|
-
| Shared proxy, worst case (HTTPS, every agent with a held request, a full line and a full body slot) | **117 / 133-151 / 177-207 / 207-241 MB** at 10 / 20 / 30 / 40 agents | |
|
|
163
|
-
| Total, worst case (proxy + walls) | ~195-200 MB at 10, ~295-310 MB at 20, ~525-560 MB at 40 agents | ~1 GB at 10, ~2 GB at 20 |
|
|
164
|
-
| Start to exit, `sbx run -- true` | **0.70 s** median (0.80 s with `--overlay`; bwrap alone 6 ms) | 1.87-2.05 s |
|
|
165
|
-
| One real agent (Claude Code) | 248 MB inside vs 249 MB bare; barebox adds ~91 MB for the first agent, ~11 MB per further one | not measured |
|
|
166
|
-
| Agents per proxy | **40 max**, enforced (the 41st is refused; run another proxy) | |
|
|
167
|
-
| Demo B, 3 exfiltration attempts | **3 of 3 blocked** in every mode | |
|
|
95
|
+
Measured on Fedora with Node 22 ([all numbers](https://github.com/hamr0/barebox/blob/main/docs/wiki/guide.md#numbers)):
|
|
168
96
|
|
|
169
|
-
|
|
97
|
+
- **0.70 s** start to exit, vs 1.87-2.05 s for [srt](https://github.com/anthropic-experimental/sandbox-runtime);
|
|
98
|
+
- **~8 MB** per sandbox, vs ~100 MB for srt (a proxy each);
|
|
99
|
+
- **95-160 MB** for the shared proxy in normal use at 10-40 agents, and at most 245 MB in the worst case;
|
|
100
|
+
- **40 agents** per proxy, enforced;
|
|
101
|
+
- **3 of 3** exfiltration attempts blocked in every mode (Demo B).
|
|
170
102
|
|
|
171
|
-
##
|
|
103
|
+
## Demos
|
|
172
104
|
|
|
173
|
-
|
|
105
|
+
```
|
|
106
|
+
git clone https://github.com/hamr0/barebox && cd barebox && npm install
|
|
107
|
+
bash examples/demo-a/run.sh # book a trip, all three modes, every cell asserted
|
|
108
|
+
bash examples/demo-b/run.sh # a prompt-injected agent tries 3 exfiltrations in every mode
|
|
109
|
+
```
|
|
174
110
|
|
|
175
|
-
|
|
176
|
-
- The proxy resolves DNS before the gate decides, so data hidden in a hostname can leak.
|
|
177
|
-
- Model API calls pass with any key, an attacker's included.
|
|
178
|
-
- Bodies over 64 KB are not scanned for card numbers. `gzip` and `deflate` bodies are decoded for the scan (up to 64 KB of output); `br`, `zstd` and bodies that fail to decode are scanned as sent, so a card inside their compressed bytes is not found.
|
|
179
|
-
- `~/.claude` stays readable: Claude Code's tokens refresh themselves.
|
|
180
|
-
- Writes over local sockets (a Postgres, a Docker daemon) are not on the undo layer.
|
|
111
|
+
The GIF above is a scripted agent in real barebox, one unedited take. In a live run with a real model (Meta's muse), 31 requests went out: 23 with no question, and 8 stopped for a person (3 allowed, 5 denied). The real payment key reached the server once, after a yes ([video](assets/demo-a.webm)).
|
|
181
112
|
|
|
182
113
|
## Install
|
|
183
114
|
|
package/barebox.context.md
CHANGED
|
@@ -32,6 +32,8 @@ import { join } from "node:path";
|
|
|
32
32
|
// then add the agent to it.
|
|
33
33
|
const runtime = mkdtempSync(join(tmpdir(), "sbx-"));
|
|
34
34
|
const proj = mkdtempSync(join(tmpdir(), "proj-"));
|
|
35
|
+
// No `hosts` here, so every host passes with no first-contact ask. For asks pass `hosts: { unknown: "ask" }`
|
|
36
|
+
// and a `gateFor`; `run()` and `sbx` ask by default.
|
|
35
37
|
const proxy = createProxy({ runtime, port: 0, logFile: join(runtime, "mitm.log") });
|
|
36
38
|
await proxy.ready;
|
|
37
39
|
const child = launch({ runtime, agent: "fx", proj, command: ["bash", "-c", "echo hi"], socket: proxy.addAgent("fx"), caFile: proxy.caFile });
|
|
@@ -48,6 +50,8 @@ import { join } from "node:path";
|
|
|
48
50
|
// The TCP port is opt-in for tests (bound to 127.0.0.1); agents connect
|
|
49
51
|
// over their own unix socket: proxy.addAgent("fx") -> <runtime>/socks/fx.sock
|
|
50
52
|
const runtime = mkdtempSync(join(tmpdir(), "sbx-"));
|
|
53
|
+
// No `hosts` here, so every host passes with no first-contact ask. For asks pass `hosts: { unknown: "ask" }`
|
|
54
|
+
// and a `gateFor`; `run()` and `sbx` ask by default.
|
|
51
55
|
const proxy = createProxy({ runtime, port: 0, logFile: join(runtime, "mitm.log") });
|
|
52
56
|
await proxy.ready;
|
|
53
57
|
await proxy.close();
|
|
@@ -71,7 +75,11 @@ after the run), and every other command takes `--name docs-bot` instead of
|
|
|
71
75
|
|
|
72
76
|
A second terminal can answer at the same time through the file checkpoint
|
|
73
77
|
(`<runtime>/asks` + `<runtime>/answers`); the first answer wins and the
|
|
74
|
-
prompt prints `✓ answered elsewhere (allowed)` or
|
|
78
|
+
prompt prints `✓ answered elsewhere (allowed)` or
|
|
79
|
+
`✗ answered elsewhere (<reason>)` when the proxy decides. A write that fails
|
|
80
|
+
prints `✗ not sent (<code>), try again:` with the same question, and the next
|
|
81
|
+
line typed retries; the hold also stays open for another terminal or its
|
|
82
|
+
deadline:
|
|
75
83
|
|
|
76
84
|
```bash
|
|
77
85
|
npx sbx pending --name docs-bot
|
|
@@ -105,11 +113,12 @@ exact `host:port` pairs, such as a local model server, past the wall.
|
|
|
105
113
|
|
|
106
114
|
```js no-run
|
|
107
115
|
import { run } from "barebox";
|
|
108
|
-
const { exit, asks, audit, diff, runtime } = await run({
|
|
116
|
+
const { exit, asks, audit, diff, runtime, hosts } = await run({
|
|
109
117
|
proj: "/path/to/project",
|
|
110
118
|
command: ["bash", "-c", "echo hi"],
|
|
111
119
|
mode: "auto",
|
|
112
120
|
overlay: true, // writes land on the undo layer; `diff` lists them
|
|
121
|
+
// hosts: { allow: ["registry.npmjs.org"] }, // `hosts` in the result: { allowed, refused }
|
|
113
122
|
onAsk: async (ask) => ({ decision: "deny", reason: "not today" }), // omit for the file checkpoint
|
|
114
123
|
});
|
|
115
124
|
```
|
|
@@ -131,7 +140,7 @@ Its exit code mirrors the agent's.
|
|
|
131
140
|
(positive integer) and `localLlm` (array of `"host:port"`). A flag beats the file, the file beats the default; an
|
|
132
141
|
unknown key, bad value or bad JSON exits 2 naming the file and key. The file
|
|
133
142
|
is hidden inside the sandbox wherever it resolves. The library does not read it.
|
|
134
|
-
Two more keys, `labels` and `tenants`, are described under "Labels and model endpoints". `floor` (`{ pay?: string[], send?: string[] }`) lists your own payment and send domains: an entry is a host, `*.domain` (subdomains only) or `"METHOD host/path"`; any write to a listed host, or the one listed endpoint, asks in every mode, `trust` included, and the question shows the recipient, amount and currency fields found in the body (labelled by path), or says why none was read. Each of the three lists in the effect holds at most 6 fields, and 6 means "more than 5": a list of more than 5 is shown as "more than 5 fields", none listed. Endpoint entries match the request path case-insensitively, with `%XX` of unreserved characters decoded and `;params` dropped; `sbx pending` shows the floor entry and the effect lines. There are no built-in entries; an absent `floor` lists nothing. Two more, `env` and `secrets`, are described under "Keys the agent never holds".
|
|
143
|
+
`hosts` (`{ allow?: string[], deny?: string[], unknown?: "ask"|"deny" }`; entries are a lower-case host or `*.domain`) decides which hosts the agent may reach: a `deny` host is refused in every mode before any DNS lookup, an `allow` host never gets the first-contact question, and any other host asks once on first contact in `ask` and `auto` (allow for this run, or deny; `trust` lets it through). `unknown: "deny"` refuses such hosts at once, which `sbx run` does by default with no terminal. Model endpoints, secret hosts and `localLlm` hosts never ask. In the library, `run({ hosts })` takes the same shape and its result carries `hosts: { allowed, refused }`; `createProxy({ hosts })` also takes `unknown: "allow"`, its default. `sbx run` prints a `hosts:` summary line at the start, and at the end the hosts you allowed as a line to paste into `hosts.allow`. Two more keys, `labels` and `tenants`, are described under "Labels and model endpoints". `floor` (`{ pay?: string[], send?: string[] }`) lists your own payment and send domains: an entry is a host, `*.domain` (subdomains only) or `"METHOD host/path"`; any write to a listed host, or the one listed endpoint, asks in every mode, `trust` included, and the question shows the recipient, amount and currency fields found in the body (labelled by path), or says why none was read. Each of the three lists in the effect holds at most 6 fields, and 6 means "more than 5": a list of more than 5 is shown as "more than 5 fields", none listed. Endpoint entries match the request path case-insensitively, with `%XX` of unreserved characters decoded and `;params` dropped; `sbx pending` shows the floor entry and the effect lines. There are no built-in entries; an absent `floor` lists nothing. Two more, `env` and `secrets`, are described under "Keys the agent never holds".
|
|
135
144
|
|
|
136
145
|
## Modes and the gate
|
|
137
146
|
|
|
@@ -163,7 +172,10 @@ and `sbx approve|deny` work as above, and the ask carries the gate's `rule`
|
|
|
163
172
|
(`rwx.ask`, `flags.cardLike`, `flags.paymentPath`) and `letter`. A request
|
|
164
173
|
with a body of 64 KB or less is read in the agent's working slot before the
|
|
165
174
|
gate decides. Denials read `403 denied: <rule>[: reason]` (a human or timeout
|
|
166
|
-
denial reads `denied: <reason>`).
|
|
175
|
+
denial reads `denied: <reason>`). Two refusals never reach the gate, in every mode and for every host, model hosts
|
|
176
|
+
included: a request with an `Upgrade` header (WebSocket, h2c) is answered `403 denied: upgrade`, and a `CONNECT` inside
|
|
177
|
+
a tunnel `403 denied: connect`. Nothing is resolved, gated or dialed; each leaves one `deny` line in the proxy's own
|
|
178
|
+
log with the agent and target (no headers).
|
|
167
179
|
|
|
168
180
|
`createProxy` takes `gateFor(agent, { humanChannel, tools })`, called once per agent,
|
|
169
181
|
returning a bareguard `Gate` or any object with `async check(action)` that
|
|
@@ -179,6 +191,9 @@ still inside a `check()`.
|
|
|
179
191
|
`localLlm` (config key; `allowLocal` on `run()` and `createProxy()`) is an
|
|
180
192
|
array of `"host:port"` strings. Only those exact pairs pass the wall's
|
|
181
193
|
private/loopback check, never link-local (cloud metadata).
|
|
194
|
+
An entry names no scheme and drops a default port, so `localhost:80` also
|
|
195
|
+
matches an https server on `localhost` (port 443), and `127.0.0.1:443` over
|
|
196
|
+
plain http is not matched (it asks as a plain POST); use a non-default port.
|
|
182
197
|
|
|
183
198
|
## Keys the agent never holds
|
|
184
199
|
|
|
@@ -265,6 +280,11 @@ it between runs (no proxy running) to start a new one.
|
|
|
265
280
|
its outcome share `meta.id`; a request with a body gets one `body` line,
|
|
266
281
|
`meta: { agent, rid, bodyBytes, bodySha256 }`, joined to its gate line by
|
|
267
282
|
`action.rid`.
|
|
283
|
+
- Every refused request has a `deny` line with `meta: { agent, code, note, method, url }`,
|
|
284
|
+
refusals before the gate included (a bad target, a host deny, the wall, a hold
|
|
285
|
+
timeout, a full hold queue). Without a `Host` header, `url` is the raw target.
|
|
286
|
+
- In barebox's own lines, `url` (in `meta` and in `where`) has userinfo masked whole (`http://***@host/...`) and card
|
|
287
|
+
numbers masked to their last 4 digits. bareguard's gate lines keep the URL as sent.
|
|
268
288
|
- Lines for an agent whose gate is not built, and every line when `gateFor` is
|
|
269
289
|
omitted, are written by a runtime-level `sbx` gate (`meta.agent` names the
|
|
270
290
|
agent).
|
|
@@ -311,6 +331,14 @@ those hosts is a normal `POST`. A host written with a trailing dot
|
|
|
311
331
|
`paymentPath` mark still applies): a model call carries the whole conversation,
|
|
312
332
|
and a card number in it must not kill the agent.
|
|
313
333
|
|
|
334
|
+
A call to a built-in model endpoint (Anthropic, OpenAI) is a model call only with this run's key:
|
|
335
|
+
a key header (`x-api-key`, or `Authorization` without `Bearer `) that holds a bound secret placeholder, or a key
|
|
336
|
+
a human already allowed in this run. Any other key, or none, makes it a plain `http.POST` (`x`): it asks in `ask`
|
|
337
|
+
and `auto`, passes in `trust`, and the card floor applies. The ask shows only the key's last 4 characters; an allow
|
|
338
|
+
remembers the key's SHA-256 in the proxy's memory for this run (nothing is stored, a deny is not remembered, and
|
|
339
|
+
parallel calls with one unknown key share one ask: they wait behind it, at most 16 waiting per agent, past that 429 `hold queue full`; only a person's answer or the hold timeout denies them, a client that goes or a full hold line lets the next one ask). With no key the question says `a model call with no key`; with a key under 8 characters it shows no last 4. The audit action carries `modelKey: "other"`, never key bytes.
|
|
340
|
+
`localLlm` endpoints are always model calls, with no key check.
|
|
341
|
+
|
|
314
342
|
Label folders are hidden inside the sandbox like the config file, so the agent
|
|
315
343
|
cannot rewrite a letter. `run()` and `createProxy()` take `labels:
|
|
316
344
|
{ matcher, tools }` (what `loadLabels` returns); omitted means no labels and
|
package/package.json
CHANGED
package/primitives.json
CHANGED
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"category": "run",
|
|
61
61
|
"when": "Reach for this to HARNESS-ONLY run one sandboxed agent start-to-finish in a single call: it starts the proxy, sandboxes the command, answers holds, and returns the exit code with the ask and audit trail (plus the overlay diff once M4 exists).",
|
|
62
62
|
"import": "import { run } from 'barebox'",
|
|
63
|
-
"signature": "run(opts: object) => Promise<{ exit: number, asks: AskRecord[], audit: string, diff: OverlayChange[], runtime: string }>",
|
|
63
|
+
"signature": "run(opts: object) => Promise<{ exit: number, asks: AskRecord[], audit: string, diff: OverlayChange[], runtime: string, hosts: { allowed: string[], refused: string[] } }>",
|
|
64
64
|
"fails": "Rejects on a missing/unreadable `proj`, an empty `command`, a bad `mode`, a misshapen `onAsk`, a `secrets` entry with no value (a `fromEnv` variable missing from this process's environment; the message names the secret, never a value), a proxy that never becomes ready, a `launch` that throws (uncommitted overlay changes, a runtime inside the project — the proxy is closed first), or an overlay diff that cannot be read. The agent's own nonzero exit is returned as `exit`, never thrown.",
|
|
65
65
|
"example": "import { run } from \"barebox\";\nconst { exit, asks, audit } = await run({ proj: \"/tmp/proj\", command: [\"bash\", \"-c\", \"echo hi\"] });"
|
|
66
66
|
}
|
package/src/cli.js
CHANGED
|
@@ -38,8 +38,8 @@ import { resolveConfig } from './config.js';
|
|
|
38
38
|
import { loadLabels } from './labels.js';
|
|
39
39
|
import { MODES } from './policy.js';
|
|
40
40
|
import { run as sandboxRun } from './run.js';
|
|
41
|
-
import { createTerminalPrompt, paint, ANSI, effectLines, floorTail } from './prompt.js';
|
|
42
|
-
import { DEFAULT_POLL_MS } from './holds.js';
|
|
41
|
+
import { createTerminalPrompt, paint, ANSI, effectLines, floorTail, keyTail, askUrl } from './prompt.js';
|
|
42
|
+
import { DEFAULT_POLL_MS, writeTmpFile } from './holds.js';
|
|
43
43
|
import { diffOverlay, commitOverlay, rollbackOverlay } from './overlay.js';
|
|
44
44
|
import { assertAgentName, createRuntime, namedRuntime, hostNode, runtimePaths, runtimeLive, safe, shellQuote } from './runtime.js';
|
|
45
45
|
|
|
@@ -218,7 +218,7 @@ async function run(args) {
|
|
|
218
218
|
usage();
|
|
219
219
|
}
|
|
220
220
|
if (values.mode !== undefined && !MODES.includes(values.mode)) usage();
|
|
221
|
-
/** @type {{ mode: string, holdTimeoutSec?: number|string, localLlm: string[], labels: string[], tenants: Record<string, string[]>, heldBodyMaxMB?: number, floor?: { pay?: string[], send?: string[] }, env?: { pass?: string[], set?: Record<string, string> }, secrets?: Record<string, { fromEnv?: string, value?: string, hosts: string[] }> }} */
|
|
221
|
+
/** @type {{ mode: string, holdTimeoutSec?: number|string, localLlm: string[], labels: string[], tenants: Record<string, string[]>, heldBodyMaxMB?: number, floor?: { pay?: string[], send?: string[] }, hosts?: { allow?: string[], deny?: string[], unknown?: 'ask'|'deny' }, env?: { pass?: string[], set?: Record<string, string> }, secrets?: Record<string, { fromEnv?: string, value?: string, hosts: string[] }> }} */
|
|
222
222
|
let cfg;
|
|
223
223
|
try {
|
|
224
224
|
cfg = resolveConfig({ mode: values.mode, hold: values.hold });
|
|
@@ -271,7 +271,7 @@ async function run(args) {
|
|
|
271
271
|
if (prompt?.ask(h)) { prompted.add(h.id); return; }
|
|
272
272
|
const c = clean(h, ['id', 'agent', 'method', 'url', 'rule', 'bodyPreview']);
|
|
273
273
|
if (json) out(JSON.stringify({ ev: 'ask', ...c }));
|
|
274
|
-
else out(`ask ${c.id} ${c.agent} ${c.method} ${
|
|
274
|
+
else out(`ask ${c.id} ${c.agent} ${c.method} ${askUrl(h)} rule=${c.rule}${floorTail(h)}${keyTail(h)}`);
|
|
275
275
|
};
|
|
276
276
|
const emitDecided = (e) => {
|
|
277
277
|
if (!json && prompted.delete(e.id)) return;
|
|
@@ -286,7 +286,12 @@ async function run(args) {
|
|
|
286
286
|
} else err(name !== undefined
|
|
287
287
|
? `sandbox ${name} (answer from another terminal: sbx approve --name ${name} <id>)`
|
|
288
288
|
: `runtime ${runtime} (answer with: SBX_RUNTIME=${shellQuote(runtime)} sbx approve <id>)`);
|
|
289
|
-
|
|
289
|
+
// M14: hosts on neither list ask when a person is here, else are refused; `trust` lets them through.
|
|
290
|
+
const hostsUnknown = cfg.hosts?.unknown ?? (interactive ? 'ask' : 'deny');
|
|
291
|
+
err(`hosts: ${cfg.hosts?.allow?.length ?? 0} allowed, ${cfg.hosts?.deny?.length ?? 0} denied in config; other hosts ${
|
|
292
|
+
mode === 'trust' ? 'pass (trust)' : hostsUnknown === 'ask' ? 'ask on first contact'
|
|
293
|
+
: cfg.hosts?.unknown ? 'are refused' : 'are refused (no terminal)'}`);
|
|
294
|
+
/** @type {{ exit: number, diff: { path: string }[], hosts: { allowed: string[], refused: string[] } } | null} */
|
|
290
295
|
let result = null;
|
|
291
296
|
try {
|
|
292
297
|
// SBX_OVERLAY_IGNORE extends the M4 ignore list (Q3) as comma names.
|
|
@@ -295,7 +300,7 @@ async function run(args) {
|
|
|
295
300
|
result = await sandboxRun({
|
|
296
301
|
runtime, proj: process.cwd(), command, mode, timeoutMs,
|
|
297
302
|
...(name !== undefined ? { agent: name } : {}),
|
|
298
|
-
allowLocal: cfg.localLlm, floor: cfg.floor, labels, secrets: cfg.secrets, env: cfg.env,
|
|
303
|
+
allowLocal: cfg.localLlm, floor: cfg.floor, hosts: { ...cfg.hosts, unknown: hostsUnknown }, labels, secrets: cfg.secrets, env: cfg.env,
|
|
299
304
|
...(cfg.heldBodyMaxMB ? { heldBodyMaxBytes: cfg.heldBodyMaxMB * 1048576 } : {}),
|
|
300
305
|
unsafeTestOnly: { allowLoopback: process.env.SBX_UNSAFE_TEST_ALLOW_LOOPBACK === '1' },
|
|
301
306
|
overlay,
|
|
@@ -317,6 +322,13 @@ async function run(args) {
|
|
|
317
322
|
prompt?.close();
|
|
318
323
|
if (json) out(JSON.stringify({ ev: 'done', exit: result.exit }));
|
|
319
324
|
else out(`done exit ${result.exit}`);
|
|
325
|
+
const { allowed, refused } = result.hosts;
|
|
326
|
+
if (json) {
|
|
327
|
+
if (allowed.length || refused.length) out(JSON.stringify({ ev: 'hosts', allowed, refused }));
|
|
328
|
+
} else {
|
|
329
|
+
if (allowed.length) out(`hosts allowed this run (add to hosts.allow): ${JSON.stringify(allowed)}`);
|
|
330
|
+
if (refused.length) out(`hosts refused (not in hosts.allow): ${JSON.stringify(refused)}`);
|
|
331
|
+
}
|
|
320
332
|
if (overlay) {
|
|
321
333
|
const n = result.diff.length;
|
|
322
334
|
err(n
|
|
@@ -426,7 +438,7 @@ async function pending(rest) {
|
|
|
426
438
|
// Agent-controlled bytes (URL, rule, body preview): sanitized before
|
|
427
439
|
// they reach the approver's terminal (see `safe`).
|
|
428
440
|
const body = safe(h.bodyPreview).replace(/\s+/g, ' ').slice(0, 200);
|
|
429
|
-
out(`${safe(h.id)} ${safe(h.agent)} ${safe(h.method)} ${
|
|
441
|
+
out(`${safe(h.id)} ${safe(h.agent)} ${safe(h.method)} ${askUrl(h)} (${waiting}s) rule=${safe(h.rule)}${floorTail(h)}${keyTail(h)} body=${body}`);
|
|
430
442
|
for (const line of effectLines(h.effect, false)) out(line);
|
|
431
443
|
}
|
|
432
444
|
process.exit(0);
|
|
@@ -474,9 +486,7 @@ async function answerTarget(rest) {
|
|
|
474
486
|
*/
|
|
475
487
|
function writeAnswer(paths, id, decision, reason) {
|
|
476
488
|
const final = paths.answerFile(id);
|
|
477
|
-
|
|
478
|
-
const tmp = `${final}.tmp-${process.pid}-${Math.random().toString(36).slice(2)}`;
|
|
479
|
-
fs.writeFileSync(tmp, JSON.stringify(decision === 'allow' ? { decision } : { decision, reason }), { mode: 0o600 });
|
|
489
|
+
const tmp = writeTmpFile(final, JSON.stringify(decision === 'allow' ? { decision } : { decision, reason }));
|
|
480
490
|
try {
|
|
481
491
|
fs.linkSync(tmp, final);
|
|
482
492
|
return true;
|
package/src/config.js
CHANGED
|
@@ -7,6 +7,7 @@ import os from 'node:os';
|
|
|
7
7
|
import path from 'node:path';
|
|
8
8
|
import { MODES } from './policy.js';
|
|
9
9
|
import { floorList } from './lists.js';
|
|
10
|
+
import { hostMatcher } from 'bareguard';
|
|
10
11
|
|
|
11
12
|
const DEFAULTS = { mode: 'auto', localLlm: [], labels: [], tenants: {} };
|
|
12
13
|
|
|
@@ -80,6 +81,23 @@ const checkFloor = (/** @type {any} */ v) => {
|
|
|
80
81
|
return null;
|
|
81
82
|
};
|
|
82
83
|
|
|
84
|
+
/** @param {unknown} v @returns {string|null} the error for a `hosts` value, or null */
|
|
85
|
+
const checkHosts = (/** @type {any} */ v) => {
|
|
86
|
+
if (!isObj(v)) return 'must be an object of { allow?, deny?, unknown? }';
|
|
87
|
+
for (const [k, list] of Object.entries(v)) {
|
|
88
|
+
if (k === 'unknown') {
|
|
89
|
+
if (list !== 'ask' && list !== 'deny') return 'hosts.unknown must be "ask" or "deny"';
|
|
90
|
+
} else if (k === 'allow' || k === 'deny') {
|
|
91
|
+
if (!Array.isArray(list)) return `hosts.${k} must be an array`;
|
|
92
|
+
for (const [i, e] of list.entries()) {
|
|
93
|
+
if (typeof e !== 'string') return `hosts.${k}[${i}] must be a string`;
|
|
94
|
+
try { hostMatcher([e]); } catch (err) { return `hosts.${k}[${i}]: ${err instanceof Error ? err.message : String(err)}`; }
|
|
95
|
+
}
|
|
96
|
+
} else return `has unknown field "${k}"`;
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
};
|
|
100
|
+
|
|
83
101
|
/** Validators by key; each returns an error string or null. */
|
|
84
102
|
const KEYS = {
|
|
85
103
|
mode: (v) => (MODES.includes(v) ? null : `must be one of ${MODES.join(', ')}`),
|
|
@@ -94,6 +112,7 @@ const KEYS = {
|
|
|
94
112
|
&& Object.values(v).every((a) => Array.isArray(a) && a.length > 0 && a.every(isHttpUrl))
|
|
95
113
|
? null : 'must be an object of vendor -> non-empty array of http(s) URLs'),
|
|
96
114
|
floor: checkFloor,
|
|
115
|
+
hosts: checkHosts,
|
|
97
116
|
env: checkEnv,
|
|
98
117
|
secrets: checkSecrets,
|
|
99
118
|
};
|
|
@@ -113,7 +132,7 @@ export function configPath(env = process.env) {
|
|
|
113
132
|
* Read the config file over the defaults. No file means defaults.
|
|
114
133
|
*
|
|
115
134
|
* @param {NodeJS.ProcessEnv} [env] environment to read (default `process.env`)
|
|
116
|
-
* @returns {{ mode: string, holdTimeoutSec?: number|string, localLlm: string[], labels: string[], tenants: Record<string, string[]>, heldBodyMaxMB?: number, floor?: { pay?: string[], send?: string[] }, env?: { pass?: string[], set?: Record<string, string> }, secrets?: Record<string, { fromEnv?: string, value?: string, hosts: string[] }> }} effective settings (`heldBodyMaxMB` absent means the library default)
|
|
135
|
+
* @returns {{ mode: string, holdTimeoutSec?: number|string, localLlm: string[], labels: string[], tenants: Record<string, string[]>, heldBodyMaxMB?: number, floor?: { pay?: string[], send?: string[] }, hosts?: { allow?: string[], deny?: string[], unknown?: 'ask'|'deny' }, env?: { pass?: string[], set?: Record<string, string> }, secrets?: Record<string, { fromEnv?: string, value?: string, hosts: string[] }> }} effective settings (`heldBodyMaxMB` absent means the library default)
|
|
117
136
|
* @throws {Error} naming the file (and the key) on invalid JSON, an unknown key or a bad value
|
|
118
137
|
*/
|
|
119
138
|
export function loadConfig(env = process.env) {
|
|
@@ -155,7 +174,7 @@ export function loadConfig(env = process.env) {
|
|
|
155
174
|
* @param {string} [flags.mode] `--mode`
|
|
156
175
|
* @param {string} [flags.hold] `--hold` (`"never"` or a positive integer of seconds, as typed)
|
|
157
176
|
* @param {NodeJS.ProcessEnv} [env] environment to read (default `process.env`)
|
|
158
|
-
* @returns {{ mode: string, holdTimeoutSec?: number|string, localLlm: string[], labels: string[], tenants: Record<string, string[]>, heldBodyMaxMB?: number, floor?: { pay?: string[], send?: string[] }, env?: { pass?: string[], set?: Record<string, string> }, secrets?: Record<string, { fromEnv?: string, value?: string, hosts: string[] }> }} effective settings (`heldBodyMaxMB` absent means the library default)
|
|
177
|
+
* @returns {{ mode: string, holdTimeoutSec?: number|string, localLlm: string[], labels: string[], tenants: Record<string, string[]>, heldBodyMaxMB?: number, floor?: { pay?: string[], send?: string[] }, hosts?: { allow?: string[], deny?: string[], unknown?: 'ask'|'deny' }, env?: { pass?: string[], set?: Record<string, string> }, secrets?: Record<string, { fromEnv?: string, value?: string, hosts: string[] }> }} effective settings (`heldBodyMaxMB` absent means the library default)
|
|
159
178
|
* @throws {Error} as {@link loadConfig}
|
|
160
179
|
*/
|
|
161
180
|
export function resolveConfig(flags = {}, env = process.env) {
|