@ship.zone/runner 2.0.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 (180) hide show
  1. package/.smartconfig.json +101 -3
  2. package/changelog.md +69 -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 -21
  141. package/readme.md +91 -40
  142. package/rust/.cargo/config.toml +1 -1
  143. package/rust/Cargo.lock +43 -0
  144. package/rust/Cargo.toml +4 -1
  145. package/rust/src/lib.rs +156 -1
  146. package/rust/src/main.rs +5 -1
  147. package/rust-toolchain.toml +4 -0
  148. package/ts/00_commitinfo_data.ts +1 -1
  149. package/ts/api-client.ts +10 -7
  150. package/ts/artifact-manager.ts +9 -7
  151. package/ts/attempt-state.ts +75 -84
  152. package/ts/cache-manager.ts +22 -28
  153. package/ts/cli-entry.ts +4 -0
  154. package/ts/cli.ts +56 -45
  155. package/ts/config.ts +50 -39
  156. package/ts/errors.ts +19 -0
  157. package/ts/filesystem.ts +316 -0
  158. package/ts/index.ts +16 -15
  159. package/ts/interfaces.ts +2 -2
  160. package/ts/log-sender.ts +4 -4
  161. package/ts/oci-executor.ts +235 -383
  162. package/ts/plugins.ts +21 -3
  163. package/ts/protocol-validator.ts +5 -5
  164. package/ts/redactor.ts +2 -2
  165. package/ts/registration-state.ts +82 -90
  166. package/ts/runner.ts +30 -17
  167. package/ts/source-workspace.ts +11 -8
  168. package/ts/spec-version.ts +2 -2
  169. package/ts/staging-scavenger.ts +37 -26
  170. package/ts/state-owner.ts +346 -0
  171. package/ts/transfer-archive.ts +214 -243
  172. package/ts/validation.ts +1 -1
  173. package/ts/wire-schema.ts +3 -3
  174. package/deno.json +0 -56
  175. package/deno.lock +0 -1762
  176. package/dist_npm/mod.d.ts +0 -967
  177. package/dist_npm/mod.js +0 -10058
  178. package/mod.ts +0 -8
  179. package/musl-copyright.md +0 -81
  180. package/third-party-licenses.md +0 -95
