@ship.zone/runner 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/changelog.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026-09-27 - 1.1.0
4
+
5
+ ### Features
6
+
7
+ - speak the @foss.global/ci-spec 1.2.0 runner protocol (protocol)
8
+ - Upgrade `@foss.global/ci-spec` to 1.2.0; the runner implements and sends `spec` 1.2.0, and a 1.1
9
+ or 1.0 coordinator still uses the constructs of its own version.
10
+ - Capabilities advertise an empty `leaseFeatures` list and `maximumTimeoutMs`, the configured
11
+ `oci.maximumTimeoutMs`, when the lower of the coordinator and runner versions is 1.2.0 or later,
12
+ and omit both below it, as `resources` is omitted against a 1.0.0 coordinator.
13
+ - A lease that uses a pull grant, binding, or `npmGrants` outside the advertised `leaseFeatures`,
14
+ or a job whose `timeoutMs` exceeds the advertised `maximumTimeoutMs`, is abandoned as
15
+ `runner_error` before acceptance. Leases with grants, bindings, or npm grants stay refused in
16
+ every session.
17
+ - The redaction set splits values into lines at CR LF, LF, and CR, as 1.2.0 defines; the behavior
18
+ is unchanged and now covered by the line-definition vectors.
19
+
3
20
  ## 2026-09-27 - 1.0.0
4
21
 
5
22
  ### Breaking Changes
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ship.zone/runner",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "exports": "./mod.ts",
5
5
  "nodeModulesDir": "none",
6
6
  "minimumDependencyAge": {
@@ -40,15 +40,15 @@
40
40
  "strict": true
41
41
  },
42
42
  "imports": {
43
- "@foss.global/ci-spec": "npm:@foss.global/ci-spec@1.1.1",
44
- "@foss.global/ci-spec/archive-cases.json": "npm:@foss.global/ci-spec@1.1.1/archive-cases.json",
45
- "@foss.global/ci-spec/digest-cases.json": "npm:@foss.global/ci-spec@1.1.1/digest-cases.json",
46
- "@foss.global/ci-spec/runner-cases.json": "npm:@foss.global/ci-spec@1.1.1/runner-cases.json",
47
- "@foss.global/ci-spec/runner-job.schema.json": "npm:@foss.global/ci-spec@1.1.1/runner-job.schema.json",
48
- "@foss.global/ci-spec/runner-messages.json": "npm:@foss.global/ci-spec@1.1.1/runner-messages.json",
49
- "@foss.global/ci-spec/runner.openapi.json": "npm:@foss.global/ci-spec@1.1.1/runner.openapi.json",
50
- "@foss.global/ci-spec/version-cases.json": "npm:@foss.global/ci-spec@1.1.1/version-cases.json",
51
- "@foss.global/ci-spec/conformance/runner-jobs/": "npm:/@foss.global/ci-spec@1.1.1/conformance/runner-jobs/",
43
+ "@foss.global/ci-spec": "npm:@foss.global/ci-spec@1.2.0",
44
+ "@foss.global/ci-spec/archive-cases.json": "npm:@foss.global/ci-spec@1.2.0/archive-cases.json",
45
+ "@foss.global/ci-spec/digest-cases.json": "npm:@foss.global/ci-spec@1.2.0/digest-cases.json",
46
+ "@foss.global/ci-spec/runner-cases.json": "npm:@foss.global/ci-spec@1.2.0/runner-cases.json",
47
+ "@foss.global/ci-spec/runner-job.schema.json": "npm:@foss.global/ci-spec@1.2.0/runner-job.schema.json",
48
+ "@foss.global/ci-spec/runner-messages.json": "npm:@foss.global/ci-spec@1.2.0/runner-messages.json",
49
+ "@foss.global/ci-spec/runner.openapi.json": "npm:@foss.global/ci-spec@1.2.0/runner.openapi.json",
50
+ "@foss.global/ci-spec/version-cases.json": "npm:@foss.global/ci-spec@1.2.0/version-cases.json",
51
+ "@foss.global/ci-spec/conformance/runner-jobs/": "npm:/@foss.global/ci-spec@1.2.0/conformance/runner-jobs/",
52
52
  "@std/assert": "jsr:@std/assert@^1.0.14",
53
53
  "@std/path": "jsr:@std/path@^1.1.2",
54
54
  "ajv/dist/2020.js": "npm:ajv@8.20.0/dist/2020.js"
package/deno.lock CHANGED
@@ -5,7 +5,7 @@
5
5
  "jsr:@std/internal@^1.0.12": "1.0.14",
6
6
  "jsr:@std/internal@^1.0.14": "1.0.14",
7
7
  "jsr:@std/path@^1.1.2": "1.1.6",
8
- "npm:@foss.global/ci-spec@1.1.1": "1.1.1",
8
+ "npm:@foss.global/ci-spec@1.2.0": "1.2.0",
9
9
  "npm:@git.zone/tsrust@^1.15.1": "1.15.1",
10
10
  "npm:ajv@8.20.0": "8.20.0",
11
11
  "npm:ajv@^8.20.0": "8.20.0"
@@ -103,9 +103,9 @@
103
103
  ],
