@astrale-os/kernel-protocol 0.5.0-beta.67 → 0.5.0-beta.68

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 (221) hide show
  1. package/dist/codecs/index.d.ts +1 -2
  2. package/dist/codecs/index.js +1 -2
  3. package/dist/codecs/media-types.d.ts +0 -1
  4. package/dist/codecs/media-types.js +0 -1
  5. package/dist/index.d.ts +3 -1
  6. package/dist/index.js +3 -1
  7. package/dist/invocation/admission.d.ts +2 -2
  8. package/dist/invocation/admission.js +5 -5
  9. package/dist/invocation/binding-codecs.d.ts +1 -1
  10. package/dist/invocation/binding-codecs.js +1 -6
  11. package/dist/invocation/http/negotiation.js +3 -10
  12. package/dist/invocation/index.d.ts +5 -2
  13. package/dist/invocation/index.js +4 -2
  14. package/dist/invocation/legacy/index.d.ts +29 -0
  15. package/dist/invocation/legacy/index.js +28 -0
  16. package/dist/invocation/legacy/route.d.ts +14 -0
  17. package/dist/invocation/legacy/route.js +25 -0
  18. package/dist/invocation/legacy/via.d.ts +30 -0
  19. package/dist/invocation/legacy/via.js +15 -0
  20. package/dist/invocation/redirect.d.ts +15 -12
  21. package/dist/invocation/redirect.js +9 -21
  22. package/dist/invocation/request.js +2 -2
  23. package/dist/invocation/routing.d.ts +19 -5
  24. package/dist/invocation/routing.js +50 -20
  25. package/dist/invocation/schema.d.ts +3 -8
  26. package/dist/invocation/schema.js +3 -10
  27. package/dist/invocation/service-reason.d.ts +13 -13
  28. package/dist/invocation/service-reason.js +13 -12
  29. package/dist/invocation/stale-route.d.ts +1 -1
  30. package/dist/invocation/target.d.ts +3 -0
  31. package/dist/invocation/target.js +8 -1
  32. package/dist/invocation/websocket/index.d.ts +1 -1
  33. package/dist/invocation/websocket/index.js +1 -1
  34. package/dist/invocation/websocket/subprotocol.d.ts +1 -2
  35. package/dist/invocation/websocket/subprotocol.js +3 -4
  36. package/dist/issuer/index.d.ts +1 -0
  37. package/dist/issuer/index.js +1 -0
  38. package/dist/issuer/paths.d.ts +2 -0
  39. package/dist/issuer/paths.js +1 -0
  40. package/dist/issuer/workflow-engine.d.ts +18 -0
  41. package/dist/issuer/workflow-engine.js +59 -0
  42. package/dist/{publication → release}/bindings/callable.js +6 -6
  43. package/dist/release/bindings/invocation.js +13 -0
  44. package/dist/{publication → release}/bindings/view.d.ts +1 -1
  45. package/dist/{publication → release}/bindings/view.js +10 -10
  46. package/dist/release/build.d.ts +6 -0
  47. package/dist/release/build.js +7 -0
  48. package/dist/release/bundle-admission.d.ts +21 -0
  49. package/dist/{publication → release}/bundle-admission.js +18 -18
  50. package/dist/{publication → release}/bundle-descriptor.js +6 -6
  51. package/dist/release/bundle-evidence.d.ts +3 -0
  52. package/dist/release/bundle-evidence.js +13 -0
  53. package/dist/{publication → release}/bundle.d.ts +2 -2
  54. package/dist/{publication → release}/bundle.js +9 -9
  55. package/dist/{publication → release}/delivery/attestation.d.ts +1 -0
  56. package/dist/release/delivery/claims.d.ts +21 -0
  57. package/dist/release/delivery/claims.js +68 -0
  58. package/dist/release/delivery/delivery.d.ts +11 -0
  59. package/dist/release/delivery/delivery.js +24 -0
  60. package/dist/{publication → release}/delivery/error.d.ts +2 -0
  61. package/dist/{publication → release}/delivery/error.js +1 -0
  62. package/dist/{publication → release}/delivery/index.d.ts +6 -1
  63. package/dist/{publication → release}/delivery/index.js +5 -0
  64. package/dist/{publication → release}/delivery/limits.d.ts +2 -1
  65. package/dist/release/delivery/limits.js +5 -0
  66. package/dist/release/delivery/request.d.ts +21 -0
  67. package/dist/release/delivery/request.js +60 -0
  68. package/dist/{publication → release}/delivery-declaration.js +4 -4
  69. package/dist/release/delivery-endpoint.js +22 -0
  70. package/dist/release/digest.d.ts +13 -0
  71. package/dist/{publication/etag.js → release/digest.js} +1 -10
  72. package/dist/release/error.d.ts +7 -0
  73. package/dist/release/error.js +11 -0
  74. package/dist/release/index.d.ts +21 -0
  75. package/dist/release/index.js +14 -0
  76. package/dist/release/issuer.d.ts +5 -0
  77. package/dist/release/issuer.js +34 -0
  78. package/dist/release/legacy/bindings.d.ts +14 -0
  79. package/dist/release/legacy/bindings.js +11 -0
  80. package/dist/release/legacy/bundle-admission.d.ts +6 -0
  81. package/dist/release/legacy/bundle-admission.js +10 -0
  82. package/dist/release/legacy/bundle-evidence.d.ts +8 -0
  83. package/dist/release/legacy/bundle-evidence.js +11 -0
  84. package/dist/release/legacy/bundle.d.ts +24 -0
  85. package/dist/release/legacy/bundle.js +31 -0
  86. package/dist/release/legacy/delivery/attestation.d.ts +6 -0
  87. package/dist/release/legacy/delivery/attestation.js +1 -0
  88. package/dist/{publication → release/legacy}/delivery/claims.d.ts +9 -0
  89. package/dist/{publication → release/legacy}/delivery/claims.js +7 -2
  90. package/dist/release/legacy/delivery/delivery.d.ts +18 -0
  91. package/dist/{publication → release/legacy}/delivery/delivery.js +6 -2
  92. package/dist/release/legacy/delivery/error.d.ts +16 -0
  93. package/dist/release/legacy/delivery/error.js +6 -0
  94. package/dist/release/legacy/delivery/index.d.ts +13 -0
  95. package/dist/release/legacy/delivery/index.js +13 -0
  96. package/dist/release/legacy/delivery/limits.d.ts +21 -0
  97. package/dist/release/legacy/delivery/limits.js +22 -0
  98. package/dist/release/legacy/delivery/request.d.ts +26 -0
  99. package/dist/{publication → release/legacy}/delivery/request.js +8 -3
  100. package/dist/release/legacy/delivery-declaration.d.ts +9 -0
  101. package/dist/release/legacy/delivery-declaration.js +11 -0
  102. package/dist/release/legacy/error.d.ts +26 -0
  103. package/dist/release/legacy/error.js +114 -0
  104. package/dist/release/legacy/etag.d.ts +12 -0
  105. package/dist/release/legacy/etag.js +14 -0
  106. package/dist/release/legacy/index.d.ts +72 -0
  107. package/dist/{publication → release/legacy}/index.js +7 -2
  108. package/dist/release/legacy/profiles.d.ts +23 -0
  109. package/dist/release/legacy/profiles.js +36 -0
  110. package/dist/release/legacy/projection.d.ts +13 -0
  111. package/dist/release/legacy/projection.js +25 -0
  112. package/dist/release/legacy/publication.d.ts +90 -0
  113. package/dist/release/legacy/publication.js +124 -0
  114. package/dist/release/legacy/reference.d.ts +47 -0
  115. package/dist/{publication → release/legacy}/reference.js +27 -3
  116. package/dist/release/legacy/requirements.d.ts +30 -0
  117. package/dist/release/legacy/requirements.js +20 -0
  118. package/dist/{publication → release}/manifest.js +6 -6
  119. package/dist/release/reference.d.ts +26 -0
  120. package/dist/release/reference.js +70 -0
  121. package/dist/release/release.d.ts +60 -0
  122. package/dist/release/release.js +123 -0
  123. package/dist/{publication → release}/requirements.d.ts +11 -4
  124. package/dist/{publication → release}/requirements.js +58 -39
  125. package/dist/{publication → release}/route.js +24 -24
  126. package/dist/{publication → release}/schema.js +4 -4
  127. package/dist/release/served.d.ts +26 -0
  128. package/dist/release/served.js +65 -0
  129. package/dist/release/shape.d.ts +8 -0
  130. package/dist/routes/admission.d.ts +1 -1
  131. package/dist/routes/admission.js +7 -85
  132. package/dist/routes/binding.d.ts +3 -3
  133. package/dist/routes/binding.js +10 -19
  134. package/dist/routes/compiler.d.ts +2 -2
  135. package/dist/routes/compiler.js +3 -2
  136. package/dist/routes/credential.d.ts +1 -1
  137. package/dist/routes/decode.d.ts +5 -2
  138. package/dist/routes/decode.js +15 -4
  139. package/dist/routes/deployment-retired.d.ts +30 -0
  140. package/dist/routes/deployment-retired.js +96 -0
  141. package/dist/routes/encode.js +7 -6
  142. package/dist/routes/entries.d.ts +23 -0
  143. package/dist/routes/entries.js +150 -0
  144. package/dist/routes/evidence.d.ts +3 -3
  145. package/dist/routes/evidence.js +7 -34
  146. package/dist/routes/header.d.ts +9 -0
  147. package/dist/routes/header.js +34 -0
  148. package/dist/routes/index.d.ts +5 -2
  149. package/dist/routes/index.js +5 -2
  150. package/dist/routes/legacy/index.d.ts +29 -0
  151. package/dist/routes/legacy/index.js +29 -0
  152. package/dist/routes/legacy/routing.d.ts +24 -0
  153. package/dist/routes/legacy/routing.js +45 -0
  154. package/dist/routes/legacy/table.d.ts +34 -0
  155. package/dist/routes/legacy/table.js +50 -0
  156. package/dist/routes/mapping.d.ts +1 -1
  157. package/dist/routes/mapping.js +4 -4
  158. package/dist/routes/match.d.ts +1 -1
  159. package/dist/routes/placement.d.ts +2 -2
  160. package/dist/routes/plan.d.ts +1 -1
  161. package/dist/routes/request.d.ts +3 -3
  162. package/dist/routes/reservation.d.ts +4 -2
  163. package/dist/routes/reservation.js +4 -3
  164. package/dist/routes/routing.d.ts +30 -6
  165. package/dist/routes/routing.js +34 -49
  166. package/dist/routes/select.d.ts +1 -1
  167. package/dist/routes/table.d.ts +3 -2
  168. package/dist/routes/target.d.ts +5 -0
  169. package/dist/routes/target.js +16 -0
  170. package/dist/runtime/artifact.d.ts +2 -2
  171. package/dist/runtime/artifact.js +2 -2
  172. package/dist/schema/installation/codec.d.ts +6 -1
  173. package/dist/schema/installation/codec.js +10 -7
  174. package/dist/schema/installation/introspection/codec.d.ts +11 -2
  175. package/dist/schema/installation/introspection/codec.js +59 -41
  176. package/dist/schema/installation/introspection/result.d.ts +8 -1
  177. package/dist/schema/installation/legacy/index.d.ts +39 -0
  178. package/dist/schema/installation/legacy/index.js +39 -0
  179. package/dist/schema/installation/legacy/installation.d.ts +9 -0
  180. package/dist/schema/installation/legacy/installation.js +28 -0
  181. package/dist/schema/installation/legacy/introspection.d.ts +10 -0
  182. package/dist/schema/installation/legacy/introspection.js +70 -0
  183. package/dist/schema/installation/legacy/msgpack.d.ts +1 -0
  184. package/dist/schema/installation/legacy/msgpack.js +143 -0
  185. package/package.json +59 -36
  186. package/dist/codecs/msgpack.d.ts +0 -4
  187. package/dist/codecs/msgpack.js +0 -53
  188. package/dist/publication/bindings/invocation.js +0 -13
  189. package/dist/publication/bundle-admission.d.ts +0 -4
  190. package/dist/publication/bundle-evidence.d.ts +0 -3
  191. package/dist/publication/bundle-evidence.js +0 -13
  192. package/dist/publication/content.d.ts +0 -10
  193. package/dist/publication/delivery/delivery.d.ts +0 -9
  194. package/dist/publication/delivery/limits.js +0 -4
  195. package/dist/publication/delivery/request.d.ts +0 -15
  196. package/dist/publication/delivery-endpoint.js +0 -22
  197. package/dist/publication/error.d.ts +0 -7
  198. package/dist/publication/error.js +0 -11
  199. package/dist/publication/etag.d.ts +0 -6
  200. package/dist/publication/index.d.ts +0 -17
  201. package/dist/publication/legacy-requirements.d.ts +0 -12
  202. package/dist/publication/legacy-requirements.js +0 -23
  203. package/dist/publication/publication.d.ts +0 -38
  204. package/dist/publication/publication.js +0 -146
  205. package/dist/publication/reference.d.ts +0 -17
  206. package/dist/routes/release-unavailable.d.ts +0 -8
  207. package/dist/routes/release-unavailable.js +0 -32
  208. /package/dist/{publication → release}/bindings/callable.d.ts +0 -0
  209. /package/dist/{publication → release}/bindings/index.d.ts +0 -0
  210. /package/dist/{publication → release}/bindings/index.js +0 -0
  211. /package/dist/{publication → release}/bindings/invocation.d.ts +0 -0
  212. /package/dist/{publication → release}/bundle-descriptor.d.ts +0 -0
  213. /package/dist/{publication → release}/declaration.d.ts +0 -0
  214. /package/dist/{publication → release}/declaration.js +0 -0
  215. /package/dist/{publication → release}/delivery/attestation.js +0 -0
  216. /package/dist/{publication → release}/delivery-declaration.d.ts +0 -0
  217. /package/dist/{publication → release}/delivery-endpoint.d.ts +0 -0
  218. /package/dist/{publication → release}/manifest.d.ts +0 -0
  219. /package/dist/{publication → release}/route.d.ts +0 -0
  220. /package/dist/{publication → release}/schema.d.ts +0 -0
  221. /package/dist/{publication/content.js → release/shape.js} +0 -0
