@ship.zone/runner 2.1.0 → 3.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.
Files changed (179) hide show
  1. package/.smartconfig.json +99 -2
  2. package/changelog.md +58 -0
  3. package/dist_rust/runnerworkspace_linux_amd64_musl +0 -0
  4. package/dist_rust/runnerworkspace_linux_amd64_musl.third-party-notices.json +679 -0
  5. package/dist_rust/runnerworkspace_linux_amd64_musl.third-party-notices.txt +15719 -0
  6. package/dist_rust/runnerworkspace_linux_amd64_musl.tsrust-build.json +5 -5
  7. package/dist_rust/runnerworkspace_linux_arm64_musl +0 -0
  8. package/dist_rust/runnerworkspace_linux_arm64_musl.third-party-notices.json +679 -0
  9. package/dist_rust/runnerworkspace_linux_arm64_musl.third-party-notices.txt +15719 -0
  10. package/dist_rust/runnerworkspace_linux_arm64_musl.tsrust-build.json +5 -5
  11. package/dist_ts/00_commitinfo_data.d.ts +8 -0
  12. package/dist_ts/00_commitinfo_data.js +9 -0
  13. package/dist_ts/api-client.d.ts +46 -0
  14. package/dist_ts/api-client.js +592 -0
  15. package/dist_ts/artifact-manager.d.ts +11 -0
  16. package/dist_ts/artifact-manager.js +140 -0
  17. package/dist_ts/attempt-state.d.ts +18 -0
  18. package/dist_ts/attempt-state.js +151 -0
  19. package/dist_ts/cache-manager.d.ts +13 -0
  20. package/dist_ts/cache-manager.js +300 -0
  21. package/dist_ts/cli-entry.d.ts +2 -0
  22. package/dist_ts/cli-entry.js +4 -0
  23. package/dist_ts/cli.d.ts +14 -0
  24. package/dist_ts/cli.js +215 -0
  25. package/dist_ts/config.d.ts +8 -0
  26. package/dist_ts/config.js +445 -0
  27. package/dist_ts/errors.d.ts +41 -0
  28. package/dist_ts/errors.js +90 -0
  29. package/dist_ts/filesystem.d.ts +73 -0
  30. package/dist_ts/filesystem.js +207 -0
  31. package/dist_ts/index.d.ts +16 -0
  32. package/dist_ts/index.js +17 -0
  33. package/dist_ts/interfaces.d.ts +614 -0
  34. package/dist_ts/interfaces.js +3 -0
  35. package/dist_ts/log-sender.d.ts +26 -0
  36. package/dist_ts/log-sender.js +124 -0
  37. package/dist_ts/oci-executor.d.ts +155 -0
  38. package/dist_ts/oci-executor.js +2238 -0
  39. package/dist_ts/plugins.d.ts +19 -0
  40. package/dist_ts/plugins.js +23 -0
  41. package/dist_ts/protocol-validator.d.ts +39 -0
  42. package/dist_ts/protocol-validator.js +483 -0
  43. package/dist_ts/redactor.d.ts +78 -0
  44. package/dist_ts/redactor.js +235 -0
  45. package/dist_ts/registration-state.d.ts +16 -0
  46. package/dist_ts/registration-state.js +171 -0
  47. package/dist_ts/runner.d.ts +64 -0
  48. package/dist_ts/runner.js +882 -0
  49. package/dist_ts/source-workspace.d.ts +10 -0
  50. package/dist_ts/source-workspace.js +125 -0
  51. package/dist_ts/spec-version.d.ts +11 -0
  52. package/dist_ts/spec-version.js +41 -0
  53. package/dist_ts/staging-scavenger.d.ts +7 -0
  54. package/dist_ts/staging-scavenger.js +63 -0
  55. package/dist_ts/state-owner.d.ts +74 -0
  56. package/dist_ts/state-owner.js +289 -0
  57. package/dist_ts/transfer-archive.d.ts +78 -0
  58. package/dist_ts/transfer-archive.js +1619 -0
  59. package/dist_ts/validation.d.ts +11 -0
  60. package/dist_ts/validation.js +79 -0
  61. package/dist_ts/wire-schema.d.ts +10 -0
  62. package/dist_ts/wire-schema.js +114 -0
  63. package/native-notices/crates/bitflags-2.13.1/license-apache +201 -0
  64. package/native-notices/crates/bitflags-2.13.1/license-mit +25 -0
  65. package/native-notices/crates/cc-1.8.0/license-apache +201 -0
  66. package/native-notices/crates/cc-1.8.0/license-mit +25 -0
  67. package/native-notices/crates/cfg-if-1.0.4/license-apache +201 -0
  68. package/native-notices/crates/cfg-if-1.0.4/license-mit +25 -0
  69. package/native-notices/crates/cfg_aliases-0.2.2/license +9 -0
  70. package/native-notices/crates/cfg_aliases-0.2.2/notices.md +26 -0
  71. package/native-notices/crates/find-msvc-tools-0.1.14/license-apache +201 -0
  72. package/native-notices/crates/find-msvc-tools-0.1.14/license-mit +25 -0
  73. package/native-notices/crates/itoa-1.0.18/license-apache +176 -0
  74. package/native-notices/crates/itoa-1.0.18/license-mit +23 -0
  75. package/native-notices/crates/libc-0.2.189/license-apache +176 -0
  76. package/native-notices/crates/libc-0.2.189/license-mit +25 -0
  77. package/native-notices/crates/memchr-2.8.3/copying +3 -0
  78. package/native-notices/crates/memchr-2.8.3/license-mit +21 -0
  79. package/native-notices/crates/memchr-2.8.3/unlicense +24 -0
  80. package/native-notices/crates/nix-0.30.1/license +21 -0
  81. package/native-notices/crates/proc-macro2-1.0.107/license-apache +176 -0
  82. package/native-notices/crates/proc-macro2-1.0.107/license-mit +23 -0
  83. package/native-notices/crates/quote-1.0.47/license-apache +176 -0
  84. package/native-notices/crates/quote-1.0.47/license-mit +23 -0
  85. package/native-notices/crates/serde-1.0.229/license-apache +176 -0
  86. package/native-notices/crates/serde-1.0.229/license-mit +23 -0
  87. package/native-notices/crates/serde_core-1.0.229/license-apache +176 -0
  88. package/native-notices/crates/serde_core-1.0.229/license-mit +23 -0
  89. package/native-notices/crates/serde_derive-1.0.229/license-apache +176 -0
  90. package/native-notices/crates/serde_derive-1.0.229/license-mit +23 -0
  91. package/native-notices/crates/serde_json-1.0.151/license-apache +176 -0
  92. package/native-notices/crates/serde_json-1.0.151/license-mit +23 -0
  93. package/native-notices/crates/shlex-2.0.1/license-apache +13 -0
  94. package/native-notices/crates/shlex-2.0.1/license-mit +21 -0
  95. package/native-notices/crates/syn-3.0.3/license-apache +176 -0
  96. package/native-notices/crates/syn-3.0.3/license-mit +23 -0
  97. package/native-notices/crates/tikv-jemalloc-sys-0.7.1+5.3.1-0-g81034ce1f1373e37dc865038e1bc8eeecf559ce8/license-apache +201 -0
  98. package/native-notices/crates/tikv-jemalloc-sys-0.7.1+5.3.1-0-g81034ce1f1373e37dc865038e1bc8eeecf559ce8/license-mit +25 -0
  99. package/native-notices/crates/tikv-jemallocator-0.7.0/license-apache +201 -0
  100. package/native-notices/crates/tikv-jemallocator-0.7.0/license-mit +25 -0
  101. package/native-notices/crates/unicode-ident-1.0.24/license-apache +176 -0
  102. package/native-notices/crates/unicode-ident-1.0.24/license-mit +23 -0
  103. package/native-notices/crates/unicode-ident-1.0.24/license-unicode +39 -0
  104. package/native-notices/crates/zmij-1.0.23/license-mit +23 -0
  105. package/native-notices/manifest.json +763 -0
  106. package/native-notices/native/tikv-jemalloc-sys-0.7.1+5.3.1-0-g81034ce1f1373e37dc865038e1bc8eeecf559ce8/jemalloc-5.3.1/jemalloc-copying +27 -0
  107. package/native-notices/readme.md +46 -0
  108. package/native-notices/runtime/gcc/gpl-3.0.txt +674 -0
  109. package/native-notices/runtime/gcc/runtime-library-exception-3.1.txt +73 -0
  110. package/native-notices/runtime/libunwind-22.1.2/license.txt +311 -0
  111. package/native-notices/runtime/musl-1.2.5/copyright +193 -0
  112. package/native-notices/rust/compiler-builtins-license.txt +275 -0
  113. package/native-notices/rust/copyright-library.html +8266 -0
  114. package/native-notices/rust/crates/addr2line-0.25.1/license-apache +201 -0
  115. package/native-notices/rust/crates/addr2line-0.25.1/license-mit +25 -0
  116. package/native-notices/rust/crates/adler2-2.0.1/license-0bsd +12 -0
  117. package/native-notices/rust/crates/adler2-2.0.1/license-apache +201 -0
  118. package/native-notices/rust/crates/adler2-2.0.1/license-mit +23 -0
  119. package/native-notices/rust/crates/memchr-2.7.6/copying +3 -0
  120. package/native-notices/rust/crates/memchr-2.7.6/license-mit +21 -0
  121. package/native-notices/rust/crates/memchr-2.7.6/unlicense +24 -0
  122. package/native-notices/rust/crates/miniz_oxide-0.8.9/license +25 -0
  123. package/native-notices/rust/crates/miniz_oxide-0.8.9/license-apache.md +177 -0
  124. package/native-notices/rust/crates/miniz_oxide-0.8.9/license-mit.md +24 -0
  125. package/native-notices/rust/crates/miniz_oxide-0.8.9/license-zlib.md +14 -0
  126. package/native-notices/rust/crates/object-0.37.3/license-apache +201 -0
  127. package/native-notices/rust/crates/object-0.37.3/license-mit +25 -0
  128. package/native-notices/rust/licenses/apache-2.0.txt +73 -0
  129. package/native-notices/rust/licenses/bsd-2-clause.txt +9 -0
  130. package/native-notices/rust/licenses/cc-by-sa-4.0.txt +427 -0
  131. package/native-notices/rust/licenses/gcc-exception-3.1.txt +30 -0
  132. package/native-notices/rust/licenses/gpl-2.0-only.txt +133 -0
  133. package/native-notices/rust/licenses/gpl-3.0-or-later.txt +202 -0
  134. package/native-notices/rust/licenses/isc.txt +7 -0
  135. package/native-notices/rust/licenses/llvm-exception.txt +15 -0
  136. package/native-notices/rust/licenses/mit.txt +9 -0
  137. package/native-notices/rust/licenses/ncsa.txt +29 -0
  138. package/native-notices/rust/licenses/ofl-1.1.txt +43 -0
  139. package/native-notices/rust/licenses/unicode-3.0.txt +39 -0
  140. package/package.json +24 -22
  141. package/readme.md +91 -40
  142. package/rust/.cargo/config.toml +1 -1
  143. package/rust/Cargo.toml +1 -1
  144. package/rust/src/lib.rs +156 -1
  145. package/rust/src/main.rs +1 -1
  146. package/rust-toolchain.toml +4 -0
  147. package/ts/00_commitinfo_data.ts +1 -1
  148. package/ts/api-client.ts +10 -7
  149. package/ts/artifact-manager.ts +9 -7
  150. package/ts/attempt-state.ts +75 -84
  151. package/ts/cache-manager.ts +22 -28
  152. package/ts/cli-entry.ts +4 -0
  153. package/ts/cli.ts +56 -45
  154. package/ts/config.ts +50 -39
  155. package/ts/errors.ts +19 -0
  156. package/ts/filesystem.ts +316 -0
  157. package/ts/index.ts +16 -15
  158. package/ts/interfaces.ts +2 -2
  159. package/ts/log-sender.ts +4 -4
  160. package/ts/oci-executor.ts +235 -383
  161. package/ts/plugins.ts +21 -3
  162. package/ts/protocol-validator.ts +5 -5
  163. package/ts/redactor.ts +2 -2
  164. package/ts/registration-state.ts +82 -90
  165. package/ts/runner.ts +30 -17
  166. package/ts/source-workspace.ts +11 -8
  167. package/ts/spec-version.ts +2 -2
  168. package/ts/staging-scavenger.ts +37 -26
  169. package/ts/state-owner.ts +346 -0
  170. package/ts/transfer-archive.ts +214 -243
  171. package/ts/validation.ts +1 -1
  172. package/ts/wire-schema.ts +3 -3
  173. package/deno.json +0 -56
  174. package/deno.lock +0 -1495
  175. package/dist_npm/mod.d.ts +0 -967
  176. package/dist_npm/mod.js +0 -10058
  177. package/mod.ts +0 -8
  178. package/musl-copyright.md +0 -81
  179. package/third-party-licenses.md +0 -187
