@orangelogic/myos-gen1 1.0.0-alpha.2 → 1.0.0-alpha.22

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 (147) hide show
  1. package/NOTICE.md +4 -0
  2. package/README.md +30 -11
  3. package/contracts/core/Release/ManualBundleAttestation.g.cs +26 -0
  4. package/contracts/core/Release/ManualBundleProof.cs +42 -0
  5. package/contracts/core/Release/ReleaseContext.g.cs +111 -0
  6. package/contracts/core/Release/ReleaseEligibility.cs +198 -0
  7. package/contracts/core/Release/ReleasePolicy.g.cs +64 -0
  8. package/contracts/core/Release/StrictSemVersion.cs +97 -0
  9. package/contracts/core/Release/Unit.g.cs +842 -0
  10. package/contracts/core/Release/UnitKinds.g.cs +36 -0
  11. package/contracts/core/Release/UnitUiStrings.g.cs +140 -0
  12. package/contracts/core/Release/WebComponentProps.g.cs +234 -0
  13. package/contracts/core/fixtures/eligibility.json +3112 -0
  14. package/contracts/core/fixtures/runtime-graph.json +192 -0
  15. package/contracts/core/fixtures/semver.json +42 -0
  16. package/contracts/core/fixtures/unit.json +189 -0
  17. package/contracts/core/fixtures/web-component-props.json +628 -0
  18. package/contracts/core-design-system-entries.json +5 -1
  19. package/contracts/dotnet/ManualBundleAttestation.g.cs +26 -0
  20. package/contracts/dotnet/ManualBundleProof.cs +42 -0
  21. package/contracts/dotnet/OrangeLogic.UiComponents.Contracts.csproj +0 -1
  22. package/contracts/dotnet/ReleaseContext.g.cs +111 -0
  23. package/contracts/dotnet/ReleaseEligibility.cs +36 -3
  24. package/contracts/dotnet/ReleasePolicy.g.cs +64 -0
  25. package/contracts/dotnet/StrictSemVersion.cs +7 -0
  26. package/contracts/dotnet/Unit.g.cs +842 -0
  27. package/contracts/dotnet/UnitKinds.g.cs +36 -0
  28. package/contracts/dotnet/UnitUiStrings.g.cs +140 -0
  29. package/contracts/dotnet/WebComponentProps.g.cs +234 -0
  30. package/contracts/fixtures/eligibility.json +123 -14
  31. package/contracts/fixtures/runtime-graph.json +192 -0
  32. package/contracts/fixtures/unit.json +189 -0
  33. package/contracts/fixtures/web-component-props.json +628 -0
  34. package/contracts/generated-manifest.json +196 -0
  35. package/contracts/release/3/README.md +21 -2
  36. package/contracts/release/3/manifest.schema.json +570 -276
  37. package/contracts/release/3/release.ts +182 -41
  38. package/contracts/release/3/semver.ts +2 -0
  39. package/contracts/runtime/1/graph-manifest.schema.json +482 -0
  40. package/contracts/slot/1/README.md +2 -0
  41. package/contracts/slot/1/slot.ts +14 -2
  42. package/contracts/unit/1/README.md +103 -4
  43. package/contracts/unit/1/unit-text.schema.json +2079 -97
  44. package/contracts/unit/1/unit.schema.json +2223 -0
  45. package/contracts/unit/1/unit.ts +603 -64
  46. package/dist/autocomplete-TAEE2DSJ.js +266 -0
  47. package/dist/chunk-5UNNZQC5.js +1262 -0
  48. package/dist/chunk-GOKSCQBV.js +12 -0
  49. package/dist/chunk-V5UZMUQG.js +184 -0
  50. package/dist/contracts/generated/constants.d.ts +4 -0
  51. package/dist/contracts/generated/release.d.ts +175 -0
  52. package/dist/contracts/generated/unit.d.ts +484 -0
  53. package/dist/contracts/generated/web-component-props.d.ts +467 -0
  54. package/dist/contracts/host.d.ts +81 -0
  55. package/dist/contracts/release.d.ts +1 -137
  56. package/dist/contracts/semver.js +1 -1
  57. package/dist/contracts/unit.d.ts +3 -379
  58. package/dist/contracts/unit.js +3 -1
  59. package/dist/date-ZU4VLN4R.js +186 -0
  60. package/dist/gen1-build-receipt.json +271 -0
  61. package/dist/gen1-metafile.json +2154 -0
  62. package/dist/media-MISCSROL.js +65 -0
  63. package/dist/menu-MXDIPHBR.js +196 -0
  64. package/dist/remote-table-KJ2OUZNY.js +8 -0
  65. package/dist/rich-text-FGCAWO5N.js +147 -0
  66. package/dist/runtime/autocomplete-input.d.ts +8 -0
  67. package/dist/runtime/chart-config.d.ts +23 -0
  68. package/dist/runtime/chart-export.d.ts +17 -0
  69. package/dist/runtime/chart.d.ts +4 -0
  70. package/dist/runtime/configured-color.d.ts +6 -0
  71. package/dist/runtime/control-menu.d.ts +4 -5
  72. package/dist/runtime/controls.d.ts +40 -5
  73. package/dist/runtime/date-input.d.ts +7 -0
  74. package/dist/runtime/index.css +60 -1
  75. package/dist/runtime/index.d.ts +20 -3
  76. package/dist/runtime/index.js +200 -1879
  77. package/dist/runtime/input-validity.d.ts +12 -0
  78. package/dist/runtime/lazy-renderers.d.ts +54 -0
  79. package/dist/runtime/menu-panels.d.ts +5 -0
  80. package/dist/runtime/mount.d.ts +3 -2
  81. package/dist/runtime/overflow.d.ts +20 -0
  82. package/dist/runtime/panel-keys.d.ts +4 -0
  83. package/dist/runtime/parameter-input-context.d.ts +5 -0
  84. package/dist/runtime/presentation-state.d.ts +7 -0
  85. package/dist/runtime/renderer-families.json +137 -0
  86. package/dist/runtime/renderer-loaders.d.ts +6 -0
  87. package/dist/runtime/renderers/autocomplete.d.ts +1 -0
  88. package/dist/runtime/renderers/date.d.ts +1 -0
  89. package/dist/runtime/renderers/media.d.ts +1 -0
  90. package/dist/runtime/renderers/menu.d.ts +2 -0
  91. package/dist/runtime/renderers/remote-table.d.ts +1 -0
  92. package/dist/runtime/renderers/rich-text.d.ts +1 -0
  93. package/dist/runtime/renderers/select.d.ts +1 -0
  94. package/dist/runtime/renderers/tab-menu.d.ts +1 -0
  95. package/dist/runtime/renderers/table.d.ts +1 -0
  96. package/dist/runtime/renderers/webcomponent.d.ts +1 -0
  97. package/dist/runtime/renderers/widgets.d.ts +1 -0
  98. package/dist/runtime/rich-text-options.d.ts +1 -1
  99. package/dist/runtime/runtime-instance.d.ts +29 -0
  100. package/dist/runtime/select-input.d.ts +5 -0
  101. package/dist/runtime/selection-banner.d.ts +18 -0
  102. package/dist/runtime/table.d.ts +19 -4
  103. package/dist/runtime/unit-store.d.ts +1 -1
  104. package/dist/select-JP36IZ22.js +79 -0
  105. package/dist/tab-menu-AWDFXZAL.js +57 -0
  106. package/dist/table-VL5EICSV.js +8 -0
  107. package/dist/webcomponent-OK7UVVKE.js +255 -0
  108. package/dist/widgets-M767NNSN.js +75 -0
  109. package/package.json +20 -7
  110. package/schema/README.md +34 -0
  111. package/schema/dotnet/ManualBundleProof.cs +38 -0
  112. package/schema/dotnet/ReleaseEligibility.cs +194 -0
  113. package/schema/dotnet/StrictSemVersion.cs +93 -0
  114. package/schema/dotnet/UnitUiStrings.cs.template +17 -0
  115. package/{contracts/dotnet → schema/fixtures/baseline}/ReleaseContext.cs +10 -1
  116. package/schema/fixtures/baseline/release.ts +68 -0
  117. package/schema/fixtures/baseline/unit.ts +313 -0
  118. package/schema/fixtures/core/9210ff75095/ManualBundleAttestation.cs +48 -0
  119. package/schema/fixtures/core/9210ff75095/ReleaseContext.cs +62 -0
  120. package/schema/fixtures/core/9210ff75095/ReleaseEligibility.cs +200 -0
  121. package/schema/fixtures/core/9210ff75095/ReleasePolicy.cs +30 -0
  122. package/schema/fixtures/core/9210ff75095/StrictSemVersion.cs +99 -0
  123. package/schema/fixtures/core/9210ff75095/provenance.json +13 -0
  124. package/schema/fixtures/eligibility.json +3112 -0
  125. package/schema/fixtures/published/1.0.0-alpha.16/forgot-password.unit.json +132 -0
  126. package/schema/fixtures/published/1.0.0-alpha.16/provenance.json +15 -0
  127. package/schema/fixtures/published/1.0.0-alpha.16/release.ts +68 -0
  128. package/schema/fixtures/published/1.0.0-alpha.16/unit.schema.json +3206 -0
  129. package/{contracts/unit/2 → schema/fixtures/published/1.0.0-alpha.16}/unit.ts +82 -5
  130. package/schema/fixtures/semver.json +42 -0
  131. package/schema/gen1.schema.json +5925 -0
  132. package/scripts/boundaries.mjs +8 -1
  133. package/scripts/build-runtime-graph.mjs +58 -0
  134. package/scripts/build-runtime.mjs +49 -0
  135. package/scripts/gen1-release-content.mjs +15 -0
  136. package/scripts/generate-contracts.mjs +250 -0
  137. package/scripts/release-manifest.mjs +7 -0
  138. package/scripts/renderer-families.mjs +42 -0
  139. package/scripts/sync-core.mjs +49 -0
  140. package/scripts/sync-events-actions-fixtures.mjs +24 -0
  141. package/scripts/sync-gen1-contracts.mjs +29 -56
  142. package/PROVENANCE.json +0 -459
  143. package/contracts/unit/2/README.md +0 -15
  144. package/dist/chunk-HGWP6ELB.js +0 -262
  145. /package/{contracts/dotnet → schema/fixtures/baseline}/ReleasePolicy.cs +0 -0
  146. /package/{contracts/dotnet → schema/fixtures/baseline}/UnitUiStrings.cs +0 -0
  147. /package/{contracts/unit/2 → schema/fixtures/published/1.0.0-alpha.16}/unit-text.schema.json +0 -0