@@ -0,0 +1,614 @@
1
+ export declare const runnerVersion: string;
2
+ export type TExecutionProfile = 'oci' | 'oci-image' | 'vm';
3
+ export type TIsolation = 'container' | 'microvm';
4
+ export type TRunnerFeature = 'source.tar-gz' | 'artifacts' | 'caches';
5
+ export type TLeaseFeature = 'image-pull-grants' | 'candidate-bindings' | 'npm-read-grants';
6
+ export type TNetworkMode = 'none' | 'egress';
7
+ export type TSourceFormat = 'tar.gz';
8
+ export type TOciRuntime = 'docker' | 'podman';
9
+ export type TArtifactPermission = 'none' | 'write';
10
+ export type TCachePermission = 'none' | 'read' | 'read-write';
11
+ export type TImagePermission = 'none' | 'push';
12
+ export type TCacheAccess = 'read' | 'read-write';
13
+ export type TArtifactWhen = 'always' | 'success' | 'failure';
14
+ export type TLogStream = 'stdout' | 'stderr' | 'runner';
15
+ export type TImageGrantAccess = 'pull' | 'push';
16
+ export type TJobCompletionStatus = 'succeeded' | 'failed' | 'canceled' | 'timed_out' | 'system_error';
17
+ export type TCancellationReason = 'user_requested' | 'superseded' | 'policy' | 'coordinator_shutdown';
18
+ export type TAbandonReason = 'runner_shutdown' | 'runner_error';
19
+ export type TJsonPrimitive = null | boolean | number | string;
20
+ export type TJsonValue = TJsonPrimitive | TJsonValue[] | {
21
+ [key: string]: TJsonValue;
22
+ };
23
+ export type TJsonObject = {
24
+ [key: string]: TJsonValue;
25
+ };
26
+ export interface IProtocolLimits {
27
+ maximumJsonBytes: number;
28
+ maximumLogChunkBytes: number;
29
+ maximumTotalLogBytes: number;
30
+ minimumLeaseSeconds: number;
31
+ maximumLeaseSeconds: number;
32
+ }
33
+ export interface IDiscoveryResponse {
34
+ spec: string;
35
+ basePath: '/api/runner';
36
+ status: 'draft';
37
+ serverTime: string;
38
+ limits: IProtocolLimits;
39
+ }
40
+ export interface IRunnerCredential {
41
+ credentialId: string;
42
+ runnerId: string;
43
+ token: string;
44
+ expiresAt: string;
45
+ previousCredentialValidUntil?: string;
46
+ }
47
+ export interface ITransferLimits {
48
+ maximumSourceArchiveBytes: number;
49
+ maximumSourceExtractedBytes: number;
50
+ maximumSourceEntries: number;
51
+ maximumArtifactArchiveBytes: number;
52
+ maximumArtifactExtractedBytes: number;
53
+ maximumArtifactEntries: number;
54
+ maximumArtifacts: number;
55
+ maximumCacheArchiveBytes: number;
56
+ maximumCacheExtractedBytes: number;
57
+ maximumCacheEntries: number;
58
+ maximumCaches: number;
59
+ maximumLogChunkBytes: number;
60
+ maximumTotalLogBytes: number;
61
+ maximumWorkspaceBytes: number;
62
+ maximumWorkspaceEntries: number;
63
+ }
64
+ export interface IResourceLimits {
65
+ maximumMemoryBytes: number;
66
+ maximumCpus: number;
67
+ maximumPids: number;
68
+ maximumSharedMemoryBytes: number;
69
+ }
70
+ export interface IRunnerCapabilities {
71
+ executionProfiles: TExecutionProfile[];
72
+ isolation: TIsolation[];
73
+ platforms: string[];
74
+ labels: string[];
75
+ features: TRunnerFeature[];
76
+ networks: TNetworkMode[];
77
+ sourceFormats: TSourceFormat[];
78
+ limits: ITransferLimits;
79
+ /** The largest resource ceilings the runner enforces per attempt. */
80
+ resources?: IResourceLimits;
81
+ /** The lease contents the runner uses. */
82
+ leaseFeatures?: TLeaseFeature[];
83
+ /** The largest job `timeoutMs` the runner executes. */
84
+ maximumTimeoutMs?: number;
85
+ }
86
+ export interface IRegisterRunnerRequest {
87
+ registrationRequestId: string;
88
+ spec: string;
89
+ runnerVersion: string;
90
+ name: string;
91
+ capabilities: IRunnerCapabilities;
92
+ }
93
+ export interface IRegisterRunnerResponse {
94
+ spec: string;
95
+ serverTime: string;
96
+ registrationReplayUntil: string;
97
+ credential: IRunnerCredential;
98
+ }
99
+ export interface IStartSessionRequest {
100
+ sessionRequestId: string;
101
+ runnerId: string;
102
+ spec: string;
103
+ runnerVersion: string;
104
+ capabilities: IRunnerCapabilities;
105
+ }
106
+ export interface IStartSessionResponse {
107
+ sessionId: string;
108
+ spec: string;
109
+ serverTime: string;
110
+ credential?: IRunnerCredential;
111
+ }
112
+ export interface IRunnerHeartbeatRequest {
113
+ runnerId: string;
114
+ sessionId: string;
115
+ }
116
+ export interface IRunnerHeartbeatResponse {
117
+ serverTime: string;
118
+ drainRequested: boolean;
119
+ credential?: IRunnerCredential;
120
+ }
121
+ export interface IClaimJobRequest {
122
+ claimRequestId: string;
123
+ runnerId: string;
124
+ sessionId: string;
125
+ capabilities: IRunnerCapabilities;
126
+ }
127
+ export interface IClaimJobResponse {
128
+ serverTime: string;
129
+ retryAfterMs?: number;
130
+ lease: unknown | null;
131
+ }
132
+ /** Attempt-scoped registry credential for one registry, repository, and access mode. */
133
+ export interface IImageGrant {
134
+ grantId: string;
135
+ access: TImageGrantAccess;
136
+ registry: string;
137
+ repository: string;
138
+ username: string;
139
+ secret: string;
140
+ expiresAt: string;
141
+ }
142
+ /** Resolution of one candidate reference of the job to a digest-pinned image. */
143
+ export interface IImageBinding {
144
+ candidate: string;
145
+ image: string;
146
+ }
147
+ /** Attempt-scoped read-only npm registry token for one `npmRead` entry of the job. */
148
+ export interface INpmGrant {
149
+ grantId: string;
150
+ registry: string;
151
+ scopes: string[];
152
+ secret: string;
153
+ expiresAt: string;
154
+ }
155
+ /** A lease exactly as the protocol defines it, for every execution profile. */
156
+ export interface IJobLease {
157
+ jobId: string;
158
+ attemptId: string;
159
+ leaseId: string;
160
+ fencingToken: string;
161
+ leaseExpiresAt: string;
162
+ job: TCompiledRunnerJob;
163
+ grants: IImageGrant[];
164
+ bindings: IImageBinding[];
165
+ npmGrants?: INpmGrant[];
166
+ }
167
+ /**
168
+ * A lease this runner executes: an `oci` job in `container` isolation with a digest-pinned image,
169
+ * no image grants or bindings, and no npm grants.
170
+ */
171
+ export interface IOciJobLease extends Omit<IJobLease, 'job' | 'grants' | 'bindings' | 'npmGrants'> {
172
+ job: IOciRunnerJob;
173
+ grants: [];
174
+ bindings: [];
175
+ }
176
+ export interface IJobIdentity {
177
+ runnerId: string;
178
+ sessionId: string;
179
+ jobId: string;
180
+ attemptId: string;
181
+ leaseId: string;
182
+ fencingToken: string;
183
+ }
184
+ export interface IAcceptJobRequest {
185
+ acceptRequestId: string;
186
+ identity: IJobIdentity;
187
+ }
188
+ export interface IJobHeartbeatRequest {
189
+ identity: IJobIdentity;
190
+ observedCancellationRequestId?: string;
191
+ }
192
+ export interface ICancellationDirective {
193
+ requestId: string;
194
+ requestedAt: string;
195
+ reason: TCancellationReason;
196
+ terminateBy: string;
197
+ }
198
+ export interface IJobHeartbeatResponse {
199
+ serverTime: string;
200
+ leaseExpiresAt: string;
201
+ cancellation?: ICancellationDirective;
202
+ }
203
+ export interface ILogChunk {
204
+ identity: IJobIdentity;
205
+ sequence: number;
206
+ stream: TLogStream;
207
+ data: string;
208
+ timestamp: string;
209
+ }
210
+ export interface ILogAcknowledgement {
211
+ serverTime: string;
212
+ nextSequence: number;
213
+ }
214
+ export interface ICompleteJobRequest {
215
+ completionRequestId: string;
216
+ identity: IJobIdentity;
217
+ status: TJobCompletionStatus;
218
+ exitCode: number | null;
219
+ startedAt: string;
220
+ completedAt: string;
221
+ cancellationRequestId?: string;
222
+ error?: string;
223
+ }
224
+ export interface ICompleteJobResponse {
225
+ serverTime: string;
226
+ accepted: true;
227
+ }
228
+ export interface IAbandonJobRequest {
229
+ abandonRequestId: string;
230
+ identity: IJobIdentity;
231
+ reason: TAbandonReason;
232
+ }
233
+ export interface IRecoverAttemptRequest {
234
+ recoveryRequestId: string;
235
+ runnerId: string;
236
+ currentSessionId: string;
237
+ previousSessionId: string;
238
+ jobId: string;
239
+ attemptId: string;
240
+ reason: 'runner_restarted';
241
+ }
242
+ export interface ITransferRecord {
243
+ name: string;
244
+ format: 'tar.gz';
245
+ sha256: string;
246
+ sizeBytes: number;
247
+ extractedSizeBytes: number;
248
+ entryCount: number;
249
+ createdAt: string;
250
+ }
251
+ export interface IErrorResponse {
252
+ error: {
253
+ code: string;
254
+ message: string;
255
+ };
256
+ }
257
+ export interface IJobRequirements {
258
+ executionProfile: TExecutionProfile;
259
+ isolation: TIsolation;
260
+ platform?: string;
261
+ labels: string[];
262
+ features: TRunnerFeature[];
263
+ limits: ITransferLimits;
264
+ }
265
+ export interface IJobPermissions {
266
+ source: 'read';
267
+ artifacts: TArtifactPermission;
268
+ caches: TCachePermission;
269
+ images: TImagePermission;
270
+ }
271
+ export interface IEgressRule {
272
+ host: string;
273
+ ports: number[];
274
+ }
275
+ export interface INoNetwork {
276
+ mode: 'none';
277
+ }
278
+ export interface IEgressNetwork {
279
+ mode: 'egress';
280
+ allow: IEgressRule[];
281
+ }
282
+ export type TJobNetwork = INoNetwork | IEgressNetwork;
283
+ export interface ICandidateReference {
284
+ candidate: string;
285
+ }
286
+ export type TImageReference = string | ICandidateReference;
287
+ export interface IOciExecution {
288
+ profile: 'oci';
289
+ image: TImageReference;
290
+ workingDirectory?: string;
291
+ }
292
+ export interface IVmExecution {
293
+ profile: 'vm';
294
+ image: TImageReference;
295
+ workingDirectory?: string;
296
+ }
297
+ export interface IBuildSecret {
298
+ id: string;
299
+ environment: string;
300
+ }
301
+ export interface IBaseImage {
302
+ name: string;
303
+ image: TImageReference;
304
+ }
305
+ export interface IImageBuild {
306
+ context: string;
307
+ dockerfile: string;
308
+ target?: string;
309
+ buildArgs: Record<string, string>;
310
+ secrets: IBuildSecret[];
311
+ labels: Record<string, string>;
312
+ baseImages: IBaseImage[];
313
+ }
314
+ export interface ICompiledStep {
315
+ name?: string;
316
+ command: string[];
317
+ environment: Record<string, string>;
318
+ }
319
+ export interface IJobSource {
320
+ format: 'tar.gz';
321
+ sha256: string;
322
+ sizeBytes: number;
323
+ extractedSizeBytes: number;
324
+ entryCount: number;
325
+ }
326
+ export interface IJobResources {
327
+ memoryBytes?: number;
328
+ cpus?: number;
329
+ pids?: number;
330
+ sharedMemoryBytes?: number;
331
+ }
332
+ export interface INpmReadEntry {
333
+ registry: string;
334
+ scopes: string[];
335
+ }
336
+ export interface IArtifactDeclaration {
337
+ name: string;
338
+ path: string;
339
+ format: 'tar.gz';
340
+ when: TArtifactWhen;
341
+ required: boolean;
342
+ maximumBytes: number;
343
+ maximumExtractedBytes: number;
344
+ maximumEntries: number;
345
+ retentionDays?: number;
346
+ }
347
+ export interface IBuildCacheDeclaration {
348
+ name: string;
349
+ key: string;
350
+ access: TCacheAccess;
351
+ maximumBytes: number;
352
+ maximumExtractedBytes: number;
353
+ maximumEntries: number;
354
+ retentionDays?: number;
355
+ }
356
+ export interface ICacheDeclaration extends IBuildCacheDeclaration {
357
+ paths: string[];
358
+ }
359
+ interface ICompiledRunnerJobBase {
360
+ spec: string;
361
+ sourceObjectId: string;
362
+ workflowDigest: string;
363
+ compiledPlanDigest: string;
364
+ requirements: IJobRequirements;
365
+ permissions: IJobPermissions;
366
+ network: TJobNetwork;
367
+ source: IJobSource;
368
+ secrets: Record<string, string>;
369
+ timeoutMs: number;
370
+ resources?: IJobResources;
371
+ npmRead?: INpmReadEntry[];
372
+ artifacts: IArtifactDeclaration[];
373
+ }
374
+ /** A compiled `oci` job: ordered argument-array steps in fresh containers. */
375
+ export interface IContainerRunnerJob extends ICompiledRunnerJobBase {
376
+ execution: IOciExecution;
377
+ steps: ICompiledStep[];
378
+ caches: ICacheDeclaration[];
379
+ }
380
+ /** A compiled `vm` job: ordered steps as root in one microVM guest per attempt. */
381
+ export interface IVmRunnerJob extends ICompiledRunnerJobBase {
382
+ execution: IVmExecution;
383
+ steps: ICompiledStep[];
384
+ caches: ICacheDeclaration[];
385
+ }
386
+ /** A compiled `oci-image` job: one single-platform image build in a microVM guest. */
387
+ export interface IImageBuildRunnerJob extends ICompiledRunnerJobBase {
388
+ build: IImageBuild;
389
+ caches: IBuildCacheDeclaration[];
390
+ }
391
+ /** Every compiled job shape the published runner job schema admits. */
392
+ export type TCompiledRunnerJob = IContainerRunnerJob | IVmRunnerJob | IImageBuildRunnerJob;
393
+ /** An `oci` job this runner executes: container isolation, no network, a digest-pinned image. */
394
+ export interface IOciRunnerJob extends IContainerRunnerJob {
395
+ requirements: IJobRequirements & {
396
+ executionProfile: 'oci';
397
+ isolation: 'container';
398
+ };
399
+ network: INoNetwork;
400
+ execution: IOciExecution & {
401
+ image: string;
402
+ };
403
+ }
404
+ export interface ITransferMetadata {
405
+ sha256: string;
406
+ sizeBytes: number;
407
+ extractedSizeBytes: number;
408
+ entryCount: number;
409
+ }
410
+ export interface ITransferDownload extends ITransferMetadata {
411
+ body: ReadableStream<Uint8Array>;
412
+ }
413
+ export interface ICacheDownloadMiss {
414
+ hit: false;
415
+ }
416
+ export interface ICacheDownloadHit extends ITransferDownload {
417
+ hit: true;
418
+ }
419
+ export type TCacheDownload = ICacheDownloadMiss | ICacheDownloadHit;
420
+ export type TOpenTransferBody = () => ReadableStream<Uint8Array> | Promise<ReadableStream<Uint8Array>>;
421
+ export interface ITransferManagerConfig {
422
+ stateDirectory: string;
423
+ transferStagingReserveBytes: number;
424
+ transferStagingReserveInodes: number;
425
+ maximumSourceArchiveBytes: number;
426
+ maximumSourceExtractedBytes: number;
427
+ maximumSourceEntries: number;
428
+ maximumArtifactBytes: number;
429
+ maximumArtifactExtractedBytes: number;
430
+ maximumArtifactEntries: number;
431
+ maximumArtifacts: number;
432
+ maximumCacheArchiveBytes: number;
433
+ maximumCacheExtractedBytes: number;
434
+ maximumCacheEntries: number;
435
+ maximumCaches: number;
436
+ maximumWorkspaceEntries: number;
437
+ oci: Pick<IOciExecutorConfig, 'workspaceSizeBytes'>;
438
+ }
439
+ export type TExecutionStopReason = 'job_canceled' | 'lease_lost' | 'lease_expired' | 'runner_shutdown' | 'job_timeout' | 'log_delivery_failed' | 'resource_limit';
440
+ export type TOciArchitecture = 'amd64' | 'arm64';
441
+ export type TOciHelperTarget = 'linux_amd64' | 'linux_arm64';
442
+ export interface IOciExecutorConfig {
443
+ runtime: TOciRuntime;
444
+ runtimePath: string;
445
+ workspaceHelperPath?: string;
446
+ requireRootless: boolean;
447
+ allowedNetworks: TNetworkMode[];
448
+ containerUser: string;
449
+ defaultTimeoutMs: number;
450
+ maximumTimeoutMs: number;
451
+ defaultMemoryBytes: number;
452
+ maximumMemoryBytes: number;
453
+ defaultCpus: number;
454
+ maximumCpus: number;
455
+ defaultPids: number;
456
+ maximumPids: number;
457
+ defaultSharedMemoryBytes: number;
458
+ maximumSharedMemoryBytes: number;
459
+ workspaceSizeBytes: number;
460
+ temporarySizeBytes: number;
461
+ stopTimeoutSeconds: number;
462
+ }
463
+ export interface IRunnerConfig extends ITransferManagerConfig {
464
+ controlPlaneUrl: string;
465
+ allowInsecureLoopback: boolean;
466
+ name: string;
467
+ labels: string[];
468
+ bootstrapToken?: string;
469
+ runnerId?: string;
470
+ runnerCredentialId?: string;
471
+ runnerToken?: string;
472
+ runnerTokenExpiresAt?: string;
473
+ pollIntervalMs: number;
474
+ runnerHeartbeatIntervalMs: number;
475
+ jobHeartbeatIntervalMs: number;
476
+ leaseSafetyMarginMs: number;
477
+ requestTimeoutMs: number;
478
+ maximumResponseBytes: number;
479
+ sourceTransferTimeoutMs: number;
480
+ maximumLogBytes: number;
481
+ maximumLogChunkBytes: number;
482
+ artifactUploadTimeoutMs: number;
483
+ cacheTransferTimeoutMs: number;
484
+ maximumEnvironmentVariables: number;
485
+ maximumEnvironmentValueBytes: number;
486
+ maximumSecretBytes: number;
487
+ oci: IOciExecutorConfig;
488
+ }
489
+ export interface IExecutionContext {
490
+ runnerId: string;
491
+ sessionId: string;
492
+ lease: IOciJobLease;
493
+ preparedLease: IPreparedOciLease;
494
+ workspacePath: string;
495
+ /**
496
+ * Milliseconds left until the attempt deadline when execution starts: the job `timeoutMs`
497
+ * counted from the acceptance 204, less the time source extraction and cache restoration took.
498
+ */
499
+ timeoutMs: number;
500
+ signal: AbortSignal;
501
+ terminationDeadline?: () => number | undefined;
502
+ onLog: (stream: 'stdout' | 'stderr', data: string) => Promise<void>;
503
+ }
504
+ export interface IOciRuntimeFacts {
505
+ readonly runtime: TOciRuntime;
506
+ readonly endpoint: string;
507
+ readonly rootless: boolean;
508
+ readonly os: 'linux';
509
+ readonly architecture: TOciArchitecture;
510
+ readonly helperTarget: TOciHelperTarget;
511
+ readonly helperPath: string;
512
+ readonly helperSha256: string;
513
+ readonly workspaceBlockSize: number;
514
+ }
515
+ export interface IPrepareOciLeaseContext {
516
+ runnerId: string;
517
+ sessionId: string;
518
+ lease: IOciJobLease;
519
+ signal: AbortSignal;
520
+ }
521
+ export interface IPreparedOciLease {
522
+ readonly preparationId: string;
523
+ readonly attemptId: string;
524
+ readonly image: string;
525
+ readonly imageArchitecture: TOciArchitecture;
526
+ cleanup(): Promise<void>;
527
+ }
528
+ export interface IWorkspaceTreeMetadata {
529
+ logicalBytes: number;
530
+ entryCount: number;
531
+ }
532
+ export interface IWorkspaceExportRequest {
533
+ selections: string[];
534
+ maximumBytes: number;
535
+ maximumEntries: number;
536
+ signal?: AbortSignal;
537
+ }
538
+ export interface IWorkspaceExport {
539
+ path: string;
540
+ metadata: IWorkspaceTreeMetadata;
541
+ cleanup(): Promise<void>;
542
+ }
543
+ export interface IRuntimeWorkspaceExporter {
544
+ exportSelected(request: IWorkspaceExportRequest): Promise<IWorkspaceExport>;
545
+ cleanup(): Promise<void>;
546
+ }
547
+ export interface IExecutionResult {
548
+ exitCode: number | null;
549
+ stopReason?: TExecutionStopReason;
550
+ workspace?: IRuntimeWorkspaceExporter;
551
+ }
552
+ export interface IJobExecutor {
553
+ verifyRuntime(): Promise<IOciRuntimeFacts>;
554
+ prepareLease(context: IPrepareOciLeaseContext): Promise<IPreparedOciLease>;
555
+ reconcileOrphans(runnerId: string, currentSessionId: string): Promise<void>;
556
+ execute(context: IExecutionContext): Promise<IExecutionResult>;
557
+ }
558
+ export interface IPreparedWorkspace {
559
+ path: string;
560
+ metadata: IWorkspaceTreeMetadata;
561
+ materializedEntryCount: number;
562
+ cleanup(): Promise<void>;
563
+ }
564
+ export interface ISourcePrepareContext {
565
+ identity: IJobIdentity;
566
+ job: Pick<IOciRunnerJob, 'source' | 'permissions' | 'requirements'>;
567
+ signal: AbortSignal;
568
+ }
569
+ export interface IRunnerRunResult {
570
+ claimed: boolean;
571
+ status?: TJobCompletionStatus;
572
+ }
573
+ /** A streaming check of bytes against the attempt's redaction set. */
574
+ export interface ISecretContentMatcher {
575
+ /** Feeds bytes and returns whether a member has occurred anywhere in the stream so far. */
576
+ push(bytes: Uint8Array): boolean;
577
+ }
578
+ /** The attempt's redaction set as the archive publication check consumes it. */
579
+ export interface ISecretRedactionSet {
580
+ readonly empty: boolean;
581
+ occursIn(text: string): boolean;
582
+ createContentMatcher(): ISecretContentMatcher;
583
+ }
584
+ export interface IArtifactUploadContext {
585
+ workspace: IRuntimeWorkspaceExporter;
586
+ job: Pick<IOciRunnerJob, 'artifacts' | 'permissions' | 'requirements'>;
587
+ status: TJobCompletionStatus;
588
+ redactionSet: ISecretRedactionSet;
589
+ identity: IJobIdentity;
590
+ signal: AbortSignal;
591
+ }
592
+ export interface IArtifactManager {
593
+ upload(context: IArtifactUploadContext): Promise<void>;
594
+ }
595
+ export interface ICacheRestoreContext {
596
+ workspacePath: string;
597
+ workspaceEntryCount: number;
598
+ job: Pick<IOciRunnerJob, 'caches' | 'permissions' | 'requirements' | 'source'>;
599
+ identity: IJobIdentity;
600
+ signal: AbortSignal;
601
+ }
602
+ export interface ICacheSaveContext {
603
+ workspace: IRuntimeWorkspaceExporter;
604
+ job: Pick<IOciRunnerJob, 'caches' | 'permissions' | 'requirements'>;
605
+ status: TJobCompletionStatus;
606
+ redactionSet: ISecretRedactionSet;
607
+ identity: IJobIdentity;
608
+ signal: AbortSignal;
609
+ }
610
+ export interface ICacheManager {
611
+ restore(context: ICacheRestoreContext): Promise<void>;
612
+ save(context: ICacheSaveContext): Promise<void>;
613
+ }
614
+ export {};
@@ -0,0 +1,3 @@
1
+ import { commitinfo } from './00_commitinfo_data.js';
2
+ export const runnerVersion = commitinfo.version;
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2ludGVyZmFjZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBRXJELE1BQU0sQ0FBQyxNQUFNLGFBQWEsR0FBVyxVQUFVLENBQUMsT0FBTyxDQUFDIn0=
@@ -0,0 +1,26 @@
1
+ import type { IJobIdentity, ILogAcknowledgement, ILogChunk } from './interfaces.js';
2
+ import { type SecretRedactionSet } from './redactor.js';
3
+ export interface ILogApi {
4
+ appendLog(chunk: ILogChunk, signal?: AbortSignal): Promise<ILogAcknowledgement>;
5
+ }
6
+ export declare class LogSender {
7
+ private readonly api;
8
+ private readonly identity;
9
+ private readonly maximumBytes;
10
+ private readonly maximumChunkBytes;
11
+ private readonly signal?;
12
+ private readonly redactors;
13
+ private readonly sequenceRedactor;
14
+ private sequence;
15
+ private sentBytes;
16
+ private operationQueue;
17
+ private terminalError;
18
+ private observationSequence;
19
+ private readonly lastObservation;
20
+ constructor(api: ILogApi, identity: IJobIdentity, redactionSet: SecretRedactionSet, maximumBytes: number, maximumChunkBytes: number, signal?: AbortSignal | undefined);
21
+ write(stream: 'stdout' | 'stderr', rawData: string): Promise<void>;
22
+ writeRunnerMessage(data: string): Promise<void>;
23
+ flush(): Promise<void>;
24
+ private schedule;
25
+ private sendBatch;
26
+ }