@langchain/sandbox-standard-tests 1.0.0 → 2.0.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/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sandbox = require("./sandbox-D7MiOPSd.cjs");
2
+ const require_sandbox = require("./sandbox-Cna4fdRg.cjs");
3
3
  exports.sandboxStandardTests = require_sandbox.sandboxStandardTests;
4
4
  exports.withRetry = require_sandbox.withRetry;
package/dist/index.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as HookFn, c as SandboxInstanceV2, d as TestFn, f as TestRunner, i as ExpectFn, l as StandardTestsConfig, n as withRetry, o as SandboxInstance, r as AnySandboxInstance, s as SandboxInstanceV1, t as sandboxStandardTests, u as SuiteFn } from "./sandbox-C81RxygO.cjs";
1
+ import { a as HookFn, c as SandboxInstanceV2, d as TestFn, f as TestRunner, i as ExpectFn, l as StandardTestsConfig, n as withRetry, o as SandboxInstance, r as AnySandboxInstance, s as SandboxInstanceV1, t as sandboxStandardTests, u as SuiteFn } from "./sandbox-B5zI_2m-.cjs";
2
2
  export { type AnySandboxInstance, type ExpectFn, type HookFn, type SandboxInstance, type SandboxInstanceV1, type SandboxInstanceV2, type StandardTestsConfig, type SuiteFn, type TestFn, type TestRunner, sandboxStandardTests, withRetry };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as HookFn, c as SandboxInstanceV2, d as TestFn, f as TestRunner, i as ExpectFn, l as StandardTestsConfig, n as withRetry, o as SandboxInstance, r as AnySandboxInstance, s as SandboxInstanceV1, t as sandboxStandardTests, u as SuiteFn } from "./sandbox-BmvI_rV6.js";
1
+ import { a as HookFn, c as SandboxInstanceV2, d as TestFn, f as TestRunner, i as ExpectFn, l as StandardTestsConfig, n as withRetry, o as SandboxInstance, r as AnySandboxInstance, s as SandboxInstanceV1, t as sandboxStandardTests, u as SuiteFn } from "./sandbox-B5zI_2m-.js";
2
2
  export { type AnySandboxInstance, type ExpectFn, type HookFn, type SandboxInstance, type SandboxInstanceV1, type SandboxInstanceV2, type StandardTestsConfig, type SuiteFn, type TestFn, type TestRunner, sandboxStandardTests, withRetry };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as withRetry, t as sandboxStandardTests } from "./sandbox-BbDX1T-X.js";
1
+ import { n as withRetry, t as sandboxStandardTests } from "./sandbox-Bnab52lG.js";
2
2
  export { sandboxStandardTests, withRetry };
@@ -1,5 +1,4 @@
1
1
  import { FileDownloadResponse, FileUploadResponse, MaybePromise, SandboxBackendProtocol, SandboxBackendProtocolV2 } from "deepagents";
2
-
3
2
  //#region src/types.d.ts
4
3
  /** A `describe` / suite function accepted by the standard tests. */