package/NOTICE.md ADDED
@@ -0,0 +1,4 @@
1
+ Gen1 provides the Orange Logic native React runtime, component build helpers,
2
+ versioned contracts and schemas. Copyright and license notices in distributed
3
+ source files remain applicable. This notice does not grant redistribution rights
4
+ or change the package's UNLICENSED status.
package/README.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # @orangelogic/myos-gen1
2
2
 
3
- Native React Gen1 unit runtime, public wire contracts and standalone component build tools. This is infrastructure, not a ported Lit component. It is released with `@orangelogic/design-system-react` at the same version (first joint release: `1.0.0-alpha.2`). React and React DOM are peers; the design system is an exact-version peer.
3
+ Native React Gen1 unit runtime, public wire contracts and standalone component build tools. This is infrastructure, not a ported Lit component. SDK alpha.22 requires `@orangelogic/design-system-react` in the range `>=1.0.0-alpha.18 <2.0.0`. React and React DOM are peers.
4
4
 
5
- Install the two packages from the configured npm feed and install their React peers:
5
+ In this repository, the SDK is an npm workspace at `packages/gen1`, ordered before its component consumers. Run `npm install` from the repository root; it links the SDK and builds its runtime and declarations. Rebuild with `npm run build --workspace @orangelogic/myos-gen1`, check with `npm run check --workspace @orangelogic/myos-gen1`, and test with `npm test --workspace @orangelogic/myos-gen1`. These commands use the installed design-system package. Standalone component checkouts retain exact published runtime dependencies.
6
+
7
+ After these versions are published, install the SDK with a compatible design system and their React peers:
6
8
 
7
9
  ```sh
8
- npm install --save-exact @orangelogic/myos-gen1@1.0.0-alpha.2 @orangelogic/design-system-react@1.0.0-alpha.2 react@19.3.0 react-dom@19.3.0
10
+ npm install --save-exact @orangelogic/myos-gen1@1.0.0-alpha.22 @orangelogic/design-system-react@1.0.0-alpha.18 react@19.3.0 react-dom@19.3.0
9
11
  npm install --save-dev --save-exact @types/react@19.3.0 @types/react-dom@19.3.0
10
12
  ```
11
13
 
@@ -18,7 +20,7 @@ A component folder contains `package.json`, `component.json`, `src/Example.tsx`,
18
20
  "sourceEntry": "src/Example.tsx",
19
21
  "componentExport": "Example",
20
22
  "designSystemEntries": ["box"],
21
- "slotBindings": [{"slotId":"Example_VForm","slotVersion":1,"protocol":2}]
23
+ "slotBindings": [{"slotId":"Example_VForm","slotVersion":1,"protocol":1}]
22
24
  }
