barebox 0.1.0 → 0.3.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 +97 -0
- package/README.md +152 -7
- package/barebox.context.md +144 -0
- package/package.json +40 -3
- package/primitives.json +59 -0
- package/src/certs.js +109 -0
- package/src/cli.js +361 -0
- package/src/holds.js +476 -0
- package/src/index.js +5 -0
- package/src/launcher.js +272 -0
- package/src/overlay-walk.js +49 -0
- package/src/overlay.js +1012 -0
- package/src/proxy.js +572 -0
- package/src/run.js +226 -0
- package/src/runtime.js +263 -0
- package/src/wall.js +156 -0
- package/types/certs.d.ts +26 -0
- package/types/cli.d.ts +2 -0
- package/types/holds.d.ts +248 -0
- package/types/index.d.ts +4 -0
- package/types/launcher.d.ts +53 -0
- package/types/overlay-walk.d.ts +1 -0
- package/types/overlay.d.ts +220 -0
- package/types/proxy.d.ts +204 -0
- package/types/run.d.ts +192 -0
- package/types/runtime.d.ts +112 -0
- package/types/wall.d.ts +30 -0
- package/.claude/remember/AGENT_RULES.md +0 -291
- package/docs/product/agent-sandbox-prd.md +0 -418
- package/docs/product/agent-sandbox.md +0 -218
- package/poc/m0/README.md +0 -20
- package/poc/m0/func-fx.txt +0 -15
- package/poc/m0/func-fy.txt +0 -15
- package/poc/m0/launch.sh +0 -43
- package/poc/m0/measure.js +0 -53
- package/poc/m0/measure.txt +0 -23
- package/poc/m0/proxy.js +0 -74
- package/poc/m0/proxy.log +0 -28
- package/poc/m0/red-mem.txt +0 -4
- package/poc/m0/red-proxy.log +0 -13
- package/poc/m0/redteam.sh +0 -118
- package/poc/m0/run-m0.sh +0 -136
package/src/cli.js
ADDED
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// sbx — second-terminal CLI for the hold queue (M2.5 file channel):
|
|
3
|
+
// sbx pending | approve <id> | deny <id> [reason]
|
|
4
|
+
// Reads `<runtime>/asks/<id>.json`, answers by atomically writing
|
|
5
|
+
// `<runtime>/answers/<id>.json` (tmp file + rename, so the proxy never sees
|
|
6
|
+
// a partial). The runtime comes from SBX_RUNTIME only; there is no
|
|
7
|
+
// cwd-relative default.
|
|
8
|
+
//
|
|
9
|
+
// sbx run [--mode ask|auto|trust] [--json] [--overlay] -- <cmd> [...]
|
|
10
|
+
// Runs one sandboxed agent start-to-finish in this process (project = cwd).
|
|
11
|
+
// The runtime is SBX_RUNTIME when set, else a short temp dir (printed to
|
|
12
|
+
// stderr so a second terminal can approve from it). With --json, stdout
|
|
13
|
+
// carries JSON lines only (`{"ev":"ask",...}` per parked ask,
|
|
14
|
+
// `{"ev":"decided","id","decision","reason"}` when each one ends (answered,
|
|
15
|
+
// timed out, or its client went away), then `{"ev":"done","exit":N}`); the
|
|
16
|
+
// agent's own output goes to stderr there so the stream stays parseable. Without --json the same events print as
|
|
17
|
+
// human-readable lines. The process exit code mirrors the agent's (usage
|
|
18
|
+
// errors stay exit 2). SBX_UNSAFE_TEST_ALLOW_LOOPBACK=1 is a TEST-ONLY opt-in
|
|
19
|
+
// (fixtures live on 127.0.0.1); production never sets it.
|
|
20
|
+
//
|
|
21
|
+
// sbx diff [--agent <name>] | commit [--agent <name>] [--skip-conflicts] | rollback [--agent <name>]
|
|
22
|
+
// Reviews the M4 tracing paper of the last overlay run in SBX_RUNTIME:
|
|
23
|
+
// `diff` lists added/modified/deleted paths (`A`/`M`/`D`, conflicts flagged),
|
|
24
|
+
// `commit` presses the paper down (refusing on conflicts unless
|
|
25
|
+
// --skip-conflicts), `rollback` throws it away. Exit 1 on refusal or when no
|
|
26
|
+
// overlay exists for the agent (default `agent`); SBX_RUNTIME is required.
|
|
27
|
+
import fs from 'node:fs';
|
|
28
|
+
import path from 'node:path';
|
|
29
|
+
import { parseArgs } from 'node:util';
|
|
30
|
+
import { writeFileAtomic } from './holds.js';
|
|
31
|
+
import { run as sandboxRun } from './run.js';
|
|
32
|
+
import { diffOverlay, commitOverlay, rollbackOverlay } from './overlay.js';
|
|
33
|
+
import { assertAgentName, createRuntime, runtimePaths, runtimeLive, safe } from './runtime.js';
|
|
34
|
+
|
|
35
|
+
const USAGE = 'usage: sbx [--help] | pending | approve <id> | deny <id> [reason] | diff [--agent <name>] | commit [--agent <name>] [--skip-conflicts] | rollback [--agent <name>] | run [--mode ask|auto|trust] [--json] [--overlay] -- <cmd> [...]';
|
|
36
|
+
|
|
37
|
+
/** Hold ids the CLI accepts: `h<n>` only. Anything else is a usage error, never a path. */
|
|
38
|
+
const HOLD_ID_RE = /^h\d+$/;
|
|
39
|
+
|
|
40
|
+
// Exit codes: 0 ok, 1 unknown id / refused / run failure, 2 usage.
|
|
41
|
+
// `sbx run` mirrors the agent's exit code instead (usage errors stay 2).
|
|
42
|
+
//
|
|
43
|
+
// Every line `sbx` prints goes through `out` (stdout) or `err` (stderr):
|
|
44
|
+
// both sanitize, so agent-chosen bytes (paths, URLs, reasons) can never
|
|
45
|
+
// smuggle terminal control into the approver's terminal.
|
|
46
|
+
function out(line) {
|
|
47
|
+
console.log(safe(line));
|
|
48
|
+
}
|
|
49
|
+
function err(line) {
|
|
50
|
+
console.error(safe(line));
|
|
51
|
+
}
|
|
52
|
+
/** Usage error on stderr, exit 2. @returns {never} */
|
|
53
|
+
function usage() {
|
|
54
|
+
err(USAGE);
|
|
55
|
+
process.exit(2);
|
|
56
|
+
}
|
|
57
|
+
/** `SBX_RUNTIME` or a usage error. @returns {string} */
|
|
58
|
+
function needRuntime() {
|
|
59
|
+
const runtime = process.env.SBX_RUNTIME;
|
|
60
|
+
if (!runtime) usage();
|
|
61
|
+
return runtime;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @param {string[]} rest argv after the subcommand
|
|
65
|
+
* @param {object} [opts]
|
|
66
|
+
* @param {boolean} [opts.skipConflicts] this command accepts `--skip-conflicts` (commit only)
|
|
67
|
+
* @returns {{ runtime: string, agent: string, skipConflicts: boolean }}
|
|
68
|
+
*/
|
|
69
|
+
function overlayArgs(rest, { skipConflicts = false } = {}) {
|
|
70
|
+
const runtime = needRuntime();
|
|
71
|
+
/** @type {{ agent?: string, 'skip-conflicts'?: boolean }} */
|
|
72
|
+
let flagValues;
|
|
73
|
+
try {
|
|
74
|
+
({ values: flagValues } = parseArgs({
|
|
75
|
+
args: rest,
|
|
76
|
+
options: {
|
|
77
|
+
agent: { type: 'string' },
|
|
78
|
+
'skip-conflicts': { type: 'boolean' },
|
|
79
|
+
},
|
|
80
|
+
strict: true,
|
|
81
|
+
allowPositionals: false,
|
|
82
|
+
}));
|
|
83
|
+
} catch {
|
|
84
|
+
usage();
|
|
85
|
+
}
|
|
86
|
+
const agent = flagValues.agent ?? 'agent';
|
|
87
|
+
const skip = flagValues['skip-conflicts'] ?? false;
|
|
88
|
+
if (skip && !skipConflicts) usage();
|
|
89
|
+
try {
|
|
90
|
+
assertAgentName(agent);
|
|
91
|
+
} catch (e) {
|
|
92
|
+
err(e instanceof Error ? e.message : String(e));
|
|
93
|
+
process.exit(2);
|
|
94
|
+
}
|
|
95
|
+
return { runtime, agent, skipConflicts: skip };
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* @param {string[]} rest argv after the subcommand
|
|
99
|
+
* @returns {{ runtime: string, positionals: string[] }}
|
|
100
|
+
*/
|
|
101
|
+
function decideArgs(rest) {
|
|
102
|
+
const runtime = needRuntime();
|
|
103
|
+
/** @type {string[]} */
|
|
104
|
+
let positionals;
|
|
105
|
+
try {
|
|
106
|
+
({ positionals } = parseArgs({ args: rest, options: {}, strict: true, allowPositionals: true }));
|
|
107
|
+
} catch {
|
|
108
|
+
usage();
|
|
109
|
+
}
|
|
110
|
+
return { runtime, positionals };
|
|
111
|
+
}
|
|
112
|
+
/** Overlay failure on stderr, exit 1 (`process.exit` is already `never`). @param {unknown} e @returns {never} */
|
|
113
|
+
function fail(e) {
|
|
114
|
+
err(e instanceof Error ? e.message : String(e));
|
|
115
|
+
process.exit(1);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Change status to its letter. @param {string} s @returns {string} */
|
|
119
|
+
const letter = (/** @type {string} */ s) => (s === 'added' ? 'A' : s === 'deleted' ? 'D' : 'M');
|
|
120
|
+
|
|
121
|
+
const COMMANDS = { run, diff, commit, rollback, pending, approve, deny };
|
|
122
|
+
const [cmd, ...args] = process.argv.slice(2);
|
|
123
|
+
if (!cmd || cmd === '--help' || cmd === '-h') {
|
|
124
|
+
if (!cmd) usage();
|
|
125
|
+
out(USAGE);
|
|
126
|
+
process.exit(0);
|
|
127
|
+
}
|
|
128
|
+
if (!Object.hasOwn(COMMANDS, /** @type {string} */ (cmd))) usage();
|
|
129
|
+
await COMMANDS[/** @type {keyof typeof COMMANDS} */ (cmd)](args);
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* One sandboxed run in this process. Reports every parked ask from the
|
|
133
|
+
* queue's events (same process, so nothing is polled and no ask is missed),
|
|
134
|
+
* then the agent's exit code.
|
|
135
|
+
*
|
|
136
|
+
* @param {string[]} args argv after `run`
|
|
137
|
+
* @returns {Promise<void>} sets `process.exitCode` (mirrors the agent)
|
|
138
|
+
*/
|
|
139
|
+
async function run(args) {
|
|
140
|
+
const sep = args.indexOf('--');
|
|
141
|
+
if (sep < 0) usage();
|
|
142
|
+
const flags = args.slice(0, sep);
|
|
143
|
+
const command = args.slice(sep + 1);
|
|
144
|
+
/** @type {{ mode?: string, json?: boolean, overlay?: boolean }} */
|
|
145
|
+
let values;
|
|
146
|
+
try {
|
|
147
|
+
({ values } = parseArgs({
|
|
148
|
+
args: flags,
|
|
149
|
+
options: {
|
|
150
|
+
mode: { type: 'string' },
|
|
151
|
+
json: { type: 'boolean' },
|
|
152
|
+
overlay: { type: 'boolean' },
|
|
153
|
+
},
|
|
154
|
+
strict: true,
|
|
155
|
+
allowPositionals: false,
|
|
156
|
+
}));
|
|
157
|
+
} catch {
|
|
158
|
+
usage();
|
|
159
|
+
}
|
|
160
|
+
const mode = values.mode ?? 'auto';
|
|
161
|
+
if (mode !== 'ask' && mode !== 'auto' && mode !== 'trust') usage();
|
|
162
|
+
if (!command.length) usage();
|
|
163
|
+
const json = values.json ?? false;
|
|
164
|
+
const overlay = values.overlay ?? false;
|
|
165
|
+
const runtime = process.env.SBX_RUNTIME || createRuntime();
|
|
166
|
+
// Agent-controlled bytes, sanitized before they reach a terminal or a JSON consumer.
|
|
167
|
+
const clean = (o, keys) => {
|
|
168
|
+
const c = { ...o };
|
|
169
|
+
for (const k of keys) if (c[k] != null) c[k] = safe(c[k]);
|
|
170
|
+
return c;
|
|
171
|
+
};
|
|
172
|
+
const emitAsk = (h) => {
|
|
173
|
+
const c = clean(h, ['id', 'agent', 'method', 'url', 'rule', 'bodyPreview']);
|
|
174
|
+
if (json) out(JSON.stringify({ ev: 'ask', ...c }));
|
|
175
|
+
else out(`ask ${c.id} ${c.agent} ${c.method} ${c.url} rule=${c.rule}`);
|
|
176
|
+
};
|
|
177
|
+
const emitDecided = (e) => {
|
|
178
|
+
const c = clean(e, ['id', 'decision', 'reason']);
|
|
179
|
+
if (json) out(JSON.stringify({ ev: 'decided', id: c.id, decision: c.decision, reason: c.reason }));
|
|
180
|
+
else out(`decided ${c.id} ${c.decision}${c.reason ? ` (${c.reason})` : ''}`);
|
|
181
|
+
};
|
|
182
|
+
err(`runtime ${runtime} (answer with: SBX_RUNTIME=${runtime} sbx approve <id>)`);
|
|
183
|
+
/** @type {{ exit: number, diff: { path: string }[] } | null} */
|
|
184
|
+
let result = null;
|
|
185
|
+
try {
|
|
186
|
+
// SBX_OVERLAY_IGNORE extends the M4 ignore list (Q3) as comma names.
|
|
187
|
+
const extraIgnore = (process.env.SBX_OVERLAY_IGNORE ?? '').split(',')
|
|
188
|
+
.map((s) => s.trim()).filter(Boolean);
|
|
189
|
+
result = await sandboxRun({
|
|
190
|
+
runtime, proj: process.cwd(), command, mode,
|
|
191
|
+
unsafeTestOnly: { allowLoopback: process.env.SBX_UNSAFE_TEST_ALLOW_LOOPBACK === '1' },
|
|
192
|
+
overlay,
|
|
193
|
+
...(extraIgnore.length ? { overlayIgnore: ['node_modules', ...extraIgnore] } : {}),
|
|
194
|
+
onEvent: (e) => { if (e.type === 'ask') emitAsk(e.ask); else emitDecided(e); },
|
|
195
|
+
// With --json stdout is a pure event stream: agent output goes to
|
|
196
|
+
// stderr so a parser never trips over it.
|
|
197
|
+
...(json ? { stdout: process.stderr, stderr: process.stderr } : {}),
|
|
198
|
+
});
|
|
199
|
+
} catch (e) {
|
|
200
|
+
err(`run failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
201
|
+
process.exitCode = 1;
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (json) out(JSON.stringify({ ev: 'done', exit: result.exit }));
|
|
205
|
+
else out(`done exit ${result.exit}`);
|
|
206
|
+
if (overlay) {
|
|
207
|
+
const n = result.diff.length;
|
|
208
|
+
err(n
|
|
209
|
+
? `overlay: ${n} change(s) — review with: SBX_RUNTIME=${runtime} sbx diff`
|
|
210
|
+
: 'overlay: no changes');
|
|
211
|
+
}
|
|
212
|
+
process.exitCode = result.exit;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** @param {string[]} rest @returns {Promise<void>} */
|
|
216
|
+
async function diff(rest) {
|
|
217
|
+
const { runtime, agent } = overlayArgs(rest);
|
|
218
|
+
let changes;
|
|
219
|
+
try {
|
|
220
|
+
changes = diffOverlay({ runtime, agent });
|
|
221
|
+
} catch (e) {
|
|
222
|
+
fail(e);
|
|
223
|
+
}
|
|
224
|
+
if (!changes.length) {
|
|
225
|
+
out('no changes');
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
for (const c of changes) {
|
|
229
|
+
out(`${letter(c.status)} ${c.path}${c.conflict ? ` (CONFLICT: ${c.reason})` : ''}`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** @param {string[]} rest @returns {Promise<void>} */
|
|
234
|
+
async function commit(rest) {
|
|
235
|
+
const { runtime, agent, skipConflicts } = overlayArgs(rest, { skipConflicts: true });
|
|
236
|
+
let res;
|
|
237
|
+
try {
|
|
238
|
+
res = commitOverlay({ runtime, agent, onConflict: skipConflicts ? 'skip' : 'refuse' });
|
|
239
|
+
} catch (e) {
|
|
240
|
+
// Refusal is the product working, not a crash: name every conflict and
|
|
241
|
+
// how to proceed on stderr, and exit 1 (never 0 — nothing was committed).
|
|
242
|
+
if (e instanceof Error && /** @type {{code?: string}} */ (e).code === 'SBX_CONFLICT') {
|
|
243
|
+
for (const c of /** @type {{conflicts: {path: string, reason: string}[]}} */ (/** @type {unknown} */ (e)).conflicts) {
|
|
244
|
+
err(`conflict: ${c.path} (${c.reason})`);
|
|
245
|
+
}
|
|
246
|
+
err('commit refused: resolve the conflicts, or re-run with --skip-conflicts to commit the rest');
|
|
247
|
+
process.exit(1);
|
|
248
|
+
}
|
|
249
|
+
fail(e);
|
|
250
|
+
}
|
|
251
|
+
for (const p of res.committed) out(`committed ${p}`);
|
|
252
|
+
for (const s of res.skipped) out(`skipped (conflict): ${s.path} (${s.reason})`);
|
|
253
|
+
if (!res.committed.length && !res.skipped.length) out('nothing to commit');
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** @param {string[]} rest @returns {Promise<void>} */
|
|
257
|
+
async function rollback(rest) {
|
|
258
|
+
const { runtime, agent } = overlayArgs(rest);
|
|
259
|
+
let res;
|
|
260
|
+
try {
|
|
261
|
+
res = rollbackOverlay({ runtime, agent });
|
|
262
|
+
} catch (e) {
|
|
263
|
+
fail(e);
|
|
264
|
+
}
|
|
265
|
+
if (!res.exact) {
|
|
266
|
+
if (res.discarded.length) {
|
|
267
|
+
out(`discarded ${res.discarded.length} entries, exact list unavailable: ${res.why}`);
|
|
268
|
+
} else {
|
|
269
|
+
out(`discarded (could not list: ${res.why})`);
|
|
270
|
+
}
|
|
271
|
+
} else if (!res.discarded.length) {
|
|
272
|
+
out('nothing to discard');
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
for (const c of res.discarded) {
|
|
276
|
+
out(c.status === 'unknown' ? `discarded ${c.path}` : `discarded ${letter(c.status)} ${c.path}`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/** @param {string[]} rest @returns {Promise<void>} */
|
|
281
|
+
async function pending(rest) {
|
|
282
|
+
const { runtime } = decideArgs(rest);
|
|
283
|
+
const paths = runtimePaths(runtime);
|
|
284
|
+
let names = [];
|
|
285
|
+
try {
|
|
286
|
+
names = fs.readdirSync(paths.asksDir);
|
|
287
|
+
} catch {}
|
|
288
|
+
const items = [];
|
|
289
|
+
for (const name of names) {
|
|
290
|
+
if (!name.endsWith('.json')) continue;
|
|
291
|
+
try {
|
|
292
|
+
items.push(JSON.parse(fs.readFileSync(path.join(paths.asksDir, name), 'utf8')));
|
|
293
|
+
} catch {
|
|
294
|
+
// Being written; the next run sees it.
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
if (!items.length) {
|
|
298
|
+
out('nothing held');
|
|
299
|
+
process.exit(0);
|
|
300
|
+
}
|
|
301
|
+
if (!(await runtimeLive(runtime))) {
|
|
302
|
+
err(`no live proxy on ${runtime}: ${items.length} stale ask(s) can't be decided (cleared at the next start)`);
|
|
303
|
+
process.exit(1);
|
|
304
|
+
}
|
|
305
|
+
for (const h of items) {
|
|
306
|
+
// Live wait from the ask file's mtime (the payload's waitingSec is 0 at park).
|
|
307
|
+
let waiting = 0;
|
|
308
|
+
try {
|
|
309
|
+
const st = fs.statSync(paths.askFile(h.id));
|
|
310
|
+
waiting = Math.max(0, Math.round((Date.now() - st.mtimeMs) / 1000));
|
|
311
|
+
} catch {}
|
|
312
|
+
// Agent-controlled bytes (URL, rule, body preview): sanitized before
|
|
313
|
+
// they reach the approver's terminal (see `safe`).
|
|
314
|
+
const body = safe(h.bodyPreview).replace(/\s+/g, ' ').slice(0, 200);
|
|
315
|
+
out(`${safe(h.id)} ${safe(h.agent)} ${safe(h.method)} ${safe(h.url)} (${waiting}s) rule=${safe(h.rule)} body=${body}`);
|
|
316
|
+
}
|
|
317
|
+
process.exit(0);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* @param {string[]} rest command args (`<id> [reason]`)
|
|
322
|
+
* @returns {Promise<{ id: string, reason: string, paths: ReturnType<typeof runtimePaths> }>}
|
|
323
|
+
*/
|
|
324
|
+
async function answerTarget(rest) {
|
|
325
|
+
const { runtime, positionals } = decideArgs(rest);
|
|
326
|
+
const [id, ...ids] = positionals;
|
|
327
|
+
// The id goes straight into `asks/<id>.json` and `answers/<id>.json`:
|
|
328
|
+
// anything but `h<n>` is rejected here (exit 2) before any file is
|
|
329
|
+
// touched, so `sbx approve ../asks/h9` cannot write outside `answers/`.
|
|
330
|
+
if (id === undefined) usage();
|
|
331
|
+
if (!HOLD_ID_RE.test(id)) {
|
|
332
|
+
err(`bad hold id ${JSON.stringify(id)} (want h<n>, e.g. h1)`);
|
|
333
|
+
process.exit(2);
|
|
334
|
+
}
|
|
335
|
+
const paths = runtimePaths(runtime);
|
|
336
|
+
try {
|
|
337
|
+
fs.readFileSync(paths.askFile(id), 'utf8');
|
|
338
|
+
} catch {
|
|
339
|
+
err(`unknown ${id}`);
|
|
340
|
+
process.exit(1);
|
|
341
|
+
}
|
|
342
|
+
if (!(await runtimeLive(runtime))) {
|
|
343
|
+
err(`no live proxy on ${runtime}: nothing reads answers`);
|
|
344
|
+
process.exit(1);
|
|
345
|
+
}
|
|
346
|
+
return { id, reason: ids.join(' ') || 'denied by user', paths };
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/** @param {string[]} rest @returns {Promise<void>} */
|
|
350
|
+
async function approve(rest) {
|
|
351
|
+
const { id, paths } = await answerTarget(rest);
|
|
352
|
+
writeFileAtomic(paths.answerFile(id), JSON.stringify({ decision: 'allow' }));
|
|
353
|
+
out(`approved ${id}`);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/** @param {string[]} rest @returns {Promise<void>} */
|
|
357
|
+
async function deny(rest) {
|
|
358
|
+
const { id, reason, paths } = await answerTarget(rest);
|
|
359
|
+
writeFileAtomic(paths.answerFile(id), JSON.stringify({ decision: 'deny', reason }));
|
|
360
|
+
out(`denied ${id}`);
|
|
361
|
+
}
|