@xploai/core 1.0.12 → 1.0.13
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/dist/adapters.test.js +53 -4
- package/dist/adapters.test.js.map +1 -1
- package/dist/agent-auth-hint.d.ts +16 -0
- package/dist/agent-auth-hint.js +85 -0
- package/dist/agent-auth-hint.js.map +1 -0
- package/dist/agent-auth-hint.test.d.ts +1 -0
- package/dist/agent-auth-hint.test.js +72 -0
- package/dist/agent-auth-hint.test.js.map +1 -0
- package/dist/audit.d.ts +39 -1
- package/dist/audit.js +160 -14
- package/dist/audit.js.map +1 -1
- package/dist/audit.test.d.ts +1 -0
- package/dist/audit.test.js +90 -0
- package/dist/audit.test.js.map +1 -0
- package/dist/claude-code-adapter.d.ts +3 -0
- package/dist/claude-code-adapter.js +9 -3
- package/dist/claude-code-adapter.js.map +1 -1
- package/dist/claw-adapter.js +1 -1
- package/dist/claw-adapter.js.map +1 -1
- package/dist/codex-adapter.d.ts +10 -0
- package/dist/codex-adapter.js +80 -13
- package/dist/codex-adapter.js.map +1 -1
- package/dist/grokbot-adapter.d.ts +3 -0
- package/dist/grokbot-adapter.js +9 -3
- package/dist/grokbot-adapter.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/onchainos-guard-bin.d.ts +2 -0
- package/dist/onchainos-guard-bin.js +55 -0
- package/dist/onchainos-guard-bin.js.map +1 -0
- package/dist/write-guard.d.ts +82 -0
- package/dist/write-guard.js +371 -0
- package/dist/write-guard.js.map +1 -0
- package/dist/write-guard.test.d.ts +1 -0
- package/dist/write-guard.test.js +267 -0
- package/dist/write-guard.test.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { chmodSync, closeSync, existsSync, fstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { homedir, tmpdir } from "node:os";
|
|
3
|
+
import { delimiter, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { findOnchainosBinaries } from "./onchainos-path.js";
|
|
6
|
+
/**
|
|
7
|
+
* Daemon-side approval gate for AI agent runs.
|
|
8
|
+
*
|
|
9
|
+
* An agent task drives the real `onchainos` CLI through its own shell, so a prompt
|
|
10
|
+
* can only ask the model to confirm before it moves funds, and nothing makes it. The
|
|
11
|
+
* guard puts a shim named `onchainos` first on the agent's PATH. The shim lets reads
|
|
12
|
+
* through, and refuses any command that moves funds or signs unless the exact argv
|
|
13
|
+
* was approved by the user for this task. Refused commands are recorded and returned
|
|
14
|
+
* as an `approval_required` artifact so the dashboard can ask the user.
|
|
15
|
+
*
|
|
16
|
+
* Direct `cli` tasks (the dashboard's own forms, which show their own confirm step)
|
|
17
|
+
* do not go through the guard.
|
|
18
|
+
*/
|
|
19
|
+
/** Subcommands that spend funds, sign, or change wallet/order state, per command group. */
|
|
20
|
+
const WRITE_SUBCOMMANDS = {
|
|
21
|
+
swap: ["execute"],
|
|
22
|
+
"cross-chain": ["execute"],
|
|
23
|
+
gateway: ["broadcast"],
|
|
24
|
+
wallet: [
|
|
25
|
+
"send",
|
|
26
|
+
"contract-call",
|
|
27
|
+
"sign-message",
|
|
28
|
+
"logout",
|
|
29
|
+
"create", // `wallet inscription create`
|
|
30
|
+
"update-default-token", // `wallet gas-station ...`
|
|
31
|
+
"enable",
|
|
32
|
+
"disable",
|
|
33
|
+
"setup",
|
|
34
|
+
"unlock", // `wallet utxo ...`
|
|
35
|
+
"lock",
|
|
36
|
+
"reclaim",
|
|
37
|
+
],
|
|
38
|
+
strategy: ["create-limit", "cancel", "resume"],
|
|
39
|
+
payment: ["pay", "pay-local", "charge", "session", "subscription", "create"],
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Groups where almost everything signs, pays or broadcasts (the OKX.AI marketplace: create-task,
|
|
43
|
+
* confirm-accept, complete, refund-execute, apply, deliver, start-autorenew, ...). Listing the writes
|
|
44
|
+
* would miss each new subcommand, so here the reads are listed and anything else is a write.
|
|
45
|
+
*/
|
|
46
|
+
const READ_ONLY_SUBCOMMANDS = {
|
|
47
|
+
agent: new Set([
|
|
48
|
+
"help",
|
|
49
|
+
"get-my-agents",
|
|
50
|
+
"get-agents",
|
|
51
|
+
"my-agents",
|
|
52
|
+
"search",
|
|
53
|
+
"profile",
|
|
54
|
+
"service-list",
|
|
55
|
+
"service-match",
|
|
56
|
+
"service-detail",
|
|
57
|
+
"feedback-list",
|
|
58
|
+
"task-feedback",
|
|
59
|
+
"subscribe-detail",
|
|
60
|
+
"subscribe-cost",
|
|
61
|
+
"device-list",
|
|
62
|
+
"asp",
|
|
63
|
+
"asp-match",
|
|
64
|
+
"asp-claimable",
|
|
65
|
+
"task-service-select",
|
|
66
|
+
"task-create-prepare",
|
|
67
|
+
"prepare-create",
|
|
68
|
+
"designated-route",
|
|
69
|
+
"list-jobs-by-verified-sender",
|
|
70
|
+
"status",
|
|
71
|
+
"lifecycle",
|
|
72
|
+
"tasks",
|
|
73
|
+
"list",
|
|
74
|
+
"my-tasks",
|
|
75
|
+
"active-tasks",
|
|
76
|
+
"my-subscriptions",
|
|
77
|
+
"subscription-list",
|
|
78
|
+
"refund-list",
|
|
79
|
+
"refund-detail",
|
|
80
|
+
"refund-prepare",
|
|
81
|
+
"arbitration-list",
|
|
82
|
+
"arbitration-detail",
|
|
83
|
+
"gate-check",
|
|
84
|
+
"communication-check",
|
|
85
|
+
"system-config",
|
|
86
|
+
]),
|
|
87
|
+
};
|
|
88
|
+
/** Global flag whose value would otherwise be mistaken for a subcommand. */
|
|
89
|
+
const VALUE_FLAGS = new Set(["--chain"]);
|
|
90
|
+
function positionals(argv) {
|
|
91
|
+
const out = [];
|
|
92
|
+
for (let i = 0; i < argv.length; i++) {
|
|
93
|
+
const token = argv[i];
|
|
94
|
+
if (token === "--") {
|
|
95
|
+
out.push(...argv.slice(i + 1));
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
if (token.startsWith("-")) {
|
|
99
|
+
if (VALUE_FLAGS.has(token))
|
|
100
|
+
i++;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
out.push(token);
|
|
104
|
+
}
|
|
105
|
+
return out;
|
|
106
|
+
}
|
|
107
|
+
const isKnownGroup = (token) => token in WRITE_SUBCOMMANDS || token in READ_ONLY_SUBCOMMANDS;
|
|
108
|
+
/**
|
|
109
|
+
* True when the onchainos argv moves funds, signs, or changes orders.
|
|
110
|
+
*
|
|
111
|
+
* The group is the first positional that names a known command group, not simply the first
|
|
112
|
+
* positional: a global option that takes a value (`--output json wallet send`) leaves that value
|
|
113
|
+
* ahead of the group, and reading it as the group would let the write through. Any positional after
|
|
114
|
+
* the group that names a write subcommand counts, so a stray value ahead of the subcommand cannot
|
|
115
|
+
* hide it either.
|
|
116
|
+
*/
|
|
117
|
+
export function isOnchainosWriteCommand(argv) {
|
|
118
|
+
const tokens = positionals(argv).map((token) => token.toLowerCase());
|
|
119
|
+
const at = tokens.findIndex(isKnownGroup);
|
|
120
|
+
if (at < 0)
|
|
121
|
+
return false;
|
|
122
|
+
const group = tokens[at];
|
|
123
|
+
const rest = tokens.slice(at + 1);
|
|
124
|
+
const writes = WRITE_SUBCOMMANDS[group];
|
|
125
|
+
if (writes && rest.some((token) => writes.includes(token)))
|
|
126
|
+
return true;
|
|
127
|
+
const reads = READ_ONLY_SUBCOMMANDS[group];
|
|
128
|
+
const subcommand = rest[0];
|
|
129
|
+
return Boolean(reads && subcommand !== undefined && !reads.has(subcommand));
|
|
130
|
+
}
|
|
131
|
+
export function sameArgv(a, b) {
|
|
132
|
+
return a.length === b.length && a.every((token, i) => token === b[i]);
|
|
133
|
+
}
|
|
134
|
+
export function isApprovedArgv(argv, approved) {
|
|
135
|
+
return approved.some((candidate) => sameArgv(candidate, argv));
|
|
136
|
+
}
|
|
137
|
+
/** Validates the `approvedCommands` task param: a list of argv arrays of strings. */
|
|
138
|
+
export function parseApprovedCommands(value) {
|
|
139
|
+
if (!Array.isArray(value))
|
|
140
|
+
return [];
|
|
141
|
+
return value
|
|
142
|
+
.filter((entry) => Array.isArray(entry) && entry.length > 0 && entry.every((t) => typeof t === "string"))
|
|
143
|
+
.slice(0, 20);
|
|
144
|
+
}
|
|
145
|
+
export const APPROVAL_ARTIFACT_NAME = "approval_required";
|
|
146
|
+
const COMMAND_WORD = /^[a-z][a-z0-9-]{0,31}$/i;
|
|
147
|
+
const CHAIN_VALUE = /^[A-Za-z0-9_-]{1,32}$/;
|
|
148
|
+
/**
|
|
149
|
+
* The command group, subcommand and `--chain` of an onchainos call, for showing progress. Arguments
|
|
150
|
+
* (addresses, amounts, tokens) are deliberately left out: the step goes to the dashboard as text
|
|
151
|
+
* and is not the place to copy a wallet address or an amount around. A token that does not look
|
|
152
|
+
* like a command name is dropped rather than shown.
|
|
153
|
+
*/
|
|
154
|
+
export function describeOnchainosCall(argv) {
|
|
155
|
+
const tokens = positionals(argv);
|
|
156
|
+
const at = tokens.findIndex((token) => isKnownGroup(token.toLowerCase()));
|
|
157
|
+
const words = (at >= 0 ? tokens.slice(at, at + 2) : tokens.slice(0, 2)).filter((token) => COMMAND_WORD.test(token));
|
|
158
|
+
if (words.length === 0)
|
|
159
|
+
return undefined;
|
|
160
|
+
let chain;
|
|
161
|
+
for (let i = 0; i < argv.length; i++) {
|
|
162
|
+
const token = argv[i];
|
|
163
|
+
const value = token === "--chain" ? argv[i + 1] : token.startsWith("--chain=") ? token.slice("--chain=".length) : undefined;
|
|
164
|
+
if (value !== undefined) {
|
|
165
|
+
chain = CHAIN_VALUE.test(value) ? value.toLowerCase() : undefined;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return { command: words.join(" ").toLowerCase(), ...(chain ? { chain } : {}) };
|
|
170
|
+
}
|
|
171
|
+
export function agentStepFromCall(call) {
|
|
172
|
+
const where = call.chain ? ` (${call.chain})` : "";
|
|
173
|
+
return call.blocked
|
|
174
|
+
? { kind: "approval", command: call.command, chain: call.chain, message: `Waiting for your approval to run onchainos ${call.command}${where}` }
|
|
175
|
+
: { kind: "command", command: call.command, chain: call.chain, message: `Running onchainos ${call.command}${where}` };
|
|
176
|
+
}
|
|
177
|
+
export const WRITE_BLOCKED_MESSAGE = "BLOCKED: this command moves funds or signs and needs the user's approval. It was recorded for the user to approve. " +
|
|
178
|
+
"Do not retry it, change it, or look for another way to run it. Stop now and tell the user, in your final answer, " +
|
|
179
|
+
"the exact command you intended to run and what it would do.";
|
|
180
|
+
const GUARD_BIN = fileURLToPath(new URL("./onchainos-guard-bin.js", import.meta.url));
|
|
181
|
+
const ZSH_DIR = "zdot";
|
|
182
|
+
/**
|
|
183
|
+
* zsh startup files that load the user's own (from LUMORA_REAL_ZDOTDIR, default $HOME) and then put
|
|
184
|
+
* the guard directory back at the front of PATH. One per file zsh may read, because which of them
|
|
185
|
+
* run depends on how the agent starts its shell (-c, -lc, -ic, -lic).
|
|
186
|
+
*/
|
|
187
|
+
function writeZshStartupFiles(zdot) {
|
|
188
|
+
mkdirSync(zdot, { recursive: true });
|
|
189
|
+
for (const name of [".zshenv", ".zprofile", ".zshrc", ".zlogin"]) {
|
|
190
|
+
writeFileSync(join(zdot, name), [
|
|
191
|
+
`[ -f "\${LUMORA_REAL_ZDOTDIR:-$HOME}/${name}" ] && . "\${LUMORA_REAL_ZDOTDIR:-$HOME}/${name}"`,
|
|
192
|
+
'if [ -n "$LUMORA_GUARD_DIR" ]; then PATH="${PATH//$LUMORA_GUARD_DIR:/}"; export PATH="$LUMORA_GUARD_DIR:$PATH"; fi',
|
|
193
|
+
"",
|
|
194
|
+
].join("\n"));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/** Returns null when the guard cannot be installed; `runWithWriteGuard` then refuses to start the agent. */
|
|
198
|
+
export function createWriteGuard(opts = {}) {
|
|
199
|
+
const baseEnv = opts.baseEnv ?? process.env;
|
|
200
|
+
if (!existsSync(GUARD_BIN))
|
|
201
|
+
return null;
|
|
202
|
+
let dir;
|
|
203
|
+
try {
|
|
204
|
+
dir = mkdtempSync(join(tmpdir(), "lumora-guard-"));
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
const cleanup = () => rmSync(dir, { recursive: true, force: true });
|
|
210
|
+
try {
|
|
211
|
+
const shim = process.platform === "win32" ? join(dir, "onchainos.cmd") : join(dir, "onchainos");
|
|
212
|
+
writeFileSync(shim, process.platform === "win32"
|
|
213
|
+
? '@echo off\r\n"%LUMORA_GUARD_NODE%" "%LUMORA_GUARD_BIN%" %*\r\n'
|
|
214
|
+
: '#!/bin/sh\nexec "$LUMORA_GUARD_NODE" "$LUMORA_GUARD_BIN" "$@"\n');
|
|
215
|
+
chmodSync(shim, 0o755);
|
|
216
|
+
writeFileSync(join(dir, "approved.json"), JSON.stringify(opts.approvedCommands ?? []));
|
|
217
|
+
writeFileSync(join(dir, "blocked.jsonl"), "");
|
|
218
|
+
writeFileSync(join(dir, "calls.jsonl"), "");
|
|
219
|
+
if (process.platform !== "win32")
|
|
220
|
+
writeZshStartupFiles(join(dir, ZSH_DIR));
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
cleanup();
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
const realBin = findOnchainosBinaries(baseEnv)[0];
|
|
227
|
+
const basePath = baseEnv.PATH ?? "";
|
|
228
|
+
const blockedFile = join(dir, "blocked.jsonl");
|
|
229
|
+
const readBlocked = () => {
|
|
230
|
+
let raw = "";
|
|
231
|
+
try {
|
|
232
|
+
raw = readFileSync(blockedFile, "utf8");
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
return [];
|
|
236
|
+
}
|
|
237
|
+
const seen = new Set();
|
|
238
|
+
const out = [];
|
|
239
|
+
for (const line of raw.split("\n")) {
|
|
240
|
+
if (!line.trim())
|
|
241
|
+
continue;
|
|
242
|
+
try {
|
|
243
|
+
const argv = JSON.parse(line);
|
|
244
|
+
if (!Array.isArray(argv) || !argv.every((t) => typeof t === "string"))
|
|
245
|
+
continue;
|
|
246
|
+
const key = JSON.stringify(argv);
|
|
247
|
+
if (seen.has(key))
|
|
248
|
+
continue;
|
|
249
|
+
seen.add(key);
|
|
250
|
+
out.push(argv);
|
|
251
|
+
}
|
|
252
|
+
catch {
|
|
253
|
+
// A torn line from a killed process: ignore it.
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return out;
|
|
257
|
+
};
|
|
258
|
+
return {
|
|
259
|
+
env: {
|
|
260
|
+
PATH: `${dir}${delimiter}${basePath}`,
|
|
261
|
+
// Agents run their commands through the user's shell, and the shell's startup files
|
|
262
|
+
// (zsh -i / -l read ~/.zshrc, ~/.zprofile, ...) put ~/.local/bin and friends in front of the
|
|
263
|
+
// PATH given here, so the real onchainos would be found before the shim. zsh reads its
|
|
264
|
+
// startup files from ZDOTDIR: pointing it at files that source the user's own and then put
|
|
265
|
+
// the shim first again keeps the shim ahead no matter what they do.
|
|
266
|
+
...(process.platform === "win32" ? {} : { ZDOTDIR: join(dir, ZSH_DIR), LUMORA_REAL_ZDOTDIR: baseEnv.ZDOTDIR || baseEnv.HOME || homedir() }),
|
|
267
|
+
LUMORA_GUARD_DIR: dir,
|
|
268
|
+
LUMORA_GUARD_NODE: process.execPath,
|
|
269
|
+
LUMORA_GUARD_BIN: GUARD_BIN,
|
|
270
|
+
...(realBin ? { LUMORA_REAL_ONCHAINOS: realBin } : {}),
|
|
271
|
+
},
|
|
272
|
+
blocked: readBlocked,
|
|
273
|
+
watchCalls(onStep) {
|
|
274
|
+
const callsFile = join(dir, "calls.jsonl");
|
|
275
|
+
let offset = 0;
|
|
276
|
+
let partial = "";
|
|
277
|
+
const drain = () => {
|
|
278
|
+
let fd;
|
|
279
|
+
try {
|
|
280
|
+
fd = openSync(callsFile, "r");
|
|
281
|
+
const size = fstatSync(fd).size;
|
|
282
|
+
if (size <= offset)
|
|
283
|
+
return;
|
|
284
|
+
const buffer = Buffer.alloc(size - offset);
|
|
285
|
+
const read = readSync(fd, buffer, 0, buffer.length, offset);
|
|
286
|
+
offset += read;
|
|
287
|
+
const lines = (partial + buffer.subarray(0, read).toString("utf8")).split("\n");
|
|
288
|
+
partial = lines.pop() ?? "";
|
|
289
|
+
for (const line of lines) {
|
|
290
|
+
if (!line.trim())
|
|
291
|
+
continue;
|
|
292
|
+
try {
|
|
293
|
+
const call = JSON.parse(line);
|
|
294
|
+
if (typeof call.command !== "string")
|
|
295
|
+
continue;
|
|
296
|
+
onStep(agentStepFromCall({ command: call.command, chain: typeof call.chain === "string" ? call.chain : undefined, blocked: call.blocked === true }));
|
|
297
|
+
}
|
|
298
|
+
catch {
|
|
299
|
+
// A torn or foreign line: skip it.
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
catch {
|
|
304
|
+
// The folder may already be gone; progress is best effort.
|
|
305
|
+
}
|
|
306
|
+
finally {
|
|
307
|
+
if (fd !== undefined)
|
|
308
|
+
closeSync(fd);
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
const timer = setInterval(drain, 400);
|
|
312
|
+
timer.unref();
|
|
313
|
+
return () => {
|
|
314
|
+
clearInterval(timer);
|
|
315
|
+
drain();
|
|
316
|
+
};
|
|
317
|
+
},
|
|
318
|
+
artifact() {
|
|
319
|
+
const blocked = readBlocked();
|
|
320
|
+
if (blocked.length === 0)
|
|
321
|
+
return undefined;
|
|
322
|
+
return { name: APPROVAL_ARTIFACT_NAME, mimeType: "application/json", metadata: { commands: blocked } };
|
|
323
|
+
},
|
|
324
|
+
cleanup,
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Whether an agent run on this computer can be guarded right now. The daemon advertises it so the
|
|
329
|
+
* dashboard knows whether it may ask an agent to attempt a fund-moving command (and get it held for
|
|
330
|
+
* approval) or must forbid the command outright. Probes the real install and cleans up after itself.
|
|
331
|
+
*/
|
|
332
|
+
export function isWriteGuardAvailable(install = createWriteGuard) {
|
|
333
|
+
const guard = install();
|
|
334
|
+
if (!guard)
|
|
335
|
+
return false;
|
|
336
|
+
guard.cleanup();
|
|
337
|
+
return true;
|
|
338
|
+
}
|
|
339
|
+
/** Raised when the approval guard cannot be installed: running the agent anyway would drop it silently. */
|
|
340
|
+
export class WriteGuardUnavailableError extends Error {
|
|
341
|
+
constructor() {
|
|
342
|
+
super("The approval guard could not be installed on this computer, so the agent was not started: without it nothing would stop it from moving funds. " +
|
|
343
|
+
"Reinstall or rebuild the daemon so onchainos-guard-bin.js is present, and make sure the temp folder is writable. " +
|
|
344
|
+
"(Set LUMORA_ALLOW_UNGUARDED_AGENT=1 on the daemon only if you accept agents running without approval.)");
|
|
345
|
+
this.name = "WriteGuardUnavailableError";
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Runs an agent with the guard installed and attaches the approval request (if the agent
|
|
350
|
+
* tried a fund-moving command) to the result. `run` receives the env to spawn the agent with.
|
|
351
|
+
* If the guard cannot be installed the agent is not started, unless the machine owner opted out
|
|
352
|
+
* with `LUMORA_ALLOW_UNGUARDED_AGENT=1`.
|
|
353
|
+
*/
|
|
354
|
+
export async function runWithWriteGuard(approvedCommands, run, options = {}) {
|
|
355
|
+
const guard = (options.install ?? createWriteGuard)({ approvedCommands: parseApprovedCommands(approvedCommands) });
|
|
356
|
+
if (!guard && process.env.LUMORA_ALLOW_UNGUARDED_AGENT !== "1") {
|
|
357
|
+
throw new WriteGuardUnavailableError();
|
|
358
|
+
}
|
|
359
|
+
const stopWatching = options.onStep ? guard?.watchCalls(options.onStep) : undefined;
|
|
360
|
+
try {
|
|
361
|
+
const result = await run(guard?.env ?? {});
|
|
362
|
+
stopWatching?.();
|
|
363
|
+
const artifact = guard?.artifact();
|
|
364
|
+
return artifact ? { ...result, artifacts: [...result.artifacts, artifact] } : result;
|
|
365
|
+
}
|
|
366
|
+
finally {
|
|
367
|
+
stopWatching?.();
|
|
368
|
+
guard?.cleanup();
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
//# sourceMappingURL=write-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-guard.js","sourceRoot":"","sources":["../src/write-guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACvJ,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;;;;;;;;;;GAYG;AAEH,2FAA2F;AAC3F,MAAM,iBAAiB,GAAsC;IAC3D,IAAI,EAAE,CAAC,SAAS,CAAC;IACjB,aAAa,EAAE,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,CAAC,WAAW,CAAC;IACtB,MAAM,EAAE;QACN,MAAM;QACN,eAAe;QACf,cAAc;QACd,QAAQ;QACR,QAAQ,EAAE,8BAA8B;QACxC,sBAAsB,EAAE,2BAA2B;QACnD,QAAQ;QACR,SAAS;QACT,OAAO;QACP,QAAQ,EAAE,oBAAoB;QAC9B,MAAM;QACN,SAAS;KACV;IACD,QAAQ,EAAE,CAAC,cAAc,EAAE,QAAQ,EAAE,QAAQ,CAAC;IAC9C,OAAO,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,CAAC;CAC7E,CAAC;AAEF;;;;GAIG;AACH,MAAM,qBAAqB,GAAwC;IACjE,KAAK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B,MAAM,QAAQ,GAAG,KAAK,EAAE,QAAQ,EAAE,CAAC;QACnC,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,CAAC,GAAG,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;IACvF,CAAC;YAAS,CAAC;QACT,YAAY,EAAE,EAAE,CAAC;QACjB,KAAK,EAAE,OAAO,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { chmodSync, existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { test } from "node:test";
|
|
6
|
+
import { execa } from "execa";
|
|
7
|
+
import { APPROVAL_ARTIFACT_NAME, WriteGuardUnavailableError, agentStepFromCall, createWriteGuard, describeOnchainosCall, isOnchainosWriteCommand, isWriteGuardAvailable, parseApprovedCommands, runWithWriteGuard } from "./write-guard.js";
|
|
8
|
+
test("fund-moving and signing commands are classified as writes", () => {
|
|
9
|
+
for (const argv of [
|
|
10
|
+
["swap", "execute", "--chain", "xlayer"],
|
|
11
|
+
["--chain", "xlayer", "swap", "execute"],
|
|
12
|
+
["wallet", "send", "--readable-amount", "1"],
|
|
13
|
+
["wallet", "contract-call", "--to", "0x1"],
|
|
14
|
+
["wallet", "gas-station", "enable"],
|
|
15
|
+
["cross-chain", "execute"],
|
|
16
|
+
["strategy", "create-limit"],
|
|
17
|
+
["strategy", "cancel"],
|
|
18
|
+
["gateway", "broadcast"],
|
|
19
|
+
["payment", "pay"],
|
|
20
|
+
["SWAP", "Execute"],
|
|
21
|
+
]) {
|
|
22
|
+
assert.equal(isOnchainosWriteCommand(argv), true, argv.join(" "));
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
test("read-only commands are not writes", () => {
|
|
26
|
+
for (const argv of [
|
|
27
|
+
[],
|
|
28
|
+
["swap", "quote", "--from", "usdt"],
|
|
29
|
+
["wallet", "status"],
|
|
30
|
+
["wallet", "balance", "--all"],
|
|
31
|
+
["wallet", "gas-station", "status"],
|
|
32
|
+
["cross-chain", "quote"],
|
|
33
|
+
["strategy", "list"],
|
|
34
|
+
["market", "price"],
|
|
35
|
+
["signal", "list", "--chain", "xlayer"],
|
|
36
|
+
["defi", "invest"],
|
|
37
|
+
]) {
|
|
38
|
+
assert.equal(isOnchainosWriteCommand(argv), false, argv.join(" "));
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
test("approvedCommands is validated as argv arrays of strings", () => {
|
|
42
|
+
assert.deepEqual(parseApprovedCommands([["swap", "execute"], "swap execute", [], ["a", 1]]), [["swap", "execute"]]);
|
|
43
|
+
assert.deepEqual(parseApprovedCommands(undefined), []);
|
|
44
|
+
});
|
|
45
|
+
test("the shim passes reads, refuses unapproved writes and allows the exact approved argv", async (t) => {
|
|
46
|
+
const bin = mkdtempSync(join(tmpdir(), "fake-onchainos-"));
|
|
47
|
+
t.after(() => rmSync(bin, { recursive: true, force: true }));
|
|
48
|
+
const fake = join(bin, "onchainos");
|
|
49
|
+
writeFileSync(fake, '#!/bin/sh\necho "REAL $@"\n');
|
|
50
|
+
chmodSync(fake, 0o755);
|
|
51
|
+
const baseEnv = { ...process.env, PATH: `${bin}:${process.env.PATH ?? ""}` };
|
|
52
|
+
const approved = ["swap", "execute", "--amount", "0.3"];
|
|
53
|
+
const guard = createWriteGuard({ approvedCommands: [approved], baseEnv });
|
|
54
|
+
assert.ok(guard, "guard installs");
|
|
55
|
+
t.after(() => guard.cleanup());
|
|
56
|
+
const run = (...args) => execa("onchainos", args, { env: { ...baseEnv, ...guard.env }, extendEnv: false, reject: false });
|
|
57
|
+
const read = await run("swap", "quote");
|
|
58
|
+
assert.equal(read.exitCode, 0);
|
|
59
|
+
assert.match(read.stdout, /REAL swap quote/);
|
|
60
|
+
const refused = await run("wallet", "send", "--readable-amount", "1000");
|
|
61
|
+
assert.equal(refused.exitCode, 3);
|
|
62
|
+
assert.match(refused.stderr, /approval_required/);
|
|
63
|
+
assert.doesNotMatch(refused.stdout, /REAL/);
|
|
64
|
+
const changed = await run("swap", "execute", "--amount", "300");
|
|
65
|
+
assert.equal(changed.exitCode, 3, "a different amount is not covered by the approval");
|
|
66
|
+
const allowed = await run(...approved);
|
|
67
|
+
assert.equal(allowed.exitCode, 0);
|
|
68
|
+
assert.match(allowed.stdout, /REAL swap execute --amount 0.3/);
|
|
69
|
+
const artifact = guard.artifact();
|
|
70
|
+
assert.equal(artifact?.name, APPROVAL_ARTIFACT_NAME);
|
|
71
|
+
assert.deepEqual(artifact?.metadata?.commands, [
|
|
72
|
+
["wallet", "send", "--readable-amount", "1000"],
|
|
73
|
+
["swap", "execute", "--amount", "300"],
|
|
74
|
+
]);
|
|
75
|
+
});
|
|
76
|
+
test("an agent run that tries a fund-moving command ends with an approval_required artifact", async (t) => {
|
|
77
|
+
const dir = mkdtempSync(join(tmpdir(), "guard-agent-"));
|
|
78
|
+
t.after(() => rmSync(dir, { recursive: true, force: true }));
|
|
79
|
+
const fakeOnchainos = join(dir, "onchainos");
|
|
80
|
+
writeFileSync(fakeOnchainos, '#!/bin/sh\necho "REAL $@" >> "$LUMORA_TEST_LOG"\n');
|
|
81
|
+
chmodSync(fakeOnchainos, 0o755);
|
|
82
|
+
// A stand-in for `claude`: the "agent" runs a swap and reports whatever happened.
|
|
83
|
+
const fakeClaude = join(dir, "claude");
|
|
84
|
+
writeFileSync(fakeClaude, '#!/bin/sh\nonchainos swap quote >/dev/null 2>&1\nonchainos swap execute --amount 0.3 >/dev/null 2>&1\necho \'{"type":"result","result":"prepared"}\'\n');
|
|
85
|
+
chmodSync(fakeClaude, 0o755);
|
|
86
|
+
const log = join(dir, "calls.log");
|
|
87
|
+
const previousPath = process.env.PATH;
|
|
88
|
+
const previousLog = process.env.LUMORA_TEST_LOG;
|
|
89
|
+
process.env.PATH = `${dir}:${previousPath ?? ""}`;
|
|
90
|
+
process.env.LUMORA_TEST_LOG = log;
|
|
91
|
+
t.after(() => {
|
|
92
|
+
process.env.PATH = previousPath;
|
|
93
|
+
if (previousLog === undefined)
|
|
94
|
+
delete process.env.LUMORA_TEST_LOG;
|
|
95
|
+
else
|
|
96
|
+
process.env.LUMORA_TEST_LOG = previousLog;
|
|
97
|
+
});
|
|
98
|
+
const { ClaudeCodeAdapter } = await import("./claude-code-adapter.js");
|
|
99
|
+
const adapter = new ClaudeCodeAdapter({ binPath: fakeClaude });
|
|
100
|
+
const task = { id: "11111111-1111-4111-8111-111111111111", agentType: "claude_code" };
|
|
101
|
+
const hooks = { onHeartbeat: async () => { } };
|
|
102
|
+
const result = await adapter.run(task, { message: "swap 0.3 usdt" }, hooks);
|
|
103
|
+
const artifact = result.artifacts.find((a) => a.name === APPROVAL_ARTIFACT_NAME);
|
|
104
|
+
assert.deepEqual(artifact?.metadata?.commands, [["swap", "execute", "--amount", "0.3"]]);
|
|
105
|
+
const { readFileSync } = await import("node:fs");
|
|
106
|
+
assert.equal(readFileSync(log, "utf8"), "REAL swap quote\n", "only the read reached the real CLI");
|
|
107
|
+
// The same request with the user's approval for that exact command runs it and asks for nothing.
|
|
108
|
+
const approved = await adapter.run(task, { message: "swap 0.3 usdt", approvedCommands: [["swap", "execute", "--amount", "0.3"]] }, hooks);
|
|
109
|
+
assert.equal(approved.artifacts.some((a) => a.name === APPROVAL_ARTIFACT_NAME), false);
|
|
110
|
+
assert.match(readFileSync(log, "utf8"), /REAL swap execute --amount 0.3/);
|
|
111
|
+
});
|
|
112
|
+
test("the marketplace `agent` group is a write unless the subcommand is a known read", () => {
|
|
113
|
+
for (const argv of [
|
|
114
|
+
["agent", "create-task"],
|
|
115
|
+
["agent", "confirm-accept", "--task-id", "1"],
|
|
116
|
+
["agent", "complete"],
|
|
117
|
+
["agent", "refund-execute"],
|
|
118
|
+
["agent", "start-autorenew"],
|
|
119
|
+
["agent", "apply"],
|
|
120
|
+
["agent", "deliver"],
|
|
121
|
+
["agent", "a2mcp"],
|
|
122
|
+
["agent", "some-future-subcommand"],
|
|
123
|
+
["--chain", "xlayer", "agent", "create-task"],
|
|
124
|
+
]) {
|
|
125
|
+
assert.equal(isOnchainosWriteCommand(argv), true, argv.join(" "));
|
|
126
|
+
}
|
|
127
|
+
for (const argv of [
|
|
128
|
+
["agent", "get-my-agents"],
|
|
129
|
+
["agent", "tasks"],
|
|
130
|
+
["agent", "status", "--task-id", "1"],
|
|
131
|
+
["agent", "gate-check"],
|
|
132
|
+
["agent"],
|
|
133
|
+
["token", "search", "--query", "agent"],
|
|
134
|
+
]) {
|
|
135
|
+
assert.equal(isOnchainosWriteCommand(argv), false, argv.join(" "));
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
test("a global option with a value ahead of the group cannot hide a write", () => {
|
|
139
|
+
assert.equal(isOnchainosWriteCommand(["--output", "json", "wallet", "send"]), true);
|
|
140
|
+
assert.equal(isOnchainosWriteCommand(["--home", "/tmp/x", "swap", "execute"]), true);
|
|
141
|
+
assert.equal(isOnchainosWriteCommand(["--output", "json", "swap", "quote"]), false);
|
|
142
|
+
});
|
|
143
|
+
test("an agent is not started when the approval guard cannot be installed", async () => {
|
|
144
|
+
let started = false;
|
|
145
|
+
await assert.rejects(runWithWriteGuard([], async () => {
|
|
146
|
+
started = true;
|
|
147
|
+
return { taskId: "t", finalStatus: "succeeded", texts: [], artifacts: [] };
|
|
148
|
+
}, { install: () => null }), (error) => error instanceof WriteGuardUnavailableError);
|
|
149
|
+
assert.equal(started, false);
|
|
150
|
+
});
|
|
151
|
+
test("the machine owner can opt out of the guard explicitly", async () => {
|
|
152
|
+
process.env.LUMORA_ALLOW_UNGUARDED_AGENT = "1";
|
|
153
|
+
try {
|
|
154
|
+
const result = await runWithWriteGuard([], async (env) => {
|
|
155
|
+
assert.deepEqual(env, {});
|
|
156
|
+
return { taskId: "t", finalStatus: "succeeded", texts: ["ok"], artifacts: [] };
|
|
157
|
+
}, { install: () => null });
|
|
158
|
+
assert.equal(result.finalStatus, "succeeded");
|
|
159
|
+
}
|
|
160
|
+
finally {
|
|
161
|
+
delete process.env.LUMORA_ALLOW_UNGUARDED_AGENT;
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
test("the shim still wins when the user's zsh startup files put their own PATH entries in front", async (t) => {
|
|
165
|
+
if (!existsSync("/bin/zsh"))
|
|
166
|
+
return t.skip("zsh is not installed");
|
|
167
|
+
const root = mkdtempSync(join(tmpdir(), "guard-zsh-"));
|
|
168
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
169
|
+
// A home folder like a developer's: every startup file prepends a directory with the "real" onchainos.
|
|
170
|
+
const home = join(root, "home");
|
|
171
|
+
mkdirSync(join(home, "bin"), { recursive: true });
|
|
172
|
+
writeFileSync(join(home, "bin", "onchainos"), '#!/bin/sh\necho REAL "$@"\n');
|
|
173
|
+
chmodSync(join(home, "bin", "onchainos"), 0o755);
|
|
174
|
+
for (const file of [".zshenv", ".zprofile", ".zshrc", ".zlogin"])
|
|
175
|
+
writeFileSync(join(home, file), `export PATH="${home}/bin:$PATH"\n`);
|
|
176
|
+
const guard = createWriteGuard({ baseEnv: { ...process.env, HOME: home } });
|
|
177
|
+
assert.ok(guard, "guard installs");
|
|
178
|
+
t.after(() => guard.cleanup());
|
|
179
|
+
for (const mode of ["-c", "-lc", "-ic", "-lic"]) {
|
|
180
|
+
const outcome = await execa("/bin/zsh", [mode, "onchainos swap execute --amount 0"], {
|
|
181
|
+
env: { ...process.env, HOME: home, ...guard.env },
|
|
182
|
+
extendEnv: false,
|
|
183
|
+
reject: false,
|
|
184
|
+
});
|
|
185
|
+
assert.equal(outcome.exitCode, 3, `zsh ${mode}: the write must be refused by the shim, got: ${outcome.stdout || outcome.stderr}`);
|
|
186
|
+
assert.doesNotMatch(outcome.stdout, /REAL/, `zsh ${mode}: the real binary must not run`);
|
|
187
|
+
}
|
|
188
|
+
// A read is passed on to the real binary (found from the daemon's own PATH, not the startup
|
|
189
|
+
// files' one), so it is not refused.
|
|
190
|
+
const read = await execa("/bin/zsh", ["-lic", "onchainos wallet status"], { env: { ...process.env, HOME: home, ...guard.env }, extendEnv: false, reject: false });
|
|
191
|
+
assert.doesNotMatch(`${read.stdout}${read.stderr}`, /approval_required/);
|
|
192
|
+
});
|
|
193
|
+
test("a progress step names the command and chain but never the arguments", () => {
|
|
194
|
+
assert.deepEqual(describeOnchainosCall(["swap", "quote", "--from", "usdt", "--to", "okb", "--readable-amount", "0.3", "--chain", "xlayer"]), { command: "swap quote", chain: "xlayer" });
|
|
195
|
+
assert.deepEqual(describeOnchainosCall(["--chain=Base", "wallet", "send", "--recipient", "0xabc", "--readable-amount", "9"]), { command: "wallet send", chain: "base" });
|
|
196
|
+
assert.deepEqual(describeOnchainosCall(["wallet", "status"]), { command: "wallet status" });
|
|
197
|
+
// A value that is not a command word is dropped, not shown.
|
|
198
|
+
assert.deepEqual(describeOnchainosCall(["token", "0xAbC0000000000000000000000000000000000001"]), { command: "token" });
|
|
199
|
+
assert.equal(describeOnchainosCall(["--chain", "weird chain!!", "wallet", "status"])?.chain, undefined);
|
|
200
|
+
assert.equal(describeOnchainosCall([]), undefined);
|
|
201
|
+
for (const call of [["swap", "quote", "--readable-amount", "123.45", "--wallet", "0xDEADBEEF"]]) {
|
|
202
|
+
const text = JSON.stringify(describeOnchainosCall(call));
|
|
203
|
+
assert.doesNotMatch(text, /123\.45|DEADBEEF/i);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
test("a step is a complete sentence, and a refused call says it is waiting for approval", () => {
|
|
207
|
+
assert.equal(agentStepFromCall({ command: "swap quote", chain: "xlayer" }).message, "Running onchainos swap quote (xlayer)");
|
|
208
|
+
assert.equal(agentStepFromCall({ command: "wallet status" }).message, "Running onchainos wallet status");
|
|
209
|
+
const waiting = agentStepFromCall({ command: "swap execute", chain: "xlayer", blocked: true });
|
|
210
|
+
assert.equal(waiting.kind, "approval");
|
|
211
|
+
assert.equal(waiting.message, "Waiting for your approval to run onchainos swap execute (xlayer)");
|
|
212
|
+
});
|
|
213
|
+
test("the guard reports each onchainos call the agent makes, in order, including a refused one", async (t) => {
|
|
214
|
+
const bin = mkdtempSync(join(tmpdir(), "fake-onchainos-"));
|
|
215
|
+
t.after(() => rmSync(bin, { recursive: true, force: true }));
|
|
216
|
+
writeFileSync(join(bin, "onchainos"), "#!/bin/sh\necho REAL\n");
|
|
217
|
+
chmodSync(join(bin, "onchainos"), 0o755);
|
|
218
|
+
const baseEnv = { ...process.env, PATH: `${bin}:${process.env.PATH ?? ""}` };
|
|
219
|
+
const guard = createWriteGuard({ baseEnv });
|
|
220
|
+
assert.ok(guard);
|
|
221
|
+
t.after(() => guard.cleanup());
|
|
222
|
+
const steps = [];
|
|
223
|
+
const stop = guard.watchCalls((step) => steps.push(step.message));
|
|
224
|
+
const run = (...args) => execa("onchainos", args, { env: { ...baseEnv, ...guard.env }, extendEnv: false, reject: false });
|
|
225
|
+
await run("wallet", "status");
|
|
226
|
+
await run("swap", "quote", "--chain", "xlayer", "--readable-amount", "0.3");
|
|
227
|
+
await run("swap", "execute", "--chain", "xlayer", "--readable-amount", "0.3");
|
|
228
|
+
stop();
|
|
229
|
+
assert.deepEqual(steps, [
|
|
230
|
+
"Running onchainos wallet status",
|
|
231
|
+
"Running onchainos swap quote (xlayer)",
|
|
232
|
+
"Waiting for your approval to run onchainos swap execute (xlayer)",
|
|
233
|
+
]);
|
|
234
|
+
});
|
|
235
|
+
test("an adapter run reports the agent's onchainos calls as progress while it works", async (t) => {
|
|
236
|
+
const dir = mkdtempSync(join(tmpdir(), "guard-progress-"));
|
|
237
|
+
t.after(() => rmSync(dir, { recursive: true, force: true }));
|
|
238
|
+
writeFileSync(join(dir, "onchainos"), "#!/bin/sh\necho REAL\n");
|
|
239
|
+
chmodSync(join(dir, "onchainos"), 0o755);
|
|
240
|
+
writeFileSync(join(dir, "claude"), '#!/bin/sh\nonchainos wallet status >/dev/null 2>&1\nonchainos swap quote --chain xlayer --readable-amount 7.77 >/dev/null 2>&1\nonchainos swap execute --chain xlayer --readable-amount 7.77 >/dev/null 2>&1\necho \'{"type":"result","result":"done"}\'\n');
|
|
241
|
+
chmodSync(join(dir, "claude"), 0o755);
|
|
242
|
+
const previousPath = process.env.PATH;
|
|
243
|
+
process.env.PATH = `${dir}:${previousPath ?? ""}`;
|
|
244
|
+
t.after(() => { process.env.PATH = previousPath; });
|
|
245
|
+
const { ClaudeCodeAdapter } = await import("./claude-code-adapter.js");
|
|
246
|
+
const adapter = new ClaudeCodeAdapter({ binPath: join(dir, "claude") });
|
|
247
|
+
const progress = [];
|
|
248
|
+
await adapter.run({ id: "11111111-1111-4111-8111-111111111111", agentType: "claude_code" }, { message: "swap" }, { onHeartbeat: async () => { }, onProgress: (message, detail) => progress.push({ message, kind: detail?.kind }) });
|
|
249
|
+
assert.deepEqual(progress.map((p) => p.message), ["Starting Claude Code", "Running onchainos wallet status", "Running onchainos swap quote (xlayer)", "Waiting for your approval to run onchainos swap execute (xlayer)"]);
|
|
250
|
+
assert.deepEqual(progress.map((p) => p.kind), ["phase", "command", "command", "approval"]);
|
|
251
|
+
assert.doesNotMatch(JSON.stringify(progress), /7\.77/, "amounts are not reported");
|
|
252
|
+
});
|
|
253
|
+
test("the daemon can tell whether the guard is installable, and cleans up the probe", () => {
|
|
254
|
+
assert.equal(isWriteGuardAvailable(), true);
|
|
255
|
+
assert.equal(isWriteGuardAvailable(() => null), false);
|
|
256
|
+
let cleaned = false;
|
|
257
|
+
const fake = {
|
|
258
|
+
env: {},
|
|
259
|
+
blocked: () => [],
|
|
260
|
+
artifact: () => undefined,
|
|
261
|
+
watchCalls: () => () => { },
|
|
262
|
+
cleanup: () => { cleaned = true; },
|
|
263
|
+
};
|
|
264
|
+
assert.equal(isWriteGuardAvailable(() => fake), true);
|
|
265
|
+
assert.equal(cleaned, true);
|
|
266
|
+
});
|
|
267
|
+
//# sourceMappingURL=write-guard.test.js.map
|