23
25
  ```
24
26
 
@@ -39,19 +41,36 @@ Run `npx --no-install gen1-build` in that folder, or call `buildComponent({root}
39
41
  | `./contracts/unit` | All original unit types, public values and vocabulary |
40
42
  | `./contracts/release` | All original release, eligibility, slot and host wire types |
41
43
  | `./contracts/semver` | Original strict SemVer implementation |
42
- | `./build` / `gen1-build` | `buildComponent({root})` replaces repository-wide `buildComponents({selected,changed})`; G2 owns component enumeration and changed-build scheduling |
44
+ | `./build` / `gen1-build` | `buildComponent({root})` builds one component; callers own component enumeration and changed-build scheduling |
43
45
  | `./boundaries` | Original boundary primitives; standalone builds use `checkBoundaries(root,{entry})` |
44
46
  | `./components`, `./demo` | Descriptor/mount and data-only demo helpers |
45
47
  | `./sync-contracts` | `syncGen1Contracts` checks source synchronization; `copyGen1Contracts({destination,check})` copies or verifies an installed package’s served contracts |
46
- | `./protocols/*` | Served contracts, e.g. `protocols/unit/1/unit.ts`, `protocols/unit/2/unit.ts`, release/3 schemas and fixtures |
48
+ | `./protocols/*` | Served contracts, e.g. `protocols/unit/1/unit.ts`, release/3 schemas; development fixtures are excluded |
47
49
  | `./runtime/styles.css` | Runtime CSS for explicit host stylesheet handling |
48
50
 
49
- Protocol 1 is frozen byte-for-byte; protocol 2 is copied unchanged. See `PROVENANCE.json` for source commit and byte hashes, and `api-map.json` for every original public export. Runtime CSS passes through CSS Modules while preserving the established `uic-*` hooks used by existing components. Heavy engines remain lazy inside the design-system controls.
51
+ Unit protocol 1 is the only Gen1 unit protocol: units and slot bindings carry `protocol: 1`, and the runtime rejects a unit of any other protocol. `protocols/unit/1` is generated from the public contract sources. See `NOTICE.md` for attribution and `api-map.json` for the public export mapping. Runtime CSS passes through CSS Modules while preserving the established `uic-*` hooks used by existing components. Heavy engines remain lazy inside the design-system controls.
52
+
53
+ Consumers own component implementations, registry publication, release manifests and preview routing. Use the package's served contracts, admit the shared runtime and its transitive graph in the host loader, and retain registry admission and per-mount byte/node limits. No protocol, authorization or CSP relaxation is implied.
54
+
55
+ Autocomplete creation can additionally declare `allowEmptyCreation` and the server's `emptyCreationLabel`.
56
+ With creation enabled, blank or exactly matched queries offer that action and post `%CREATE_ENTRY%` with empty text.
57
+ Unmatched typed queries keep `creationLabel` and post their typed text. Absent fields retain existing behavior; missing empty labels do not invent an action or fallback text.
58
+ The empty action uses the design system's pinned listbox footer and disappears immediately when an authoritative unit withdraws its permission flag or label, even while a replacement search is pending.
59
+
60
+ Configured presentation colours are optional: `Option.color` supplies a decorative choice swatch,
61
+ `LabelNode.color` sets foreground text/icon colour, and `GroupNode.background` sets its background.
62
+ Only seven-character `#RRGGBB` values are accepted. CSS expressions, alpha colours, URLs and whitespace
63
+ are rejected by the schema and ignored by direct renderer calls. Absent fields preserve default styling.
64
+ `OptionText` renders the optional swatch and server text through public controls; it adds no accessible name.
65
+ The option's configured text remains its accessible label. Components that specialize a choice control
66
+ should reuse `OptionText` rather than duplicating colour validation or interpreting HTML to recover colour.
67
+
68
+ The delivered runtime imports design-system controls and mount helpers through `@orangelogic/design-system-react/cortex-kit`. Sharing this entry avoids composing dozens of public control wrappers and their styles into the independent runtime's mount closure. The eleven renderer families remain dynamic imports; the full graph, including those families, must still fit the 160-node mount budget. `tests/build-runtime-graph.test.mjs` checks the emitted imports, peer range and family edges. The dormant `chart.tsx` retains its per-control imports: no chart renderer is registered, and amCharts is deliberately excluded from the kit and delivery graph.
50
69
 
51
- The components repository retains component implementations, registry publication, release-manifest construction, preview routing and product acceptance. G2 must replace relative runtime/contract imports, remove its runtime workspace and rebuild orchestration, copy served contracts from these package exports, update registry validators to admit the shared runtime specifier and transitive graph, and update the gen1-port skill. Previously per-component omitted-control stand-ins disappear: the shared runtime exposes the full supported control closure. Registry admission and per-mount byte/node caps must be checked against that closure. No protocol, authorization or CSP relaxation is implied.
70
+ The scroll binding resolves its owning control through native display:contents wrappers and ignores nested control scrolls. Use `discoverComponents(componentProjectRoot)` with an explicit project root; standalone builds use `checkBoundaries`, while `checkLayout` remains the legacy bare-component layout checker. The emitted stylesheet is `mount.css`; Release assembly should consume `mount.css` and include it in the source-digest recipe.
52
71
 
53
- Source and runtime API behavior are preserved except the documented build/distribution changes. These author checks do not constitute independent acceptance or Cortex product integration approval.
72
+ `buildComponent({root, project})` accepts an explicit shared dependency manifest for bare first-party components; source ownership remains confined to `root`. Standalone consumers omit `project`. The distribution includes `protocols/dotnet/*` for the registry's project reference.
54
73
 
55
- The scroll binding resolves its owning control through native display:contents wrappers and ignores nested control scrolls. Use `discoverComponents(componentProjectRoot)` with an explicit project root; standalone builds use `checkBoundaries`, while `checkLayout` remains the legacy bare-component layout checker. The emitted stylesheet is `mount.css`; G2 release assembly must update its old `styles.css` input and source-digest recipe.
74
+ Parameter textareas start at one row and use the textarea atom's content autosizing, including shrinking after a host refresh or cancel. Ordinary textareas retain the atom's four-row/manual-resize defaults; password parameters retain password input privacy. The atom owns horizontal padding so its native resize grip reaches the control edge in manual mode, while labels keep the same text inset.
56
75
 
57
- G2 reconciliation preserves V01 runtime fixes and F2B scaffold isolation, including their tests. `buildComponent({root, project})` accepts an explicit shared dependency manifest for bare first-party components; source ownership remains confined to `root`. Standalone consumers omit `project`. The distribution includes `protocols/dotnet/*` for the registry's project reference.
76
+ Parameter editors may carry optional `origin` presentation metadata: `kind` (`profile`, `local-session` or `user-session`), safe hexadecimal `color`, optional `inherited` and optional profile `depth` (0..255). Cortex resolves visibility, precedence and the configured palette. The runtime draws the origin line without accepting arbitrary CSS or changing parameter actions; inherited origins use a dashed line and current origins a solid line. Units without metadata show no line. This restores the compact legacy parameter-text behavior and configured origin meaning without copying legacy skin classes into React.
@@ -0,0 +1,26 @@
1
+ // <auto-generated /> @orangelogic/myos-gen1 version=1.0.0-alpha.22
2
+ // schema-sha256=d475a5a955dbf03a276624f1fa0761e2f8c2bd8022bd8703aab6d508a81db8fd generator=1
3
+ #nullable enable
4
+ #pragma warning disable CS1591 // Public wire fields are documented in gen1.schema.json.
5
+ using System;
6
+ using System.Collections.Generic;
7
+ using System.Collections.Immutable;
8
+
9
+ namespace OrangeLogic.Contracts.Extensibility.UiComponent.Release;
10
+
11
+ public sealed record ManualBundleAttestation(
12
+ [property: System.Text.Json.Serialization.JsonPropertyName("format")] string? Format,
13
+ [property: System.Text.Json.Serialization.JsonPropertyName("targetIdentity")] ReleaseIdentity? TargetIdentity,
14
+ [property: System.Text.Json.Serialization.JsonPropertyName("targetDigests")] ReleaseDigests? TargetDigests,
15
+ [property: System.Text.Json.Serialization.JsonPropertyName("sourceArchiveSha256")] string? SourceArchiveSha256,
16
+ [property: System.Text.Json.Serialization.JsonPropertyName("audienceSha256")] string? AudienceSha256,
17
+ [property: System.Text.Json.Serialization.JsonPropertyName("ceiling")] ExecutionPrivilege Ceiling,
18
+ [property: System.Text.Json.Serialization.JsonPropertyName("policyVersion")] long PolicyVersion,
19
+ [property: System.Text.Json.Serialization.JsonPropertyName("actorIssuer")] string? ActorIssuer,
20
+ [property: System.Text.Json.Serialization.JsonPropertyName("actorSubject")] string? ActorSubject,
21
+ [property: System.Text.Json.Serialization.JsonPropertyName("publishedAtUtc")] DateTimeOffset PublishedAtUtc,
22
+ [property: System.Text.Json.Serialization.JsonPropertyName("staffAuthorized")] bool StaffAuthorized,
23
+ [property: System.Text.Json.Serialization.JsonPropertyName("sourceBuild")] bool SourceBuild,
24
+ [property: System.Text.Json.Serialization.JsonPropertyName("scan")] bool Scan,
25
+ [property: System.Text.Json.Serialization.JsonPropertyName("independentReview")] bool IndependentReview);
26
+
@@ -0,0 +1,42 @@
1
+ // <auto-generated /> @orangelogic/myos-gen1 version=1.0.0-alpha.22
2
+ // schema-sha256=d475a5a955dbf03a276624f1fa0761e2f8c2bd8022bd8703aab6d508a81db8fd generator=1
3
+ #nullable enable
4
+ #pragma warning disable CS1591 // Public wire fields are documented in gen1.schema.json.
5
+ using System;
6
+ using System.Linq;
7
+
8
+ namespace OrangeLogic.Contracts.Extensibility.UiComponent.Release;
9
+
10
+ /// <summary>Checks the direct proof only; host eligibility must still enforce compatibility, selection and revocation.</summary>
11
+ public static class ManualBundleProof
12
+ {
13
+ public const string Format = "orangelogic.gen1.manual-bundle/1";
14
+ public const string Capability = "manual-bundle/1";
15
+ public const string Exemption = "manual-bundle:1";
16
+
17
+ public static bool Accepts(ReleasePolicy r, ProvenanceEvidence p, ManualBundleAttestation? proof, DateTimeOffset now)
18
+ {
19
+ var a = r.Approval;
20
+ var d = r.Digests;
21
+ return proof is not null && proof.Format == Format && a is not null && d is not null &&
22
+ r.Identity is { PackageId: not null, Version: not null } identity &&
23
+ StrictSemVersion.TryParse(identity.Version, out var version) && !version.IsPrerelease && !identity.Version.Contains('+') &&
24
+ proof.TargetIdentity == identity && proof.TargetDigests == d &&
25
+ new[] { d.Release, d.Source, d.Build, d.Artifact, d.Manifest, d.Authorship, proof.SourceArchiveSha256, r.AudienceSha256 }.All(Hash) &&
26
+ d.Release == d.Manifest && d.Build == d.Authorship &&
27
+ p.Authenticated && p.Identity == identity && p.Digests == d && p.Approval == a && p.AudienceSha256 == r.AudienceSha256 &&
28
+ a.Digests == d && a.AudienceSha256 == r.AudienceSha256 && a.Revision == 1 &&
29
+ a.ExemptionId == Exemption && a.PolicyVersion == 1 && proof.PolicyVersion == a.PolicyVersion &&
30
+ a.Ceiling == ExecutionPrivilege.VisitingStaff && proof.Ceiling == a.Ceiling && proof.AudienceSha256 == r.AudienceSha256 &&
31
+ r.Audience is { Kind: "everyone", CustomerIds: { IsDefault: false, IsEmpty: true }, InstanceIds: { IsDefault: false, IsEmpty: true } } &&
32
+ proof.StaffAuthorized && Text(proof.ActorIssuer) && Text(proof.ActorSubject) &&
33
+ proof.PublishedAtUtc != default && proof.PublishedAtUtc.Offset == TimeSpan.Zero && proof.PublishedAtUtc <= now &&
34
+ !proof.SourceBuild && !proof.Scan && !proof.IndependentReview &&
35
+ !r.OfficialDefault && !p.OfficialDefault && !p.IsOrangeLogicAuthored &&
36
+ !p.CodeReviewVerified && !p.SecurityReviewVerified && !p.ExemptionVerified && p.ManualStable is null &&
37
+ a.CodeReviewId is null && a.SecurityReviewId is null;
38
+ }
39
+
40
+ private static bool Hash(string? value) => value is { Length: 64 } && value.All(c => c is >= '0' and <= '9' or >= 'a' and <= 'f');
41
+ private static bool Text(string? value) => value is { Length: > 0 and <= 256 } && value.Trim() == value && !value.Any(char.IsControl);
42
+ }
@@ -0,0 +1,111 @@
1
+ // <auto-generated /> @orangelogic/myos-gen1 version=1.0.0-alpha.22
2
+ // schema-sha256=d475a5a955dbf03a276624f1fa0761e2f8c2bd8022bd8703aab6d508a81db8fd generator=1
3
+ #nullable enable
4
+ #pragma warning disable CS1591 // Public wire fields are documented in gen1.schema.json.
5
+ using System;
6
+ using System.Collections.Generic;
7
+ using System.Collections.Immutable;
8
+
9
+ namespace OrangeLogic.Contracts.Extensibility.UiComponent.Release;
10
+
11
+ public enum ExecutionPrivilege { Unknown, Ordinary, CustomerAdmin, VisitingStaff }
12
+
13
+ public enum SelectionMode { ExactPin, FloatingStable, OfficialCoverage }
14
+
15
+ public sealed record ReleaseIdentity(
16
+ [property: System.Text.Json.Serialization.JsonPropertyName("packageId")] string? PackageId,
17
+ [property: System.Text.Json.Serialization.JsonPropertyName("version")] string? Version);
18
+
19
+ public sealed record SlotContract(
20
+ [property: System.Text.Json.Serialization.JsonPropertyName("slotId")] string? SlotId,
21
+ [property: System.Text.Json.Serialization.JsonPropertyName("version")] int Version,
22
+ [property: System.Text.Json.Serialization.JsonPropertyName("supportedProtocols")] ImmutableArray<int> SupportedProtocols);
23
+
24
+ public sealed record DesignSystemPin(
25
+ [property: System.Text.Json.Serialization.JsonPropertyName("releaseId")] string? ReleaseId,
26
+ [property: System.Text.Json.Serialization.JsonPropertyName("version")] string? Version,
27
+ [property: System.Text.Json.Serialization.JsonPropertyName("manifestSha256")] string? ManifestSha256);
28
+
29
+ public sealed record RenderBinding(
30
+ [property: System.Text.Json.Serialization.JsonPropertyName("customerId")] string? CustomerId,
31
+ [property: System.Text.Json.Serialization.JsonPropertyName("instanceId")] string? InstanceId,
32
+ [property: System.Text.Json.Serialization.JsonPropertyName("locationId")] string? LocationId,
33
+ [property: System.Text.Json.Serialization.JsonPropertyName("profileId")] string? ProfileId,
34
+ [property: System.Text.Json.Serialization.JsonPropertyName("principalAuthorizationRevision")] long PrincipalAuthorizationRevision,
35
+ [property: System.Text.Json.Serialization.JsonPropertyName("parameterSessionId")] string? ParameterSessionId,
36
+ [property: System.Text.Json.Serialization.JsonPropertyName("parameterSessionRevision")] long ParameterSessionRevision,
37
+ [property: System.Text.Json.Serialization.JsonPropertyName("bindingSha256")] string? BindingSha256,
38
+ [property: System.Text.Json.Serialization.JsonPropertyName("configurationSha256")] string? ConfigurationSha256);
39
+
40
+ public sealed record RegistryEvidence(
41
+ [property: System.Text.Json.Serialization.JsonPropertyName("authenticated")] bool Authenticated);
42
+
43
+ public sealed record ProvenanceEvidence(
44
+ [property: System.Text.Json.Serialization.JsonPropertyName("authenticated")] bool Authenticated,
45
+ [property: System.Text.Json.Serialization.JsonPropertyName("identity")] ReleaseIdentity? Identity,
46
+ [property: System.Text.Json.Serialization.JsonPropertyName("digests")] ReleaseDigests? Digests,
47
+ [property: System.Text.Json.Serialization.JsonPropertyName("audienceSha256")] string? AudienceSha256,
48
+ [property: System.Text.Json.Serialization.JsonPropertyName("approval")] Approval? Approval,
49
+ [property: System.Text.Json.Serialization.JsonPropertyName("isOrangeLogicAuthored")] bool IsOrangeLogicAuthored,
50
+ [property: System.Text.Json.Serialization.JsonPropertyName("officialDefault")] bool OfficialDefault,
51
+ [property: System.Text.Json.Serialization.JsonPropertyName("codeReviewVerified")] bool CodeReviewVerified,
52
+ [property: System.Text.Json.Serialization.JsonPropertyName("securityReviewVerified")] bool SecurityReviewVerified,
53
+ [property: System.Text.Json.Serialization.JsonPropertyName("exemptionVerified")] bool ExemptionVerified,
54
+ [property: System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)]
55
+ [property: System.Text.Json.Serialization.JsonPropertyName("manualStable")] ManualStableAttestation? ManualStable = null,
56
+ [property: System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)]
57
+ [property: System.Text.Json.Serialization.JsonPropertyName("manualBundle")] ManualBundleAttestation? ManualBundle = null);
58
+
59
+ public sealed record ManualStableAttestation(
60
+ [property: System.Text.Json.Serialization.JsonPropertyName("format")] string? Format,
61
+ [property: System.Text.Json.Serialization.JsonPropertyName("sourceIdentity")] ReleaseIdentity? SourceIdentity,
62
+ [property: System.Text.Json.Serialization.JsonPropertyName("sourceDigests")] ReleaseDigests? SourceDigests,
63
+ [property: System.Text.Json.Serialization.JsonPropertyName("targetIdentity")] ReleaseIdentity? TargetIdentity,
64
+ [property: System.Text.Json.Serialization.JsonPropertyName("targetDigests")] ReleaseDigests? TargetDigests,
65
+ [property: System.Text.Json.Serialization.JsonPropertyName("audienceSha256")] string? AudienceSha256,
66
+ [property: System.Text.Json.Serialization.JsonPropertyName("ceiling")] ExecutionPrivilege Ceiling,
67
+ [property: System.Text.Json.Serialization.JsonPropertyName("policyVersion")] long PolicyVersion,
68
+ [property: System.Text.Json.Serialization.JsonPropertyName("actorIssuer")] string? ActorIssuer,
69
+ [property: System.Text.Json.Serialization.JsonPropertyName("actorSubject")] string? ActorSubject,
70
+ [property: System.Text.Json.Serialization.JsonPropertyName("promotedAtUtc")] DateTimeOffset PromotedAtUtc,
71
+ [property: System.Text.Json.Serialization.JsonPropertyName("reason")] string? Reason,
72
+ [property: System.Text.Json.Serialization.JsonPropertyName("staffAuthorized")] bool StaffAuthorized);
73
+
74
+ public sealed record RevocationEvidence(
75
+ [property: System.Text.Json.Serialization.JsonPropertyName("authenticated")] bool Authenticated,
76
+ [property: System.Text.Json.Serialization.JsonPropertyName("policyRevision")] long PolicyRevision,
77
+ [property: System.Text.Json.Serialization.JsonPropertyName("epoch")] long Epoch,
78
+ [property: System.Text.Json.Serialization.JsonPropertyName("sequence")] long Sequence,
79
+ [property: System.Text.Json.Serialization.JsonPropertyName("issuedAtUtc")] DateTimeOffset IssuedAtUtc,
80
+ [property: System.Text.Json.Serialization.JsonPropertyName("observedAtUtc")] DateTimeOffset ObservedAtUtc,
81
+ [property: System.Text.Json.Serialization.JsonPropertyName("expiresAtUtc")] DateTimeOffset ExpiresAtUtc,
82
+ [property: System.Text.Json.Serialization.JsonPropertyName("elapsedMilliseconds")] long ElapsedMilliseconds,
83
+ [property: System.Text.Json.Serialization.JsonPropertyName("deniedArtifactDigests")] ImmutableArray<string>? DeniedArtifactDigests);
84
+
85
+ public sealed record EvaluationEvidence(
86
+ [property: System.Text.Json.Serialization.JsonPropertyName("expectedComponentId")] string? ExpectedComponentId,
87
+ [property: System.Text.Json.Serialization.JsonPropertyName("evaluatedAtUtc")] DateTimeOffset EvaluatedAtUtc,
88
+ [property: System.Text.Json.Serialization.JsonPropertyName("registry")] RegistryEvidence? Registry,
89
+ [property: System.Text.Json.Serialization.JsonPropertyName("provenance")] ProvenanceEvidence? Provenance,
90
+ [property: System.Text.Json.Serialization.JsonPropertyName("revocation")] RevocationEvidence? Revocation);
91
+
92
+ public sealed record ExecutionContext(
93
+ [property: System.Text.Json.Serialization.JsonPropertyName("policyRevision")] long PolicyRevision,
94
+ [property: System.Text.Json.Serialization.JsonPropertyName("binding")] RenderBinding? Binding,
95
+ [property: System.Text.Json.Serialization.JsonPropertyName("slot")] SlotContract? Slot,
96
+ [property: System.Text.Json.Serialization.JsonPropertyName("cortexVersion")] string? CortexVersion,
97
+ [property: System.Text.Json.Serialization.JsonPropertyName("designSystem")] DesignSystemPin? DesignSystem,
98
+ [property: System.Text.Json.Serialization.JsonPropertyName("privilege")] ExecutionPrivilege Privilege,
99
+ [property: System.Text.Json.Serialization.JsonPropertyName("revocationEpoch")] long RevocationEpoch,
100
+ [property: System.Text.Json.Serialization.JsonPropertyName("revocationSequence")] long RevocationSequence,
101
+ [property: System.Text.Json.Serialization.JsonPropertyName("evidence")] EvaluationEvidence? Evidence);
102
+
103
+ public sealed record EligibilityResult(
104
+ [property: System.Text.Json.Serialization.JsonPropertyName("eligible")] bool Eligible,
105
+ [property: System.Text.Json.Serialization.JsonPropertyName("reason")] string Reason,
106
+ [property: System.Text.Json.Serialization.JsonPropertyName("protocol")] int? Protocol);
107
+
108
+ public sealed record RuntimePin(
109
+ [property: System.Text.Json.Serialization.JsonPropertyName("version")] string Version,
110
+ [property: System.Text.Json.Serialization.JsonPropertyName("graphManifestSha256")] string GraphManifestSha256);
111
+
@@ -0,0 +1,198 @@
1
+ // <auto-generated /> @orangelogic/myos-gen1 version=1.0.0-alpha.22
2
+ // schema-sha256=d475a5a955dbf03a276624f1fa0761e2f8c2bd8022bd8703aab6d508a81db8fd generator=1
3
+ #nullable enable
4
+ #pragma warning disable CS1591 // Public wire fields are documented in gen1.schema.json.
5
+ using System;
6
+ using System.Collections.Generic;
7
+ using System.Linq;
8
+ using System.Collections.Immutable;
9
+
10
+ namespace OrangeLogic.Contracts.Extensibility.UiComponent.Release;
11
+
12
+ /// <summary>Shared fail-closed policy evaluation. Inputs must be captured by trusted adapters; this is not a signature verifier.</summary>
13
+ public static class ReleaseEligibility
14
+ {
15
+ public const int MaximumFreshnessSeconds = 300;
16
+ private const long MaxWireInteger = 9_007_199_254_740_991;
17
+
18
+ public static EligibilityResult Evaluate(ReleasePolicy? release, ExecutionContext? context, SelectionMode mode, string? allowedChannel = null)
19
+ {
20
+ if (!ValidIdentity(release?.Identity)) return Deny("INVALID_IDENTITY");
21
+ if (release is null || context is null || !ValidMetadata(release, context, mode)) return Deny("INVALID_METADATA");
22
+ var evidence = context.Evidence!;
23
+ var registry = evidence.Registry;
24
+ if (registry is null || !registry.Authenticated)
25
+ return Deny("UNTRUSTED_REGISTRY");
26
+
27
+ var slot = context.Slot!;
28
+ if (!release.Exports.Contains(evidence.ExpectedComponentId!, StringComparer.Ordinal) ||
29
+ !release.SlotRanges.Any(range => range.ComponentId == evidence.ExpectedComponentId && range.SlotId == slot.SlotId &&
30
+ slot.Version >= range.Min && (range.Max is null || slot.Version <= range.Max))) return Deny("SLOT_INCOMPATIBLE");
31
+
32
+ var protocols = release.Protocols.Intersect(slot.SupportedProtocols).ToArray();
33
+ if (protocols.Length == 0) return Deny("PROTOCOL_INCOMPATIBLE");
34
+ if (release.CortexRange is not null && !InRange(context.CortexVersion!, release.CortexRange)) return Deny("CORTEX_INCOMPATIBLE");
35
+
36
+ var audience = release.Audience!;
37
+ var binding = context.Binding!;
38
+ if (audience.Kind != "everyone" &&
39
+ (!audience.CustomerIds.Contains(binding.CustomerId!, StringComparer.Ordinal) ||
40
+ !audience.InstanceIds.Contains(binding.InstanceId!, StringComparer.Ordinal))) return Deny("AUDIENCE_DENIED");
41
+ if (context.Privilege == ExecutionPrivilege.Unknown) return Deny("UNKNOWN_PRIVILEGE");
42
+ if (!ApprovalAccepts(release, context, allowedChannel)) return Deny("APPROVAL_INSUFFICIENT");
43
+
44
+ var freshness = evidence.Revocation;
45
+ if (release.Revoked == true || (freshness is { Authenticated: true } &&
46
+ freshness.DeniedArtifactDigests is { IsDefault: false } denied &&
47
+ denied.Contains(release.Digests!.Artifact!, StringComparer.Ordinal))) return Deny("REVOKED");
48
+ if (!Fresh(context)) return Deny("REVOCATION_STALE");
49
+ if (mode != SelectionMode.ExactPin && release.Withdrawn == true) return Deny("WITHDRAWN");
50
+ if (mode != SelectionMode.ExactPin && release.Deprecated == true) return Deny("DEPRECATED");
51
+ if (mode != SelectionMode.ExactPin && StrictSemVersion.Parse(release.Identity!.Version!).IsPrerelease) return Deny("PRERELEASE_EXCLUDED");
52
+ if (mode == SelectionMode.OfficialCoverage && (!release.OfficialDefault || audience.Kind != "everyone" ||
53
+ evidence.Provenance is not { IsOrangeLogicAuthored: true, OfficialDefault: true })) return Deny("NOT_OFFICIAL");
54
+ return new(true, "ELIGIBLE", protocols.Max());
55
+ }
56
+
57
+ private static bool ValidMetadata(ReleasePolicy r, ExecutionContext c, SelectionMode mode)
58
+ {
59
+ if (!Enum.IsDefined(mode) || !Enum.IsDefined(c.Privilege) ||
60
+ !Positive(c.PolicyRevision) ||
61
+ !Positive(c.RevocationEpoch) || !Nonnegative(c.RevocationSequence) ||
62
+ c.Binding is not { } b || !ValidBinding(b) ||
63
+ c.Slot is not { } slot || !Text(slot.SlotId) || slot.Version <= 0 || !Protocols(slot.SupportedProtocols) ||
64
+ !StrictSemVersion.TryParse(c.CortexVersion, out _) ||
65
+ c.DesignSystem is not { } ds || !Text(ds.ReleaseId) || !Hash(ds.ManifestSha256) || !StrictSemVersion.TryParse(ds.Version, out _) ||
66
+ c.Evidence is not { } e || !Text(e.ExpectedComponentId) || !Utc(e.EvaluatedAtUtc) ||
67
+ !Digests(r.Digests) || !Hash(r.AudienceSha256) || !Strings(r.Exports, false) || !Protocols(r.Protocols) ||
68
+ r.SlotRanges.IsDefaultOrEmpty || r.Withdrawn is null || r.Deprecated is null || r.Revoked is null ||
69
+ (r.CortexRange is not null && !ValidRange(r.CortexRange, false)) || !ValidRange(r.DesignSystemRange, true)) return false;
70
+ if (r.SlotRanges.Any(range => range is null || !Text(range.ComponentId) || !Text(range.SlotId) ||
71
+ range.Min <= 0 || (range.Max is not null && range.Max < range.Min) || !r.Exports.Contains(range.ComponentId!, StringComparer.Ordinal)) ||
72
+ r.SlotRanges.Select(range => (range.ComponentId, range.SlotId)).Distinct().Count() != r.SlotRanges.Length ||
73
+ r.Exports.Any(export => !r.SlotRanges.Any(range => range.ComponentId == export))) return false;
74
+ var a = r.Audience;
75
+ if (a is null || !Strings(a.CustomerIds, true) || !Strings(a.InstanceIds, true)) return false;
76
+ return a.Kind switch
77
+ {
78
+ "everyone" => a.CustomerIds.IsEmpty && a.InstanceIds.IsEmpty,
79
+ "restrictedOLAlternative" => a.CustomerIds.Length > 0 && a.InstanceIds.Length > 0,
80
+ "customerInstances" => a.CustomerIds.Length == 1 && a.InstanceIds.Length > 0,
81
+ _ => false
82
+ };
83
+ }
84
+
85
+ private static bool ApprovalAccepts(ReleasePolicy r, ExecutionContext c, string? allowedChannel)
86
+ {
87
+ var p = c.Evidence!.Provenance;
88
+ var a = r.Approval;
89
+ if (p is null || !p.Authenticated || p.Identity != r.Identity || p.Digests != r.Digests ||
90
+ p.AudienceSha256 != r.AudienceSha256 || p.Approval != a || p.OfficialDefault != r.OfficialDefault ||
91
+ a is null || !Positive(a.Revision) || a.PolicyVersion != c.PolicyRevision ||
92
+ a.Digests != r.Digests || a.AudienceSha256 != r.AudienceSha256 ||
93
+ !Enum.IsDefined(a.Ceiling) || a.Ceiling == ExecutionPrivilege.Unknown ||
94
+ PrivilegeRank(c.Privilege) > PrivilegeRank(a.Ceiling)) return false;
95
+ if (r.Audience!.Kind == "restrictedOLAlternative" && !p.IsOrangeLogicAuthored) return false;
96
+ if (a.ExemptionId == ManualBundleProof.Exemption || p.ManualBundle is not null)
97
+ return ManualBundleProof.Accepts(r, p, p.ManualBundle, c.Evidence.EvaluatedAtUtc);
98
+ if (a.ExemptionId == "manual-stable:1" || p.ManualStable is not null)
99
+ return ManualStableProofAccepts(r, p, c.Evidence.EvaluatedAtUtc);
100
+ // The trusted host supplies a channel only after checking current site opt-in and signed membership.
101
+ if (a.ExemptionId?.StartsWith("channel:", StringComparison.Ordinal) == true)
102
+ return Text(allowedChannel) && a.ExemptionId == "channel:" + allowedChannel &&
103
+ StrictSemVersion.Parse(r.Identity!.Version!).IsPrerelease && p.ExemptionVerified &&
104
+ a.CodeReviewId is null && a.SecurityReviewId is null;
105
+ if (Text(a.ExemptionId)) return p.IsOrangeLogicAuthored && p.ExemptionVerified &&
106
+ a.CodeReviewId is null && a.SecurityReviewId is null;
107
+ if (a.ExemptionId is not null || !Text(a.CodeReviewId) || !p.CodeReviewVerified) return false;
108
+ var securityRequired = r.Audience.Kind == "everyone" || r.Audience.CustomerIds.Length > 1 ||
109
+ PrivilegeRank(a.Ceiling) >= PrivilegeRank(ExecutionPrivilege.CustomerAdmin);
110
+ return (!securityRequired || (Text(a.SecurityReviewId) && p.SecurityReviewVerified)) &&
111
+ (a.SecurityReviewId is null || (Text(a.SecurityReviewId) && p.SecurityReviewVerified));
112
+ }
113
+
114
+ /// <summary>Checks only a manual attestation's binding and truthfulness. Call Evaluate for audience, privilege, availability and revocation.</summary>
115
+ public static bool ManualStableProofAccepts(ReleasePolicy r, ProvenanceEvidence p, DateTimeOffset now)
116
+ {
117
+ var a = r.Approval!;
118
+ var m = p.ManualStable;
119
+ return p.ManualBundle is null && a is not null && ValidIdentity(r.Identity) && Digests(r.Digests) && Hash(r.AudienceSha256) &&
120
+ p.Authenticated && p.Identity == r.Identity && p.Digests == r.Digests && p.Approval == a &&
121
+ p.AudienceSha256 == r.AudienceSha256 && a.Digests == r.Digests && a.AudienceSha256 == r.AudienceSha256 &&
122
+ Positive(a.Revision) && Positive(a.PolicyVersion) && Enum.IsDefined(a.Ceiling) && a.Ceiling != ExecutionPrivilege.Unknown &&
123
+ a.ExemptionId == "manual-stable:1" && m is not null && m.Format == "orangelogic.gen1.manual-stable/1" &&
124
+ m.StaffAuthorized && Text(m.ActorIssuer) && Text(m.ActorSubject) &&
125
+ Utc(m.PromotedAtUtc) && m.PromotedAtUtc <= now && m.Reason is { Length: <= 1024 } && !m.Reason.Any(char.IsControl) &&
126
+ ValidIdentity(m.SourceIdentity) && StrictSemVersion.Parse(m.SourceIdentity!.Version!).IsPrerelease &&
127
+ m.SourceIdentity!.PackageId == r.Identity!.PackageId && m.TargetIdentity == r.Identity &&
128
+ !StrictSemVersion.Parse(r.Identity!.Version!).IsPrerelease && !r.Identity.Version!.Contains('+') &&
129
+ Digests(m.SourceDigests) && m.TargetDigests == r.Digests &&
130
+ m.SourceDigests!.Release != r.Digests!.Release && m.SourceDigests.Manifest != r.Digests.Manifest &&
131
+ m.SourceDigests.Source == r.Digests.Source && m.SourceDigests.Build == r.Digests.Build &&
132
+ m.SourceDigests.Artifact == r.Digests.Artifact && m.SourceDigests.Authorship == r.Digests.Authorship &&
133
+ m.AudienceSha256 == r.AudienceSha256 && m.Ceiling == a.Ceiling && m.PolicyVersion == a.PolicyVersion &&
134
+ !r.OfficialDefault && !p.OfficialDefault && !p.IsOrangeLogicAuthored &&
135
+ !p.CodeReviewVerified && !p.SecurityReviewVerified && !p.ExemptionVerified &&
136
+ a.CodeReviewId is null && a.SecurityReviewId is null;
137
+ }
138
+
139
+ private static bool Fresh(ExecutionContext c)
140
+ {
141
+ var f = c.Evidence!.Revocation;
142
+ var now = c.Evidence.EvaluatedAtUtc;
143
+ if (f is null || !f.Authenticated ||
144
+ f.PolicyRevision != c.PolicyRevision || !Positive(f.Epoch) || !Nonnegative(f.Sequence) ||
145
+ f.Epoch < c.RevocationEpoch || (f.Epoch == c.RevocationEpoch && f.Sequence < c.RevocationSequence) ||
146
+ !Utc(f.IssuedAtUtc) || !Utc(f.ObservedAtUtc) || !Utc(f.ExpiresAtUtc) ||
147
+ f.IssuedAtUtc > f.ObservedAtUtc || f.ObservedAtUtc > now || f.ExpiresAtUtc <= f.IssuedAtUtc ||
148
+ f.ExpiresAtUtc - f.IssuedAtUtc > TimeSpan.FromSeconds(MaximumFreshnessSeconds) ||
149
+ f.ElapsedMilliseconds < 0 || f.ElapsedMilliseconds >= MaximumFreshnessSeconds * 1000L ||
150
+ f.DeniedArtifactDigests is not { IsDefault: false } denied || denied.Any(digest => !Hash(digest))) return false;
151
+ // Avoid timestamp addition/overflow and use the greater conservative elapsed age.
152
+ var age = now - f.IssuedAtUtc;
153
+ var monotonicAge = f.ObservedAtUtc - f.IssuedAtUtc + TimeSpan.FromMilliseconds(f.ElapsedMilliseconds);
154
+ if (monotonicAge > age) age = monotonicAge;
155
+ return age < TimeSpan.FromSeconds(MaximumFreshnessSeconds) && age < f.ExpiresAtUtc - f.IssuedAtUtc;
156
+ }
157
+
158
+ private static bool ValidBinding(RenderBinding b) => Text(b.CustomerId) && Text(b.InstanceId) && Text(b.LocationId) && Text(b.ProfileId) &&
159
+ Positive(b.PrincipalAuthorizationRevision) && Nonnegative(b.ParameterSessionRevision) &&
160
+ (b.ParameterSessionId is null ? b.ParameterSessionRevision == 0 : Text(b.ParameterSessionId) && b.ParameterSessionRevision > 0) &&
161
+ Hash(b.BindingSha256) && Hash(b.ConfigurationSha256);
162
+
163
+ private static bool ValidIdentity(ReleaseIdentity? id) => id is not null &&
164
+ id.PackageId is { Length: > 0 and <= 128 } name && name[0] is (>= 'a' and <= 'z') or (>= '0' and <= '9') &&
165
+ name.All(ch => ch is (>= 'a' and <= 'z') or (>= '0' and <= '9') or '.' or '-') &&
166
+ !name.Contains("..", StringComparison.Ordinal) && StrictSemVersion.TryParse(id.Version, out _);
167
+
168
+ private static bool ValidRange(VersionRange? range, bool designSystem)
169
+ {
170
+ if (range is null || !StrictSemVersion.TryParse(range.Min, out var min)) return false;
171
+ if (range.Max is null) return true;
172
+ return StrictSemVersion.TryParse(range.Max, out var max) && max.ComparePrecedence(min) >= 0 &&
173
+ (!designSystem || SameDesignSystemLine(min, max));
174
+ }
175
+ private static bool InRange(string version, VersionRange range)
176
+ {
177
+ var candidate = StrictSemVersion.Parse(version);
178
+ return candidate.ComparePrecedence(StrictSemVersion.Parse(range.Min!)) >= 0 &&
179
+ (range.Max is null || candidate.ComparePrecedence(StrictSemVersion.Parse(range.Max)) <= 0);
180
+ }
181
+ private static bool SameDesignSystemLine(StrictSemVersion min, StrictSemVersion version) => min.Major == version.Major &&
182
+ (min.Major != "0" || min.Minor == version.Minor);
183
+ private static int PrivilegeRank(ExecutionPrivilege privilege) => privilege switch
184
+ {
185
+ ExecutionPrivilege.Ordinary => 1, ExecutionPrivilege.CustomerAdmin => 2, ExecutionPrivilege.VisitingStaff => 3, _ => int.MaxValue
186
+ };
187
+ private static bool Protocols(ImmutableArray<int> values) => !values.IsDefaultOrEmpty && values.All(value => value > 0) && values.Distinct().Count() == values.Length;
188
+ private static bool Strings(ImmutableArray<string> values, bool emptyAllowed) => !values.IsDefault && (emptyAllowed || !values.IsEmpty) &&
189
+ values.All(Text) && values.Distinct(StringComparer.Ordinal).Count() == values.Length;
190
+ private static bool Text(string? value) => value is { Length: > 0 and <= 256 } && !string.IsNullOrWhiteSpace(value) &&
191
+ value == value.Trim() && !value.Any(char.IsControl);
192
+ private static bool Hash(string? value) => value is { Length: 64 } && value.All(ch => ch is (>= '0' and <= '9') or (>= 'a' and <= 'f'));
193
+ private static bool Digests(ReleaseDigests? d) => d is not null && Hash(d.Release) && Hash(d.Source) && Hash(d.Build) && Hash(d.Artifact) && Hash(d.Manifest) && Hash(d.Authorship);
194
+ private static bool Utc(DateTimeOffset time) => time != default && time.Offset == TimeSpan.Zero;
195
+ private static bool Positive(long value) => value > 0 && value <= MaxWireInteger;
196
+ private static bool Nonnegative(long value) => value >= 0 && value <= MaxWireInteger;
197
+ private static EligibilityResult Deny(string reason) => new(false, reason, null);
198
+ }
@@ -0,0 +1,64 @@
1
+ // <auto-generated /> @orangelogic/myos-gen1 version=1.0.0-alpha.22
2
+ // schema-sha256=d475a5a955dbf03a276624f1fa0761e2f8c2bd8022bd8703aab6d508a81db8fd generator=1
3
+ #nullable enable
4
+ #pragma warning disable CS1591 // Public wire fields are documented in gen1.schema.json.
5
+ using System;
6
+ using System.Collections.Generic;
7
+ using System.Collections.Immutable;
8
+
9
+ namespace OrangeLogic.Contracts.Extensibility.UiComponent.Release;
10
+
11
+ public sealed record ReleaseDigests(
12
+ [property: System.Text.Json.Serialization.JsonPropertyName("release")] string? Release,
13
+ [property: System.Text.Json.Serialization.JsonPropertyName("source")] string? Source,
14
+ [property: System.Text.Json.Serialization.JsonPropertyName("build")] string? Build,
15
+ [property: System.Text.Json.Serialization.JsonPropertyName("artifact")] string? Artifact,
16
+ [property: System.Text.Json.Serialization.JsonPropertyName("manifest")] string? Manifest,
17
+ [property: System.Text.Json.Serialization.JsonPropertyName("authorship")] string? Authorship);
18
+
19
+ public sealed record VersionRange(
20
+ [property: System.Text.Json.Serialization.JsonPropertyName("min")] string? Min,
21
+ [property: System.Text.Json.Serialization.JsonPropertyName("max")] string? Max);
22
+
23
+ public sealed record SlotRange(
24
+ [property: System.Text.Json.Serialization.JsonPropertyName("componentId")] string? ComponentId,
25
+ [property: System.Text.Json.Serialization.JsonPropertyName("slotId")] string? SlotId,
26
+ [property: System.Text.Json.Serialization.JsonPropertyName("min")] int Min,
27
+ [property: System.Text.Json.Serialization.JsonPropertyName("max")] int? Max);
28
+
29
+ public sealed record ReleaseFixture(
30
+ [property: System.Text.Json.Serialization.JsonPropertyName("path")] string Path,
31
+ [property: System.Text.Json.Serialization.JsonPropertyName("sha256")] string Sha256,
32
+ [property: System.Text.Json.Serialization.JsonPropertyName("publicUnitJson")] string PublicUnitJson);
33
+
34
+ public sealed record ReleaseAudience(
35
+ [property: System.Text.Json.Serialization.JsonPropertyName("kind")] string? Kind,
36
+ [property: System.Text.Json.Serialization.JsonPropertyName("customerIds")] ImmutableArray<string> CustomerIds,
37
+ [property: System.Text.Json.Serialization.JsonPropertyName("instanceIds")] ImmutableArray<string> InstanceIds);
38
+
39
+ public sealed record Approval(
40
+ [property: System.Text.Json.Serialization.JsonPropertyName("revision")] long Revision,
41
+ [property: System.Text.Json.Serialization.JsonPropertyName("policyVersion")] long PolicyVersion,
42
+ [property: System.Text.Json.Serialization.JsonPropertyName("digests")] ReleaseDigests? Digests,
43
+ [property: System.Text.Json.Serialization.JsonPropertyName("audienceSha256")] string? AudienceSha256,
44
+ [property: System.Text.Json.Serialization.JsonPropertyName("ceiling")] ExecutionPrivilege Ceiling,
45
+ [property: System.Text.Json.Serialization.JsonPropertyName("codeReviewId")] string? CodeReviewId,
46
+ [property: System.Text.Json.Serialization.JsonPropertyName("securityReviewId")] string? SecurityReviewId,
47
+ [property: System.Text.Json.Serialization.JsonPropertyName("exemptionId")] string? ExemptionId);
48
+
49
+ public sealed record ReleasePolicy(
50
+ [property: System.Text.Json.Serialization.JsonPropertyName("identity")] ReleaseIdentity? Identity,
51
+ [property: System.Text.Json.Serialization.JsonPropertyName("digests")] ReleaseDigests? Digests,
52
+ [property: System.Text.Json.Serialization.JsonPropertyName("officialDefault")] bool OfficialDefault,
53
+ [property: System.Text.Json.Serialization.JsonPropertyName("exports")] ImmutableArray<string> Exports,
54
+ [property: System.Text.Json.Serialization.JsonPropertyName("protocols")] ImmutableArray<int> Protocols,
55
+ [property: System.Text.Json.Serialization.JsonPropertyName("slotRanges")] ImmutableArray<SlotRange> SlotRanges,
56
+ [property: System.Text.Json.Serialization.JsonPropertyName("cortexRange")] VersionRange? CortexRange,
57
+ [property: System.Text.Json.Serialization.JsonPropertyName("designSystemRange")] VersionRange? DesignSystemRange,
58
+ [property: System.Text.Json.Serialization.JsonPropertyName("audience")] ReleaseAudience? Audience,
59
+ [property: System.Text.Json.Serialization.JsonPropertyName("audienceSha256")] string? AudienceSha256,
60
+ [property: System.Text.Json.Serialization.JsonPropertyName("approval")] Approval? Approval,
61
+ [property: System.Text.Json.Serialization.JsonPropertyName("withdrawn")] bool? Withdrawn,
62
+ [property: System.Text.Json.Serialization.JsonPropertyName("deprecated")] bool? Deprecated,
63
+ [property: System.Text.Json.Serialization.JsonPropertyName("revoked")] bool? Revoked);
64
+