fix(workflow): isolate local scripts in bounded QuickJS runtime
This commit is contained in:
1 parent
fac81b08e8
commit
2844fd49dd
7 files changed
+771
-696
No files matched your search
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bun
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtempSync, rmSync } from "node:fs";
|
||||
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { resolve, join } from "node:path";
|
||||
import { spawnSync } from "node:child_process";
|
||||
@@ -23,6 +23,11 @@ try {
|
||||
const version = spawnSync(command, [...prefix, ...(plugin ? ["--hose-use-cli"] : []), "version", "--json"], { cwd, env, encoding: "utf8", timeout: 5000 });
|
||||
assert.equal(version.status, 0, version.stderr);
|
||||
assert.ok(JSON.parse(version.stdout).version);
|
||||
writeFileSync(join(cwd, "smoke.json"), JSON.stringify({ id: "smoke", name: "Smoke", source: "manual", credentials: { accessToken: "fixture", corpId: "smoke", staffId: "smoke:staff" } }));
|
||||
const sandbox = spawnSync(command, [...prefix, ...(plugin ? ["--hose-use-cli"] : []), "workflow", "eval-script", "--code", 'return { total: items.reduce((a, b) => a + b, 0), host: typeof process };', "--input", '{"items":[1,2,3]}', "--corp", "smoke"], { cwd, env, encoding: "utf8", timeout: 5000 });
|
||||
assert.equal(sandbox.status, 0, sandbox.stderr);
|
||||
assert.match(sandbox.stdout, /"total": 6/);
|
||||
assert.match(sandbox.stdout, /"host": "undefined"/);
|
||||
await client.connect(transport, { timeout: 5000 });
|
||||
const tools = await client.listTools();
|
||||
assert.deepEqual(tools.tools.map(tool => tool.name), ["hose_cli"]);
|
||||
|
||||
Reference in new issue
Block a user