@@ -0,0 +1,25 @@
1
+ import { seal } from './publication.js';
2
+ /**
3
+ * The v3 Publication a v4 deployment serves at `domain.json`, for the Kernels, Workers and tools
4
+ * that predate `DomainRelease` v4: the release's served content sealed as Publication v3. It drops
5
+ * `format`, `version`, `digest` and `build`, so its ETag covers what a v3 ETag always covered and
6
+ * never the code. Frozen forever: every party that projects a release (Kernel, Worker, tooling at
7
+ * any package version) must compute the same bytes, which the golden vectors pin.
8
+ *
9
+ * @deprecated Serves pre-v4 readers only; a v4 reader fetches the `DomainRelease` at `release.json`.
10
+ * Deleted with the projection row of `legacy/index.ts`.
11
+ */
12
+ export function publication(release) {
13
+ return seal({
14
+ format: 'astrale.domain.publication',
15
+ version: 3,
16
+ origin: release.origin,
17
+ identity: release.identity,
18
+ schema: release.schema,
19
+ requirements: release.requirements,
20
+ ...(release.manifest === undefined ? {} : { manifest: release.manifest }),
21
+ bindings: release.bindings,
22
+ routes: release.routes,
23
+ ...(release.delivery === undefined ? {} : { delivery: release.delivery }),
24
+ });
25
+ }
@@ -0,0 +1,90 @@
1
+ import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
2
+ import type { Key } from '@astrale-os/kernel-dsl/v1/addressing';
3
+ import type { CallableBinding, ViewBinding } from '../bindings/index.js';
4
+ import type { Endpoint as DeliveryEndpoint } from '../delivery-endpoint.js';
5
+ import type { Manifest } from '../manifest.js';
6
+ import type { Requirements } from '../requirements.js';
7
+ import type { HttpRoute } from '../route.js';
8
+ import type { Schema } from '../schema.js';
9
+ import type { Etag } from './etag.js';
10
+ /**
11
+ * @deprecated Path of the v2/v3 Publication; use the release `PATH` (`release.json`) from
12
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
13
+ */
14
+ export declare const PATH: '/.well-known/astrale/domain.json';
15
+ /**
16
+ * @deprecated Media type of Publication v3; use the release `MEDIA_TYPE` from
17
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
18
+ */
19
+ export declare const MEDIA_TYPE: 'application/vnd.astrale.domain-publication+json;v=3';
20
+ /**
21
+ * @deprecated Media type of Publication v2; use the release `MEDIA_TYPE` from
22
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
23
+ */
24
+ export declare const LEGACY_MEDIA_TYPE: 'application/vnd.astrale.domain-publication+json;v=2';
25
+ /**
26
+ * Select the media type of one v2 or v3 Publication.
27
+ *
28
+ * @deprecated Serves and retains v2/v3 Publications only; use the release `MEDIA_TYPE` from
29
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4), the one media type of a
30
+ * release.
31
+ */
32
+ export declare function mediaType(input: Pick<Publication, 'version'>): typeof MEDIA_TYPE | typeof LEGACY_MEDIA_TYPE;
33
+ /**
34
+ * Resolve the canonical Publication URL beneath one exact HTTP(S) serving issuer.
35
+ *
36
+ * @deprecated Locates the v2/v3 Publication; use the release `url` (`release.json`) from
37
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
38
+ */
39
+ export declare function url(input: string): string;
40
+ /**
41
+ * Immutable v2/v3 deployment snapshot of one root Domain.
42
+ *
43
+ * @deprecated Use `DomainRelease` from `@astrale-os/kernel-protocol/release` (added with
44
+ * `DomainRelease` v4). Kept to read and serve the documents of Kernels, Workers and installations
45
+ * that predate v4.
46
+ */
47
+ export interface Publication {
48
+ readonly format: 'astrale.domain.publication';
49
+ readonly version: 2 | 3;
50
+ readonly origin: Key.Origin;
51
+ readonly identity: {
52
+ readonly issuer: IssuerId;
53
+ readonly subject: string;
54
+ };
55
+ readonly etag: Etag;
56
+ readonly schema: Schema;
57
+ readonly requirements: Requirements;
58
+ readonly manifest?: Manifest;
59
+ readonly bindings: {
60
+ readonly callables: readonly CallableBinding[];
61
+ readonly views: readonly ViewBinding[];
62
+ };
63
+ readonly routes: readonly HttpRoute[];
64
+ readonly delivery?: DeliveryEndpoint;
65
+ }
66
+ /**
67
+ * @deprecated Content of a v2/v3 Publication before its ETag is computed; use the release
68
+ * `Content` from `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4). Only
69
+ * version 3 is sealed; version 2 is read-only retained evidence.
70
+ */
71
+ export type Content = Omit<Publication, 'etag' | 'version'> & {
72
+ readonly version: 3;
73
+ };
74
+ /** The ETag-covered content of any admitted Publication, including retained version 2. */
75
+ export type EtagContent = Omit<Publication, 'etag'>;
76
+ /**
77
+ * @deprecated Seals a v2/v3 Publication; use the release `seal` from
78
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
79
+ */
80
+ export declare function seal(input: Content): Publication;
81
+ /**
82
+ * @deprecated Admits a v2/v3 Publication; use the release `accept` from
83
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
84
+ */
85
+ export declare function accept(input: unknown): Publication;
86
+ /**
87
+ * @deprecated Encodes a v2/v3 Publication byte-identically to its accepted wire form; use the
88
+ * release `encode` from `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
89
+ */
90
+ export declare function encode(input: Publication): Uint8Array;
@@ -0,0 +1,124 @@
1
+ import * as portable from '@astrale-os/kernel-dsl/value';
2
+ import { admitDigest } from '../digest.js';
3
+ import { servedUrl } from '../issuer.js';
4
+ import { admitServedContent } from '../served.js';
5
+ import { deepFreeze } from '../shape.js';
6
+ import { exact, fail, record, withPublicationError } from './error.js';
7
+ import { computeEtag } from './etag.js';
8
+ import { decodeLegacyRequirements, encodeLegacyRequirements } from './profiles.js';
9
+ /**
10
+ * @deprecated Path of the v2/v3 Publication; use the release `PATH` (`release.json`) from
11
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
12
+ */
13
+ export const PATH = '/.well-known/astrale/domain.json';
14
+ /**
15
+ * @deprecated Media type of Publication v3; use the release `MEDIA_TYPE` from
16
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
17
+ */
18
+ export const MEDIA_TYPE = 'application/vnd.astrale.domain-publication+json;v=3';
19
+ /**
20
+ * @deprecated Media type of Publication v2; use the release `MEDIA_TYPE` from
21
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
22
+ */
23
+ export const LEGACY_MEDIA_TYPE = 'application/vnd.astrale.domain-publication+json;v=2';
24
+ /**
25
+ * Select the media type of one v2 or v3 Publication.
26
+ *
27
+ * @deprecated Serves and retains v2/v3 Publications only; use the release `MEDIA_TYPE` from
28
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4), the one media type of a
29
+ * release.
30
+ */
31
+ export function mediaType(input) {
32
+ return input.version === 2 ? LEGACY_MEDIA_TYPE : MEDIA_TYPE;
33
+ }
34
+ /**
35
+ * Resolve the canonical Publication URL beneath one exact HTTP(S) serving issuer.
36
+ *
37
+ * @deprecated Locates the v2/v3 Publication; use the release `url` (`release.json`) from
38
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
39
+ */
40
+ export function url(input) {
41
+ return withPublicationError(() => servedUrl(input, PATH));
42
+ }
43
+ /**
44
+ * @deprecated Seals a v2/v3 Publication; use the release `seal` from
45
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
46
+ */
47
+ export function seal(input) {
48
+ return withPublicationError(() => {
49
+ const canonical = withoutEtag(acceptPublication({ ...input, etag: 'canonicalizing' }, 'seal'));
50
+ return acceptPublication({ ...canonical, etag: computeEtag(canonical) }, 'canonical');
51
+ });
52
+ }
53
+ /**
54
+ * @deprecated Admits a v2/v3 Publication; use the release `accept` from
55
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
56
+ */
57
+ export function accept(input) {
58
+ return withPublicationError(() => {
59
+ const publication = acceptPublication(input, 'wire');
60
+ if (publication.etag !== computeEtag(withoutEtag(publication))) {
61
+ fail('PUBLICATION_ETAG_MISMATCH', 'Publication ETag does not match its canonical content.');
62
+ }
63
+ return publication;
64
+ });
65
+ }
66
+ /**
67
+ * @deprecated Encodes a v2/v3 Publication byte-identically to its accepted wire form; use the
68
+ * release `encode` from `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
69
+ */
70
+ export function encode(input) {
71
+ const wire = input.version === 2
72
+ ? { ...input, requirements: encodeLegacyRequirements(input.requirements) }
73
+ : input;
74
+ return portable.json.encode(wire);
75
+ }
76
+ function acceptPublication(input, mode) {
77
+ const value = record(input, 'PUBLICATION_INVALID', 'Expected a Publication object.');
78
+ exact(value, [
79
+ 'format',
80
+ 'version',
81
+ 'origin',
82
+ 'identity',
83
+ 'etag',
84
+ 'schema',
85
+ 'requirements',
86
+ 'manifest',
87
+ 'bindings',
88
+ 'routes',
89
+ 'delivery',
90
+ ], 'PUBLICATION_INVALID');
91
+ if (value.format !== 'astrale.domain.publication' ||
92
+ (value.version !== 2 && value.version !== 3)) {
93
+ fail('PUBLICATION_INVALID', 'Unsupported Publication format or version.');
94
+ }
95
+ // Version 2 is read-only: retained Publications keep their exact bytes and ETag, but no new one
96
+ // is sealed.
97
+ if (value.version !== 3 && mode === 'seal') {
98
+ fail('PUBLICATION_INVALID', 'Only Publication version 3 can be sealed.');
99
+ }
100
+ const served = admitServedContent(value, {
101
+ views: mode === 'seal' ? 'canonicalize' : 'admit',
102
+ ...(value.version === 2 && mode === 'wire' ? { requirements: decodeLegacyRequirements } : {}),
103
+ });
104
+ const admittedEtag = mode === 'wire' ? admitDigest(value.etag) : value.etag;
105
+ if (typeof admittedEtag !== 'string')
106
+ fail('PUBLICATION_INVALID', 'Publication ETag is missing.');
107
+ return deepFreeze({
108
+ format: 'astrale.domain.publication',
109
+ version: value.version,
110
+ origin: served.origin,
111
+ identity: served.identity,
112
+ etag: admittedEtag,
113
+ schema: served.schema,
114
+ requirements: served.requirements,
115
+ ...(served.manifest === undefined ? {} : { manifest: served.manifest }),
116
+ bindings: served.bindings,
117
+ routes: served.routes,
118
+ ...(served.delivery === undefined ? {} : { delivery: served.delivery }),
119
+ });
120
+ }
121
+ function withoutEtag(input) {
122
+ const { etag: _etag, ...content } = input;
123
+ return content;
124
+ }
@@ -0,0 +1,47 @@
1
+ import type { Revision } from '@astrale-os/kernel-dsl/v1/addressing';
2
+ import { type Key } from '@astrale-os/kernel-dsl/v1/addressing';
3
+ import type { Etag } from './etag.js';
4
+ import type { Publication } from './publication.js';
5
+ /**
6
+ * Compact untrusted projection that witnesses one exact Publication.
7
+ *
8
+ * @deprecated Witnesses a v2/v3 Publication; use `ReleaseRef` from
9
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
10
+ */
11
+ export interface PublicationRef {
12
+ readonly origin: Key.Origin;
13
+ readonly identity: Publication['identity'];
14
+ readonly revision: Revision;
15
+ readonly etag: Etag;
16
+ }
17
+ /**
18
+ * @deprecated Relation between two `PublicationRef`s; use `ReleaseReferenceRelation` from
19
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
20
+ */
21
+ export type PublicationReferenceRelation = 'exact' | 'same-schema' | 'schema-drift' | 'identity-drift' | 'origin-drift';
22
+ /**
23
+ * @deprecated Projects a v2/v3 Publication; use the release `reference` from
24
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
25
+ */
26
+ export declare function reference(input: Publication): PublicationRef;
27
+ /**
28
+ * @deprecated Admits a v2/v3 Publication reference; use the release `acceptReference` from
29
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
30
+ */
31
+ export declare function acceptReference(input: unknown): PublicationRef;
32
+ /**
33
+ * @deprecated Classifies two `PublicationRef`s; use the release `compareReferences` from
34
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
35
+ */
36
+ export declare function compareReferences(input: PublicationRef, expected: PublicationRef): PublicationReferenceRelation;
37
+ /**
38
+ * @deprecated Compares a v2/v3 Publication with a `PublicationRef`; use
39
+ * `compareReferences(reference(release), expected)` from `@astrale-os/kernel-protocol/release`
40
+ * (added with `DomainRelease` v4).
41
+ */
42
+ export declare function compareReference(input: Publication, expected: PublicationRef): PublicationReferenceRelation;
43
+ /**
44
+ * @deprecated Matches a v2/v3 Publication with a `PublicationRef`; use the release
45
+ * `matchesReference` from `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
46
+ */
47
+ export declare function matchesReference(input: Publication, expected: PublicationRef): boolean;
@@ -1,9 +1,13 @@
1
1
  import { AuthValueError } from '@astrale-os/kernel-core/auth/error';