5
4
  interface SuiteFn {
@@ -194,4 +193,4 @@ declare function withRetry<T>(fn: () => Promise<T>, maxRetries?: number, delayMs
194
193
  declare function sandboxStandardTests<T extends AnySandboxInstance>(config: StandardTestsConfig<T>): void;
195
194
  //#endregion
196
195
  export { HookFn as a, SandboxInstanceV2 as c, TestFn as d, TestRunner as f, ExpectFn as i, StandardTestsConfig as l, withRetry as n, SandboxInstance as o, AnySandboxInstance as r, SandboxInstanceV1 as s, sandboxStandardTests as t, SuiteFn as u };
197
- //# sourceMappingURL=sandbox-BmvI_rV6.d.ts.map
196
+ //# sourceMappingURL=sandbox-B5zI_2m-.d.cts.map
@@ -1,5 +1,4 @@
1
1
  import { FileDownloadResponse, FileUploadResponse, MaybePromise, SandboxBackendProtocol, SandboxBackendProtocolV2 } from "deepagents";
2
-
3
2
  //#region src/types.d.ts
4
3
  /** A `describe` / suite function accepted by the standard tests. */
5
4
  interface SuiteFn {
@@ -194,4 +193,4 @@ declare function withRetry<T>(fn: () => Promise<T>, maxRetries?: number, delayMs
194
193
  declare function sandboxStandardTests<T extends AnySandboxInstance>(config: StandardTestsConfig<T>): void;
195
194
  //#endregion
196
195
  export { HookFn as a, SandboxInstanceV2 as c, TestFn as d, TestRunner as f, ExpectFn as i, StandardTestsConfig as l, withRetry as n, SandboxInstance as o, AnySandboxInstance as r, SandboxInstanceV1 as s, sandboxStandardTests as t, SuiteFn as u };
197
- //# sourceMappingURL=sandbox-C81RxygO.d.cts.map
196
+ //# sourceMappingURL=sandbox-B5zI_2m-.d.ts.map
@@ -67,7 +67,8 @@ function registerCommandExecutionTests(getShared, config, timeout) {
67
67
  expect(result.truncated).toBe(false);
68
68
  }, timeout);
69
69
  it("should capture non-zero exit code", async () => {
70
- expect((await getShared().execute("exit 42")).exitCode).toBe(42);
70
+ const result = await getShared().execute("exit 42");
71
+ expect(result.exitCode).toBe(42);
71
72
  }, timeout);
72
73
  it("should capture multiline output", async () => {
73
74
  const result = await getShared().execute("echo \"line1\" && echo \"line2\" && echo \"line3\"");
@@ -77,15 +78,17 @@ function registerCommandExecutionTests(getShared, config, timeout) {
77
78
  expect(result.output).toContain("line3");
78
79
  }, timeout);
79
80
  it("should capture stderr output", async () => {
80
- expect((await getShared().execute("echo \"error message\" >&2")).output).toContain("error message");
81
+ const result = await getShared().execute("echo \"error message\" >&2");
82
+ expect(result.output).toContain("error message");
81
83
  }, timeout);
82
84
  it("should handle command with environment variables", async () => {
83
- const result = await getShared().execute("export MY_VAR=\"test_value\" && echo $MY_VAR");
85
+ const result = await withRetry(() => getShared().execute("export MY_VAR=\"test_value\" && echo $MY_VAR"), 3, 2e3);
84
86
  expect(result.exitCode).toBe(0);
85
87
  expect(result.output.trim()).toBe("test_value");
86
88
  }, timeout);
87
89
  it("should handle non-existent command", async () => {
88
- expect((await getShared().execute("nonexistent_command_12345")).exitCode).not.toBe(0);
90
+ const result = await getShared().execute("nonexistent_command_12345");
91
+ expect(result.exitCode).not.toBe(0);
89
92
  }, timeout);
90
93
  });
91
94
  }
@@ -141,7 +144,8 @@ function registerFileOperationTests(getShared, config, timeout) {
141
144
  expect(results.length).toBe(1);
142
145
  expect(results[0].path).toBe(filePath);
143
146
  expect(results[0].error).toBeNull();
144
- expect((await shared.execute(`cat ${filePath}`)).output.trim()).toBe("Hello from test file!");
147
+ const checkResult = await shared.execute(`cat ${filePath}`);
148
+ expect(checkResult.output.trim()).toBe("Hello from test file!");
145
149
  }, timeout);