@@ -1,12 +1,27 @@
1
- import { createHash } from 'node:crypto';
2
- import { dirname, join, resolve } from '@std/path';
3
- import { maximumArchivePathMetadataBytes } from './plugins.ts';
1
+ import * as plugins from './plugins.js';
2
+ import {
3
+ asyncIteratorStream,
4
+ createNewWriteFlags,
5
+ type IMakeTempOptions,
6
+ type IRemoveOptions,
7
+ isNotFound,
8
+ makeTempFile,
9
+ openReadableFile,
10
+ readFileChunks,
11
+ removePath,
12
+ type TFileHandle,
13
+ truncateExistingWriteFlags,
14
+ withFileHandle,
15
+ withFileHandleChunks,
16
+ withOpenFile,
17
+ writeAll,
18
+ } from './filesystem.js';
4
19
  import {
5
20
  ProtocolError,
6
21
  ResourceCleanupError,
7
22
  RunnerError,
8
23
  SecretDisclosureError,
9
- } from './errors.ts';
24
+ } from './errors.js';
10
25
  import type {
11
26
  ISecretRedactionSet,
12
27
  ITransferDownload,
@@ -14,7 +29,9 @@ import type {
14
29
  ITransferRecord,
15
30
  IWorkspaceTreeMetadata,
16
31
  TOpenTransferBody,
17
- } from './interfaces.ts';
32
+ } from './interfaces.js';
33
+
34
+ const { dirname, join, resolve } = plugins.path;
18
35
 
