@ship.zone/runner 2.1.0 → 4.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 (200) hide show
  1. package/.smartconfig.json +118 -3
  2. package/changelog.md +101 -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 +47 -0
  14. package/dist_ts/api-client.js +600 -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 +18 -0
  23. package/dist_ts/cli.d.ts +14 -0
  24. package/dist_ts/cli.js +243 -0
  25. package/dist_ts/config.d.ts +8 -0
  26. package/dist_ts/config.js +495 -0
  27. package/dist_ts/egress-proxy.d.ts +99 -0
  28. package/dist_ts/egress-proxy.js +607 -0
  29. package/dist_ts/errors.d.ts +41 -0
  30. package/dist_ts/errors.js +90 -0
  31. package/dist_ts/filesystem.d.ts +73 -0
  32. package/dist_ts/filesystem.js +207 -0
  33. package/dist_ts/index.d.ts +20 -0
  34. package/dist_ts/index.js +21 -0
  35. package/dist_ts/interfaces.d.ts +685 -0
  36. package/dist_ts/interfaces.js +3 -0
  37. package/dist_ts/log-sender.d.ts +26 -0
  38. package/dist_ts/log-sender.js +124 -0
  39. package/dist_ts/microvm-executor.d.ts +90 -0
  40. package/dist_ts/microvm-executor.js +1045 -0
  41. package/dist_ts/node-version.d.ts +11 -0
  42. package/dist_ts/node-version.js +43 -0
  43. package/dist_ts/npm-grants.d.ts +9 -0
  44. package/dist_ts/npm-grants.js +44 -0
  45. package/dist_ts/oci-registry.d.ts +73 -0
  46. package/dist_ts/oci-registry.js +508 -0
  47. package/dist_ts/plugins.d.ts +23 -0
  48. package/dist_ts/plugins.js +27 -0
  49. package/dist_ts/protocol-validator.d.ts +39 -0
  50. package/dist_ts/protocol-validator.js +488 -0
  51. package/dist_ts/redactor.d.ts +78 -0
  52. package/dist_ts/redactor.js +235 -0
  53. package/dist_ts/registration-state.d.ts +16 -0
  54. package/dist_ts/registration-state.js +171 -0
  55. package/dist_ts/runner.d.ts +65 -0
  56. package/dist_ts/runner.js +912 -0
  57. package/dist_ts/source-workspace.d.ts +10 -0
  58. package/dist_ts/source-workspace.js +125 -0
  59. package/dist_ts/spec-version.d.ts +11 -0
  60. package/dist_ts/spec-version.js +41 -0
  61. package/dist_ts/staging-scavenger.d.ts +7 -0
  62. package/dist_ts/staging-scavenger.js +63 -0
  63. package/dist_ts/state-owner.d.ts +74 -0
  64. package/dist_ts/state-owner.js +291 -0
  65. package/dist_ts/transfer-archive.d.ts +78 -0
  66. package/dist_ts/transfer-archive.js +1619 -0
  67. package/dist_ts/validation.d.ts +11 -0
  68. package/dist_ts/validation.js +79 -0
  69. package/dist_ts/vsock-protocol.d.ts +130 -0
  70. package/dist_ts/vsock-protocol.js +336 -0
  71. package/dist_ts/wire-schema.d.ts +10 -0
  72. package/dist_ts/wire-schema.js +114 -0
  73. package/native-notices/crates/bitflags-2.13.1/license-apache +201 -0
  74. package/native-notices/crates/bitflags-2.13.1/license-mit +25 -0
  75. package/native-notices/crates/cc-1.8.0/license-apache +201 -0
  76. package/native-notices/crates/cc-1.8.0/license-mit +25 -0
  77. package/native-notices/crates/cfg-if-1.0.4/license-apache +201 -0
  78. package/native-notices/crates/cfg-if-1.0.4/license-mit +25 -0
  79. package/native-notices/crates/cfg_aliases-0.2.2/license +9 -0
  80. package/native-notices/crates/cfg_aliases-0.2.2/notices.md +26 -0
  81. package/native-notices/crates/find-msvc-tools-0.1.14/license-apache +201 -0
  82. package/native-notices/crates/find-msvc-tools-0.1.14/license-mit +25 -0
  83. package/native-notices/crates/itoa-1.0.18/license-apache +176 -0
  84. package/native-notices/crates/itoa-1.0.18/license-mit +23 -0
  85. package/native-notices/crates/libc-0.2.189/license-apache +176 -0
  86. package/native-notices/crates/libc-0.2.189/license-mit +25 -0
  87. package/native-notices/crates/memchr-2.8.3/copying +3 -0
  88. package/native-notices/crates/memchr-2.8.3/license-mit +21 -0
  89. package/native-notices/crates/memchr-2.8.3/unlicense +24 -0
  90. package/native-notices/crates/nix-0.30.1/license +21 -0
  91. package/native-notices/crates/proc-macro2-1.0.107/license-apache +176 -0
  92. package/native-notices/crates/proc-macro2-1.0.107/license-mit +23 -0
  93. package/native-notices/crates/quote-1.0.47/license-apache +176 -0
  94. package/native-notices/crates/quote-1.0.47/license-mit +23 -0
  95. package/native-notices/crates/serde-1.0.229/license-apache +176 -0
  96. package/native-notices/crates/serde-1.0.229/license-mit +23 -0
  97. package/native-notices/crates/serde_core-1.0.229/license-apache +176 -0
  98. package/native-notices/crates/serde_core-1.0.229/license-mit +23 -0
  99. package/native-notices/crates/serde_derive-1.0.229/license-apache +176 -0
  100. package/native-notices/crates/serde_derive-1.0.229/license-mit +23 -0
  101. package/native-notices/crates/serde_json-1.0.151/license-apache +176 -0
  102. package/native-notices/crates/serde_json-1.0.151/license-mit +23 -0
  103. package/native-notices/crates/shlex-2.0.1/license-apache +13 -0
  104. package/native-notices/crates/shlex-2.0.1/license-mit +21 -0
  105. package/native-notices/crates/syn-3.0.3/license-apache +176 -0
  106. package/native-notices/crates/syn-3.0.3/license-mit +23 -0
  107. package/native-notices/crates/tikv-jemalloc-sys-0.7.1+5.3.1-0-g81034ce1f1373e37dc865038e1bc8eeecf559ce8/license-apache +201 -0
  108. package/native-notices/crates/tikv-jemalloc-sys-0.7.1+5.3.1-0-g81034ce1f1373e37dc865038e1bc8eeecf559ce8/license-mit +25 -0
  109. package/native-notices/crates/tikv-jemallocator-0.7.0/license-apache +201 -0
  110. package/native-notices/crates/tikv-jemallocator-0.7.0/license-mit +25 -0
  111. package/native-notices/crates/unicode-ident-1.0.24/license-apache +176 -0
  112. package/native-notices/crates/unicode-ident-1.0.24/license-mit +23 -0
  113. package/native-notices/crates/unicode-ident-1.0.24/license-unicode +39 -0
  114. package/native-notices/crates/zmij-1.0.23/license-mit +23 -0
  115. package/native-notices/manifest.json +763 -0
  116. package/native-notices/native/tikv-jemalloc-sys-0.7.1+5.3.1-0-g81034ce1f1373e37dc865038e1bc8eeecf559ce8/jemalloc-5.3.1/jemalloc-copying +27 -0
  117. package/native-notices/readme.md +46 -0
  118. package/native-notices/runtime/gcc/gpl-3.0.txt +674 -0
  119. package/native-notices/runtime/gcc/runtime-library-exception-3.1.txt +73 -0
  120. package/native-notices/runtime/libunwind-22.1.2/license.txt +311 -0
  121. package/native-notices/runtime/musl-1.2.5/copyright +193 -0
  122. package/native-notices/rust/compiler-builtins-license.txt +275 -0
  123. package/native-notices/rust/copyright-library.html +8266 -0
  124. package/native-notices/rust/crates/addr2line-0.25.1/license-apache +201 -0
  125. package/native-notices/rust/crates/addr2line-0.25.1/license-mit +25 -0
  126. package/native-notices/rust/crates/adler2-2.0.1/license-0bsd +12 -0
  127. package/native-notices/rust/crates/adler2-2.0.1/license-apache +201 -0
  128. package/native-notices/rust/crates/adler2-2.0.1/license-mit +23 -0
  129. package/native-notices/rust/crates/memchr-2.7.6/copying +3 -0
  130. package/native-notices/rust/crates/memchr-2.7.6/license-mit +21 -0
  131. package/native-notices/rust/crates/memchr-2.7.6/unlicense +24 -0
  132. package/native-notices/rust/crates/miniz_oxide-0.8.9/license +25 -0
  133. package/native-notices/rust/crates/miniz_oxide-0.8.9/license-apache.md +177 -0
  134. package/native-notices/rust/crates/miniz_oxide-0.8.9/license-mit.md +24 -0
  135. package/native-notices/rust/crates/miniz_oxide-0.8.9/license-zlib.md +14 -0
  136. package/native-notices/rust/crates/object-0.37.3/license-apache +201 -0
  137. package/native-notices/rust/crates/object-0.37.3/license-mit +25 -0
  138. package/native-notices/rust/licenses/apache-2.0.txt +73 -0
  139. package/native-notices/rust/licenses/bsd-2-clause.txt +9 -0
  140. package/native-notices/rust/licenses/cc-by-sa-4.0.txt +427 -0
  141. package/native-notices/rust/licenses/gcc-exception-3.1.txt +30 -0
  142. package/native-notices/rust/licenses/gpl-2.0-only.txt +133 -0
  143. package/native-notices/rust/licenses/gpl-3.0-or-later.txt +202 -0
  144. package/native-notices/rust/licenses/isc.txt +7 -0
  145. package/native-notices/rust/licenses/llvm-exception.txt +15 -0
  146. package/native-notices/rust/licenses/mit.txt +9 -0
  147. package/native-notices/rust/licenses/ncsa.txt +29 -0
  148. package/native-notices/rust/licenses/ofl-1.1.txt +43 -0
  149. package/native-notices/rust/licenses/unicode-3.0.txt +39 -0
  150. package/package.json +31 -26
  151. package/readme.md +157 -95
  152. package/rust/.cargo/config.toml +1 -1
  153. package/rust/Cargo.lock +1 -0
  154. package/rust/Cargo.toml +3 -2
  155. package/rust/src/cpio.rs +147 -0
  156. package/rust/src/extfs.rs +747 -0
  157. package/rust/src/guest.rs +2411 -0
  158. package/rust/src/lib.rs +197 -1
  159. package/rust/src/main.rs +7 -2
  160. package/rust/src/oci_tar.rs +842 -0
  161. package/rust-toolchain.toml +4 -0
  162. package/ts/00_commitinfo_data.ts +2 -2
  163. package/ts/api-client.ts +29 -8
  164. package/ts/artifact-manager.ts +9 -7
  165. package/ts/attempt-state.ts +75 -84
  166. package/ts/cache-manager.ts +22 -28
  167. package/ts/cli-entry.ts +17 -0
  168. package/ts/cli.ts +86 -53
  169. package/ts/config.ts +146 -62
  170. package/ts/egress-proxy.ts +649 -0
  171. package/ts/errors.ts +19 -0
  172. package/ts/filesystem.ts +316 -0
  173. package/ts/index.ts +20 -15
  174. package/ts/interfaces.ts +105 -23
  175. package/ts/log-sender.ts +4 -4
  176. package/ts/microvm-executor.ts +1265 -0
  177. package/ts/node-version.ts +49 -0
  178. package/ts/npm-grants.ts +49 -0
  179. package/ts/oci-registry.ts +649 -0
  180. package/ts/plugins.ts +25 -3
  181. package/ts/protocol-validator.ts +34 -30
  182. package/ts/redactor.ts +2 -2
  183. package/ts/registration-state.ts +82 -90
  184. package/ts/runner.ts +81 -34
  185. package/ts/source-workspace.ts +11 -8
  186. package/ts/spec-version.ts +2 -2
  187. package/ts/staging-scavenger.ts +37 -26
  188. package/ts/state-owner.ts +353 -0
  189. package/ts/transfer-archive.ts +214 -243
  190. package/ts/validation.ts +1 -1
  191. package/ts/vsock-protocol.ts +437 -0
  192. package/ts/wire-schema.ts +3 -3
  193. package/deno.json +0 -56
  194. package/deno.lock +0 -1495
  195. package/dist_npm/mod.d.ts +0 -967
  196. package/dist_npm/mod.js +0 -10058
  197. package/mod.ts +0 -8
  198. package/musl-copyright.md +0 -81
  199. package/third-party-licenses.md +0 -187
  200. package/ts/oci-executor.ts +0 -3137
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The minimum Node.js version of the runner: `engines.node` of its `package.json`, which must have
3
+ * the form `>=major.minor.patch`.
4
+ */
5
+ export declare const nodeEnginesMinimum: () => string;
6
+ /**
7
+ * Refuses a Node.js release older than the `engines.node` minimum before the runner starts: on
8
+ * such a release the runner would fail deep inside, for example because `fs.statfs` does not
9
+ * report the fragment size.
10
+ */
11
+ export declare const assertSupportedNodeVersion: (nodeVersion: string) => void;
@@ -0,0 +1,43 @@
1
+ // The bundle of the single executables inlines package.json; dist_ts and ts read it from the
2
+ // package root.
3
+ import packageJson from '../package.json' with { type: 'json' };
4
+ import { RunnerError } from './errors.js';
5
+ const releaseVersionPattern = /^(\d+)\.(\d+)\.(\d+)$/;
6
+ const enginesRangePattern = /^>=\s*(\d+\.\d+\.\d+)$/;
7
+ const parseReleaseVersion = (version, label) => {
8
+ const match = releaseVersionPattern.exec(version);
9
+ if (!match)
10
+ throw new RunnerError(`${label} ${version} is not a major.minor.patch version`);
11
+ return [Number(match[1]), Number(match[2]), Number(match[3])];
12
+ };
13
+ const isAtLeast = (version, minimum) => {
14
+ for (let index = 0; index < version.length; index++) {
15
+ if (version[index] !== minimum[index])
16
+ return version[index] > minimum[index];
17
+ }
18
+ return true;
19
+ };
20
+ /**
21
+ * The minimum Node.js version of the runner: `engines.node` of its `package.json`, which must have
22
+ * the form `>=major.minor.patch`.
23
+ */
24
+ export const nodeEnginesMinimum = () => {
25
+ const match = enginesRangePattern.exec(packageJson.engines.node);
26
+ if (!match) {
27
+ throw new RunnerError('The runner package.json engines.node must be ">=major.minor.patch"');
28
+ }
29
+ return match[1];
30
+ };
31
+ /**
32
+ * Refuses a Node.js release older than the `engines.node` minimum before the runner starts: on
33
+ * such a release the runner would fail deep inside, for example because `fs.statfs` does not
34
+ * report the fragment size.
35
+ */
36
+ export const assertSupportedNodeVersion = (nodeVersion) => {
37
+ const minimum = nodeEnginesMinimum();
38
+ const version = parseReleaseVersion(nodeVersion, 'Node.js');
39
+ if (!isAtLeast(version, parseReleaseVersion(minimum, 'The engines.node minimum'))) {
40
+ throw new RunnerError(`The runner needs Node.js ${minimum} or later, and this is Node.js ${nodeVersion}`);
41
+ }
42
+ };
43
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZS12ZXJzaW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHMvbm9kZS12ZXJzaW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDZGQUE2Rjt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SyxDQUFDLENBQUM7SUFDaEYsQ0FBQztJQUNELE9BQU8sSUFBSSxDQUFDO0FBQ2QsQ0FBQyxDQUFDO0FBRUY7OztHQUdHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sa0JBQWtCLEdBQUcsR0FBVyxFQUFFO0lBQzdDLE1BQU0sS0FBSyxHQUFHLG1CQUFtQixDQUFDLElBQUksQ0FBQyxXQUFXLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ2pFLElBQUksQ0FBQyxLQUFLLEVBQUUsQ0FBQztRQUNYLE1BQU0sSUFBSSxXQUFXLENBQUMsb0VBQW9FLENBQUMsQ0FBQztJQUM5RixDQUFDO0lBQ0QsT0FBTyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUM7QUFDbEIsQ0FBQyxDQUFDO0FBRUY7Ozs7R0FJRztBQUNILE1BQU0sQ0FBQyxNQUFNLDBCQUEwQixHQUFHLENBQUMsV0FBbUIsRUFBUSxFQUFFO0lBQ3RFLE1BQU0sT0FBTyxHQUFHLGtCQUFrQixFQUFFLENBQUM7SUFDckMsTUFBTSxPQUFPLEdBQUcsbUJBQW1CLENBQUMsV0FBVyxFQUFFLFNBQVMsQ0FBQyxDQUFDO0lBQzVELElBQUksQ0FBQyxTQUFTLENBQUMsT0FBTyxFQUFFLG1CQUFtQixDQUFDLE9BQU8sRUFBRSwwQkFBMEIsQ0FBQyxDQUFDLEVBQUUsQ0FBQztRQUNsRixNQUFNLElBQUksV0FBVyxDQUNuQiw0QkFBNEIsT0FBTyxrQ0FBa0MsV0FBVyxFQUFFLENBQ25GLENBQUM7SUFDSixDQUFDO0FBQ0gsQ0FBQyxDQUFDIn0=
@@ -0,0 +1,9 @@
1
+ import type { INpmGrant } from './interfaces.js';
2
+ /** Fixed guest path where the runner mounts the read-only attempt-scoped npm config file. */
3
+ export declare const GUEST_NPMRC_PATH = "/run/shipzone-npmrc/npmrc";
4
+ /**
5
+ * Renders the attempt-scoped `.npmrc` file from `npmGrants` per `@ship.zone/ci-spec`
6
+ * (npm Read Grants): maps every scope to its registry and binds each attempt-scoped read token
7
+ * without placing the token anywhere else.
8
+ */
9
+ export declare const buildNpmrcContent: (grants: readonly INpmGrant[]) => string;
@@ -0,0 +1,44 @@
1
+ import { ProtocolError } from './errors.js';
2
+ /** Fixed guest path where the runner mounts the read-only attempt-scoped npm config file. */
3
+ export const GUEST_NPMRC_PATH = '/run/shipzone-npmrc/npmrc';
4
+ const ensureTrailingSlash = (value) => (value.endsWith('/') ? value : `${value}/`);
5
+ /**
6
+ * Renders the attempt-scoped `.npmrc` file from `npmGrants` per `@ship.zone/ci-spec`
7
+ * (npm Read Grants): maps every scope to its registry and binds each attempt-scoped read token
8
+ * without placing the token anywhere else.
9
+ */
10
+ export const buildNpmrcContent = (grants) => {
11
+ if (grants.length === 0)
12
+ return '';
13
+ const lines = [];
14
+ const emittedTokens = new Set();
15
+ for (const grant of grants) {
16
+ if (grant.secret.includes('\n') || grant.secret.includes('\r')) {
17
+ throw new ProtocolError('npm grant secret must not contain line terminators');
18
+ }
19
+ let parsed;
20
+ try {
21
+ parsed = new URL(grant.registry);
22
+ }
23
+ catch (error) {
24
+ throw new ProtocolError(`Invalid npm grant registry URL: ${grant.registry}`, { cause: error });
25
+ }
26
+ if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') {
27
+ throw new ProtocolError(`Unsupported npm grant registry protocol: ${parsed.protocol}`);
28
+ }
29
+ const registryUrl = ensureTrailingSlash(parsed.toString());
30
+ const authKey = `//${parsed.host}${ensureTrailingSlash(parsed.pathname)}:_authToken`;
31
+ for (const scope of grant.scopes) {
32
+ if (!scope.startsWith('@') || scope.includes('=') || scope.includes('\n') || scope.includes('\r')) {
33
+ throw new ProtocolError(`Invalid npm grant scope: ${scope}`);
34
+ }
35
+ lines.push(`${scope}:registry=${registryUrl}`);
36
+ }
37
+ if (!emittedTokens.has(authKey)) {
38
+ emittedTokens.add(authKey);
39
+ lines.push(`${authKey}=${grant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Qyw0QkFBNEIsS0FBSyxFQUFFLENBQUMsQ0FBQztZQUMvRCxDQUFDO1lBQ0QsS0FBSyxDQUFDLElBQUksQ0FBQyxHQUFHLEtBQUssYUFBYSxXQUFXLEVBQUUsQ0FBQyxDQUFDO1FBQ2pELENBQUM7UUFFRCxJQUFJLENBQUMsYUFBYSxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsRUFBRSxDQUFDO1lBQ2hDLGFBQWEsQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLENBQUM7WUFDM0IsS0FBSyxDQUFDLElBQUksQ0FBQyxHQUFHLE9BQU8sSUFBSSxLQUFLLENBQUMsTUFBTSxFQUFFLENBQUMsQ0FBQztRQUMzQyxDQUFDO0lBQ0gsQ0FBQztJQUVELE9BQU8sR0FBRyxLQUFLLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUM7QUFDakMsQ0FBQyxDQUFDIn0=
@@ -0,0 +1,73 @@
1
+ import type { IImageBinding, IImageGrant, TImageReference, TOciArchitecture } from './interfaces.js';
2
+ export interface IParsedImageReference {
3
+ readonly raw: string;
4
+ readonly registry: string;
5
+ readonly repository: string;
6
+ /** Exact literal registry segment before the first `/` (undefined if hostless). */
7
+ readonly exactRegistry?: string;
8
+ /** Exact literal repository segment between the first `/` and `@` (undefined if hostless). */
9
+ readonly exactRepository?: string;
10
+ readonly digest: string;
11
+ readonly digestHex: string;
12
+ }
13
+ export interface IMaterializedOciImage {
14
+ readonly image: string;
15
+ readonly manifestDigest: string;
16
+ readonly os: 'linux';
17
+ readonly architecture: TOciArchitecture;
18
+ readonly rootfsPath: string;
19
+ readonly rootfsSha256: string;
20
+ readonly rootfsSizeBytes: number;
21
+ readonly defaultEnv: Record<string, string>;
22
+ readonly defaultWorkingDir?: string;
23
+ /** True when pulled with a lease pull grant into an attempt-private store. */
24
+ readonly attemptPrivate: boolean;
25
+ /** Removes the attempt-private store when `attemptPrivate` is true; no-op for shared cache. */
26
+ cleanup(): Promise<void>;
27
+ }
28
+ export interface IOciRegistryClientOptions {
29
+ readonly cacheDirectory: string;
30
+ readonly helperPath: string;
31
+ readonly allowInsecureLoopback: boolean;
32
+ readonly requestTimeoutMs: number;
33
+ readonly maximumRootfsBytes: number;
34
+ readonly fetchImplementation?: typeof fetch;
35
+ readonly buildRootfs?: (options: {
36
+ helperPath: string;
37
+ layerPaths: string[];
38
+ outputPath: string;
39
+ maximumBytes: number;
40
+ signal?: AbortSignal;
41
+ }) => Promise<void>;
42
+ }
43
+ /**
44
+ * Resolves a job's `TImageReference` (either a digest-pinned string or `{ candidate }`) using the
45
+ * lease's `bindings`.
46
+ */
47
+ export declare const resolveImageReference: (imageRef: TImageReference, bindings: readonly IImageBinding[]) => string;
48
+ /**
49
+ * Parses a digest-pinned OCI/Docker image reference (`<name>@sha256:<64 hex>`).
50
+ * Rejects mutable tags without a digest.
51
+ */
52
+ export declare const parseDigestPinnedImageReference: (image: string) => IParsedImageReference;
53
+ /**
54
+ * Matches an image reference against lease pull grants using exact literal registry & repository
55
+ * equality per `@ship.zone/ci-spec` (no default registry, no rewriting, no case folding).
56
+ */
57
+ export declare const findMatchingPullGrant: (image: string, grants: readonly IImageGrant[]) => IImageGrant | undefined;
58
+ /**
59
+ * Pulls digest-pinned Linux OCI/Docker images directly via OCI Distribution v2 over HTTP(S),
60
+ * verifies every manifest, config, and layer SHA-256 digest, honors attempt-scoped pull grants
61
+ * without following redirects or leaking private layers into shared cache, and materializes a
62
+ * deterministic read-only ext2 rootfs image.
63
+ */
64
+ export declare class OciRegistryClient {
65
+ private readonly options;
66
+ private readonly fetchImpl;
67
+ private readonly buildRootfsImpl;
68
+ constructor(options: IOciRegistryClientOptions);
69
+ private originFor;
70
+ private fetchRegistry;
71
+ private fetchDigestBlob;
72
+ materializeImage(image: string, targetArchitecture: TOciArchitecture, signal?: AbortSignal, grants?: readonly IImageGrant[]): Promise<IMaterializedOciImage>;
73
+ }