146
150
  it("should download files from sandbox", async () => {
147
151
  const shared = getShared();
@@ -152,7 +156,8 @@ function registerFileOperationTests(getShared, config, timeout) {
152
156
  expect(results.length).toBe(1);
153
157
  expect(results[0].error).toBeNull();
154
158
  expect(results[0].content).not.toBeNull();
155
- expect(new TextDecoder().decode(results[0].content).trim()).toBe("Download test content");
159
+ const content = new TextDecoder().decode(results[0].content);
160
+ expect(content.trim()).toBe("Download test content");
156
161
  }, timeout);
157
162
  it("should handle file not found on download", async () => {
158
163
  const filePath = config.resolvePath("nonexistent-file-12345.txt");
@@ -166,20 +171,23 @@ function registerFileOperationTests(getShared, config, timeout) {
166
171
  const filePath = config.resolvePath("read-test.txt");
167
172
  const encoder = new TextEncoder();
168
173
  await shared.uploadFiles([[filePath, encoder.encode("Read test content")]]);
169
- expect((await shared.read(filePath)).content).toContain("Read test content");
174
+ const content = await shared.read(filePath);
175
+ expect(content.content).toContain("Read test content");
170
176
  }, timeout);
171
177
  it("should use inherited write method from BaseSandbox", async () => {
172
178
  const shared = getShared();
173
179
  const filePath = config.resolvePath("write-test.txt");
174
180
  await shared.write(filePath, "Written via BaseSandbox");
175
- expect((await shared.execute(`cat ${filePath}`)).output.trim()).toBe("Written via BaseSandbox");
181
+ const result = await shared.execute(`cat ${filePath}`);
182
+ expect(result.output.trim()).toBe("Written via BaseSandbox");
176
183
  }, timeout);
177
184
  it("should use inherited edit method from BaseSandbox", async () => {
178
185
  const shared = getShared();
179
186
  const filePath = config.resolvePath("edit-test.txt");
180
187
  await shared.write(filePath, "Hello World");
181
188
  await shared.edit(filePath, "Hello World", "Hello Edited World");
182
- expect((await shared.execute(`cat ${filePath}`)).output.trim()).toBe("Hello Edited World");
189
+ const result = await shared.execute(`cat ${filePath}`);
190
+ expect(result.output.trim()).toBe("Hello Edited World");
183
191
  }, timeout);
184
192
  it("should upload multiple files at once", async () => {
185
193
  const shared = getShared();
@@ -204,7 +212,7 @@ function registerFileOperationTests(getShared, config, timeout) {
204
212
  //#endregion
205
213
  //#region src/tests/write.ts
206
214
  /**
207
- * Register detailed write() tests (new file, parent dirs, existing file,
215
+ * Register detailed write() tests (new file, parent dirs, existing file overwrite,
208
216
  * special chars, empty, spaces, unicode, slashes, long content, newlines).
209
217
  */
210
218
  function registerWriteTests(getShared, config, timeout) {
@@ -217,71 +225,88 @@ function registerWriteTests(getShared, config, timeout) {
217
225
  const result = await shared.write(filePath, content);
218
226
  expect(result.error).toBeUndefined();
219
227
  expect(result.path).toBe(filePath);
220
- expect((await shared.execute(`cat ${filePath}`)).output.trim()).toBe(content);
228
+ const execResult = await shared.execute(`cat ${filePath}`);
229
+ expect(execResult.output.trim()).toBe(content);
221
230
  }, timeout);
222
231
  it("should create parent directories automatically", async () => {
223
232
  const shared = getShared();
224
233
  const filePath = config.resolvePath("wt-parents/deep/nested/dir/file.txt");
225
234
  const content = "Nested file content";
226
- expect((await shared.write(filePath, content)).error).toBeUndefined();
227
- expect((await shared.execute(`cat ${filePath}`)).output.trim()).toBe(content);
235
+ const result = await shared.write(filePath, content);
236
+ expect(result.error).toBeUndefined();
237
+ const execResult = await shared.execute(`cat ${filePath}`);
238
+ expect(execResult.output.trim()).toBe(content);
228
239
  }, timeout);
229
- it("should fail when writing to an existing file", async () => {
240
+ it("should overwrite an existing file", async () => {
230
241
  const shared = getShared();
231
242
  const filePath = config.resolvePath("wt-existing.txt");
232
243
  await shared.write(filePath, "First content");
233
244
  const result = await shared.write(filePath, "Second content");
234
- expect(result.error).toBeDefined();
235
- expect(result.error.toLowerCase()).toContain("already exists");
236
- expect((await shared.execute(`cat ${filePath}`)).output.trim()).toBe("First content");
245
+ expect(result.error).toBeUndefined();
246
+ const execResult = await shared.execute(`cat ${filePath}`);
247
+ expect(execResult.output.trim()).toBe("Second content");
237
248
  }, timeout);
238
249
  it("should handle special characters and escape sequences", async () => {
239
250
  const shared = getShared();
240
251
  const filePath = config.resolvePath("wt-special.txt");
241
252
  const content = "Special chars: $VAR, `command`, $(subshell)\nTab here\nBackslash: \\";
242
- expect((await shared.write(filePath, content)).error).toBeUndefined();
243
- expect((await shared.execute(`cat ${filePath}`)).output.trim()).toBe(content);
253
+ const result = await shared.write(filePath, content);
254
+ expect(result.error).toBeUndefined();
255
+ const execResult = await shared.execute(`cat ${filePath}`);
256
+ expect(execResult.output.trim()).toBe(content);
244
257
  }, timeout);
245
258
  it("should write an empty file", async () => {
246
259
  const shared = getShared();
247
260
  const filePath = config.resolvePath("wt-empty.txt");
248
- expect((await shared.write(filePath, "")).error).toBeUndefined();
249
- expect((await shared.execute(`[ -f ${filePath} ] && echo 'exists' || echo 'missing'`)).output).toContain("exists");
261
+ const result = await shared.write(filePath, "");
262
+ expect(result.error).toBeUndefined();
263
+ const execResult = await shared.execute(`[ -f ${filePath} ] && echo 'exists' || echo 'missing'`);
264
+ expect(execResult.output).toContain("exists");
250
265
  }, timeout);
251
266
  it("should write a file with spaces in the path", async () => {
252
267
  const shared = getShared();
253
268
  const filePath = config.resolvePath("wt-spaces/dir with spaces/file name.txt");
254
269
  const content = "Content in file with spaces";
255
- expect((await shared.write(filePath, content)).error).toBeUndefined();
256
- expect((await shared.execute(`cat '${filePath}'`)).output.trim()).toBe(content);
270
+ const result = await shared.write(filePath, content);
271
+ expect(result.error).toBeUndefined();
272
+ const execResult = await shared.execute(`cat '${filePath}'`);
273
+ expect(execResult.output.trim()).toBe(content);
257
274
  }, timeout);
258
275
  it("should write unicode content", async () => {
259
276
  const shared = getShared();
260
277
  const filePath = config.resolvePath("wt-unicode.txt");
261
278
  const content = "Hello 👋 世界 مرحبا Привет 🌍\nLine with émojis 🎉";
262
- expect((await shared.write(filePath, content)).error).toBeUndefined();
263
- expect((await shared.execute(`cat ${filePath}`)).output.trim()).toBe(content);
279
+ const result = await shared.write(filePath, content);
280
+ expect(result.error).toBeUndefined();
281
+ const execResult = await shared.execute(`cat ${filePath}`);
282
+ expect(execResult.output.trim()).toBe(content);
264
283
  }, timeout);
265
284
  it("should handle consecutive slashes in path", async () => {
266
285
  const shared = getShared();
267
286
  const basePath = config.resolvePath("wt-slashes");
268
287
  const filePath = `${basePath}//subdir///file.txt`;
269
288
  const content = "Content";
270
- expect((await shared.write(filePath, content)).error).toBeUndefined();
271
- expect((await shared.execute(`cat ${basePath}/subdir/file.txt`)).output.trim()).toBe(content);
289
+ const result = await shared.write(filePath, content);
290
+ expect(result.error).toBeUndefined();
291
+ const execResult = await shared.execute(`cat ${basePath}/subdir/file.txt`);
292
+ expect(execResult.output.trim()).toBe(content);
272
293
  }, timeout);
273
294
  it("should write very long content (1000 lines)", async () => {
274
295
  const shared = getShared();
275
296
  const filePath = config.resolvePath("wt-long.txt");
276
297
  const content = Array.from({ length: 1e3 }, (_, i) => `Line ${i} with some content here`).join("\n");
277
- expect((await shared.write(filePath, content)).error).toBeUndefined();
278
- expect((await shared.execute(`wc -l < ${filePath}`)).output.trim()).toMatch(/^(999|1000)$/);
298
+ const result = await shared.write(filePath, content);
299
+ expect(result.error).toBeUndefined();
300
+ const execResult = await shared.execute(`wc -l < ${filePath}`);
301
+ expect(execResult.output.trim()).toMatch(/^(999|1000)$/);
279
302
  }, timeout);
280
303
  it("should write content with only newlines", async () => {
281
304
  const shared = getShared();
282
305
  const filePath = config.resolvePath("wt-newlines.txt");
283
- expect((await shared.write(filePath, "\n\n\n\n\n")).error).toBeUndefined();
284
- expect((await shared.execute(`wc -l < ${filePath}`)).output.trim()).toBe("5");
306
+ const result = await shared.write(filePath, "\n\n\n\n\n");
307
+ expect(result.error).toBeUndefined();
308
+ const execResult = await shared.execute(`wc -l < ${filePath}`);
309
+ expect(execResult.output.trim()).toBe("5");
285
310
  }, timeout);
286
311
  });
287
312
  }
@@ -314,7 +339,8 @@ function registerReadTests(getShared, config, timeout) {
314
339
  const shared = adaptSandboxInstance(getShared());
315
340
  const filePath = config.resolvePath("rd-empty.txt");
316
341
  await shared.write(filePath, "");
317
- expect((await shared.read(filePath)).error).toBeUndefined();
342
+ const result = await shared.read(filePath);
343
+ expect(result.error).toBeUndefined();
318
344
  }, timeout);
319
345
  it("should read with offset parameter", async () => {
320
346
  const shared = adaptSandboxInstance(getShared());
@@ -369,7 +395,8 @@ function registerReadTests(getShared, config, timeout) {
369
395
  const shared = adaptSandboxInstance(getShared());
370
396
  const filePath = config.resolvePath("rd-zero-limit.txt");
371
397
  await shared.write(filePath, "Line 1\nLine 2\nLine 3");
372
- expect((await shared.read(filePath, 0, 0)).content).not.toContain("Line 1");
398
+ const result = await shared.read(filePath, 0, 0);
399
+ expect(result.content).not.toContain("Line 1");
373
400
  }, timeout);
374
401
  it("should handle offset beyond file length", async () => {
375
402
  const shared = adaptSandboxInstance(getShared());
@@ -449,7 +476,8 @@ function registerEditTests(getShared, config, timeout) {
449
476
  expect(result.occurrences).toBe(3);
450
477
  const execResult = await shared.execute(`cat ${filePath}`);
451
478
  expect(execResult.output).not.toContain("apple");
452
- expect(execResult.output.split("pear").length - 1).toBe(3);
479
+ const pearCount = execResult.output.split("pear").length - 1;
480
+ expect(pearCount).toBe(3);
453
481
  }, timeout);
454
482
  it("should return error when string is not found", async () => {
455
483
  const shared = getShared();
@@ -469,8 +497,10 @@ function registerEditTests(getShared, config, timeout) {
469
497
  const shared = adaptSandboxInstance(getShared());
470
498
  const filePath = config.resolvePath("ed-special.txt");
471
499
  await shared.write(filePath, "Price: $100.00\nPattern: [a-z]*\nPath: /usr/bin");
472
- expect((await shared.edit(filePath, "$100.00", "$200.00")).error).toBeUndefined();
473
- expect((await shared.edit(filePath, "[a-z]*", "[0-9]+")).error).toBeUndefined();
500
+ const result1 = await shared.edit(filePath, "$100.00", "$200.00");
501
+ expect(result1.error).toBeUndefined();
502
+ const result2 = await shared.edit(filePath, "[a-z]*", "[0-9]+");
503
+ expect(result2.error).toBeUndefined();
474
504
  const content = await shared.read(filePath);
475
505
  expect(content.content).toContain("$200.00");
476
506
  expect(content.content).toContain("[0-9]+");
@@ -506,7 +536,8 @@ function registerEditTests(getShared, config, timeout) {
506
536
  const result = await shared.edit(filePath, "Same text", "Same text");
507
537
  expect(result.error).toBeUndefined();
508
538
  expect(result.occurrences).toBe(1);
509
- expect((await shared.read(filePath)).content).toContain("Same text");
539
+ const content = await shared.read(filePath);
540
+ expect(content.content).toContain("Same text");
510
541
  }, timeout);
511
542
  it("should handle unicode content", async () => {
512
543
  const shared = adaptSandboxInstance(getShared());
@@ -526,7 +557,8 @@ function registerEditTests(getShared, config, timeout) {
526
557
  const result = await shared.edit(filePath, " ", " ");
527
558
  expect(result.error).toBeUndefined();
528
559
  expect(result.occurrences).toBe(1);
529
- expect((await shared.read(filePath)).content).toContain("Line1 Line2");
560
+ const content = await shared.read(filePath);
561
+ expect(content.content).toContain("Line1 Line2");
530
562
  }, timeout);
531
563
  it("should handle very long old and new strings", async () => {
532
564
  const shared = adaptSandboxInstance(getShared());
@@ -545,7 +577,8 @@ function registerEditTests(getShared, config, timeout) {
545
577
  const shared = adaptSandboxInstance(getShared());
546
578
  const filePath = config.resolvePath("ed-line-endings.txt");
547
579
  await shared.write(filePath, "Line 1\nLine 2\nLine 3\n");
548
- expect((await shared.edit(filePath, "Line 2", "Modified Line 2")).error).toBeUndefined();
580
+ const result = await shared.edit(filePath, "Line 2", "Modified Line 2");
581
+ expect(result.error).toBeUndefined();
549
582
  const content = await shared.read(filePath);
550
583
  expect(content.content).toContain("Line 1");
551
584
  expect(content.content).toContain("Modified Line 2");
@@ -558,7 +591,8 @@ function registerEditTests(getShared, config, timeout) {
558
591
  const result = await shared.edit(filePath, "brown fox", "red cat");
559
592
  expect(result.error).toBeUndefined();
560
593
  expect(result.occurrences).toBe(1);
561
- expect((await shared.execute(`cat ${filePath}`)).output).toContain("The quick red cat jumps");
594
+ const execResult = await shared.execute(`cat ${filePath}`);
595
+ expect(execResult.output).toContain("The quick red cat jumps");
562
596
  }, timeout);
563
597
  });
564
598
  }
@@ -642,7 +676,8 @@ function registerLsInfoTests(getShared, config, timeout) {
642
676
  await shared.write(`${baseDir}/\u0444\u0430\u0439\u043B.txt`, "content");
643
677
  const lsResult = await shared.ls(baseDir);
644
678
  expect(lsResult.error).toBeUndefined();
645
- expect((lsResult.files || []).length).toBe(2);
679
+ const result = lsResult.files || [];
680
+ expect(result.length).toBe(2);
646
681
  }, timeout);
647
682
  it("should handle large directories", async () => {
648
683
  const shared = adaptSandboxInstance(getShared());
@@ -662,7 +697,8 @@ function registerLsInfoTests(getShared, config, timeout) {
662
697
  await shared.write(`${baseDir}/file.txt`, "content");
663
698
  const lsResult = await shared.ls(`${baseDir}/`);
664
699
  expect(lsResult.error).toBeUndefined();
665
- expect((lsResult.files || []).length).toBeGreaterThanOrEqual(1);
700
+ const result = lsResult.files || [];
701
+ expect(result.length).toBeGreaterThanOrEqual(1);
666
702
  }, timeout);
667
703
  it("should handle special characters in filenames", async () => {
668
704
  const shared = adaptSandboxInstance(getShared());
@@ -732,7 +768,8 @@ function registerGrepRawTests(getShared, config, timeout) {
732
768
  expect(result.error).toBeUndefined();
733
769
  const matches = result.matches;
734
770
  expect(matches.length).toBe(3);
735
- expect(matches.map((m) => m.line)).toEqual([
771
+ const lineNumbers = matches.map((m) => m.line);
772
+ expect(lineNumbers).toEqual([
736
773
  1,
737
774
  3,
738
775
  5
@@ -927,7 +964,8 @@ function registerGlobInfoTests(getShared, config, timeout) {
927
964
  expect(globResult.error).toBeUndefined();
928
965
  const result = globResult.files || [];
929
966
  expect(result.length).toBe(2);
930
- expect(result.map((info) => info.path)).not.toContain("file10.txt");
967
+ const paths = result.map((info) => info.path);
968
+ expect(paths).not.toContain("file10.txt");
931
969
  }, timeout);
932
970
  it("should match multiple extensions separately", async () => {
933
971
  const shared = adaptSandboxInstance(getShared());
@@ -996,8 +1034,10 @@ function registerInitialFilesTests(config, timeout) {
996
1034
  } }));
997
1035
  try {
998
1036
  expect(tmp.isRunning).toBe(true);
999
- expect((await tmp.execute(`cat ${buttonPath}`)).output).toContain("Button");
1000
- expect((await tmp.execute(`cat ${helperPath}`)).output).toContain("capitalize");
1037
+ const buttonContent = await tmp.execute(`cat ${buttonPath}`);
1038
+ expect(buttonContent.output).toContain("Button");
1039
+ const helperContent = await tmp.execute(`cat ${helperPath}`);
1040
+ expect(helperContent.output).toContain("capitalize");
1001
1041
  } finally {
1002
1042
  await config.closeSandbox?.(tmp);
1003
1043
  }
@@ -1017,7 +1057,8 @@ function registerInitialFilesTests(config, timeout) {
1017
1057
  const filePath = config.resolvePath("init-read-test.txt");
1018
1058
  const tmp = await withRetry(() => config.createSandbox({ initialFiles: { [filePath]: "Content for read test" } }));
1019
1059
  try {
1020
- expect((await adaptSandboxInstance(tmp).read(filePath)).content).toContain("Content for read test");
1060
+ const content = await adaptSandboxInstance(tmp).read(filePath);
1061
+ expect(content.content).toContain("Content for read test");
1021
1062
  } finally {
1022
1063
  await config.closeSandbox?.(tmp);
1023
1064
  }
@@ -1029,7 +1070,8 @@ function registerInitialFilesTests(config, timeout) {
1029
1070
  const results = await tmp.downloadFiles([filePath]);
1030
1071
  expect(results[0].error).toBeNull();
1031
1072
  expect(results[0].content).not.toBeNull();
1032
- expect(new TextDecoder().decode(results[0].content)).toContain("Content for download test");
1073
+ const content = new TextDecoder().decode(results[0].content);
1074
+ expect(content).toContain("Content for download test");
1033
1075
  } finally {
1034
1076
  await config.closeSandbox?.(tmp);
1035
1077
  }
@@ -1052,7 +1094,8 @@ function registerInitialFilesTests(config, timeout) {
1052
1094
  try {
1053
1095
  const lsResult = await adaptSandboxInstance(tmp).ls(dirPath);
1054
1096
  expect(lsResult.error).toBeUndefined();
1055
- expect((lsResult.files || []).map((e) => e.path.replace(/\/$/, ""))).toContain(filePath);
1097
+ const paths = (lsResult.files || []).map((e) => e.path.replace(/\/$/, ""));
1098
+ expect(paths).toContain(filePath);
1056
1099
  } finally {
1057
1100
  await config.closeSandbox?.(tmp);
1058
1101
  }
@@ -1070,9 +1113,12 @@ function registerIntegrationTests(getShared, config, timeout) {
1070
1113
  it("should complete a write-read-edit-read workflow", async () => {
1071
1114
  const shared = adaptSandboxInstance(getShared());
1072
1115
  const filePath = config.resolvePath("intg-workflow.txt");
1073
- expect((await shared.write(filePath, "Original content")).error).toBeUndefined();
1074
- expect((await shared.read(filePath)).content).toContain("Original content");
1075
- expect((await shared.edit(filePath, "Original", "Modified")).error).toBeUndefined();
1116
+ const writeResult = await shared.write(filePath, "Original content");
1117
+ expect(writeResult.error).toBeUndefined();
1118
+ const content = await shared.read(filePath);
1119
+ expect(content.content).toContain("Original content");
1120
+ const editResult = await shared.edit(filePath, "Original", "Modified");
1121
+ expect(editResult.error).toBeUndefined();
1076
1122
  const updatedContent = await shared.read(filePath);
1077
1123
  expect(updatedContent.content).toContain("Modified content");
1078
1124
  expect(updatedContent.content).not.toContain("Original");
@@ -1092,7 +1138,8 @@ function registerIntegrationTests(getShared, config, timeout) {
1092
1138
  expect(lsPaths).toContain(`${baseDir}/subdir2`);
1093
1139
  const globResult = await shared.glob("**/*.txt", baseDir);
1094
1140
  expect(globResult.error).toBeUndefined();
1095
- expect((globResult.files || []).length).toBe(3);
1141
+ const files = globResult.files || [];
1142
+ expect(files.length).toBe(3);
1096
1143
  const grepResult = await shared.grep("file", baseDir);
1097
1144
  expect(grepResult.error).toBeUndefined();
1098
1145
  expect(grepResult.matches.length).toBeGreaterThanOrEqual(3);
@@ -1120,7 +1167,7 @@ function registerIntegrationTests(getShared, config, timeout) {
1120
1167
  * - Sandbox lifecycle (create, isRunning, close, two-step initialization)
1121
1168
  * - Command execution (echo, exit codes, multiline output, stderr, env vars)
1122
1169
  * - File operations (upload, download, read, write, edit, multiple files)
1123
- * - write() (new file, parent dirs, existing file, special chars, unicode, long content)
1170
+ * - write() (new file, parent dirs, existing file overwrite, special chars, unicode, long content)
1124
1171
  * - read() (basic, nonexistent, offset, limit, offset+limit, unicode, chunked)
1125
1172
  * - edit() (single/multi occurrence, replaceAll, not found, special chars, multiline, unicode)
1126
1173
  * - ls() (basic listing, empty dir, hidden files, large dir, absolute paths)
@@ -1227,4 +1274,4 @@ function sandboxStandardTests(config) {
1227
1274
  //#endregion
1228
1275
  export { withRetry as n, sandboxStandardTests as t };
1229
1276
 
1230
- //# sourceMappingURL=sandbox-BbDX1T-X.js.map
1277
+ //# sourceMappingURL=sandbox-Bnab52lG.js.map