19
36
  const tarBlockSize = 512;
20
37
  const maximumPaxHeaderBytes = 16 * 1024;
@@ -79,10 +96,10 @@ export interface ICreateTarGzipOptions {
79
96
  }
80
97
 
81
98
  export interface ITransferArchiveFileOperations {
82
- makeTempFile(options: Deno.MakeTempOptions): Promise<string>;
99
+ makeTempFile(options: IMakeTempOptions): Promise<string>;
83
100
  chmod(path: string, mode: number): Promise<void>;
84
- remove(path: string, options?: Deno.RemoveOptions): Promise<void>;
85
- openRead?(path: string): Promise<Pick<Deno.FsFile, 'read' | 'stat' | 'close'>>;
101
+ remove(path: string, options?: IRemoveOptions): Promise<void>;
102
+ openRead?(path: string): Promise<TFileHandle>;
86
103
  }
87
104
 
88
105
  export interface IPreparedTransferArchive {
@@ -143,10 +160,10 @@ const checkedMultiply = (left: number, right: number, message: string): number =
143
160
  };
144
161
 
145
162
  const defaultFileOperations: ITransferArchiveFileOperations = {
146
- makeTempFile: (options) => Deno.makeTempFile(options),
147
- chmod: (path, mode) => Deno.chmod(path, mode),
148
- remove: (path, options) => Deno.remove(path, options),
149
- openRead: (path) => Deno.open(path, { read: true }),
163
+ makeTempFile: (options) => makeTempFile(options),
164
+ chmod: (path, mode) => plugins.fs.chmod(path, mode),
165
+ remove: (path, options) => removePath(path, options),
166
+ openRead: (path) => plugins.fs.open(path, 'r'),
150
167
  };
151
168
 