2
2
  import { accept as acceptIssuerId } from '@astrale-os/kernel-core/auth/issuer';
3
3
  import { patterns } from '@astrale-os/kernel-dsl/v1/addressing';
4
- import { deepFreeze, exact, record } from './content.js';
5
- import { fail } from './error.js';
6
- import { admitDigest } from './etag.js';
4
+ import { admitDigest } from '../digest.js';
5
+ import { deepFreeze } from '../shape.js';
6
+ import { exact, fail, record, withPublicationError } from './error.js';
7
+ /**
8
+ * @deprecated Projects a v2/v3 Publication; use the release `reference` from
9
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
10
+ */
7
11
  export function reference(input) {
8
12
  return deepFreeze({
9
13
  origin: input.origin,
@@ -12,7 +16,14 @@ export function reference(input) {
12
16
  etag: input.etag,
13
17
  });
14
18
  }
19
+ /**
20
+ * @deprecated Admits a v2/v3 Publication reference; use the release `acceptReference` from
21
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
22
+ */
15
23
  export function acceptReference(input) {
24
+ return withPublicationError(() => admitReference(input));
25
+ }
26
+ function admitReference(input) {
16
27
  const value = record(input, 'PUBLICATION_INVALID', 'Publication reference is invalid.');
17
28
  exact(value, ['origin', 'identity', 'revision', 'etag'], 'PUBLICATION_INVALID');
18
29
  if (typeof value.origin !== 'string' || !patterns.origin.test(value.origin)) {
@@ -35,6 +46,10 @@ export function acceptReference(input) {
35
46
  etag: admitDigest(value.etag),
36
47
  });
37
48
  }
49
+ /**
50
+ * @deprecated Classifies two `PublicationRef`s; use the release `compareReferences` from
51
+ * `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
52
+ */
38
53
  export function compareReferences(input, expected) {
39
54
  if (input.origin !== expected.origin)
40
55
  return 'origin-drift';
@@ -46,9 +61,18 @@ export function compareReferences(input, expected) {
46
61
  return 'schema-drift';
47
62
  return input.etag === expected.etag ? 'exact' : 'same-schema';
48
63
  }
64
+ /**
65
+ * @deprecated Compares a v2/v3 Publication with a `PublicationRef`; use
66
+ * `compareReferences(reference(release), expected)` from `@astrale-os/kernel-protocol/release`
67
+ * (added with `DomainRelease` v4).
68
+ */
49
69
  export function compareReference(input, expected) {
50
70
  return compareReferences(reference(input), expected);
51
71
  }
72
+ /**
73
+ * @deprecated Matches a v2/v3 Publication with a `PublicationRef`; use the release
74
+ * `matchesReference` from `@astrale-os/kernel-protocol/release` (added with `DomainRelease` v4).
75
+ */
52
76
  export function matchesReference(input, expected) {
53
77
  return compareReference(input, expected) === 'exact';
54
78
  }
@@ -0,0 +1,30 @@
1
+ import type { schema } from '@astrale-os/kernel-dsl/v1';
2
+ import * as requirements from '../requirements.js';
3
+ /** @deprecated Use `NonEmpty` from `@astrale-os/kernel-protocol/release`. */
4
+ export type NonEmpty<Value> = requirements.NonEmpty<Value>;
5
+ /** @deprecated Use `ClassOperation` from `@astrale-os/kernel-protocol/release`. */
6
+ export type ClassOperation = requirements.ClassOperation;
7
+ /** @deprecated Use `ClassCapabilityRequirement` from `@astrale-os/kernel-protocol/release`. */
8
+ export type ClassCapabilityRequirement = requirements.ClassCapabilityRequirement;
9
+ /** @deprecated Use `CapabilityAuthorityRequirements` from `@astrale-os/kernel-protocol/release`. */
10
+ export type CapabilityAuthorityRequirements = requirements.CapabilityAuthorityRequirements;
11
+ /** @deprecated Use `CapabilityRequirements` from `@astrale-os/kernel-protocol/release`. */
12
+ export type CapabilityRequirements = requirements.CapabilityRequirements;
13
+ /** @deprecated Use `CoreCapabilityRequirement` from `@astrale-os/kernel-protocol/release`. */
14
+ export type CoreCapabilityRequirement = requirements.CoreCapabilityRequirement;
15
+ /** @deprecated Use `Requirements` from `@astrale-os/kernel-protocol/release`. */
16
+ export type PublicationRequirements = requirements.Requirements;
17
+ /**
18
+ * Admit the exact closed canonical requirements object used by Publication v3.
19
+ *
20
+ * @deprecated Use `admitRequirements` from `@astrale-os/kernel-protocol/release`, which reports
21
+ * `ReleaseError`.
22
+ */
23
+ export declare function admitRequirements(input: unknown): PublicationRequirements;
24
+ /**
25
+ * Bind explicit capability targets to exact functional dependencies in the bundle closure.
26
+ *
27
+ * @deprecated Use `validateRequirements` from `@astrale-os/kernel-protocol/release`, which reports
28
+ * `ReleaseError`.
29
+ */
30
+ export declare function validateRequirements(root: schema.DomainSchema, closure: readonly schema.DomainSchema[], input: PublicationRequirements): void;
@@ -0,0 +1,20 @@
1
+ import * as requirements from '../requirements.js';
2
+ import { withPublicationError } from './error.js';
3
+ /**
4
+ * Admit the exact closed canonical requirements object used by Publication v3.
5
+ *
6
+ * @deprecated Use `admitRequirements` from `@astrale-os/kernel-protocol/release`, which reports
7
+ * `ReleaseError`.
8
+ */
9
+ export function admitRequirements(input) {
10
+ return withPublicationError(() => requirements.admitRequirements(input));
11
+ }
12
+ /**
13
+ * Bind explicit capability targets to exact functional dependencies in the bundle closure.
14
+ *
15
+ * @deprecated Use `validateRequirements` from `@astrale-os/kernel-protocol/release`, which reports
16
+ * `ReleaseError`.
17
+ */
18
+ export function validateRequirements(root, closure, input) {
19
+ withPublicationError(() => requirements.validateRequirements(root, closure, input));
20
+ }
@@ -1,13 +1,13 @@
1
1
  import { acceptDefinitionRef } from '@astrale-os/kernel-dsl/v1/addressing';
2
- import { exact, record } from './content.js';
3
2
  import { fail } from './error.js';
3
+ import { exact, record } from './shape.js';
4
4
  export function admitManifest(input) {
5
5
  if (input === undefined)
6
6
  return undefined;
7
- const value = record(input, 'PUBLICATION_INVALID', 'Manifest is invalid.');
8
- exact(value, ['logo', 'entrypoint'], 'PUBLICATION_INVALID');
7
+ const value = record(input, 'RELEASE_INVALID', 'Manifest is invalid.');
8
+ exact(value, ['logo', 'entrypoint'], 'RELEASE_INVALID');
9
9
  if (value.logo !== undefined && typeof value.logo !== 'string') {
10
- fail('PUBLICATION_INVALID', 'Manifest logo must be a string.');
10
+ fail('RELEASE_INVALID', 'Manifest logo must be a string.');
11
11
  }
12
12
  let entrypoint;
13
13
  if (value.entrypoint !== undefined) {
@@ -16,10 +16,10 @@ export function admitManifest(input) {
16
16
  ref = acceptDefinitionRef(value.entrypoint);
17
17
  }
18
18
  catch (cause) {
19
- return fail('PUBLICATION_INVALID', 'Manifest entrypoint must be a root View reference.', cause);
19
+ return fail('RELEASE_INVALID', 'Manifest entrypoint must be a root View reference.', cause);
20
20
  }
21
21
  if (ref.kind !== 'view') {
22
- fail('PUBLICATION_INVALID', 'Manifest entrypoint must be a root View reference.');
22
+ fail('RELEASE_INVALID', 'Manifest entrypoint must be a root View reference.');
23
23
  }
24
24
  entrypoint = ref;
25
25
  }
@@ -0,0 +1,26 @@
1
+ import type { Revision } from '@astrale-os/kernel-dsl/v1/addressing';
2
+ import { type Key } from '@astrale-os/kernel-dsl/v1/addressing';
3
+ import type { ReleaseDigest } from './digest.js';
4
+ import type { DomainRelease } from './release.js';
5
+ /** Compact untrusted projection that witnesses one exact `DomainRelease`. */
6
+ export interface ReleaseRef {
7
+ readonly origin: Key.Origin;
8
+ readonly identity: DomainRelease['identity'];
9
+ readonly revision: Revision;
10
+ readonly digest: ReleaseDigest;
11
+ }
12
+ /**
13
+ * Relation between two `ReleaseRef`s. A release digest commits to identity, schema and build, so
14
+ * within one origin anything but the exact reference designates another release.
15
+ */
16
+ export type ReleaseReferenceRelation = 'exact' | 'release-drift' | 'origin-drift';
17
+ export declare function reference(input: DomainRelease): ReleaseRef;
18
+ export declare function acceptReference(input: unknown): ReleaseRef;
19
+ /**
20
+ * Classify a received reference against the expected one. A different origin is origin drift.
21
+ * Within one origin the reference is exact only when every coordinate equals the expected one: for
22
+ * references of admitted releases that is digest equality, and a received reference that names
23
+ * the expected digest beside any other coordinate witnesses no release, so it is release drift.
24
+ */
25
+ export declare function compareReferences(input: ReleaseRef, expected: ReleaseRef): ReleaseReferenceRelation;
26
+ export declare function matchesReference(input: DomainRelease, expected: ReleaseRef): boolean;
@@ -0,0 +1,70 @@
1
+ import { AuthValueError } from '@astrale-os/kernel-core/auth/error';
2
+ import { accept as acceptIssuerId } from '@astrale-os/kernel-core/auth/issuer';
3
+ import { patterns } from '@astrale-os/kernel-dsl/v1/addressing';
4
+ import { admitDigest } from './digest.js';
5
+ import { fail } from './error.js';
6
+ import { deepFreeze, exact, record } from './shape.js';
7
+ export function reference(input) {
8
+ return deepFreeze({
9
+ origin: input.origin,
10
+ identity: { ...input.identity },
11
+ revision: input.schema.revision,
12
+ digest: input.digest,
13
+ });
14
+ }
15
+ export function acceptReference(input) {
16
+ const value = record(input, 'RELEASE_INVALID', 'Release reference is invalid.');
17
+ exact(value, ['origin', 'identity', 'revision', 'digest'], 'RELEASE_INVALID');
18
+ if (typeof value.origin !== 'string' || !patterns.origin.test(value.origin)) {
19
+ fail('RELEASE_INVALID', 'Release reference origin is invalid.');
20
+ }
21
+ const origin = value.origin;
22
+ const identity = record(value.identity, 'RELEASE_INVALID', 'Release reference identity is invalid.');
23
+ exact(identity, ['issuer', 'subject'], 'RELEASE_INVALID');
24
+ const issuer = acceptIssuer(identity.issuer);
25
+ if (identity.subject !== origin) {
26
+ fail('RELEASE_INVALID', 'Release reference subject must equal its root origin.');
27
+ }
28
+ if (typeof value.revision !== 'string' || !patterns.revision.test(value.revision)) {
29
+ fail('RELEASE_INVALID', 'Release reference revision is invalid.');
30
+ }
31
+ return deepFreeze({
32
+ origin,
33
+ identity: { issuer, subject: origin },
34
+ revision: value.revision,
35
+ digest: admitDigest(value.digest),
36
+ });
37
+ }
38
+ /**
39
+ * Classify a received reference against the expected one. A different origin is origin drift.
40
+ * Within one origin the reference is exact only when every coordinate equals the expected one: for
41
+ * references of admitted releases that is digest equality, and a received reference that names
42
+ * the expected digest beside any other coordinate witnesses no release, so it is release drift.
43
+ */
44
+ export function compareReferences(input, expected) {
45
+ if (input.origin !== expected.origin)
46
+ return 'origin-drift';
47
+ return input.digest === expected.digest &&
48
+ input.revision === expected.revision &&
49
+ input.identity.issuer === expected.identity.issuer &&
50
+ input.identity.subject === expected.identity.subject
51
+ ? 'exact'
52
+ : 'release-drift';
53
+ }
54
+ export function matchesReference(input, expected) {
55
+ return compareReferences(reference(input), expected) === 'exact';
56
+ }
57
+ function acceptIssuer(input) {
58
+ if (typeof input !== 'string') {
59
+ fail('RELEASE_INVALID', 'Release reference issuer is invalid.');
60
+ }
61
+ try {
62
+ return acceptIssuerId(input);
63
+ }
64
+ catch (cause) {
65
+ if (cause instanceof AuthValueError) {
66
+ return fail('RELEASE_INVALID', 'Release reference issuer is invalid.', cause);
67
+ }
68
+ throw cause;
69
+ }
70
+ }
@@ -0,0 +1,60 @@
1
+ import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
2
+ import type { Key } from '@astrale-os/kernel-dsl/v1/addressing';
3
+ import type { CallableBinding, ViewBinding } from './bindings/index.js';
4
+ import type { Build } from './build.js';
5
+ import type { Endpoint as DeliveryEndpoint } from './delivery-endpoint.js';
6
+ import type { ReleaseDigest } from './digest.js';
7
+ import type { Manifest } from './manifest.js';
8
+ import type { Requirements } from './requirements.js';
9
+ import type { HttpRoute } from './route.js';
10
+ import type { Schema } from './schema.js';
11
+ /** Path of the release a deployment serves beneath its serving issuer. */
12
+ export declare const PATH: '/.well-known/astrale/release.json';
13
+ /** Media type of `DomainRelease` v4. */
14
+ export declare const MEDIA_TYPE: 'application/vnd.astrale.domain-release+json;v=4';
15
+ /** Resolve the canonical release URL beneath one exact HTTP(S) serving issuer, keeping its path. */
16
+ export declare function url(issuer: string): string;
17
+ /**
18
+ * Immutable deployment document pinned by the Kernel. Its digest covers the schema, serving
19
+ * identity and code through the build digest; `version` identifies the document format.
20
+ */
21
+ export interface DomainRelease {
22
+ readonly format: 'astrale.domain.release';
23
+ readonly version: 4;
24
+ readonly origin: Key.Origin;
25
+ readonly identity: {
26
+ readonly issuer: IssuerId;
27
+ /** Always the root origin. */
28
+ readonly subject: string;
29
+ };
30
+ readonly digest: ReleaseDigest;
31
+ readonly build: Build;
32
+ readonly schema: Schema;
33
+ readonly requirements: Requirements;
34
+ readonly manifest?: Manifest;
35
+ readonly bindings: {
36
+ readonly callables: readonly CallableBinding[];
37
+ readonly views: readonly ViewBinding[];
38
+ };
39
+ readonly routes: readonly HttpRoute[];
40
+ readonly delivery?: DeliveryEndpoint;
41
+ }
42
+ /** Content of a release before its digest is computed. */
43
+ export type Content = Omit<DomainRelease, 'digest'>;
44
+ /**
45
+ * Release digest of canonical release content: SHA-256 of its canonical JSON. The content must be
46
+ * exactly what `seal` produces, a sealed release without its digest; content that `seal` would
47
+ * canonicalize or refuse throws `ReleaseError` instead of yielding a digest no decoder accepts.
48
+ * Authored content gets its digest from `seal(content).digest`.
49
+ */
50
+ export declare function digestOf(input: Content): ReleaseDigest;
51
+ /** Validate release content, canonicalize its View bindings, and set its release digest. */
52
+ export declare function seal(input: Content): DomainRelease;
53
+ /**
54
+ * Admit one wire release: exact fields at every level, every value in the canonical form `seal`
55
+ * produces, and a digest matching its content. One release therefore has exactly one wire
56
+ * document: `encode(accept(input))` is the canonical JSON of `input`.
57
+ */
58
+ export declare function accept(input: unknown): DomainRelease;
59
+ /** Encode one release as its canonical JSON bytes. */
60
+ export declare function encode(input: DomainRelease): Uint8Array;