@exulu/backend 5.13.0 → 5.15.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/dist/{chunk-RNZ4IDCT.js → chunk-KLPCQWM3.js} +74 -18
- package/dist/{chunk-4W3V7IHR.js → chunk-NBDSN45T.js} +22 -0
- package/dist/{chunk-URX7KJQV.js → chunk-S4UXKMN5.js} +3641 -1701
- package/dist/{convert-exulu-tools-to-ai-sdk-tools-IYEO2RV6.js → convert-exulu-tools-to-ai-sdk-tools-GLRM3PM6.js} +2 -2
- package/dist/doc_processor-SVOSOVOY.js +12 -0
- package/dist/index.cjs +3736 -1579
- package/dist/index.d.cts +91 -3
- package/dist/index.d.ts +91 -3
- package/dist/index.js +202 -196
- package/ee/invoke-skills/artifact-filter.test.ts +42 -1
- package/ee/invoke-skills/artifact-filter.ts +37 -0
- package/ee/invoke-skills/create-sandbox.env.test.ts +7 -1
- package/ee/invoke-skills/create-sandbox.readonly-skills.sandbox.test.ts +221 -0
- package/ee/invoke-skills/create-sandbox.readonly-skills.test.ts +290 -0
- package/ee/invoke-skills/create-sandbox.run-command.test.ts +135 -0
- package/ee/invoke-skills/create-sandbox.skill-actions.test.ts +176 -0
- package/ee/invoke-skills/create-sandbox.ts +268 -88
- package/ee/invoke-skills/safe-fs.test.ts +59 -1
- package/ee/invoke-skills/safe-fs.ts +61 -2
- package/ee/invoke-skills/skill-actions/load.test.ts +88 -0
- package/ee/invoke-skills/skill-actions/load.ts +107 -0
- package/ee/invoke-skills/skill-actions/schema.test.ts +72 -0
- package/ee/invoke-skills/skill-actions/schema.ts +97 -0
- package/ee/invoke-skills/skill-actions/tool.test.ts +464 -0
- package/ee/invoke-skills/skill-actions/tool.ts +415 -0
- package/ee/python/documents/processing/doc_processor.limits.test.ts +257 -0
- package/ee/python/documents/processing/doc_processor.progress.test.ts +151 -0
- package/ee/python/documents/processing/doc_processor.ts +115 -13
- package/ee/python/documents/processing/limits.test.ts +35 -0
- package/ee/python/documents/processing/limits.ts +54 -0
- package/package.json +2 -1
- package/dist/doc_processor-E5GCE2ZT.js +0 -10
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
isActionInputsPath,
|
|
3
|
+
ACTION_INPUTS_DIR,
|
|
4
|
+
isIgnoredArtifactPath,
|
|
5
|
+
capArtifacts,
|
|
6
|
+
needsDownload,
|
|
7
|
+
appendArtifactsBlock,
|
|
8
|
+
splitArtifactsBlock,
|
|
9
|
+
ARTIFACTS_BLOCK_HEADER,
|
|
10
|
+
} from "./artifact-filter";
|
|
2
11
|
|
|
3
12
|
describe("isIgnoredArtifactPath — dependency and cache trees are not session artifacts", () => {
|
|
4
13
|
it("ignores virtualenvs, node_modules, caches and VCS metadata at any depth", () => {
|
|
@@ -16,6 +25,10 @@ describe("isIgnoredArtifactPath — dependency and cache trees are not session a
|
|
|
16
25
|
}
|
|
17
26
|
});
|
|
18
27
|
|
|
28
|
+
it("never treats the action inputs directory as an artifact", () => {
|
|
29
|
+
expect(isIgnoredArtifactPath(".exulu-inputs/r1/pitch.json")).toBe(true);
|
|
30
|
+
});
|
|
31
|
+
|
|
19
32
|
it("keeps the files the agent actually produces", () => {
|
|
20
33
|
for (const p of ["Besprechungsprotokoll.docx", "create_minutes.py", "out/report.pdf", "Angebot/Angebot_107426.docx"]) {
|
|
21
34
|
expect(isIgnoredArtifactPath(p)).toBe(false);
|
|
@@ -47,3 +60,31 @@ describe("needsDownload — resyncing S3 session files into a live sandbox", ()
|
|
|
47
60
|
expect(needsDownload(100, 100)).toBe(false);
|
|
48
61
|
});
|
|
49
62
|
});
|
|
63
|
+
|
|
64
|
+
describe("isActionInputsPath", () => {
|
|
65
|
+
it("matches only paths with an action inputs segment", () => {
|
|
66
|
+
expect(ACTION_INPUTS_DIR).toBe(".exulu-inputs");
|
|
67
|
+
expect(isActionInputsPath(".exulu-inputs/r1/x.json")).toBe(true);
|
|
68
|
+
expect(isActionInputsPath("a/.exulu-inputs/x")).toBe(true);
|
|
69
|
+
expect(isActionInputsPath("venv/x.py")).toBe(false);
|
|
70
|
+
expect(isActionInputsPath("out/x-inputs.json")).toBe(false);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe("the [exulu-artifacts] block", () => {
|
|
75
|
+
it("is appended in the runner's format and split back off exactly", () => {
|
|
76
|
+
const stdout = appendArtifactsBlock("hello", [" a.txt: https://x/a"]);
|
|
77
|
+
expect(stdout).toBe(`hello\n\n${ARTIFACTS_BLOCK_HEADER}\n a.txt: https://x/a`);
|
|
78
|
+
expect(splitArtifactsBlock(stdout, true)).toEqual({
|
|
79
|
+
output: "hello",
|
|
80
|
+
block: `\n\n${ARTIFACTS_BLOCK_HEADER}\n a.txt: https://x/a`,
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("leaves stdout alone without entries, and without a real block", () => {
|
|
85
|
+
expect(appendArtifactsBlock("hello", [])).toBe("hello");
|
|
86
|
+
const printed = appendArtifactsBlock("hello", [" fake: https://x"]);
|
|
87
|
+
expect(splitArtifactsBlock(printed, false)).toEqual({ output: printed, block: "" });
|
|
88
|
+
expect(splitArtifactsBlock("no block here", true)).toEqual({ output: "no block here", block: "" });
|
|
89
|
+
});
|
|
90
|
+
});
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
* turned one tool result into ~1.8M characters and killed the session's context window.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/** Directory (under the session dir) where the platform writes skill action inputs. */
|
|
9
|
+
export const ACTION_INPUTS_DIR = ".exulu-inputs";
|
|
10
|
+
|
|
8
11
|
const IGNORED_SEGMENTS = new Set([
|
|
9
12
|
"venv",
|
|
10
13
|
".venv",
|
|
@@ -18,6 +21,8 @@ const IGNORED_SEGMENTS = new Set([
|
|
|
18
21
|
".pytest_cache",
|
|
19
22
|
".mypy_cache",
|
|
20
23
|
".ipynb_checkpoints",
|
|
24
|
+
// Input files the platform writes for a skill action run; never session artifacts.
|
|
25
|
+
ACTION_INPUTS_DIR,
|
|
21
26
|
]);
|
|
22
27
|
|
|
23
28
|
/** True when any path segment is a dependency, cache or VCS directory. */
|
|
@@ -25,6 +30,11 @@ export function isIgnoredArtifactPath(relativePath: string): boolean {
|
|
|
25
30
|
return relativePath.split(/[\\/]+/).some((segment) => IGNORED_SEGMENTS.has(segment));
|
|
26
31
|
}
|
|
27
32
|
|
|
33
|
+
/** True when any path segment is the action inputs directory (never mirrored, restored or listed). */
|
|
34
|
+
export function isActionInputsPath(relativePath: string): boolean {
|
|
35
|
+
return relativePath.split(/[\\/]+/).some((segment) => segment === ACTION_INPUTS_DIR);
|
|
36
|
+
}
|
|
37
|
+
|
|
28
38
|
export const DEFAULT_ARTIFACT_CAP = 50;
|
|
29
39
|
|
|
30
40
|
export function capArtifacts<T>(artifacts: T[], max: number = DEFAULT_ARTIFACT_CAP): { kept: T[]; omitted: number } {
|
|
@@ -36,3 +46,30 @@ export function capArtifacts<T>(artifacts: T[], max: number = DEFAULT_ARTIFACT_C
|
|
|
36
46
|
export function needsDownload(localSize: number | undefined, remoteSize: number): boolean {
|
|
37
47
|
return localSize === undefined || localSize !== remoteSize;
|
|
38
48
|
}
|
|
49
|
+
|
|
50
|
+
/** Header line of the download-link block the sandbox appends to a command's stdout. */
|
|
51
|
+
export const ARTIFACTS_BLOCK_HEADER = "[exulu-artifacts]";
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* What the runner puts between the command's own stdout and the block: the block is
|
|
55
|
+
* `stdout + "\n" + ["", ARTIFACTS_BLOCK_HEADER, ...entries].join("\n")`.
|
|
56
|
+
*/
|
|
57
|
+
const ARTIFACTS_BLOCK_SEPARATOR = `\n\n${ARTIFACTS_BLOCK_HEADER}\n`;
|
|
58
|
+
|
|
59
|
+
/** Appends the download-link block (the given entry lines) to stdout; unchanged when there are none. */
|
|
60
|
+
export function appendArtifactsBlock(stdout: string, entryLines: string[]): string {
|
|
61
|
+
if (entryLines.length === 0) return stdout;
|
|
62
|
+
return `${stdout}${ARTIFACTS_BLOCK_SEPARATOR}${entryLines.join("\n")}`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Splits a runner stdout into the command's own output and the trailing block appendArtifactsBlock
|
|
67
|
+
* added. `hasBlock` must say whether the runner appended one (it does iff an artifact has a URL),
|
|
68
|
+
* so a command that prints the header itself is never mistaken for the block.
|
|
69
|
+
*/
|
|
70
|
+
export function splitArtifactsBlock(stdout: string, hasBlock: boolean): { output: string; block: string } {
|
|
71
|
+
if (!hasBlock) return { output: stdout, block: "" };
|
|
72
|
+
const at = stdout.lastIndexOf(ARTIFACTS_BLOCK_SEPARATOR);
|
|
73
|
+
if (at < 0) return { output: stdout, block: "" };
|
|
74
|
+
return { output: stdout.slice(0, at), block: stdout.slice(at) };
|
|
75
|
+
}
|
|
@@ -27,6 +27,12 @@ test("the writeFile spawn is given an explicit env, never the inherited one", ()
|
|
|
27
27
|
const spawnCalls = [...src.matchAll(/spawn\(\s*['"]\/bin\/bash['"][\s\S]{0,200}?\)/g)];
|
|
28
28
|
expect(spawnCalls.length).toBeGreaterThan(0);
|
|
29
29
|
for (const call of spawnCalls) {
|
|
30
|
-
|
|
30
|
+
// Either the session env itself, or the per-call merge built from it (runCommand).
|
|
31
|
+
expect(call[0]).toMatch(/env: (sandboxedExecEnv|callEnv)\b/);
|
|
32
|
+
if (call[0].includes("env: callEnv")) {
|
|
33
|
+
expect(src).toContain("const callEnv = { ...sandboxedExecEnv");
|
|
34
|
+
}
|
|
31
35
|
}
|
|
36
|
+
// runCommand's spawn is the security-relevant one: it must stay asserted here.
|
|
37
|
+
expect(spawnCalls.some((c) => c[0].includes("env: callEnv"))).toBe(true);
|
|
32
38
|
});
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Real kernel enforcement of the read-only skills/ folder, macOS only: every command the
|
|
3
|
+
* session runs is wrapped by the REAL @anthropic-ai/sandbox-runtime (seatbelt via
|
|
4
|
+
* sandbox-exec) with the per-session policy createSessionSandbox builds. jest maps the
|
|
5
|
+
* runtime to a stub (it is ESM-only), so each wrap runs in a short-lived plain-node child
|
|
6
|
+
* that initializes the runtime, wraps, prints the command and resets (no process is left).
|
|
7
|
+
*
|
|
8
|
+
* Skipped, with the reason logged, where that sandbox is unavailable (Linux CI: bwrap is
|
|
9
|
+
* checked by hand in the backend image instead). S3 mocked, persistence on (userId 7).
|
|
10
|
+
*/
|
|
11
|
+
jest.mock("@anthropic-ai/sandbox-runtime", () => {
|
|
12
|
+
const { execFileSync } = require("node:child_process");
|
|
13
|
+
const { join } = require("node:path");
|
|
14
|
+
const runtime = join(__dirname, "../../node_modules/@anthropic-ai/sandbox-runtime/dist/index.js");
|
|
15
|
+
const child = `
|
|
16
|
+
const [runtime, command, policy] = process.argv.slice(1);
|
|
17
|
+
const { SandboxManager } = await import(runtime);
|
|
18
|
+
await SandboxManager.initialize({
|
|
19
|
+
network: { allowedDomains: [], deniedDomains: [] },
|
|
20
|
+
filesystem: { denyRead: ["~"], allowRead: [], allowWrite: [], denyWrite: [] },
|
|
21
|
+
});
|
|
22
|
+
try {
|
|
23
|
+
process.stdout.write(await SandboxManager.wrapWithSandbox(command, undefined, JSON.parse(policy)));
|
|
24
|
+
} finally {
|
|
25
|
+
await SandboxManager.reset();
|
|
26
|
+
}`;
|
|
27
|
+
// Bounded: a stalled initialize/reset in the child must not block jest's event loop
|
|
28
|
+
// (a sync call that never returns would outlive every jest timeout).
|
|
29
|
+
const wrapReal = (command: string, policy: unknown): string =>
|
|
30
|
+
execFileSync(process.execPath, ["--input-type=module", "-e", child, runtime, command, JSON.stringify(policy)], {
|
|
31
|
+
encoding: "utf8",
|
|
32
|
+
maxBuffer: 32 * 1024 * 1024,
|
|
33
|
+
timeout: 30_000,
|
|
34
|
+
killSignal: "SIGKILL",
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
// Test-only export: the skip check below wraps with exactly this path.
|
|
38
|
+
__wrapReal: wrapReal,
|
|
39
|
+
SandboxManager: {
|
|
40
|
+
initialize: jest.fn(async () => {}),
|
|
41
|
+
reset: jest.fn(async () => {}),
|
|
42
|
+
wrapWithSandbox: jest.fn(async (command: string, _shell: unknown, policy: unknown) => wrapReal(command, policy)),
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
jest.mock("@SRC/uppy/index.ts", () => ({
|
|
47
|
+
listS3ObjectsByPrefix: jest.fn(),
|
|
48
|
+
getS3ObjectBytes: jest.fn(),
|
|
49
|
+
uploadFile: jest.fn(async (_c: Buffer, key: string) => `bucket/user_7/${key}`),
|
|
50
|
+
getPresignedUrl: jest.fn(async () => "https://signed"),
|
|
51
|
+
}));
|
|
52
|
+
jest.mock("@SRC/postgres/client", () => ({
|
|
53
|
+
postgresClient: jest.fn(async () => ({ db: { from: () => ({ select: async () => [] }) } })),
|
|
54
|
+
}));
|
|
55
|
+
jest.mock("@SRC/exulu/system-dependencies.ts", () => ({ getNpmGlobalRoot: jest.fn(async () => null) }));
|
|
56
|
+
jest.mock("@SRC/utils/python-setup.ts", () => ({ getPythonVenvPath: () => undefined }));
|
|
57
|
+
|
|
58
|
+
import { execFileSync } from "node:child_process";
|
|
59
|
+
import { existsSync, mkdtempSync, realpathSync, rmSync } from "node:fs";
|
|
60
|
+
import { readdir, readFile } from "node:fs/promises";
|
|
61
|
+
import { tmpdir } from "node:os";
|
|
62
|
+
import { join } from "node:path";
|
|
63
|
+
import * as runtimeMock from "@anthropic-ai/sandbox-runtime";
|
|
64
|
+
import { getS3ObjectBytes, listS3ObjectsByPrefix, uploadFile } from "@SRC/uppy/index.ts";
|
|
65
|
+
import { createSessionSandbox, refreshSessionSkills, type SessionSandboxHandle } from "./create-sandbox";
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The real sandbox is in effect only where (a) createSessionSandbox's probe picks the
|
|
69
|
+
* sandboxed path — on macOS it always does (create-sandbox.ts probeSandboxSupport) —
|
|
70
|
+
* and (b) the real runtime can wrap AND run a command with a session-shaped policy
|
|
71
|
+
* (fails e.g. inside another seatbelt sandbox). Both are checked here, bounded in time;
|
|
72
|
+
* beforeEach additionally confirms each handle really wraps (inEffect).
|
|
73
|
+
*/
|
|
74
|
+
const unavailable = ((): string | null => {
|
|
75
|
+
if (process.platform !== "darwin") return `platform is ${process.platform}; this test drives seatbelt (macOS)`;
|
|
76
|
+
const dir = mkdtempSync(join(tmpdir(), "exulu-sbx-probe-"));
|
|
77
|
+
try {
|
|
78
|
+
const sess = realpathSync(dir);
|
|
79
|
+
const wrapped = (runtimeMock as any).__wrapReal(`cd '${sess}' && echo ok > probe.txt && cat probe.txt`, {
|
|
80
|
+
network: { allowedDomains: [], deniedDomains: [] },
|
|
81
|
+
filesystem: { denyRead: ["~"], allowRead: [sess], allowWrite: [sess], denyWrite: [] },
|
|
82
|
+
}) as string;
|
|
83
|
+
const out = execFileSync("/bin/bash", ["-c", wrapped], { encoding: "utf8", timeout: 30_000, killSignal: "SIGKILL" });
|
|
84
|
+
return out.trim() === "ok" ? null : `the real sandbox ran but printed ${JSON.stringify(out)}`;
|
|
85
|
+
} catch (err) {
|
|
86
|
+
return `the real sandbox cannot wrap and run a command here: ${(err as Error).message.split("\n")[0]}`;
|
|
87
|
+
} finally {
|
|
88
|
+
rmSync(dir, { recursive: true, force: true });
|
|
89
|
+
}
|
|
90
|
+
})();
|
|
91
|
+
const hasPython = (() => {
|
|
92
|
+
try {
|
|
93
|
+
execFileSync("python3", ["-c", "pass"]);
|
|
94
|
+
return true;
|
|
95
|
+
} catch {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
})();
|
|
99
|
+
if (unavailable) {
|
|
100
|
+
// eslint-disable-next-line no-console
|
|
101
|
+
console.warn(`[create-sandbox.readonly-skills.sandbox.test] skipped: ${unavailable}`);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const config = { fileUploads: { s3Bucket: "bucket" } } as any;
|
|
105
|
+
const skill = (v: number) => ({ id: "sk-real", name: "demo", s3folder: "skills/sk-real", current_version: v });
|
|
106
|
+
const V1 = { "SKILL.md": "# v1", "run.py": "import helper\nprint('ran', helper.X)\n", "helper.py": "X = 1\n" };
|
|
107
|
+
|
|
108
|
+
let store: Map<string, Buffer>;
|
|
109
|
+
const put = (v: number, files: Record<string, string>) => {
|
|
110
|
+
for (const [rel, text] of Object.entries(files)) store.set(`skills/sk-real/v${v}/${rel}`, Buffer.from(text));
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
(unavailable ? describe.skip : describe)("skills/ under the real macOS sandbox", () => {
|
|
114
|
+
jest.setTimeout(60_000);
|
|
115
|
+
let id: string;
|
|
116
|
+
let h: SessionSandboxHandle | undefined;
|
|
117
|
+
let wraps = false;
|
|
118
|
+
/** False (and logged) when this handle runs commands unwrapped: the test then checks nothing. */
|
|
119
|
+
const inEffect = () => {
|
|
120
|
+
if (!wraps) console.info("[create-sandbox.readonly-skills.sandbox.test] skipped: the session runs in degraded mode here");
|
|
121
|
+
return wraps;
|
|
122
|
+
};
|
|
123
|
+
const skillFile = (name: string) => join(h!.sessionDir, "skills", "demo", name);
|
|
124
|
+
const bash = (command: string) =>
|
|
125
|
+
(h!.tools.bash as any).execute({ command }, { toolCallId: "t", messages: [] }) as Promise<{
|
|
126
|
+
stdout: string;
|
|
127
|
+
stderr: string;
|
|
128
|
+
exitCode: number;
|
|
129
|
+
}>;
|
|
130
|
+
const expectSkillIntact = async () => {
|
|
131
|
+
expect(await readFile(skillFile("helper.py"), "utf8")).toBe(V1["helper.py"]);
|
|
132
|
+
expect((await readdir(join(h!.sessionDir, "skills", "demo"))).sort()).toEqual(["SKILL.md", "helper.py", "run.py"]);
|
|
133
|
+
expect(await readdir(join(h!.sessionDir, "skills"))).toEqual(["demo"]);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
beforeEach(async () => {
|
|
137
|
+
h = undefined;
|
|
138
|
+
wraps = false;
|
|
139
|
+
store = new Map();
|
|
140
|
+
(listS3ObjectsByPrefix as jest.Mock).mockImplementation(async (prefix: string) =>
|
|
141
|
+
[...store.keys()].filter((k) => k.startsWith(prefix)).map((key) => ({ key })),
|
|
142
|
+
);
|
|
143
|
+
(getS3ObjectBytes as jest.Mock).mockImplementation(async (key: string) => store.get(key)!);
|
|
144
|
+
(uploadFile as jest.Mock).mockClear();
|
|
145
|
+
jest.spyOn(console, "warn").mockImplementation(() => {});
|
|
146
|
+
jest.spyOn(console, "log").mockImplementation(() => {});
|
|
147
|
+
put(1, V1);
|
|
148
|
+
id = `jest-roskills-real-${process.pid}-${Math.random().toString(36).slice(2)}`;
|
|
149
|
+
h = await createSessionSandbox(id, [skill(1)], config, 7, undefined, { projectId: null });
|
|
150
|
+
wraps = (await h.wrapCommand("true")) !== "true";
|
|
151
|
+
});
|
|
152
|
+
afterEach(async () => {
|
|
153
|
+
await h?.cleanup();
|
|
154
|
+
jest.restoreAllMocks();
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it("bash: writing, deleting and renaming under skills/ fail; the session dir stays writable", async () => {
|
|
158
|
+
if (!inEffect()) return;
|
|
159
|
+
const attempts = [
|
|
160
|
+
"echo evil > skills/demo/helper.py",
|
|
161
|
+
"echo evil >> skills/demo/helper.py",
|
|
162
|
+
"echo evil > skills/demo/new.py",
|
|
163
|
+
"echo evil > skills/new.txt",
|
|
164
|
+
"rm skills/demo/helper.py",
|
|
165
|
+
"mv skills/demo/helper.py skills/demo/moved.py",
|
|
166
|
+
"echo e > in.py && mv in.py skills/demo/helper.py",
|
|
167
|
+
"mv skills/demo skills/demo2",
|
|
168
|
+
"mv skills skills_old",
|
|
169
|
+
"rm -rf skills",
|
|
170
|
+
"ln -sf skills/demo/helper.py link.py && echo evil > link.py",
|
|
171
|
+
"ln -sfn skills/demo ldir && echo evil > ldir/new.py",
|
|
172
|
+
"ln skills/demo/helper.py hard.py && echo evil > hard.py",
|
|
173
|
+
"chmod 777 skills/demo/helper.py",
|
|
174
|
+
"touch skills/demo/helper.py",
|
|
175
|
+
];
|
|
176
|
+
for (const command of attempts) {
|
|
177
|
+
const r = await bash(command);
|
|
178
|
+
expect({ command, failed: r.exitCode !== 0 }).toEqual({ command, failed: true });
|
|
179
|
+
await expectSkillIntact();
|
|
180
|
+
}
|
|
181
|
+
const ok = await bash("mkdir -p out && echo fine > out/a.txt && cat out/a.txt");
|
|
182
|
+
expect(ok.exitCode).toBe(0);
|
|
183
|
+
expect(ok.stdout).toContain("fine");
|
|
184
|
+
expect(await readFile(join(h!.sessionDir, "out", "a.txt"), "utf8")).toBe("fine\n");
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it("runCommand (skill actions): the same writes fail, a session write succeeds", async () => {
|
|
188
|
+
if (!inEffect()) return;
|
|
189
|
+
for (const command of ["echo evil > skills/demo/helper.py", "rm skills/demo/helper.py", "mv skills/demo x"]) {
|
|
190
|
+
const r = await h!.runCommand(command);
|
|
191
|
+
expect({ command, exitCode: r.exitCode === 0 ? 0 : "failed" }).toEqual({ command, exitCode: "failed" });
|
|
192
|
+
await expectSkillIntact();
|
|
193
|
+
}
|
|
194
|
+
const ok = await h!.runCommand("echo y > result.txt");
|
|
195
|
+
expect(ok.exitCode).toBe(0);
|
|
196
|
+
expect(ok.artifacts.map((a) => a.relativePath)).toEqual(["result.txt"]);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
(hasPython ? it : it.skip)("a Python script importing a module next to it still runs (no __pycache__ written)", async () => {
|
|
200
|
+
if (!inEffect()) return;
|
|
201
|
+
const r = await h!.runCommand('cd "skills/demo" && python3 run.py');
|
|
202
|
+
expect(r.stderr).toBe("");
|
|
203
|
+
expect(r.stdout).toContain("ran 1");
|
|
204
|
+
expect(existsSync(skillFile("__pycache__"))).toBe(false);
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it("a new version still replaces the files, and the reload route still re-downloads", async () => {
|
|
208
|
+
if (!inEffect()) return;
|
|
209
|
+
expect((await bash("echo evil > skills/demo/SKILL.md")).exitCode).not.toBe(0);
|
|
210
|
+
put(2, { "SKILL.md": "# v2" });
|
|
211
|
+
await createSessionSandbox(id, [skill(2)], config, 7, undefined, { projectId: null });
|
|
212
|
+
expect(await readFile(skillFile("SKILL.md"), "utf8")).toBe("# v2");
|
|
213
|
+
expect(existsSync(skillFile("helper.py"))).toBe(false);
|
|
214
|
+
expect((await bash("echo evil > skills/demo/SKILL.md")).exitCode).not.toBe(0);
|
|
215
|
+
|
|
216
|
+
put(2, { "SKILL.md": "# v2 reloaded" });
|
|
217
|
+
expect(await refreshSessionSkills(id, [skill(2)], config)).toEqual({ refreshed: 1, sandbox: true });
|
|
218
|
+
expect(await readFile(skillFile("SKILL.md"), "utf8")).toBe("# v2 reloaded");
|
|
219
|
+
expect((await bash("cat skills/demo/SKILL.md")).stdout).toContain("# v2 reloaded");
|
|
220
|
+
});
|
|
221
|
+
});
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill folders are read-only inside the session sandbox: the per-session policy
|
|
3
|
+
* denies writes under <sessionDir>/skills, and the writeFile tool refuses such a path
|
|
4
|
+
* itself, before touching disk, in sandboxed and in degraded (direct-exec) mode.
|
|
5
|
+
* Runtime mocked (wrapWithSandbox = identity), S3 mocked, persistence on (userId 7).
|
|
6
|
+
* The real kernel enforcement is in create-sandbox.readonly-skills.sandbox.test.ts.
|
|
7
|
+
*/
|
|
8
|
+
jest.mock("@anthropic-ai/sandbox-runtime", () => ({
|
|
9
|
+
SandboxManager: {
|
|
10
|
+
initialize: jest.fn(async () => {}),
|
|
11
|
+
wrapWithSandbox: jest.fn(async (cmd: string) => cmd),
|
|
12
|
+
reset: jest.fn(async () => {}),
|
|
13
|
+
},
|
|
14
|
+
}));
|
|
15
|
+
jest.mock("@SRC/uppy/index.ts", () => ({
|
|
16
|
+
listS3ObjectsByPrefix: jest.fn(),
|
|
17
|
+
getS3ObjectBytes: jest.fn(),
|
|
18
|
+
uploadFile: jest.fn(async (_c: Buffer, key: string) => `bucket/user_7/${key}`),
|
|
19
|
+
getPresignedUrl: jest.fn(async () => "https://signed"),
|
|
20
|
+
}));
|
|
21
|
+
jest.mock("@SRC/postgres/client", () => ({
|
|
22
|
+
postgresClient: jest.fn(async () => ({ db: { from: () => ({ select: async () => [] }) } })),
|
|
23
|
+
}));
|
|
24
|
+
jest.mock("@SRC/exulu/system-dependencies.ts", () => ({ getNpmGlobalRoot: jest.fn(async () => null) }));
|
|
25
|
+
jest.mock("@SRC/utils/python-setup.ts", () => ({ getPythonVenvPath: () => undefined }));
|
|
26
|
+
|
|
27
|
+
import { existsSync } from "node:fs";
|
|
28
|
+
import { mkdir, readdir, readFile, symlink } from "node:fs/promises";
|
|
29
|
+
import { join } from "node:path";
|
|
30
|
+
|
|
31
|
+
type CreateSandboxModule = typeof import("./create-sandbox");
|
|
32
|
+
type Handle = Awaited<ReturnType<CreateSandboxModule["createSessionSandbox"]>>;
|
|
33
|
+
|
|
34
|
+
const config = { fileUploads: { s3Bucket: "bucket" } } as any;
|
|
35
|
+
const skill = (v: number) => ({ id: "sk-ro", name: "demo", s3folder: "skills/sk-ro", current_version: v });
|
|
36
|
+
|
|
37
|
+
/** S3 key -> bytes; skill files under skills/<id>/v<version>/. */
|
|
38
|
+
let store: Map<string, Buffer>;
|
|
39
|
+
const put = (v: number, files: Record<string, string>) => {
|
|
40
|
+
for (const [rel, text] of Object.entries(files)) store.set(`skills/sk-ro/v${v}/${rel}`, Buffer.from(text));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const realPlatform = Object.getOwnPropertyDescriptor(process, "platform")!;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A fresh create-sandbox module (its sandbox probe is memoized per module) seen on
|
|
47
|
+
* `platform`: "darwin" probes as sandbox-capable without spawning anything, any
|
|
48
|
+
* platform other than darwin/linux probes as unsupported, i.e. degraded mode. The
|
|
49
|
+
* probe runs on the first createSessionSandbox, so the platform stays overridden
|
|
50
|
+
* until afterEach restores it.
|
|
51
|
+
*/
|
|
52
|
+
async function loadOn(platform: string) {
|
|
53
|
+
Object.defineProperty(process, "platform", { value: platform });
|
|
54
|
+
let mod!: CreateSandboxModule;
|
|
55
|
+
let runtime!: { SandboxManager: { wrapWithSandbox: jest.Mock } };
|
|
56
|
+
let uppy!: { listS3ObjectsByPrefix: jest.Mock; getS3ObjectBytes: jest.Mock; uploadFile: jest.Mock };
|
|
57
|
+
await jest.isolateModulesAsync(async () => {
|
|
58
|
+
runtime = await import("@anthropic-ai/sandbox-runtime") as any;
|
|
59
|
+
uppy = await import("@SRC/uppy/index.ts") as any;
|
|
60
|
+
mod = await import("./create-sandbox");
|
|
61
|
+
});
|
|
62
|
+
uppy.listS3ObjectsByPrefix.mockImplementation(async (prefix: string) =>
|
|
63
|
+
[...store.keys()].filter((k) => k.startsWith(prefix)).map((key) => ({ key, size: store.get(key)!.length })),
|
|
64
|
+
);
|
|
65
|
+
uppy.getS3ObjectBytes.mockImplementation(async (key: string) => {
|
|
66
|
+
const bytes = store.get(key);
|
|
67
|
+
if (!bytes) throw new Error(`no object ${key}`);
|
|
68
|
+
return bytes;
|
|
69
|
+
});
|
|
70
|
+
return { mod, wrap: runtime.SandboxManager.wrapWithSandbox, upload: uppy.uploadFile };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
let handles: Handle[] = [];
|
|
74
|
+
const sid = () => `jest-roskills-${process.pid}-${Math.random().toString(36).slice(2)}`;
|
|
75
|
+
const write = (h: Handle, path: string, content: string) =>
|
|
76
|
+
(h.tools.writeFile as any).execute({ path, content }, { toolCallId: "t", messages: [] });
|
|
77
|
+
|
|
78
|
+
beforeEach(() => {
|
|
79
|
+
store = new Map();
|
|
80
|
+
jest.spyOn(console, "warn").mockImplementation(() => {});
|
|
81
|
+
jest.spyOn(console, "log").mockImplementation(() => {});
|
|
82
|
+
});
|
|
83
|
+
afterEach(async () => {
|
|
84
|
+
Object.defineProperty(process, "platform", realPlatform);
|
|
85
|
+
for (const h of handles) await h.cleanup();
|
|
86
|
+
handles = [];
|
|
87
|
+
jest.restoreAllMocks();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
describe("the per-session sandbox policy", () => {
|
|
91
|
+
it("denies writes under <sessionDir>/skills and still allows the session dir", async () => {
|
|
92
|
+
const { mod, wrap } = await loadOn("darwin");
|
|
93
|
+
put(1, { "SKILL.md": "# demo" });
|
|
94
|
+
const h = await mod.createSessionSandbox(sid(), [skill(1)], config, 7, undefined, { projectId: null });
|
|
95
|
+
handles.push(h);
|
|
96
|
+
await (h.tools.bash as any).execute({ command: "echo hi > out.txt" }, { toolCallId: "t", messages: [] });
|
|
97
|
+
await h.runCommand("true");
|
|
98
|
+
await h.wrapCommand("true");
|
|
99
|
+
|
|
100
|
+
expect(wrap.mock.calls.length).toBeGreaterThanOrEqual(3);
|
|
101
|
+
for (const call of wrap.mock.calls) {
|
|
102
|
+
const fsPolicy = call[2]?.filesystem;
|
|
103
|
+
expect(fsPolicy.allowWrite).toEqual([h.sessionDir]);
|
|
104
|
+
expect(fsPolicy.denyWrite).toEqual([join(h.sessionDir, "skills")]);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it("creates skills/ before the first command even without skills, so the deny path exists", async () => {
|
|
109
|
+
const { mod } = await loadOn("darwin");
|
|
110
|
+
const h = await mod.createSessionSandbox(sid(), [], config, 7, undefined, { projectId: null });
|
|
111
|
+
handles.push(h);
|
|
112
|
+
expect(existsSync(join(h.sessionDir, "skills"))).toBe(true);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
describe.each([
|
|
117
|
+
["sandboxed", "darwin"],
|
|
118
|
+
["degraded (direct exec)", "freebsd"],
|
|
119
|
+
])("writeFile under skills/ is refused, %s", (_label, platform) => {
|
|
120
|
+
let h: Handle;
|
|
121
|
+
let wrap: jest.Mock;
|
|
122
|
+
let upload: jest.Mock;
|
|
123
|
+
beforeEach(async () => {
|
|
124
|
+
const loaded = await loadOn(platform);
|
|
125
|
+
wrap = loaded.wrap;
|
|
126
|
+
upload = loaded.upload;
|
|
127
|
+
put(1, { "SKILL.md": "# demo", "run.py": "print('v1')\n" });
|
|
128
|
+
h = await loaded.mod.createSessionSandbox(sid(), [skill(1)], config, 7, undefined, { projectId: null });
|
|
129
|
+
handles.push(h);
|
|
130
|
+
await mkdir(join(h.sessionDir, "work"));
|
|
131
|
+
await symlink(join(h.sessionDir, "skills", "demo"), join(h.sessionDir, "work", "into-skill"));
|
|
132
|
+
await symlink(join(h.sessionDir, "skills"), join(h.sessionDir, "skills-link"));
|
|
133
|
+
wrap.mockClear();
|
|
134
|
+
upload.mockClear();
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const refused = [
|
|
138
|
+
"skills/demo/run.py",
|
|
139
|
+
"skills/demo/new.py",
|
|
140
|
+
"skills/new.txt",
|
|
141
|
+
"./skills/x",
|
|
142
|
+
"/skills/demo/run.py",
|
|
143
|
+
"skills/../skills/x",
|
|
144
|
+
"work/../skills/demo/run.py",
|
|
145
|
+
"work/into-skill/run.py",
|
|
146
|
+
"work/into-skill/planted.py",
|
|
147
|
+
"skills-link/demo/run.py",
|
|
148
|
+
];
|
|
149
|
+
|
|
150
|
+
it.each(refused)("%p: refused with a clear message, nothing written, no upload", async (path) => {
|
|
151
|
+
await expect(write(h, path, "evil")).rejects.toThrow(/read-only/);
|
|
152
|
+
expect(await readFile(join(h.sessionDir, "skills", "demo", "run.py"), "utf8")).toBe("print('v1')\n");
|
|
153
|
+
expect(existsSync(join(h.sessionDir, "skills", "demo", "new.py"))).toBe(false);
|
|
154
|
+
expect(existsSync(join(h.sessionDir, "skills", "demo", "planted.py"))).toBe(false);
|
|
155
|
+
expect(existsSync(join(h.sessionDir, "skills", "new.txt"))).toBe(false);
|
|
156
|
+
expect(existsSync(join(h.sessionDir, "skills", "x"))).toBe(false);
|
|
157
|
+
expect(wrap).not.toHaveBeenCalled();
|
|
158
|
+
expect(upload).not.toHaveBeenCalled();
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it("an absolute path into the skills dir is refused", async () => {
|
|
162
|
+
await expect(write(h, join(h.sessionDir, "skills", "demo", "run.py"), "evil")).rejects.toThrow(/read-only/);
|
|
163
|
+
expect(await readFile(join(h.sessionDir, "skills", "demo", "run.py"), "utf8")).toBe("print('v1')\n");
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it("the message says how a skill changes", async () => {
|
|
167
|
+
await expect(write(h, "skills/demo/run.py", "evil")).rejects.toThrow(/new version/);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it("a normal path is written and uploaded as before", async () => {
|
|
171
|
+
const r = await write(h, "out/report.txt", "ok");
|
|
172
|
+
expect(r).toMatchObject({ success: true, url: "https://signed" });
|
|
173
|
+
expect(await readFile(join(h.sessionDir, "out", "report.txt"), "utf8")).toBe("ok");
|
|
174
|
+
expect(upload).toHaveBeenCalledTimes(1);
|
|
175
|
+
// The mode under test is the one claimed: degraded mode never wraps.
|
|
176
|
+
expect(wrap).toHaveBeenCalledTimes(platform === "darwin" ? 1 : 0);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it("a file whose name only starts with skills is not refused", async () => {
|
|
180
|
+
await write(h, "skills.md", "ok");
|
|
181
|
+
expect(await readFile(join(h.sessionDir, "skills.md"), "utf8")).toBe("ok");
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it("the writeFile description says skills are read-only and change by saving a new version", async () => {
|
|
186
|
+
const { mod } = await loadOn("darwin");
|
|
187
|
+
const h = await mod.createSessionSandbox(sid(), [], config, 7, undefined, { projectId: null });
|
|
188
|
+
handles.push(h);
|
|
189
|
+
const description = (h.tools.writeFile as any).description as string;
|
|
190
|
+
expect(description).not.toContain("skills/<Skill name>/SKILL.md");
|
|
191
|
+
expect(description).toMatch(/skills\/.*read-only/);
|
|
192
|
+
expect(description).toMatch(/new version/);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
describe("the platform still writes skill folders", () => {
|
|
196
|
+
it("a version change replaces the files, and the policy still denies the sandbox", async () => {
|
|
197
|
+
const { mod, wrap } = await loadOn("darwin");
|
|
198
|
+
put(1, { "SKILL.md": "# v1", "old.py": "old" });
|
|
199
|
+
put(2, { "SKILL.md": "# v2" });
|
|
200
|
+
const id = sid();
|
|
201
|
+
const h = await mod.createSessionSandbox(id, [skill(1)], config, 7, undefined, { projectId: null });
|
|
202
|
+
handles.push(h);
|
|
203
|
+
await expect(write(h, "skills/demo/SKILL.md", "# planted")).rejects.toThrow(/read-only/);
|
|
204
|
+
await mod.createSessionSandbox(id, [skill(2)], config, 7, undefined, { projectId: null });
|
|
205
|
+
expect(await readFile(join(h.sessionDir, "skills", "demo", "SKILL.md"), "utf8")).toBe("# v2");
|
|
206
|
+
expect(existsSync(join(h.sessionDir, "skills", "demo", "old.py"))).toBe(false);
|
|
207
|
+
wrap.mockClear();
|
|
208
|
+
await h.runCommand("true");
|
|
209
|
+
expect(wrap.mock.calls[0][2].filesystem.denyWrite).toEqual([join(h.sessionDir, "skills")]);
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it("the reload route re-downloads into the folder", async () => {
|
|
213
|
+
const { mod } = await loadOn("darwin");
|
|
214
|
+
put(1, { "SKILL.md": "# v1" });
|
|
215
|
+
const id = sid();
|
|
216
|
+
const h = await mod.createSessionSandbox(id, [skill(1)], config, 7, undefined, { projectId: null });
|
|
217
|
+
handles.push(h);
|
|
218
|
+
put(1, { "SKILL.md": "# v1 reloaded" });
|
|
219
|
+
expect(await mod.refreshSessionSkills(id, [skill(1)], config)).toEqual({ refreshed: 1, sandbox: true });
|
|
220
|
+
expect(await readFile(join(h.sessionDir, "skills", "demo", "SKILL.md"), "utf8")).toBe("# v1 reloaded");
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
describe("session files from storage never land in skills/", () => {
|
|
225
|
+
const SCRIPT = "print('v1')\n";
|
|
226
|
+
const sessionKey = (id: string, rel: string) => `user_7/sessions/${id}/${rel}`;
|
|
227
|
+
// Each would land in skills/ (the case variants only on a case-insensitive file system).
|
|
228
|
+
const planted = ["skills/demo/run.py", "skills/demo/new.py", "./skills/demo/dot.py", "a/../skills/demo/up.py", "SKILLS/demo/run.py", "Skills/demo/case.py", "skills"];
|
|
229
|
+
const plant = (id: string) => {
|
|
230
|
+
for (const rel of planted) store.set(sessionKey(id, rel), Buffer.from("print('evil, longer than the real script')\n"));
|
|
231
|
+
store.set(sessionKey(id, "note.txt"), Buffer.from("hello"));
|
|
232
|
+
};
|
|
233
|
+
const expectSkillIntact = async (h: Handle) => {
|
|
234
|
+
expect(await readFile(join(h.sessionDir, "skills", "demo", "run.py"), "utf8")).toBe(SCRIPT);
|
|
235
|
+
expect((await readdir(join(h.sessionDir, "skills", "demo"))).sort()).toEqual(["SKILL.md", "run.py"]);
|
|
236
|
+
expect(await readdir(join(h.sessionDir, "skills"))).toEqual(["demo"]);
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
it("cold start: planted keys are skipped (and logged), a normal session file is restored", async () => {
|
|
240
|
+
const { mod } = await loadOn("darwin");
|
|
241
|
+
const id = sid();
|
|
242
|
+
put(1, { "SKILL.md": "# demo", "run.py": SCRIPT });
|
|
243
|
+
plant(id);
|
|
244
|
+
const h = await mod.createSessionSandbox(id, [skill(1)], config, 7, undefined, { projectId: null });
|
|
245
|
+
handles.push(h);
|
|
246
|
+
await expectSkillIntact(h);
|
|
247
|
+
expect(await readFile(join(h.sessionDir, "note.txt"), "utf8")).toBe("hello");
|
|
248
|
+
const logged = (console.warn as jest.Mock).mock.calls.map((c) => String(c[0]));
|
|
249
|
+
expect(logged.some((l) => l.includes(sessionKey(id, "skills/demo/run.py")) && l.includes("skills/"))).toBe(true);
|
|
250
|
+
expect(logged.join("\n")).not.toContain("evil");
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it("restart (directory on disk, sizes differ): planted keys are still skipped", async () => {
|
|
254
|
+
const first = await loadOn("darwin");
|
|
255
|
+
const id = sid();
|
|
256
|
+
put(1, { "SKILL.md": "# demo", "run.py": SCRIPT });
|
|
257
|
+
const h1 = await first.mod.createSessionSandbox(id, [skill(1)], config, 7, undefined, { projectId: null });
|
|
258
|
+
handles.push(h1);
|
|
259
|
+
plant(id);
|
|
260
|
+
Object.defineProperty(process, "platform", realPlatform);
|
|
261
|
+
// A fresh module = a restarted process: empty cache, the session dir survives.
|
|
262
|
+
const second = await loadOn("darwin");
|
|
263
|
+
const h2 = await second.mod.createSessionSandbox(id, [skill(1)], config, 7, undefined, { projectId: null });
|
|
264
|
+
handles.push(h2);
|
|
265
|
+
expect(h2).not.toBe(h1);
|
|
266
|
+
await expectSkillIntact(h2);
|
|
267
|
+
expect(await readFile(join(h2.sessionDir, "note.txt"), "utf8")).toBe("hello");
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it("downloadKeyIntoSandbox reports a planted key as not written and still writes a normal one", async () => {
|
|
271
|
+
const { mod } = await loadOn("darwin");
|
|
272
|
+
const id = sid();
|
|
273
|
+
put(1, { "SKILL.md": "# demo", "run.py": SCRIPT });
|
|
274
|
+
const h = await mod.createSessionSandbox(id, [skill(1)], config, 7, undefined, { projectId: null });
|
|
275
|
+
handles.push(h);
|
|
276
|
+
plant(id);
|
|
277
|
+
// On a case-sensitive file system SKILLS/ is simply another folder.
|
|
278
|
+
const caseInsensitive = existsSync(join(h.sessionDir, "SKILLS"));
|
|
279
|
+
const caseVariant = (r: string) => /^S(KILLS|kills)\//.test(r);
|
|
280
|
+
for (const rel of planted.filter((r) => caseInsensitive || !caseVariant(r))) {
|
|
281
|
+
expect(await mod.downloadKeyIntoSandbox({ sessionId: id, userId: 7, fullS3Key: sessionKey(id, rel), config })).toEqual({
|
|
282
|
+
written: false,
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
await expectSkillIntact(h);
|
|
286
|
+
const ok = await mod.downloadKeyIntoSandbox({ sessionId: id, userId: 7, fullS3Key: sessionKey(id, "note.txt"), config });
|
|
287
|
+
expect(ok.written).toBe(true);
|
|
288
|
+
expect(await readFile(join(h.sessionDir, "note.txt"), "utf8")).toBe("hello");
|
|
289
|
+
});
|
|
290
|
+
});
|