152
169
  export const removePathIfPresent = async (
@@ -157,7 +174,7 @@ export const removePathIfPresent = async (
157
174
  try {
158
175
  await remove(path, { recursive });
159
176
  } catch (error) {
160
- if (!(error instanceof Deno.errors.NotFound)) {
177
+ if (!isNotFound(error)) {
161
178
  throw new ResourceCleanupError(`Unable to remove owned path ${path}`, [error]);
162
179
  }
163
180
  }
@@ -196,25 +213,21 @@ export const ensureStagingCapacity = async (
196
213
  checkedInteger(requiredInodes, 'Required staging inodes');
197
214
  checkedInteger(reserveBytes, 'Transfer staging byte reserve');
198
215
  checkedInteger(reserveInodes, 'Transfer staging inode reserve');
199
- let output: Deno.CommandOutput;
216
+ let statistics: plugins.BigIntStatsFs;
200
217
  try {
201
- output = await new Deno.Command('/usr/bin/stat', {
202
- args: ['--file-system', '--format=%a %S %d', '--', path],
203
- stdin: 'null',
204
- stdout: 'piped',
205
- stderr: 'piped',
206
- }).output();
218
+ statistics = await plugins.fs.statfs(path, { bigint: true });
207
219
  } catch (error) {
208
220
  throw new RunnerError('Unable to inspect transfer staging capacity', { cause: error });
209
221
  }
210
- if (!output.success || output.stdout.byteLength > 256) {
211
- throw new RunnerError('Unable to inspect transfer staging capacity');
222
+ // Available block counts are in units of the fundamental block (fragment) size, `f_frsize`;
223
+ // `bsize` is only the optimal transfer size. `frsize` needs Node.js 26.1 or later.
224
+ const fragmentSize: bigint | undefined = statistics.frsize;
225
+ if (typeof fragmentSize !== 'bigint' || fragmentSize <= 0n) {
226
+ throw new RunnerError('Transfer staging filesystem did not report its fragment size');
212
227
  }
213
- const match = /^(\d+) (\d+) (\d+)\n?$/.exec(new TextDecoder().decode(output.stdout));
214
- if (!match) throw new RunnerError('Transfer staging filesystem returned invalid capacity');
215
- const blockSize = BigInt(match[2]);
216
- const availableBytes = BigInt(match[1]) * blockSize;
217
- const availableInodes = BigInt(match[3]);
228
+ const blockSize = fragmentSize;
229
+ const availableBytes = statistics.bavail * blockSize;
230
+ const availableInodes = statistics.ffree;
218
231
  if (availableBytes < 0n || availableInodes < 0n) {
219
232
  throw new RunnerError('Transfer staging filesystem returned invalid capacity');
220
233
  }
@@ -289,15 +302,6 @@ const cancelBody = async (
289
302
  throw error;
290
303
  };
291
304
 
292
- const writeAll = async (file: Deno.FsFile, value: Uint8Array): Promise<void> => {
293
- let offset = 0;
294
- while (offset < value.byteLength) {
295
- const written = await file.write(value.subarray(offset));
296
- if (written <= 0) throw new RunnerError('Transfer staging write made no progress');
297
- offset += written;
298
- }
299
- };
300
-
301
305
  export const stageTransferDownload = async (
302
306
  download: ITransferDownload,
303
307
  options: {
@@ -324,7 +328,7 @@ export const stageTransferDownload = async (
324
328
  let path: string | undefined;
325
329
  let cleanup: (() => Promise<void>) | undefined;
326
330
  try {
327
- await Deno.mkdir(options.directory, { recursive: true, mode: 0o700 });
331
+ await plugins.fs.mkdir(options.directory, { recursive: true, mode: 0o700 });
328
332
  await ensureStagingCapacity(
329
333
  options.directory,
330
334
  download.sizeBytes,
@@ -345,7 +349,7 @@ export const stageTransferDownload = async (
345
349
  if (!path || !cleanup) {
346
350
  throw new RunnerError('Transfer staging path ownership was not established');
347
351
  }
348
- const digest = createHash('sha256');
352
+ const digest = plugins.crypto.createHash('sha256');
349
353
  let reader: ReadableStreamDefaultReader<Uint8Array>;
350
354
  try {
351
355
  reader = download.body.getReader();
@@ -360,29 +364,35 @@ export const stageTransferDownload = async (
360
364
  }
361
365
  throw error;
362
366
  }
363
- let file: Deno.FsFile | undefined;
364
367
  let sizeBytes = 0;
365
368
  let primaryError: unknown;
366
369
  try {
367
- file = await Deno.open(path, { write: true, truncate: true });
368
- while (true) {
369
- if (options.signal?.aborted) throw options.signal.reason;
370
- const { done, value } = await reader.read();
371
- if (done) break;
372
- if (value.byteLength === 0) continue;
373
- sizeBytes = checkedAdd(sizeBytes, value.byteLength, 'Transfer body length overflow');
374
- if (sizeBytes > download.sizeBytes || sizeBytes > options.limits.maximumArchiveBytes) {
375
- throw new ProtocolError(`${options.label} body exceeded its declared length`);
376
- }
377
- digest.update(value);
378
- await writeAll(file, value);
379
- }
380
- if (sizeBytes !== download.sizeBytes) {
381
- throw new ProtocolError(`${options.label} body length did not match its declaration`);
382
- }
383
- if (digest.digest('hex') !== download.sha256) {
384
- throw new ProtocolError(`${options.label} SHA-256 did not match its declaration`);
385
- }
370
+ await withOpenFile(
371
+ path,
372
+ truncateExistingWriteFlags(),
373
+ undefined,
374
+ async (file) => {
375
+ while (true) {
376
+ if (options.signal?.aborted) throw options.signal.reason;
377
+ const { done, value } = await reader.read();
378
+ if (done) break;
379
+ if (value.byteLength === 0) continue;
380
+ sizeBytes = checkedAdd(sizeBytes, value.byteLength, 'Transfer body length overflow');
381
+ if (sizeBytes > download.sizeBytes || sizeBytes > options.limits.maximumArchiveBytes) {
382
+ throw new ProtocolError(`${options.label} body exceeded its declared length`);
383
+ }
384
+ digest.update(value);
385
+ await writeAll(file, value, 'Transfer staging write made no progress');
386
+ }
387
+ if (sizeBytes !== download.sizeBytes) {
388
+ throw new ProtocolError(`${options.label} body length did not match its declaration`);
389
+ }
390
+ if (digest.digest('hex') !== download.sha256) {
391
+ throw new ProtocolError(`${options.label} SHA-256 did not match its declaration`);
392
+ }
393
+ },
394
+ 'Transfer staging stream cleanup failed',
395
+ );
386
396
  } catch (error) {
387
397
  primaryError = error;
388
398
  try {
@@ -394,21 +404,12 @@ export const stageTransferDownload = async (
394
404
  );
395
405
  }
396
406
  } finally {
397
- const cleanupErrors: unknown[] = [];
398
407
  try {
399
408
  reader.releaseLock();
400
409
  } catch (error) {
401
- cleanupErrors.push(error);
402
- }
403
- try {
404
- file?.close();
405
- } catch (error) {
406
- cleanupErrors.push(error);
407
- }
408
- if (cleanupErrors.length > 0) {
409
410
  primaryError = new ResourceCleanupError(
410
411
  'Transfer staging stream cleanup failed',
411
- primaryError === undefined ? cleanupErrors : [primaryError, ...cleanupErrors],
412
+ primaryError === undefined ? [error] : [primaryError, error],
412
413
  );
413
414
  }
414
415
  }
@@ -709,7 +710,7 @@ class StreamBytes {
709
710
  private async pull(): Promise<void> {
710
711
  if (this.done) return;
711
712
  if (this.signal?.aborted) throw this.signal.reason;
712
- let result: ReadableStreamReadResult<Uint8Array>;
713
+ let result: Awaited<ReturnType<ReadableStreamDefaultReader<Uint8Array>['read']>>;
713
714
  try {
714
715
  result = await this.reader.read();
715
716
  } catch (error) {
@@ -1062,9 +1063,9 @@ const addPathMetadataBytes = (
1062
1063
  };
1063
1064
 
1064
1065
  const effectivePathMetadataLimit = (configured?: number): number => {
1065
- const limit = configured ?? maximumArchivePathMetadataBytes;
1066
+ const limit = configured ?? plugins.maximumArchivePathMetadataBytes;
1066
1067
  checkedInteger(limit, 'Maximum archive path metadata bytes', false);
1067
- if (limit > maximumArchivePathMetadataBytes) {
1068
+ if (limit > plugins.maximumArchivePathMetadataBytes) {
1068
1069
  throw new ProtocolError('Maximum archive path metadata bytes exceeds the protocol ceiling');
1069
1070
  }
1070
1071
  return limit;
@@ -1094,13 +1095,13 @@ const maximumTarStreamBytes = (maximumExtractedBytes: number, maximumEntries: nu
1094
1095
 
1095
1096
  const assertEmptyDirectory = async (path: string): Promise<string> => {
1096
1097
  const absolute = resolve(path);
1097
- const stat = await Deno.lstat(absolute).catch((error) => {
1098
+ const stat = await plugins.fs.lstat(absolute).catch((error) => {
1098
1099
  throw new RunnerError('Unable to inspect archive extraction root', { cause: error });
1099
1100
  });
1100
- if (!stat.isDirectory || stat.isSymlink) {
1101
+ if (!stat.isDirectory() || stat.isSymbolicLink()) {
1101
1102
  throw new RunnerError('Archive extraction root must be a real directory');
1102
1103
  }
1103
- for await (const _entry of Deno.readDir(absolute)) {
1104
+ if ((await plugins.fs.readdir(absolute)).length > 0) {
1104
1105
  throw new RunnerError('Archive extraction root must be empty');
1105
1106
  }
1106
1107
  return absolute;
@@ -1118,21 +1119,41 @@ const parseTarGzip = async (
1118
1119
  options.maximumPathMetadataBytes,
1119
1120
  );
1120
1121
  const maximumMaterializedEntries = effectiveMaterializedEntryLimit(options);
1121
- const archive = await Deno.open(options.archivePath, { read: true }).catch((error) => {
1122
+ const archive = await plugins.fs.open(options.archivePath, 'r').catch((error) => {
1122
1123
  throw new RunnerError('Unable to open staged transfer archive', { cause: error });
1123
1124
  });
1125
+ return await withFileHandle(
1126
+ archive,
1127
+ (archiveHandle) =>
1128
+ parseOpenTarGzip(
1129
+ options,
1130
+ destination,
1131
+ extract,
1132
+ archiveHandle,
1133
+ allowedPaths,
1134
+ maximumPathMetadataBytes,
1135
+ maximumMaterializedEntries,
1136
+ ),
1137
+ 'Transfer archive close failed',
1138
+ );
1139
+ };
1140
+
1141
+ const parseOpenTarGzip = async (
1142
+ options: IExtractTarGzipOptions,
1143
+ destination: string,
1144
+ extract: boolean,
1145
+ archive: TFileHandle,
1146
+ allowedPaths: string[] | undefined,
1147
+ maximumPathMetadataBytes: number,
1148
+ maximumMaterializedEntries: number,
1149
+ ): Promise<IExtractedArchiveMetadata> => {
1124
1150
  let decompressed: ReadableStream<Uint8Array>;
1125
1151
  try {
1126
- decompressed = archive.readable.pipeThrough(new DecompressionStream('gzip'));
1152
+ decompressed = asyncIteratorStream(readFileChunks(archive, streamBufferBytes))
1153
+ .pipeThrough(
1154
+ new DecompressionStream('gzip') as unknown as TransformStream<Uint8Array, Uint8Array>,
1155
+ );
1127
1156
  } catch (error) {
1128
- try {
1129
- archive.close();
1130
- } catch (cleanupError) {
1131
- throw new ResourceCleanupError('Transfer archive setup cleanup failed', [
1132
- error,
1133
- cleanupError,
1134
- ]);
1135
- }
1136
1157
  throw new ProtocolError('Transfer archive is not valid gzip data', { cause: error });
1137
1158
  }
1138
1159
  const bytes = new StreamBytes(
@@ -1265,8 +1286,8 @@ const parseTarGzip = async (
1265
1286
  throw new ProtocolError('Tar directory metadata is invalid');
1266
1287
  }
1267
1288
  if (extract) {
1268
- await Deno.mkdir(target, { recursive: true, mode: 0o700 });
1269
- await Deno.chmod(target, 0o700);
1289
+ await plugins.fs.mkdir(target, { recursive: true, mode: 0o700 });
1290
+ await plugins.fs.chmod(target, 0o700);
1270
1291
  }
1271
1292
  } else if (entryType === 'symlink') {
1272
1293
  if (options.allowSymlinks === false) {
@@ -1293,32 +1314,24 @@ const parseTarGzip = async (
1293
1314
  ) {
1294
1315
  throw new ProtocolError('Tar archive exceeds the effective extracted byte limit');
1295
1316
  }
1296
- let output: Deno.FsFile | undefined;
1297
- let entryError: unknown;
1298
- try {
1299
- if (extract) {
1300
- await Deno.mkdir(dirname(target), { recursive: true, mode: 0o700 });
1301
- output = await Deno.open(target, {
1302
- write: true,
1303
- createNew: true,
1304
- mode: (mode & 0o111) !== 0 ? 0o700 : 0o600,
1305
- });
1306
- }
1307
- await bytes.consume(sizeBytes, output ? (value) => writeAll(output!, value) : undefined);
1308
- } catch (error) {
1309
- entryError = error;
1310
- }
1311
- try {
1312
- output?.close();
1313
- } catch (cleanupError) {
1314
- throw new ResourceCleanupError(
1317
+ if (extract) {
1318
+ await plugins.fs.mkdir(dirname(target), { recursive: true, mode: 0o700 });
1319
+ await withOpenFile(
1320
+ target,
1321
+ createNewWriteFlags,
1322
+ (mode & 0o111) !== 0 ? 0o700 : 0o600,
1323
+ async (output) =>
1324
+ await bytes.consume(
1325
+ sizeBytes,
1326
+ (value) => writeAll(output, value, 'Transfer staging write made no progress'),
1327
+ ),
1315
1328
  'Archive extraction file cleanup failed',
1316
- entryError === undefined ? [cleanupError] : [entryError, cleanupError],
1317
1329
  );
1330
+ } else {
1331
+ await bytes.consume(sizeBytes);
1318
1332
  }
1319
- if (entryError !== undefined) throw entryError;
1320
1333
  if (extract) {
1321
- await Deno.chmod(target, (mode & 0o111) !== 0 ? 0o700 : 0o600);
1334
+ await plugins.fs.chmod(target, (mode & 0o111) !== 0 ? 0o700 : 0o600);
1322
1335
  }
1323
1336
  }
1324
1337
  if (padding) {
@@ -1351,8 +1364,8 @@ const parseTarGzip = async (
1351
1364
  for (const symlink of symlinks) {
1352
1365
  if (options.signal?.aborted) throw options.signal.reason;
1353
1366
  const target = join(destination, ...symlink.path.split('/'));
1354
- await Deno.mkdir(dirname(target), { recursive: true, mode: 0o700 });
1355
- await Deno.symlink(symlink.target, target);
1367
+ await plugins.fs.mkdir(dirname(target), { recursive: true, mode: 0o700 });
1368
+ await plugins.fs.symlink(symlink.target, target);
1356
1369
  }
1357
1370
  }
1358
1371
  complete = true;
@@ -1407,19 +1420,10 @@ export const extractTarGzipArchive = async (
1407
1420
  };
1408
1421
 
1409
1422
  const snapshotFor = (
1410
- stat: Deno.FileInfo,
1423
+ stat: plugins.Stats,
1411
1424
  type: TArchiveEntryType,
1412
1425
  label: string,
1413
1426
  ): IFileSnapshot => {
1414
- if (
1415
- stat.dev === null ||
1416
- stat.ino === null ||
1417
- stat.nlink === null ||
1418
- stat.mode === null ||
1419
- stat.size === null
1420
- ) {
1421
- throw new RunnerError(`${label} does not expose stable filesystem metadata`);
1422
- }
1423
1427
  return {
1424
1428
  type,
1425
1429
  dev: stat.dev,
@@ -1427,19 +1431,19 @@ const snapshotFor = (
1427
1431
  nlink: stat.nlink,
1428
1432
  size: stat.size,
1429
1433
  mode: stat.mode,
1430
- mtime: stat.mtime?.getTime() ?? null,
1434
+ mtime: stat.mtime.getTime(),
1431
1435
  };
1432
1436
  };
1433
1437
 
1434
- const typeForStat = (stat: Deno.FileInfo): TArchiveEntryType => {
1435
- if (stat.isDirectory) return 'directory';
1436
- if (stat.isFile) return 'file';
1437
- if (stat.isSymlink) return 'symlink';
1438
+ const typeForStat = (stat: plugins.Stats): TArchiveEntryType => {
1439
+ if (stat.isDirectory()) return 'directory';
1440
+ if (stat.isFile()) return 'file';
1441
+ if (stat.isSymbolicLink()) return 'symlink';
1438
1442
  throw new RunnerError('Workspace export contains a special filesystem entry');
1439
1443
  };
1440
1444
 
1441
1445
  const assertSnapshot = async (path: string, expected: IFileSnapshot): Promise<void> => {
1442
- const stat = await Deno.lstat(path).catch((error) => {
1446
+ const stat = await plugins.fs.lstat(path).catch((error) => {
1443
1447
  throw new RunnerError('Workspace export changed during archive creation', { cause: error });
1444
1448
  });
1445
1449
  const current = snapshotFor(stat, typeForStat(stat), 'Workspace export entry');
@@ -1492,11 +1496,11 @@ const collectArchiveEntries = async (
1492
1496
  selectedEntryScope: descendantScope.slice(0, -1),
1493
1497
  });
1494
1498
  }
1495
- const root = await Deno.realPath(options.sourcePath).catch((error) => {
1499
+ const root = await plugins.fs.realpath(options.sourcePath).catch((error) => {
1496
1500
  throw new RunnerError('Unable to resolve workspace export root', { cause: error });
1497
1501
  });
1498
- const rootStat = await Deno.lstat(root);
1499
- if (!rootStat.isDirectory || rootStat.isSymlink) {
1502
+ const rootStat = await plugins.fs.lstat(root);
1503
+ if (!rootStat.isDirectory() || rootStat.isSymbolicLink()) {
1500
1504
  throw new RunnerError('Workspace export root must be a real directory');
1501
1505
  }
1502
1506
  const rootSnapshot = snapshotFor(rootStat, 'directory', 'Workspace export root');
@@ -1530,11 +1534,11 @@ const collectArchiveEntries = async (
1530
1534
  parentPath: string,
1531
1535
  ): Promise<Array<{ name: string; nameBytes: Uint8Array; pathBytes: number } | undefined>> => {
1532
1536
  const children: Array<{ name: string; nameBytes: Uint8Array; pathBytes: number }> = [];
1533
- for await (const child of Deno.readDir(absolutePath)) {
1537
+ for (const childName of await plugins.fs.readdir(absolutePath)) {
1534
1538
  if (options.signal?.aborted) throw options.signal.reason;
1535
- const childPath = parentPath ? `${parentPath}/${child.name}` : child.name;
1539
+ const childPath = parentPath ? `${parentPath}/${childName}` : childName;
1536
1540
  pathSegments(childPath, maximumPathBytes, 'Workspace export');
1537
- const nameBytes = textEncoder.encode(child.name);
1541
+ const nameBytes = textEncoder.encode(childName);
1538
1542
  const pathBytes = textEncoder.encode(childPath).byteLength;
1539
1543
  const nextPendingEntries = checkedAdd(
1540
1544
  pendingEntries,
@@ -1567,7 +1571,7 @@ const collectArchiveEntries = async (
1567
1571
  }
1568
1572
  pendingEntries = nextPendingEntries;
1569
1573
  pendingPathMetadataBytes = nextPendingPathMetadataBytes;
1570
- children.push({ name: child.name, nameBytes, pathBytes });
1574
+ children.push({ name: childName, nameBytes, pathBytes });
1571
1575
  }
1572
1576
  return await orderByUtf8Bytes(children, (child) => child.nameBytes, options.signal);
1573
1577
  };
@@ -1576,7 +1580,7 @@ const collectArchiveEntries = async (
1576
1580
  pathSegments(path, maximumPathBytes, 'Workspace export');
1577
1581
  retainPathMetadata(path);
1578
1582
  const absolutePath = join(root, ...path.split('/'));
1579
- const stat = await Deno.lstat(absolutePath);
1583
+ const stat = await plugins.fs.lstat(absolutePath);
1580
1584
  const type = typeForStat(stat);
1581
1585
  const membership = selectedMembership(path, type, selections);
1582
1586
  if (!membership.accepted) {
@@ -1595,7 +1599,7 @@ const collectArchiveEntries = async (
1595
1599
  let linkTarget: string | undefined;
1596
1600
  let symlinkScope: string[] | undefined;
1597
1601
  if (type === 'symlink') {
1598
- linkTarget = await Deno.readLink(absolutePath);
1602
+ linkTarget = await plugins.fs.readlink(absolutePath);
1599
1603
  validateLinkTarget(linkTarget);
1600
1604
  retainPathMetadata(linkTarget);
1601
1605
  const selectionScopes = scopesBySelection.get(membership.selected!)!;
@@ -1766,15 +1770,15 @@ const assertSafeAncestors = async (root: string, path: string, device: number):
1766
1770
  let current = root;
1767
1771
  for (const segment of segments) {
1768
1772
  current = join(current, segment);
1769
- const stat = await Deno.lstat(current);
1770
- if (!stat.isDirectory || stat.isSymlink || stat.dev !== device) {
1773
+ const stat = await plugins.fs.lstat(current);
1774
+ if (!stat.isDirectory() || stat.isSymbolicLink() || stat.dev !== device) {
1771
1775
  throw new RunnerError('Workspace export path changed or crossed a boundary');
1772
1776
  }
1773
1777
  }
1774
1778
  };
1775
1779
 
1776
1780
  const assertOpenFileSnapshot = async (
1777
- file: Pick<Deno.FsFile, 'stat'>,
1781
+ file: Pick<TFileHandle, 'stat'>,
1778
1782
  expected: IFileSnapshot,
1779
1783
  ): Promise<void> => {
1780
1784
  const stat = await file.stat();
@@ -1792,6 +1796,29 @@ const assertOpenFileSnapshot = async (
1792
1796
  }
1793
1797
  };
1794
1798
 
1799
+ async function* exportFileChunks(
1800
+ file: TFileHandle,
1801
+ entry: IArchiveEntry,
1802
+ redactionSet: ISecretRedactionSet,
1803
+ signal?: AbortSignal,
1804
+ ): AsyncGenerator<Uint8Array> {
1805
+ await assertOpenFileSnapshot(file, entry.snapshot);
1806
+ const contentMatcher = redactionSet.empty ? undefined : redactionSet.createContentMatcher();
1807
+ let emitted = 0;
1808
+ for await (const content of readFileChunks(file, streamBufferBytes, signal)) {
1809
+ emitted = checkedAdd(emitted, content.byteLength, 'Workspace export file length overflow');
1810
+ if (emitted > entry.sizeBytes) {
1811
+ throw new RunnerError('Workspace export file grew during archive creation');
1812
+ }
1813
+ if (contentMatcher?.push(content)) throw new SecretDisclosureError();
1814
+ yield content;
1815
+ }
1816
+ if (emitted !== entry.sizeBytes) {
1817
+ throw new RunnerError('Workspace export file shrank during archive creation');
1818
+ }
1819
+ await assertOpenFileSnapshot(file, entry.snapshot);
1820
+ }
1821
+
1795
1822
  async function* tarChunks(
1796
1823
  entries: IArchiveEntry[],
1797
1824
  root: string,
@@ -1838,54 +1865,16 @@ async function* tarChunks(
1838
1865
  const type = entry.type === 'directory' ? '5' : entry.type === 'symlink' ? '2' : '0';
1839
1866
  yield tarHeader(pathField, type, entry.sizeBytes, entry.executable, linkField);
1840
1867
  if (entry.type === 'file') {
1841
- const file = await openRead(entry.absolutePath);
1842
- let fileError: unknown;
1843
- try {
1844
- {
1845
- using _fileOwner = {
1846
- [Symbol.dispose]: () => file.close(),
1847
- };
1848
- try {
1849
- await assertOpenFileSnapshot(file, entry.snapshot);
1850
- const contentMatcher = redactionSet.empty
1851
- ? undefined
1852
- : redactionSet.createContentMatcher();
1853
- const buffer = new Uint8Array(streamBufferBytes);
1854
- let emitted = 0;
1855
- while (true) {
1856
- if (signal?.aborted) throw signal.reason;
1857
- const read = await file.read(buffer);
1858
- if (read === null) break;
1859
- emitted = checkedAdd(emitted, read, 'Workspace export file length overflow');
1860
- if (emitted > entry.sizeBytes) {
1861
- throw new RunnerError('Workspace export file grew during archive creation');
1862
- }
1863
- const content = buffer.slice(0, read);
1864
- if (contentMatcher?.push(content)) throw new SecretDisclosureError();
1865
- yield content;
1866
- }
1867
- if (emitted !== entry.sizeBytes) {
1868
- throw new RunnerError('Workspace export file shrank during archive creation');
1869
- }
1870
- await assertOpenFileSnapshot(file, entry.snapshot);
1871
- } catch (error) {
1872
- fileError = error;
1873
- throw error;
1874
- }
1875
- }
1876
- } catch (error) {
1877
- if (error === fileError) throw error;
1878
- const cleanupError = error instanceof SuppressedError ? error.error : error;
1879
- throw new ResourceCleanupError(
1880
- 'Workspace export file cleanup failed',
1881
- fileError === undefined ? [cleanupError] : [fileError, cleanupError],
1882
- );
1883
- }
1868
+ yield* withFileHandleChunks(
1869
+ await openRead(entry.absolutePath),
1870
+ (file) => exportFileChunks(file, entry, redactionSet, signal),
1871
+ 'Workspace export file cleanup failed',
1872
+ );
1884
1873
  await assertSnapshot(entry.absolutePath, entry.snapshot);
1885
1874
  const padding = paddingFor(entry.sizeBytes);
1886
1875
  if (padding.byteLength) yield padding;
1887
1876
  } else if (entry.type === 'symlink') {
1888
- if (await Deno.readLink(entry.absolutePath) !== entry.linkTarget) {
1877
+ if (await plugins.fs.readlink(entry.absolutePath) !== entry.linkTarget) {
1889
1878
  throw new RunnerError('Workspace export symlink changed during archive creation');
1890
1879
  }
1891
1880
  }
@@ -1895,18 +1884,6 @@ async function* tarChunks(
1895
1884
  yield zeroBlock;
1896
1885
  }
1897
1886
 
1898
- const iteratorStream = (iterator: AsyncGenerator<Uint8Array>): ReadableStream<Uint8Array> =>
1899
- new ReadableStream<Uint8Array>({
1900
- async pull(controller) {
1901
- const result = await iterator.next();
1902
- if (result.done) controller.close();
1903
- else controller.enqueue(result.value);
1904
- },
1905
- async cancel() {
1906
- await iterator.return(undefined);
1907
- },
1908
- });
1909
-
1910
1887
  export const createTarGzipArchive = async (
1911
1888
  options: ICreateTarGzipOptions,
1912
1889
  ): Promise<IPreparedTransferArchive> => {
@@ -1916,7 +1893,7 @@ export const createTarGzipArchive = async (
1916
1893
  checkedInteger(options.expectedMetadata.logicalBytes, 'Workspace export logical bytes');
1917
1894
  checkedInteger(options.expectedMetadata.entryCount, 'Workspace export entry count');
1918
1895
  const collected = await collectArchiveEntries(options);
1919
- await Deno.mkdir(options.archiveDirectory, { recursive: true, mode: 0o700 });
1896
+ await plugins.fs.mkdir(options.archiveDirectory, { recursive: true, mode: 0o700 });
1920
1897
  const fileOperations = options.fileOperations ?? defaultFileOperations;
1921
1898
  const path = await fileOperations.makeTempFile({
1922
1899
  dir: options.archiveDirectory,
@@ -1937,64 +1914,66 @@ export const createTarGzipArchive = async (
1937
1914
  }
1938
1915
  throw error;
1939
1916
  }
1940
- const digest = createHash('sha256');
1917
+ const digest = plugins.crypto.createHash('sha256');
1941
1918
  let sizeBytes = 0;
1942
- let output: Deno.FsFile | undefined;
1943
1919
  let reader: ReadableStreamDefaultReader<Uint8Array> | undefined;
1944
1920
  let archiveSnapshot: IFileSnapshot | undefined;
1945
1921
  try {
1946
- output = await Deno.open(path, { write: true, truncate: true });
1947
- const compressor = new CompressionStream('gzip') as unknown as TransformStream<
1948
- Uint8Array,
1949
- Uint8Array
1950
- >;
1951
- const compressed = iteratorStream(
1952
- tarChunks(
1953
- collected.entries,
1954
- collected.root,
1955
- collected.rootSnapshot.dev,
1956
- fileOperations.openRead ?? defaultFileOperations.openRead!,
1957
- options.redactionSet,
1958
- options.signal,
1959
- ),
1960
- ).pipeThrough(compressor);
1961
- reader = compressed.getReader();
1962
- while (true) {
1963
- if (options.signal?.aborted) throw options.signal.reason;
1964
- const { done, value } = await reader.read();
1965
- if (done) break;
1966
- sizeBytes = checkedAdd(sizeBytes, value.byteLength, 'Archive size overflow');
1967
- if (sizeBytes > options.maximumArchiveBytes) {
1968
- throw new RunnerError('Archive exceeds the effective compressed byte limit');
1969
- }
1970
- digest.update(value);
1971
- await writeAll(output, value);
1972
- }
1922
+ await withOpenFile(
1923
+ path,
1924
+ truncateExistingWriteFlags(),
1925
+ undefined,
1926
+ async (output) => {
1927
+ const compressor = new CompressionStream('gzip') as unknown as TransformStream<
1928
+ Uint8Array,
1929
+ Uint8Array
1930
+ >;
1931
+ const compressed = asyncIteratorStream(
1932
+ tarChunks(
1933
+ collected.entries,
1934
+ collected.root,
1935
+ collected.rootSnapshot.dev,
1936
+ fileOperations.openRead ?? defaultFileOperations.openRead!,
1937
+ options.redactionSet,
1938
+ options.signal,
1939
+ ),
1940
+ ).pipeThrough(compressor);
1941
+ reader = compressed.getReader();
1942
+ while (true) {
1943
+ if (options.signal?.aborted) throw options.signal.reason;
1944
+ const { done, value } = await reader.read();
1945
+ if (done) break;
1946
+ sizeBytes = checkedAdd(sizeBytes, value.byteLength, 'Archive size overflow');
1947
+ if (sizeBytes > options.maximumArchiveBytes) {
1948
+ throw new RunnerError('Archive exceeds the effective compressed byte limit');
1949
+ }
1950
+ digest.update(value);
1951
+ await writeAll(output, value, 'Transfer staging write made no progress');
1952
+ }
1953
+ },
1954
+ 'Archive stream cleanup failed',
1955
+ );
1973
1956
  await assertSnapshot(collected.root, collected.rootSnapshot);
1974
1957
  for (const entry of collected.entries) {
1975
1958
  if (options.signal?.aborted) throw options.signal.reason;
1976
1959
  await assertSnapshot(entry.absolutePath, entry.snapshot);
1977
1960
  }
1978
1961
  archiveSnapshot = snapshotFor(
1979
- await Deno.lstat(path),
1962
+ await plugins.fs.lstat(path),
1980
1963
  'file',
1981
1964
  'Prepared transfer archive',
1982
1965
  );
1983
1966
  } catch (error) {
1984
1967
  const errors = [error];
1968
+ const openReader = reader as ReadableStreamDefaultReader<Uint8Array> | undefined;
1985
1969
  try {
1986
- await reader?.cancel(error);
1970
+ await openReader?.cancel(error);
1987
1971
  } catch (cleanupError) {
1988
1972
  // Canceling a stream that already errored rejects with that same stored error.
1989
1973
  if (cleanupError !== error) errors.push(cleanupError);
1990
1974
  }
1991
1975
  try {
1992
- reader?.releaseLock();
1993
- } catch (cleanupError) {
1994
- errors.push(cleanupError);
1995
- }
1996
- try {
1997
- output?.close();
1976
+ openReader?.releaseLock();
1998
1977
  } catch (cleanupError) {
1999
1978
  errors.push(cleanupError);
2000
1979
  }
@@ -2008,18 +1987,10 @@ export const createTarGzipArchive = async (
2008
1987
  }
2009
1988
  throw error;
2010
1989
  }
2011
- const streamCleanupErrors: unknown[] = [];
2012
1990
  try {
2013
- reader.releaseLock();
1991
+ (reader as ReadableStreamDefaultReader<Uint8Array> | undefined)?.releaseLock();
2014
1992
  } catch (error) {
2015
- streamCleanupErrors.push(error);
2016
- }
2017
- try {
2018
- output.close();
2019
- } catch (error) {
2020
- streamCleanupErrors.push(error);
2021
- }
2022
- if (streamCleanupErrors.length > 0) {
1993
+ const streamCleanupErrors: unknown[] = [error];
2023
1994
  try {
2024
1995
  await cleanup();
2025
1996
  } catch (cleanupError) {
@@ -2047,7 +2018,7 @@ export const createTarGzipArchive = async (
2047
2018
  metadata,
2048
2019
  openBody: async () => {
2049
2020
  await assertSnapshot(path, archiveSnapshot);
2050
- return (await Deno.open(path, { read: true })).readable;
2021
+ return await openReadableFile(path, streamBufferBytes, 'Transfer archive body close failed');
2051
2022
  },
2052
2023
  cleanup,
2053
2024
  };