@intentrax/sdk 1.6.0 → 1.7.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.
@@ -0,0 +1,50 @@
1
+ // Runs a developer's `--check` module in a worker thread.
2
+ //
3
+ // The sandbox never executes user check code on its own thread: both reading
4
+ // the module's exports ("describe") and calling the check ("read") happen in
5
+ // a worker that is terminated as soon as it answers, fails, or the caller's
6
+ // AbortSignal fires (the read timeout). Sockets, timers or a promise that
7
+ // never settles inside a check therefore cannot keep the CLI alive.
8
+ //
9
+ // The worker side is check-worker.mjs. Values cross the boundary by
10
+ // structured clone, so a check can only return data (functions and other
11
+ // non-cloneable values are an error).
12
+
13
+ import { Worker } from "node:worker_threads";
14
+
15
+ export function runCheckWorker({ href, mode, probe = null, signal = null }) {
16
+ return new Promise((resolve, reject) => {
17
+ if (signal && signal.aborted) {
18
+ reject(signal.reason);
19
+ return;
20
+ }
21
+ const worker = new Worker(new URL("./check-worker.mjs", import.meta.url), {
22
+ workerData: { href, mode, probe },
23
+ });
24
+ let settled = false;
25
+ const onAbort = () => finish(() => reject(signal.reason));
26
+ function finish(settle) {
27
+ if (settled) return;
28
+ settled = true;
29
+ if (signal) signal.removeEventListener("abort", onAbort);
30
+ // Terminate unconditionally: the check may have left handles open.
31
+ worker.terminate().catch(() => {});
32
+ settle();
33
+ }
34
+ worker.once("message", (m) => finish(() => (m && m.ok ? resolve(m.value) : reject(new Error(m && m.error ? m.error : "check failed")))));
35
+ worker.once("error", (err) => finish(() => reject(err)));
36
+ worker.once("exit", (code) => finish(() => reject(new Error("check worker exited with code " + code))));
37
+ if (signal) signal.addEventListener("abort", onAbort, { once: true });
38
+ });
39
+ }
40
+
41
+ // Read a check module's exports without running its code on this thread.
42
+ export async function describeCheck(href, timeoutMs) {
43
+ const controller = new AbortController();
44
+ const timer = setTimeout(() => controller.abort(new Error("loading the check module took longer than " + timeoutMs + " ms")), timeoutMs);
45
+ try {
46
+ return await runCheckWorker({ href, mode: "describe", signal: controller.signal });
47
+ } finally {
48
+ clearTimeout(timer);
49
+ }
50
+ }
@@ -0,0 +1,30 @@
1
+ // Worker side of check-runner.mjs: imports the developer's check module and
2
+ // either describes its exports or calls its check once with the probe. The
3
+ // parent terminates this worker as soon as it posts, so nothing the check
4
+ // leaves behind outlives the answer.
5
+
6
+ import { parentPort, workerData } from "node:worker_threads";
7
+
8
+ const { href, mode, probe } = workerData;
9
+
10
+ try {
11
+ const mod = await import(href);
12
+ const check = typeof mod.default === "function" ? mod.default : typeof mod.check === "function" ? mod.check : null;
13
+ if (mode === "describe") {
14
+ parentPort.postMessage({
15
+ ok: true,
16
+ value: {
17
+ has_check: check !== null,
18
+ expected: mod.expected === undefined ? null : mod.expected,
19
+ resource: mod.resource === undefined ? null : mod.resource,
20
+ },
21
+ });
22
+ } else if (check === null) {
23
+ parentPort.postMessage({ ok: false, error: "module exports no check function" });
24
+ } else {
25
+ const value = await check(probe);
26
+ parentPort.postMessage({ ok: true, value: value === undefined ? null : value });
27
+ }
28
+ } catch (err) {
29
+ parentPort.postMessage({ ok: false, error: String(err && err.message ? err.message : err).slice(0, 200) });
30
+ }
@@ -0,0 +1,376 @@
1
+ #!/usr/bin/env node
2
+ // `intentrax sandbox`: the local assurance sandbox CLI.
3
+ //
4
+ // intentrax sandbox [--scenario confirmed|contradicted] [--dir <project>] [--json]
5
+ // intentrax sandbox --check ./my-check.mjs [--check-timeout-ms 30000] [--dir <project>] [--json]
6
+ // intentrax sandbox verify <bundle.json> [--keys <local-key-set.json>] [--json]
7
+ // [--issuer-keys <pinned-external-issuers.json>] [--require-external-issuer <issuer>]...
8
+ //
9
+ // Everything runs in-process with ephemeral local keys. Output files go to
10
+ // <project>/.intentrax/local/, which is gitignored. Nothing is sent anywhere.
11
+ //
12
+ // `intentrax sandbox ...` (cli/intentrax.mjs) dispatches here; from a repository
13
+ // checkout, `node sdk/typescript/sandbox/cli.mjs [args]` runs the same thing.
14
+
15
+ import { readFileSync, writeFileSync, mkdirSync, realpathSync } from "node:fs";
16
+ import { basename, join, relative, resolve, isAbsolute } from "node:path";
17
+ import { fileURLToPath, pathToFileURL } from "node:url";
18
+ import { sha256Hex, isCanonicalizable } from "./canonical.mjs";
19
+ import { runSandbox, SCENARIOS, SAMPLE_ACTION } from "./run.mjs";
20
+ import { verifyLocalBundle } from "./verifier.mjs";
21
+ import { loadLocalKeySet, LocalKeySetError } from "./keys.mjs";
22
+ import { loadPinnedIssuerKeySet, IssuerKeySetError } from "./external-decision.mjs";
23
+ import { describeCheck, runCheckWorker } from "./check-runner.mjs";
24
+ import { VERDICTS } from "./model.mjs";
25
+
26
+ export const LOCAL_DIR = join(".intentrax", "local");
27
+
28
+ export const BANNER = Object.freeze([
29
+ "==============================================================================",
30
+ " INTENTRAX LOCAL SANDBOX: NOT PRODUCTION ASSURANCE",
31
+ " Signed with ephemeral keys generated on this machine",
32
+ " (environment: local, trust_bearing: false). No production or published key",
33
+ " was read or used, and nothing was sent over the network. Production",
34
+ " verifiers, hosted verify and the Verification Mark reject local bundles.",
35
+ "==============================================================================",
36
+ ]);
37
+
38
+ export const EXIT_CODES = Object.freeze({
39
+ [VERDICTS.LOCAL_NON_TRUST_BEARING]: 0,
40
+ [VERDICTS.PENDING_FINALITY]: 10,
41
+ [VERDICTS.INSUFFICIENT_EVIDENCE]: 11,
42
+ [VERDICTS.CONFLICTING_EVIDENCE]: 12,
43
+ [VERDICTS.INTEGRITY_ONLY]: 13,
44
+ [VERDICTS.VERIFICATION_FAILED]: 14,
45
+ });
46
+ export const USAGE_EXIT_CODE = 64;
47
+ // Loading a --check module (in its worker) is bounded separately from the
48
+ // read itself, which --check-timeout-ms bounds.
49
+ const CHECK_LOAD_TIMEOUT_MS = 15000;
50
+
51
+ class UsageError extends Error {}
52
+
53
+ function exitCodeFor(verdict) {
54
+ if (!Object.prototype.hasOwnProperty.call(EXIT_CODES, verdict)) {
55
+ // VERIFIED_FOR_SCOPE is unreachable here by construction; refuse loudly.
56
+ throw new Error("sandbox verifier produced a verdict above its ceiling: " + verdict);
57
+ }
58
+ return EXIT_CODES[verdict];
59
+ }
60
+
61
+ function parseArgs(args) {
62
+ const opts = {
63
+ scenario: null, check: null, checkTimeoutMs: 30000, dir: null, json: false, keys: null, help: false, positional: [],
64
+ issuerKeys: null, requireExternalIssuer: [],
65
+ };
66
+ for (let i = 0; i < args.length; i += 1) {
67
+ const a = args[i];
68
+ const value = () => {
69
+ const v = args[i + 1];
70
+ if (v === undefined || v.startsWith("--")) throw new UsageError(a + " requires a value");
71
+ i += 1;
72
+ return v;
73
+ };
74
+ if (a === "--help" || a === "-h") opts.help = true;
75
+ else if (a === "--json") opts.json = true;
76
+ else if (a === "--scenario") opts.scenario = value();
77
+ else if (a === "--check") opts.check = value();
78
+ else if (a === "--check-timeout-ms") {
79
+ const n = Number(value());
80
+ if (!Number.isSafeInteger(n) || n < 1 || n > 600000) throw new UsageError("--check-timeout-ms must be an integer from 1 to 600000");
81
+ opts.checkTimeoutMs = n;
82
+ } else if (a === "--dir") opts.dir = value();
83
+ else if (a === "--keys") opts.keys = value();
84
+ else if (a === "--issuer-keys") opts.issuerKeys = value();
85
+ else if (a === "--require-external-issuer") opts.requireExternalIssuer.push(value());
86
+ else if (a.startsWith("--")) throw new UsageError("unknown option " + a);
87
+ else opts.positional.push(a);
88
+ }
89
+ return opts;
90
+ }
91
+
92
+ // Load a developer's read-only check module.
93
+ // export const expected = { status: "closed" }; // required: the state your action should produce
94
+ // export const resource = "ticket:1234"; // optional label for what is checked
95
+ // export default async function check({ resource, fields }) { return { status: ... }; }
96
+ export async function loadUserCheck(path, { cwd, timeoutMs }) {
97
+ const abs = isAbsolute(path) ? path : resolve(cwd, path);
98
+ let source;
99
+ try {
100
+ source = readFileSync(abs);
101
+ } catch {
102
+ throw new UsageError("--check: cannot read " + path);
103
+ }
104
+ // The module is loaded and run only inside a worker thread (check-runner.mjs).
105
+ const href = pathToFileURL(abs).href;
106
+ let mod;
107
+ try {
108
+ mod = await describeCheck(href, CHECK_LOAD_TIMEOUT_MS);
109
+ } catch (err) {
110
+ throw new UsageError("--check: cannot load " + path + ": " + (err && err.message ? err.message : err));
111
+ }
112
+ if (!mod.has_check) throw new UsageError("--check: module must export a default async function (or `check`) returning the observed state");
113
+ const read = (probe, { signal } = {}) => runCheckWorker({ href, mode: "read", probe, signal });
114
+ const expected = mod.expected;
115
+ if (expected === null || typeof expected !== "object" || Array.isArray(expected) || Object.keys(expected).length === 0
116
+ || !isCanonicalizable(expected)) {
117
+ throw new UsageError("--check: module must export `expected`, a non-empty plain object of JSON values (integers only) " +
118
+ "describing the state your action should produce");
119
+ }
120
+ const resource = mod.resource === null ? "user:" + basename(abs) : mod.resource;
121
+ if (typeof resource !== "string" || resource.length === 0 || resource.length > 200 || resource.endsWith("*")) {
122
+ throw new UsageError("--check: `resource` must be a non-empty string (max 200 chars, no trailing *)");
123
+ }
124
+ return {
125
+ read,
126
+ expected: JSON.parse(JSON.stringify(expected)),
127
+ resource,
128
+ checkModule: { file_name: basename(abs), sha256: sha256Hex(source) },
129
+ timeoutMs,
130
+ };
131
+ }
132
+
133
+ function writeJson(path, value, mode = 0o644) {
134
+ writeFileSync(path, JSON.stringify(value, null, 2) + "\n", { mode });
135
+ }
136
+
137
+ // Everything goes under <project>/.intentrax/local/, which ignores itself.
138
+ export function writeRunArtifacts(projectDir, result) {
139
+ const localDir = join(projectDir, LOCAL_DIR);
140
+ const runDir = join(localDir, "runs", result.bundle.bundle_id);
141
+ mkdirSync(runDir, { recursive: true });
142
+ writeFileSync(join(localDir, ".gitignore"), "# Intentrax local sandbox: ephemeral keys and local-only bundles. Never commit.\n*\n");
143
+ writeJson(join(localDir, "sandbox-signing-keys.json"), result.signingKeys, 0o600);
144
+ const paths = {
145
+ local_dir: localDir,
146
+ signing_keys: join(localDir, "sandbox-signing-keys.json"),
147
+ bundle: join(runDir, "bundle.json"),
148
+ key_set: join(runDir, "local-key-set.json"),
149
+ report: join(runDir, "verification-report.json"),
150
+ };
151
+ writeJson(paths.bundle, result.bundle);
152
+ writeJson(paths.key_set, result.keySet);
153
+ writeJson(paths.report, result.report);
154
+ return paths;
155
+ }
156
+
157
+ function pad(s, n) {
158
+ return (s + " ".repeat(n)).slice(0, Math.max(n, s.length));
159
+ }
160
+
161
+ function renderAssessments(report, out) {
162
+ for (const a of report.assessments) {
163
+ const prov = a.provenance ? " [" + a.provenance + "]" : "";
164
+ const why = a.reasons.length ? " " + a.reasons.slice(0, 3).join(", ") : "";
165
+ out(" " + pad(a.dimension, 22) + " " + pad(a.result, 22) + prov + why);
166
+ }
167
+ }
168
+
169
+ function renderVerdict(report, out) {
170
+ out("");
171
+ out("Verdict: " + report.verdict + " (profile " + report.assurance_profile + ")");
172
+ if (report.verdict !== report.uncapped_verdict) {
173
+ out(" Uncapped verdict " + report.uncapped_verdict + ", capped at " + report.verdict_ceiling +
174
+ " because every signer is a local, non-trust-bearing key.");
175
+ }
176
+ const result = (dim) => report.assessments.find((a) => a.dimension === dim)?.result;
177
+ if (report.verdict === VERDICTS.CONFLICTING_EVIDENCE && result("EFFECT_CONFIRMED") === "CONTRADICTED") {
178
+ out(" The signed decision said ALLOW and the executor reported success, but the independent read");
179
+ out(" disagrees with the authorised effect. A decision record alone would not have shown this.");
180
+ }
181
+ if (report.verdict === VERDICTS.CONFLICTING_EVIDENCE && result("EXTERNAL_AUTHORIZATION") === "CONTRADICTED") {
182
+ out(" A genuinely signed, bound external authorization decision DENIED this action while the local");
183
+ out(" decision said ALLOW. The external decision is evidence, not trust; the conflict is reported as such.");
184
+ }
185
+ out("");
186
+ out("Limitations:");
187
+ for (const l of report.limitations) out(" - " + l.code + ": " + l.text);
188
+ }
189
+
190
+ function rel(cwd, p) {
191
+ const r = relative(cwd, p);
192
+ return r && !r.startsWith("..") && !isAbsolute(r) ? r : p;
193
+ }
194
+
195
+ function usage(invokedAs) {
196
+ return [
197
+ "Usage:",
198
+ " " + invokedAs + " [--scenario confirmed|contradicted] [--dir <project>] [--json]",
199
+ " " + invokedAs + " --check ./my-check.mjs [--check-timeout-ms 30000] [--dir <project>] [--json]",
200
+ " " + invokedAs + " verify <bundle.json> [--keys <local-key-set.json>] [--json]",
201
+ " [--issuer-keys <pinned-external-issuers.json>] [--require-external-issuer <issuer>]...",
202
+ "",
203
+ "Scenarios (built-in sample action, " + SAMPLE_ACTION.description + "):",
204
+ ...Object.entries(SCENARIOS).map(([k, v]) => " " + pad(k, 13) + v),
205
+ "",
206
+ "--check runs YOUR read-only check after your action: export `expected` (the state the action",
207
+ "should produce) and a default async function returning the observed state. The sandbox never",
208
+ "calls your write path. A check you wrote is labelled SELF_REPORTED, not an authoritative read.",
209
+ "",
210
+ "verify --issuer-keys assesses third-party signed authorization decisions a bundle carries",
211
+ "(EXTERNAL_AUTHORIZATION, THIRD_PARTY_ATTESTED) against an issuer key set YOU pinned; nothing is",
212
+ "fetched. --require-external-issuer makes that issuer's decision required. Evidence, never trust.",
213
+ "",
214
+ "Exit codes: 0 LOCAL_NON_TRUST_BEARING · 10 PENDING_FINALITY · 11 INSUFFICIENT_EVIDENCE ·",
215
+ "12 CONFLICTING_EVIDENCE · 13 INTEGRITY_ONLY · 14 VERIFICATION_FAILED · 64 usage",
216
+ ].join("\n");
217
+ }
218
+
219
+ async function runCommand(opts, { out, cwd, now, invokedAs }) {
220
+ if (opts.positional.length) throw new UsageError("unexpected argument " + opts.positional[0]);
221
+ if (opts.keys) throw new UsageError("--keys applies to `verify` only");
222
+ if (opts.issuerKeys || opts.requireExternalIssuer.length) {
223
+ throw new UsageError("--issuer-keys and --require-external-issuer apply to `verify` only");
224
+ }
225
+ if (opts.check && opts.scenario) throw new UsageError("--scenario applies to the built-in sample only; it cannot be combined with --check");
226
+ const scenario = opts.scenario ?? "confirmed";
227
+ if (!Object.prototype.hasOwnProperty.call(SCENARIOS, scenario)) {
228
+ throw new UsageError("unknown --scenario " + scenario + " (expected: " + Object.keys(SCENARIOS).join(", ") + ")");
229
+ }
230
+ const userCheck = opts.check ? await loadUserCheck(opts.check, { cwd, timeoutMs: opts.checkTimeoutMs }) : null;
231
+ const result = await runSandbox({ scenario, userCheck, now: now ?? new Date() });
232
+ const projectDir = opts.dir ? resolve(cwd, opts.dir) : cwd;
233
+ const paths = writeRunArtifacts(projectDir, result);
234
+ const report = result.report;
235
+ const reverify = invokedAs + " verify " + rel(cwd, paths.bundle) + " --keys " + rel(cwd, paths.key_set);
236
+
237
+ if (opts.json) {
238
+ out(JSON.stringify({
239
+ banner: BANNER.filter((l) => !l.startsWith("=")).map((l) => l.trim()).join(" "),
240
+ environment: "local",
241
+ trust_bearing: false,
242
+ production_assurance: false,
243
+ run_id: result.run_id,
244
+ scenario: result.scenario,
245
+ action: result.action,
246
+ facts: result.facts,
247
+ keys: result.keys,
248
+ files: Object.fromEntries(Object.entries(paths).map(([k, v]) => [k, rel(cwd, v)])),
249
+ reverify,
250
+ report,
251
+ }, null, 2));
252
+ return exitCodeFor(report.verdict);
253
+ }
254
+
255
+ const f = result.facts;
256
+ const effect = report.assessments.find((a) => a.dimension === "EFFECT_CONFIRMED");
257
+ const observed = report.assessments.find((a) => a.dimension === "EFFECT_OBSERVED");
258
+ BANNER.forEach((l) => out(l));
259
+ out("");
260
+ out("Scenario: " + result.scenario + (result.scenario === "user-check" ? "" : " (" + SCENARIOS[result.scenario] + ")"));
261
+ out("Action: " + result.action.description);
262
+ out(" SetState " + result.action.resource + " -> " + JSON.stringify(result.action.authorised_state));
263
+ out("");
264
+ out(" 1. Decision " + f.decision_outcome + ", signed before execution by " + result.keys.DECISION_SERVICE);
265
+ out(" 2. Executor report " + f.executor_report_status + " (self-reported by " + result.keys.EXECUTOR + ")" +
266
+ (f.synthetic_store_writes === null ? "; the sandbox did not call your system" : "; writes reaching the store: " + f.synthetic_store_writes));
267
+ out(" 3. Independent read " + (f.read_status === "OK" ? JSON.stringify(f.observed_state) : f.read_status + (f.read_error ? " (" + f.read_error + ")" : "")));
268
+ out(" read by " + result.keys.EFFECT_VERIFIER + " via " +
269
+ (f.read_kind === "USER_SUPPLIED_CHECK" ? "your check module (provenance SELF_REPORTED: you wrote the check)"
270
+ : "the sandbox's synthetic store (provenance THIRD_PARTY_ATTESTED by the local effect-verifier key)"));
271
+ out(" EFFECT_CONFIRMED = " + effect.result + " EFFECT_OBSERVED = " + observed.result);
272
+ out(" 4. Sealed bundle " + rel(cwd, paths.bundle));
273
+ out(" 5. Offline verify 8 dimensions, local key set " + rel(cwd, paths.key_set));
274
+ renderAssessments(report, out);
275
+ renderVerdict(report, out);
276
+ out("");
277
+ out("Re-verify offline: " + reverify);
278
+ out("Ephemeral private keys: " + rel(cwd, paths.signing_keys) + " (gitignored; not trust-bearing)");
279
+ return exitCodeFor(report.verdict);
280
+ }
281
+
282
+ function verifyCommand(opts, { out, cwd }) {
283
+ const [bundlePath, ...extra] = opts.positional;
284
+ if (!bundlePath || extra.length) throw new UsageError("verify requires exactly one bundle path");
285
+ if (opts.check || opts.scenario || opts.dir) {
286
+ throw new UsageError("verify takes only <bundle.json>, --keys, --issuer-keys, --require-external-issuer and --json");
287
+ }
288
+ let bundle;
289
+ try {
290
+ bundle = JSON.parse(readFileSync(resolve(cwd, bundlePath), "utf8"));
291
+ } catch {
292
+ throw new UsageError("cannot read bundle JSON from " + bundlePath);
293
+ }
294
+ let pinned = null;
295
+ if (opts.keys) {
296
+ let doc;
297
+ try {
298
+ doc = JSON.parse(readFileSync(resolve(cwd, opts.keys), "utf8"));
299
+ } catch {
300
+ throw new UsageError("cannot read key set JSON from " + opts.keys);
301
+ }
302
+ try {
303
+ pinned = loadLocalKeySet(doc);
304
+ } catch (err) {
305
+ if (err instanceof LocalKeySetError) throw new UsageError("--keys: " + err.message);
306
+ throw err;
307
+ }
308
+ }
309
+ let issuerKeys = null;
310
+ if (opts.issuerKeys) {
311
+ let doc;
312
+ try {
313
+ doc = JSON.parse(readFileSync(resolve(cwd, opts.issuerKeys), "utf8"));
314
+ } catch {
315
+ throw new UsageError("cannot read issuer key set JSON from " + opts.issuerKeys);
316
+ }
317
+ try {
318
+ issuerKeys = loadPinnedIssuerKeySet(doc);
319
+ } catch (err) {
320
+ if (err instanceof IssuerKeySetError) throw new UsageError("--issuer-keys: " + err.message);
321
+ throw err;
322
+ }
323
+ }
324
+ const report = verifyLocalBundle(bundle, { pinned, issuerKeys, externalAuthorizationIssuers: opts.requireExternalIssuer });
325
+ if (opts.json) {
326
+ out(JSON.stringify(report, null, 2));
327
+ return exitCodeFor(report.verdict);
328
+ }
329
+ BANNER.forEach((l) => out(l));
330
+ out("");
331
+ out("Bundle: " + bundlePath + (pinned ? "" : " (no --keys: signer authenticity cannot be assessed)"));
332
+ renderAssessments(report, out);
333
+ renderVerdict(report, out);
334
+ return exitCodeFor(report.verdict);
335
+ }
336
+
337
+ export async function sandboxMain(argv, {
338
+ stdout = process.stdout,
339
+ stderr = process.stderr,
340
+ cwd = process.cwd(),
341
+ now = null,
342
+ invokedAs = "intentrax sandbox",
343
+ } = {}) {
344
+ const out = (line) => stdout.write(line + "\n");
345
+ const err = (line) => stderr.write(line + "\n");
346
+ try {
347
+ const isVerify = argv[0] === "verify";
348
+ const opts = parseArgs(isVerify ? argv.slice(1) : argv);
349
+ if (opts.help) {
350
+ out(usage(invokedAs));
351
+ return 0;
352
+ }
353
+ return isVerify ? verifyCommand(opts, { out, cwd }) : await runCommand(opts, { out, cwd, now, invokedAs });
354
+ } catch (e) {
355
+ if (e instanceof UsageError || (e && /--scenario|unknown scenario/.test(e.message))) {
356
+ err("intentrax sandbox: " + e.message);
357
+ err(usage(invokedAs));
358
+ return USAGE_EXIT_CODE;
359
+ }
360
+ throw e;
361
+ }
362
+ }
363
+
364
+ function invokedDirectly() {
365
+ if (!process.argv[1]) return false;
366
+ try {
367
+ return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url));
368
+ } catch {
369
+ return false;
370
+ }
371
+ }
372
+
373
+ if (invokedDirectly()) {
374
+ const self = rel(process.cwd(), fileURLToPath(import.meta.url));
375
+ process.exitCode = await sandboxMain(process.argv.slice(2), { invokedAs: "node " + JSON.stringify(self) });
376
+ }