barebox 0.11.0 → 0.13.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 +33 -0
- package/README.md +28 -24
- package/barebox.context.md +12 -8
- package/package.json +2 -2
- package/src/cli.js +19 -11
- package/src/config.js +19 -3
- package/src/effect.js +139 -0
- package/src/holds.js +8 -3
- package/src/lists.js +78 -1
- package/src/policy.js +1 -1
- package/src/prompt.js +90 -28
- package/src/proxy.js +31 -9
- package/src/run.js +4 -2
- package/types/config.d.ts +12 -4
- package/types/effect.d.ts +31 -0
- package/types/holds.d.ts +13 -0
- package/types/lists.d.ts +20 -0
- package/types/prompt.d.ts +27 -5
- package/types/proxy.d.ts +8 -0
- package/types/run.d.ts +14 -1
package/types/proxy.d.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* @property {(agent: string, ctx: { humanChannel: (event: any) => Promise<{ decision: 'allow' | 'deny', reason?: string }>, tools: Record<string, any> }) => GateLike | Promise<GateLike>} [gateFor] builds the gate that decides one agent's requests (called once per agent, and once for the TCP door's `tcp` agent); `ctx.humanChannel` is the hold queue and `ctx.tools` the runtime's one tools table, both to hand to a bareguard `Gate`. Omit it to forward everything.
|
|
10
10
|
* @property {{ matcher: { match: (method: string, url: string) => { key: string, source: string } }, tools: Record<string, any> }} [labels] the loaded label files (see `loadLabels`); omitted means no labels, only the built-in model endpoints
|
|
11
11
|
* @property {string[]} [allowLocal] exact `host:port` pairs (the `localLlm` setting) that may pass the wall's private/loopback check; any other local destination is still denied
|
|
12
|
+
* @property {{ pay?: string[], send?: string[] }} [floor] the config `floor` key (M11): a write to a listed host or `*.domain`, or a request matching a listed `"METHOD host/path"`, asks in every mode (the gate flag `floor`); the question shows the recipient, amount and currency found in the body. Omitted means no floor lists.
|
|
12
13
|
* @property {HoldOptions} [hold] hold queue config (deadline, caps, ask seam)
|
|
13
14
|
* @property {number} [upstreamTimeoutMs] give up on an upstream response after this (default 120000)
|
|
14
15
|
* @property {object} [unsafeTestOnly] TEST-ONLY escape hatch: everything under
|
|
@@ -129,6 +130,13 @@ export type ProxyOptions = {
|
|
|
129
130
|
* exact `host:port` pairs (the `localLlm` setting) that may pass the wall's private/loopback check; any other local destination is still denied
|
|
130
131
|
*/
|
|
131
132
|
allowLocal?: string[] | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* the config `floor` key (M11): a write to a listed host or `*.domain`, or a request matching a listed `"METHOD host/path"`, asks in every mode (the gate flag `floor`); the question shows the recipient, amount and currency found in the body. Omitted means no floor lists.
|
|
135
|
+
*/
|
|
136
|
+
floor?: {
|
|
137
|
+
pay?: string[];
|
|
138
|
+
send?: string[];
|
|
139
|
+
} | undefined;
|
|
132
140
|
/**
|
|
133
141
|
* hold queue config (deadline, caps, ask seam)
|
|
134
142
|
*/
|
package/types/run.d.ts
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
* @property {number} [heldBodyMaxBytes] cap on a held request's body, in bytes (default 52428800); over it the request is denied
|
|
30
30
|
* @property {{ matcher: any, tools: Record<string, any>, dirs?: string[] }} [labels] the loaded label files (`loadLabels`); their folders are masked from the sandbox
|
|
31
31
|
* @property {string[]} [allowLocal] exact `host:port` pairs (for example a local model server) that may pass the wall's private/loopback check (the `localLlm` setting)
|
|
32
|
+
* @property {{ pay?: string[], send?: string[] }} [floor] the config `floor` key (M11): hosts, `*.domain` or `"METHOD host/path"` entries that ask in every mode, `trust` included (see `createProxy`)
|
|
32
33
|
* @property {object} [unsafeTestOnly] TEST-ONLY escape hatch, forwarded to the proxy (see `createProxy`): everything under it weakens the sandbox wall
|
|
33
34
|
* @property {NodeJS.WritableStream} [stdout] where the agent's stdout goes (default process.stdout)
|
|
34
35
|
* @property {NodeJS.WritableStream} [stderr] where the agent's stderr goes (default process.stderr)
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
* @param {number} [opts.heldBodyMaxBytes] cap on a held request's body, in bytes (default 52428800); over it the request is denied
|
|
53
54
|
* @param {{ matcher: any, tools: Record<string, any>, dirs?: string[] }|null} [opts.labels] the loaded label files (`loadLabels`); their folders are masked from the sandbox
|
|
54
55
|
* @param {string[]} [opts.allowLocal] exact `host:port` pairs (for example a local model server) that may pass the wall's private/loopback check (the `localLlm` setting)
|
|
56
|
+
* @param {{ pay?: string[], send?: string[] }|null} [opts.floor] the config `floor` key (M11): hosts, `*.domain` or `"METHOD host/path"` entries that ask in every mode, `trust` included (see `createProxy`)
|
|
55
57
|
* @param {object|null} [opts.unsafeTestOnly] TEST-ONLY escape hatch, forwarded to the proxy (see `createProxy`)
|
|
56
58
|
* @param {NodeJS.WritableStream|null} [opts.stdout] where the agent's stdout goes (default process.stdout)
|
|
57
59
|
* @param {NodeJS.WritableStream|null} [opts.stderr] where the agent's stderr goes (default process.stderr)
|
|
@@ -66,7 +68,7 @@
|
|
|
66
68
|
* import { run } from "barebox";
|
|
67
69
|
* const { exit, asks, audit } = await run({ proj: "/tmp/proj", command: ["bash", "-c", "echo hi"] });
|
|
68
70
|
*/
|
|
69
|
-
export function run({ proj, command, mode, onAsk, onEvent, runtime, agent, timeoutMs, heldBodyMaxBytes, allowLocal, labels, unsafeTestOnly, stdout, stderr, overlay, overlayIgnore, secrets, env }: {
|
|
71
|
+
export function run({ proj, command, mode, onAsk, onEvent, runtime, agent, timeoutMs, heldBodyMaxBytes, allowLocal, floor, labels, unsafeTestOnly, stdout, stderr, overlay, overlayIgnore, secrets, env }: {
|
|
70
72
|
proj: string;
|
|
71
73
|
command: string[];
|
|
72
74
|
mode?: string | undefined;
|
|
@@ -82,6 +84,10 @@ export function run({ proj, command, mode, onAsk, onEvent, runtime, agent, timeo
|
|
|
82
84
|
dirs?: string[];
|
|
83
85
|
} | null | undefined;
|
|
84
86
|
allowLocal?: string[] | undefined;
|
|
87
|
+
floor?: {
|
|
88
|
+
pay?: string[];
|
|
89
|
+
send?: string[];
|
|
90
|
+
} | null | undefined;
|
|
85
91
|
unsafeTestOnly?: object | null;
|
|
86
92
|
stdout?: NodeJS.WritableStream | null | undefined;
|
|
87
93
|
stderr?: NodeJS.WritableStream | null | undefined;
|
|
@@ -204,6 +210,13 @@ export type RunOptions = {
|
|
|
204
210
|
* exact `host:port` pairs (for example a local model server) that may pass the wall's private/loopback check (the `localLlm` setting)
|
|
205
211
|
*/
|
|
206
212
|
allowLocal?: string[] | undefined;
|
|
213
|
+
/**
|
|
214
|
+
* the config `floor` key (M11): hosts, `*.domain` or `"METHOD host/path"` entries that ask in every mode, `trust` included (see `createProxy`)
|
|
215
|
+
*/
|
|
216
|
+
floor?: {
|
|
217
|
+
pay?: string[];
|
|
218
|
+
send?: string[];
|
|
219
|
+
} | undefined;
|
|
207
220
|
/**
|
|
208
221
|
* TEST-ONLY escape hatch, forwarded to the proxy (see `createProxy`): everything under it weakens the sandbox wall
|
|
209
222
|
*/
|