104
104
  "tarball": "https://verdaccio.lossless.digital/@design.estate/dees-element/-/dees-element-3.3.0.tgz"
105
105
  },
106
- "@foss.global/ci-spec@1.1.1": {
107
- "integrity": "sha512-0ODCGgjXFUk+2zLiPXXmO5oz4jTHqHsTXPp1nRrOpm01TjvYLG/NPrCFyezWqOT+IPADZ7rcJHunOn/1sMIMSw==",
108
- "tarball": "https://verdaccio.lossless.digital/@foss.global/ci-spec/-/ci-spec-1.1.1.tgz"
106
+ "@foss.global/ci-spec@1.2.0": {
107
+ "integrity": "sha512-cQE0SZ8BRM1Tk6oSFg89LnD6Yx0cYTRuIb96nGPPIcqRFQzO0JVnz+dlzOt/+6dQW2HBjMIarvfdK5Q5B6LH3w==",
108
+ "tarball": "https://verdaccio.lossless.digital/@foss.global/ci-spec/-/ci-spec-1.2.0.tgz"
109
109
  },
110
110
  "@git.zone/tsrust@1.15.1": {
111
111
  "integrity": "sha512-J7B5IrmIt6mE9T/SHGxzATvYQSpTrn0z2cEeeJtbeQEDxy/2rumra4fS8tjzuWxVHuET5HdlW/rILD9vc6fDLg==",
@@ -1748,12 +1748,12 @@
1748
1748
  "dependencies": [
1749
1749
  "jsr:@std/assert@^1.0.14",
1750
1750
  "jsr:@std/path@^1.1.2",
1751
- "npm:@foss.global/ci-spec@1.1.1",
1751
+ "npm:@foss.global/ci-spec@1.2.0",
1752
1752
  "npm:ajv@8.20.0"
1753
1753
  ],
1754
1754
  "packageJson": {
1755
1755
  "dependencies": [
1756
- "npm:@foss.global/ci-spec@1.1.1",
1756
+ "npm:@foss.global/ci-spec@1.2.0",
1757
1757
  "npm:@git.zone/tsrust@^1.15.1",
1758
1758
  "npm:ajv@^8.20.0"
1759
1759
  ]
package/dist_npm/mod.d.ts CHANGED
@@ -93,6 +93,7 @@ export declare const runnerVersion: string;
93
93
  export type TExecutionProfile = 'oci' | 'oci-image' | 'vm';
94
94
  export type TIsolation = 'container' | 'microvm';
95
95
  export type TRunnerFeature = 'source.tar-gz' | 'artifacts' | 'caches';
96
+ export type TLeaseFeature = 'image-pull-grants' | 'candidate-bindings' | 'npm-read-grants';
96
97
  export type TNetworkMode = 'none' | 'egress';
97
98
  export type TSourceFormat = 'tar.gz';
98
99
  export type TOciRuntime = 'docker' | 'podman';
@@ -158,7 +159,12 @@ export interface IRunnerCapabilities { executionProfiles: TExecutionProfile[];
158
159
  networks: TNetworkMode[];
159
160
  sourceFormats: TSourceFormat[];
160
161
  limits: ITransferLimits;
162
+ /** Defined from specification 1.1.0 on. */
161
163
  resources?: IResourceLimits;
164
+ /** Defined from specification 1.2.0 on: the lease contents the runner uses. */
165
+ leaseFeatures?: TLeaseFeature[];
166
+ /** Defined from specification 1.2.0 on: the largest job `timeoutMs` the runner executes. */
167
+ maximumTimeoutMs?: number;
162
168
  }
163
169
  export interface IRegisterRunnerRequest { registrationRequestId: string;
164
170
  spec: string;
@@ -795,7 +801,10 @@ export declare class RunnerProtocolValidator { private readonly implementedSpec;
795
801
  * the compiled plan digest, internal coherence, and fit against the capability snapshot.
796
802
  */
797
803
  validateJob(jobUnknown: unknown): Promise<TCompiledRunnerJob>;
798
- /** Validates a lease against the published `JobLease` schema, its job, and lease coherence. */
804
+ /**
805
+ * Validates a lease against the published `JobLease` schema, its job, lease coherence, and the
806
+ * lease features of the capability snapshot.
807
+ */
799
808
  validateJobLease(leaseUnknown: unknown): Promise<IJobLease>;
800
809
  /** Validates a lease and narrows it to the `oci` shape this runner executes. */
801
810
  validateExecutableLease(leaseUnknown: unknown): Promise<IOciJobLease>;
@@ -900,7 +909,8 @@ export interface IRunnerDependencies { api: IRunnerCoordinatorClient;
900
909
  /**
901
910
  * The capabilities this runner advertises: the `oci` profile in `container` isolation on the
902
911
  * native linux platform of its verified OCI engine, the `none` network mode, the configured
903
- * transfer limits, and the resource ceilings it enforces per attempt.
912
+ * transfer limits, the resource ceilings it enforces per attempt, no lease features (it uses no
913
+ * image grants, candidate bindings, or npm read grants), and its configured longest job timeout.
904
914
  */
905
915
  export declare const runnerCapabilities: (config: IRunnerConfig, runtime: Pick<IOciRuntimeFacts, "os" | "architecture">) => IRunnerCapabilities;
906
916
  /**
package/dist_npm/mod.js CHANGED
@@ -4960,7 +4960,7 @@ var init_deno = __esm({
4960
4960
  "deno.json"() {
4961
4961
  deno_default = {
4962
4962
  name: "@ship.zone/runner",
4963
- version: "1.0.0",
4963
+ version: "1.1.0",
4964
4964
  exports: "./mod.ts",
4965
4965
  nodeModulesDir: "none",
4966
4966
  minimumDependencyAge: {
@@ -5000,15 +5000,15 @@ var init_deno = __esm({
5000
5000
  strict: true
5001
5001
  },
5002
5002
  imports: {
5003
- "@foss.global/ci-spec": "npm:@foss.global/ci-spec@1.1.1",
5004
- "@foss.global/ci-spec/archive-cases.json": "npm:@foss.global/ci-spec@1.1.1/archive-cases.json",
5005
- "@foss.global/ci-spec/digest-cases.json": "npm:@foss.global/ci-spec@1.1.1/digest-cases.json",
5006
- "@foss.global/ci-spec/runner-cases.json": "npm:@foss.global/ci-spec@1.1.1/runner-cases.json",
5007
- "@foss.global/ci-spec/runner-job.schema.json": "npm:@foss.global/ci-spec@1.1.1/runner-job.schema.json",
5008
- "@foss.global/ci-spec/runner-messages.json": "npm:@foss.global/ci-spec@1.1.1/runner-messages.json",
5009
- "@foss.global/ci-spec/runner.openapi.json": "npm:@foss.global/ci-spec@1.1.1/runner.openapi.json",
5010
- "@foss.global/ci-spec/version-cases.json": "npm:@foss.global/ci-spec@1.1.1/version-cases.json",
5011
- "@foss.global/ci-spec/conformance/runner-jobs/": "npm:/@foss.global/ci-spec@1.1.1/conformance/runner-jobs/",
5003
+ "@foss.global/ci-spec": "npm:@foss.global/ci-spec@1.2.0",
5004
+ "@foss.global/ci-spec/archive-cases.json": "npm:@foss.global/ci-spec@1.2.0/archive-cases.json",
5005
+ "@foss.global/ci-spec/digest-cases.json": "npm:@foss.global/ci-spec@1.2.0/digest-cases.json",
5006
+ "@foss.global/ci-spec/runner-cases.json": "npm:@foss.global/ci-spec@1.2.0/runner-cases.json",
5007
+ "@foss.global/ci-spec/runner-job.schema.json": "npm:@foss.global/ci-spec@1.2.0/runner-job.schema.json",
5008
+ "@foss.global/ci-spec/runner-messages.json": "npm:@foss.global/ci-spec@1.2.0/runner-messages.json",
5009
+ "@foss.global/ci-spec/runner.openapi.json": "npm:@foss.global/ci-spec@1.2.0/runner.openapi.json",
5010
+ "@foss.global/ci-spec/version-cases.json": "npm:@foss.global/ci-spec@1.2.0/version-cases.json",
5011
+ "@foss.global/ci-spec/conformance/runner-jobs/": "npm:/@foss.global/ci-spec@1.2.0/conformance/runner-jobs/",
5012
5012
  "@std/assert": "jsr:@std/assert@^1.0.14",
5013
5013
  "@std/path": "jsr:@std/path@^1.1.2",
5014
5014
  "ajv/dist/2020.js": "npm:ajv@8.20.0/dist/2020.js"
@@ -7840,7 +7840,7 @@ var init_oci_executor = __esm({
7840
7840
  });
7841
7841
 
7842
7842
  // ts/protocol-validator.ts
7843
- var sha256Pattern3, reservedEnvironmentNames, npmUserConfigEnvironmentName, maximumCommandArgumentBytes2, maximumCommandBytes2, maximumCombinedEnvironmentEntries, transferLimitNames, assertWellFormedUnicode, canonicalizeJsonInner, canonicalizeJson, toJsonValue, projectCompiledPlan, sha256, computeCompiledPlanDigest, UnsupportedJobError, deepFreeze, createRunnerCapabilitySnapshot, hasSteps, isLinuxPlatform, requireCapabilityFit, requireTransferCoherence, requireCanonicalReservedJson, requireExecutionCoherence, candidateReferences, imageName, requireLeaseCoherence, requireExecutableLease, validateCapabilityFit, RunnerProtocolValidator, validateJobLease;
7843
+ var sha256Pattern3, reservedEnvironmentNames, npmUserConfigEnvironmentName, maximumCommandArgumentBytes2, maximumCommandBytes2, maximumCombinedEnvironmentEntries, transferLimitNames, assertWellFormedUnicode, canonicalizeJsonInner, canonicalizeJson, toJsonValue, projectCompiledPlan, sha256, computeCompiledPlanDigest, UnsupportedJobError, deepFreeze, createRunnerCapabilitySnapshot, hasSteps, isLinuxPlatform, requireCapabilityFit, requireLeaseFeatureFit, requireTransferCoherence, requireCanonicalReservedJson, requireExecutionCoherence, candidateReferences, imageName, requireLeaseCoherence, requireExecutableLease, validateCapabilityFit, RunnerProtocolValidator, validateJobLease;
7844
7844
  var init_protocol_validator = __esm({
7845
7845
  "ts/protocol-validator.ts"() {
7846
7846
  init_errors();
@@ -8035,7 +8035,33 @@ var init_protocol_validator = __esm({
8035
8035
  }
8036
8036
  }
8037
8037
  }
8038
+ if (capabilities.maximumTimeoutMs !== void 0 && job.timeoutMs > capabilities.maximumTimeoutMs) {
8039
+ throw new ProtocolError("Job timeoutMs exceeds runner capability");
8040
+ }
8038
8041
  }, "requireCapabilityFit");
8042
+ requireLeaseFeatureFit = /* @__PURE__ */ __name((lease, capabilities) => {
8043
+ const advertised = capabilities.leaseFeatures;
8044
+ if (advertised === void 0) return;
8045
+ const used = [
8046
+ [
8047
+ lease.grants.some((grant) => grant.access === "pull"),
8048
+ "image-pull-grants"
8049
+ ],
8050
+ [
8051
+ lease.bindings.length > 0,
8052
+ "candidate-bindings"
8053
+ ],
8054
+ [
8055
+ lease.npmGrants !== void 0,
8056
+ "npm-read-grants"
8057
+ ]
8058
+ ];
8059
+ for (const [uses, feature] of used) {
8060
+ if (uses && !advertised.includes(feature)) {
8061
+ throw new ProtocolError(`Lease uses ${feature}, a lease feature this runner does not advertise`);
8062
+ }
8063
+ }
8064
+ }, "requireLeaseFeatureFit");
8039
8065
  requireTransferCoherence = /* @__PURE__ */ __name((job) => {
8040
8066
  const limits = job.requirements.limits;
8041
8067
  if (!job.requirements.features.includes("source.tar-gz")) {
@@ -8286,7 +8312,10 @@ var init_protocol_validator = __esm({
8286
8312
  requireCapabilityFit(job, this.capabilities);
8287
8313
  return job;
8288
8314
  }
8289
- /** Validates a lease against the published `JobLease` schema, its job, and lease coherence. */
8315
+ /**
8316
+ * Validates a lease against the published `JobLease` schema, its job, lease coherence, and the
8317
+ * lease features of the capability snapshot.
8318
+ */
8290
8319
  async validateJobLease(leaseUnknown) {
8291
8320
  if (!isRecord(leaseUnknown)) throw new ProtocolError("Invalid job lease");
8292
8321
  const { job: jobUnknown, ...envelope } = leaseUnknown;
@@ -8296,6 +8325,7 @@ var init_protocol_validator = __esm({
8296
8325
  job
8297
8326
  });
8298
8327
  requireLeaseCoherence(lease);
8328
+ requireLeaseFeatureFit(lease, this.capabilities);
8299
8329
  return lease;
8300
8330
  }
8301
8331
  /** Validates a lease and narrows it to the `oci` shape this runner executes. */
@@ -8566,7 +8596,7 @@ var init_staging_scavenger = __esm({
8566
8596
  });
8567
8597
 
8568
8598
  // ts/runner.ts
8569
- var identifierPattern4, genericSystemError, containsControlCharacter, defaultSleep2, identityFor, safeIdentityFromUnknown, isDefinitiveConflict, LeaseGuard, resourceLimitsSpecVersion, runnerCapabilities, capabilitiesForCoordinator, reconcileProtocolLimits, ShipRunner;
8599
+ var identifierPattern4, genericSystemError, containsControlCharacter, defaultSleep2, identityFor, safeIdentityFromUnknown, isDefinitiveConflict, LeaseGuard, resourceLimitsSpecVersion, leaseMatchingSpecVersion, runnerCapabilities, capabilitiesForCoordinator, reconcileProtocolLimits, ShipRunner;
8570
8600
  var init_runner = __esm({
8571
8601
  "ts/runner.ts"() {
8572
8602
  init_attempt_state();
@@ -8676,6 +8706,7 @@ var init_runner = __esm({
8676
8706
  }
8677
8707
  };
8678
8708
  resourceLimitsSpecVersion = "1.1.0";
8709
+ leaseMatchingSpecVersion = "1.2.0";
8679
8710
  runnerCapabilities = /* @__PURE__ */ __name((config, runtime) => {
8680
8711
  const artifactEnabled = config.maximumArtifacts > 0 && config.maximumArtifactBytes > 0 && config.maximumArtifactExtractedBytes > 0 && config.maximumArtifactEntries > 0;
8681
8712
  const cacheEnabled = config.maximumCaches > 0 && config.maximumCacheArchiveBytes > 0 && config.maximumCacheExtractedBytes > 0 && config.maximumCacheEntries > 0;
@@ -8729,14 +8760,27 @@ var init_runner = __esm({
8729
8760
  maximumCpus: config.oci.maximumCpus,
8730
8761
  maximumPids: config.oci.maximumPids,
8731
8762
  maximumSharedMemoryBytes: config.oci.maximumSharedMemoryBytes
8732
- }
8763
+ },
8764
+ leaseFeatures: [],
8765
+ maximumTimeoutMs: config.oci.maximumTimeoutMs
8733
8766
  });
8734
8767
  }, "runnerCapabilities");
8735
8768
  capabilitiesForCoordinator = /* @__PURE__ */ __name((capabilities, discovery) => {
8736
8769
  const messageSpec = lowerSpecVersion(discovery.spec, runnerSpecVersion);
8737
- if (compareSpecVersions(messageSpec, resourceLimitsSpecVersion) >= 0) return capabilities;
8738
- const { resources: _resources, ...withoutResources } = capabilities;
8739
- return createRunnerCapabilitySnapshot(withoutResources);
8770
+ const defines = /* @__PURE__ */ __name((since) => compareSpecVersions(messageSpec, since) >= 0, "defines");
8771
+ const { resources, leaseFeatures, maximumTimeoutMs, ...defined } = capabilities;
8772
+ return createRunnerCapabilitySnapshot({
8773
+ ...defined,
8774
+ ...resources !== void 0 && defines(resourceLimitsSpecVersion) ? {
8775
+ resources
8776
+ } : {},
8777
+ ...leaseFeatures !== void 0 && defines(leaseMatchingSpecVersion) ? {
8778
+ leaseFeatures
8779
+ } : {},
8780
+ ...maximumTimeoutMs !== void 0 && defines(leaseMatchingSpecVersion) ? {
8781
+ maximumTimeoutMs
8782
+ } : {}
8783
+ });
8740
8784
  }, "capabilitiesForCoordinator");
8741
8785
  reconcileProtocolLimits = /* @__PURE__ */ __name((config, discovery, capabilities) => {
8742
8786
  if (!specMajorVersionsMatch(discovery.spec, runnerSpecVersion)) {
@@ -3,10 +3,10 @@
3
3
  "binarySha256": "d69a00882fd822a2afecf456c38dcf828c164ec7241ce1ecfb0365d94061932b",
4
4
  "buildInfo": {
5
5
  "projectName": "@ship.zone/runner",
6
- "projectVersion": "1.0.0",
7
- "gitCommit": "618325762e102834d7050653224a810bffc485e4",
6
+ "projectVersion": "1.1.0",
7
+ "gitCommit": "c4c2e312d0a24e51b2dd6e73e69d8e81a2296b00",
8
8
  "gitDirty": false,
9
- "builtAt": "2026-09-27T13:31:21.535Z",
9
+ "builtAt": "2026-09-27T15:46:35.628Z",
10
10
  "tsrustVersion": "1.15.1",
11
11
  "binary": "runnerworkspace",
12
12
  "target": "linux_amd64_musl"
@@ -3,10 +3,10 @@
3
3
  "binarySha256": "7775abaf87eeaaf41bc47607734e704e8c63b99fdcceeb6c692397536ba7b394",
4
4
  "buildInfo": {
5
5
  "projectName": "@ship.zone/runner",
6
- "projectVersion": "1.0.0",
7
- "gitCommit": "618325762e102834d7050653224a810bffc485e4",
6
+ "projectVersion": "1.1.0",
7
+ "gitCommit": "c4c2e312d0a24e51b2dd6e73e69d8e81a2296b00",
8
8
  "gitDirty": false,
9
- "builtAt": "2026-09-27T13:31:29.997Z",
9
+ "builtAt": "2026-09-27T15:46:43.725Z",
10
10
  "tsrustVersion": "1.15.1",
11
11
  "binary": "runnerworkspace",
12
12
  "target": "linux_arm64_musl"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ship.zone/runner",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "The isolated OCI job runner for ship.zone CI/CD",
5
5
  "homepage": "https://code.foss.global/ship.zone/runner",
6
6
  "bugs": {
@@ -29,7 +29,7 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@foss.global/ci-spec": "1.1.1",
32
+ "@foss.global/ci-spec": "1.2.0",
33
33
  "ajv": "^8.20.0"
34
34
  },
35
35
  "devDependencies": {
package/readme.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @ship.zone/runner
2
2
 
3
3
  `@ship.zone/runner` is the outbound-only OCI execution agent for ship.zone CI/CD. It implements the
4
- runner protocol of `@foss.global/ci-spec` (1.1.1) for the `oci` execution profile, validates leases
4
+ runner protocol of `@foss.global/ci-spec` (1.2.0) for the `oci` execution profile, validates leases
5
5
  and compiled jobs against the published schemas, and runs one fenced attempt at a time on a local
6
6
  Docker or Podman engine.
7
7
 
@@ -44,13 +44,14 @@ Requests directly.
44
44
  - Step containers receive exactly the compiled step environment plus job secrets. Secret values are
45
45
  passed through the runtime environment rather than OCI command arguments.
46
46
  - The attempt's redaction set holds every secret value, every npm grant token, and each line of a
47
- multi-line value, leaving out members shorter than 8 UTF-8 bytes. Every member is replaced with
48
- `***` in log output, per stream and across the attempt's interleaved chunk sequence, so no chunk
49
- and no concatenation of consecutive chunks contains one. An artifact or cache archive whose entry
50
- path, link target, or file content contains a member is never published: a required artifact or a
51
- cache completes the attempt `system_error`, an optional artifact is omitted and reported.
52
- Redaction matches exact bytes; a job that transforms a value can still disclose it, so the
53
- coordinator must not grant protected secrets to untrusted jobs.
47
+ value containing a line terminator (CR LF, LF, or CR), leaving out members shorter than 8 UTF-8
48
+ bytes; a short line of a multi-line value stays unmasked when printed on its own. Every member is
49
+ replaced with `***` in log output, per stream and across the attempt's interleaved chunk sequence,
50
+ so no chunk and no concatenation of consecutive chunks contains one. An artifact or cache archive
51
+ whose entry path, link target, or file content contains a member is never published: a required
52
+ artifact or a cache completes the attempt `system_error`, an optional artifact is omitted and
53
+ reported. Redaction matches exact bytes; a job that transforms a value can still disclose it, so
54
+ the coordinator must not grant protected secrets to untrusted jobs.
54
55
 
55
56
  ## Requirements
56
57
 
@@ -226,20 +227,25 @@ terminates the attempt as `system_error`; output is never silently truncated.
226
227
  ## Runner Protocol
227
228
 
228
229
  The runner implements the specification version of the `@foss.global/ci-spec` package it is built
229
- against (its `ciSpecVersion`, currently 1.1.1), and sends it as `spec` in registration and session
230
+ against (its `ciSpecVersion`, currently 1.2.0), and sends it as `spec` in registration and session
230
231
  requests. It refuses a coordinator whose discovery, registration, or session `spec` has another
231
232
  major version, and a coordinator answers a runner of another major version with HTTP 409
232
233
  `spec_incompatible`. Messages other than compiled jobs use only constructs of the lower of both
233
- versions; against a 1.0.0 coordinator the capability snapshot omits `resources`. A leased job is
234
- accepted only when its `spec` has the same major version and is not newer than the implemented
235
- version; any other job is abandoned as `runner_error`.
234
+ versions: against a coordinator before 1.2.0 the capability snapshot omits `leaseFeatures` and
235
+ `maximumTimeoutMs`, and against a 1.0.0 coordinator also `resources`. A leased job is accepted only
236
+ when its `spec` has the same major version and is not newer than the implemented version; any other
237
+ job is abandoned as `runner_error`.
236
238
 
237
239
  The runner advertises the `oci` profile, `container` isolation, the native `linux/<arch>` platform
238
- of its verified OCI engine, the `none` network mode, its transfer limits, and `resources` maxima for
239
- memory, CPUs, PIDs, and shared memory. It refuses, by abandoning the lease as `runner_error` before
240
- acceptance, every lease it cannot execute as specified: the `vm` and `oci-image` profiles, `microvm`
241
- isolation, `egress` networks, candidate images with `bindings`, image `grants`, and jobs with
242
- `npmRead` and their `npmGrants`.
240
+ of its verified OCI engine, the `none` network mode, its transfer limits, `resources` maxima for
241
+ memory, CPUs, PIDs, and shared memory, an empty `leaseFeatures` list because it uses no image pull
242
+ grants, candidate bindings, or npm read grants, and `maximumTimeoutMs`, its configured
243
+ `oci.maximumTimeoutMs`. It refuses, by abandoning the lease as `runner_error` before acceptance,
244
+ every lease it cannot execute as specified: the `vm` and `oci-image` profiles, `microvm` isolation,
245
+ `egress` networks, candidate images with `bindings`, image `grants`, jobs with `npmRead` and their
246
+ `npmGrants`, and jobs whose `timeoutMs` exceeds `oci.maximumTimeoutMs`. Leases with grants,
247
+ bindings, or npm grants are refused whatever the session version, also when the capability snapshot
248
+ carries no `leaseFeatures`.
243
249
 
244
250
  All endpoints are below `/api/runner`. Registration uses the one-time bootstrap bearer token;
245
251
  subsequent requests use the renewable runner credential. Every request body is validated against its
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@ship.zone/runner',
6
- version: '1.0.0',
6
+ version: '1.1.0',
7
7
  description: 'The isolated OCI job runner for ship.zone CI/CD'
8
8
  }
package/ts/interfaces.ts CHANGED
@@ -5,6 +5,7 @@ export const runnerVersion: string = denoConfig.version;
5
5
  export type TExecutionProfile = 'oci' | 'oci-image' | 'vm';
6
6
  export type TIsolation = 'container' | 'microvm';
7
7
  export type TRunnerFeature = 'source.tar-gz' | 'artifacts' | 'caches';
8
+ export type TLeaseFeature = 'image-pull-grants' | 'candidate-bindings' | 'npm-read-grants';
8
9
  export type TNetworkMode = 'none' | 'egress';
9
10
  export type TSourceFormat = 'tar.gz';
10
11
  export type TOciRuntime = 'docker' | 'podman';
@@ -89,7 +90,12 @@ export interface IRunnerCapabilities {
89
90
  networks: TNetworkMode[];
90
91
  sourceFormats: TSourceFormat[];
91
92
  limits: ITransferLimits;
93
+ /** Defined from specification 1.1.0 on. */
92
94
  resources?: IResourceLimits;
95
+ /** Defined from specification 1.2.0 on: the lease contents the runner uses. */
96
+ leaseFeatures?: TLeaseFeature[];
97
+ /** Defined from specification 1.2.0 on: the largest job `timeoutMs` the runner executes. */
98
+ maximumTimeoutMs?: number;
93
99
  }
94
100
 
95
101
  export interface IRegisterRunnerRequest {
@@ -10,6 +10,7 @@ import type {
10
10
  TImageReference,
11
11
  TJsonObject,
12
12
  TJsonValue,
13
+ TLeaseFeature,
13
14
  } from './interfaces.ts';
14
15
  import { acceptSpecVersion, runnerSpecVersion } from './spec-version.ts';
15
16
  import { isRecord } from './validation.ts';
@@ -214,6 +215,33 @@ const requireCapabilityFit = (
214
215
  }
215
216
  }
216
217
  }
218
+ if (
219
+ capabilities.maximumTimeoutMs !== undefined && job.timeoutMs > capabilities.maximumTimeoutMs
220
+ ) {
221
+ throw new ProtocolError('Job timeoutMs exceeds runner capability');
222
+ }
223
+ };
224
+
225
+ /**
226
+ * Checks that a lease uses only the lease features of the capability snapshot: a pull grant
227
+ * requires `image-pull-grants`, a binding `candidate-bindings`, and `npmGrants`
228
+ * `npm-read-grants`. A snapshot without `leaseFeatures` imposes no such condition.
229
+ */
230
+ const requireLeaseFeatureFit = (lease: IJobLease, capabilities: IRunnerCapabilities): void => {
231
+ const advertised = capabilities.leaseFeatures;
232
+ if (advertised === undefined) return;
233
+ const used: Array<[boolean, TLeaseFeature]> = [
234
+ [lease.grants.some((grant) => grant.access === 'pull'), 'image-pull-grants'],
235
+ [lease.bindings.length > 0, 'candidate-bindings'],
236
+ [lease.npmGrants !== undefined, 'npm-read-grants'],
237
+ ];
238
+ for (const [uses, feature] of used) {
239
+ if (uses && !advertised.includes(feature)) {
240
+ throw new ProtocolError(
241
+ `Lease uses ${feature}, a lease feature this runner does not advertise`,
242
+ );
243
+ }
244
+ }
217
245
  };
218
246
 
219
247
  const requireTransferCoherence = (job: TCompiledRunnerJob): void => {
@@ -517,13 +545,17 @@ export class RunnerProtocolValidator {
517
545
  return job;
518
546
  }
519
547
 
520
- /** Validates a lease against the published `JobLease` schema, its job, and lease coherence. */
548
+ /**
549
+ * Validates a lease against the published `JobLease` schema, its job, lease coherence, and the
550
+ * lease features of the capability snapshot.
551
+ */
521
552
  public async validateJobLease(leaseUnknown: unknown): Promise<IJobLease> {
522
553
  if (!isRecord(leaseUnknown)) throw new ProtocolError('Invalid job lease');
523
554
  const { job: jobUnknown, ...envelope } = leaseUnknown;
524
555
  const job = await this.validateJob(jobUnknown);
525
556
  const lease = validateWireMessage<IJobLease>('JobLease', { ...envelope, job });
526
557
  requireLeaseCoherence(lease);
558
+ requireLeaseFeatureFit(lease, this.capabilities);
527
559
  return lease;
528
560
  }
529
561
 
package/ts/runner.ts CHANGED
@@ -210,15 +210,18 @@ class LeaseGuard {
210
210
  }
211
211
 
212
212
  /**
213
- * The first specification version that defines the optional capability `resources`. This is a
214
- * fixed fact of the specification history, not the version this runner implements.
213
+ * The first specification versions that define the optional capabilities: `resources` from
214
+ * 1.1.0, `leaseFeatures` and `maximumTimeoutMs` from 1.2.0. These are fixed facts of the
215
+ * specification history, not the version this runner implements.
215
216
  */
216
217
  const resourceLimitsSpecVersion = '1.1.0';
218
+ const leaseMatchingSpecVersion = '1.2.0';
217
219
 
218
220
  /**
219
221
  * The capabilities this runner advertises: the `oci` profile in `container` isolation on the
220
222
  * native linux platform of its verified OCI engine, the `none` network mode, the configured
221
- * transfer limits, and the resource ceilings it enforces per attempt.
223
+ * transfer limits, the resource ceilings it enforces per attempt, no lease features (it uses no
224
+ * image grants, candidate bindings, or npm read grants), and its configured longest job timeout.
222
225
  */
223
226
  export const runnerCapabilities = (
224
227
  config: IRunnerConfig,
@@ -263,6 +266,8 @@ export const runnerCapabilities = (
263
266
  maximumPids: config.oci.maximumPids,
264
267
  maximumSharedMemoryBytes: config.oci.maximumSharedMemoryBytes,
265
268
  },
269
+ leaseFeatures: [],
270
+ maximumTimeoutMs: config.oci.maximumTimeoutMs,
266
271
  });
267
272
  };
268
273
 
@@ -275,9 +280,16 @@ export const capabilitiesForCoordinator = (
275
280
  discovery: Pick<IDiscoveryResponse, 'spec'>,
276
281
  ): IRunnerCapabilities => {
277
282
  const messageSpec = lowerSpecVersion(discovery.spec, runnerSpecVersion);
278
- if (compareSpecVersions(messageSpec, resourceLimitsSpecVersion) >= 0) return capabilities;
279
- const { resources: _resources, ...withoutResources } = capabilities;
280
- return createRunnerCapabilitySnapshot(withoutResources);
283
+ const defines = (since: string): boolean => compareSpecVersions(messageSpec, since) >= 0;
284
+ const { resources, leaseFeatures, maximumTimeoutMs, ...defined } = capabilities;
285
+ return createRunnerCapabilitySnapshot({
286
+ ...defined,
287
+ ...(resources !== undefined && defines(resourceLimitsSpecVersion) ? { resources } : {}),
288
+ ...(leaseFeatures !== undefined && defines(leaseMatchingSpecVersion) ? { leaseFeatures } : {}),
289
+ ...(maximumTimeoutMs !== undefined && defines(leaseMatchingSpecVersion)
290
+ ? { maximumTimeoutMs }
291
+ : {}),
292
+ });
281
293
  };
282
294
 
283
295
  export const reconcileProtocolLimits = (