@astrale-os/sdk 0.6.0-beta.12 → 0.6.0-beta.14

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 (144) hide show
  1. package/README.md +7 -2
  2. package/dist/application/action/context.d.ts +5 -6
  3. package/dist/application/dependency/invoker.d.ts +2 -2
  4. package/dist/deployment/adapter/adapter.d.ts +1 -6
  5. package/dist/deployment/adapter/legacy/adapter.d.ts +0 -10
  6. package/dist/deployment/adapter/legacy/deploy/context.d.ts +0 -2
  7. package/dist/deployment/adapter/legacy/deploy/result.d.ts +2 -3
  8. package/dist/deployment/adapter/legacy/index.d.ts +10 -8
  9. package/dist/deployment/adapter/legacy/prepare/context.d.ts +0 -2
  10. package/dist/deployment/adapter/release/context.d.ts +16 -2
  11. package/dist/deployment/address/index.d.ts +1 -1
  12. package/dist/deployment/address/index.js +1 -0
  13. package/dist/deployment/address/summary.d.ts +30 -0
  14. package/dist/deployment/address/summary.js +117 -1
  15. package/dist/deployment/build/index.d.ts +1 -1
  16. package/dist/deployment/build/index.js +1 -1
  17. package/dist/deployment/build/manifest.d.ts +5 -0
  18. package/dist/deployment/build/manifest.js +10 -0
  19. package/dist/deployment/index.d.ts +1 -1
  20. package/dist/deployment/release/legacy/index.d.ts +15 -10
  21. package/dist/deployment/release/legacy/index.js +15 -10
  22. package/dist/deployment/verify/readiness/deployment.js +3 -13
  23. package/dist/deployment/verify/readiness/fetch.d.ts +13 -0
  24. package/dist/deployment/verify/readiness/fetch.js +26 -0
  25. package/dist/deployment/verify/readiness/identity.d.ts +3 -6
  26. package/dist/deployment/verify/readiness/identity.js +3 -3
  27. package/dist/deployment/verify/readiness/index.d.ts +12 -8
  28. package/dist/deployment/verify/readiness/index.js +15 -4
  29. package/dist/deployment/verify/readiness/legacy/index.d.ts +2 -0
  30. package/dist/deployment/verify/readiness/legacy/index.js +2 -0
  31. package/dist/deployment/verify/readiness/legacy/publication.d.ts +12 -0
  32. package/dist/deployment/verify/readiness/legacy/publication.js +23 -0
  33. package/dist/deployment/verify/readiness/release.d.ts +8 -0
  34. package/dist/deployment/verify/readiness/release.js +22 -0
  35. package/dist/execution/identity/authentication.d.ts +10 -2
  36. package/dist/execution/identity/authentication.js +21 -7
  37. package/dist/execution/identity/callback.d.ts +2 -12
  38. package/dist/execution/identity/callback.js +3 -9
  39. package/dist/execution/identity/delivery.d.ts +11 -4
  40. package/dist/execution/identity/delivery.js +47 -20
  41. package/dist/execution/identity/identity.d.ts +7 -3
  42. package/dist/execution/identity/identity.js +2 -2
  43. package/dist/execution/invocation/admission/authentication.d.ts +3 -8
  44. package/dist/execution/invocation/admission/authentication.js +10 -24
  45. package/dist/execution/invocation/admission/authority.d.ts +12 -6
  46. package/dist/execution/invocation/admission/authority.js +5 -1
  47. package/dist/execution/invocation/dependency/bind.d.ts +1 -1
  48. package/dist/execution/invocation/dependency/bind.js +0 -1
  49. package/dist/execution/invocation/dispatch/context.js +0 -1
  50. package/dist/execution/invocation/invocation.js +51 -14
  51. package/dist/execution/runtime/index.d.ts +1 -0
  52. package/dist/execution/runtime/index.js +1 -0
  53. package/dist/execution/runtime/load.d.ts +3 -3
  54. package/dist/execution/runtime/load.js +3 -2
  55. package/dist/execution/runtime/release.d.ts +22 -0
  56. package/dist/execution/runtime/release.js +14 -0
  57. package/dist/execution/serve.d.ts +2 -2
  58. package/dist/execution/service/create.js +9 -7
  59. package/dist/execution/service/release.d.ts +2 -2
  60. package/dist/execution/service/release.js +3 -2
  61. package/dist/execution/service/service.d.ts +9 -5
  62. package/dist/execution/service/serving/delivery.d.ts +6 -0
  63. package/dist/execution/service/{publication → serving}/delivery.js +5 -1
  64. package/dist/execution/service/{publication → serving}/index.d.ts +1 -1
  65. package/dist/execution/service/serving/installation.d.ts +4 -0
  66. package/dist/execution/service/serving/installation.js +9 -0
  67. package/dist/execution/service/serving/legacy/index.d.ts +15 -0
  68. package/dist/execution/service/serving/legacy/index.js +19 -0
  69. package/dist/execution/service/serving/source.d.ts +18 -0
  70. package/dist/execution/service/serving/source.js +19 -0
  71. package/dist/project/define.js +57 -28
  72. package/dist/project/install-command.d.ts +10 -0
  73. package/dist/project/install-command.js +13 -0
  74. package/dist/project/project.d.ts +4 -2
  75. package/dist/tooling/cli/arguments.d.ts +0 -2
  76. package/dist/tooling/cli/arguments.js +22 -15
  77. package/dist/tooling/cli/commit.d.ts +23 -0
  78. package/dist/tooling/cli/commit.js +216 -0
  79. package/dist/tooling/cli/deploy-mode.d.ts +19 -12
  80. package/dist/tooling/cli/deploy-mode.js +14 -32
  81. package/dist/tooling/cli/deploy-result.d.ts +10 -7
  82. package/dist/tooling/cli/deploy-result.js +4 -3
  83. package/dist/tooling/cli/development/candidate.d.ts +2 -3
  84. package/dist/tooling/cli/development/candidate.js +2 -9
  85. package/dist/tooling/cli/development/deployment.d.ts +2 -8
  86. package/dist/tooling/cli/development/deployment.js +2 -21
  87. package/dist/tooling/cli/development/develop.d.ts +4 -3
  88. package/dist/tooling/cli/development/develop.js +8 -112
  89. package/dist/tooling/cli/development/report.d.ts +1 -3
  90. package/dist/tooling/cli/development/report.js +1 -4
  91. package/dist/tooling/cli/help.js +28 -26
  92. package/dist/tooling/cli/immutable-deployment.d.ts +27 -0
  93. package/dist/tooling/cli/immutable-deployment.js +95 -0
  94. package/dist/tooling/cli/index.d.ts +2 -4
  95. package/dist/tooling/cli/index.js +2 -3
  96. package/dist/tooling/cli/legacy/deploy-result.d.ts +5 -3
  97. package/dist/tooling/cli/legacy/deploy-result.js +5 -3
  98. package/dist/tooling/cli/legacy/stable-target-adapter.d.ts +5 -3
  99. package/dist/tooling/cli/legacy/stable-target-deploy.d.ts +42 -0
  100. package/dist/tooling/cli/legacy/stable-target-deploy.js +104 -0
  101. package/dist/tooling/cli/orchestrate.js +46 -97
  102. package/dist/tooling/cli/secrets.d.ts +9 -0
  103. package/dist/tooling/cli/secrets.js +19 -0
  104. package/dist/tooling/linter/implementations/source/dependencies.js +8 -6
  105. package/dist/tooling/linter/policy/generated.js +2 -2
  106. package/package.json +1 -1
  107. package/dist/deployment/verify/readiness/publication.d.ts +0 -11
  108. package/dist/deployment/verify/readiness/publication.js +0 -41
  109. package/dist/execution/service/publication/delivery.d.ts +0 -2
  110. package/dist/execution/service/publication/installation.d.ts +0 -3
  111. package/dist/execution/service/publication/installation.js +0 -8
  112. package/dist/execution/service/publication/source.d.ts +0 -3
  113. package/dist/execution/service/publication/source.js +0 -11
  114. package/dist/tooling/cli/astrale/authority.d.ts +0 -5
  115. package/dist/tooling/cli/astrale/authority.js +0 -11
  116. package/dist/tooling/cli/astrale/executable.d.ts +0 -2
  117. package/dist/tooling/cli/astrale/executable.js +0 -47
  118. package/dist/tooling/cli/astrale/failure.d.ts +0 -6
  119. package/dist/tooling/cli/astrale/failure.js +0 -48
  120. package/dist/tooling/cli/astrale/instance.d.ts +0 -11
  121. package/dist/tooling/cli/astrale/instance.js +0 -52
  122. package/dist/tooling/cli/astrale/process.d.ts +0 -13
  123. package/dist/tooling/cli/astrale/process.js +0 -94
  124. package/dist/tooling/cli/astrale/version.d.ts +0 -18
  125. package/dist/tooling/cli/astrale/version.js +0 -55
  126. package/dist/tooling/cli/development/release-evidence.d.ts +0 -4
  127. package/dist/tooling/cli/development/release-evidence.js +0 -10
  128. package/dist/tooling/cli/development/session-file.d.ts +0 -53
  129. package/dist/tooling/cli/development/session-file.js +0 -337
  130. package/dist/tooling/cli/development/target-lock.d.ts +0 -16
  131. package/dist/tooling/cli/development/target-lock.js +0 -68
  132. package/dist/tooling/cli/development/view.d.ts +0 -28
  133. package/dist/tooling/cli/development/view.js +0 -151
  134. package/dist/tooling/cli/environment-release.d.ts +0 -24
  135. package/dist/tooling/cli/environment-release.js +0 -46
  136. package/dist/tooling/cli/evidence.d.ts +0 -14
  137. package/dist/tooling/cli/evidence.js +0 -53
  138. package/dist/tooling/cli/installation/index.d.ts +0 -2
  139. package/dist/tooling/cli/installation/index.js +0 -1
  140. package/dist/tooling/cli/installation/observation.d.ts +0 -10
  141. package/dist/tooling/cli/installation/observation.js +0 -44
  142. package/dist/tooling/cli/installation/reconcile.d.ts +0 -32
  143. package/dist/tooling/cli/installation/reconcile.js +0 -122
  144. /package/dist/execution/service/{publication → serving}/index.js +0 -0
@@ -1,10 +1,10 @@
1
1
  import { issuer } from '@astrale-os/kernel-protocol';
2
2
  const MAXIMUM_IDENTITY_BYTES = 256 * 1024;
3
3
  /** Verify issuer discovery and at least one admitted signing key at the serving identity. */
4
- export async function verifyIdentity(addressing, options = {}) {
4
+ export async function verifyIdentity(serving, options = {}) {
5
5
  const fetcher = options.fetch ?? globalThis.fetch;
6
- const configurationUrl = new URL(issuer.paths(addressing.issuer).configuration, addressing.issuer);
7
- const configuration = issuer.acceptConfiguration(await json(fetcher, configurationUrl.href, options.signal), addressing.issuer);
6
+ const configurationUrl = new URL(issuer.paths(serving).configuration, serving);
7
+ const configuration = issuer.acceptConfiguration(await json(fetcher, configurationUrl.href, options.signal), serving);
8
8
  const keys = issuer.acceptKeySet(await json(fetcher, configuration.jwks_uri, options.signal), configuration.id_token_signing_alg_values_supported);
9
9
  if (keys.keys.length === 0)
10
10
  throw new Error('Serving issuer publishes no signing keys.');
@@ -1,10 +1,14 @@
1
- import type { Release } from '../../release/legacy/index.js';
2
- import type { ReadinessFetch } from './publication.js';
1
+ import type { Release } from '../../release/index.js';
2
+ import type * as legacy from '../../release/legacy/index.js';
3
+ import type { ReadinessOptions } from './fetch.js';
3
4
  export { verifyDeployment } from './deployment.js';
4
5
  export { verifyIdentity } from './identity.js';
5
- export { verifyPublication, type ReadinessFetch } from './publication.js';
6
- /** Read-only verification of one exact live Release and serving identity. */
7
- export declare function readiness(release: Release, options?: {
8
- readonly fetch?: ReadinessFetch;
9
- readonly signal?: AbortSignal;
10
- }): Promise<void>;
6
+ export type { ReadinessFetch, ReadinessOptions } from './fetch.js';
7
+ export { verifyPublication } from './legacy/index.js';
8
+ export { verifyRelease } from './release.js';
9
+ /**
10
+ * Read-only verification of one exact live Release and its serving identity: an immutable
11
+ * deployment's `release.json` (release digest and build digest), or a stable target's
12
+ * `domain.json` (deprecated, `legacy/`).
13
+ */
14
+ export declare function readiness(release: Release | legacy.Release, options?: ReadinessOptions): Promise<void>;
@@ -1,10 +1,21 @@
1
1
  import { verifyIdentity } from './identity.js';
2
- import { verifyPublication } from './publication.js';
2
+ import { verifyPublication } from './legacy/index.js';
3
+ import { verifyRelease } from './release.js';
3
4
  export { verifyDeployment } from './deployment.js';
4
5
  export { verifyIdentity } from './identity.js';
5
- export { verifyPublication } from './publication.js';
6
- /** Read-only verification of one exact live Release and serving identity. */
6
+ export { verifyPublication } from './legacy/index.js';
7
+ export { verifyRelease } from './release.js';
8
+ /**
9
+ * Read-only verification of one exact live Release and its serving identity: an immutable
10
+ * deployment's `release.json` (release digest and build digest), or a stable target's
11
+ * `domain.json` (deprecated, `legacy/`).
12
+ */
7
13
  export async function readiness(release, options = {}) {
14
+ if (release.kind === 'release') {
15
+ await verifyRelease(release, options);
16
+ await verifyIdentity(release.url, options);
17
+ return;
18
+ }
8
19
  await verifyPublication(release, options);
9
- await verifyIdentity(release.addressing, options);
20
+ await verifyIdentity(release.addressing.issuer, options);
10
21
  }
@@ -0,0 +1,2 @@
1
+ /** @deprecated Stable-target readiness at `domain.json`; see `publication.ts` (removal D10). */
2
+ export { verifyPublication } from './publication.js';
@@ -0,0 +1,2 @@
1
+ /** @deprecated Stable-target readiness at `domain.json`; see `publication.ts` (removal D10). */
2
+ export { verifyPublication } from './publication.js';
@@ -0,0 +1,12 @@
1
+ import * as publication from '@astrale-os/kernel-protocol/release/legacy';
2
+ import type * as legacy from '../../../release/legacy/index.js';
3
+ import type { ReadinessOptions } from '../fetch.js';
4
+ /**
5
+ * Fetch and verify the exact live Publication and Bundle a stable target serves at `domain.json`.
6
+ *
7
+ * @deprecated Replacement: `verifyRelease`, the readiness of an immutable deployment at
8
+ * `release.json` (release digest and build digest). Consumer: the direct-mode deploy path of
9
+ * adapter-cloudflare and adapter-astrale (the consumers of `deployment/release/legacy/index.ts`).
10
+ * Removal: D10, with that path.
11
+ */
12
+ export declare function verifyPublication(release: legacy.Release, options?: ReadinessOptions): Promise<publication.Publication>;
@@ -0,0 +1,23 @@
1
+ import * as publication from '@astrale-os/kernel-protocol/release/legacy';
2
+ import { bounded, fetchRequired, MAXIMUM_BUNDLE_BYTES, MAXIMUM_DOCUMENT_BYTES, text, } from '../fetch.js';
3
+ /**
4
+ * Fetch and verify the exact live Publication and Bundle a stable target serves at `domain.json`.
5
+ *
6
+ * @deprecated Replacement: `verifyRelease`, the readiness of an immutable deployment at
7
+ * `release.json` (release digest and build digest). Consumer: the direct-mode deploy path of
8
+ * adapter-cloudflare and adapter-astrale (the consumers of `deployment/release/legacy/index.ts`).
9
+ * Removal: D10, with that path.
10
+ */
11
+ export async function verifyPublication(release, options = {}) {
12
+ const fetcher = options.fetch ?? globalThis.fetch;
13
+ const publicationUrl = publication.url(release.addressing.publicUrl);
14
+ const response = await fetchRequired(fetcher, publicationUrl, options.signal);
15
+ const deployed = publication.accept(JSON.parse(await text(response, publicationUrl, MAXIMUM_DOCUMENT_BYTES)));
16
+ if (!publication.matchesReference(deployed, publication.reference(release.publication))) {
17
+ throw new Error('Live Publication differs from the expected Release.');
18
+ }
19
+ const bundleResponse = await fetchRequired(fetcher, deployed.schema.bundle.href, options.signal);
20
+ const bytes = new Uint8Array(await bounded(bundleResponse, deployed.schema.bundle.href, MAXIMUM_BUNDLE_BYTES));
21
+ publication.decodeBundle(deployed, bytes);
22
+ return deployed;
23
+ }
@@ -0,0 +1,8 @@
1
+ import * as release from '@astrale-os/kernel-protocol/release';
2
+ import type { Release } from '../../release/index.js';
3
+ import type { ReadinessOptions } from './fetch.js';
4
+ /**
5
+ * Fetch and verify the exact live release of one immutable deployment at its `release.json`: its
6
+ * release digest and the build digest of its code, then its Bundle.
7
+ */
8
+ export declare function verifyRelease(expected: Release, options?: ReadinessOptions): Promise<release.DomainRelease>;
@@ -0,0 +1,22 @@
1
+ import * as release from '@astrale-os/kernel-protocol/release';
2
+ import { bounded, fetchRequired, MAXIMUM_BUNDLE_BYTES, MAXIMUM_DOCUMENT_BYTES, text, } from './fetch.js';
3
+ /**
4
+ * Fetch and verify the exact live release of one immutable deployment at its `release.json`: its
5
+ * release digest and the build digest of its code, then its Bundle.
6
+ */
7
+ export async function verifyRelease(expected, options = {}) {
8
+ const fetcher = options.fetch ?? globalThis.fetch;
9
+ const releaseUrl = release.url(expected.url);
10
+ const response = await fetchRequired(fetcher, releaseUrl, options.signal);
11
+ const deployed = release.accept(JSON.parse(await text(response, releaseUrl, MAXIMUM_DOCUMENT_BYTES)));
12
+ if (!release.matchesReference(deployed, release.reference(expected.document))) {
13
+ throw new Error('Live release differs from the expected Release.');
14
+ }
15
+ if (deployed.build.digest !== expected.buildDigest) {
16
+ throw new Error('Live release build digest differs from the expected build.');
17
+ }
18
+ const bundleResponse = await fetchRequired(fetcher, deployed.schema.bundle.href, options.signal);
19
+ const bytes = new Uint8Array(await bounded(bundleResponse, deployed.schema.bundle.href, MAXIMUM_BUNDLE_BYTES));
20
+ release.decodeBundle(deployed, bytes);
21
+ return deployed;
22
+ }
@@ -1,10 +1,17 @@
1
1
  import type { Fetch } from '@astrale-os/kernel-client';
2
- import type { CredentialInput, Grant, IssuerId } from '../../platform/auth/index.js';
2
+ import type { CredentialInput, IdentityId, IssuerId } from '../../platform/auth/index.js';
3
3
  import type { AuthenticatedInvocation } from '../invocation/index.js';
4
4
  import type { InvocationAdmissionInput } from '../invocation/index.js';
5
5
  import type { IdentityNetworkPolicy, VerificationBasis, VerificationBasisResolver } from './jwks.js';
6
6
  import type { SigningMaterial } from './signing.js';
7
7
  import { ClientSession } from '../../platform/client/session/index.js';
8
+ /**
9
+ * How long a callback Session reuses a learned route. It stays at most the Kernel's in-flight
10
+ * issuer window (`KERNEL_INFLIGHT_ISSUER_MS`, Host default 300 s; CT11): a route learned to a
11
+ * deployment replaced by a consented install ages out while that deployment is still accepted and
12
+ * answers the reserved miss, never after its own credential is refused (AM-85).
13
+ */
14
+ export declare const DEFAULT_ROUTE_AGE_MS = 60000;
8
15
  export declare function admit(request: InvocationAdmissionInput, configuration: AuthenticationConfiguration): Promise<unknown>;
9
16
  export interface AuthenticationConfiguration {
10
17
  readonly issuer: IssuerId;
@@ -26,5 +33,6 @@ export declare function executorSession(kernel: IssuerId, execution: {
26
33
  readonly deadline: number;
27
34
  readonly signal: AbortSignal;
28
35
  }, configuration: AuthenticationConfiguration): ClientSession;
29
- export declare function acceptResolvedDelegation(input: unknown): Grant;
36
+ /** Accept a Kernel delegation proof claim naming exactly one resolved caller Identity. */
37
+ export declare function acceptResolvedDelegation(input: unknown): IdentityId;
30
38
  export type { VerificationBasis };
@@ -10,7 +10,13 @@ import { projectError, protocolError } from '../invocation/result/index.js';
10
10
  import { callbackIdentities, createCallbackCredentialResolver, maximumCallbackDelegationTtlSeconds, selfIdentity, signDomainCallback, } from './callback.js';
11
11
  import { CredentialRejected, IssuerUnavailable, boundedFetch, callbackTtl, httpIssuer, invocationUrl, admitEndpoint, requireLive, } from './errors.js';
12
12
  import { verifyCredential, verifyCredentialAgainst } from './jwks.js';
13
- const DEFAULT_ROUTE_AGE_MS = 60_000;
13
+ /**
14
+ * How long a callback Session reuses a learned route. It stays at most the Kernel's in-flight
15
+ * issuer window (`KERNEL_INFLIGHT_ISSUER_MS`, Host default 300 s; CT11): a route learned to a
16
+ * deployment replaced by a consented install ages out while that deployment is still accepted and
17
+ * answers the reserved miss, never after its own credential is refused (AM-85).
18
+ */
19
+ export const DEFAULT_ROUTE_AGE_MS = 60_000;
14
20
  export async function admit(request, configuration) {
15
21
  const execution = request.context.execution;
16
22
  requireLive(execution);
@@ -54,12 +60,10 @@ export async function authenticate(credentialInput, expectedKernel, execution, c
54
60
  const sessions = Object.freeze({
55
61
  caller: session(expressions.caller),
56
62
  self: session(expressions.self),
57
- union: session(expressions.union),
58
63
  });
59
64
  const graph = Object.freeze({
60
65
  caller: bindSession(sessions.caller, execution),
61
66
  self: bindSession(sessions.self, execution),
62
- union: bindSession(sessions.union, execution),
63
67
  });
64
68
  let closed = false;
65
69
  return Object.freeze({
@@ -71,7 +75,6 @@ export async function authenticate(credentialInput, expectedKernel, execution, c
71
75
  closed = true;
72
76
  sessions.caller.close();
73
77
  sessions.self.close();
74
- sessions.union.close();
75
78
  },
76
79
  });
77
80
  }
@@ -122,7 +125,7 @@ async function establishCaller(input, audience, verification, execution, policy)
122
125
  if (proof.verified.sub !== context.verified.sub) {
123
126
  throw new CredentialRejected('Destination carrier and authority proof subjects differ.');
124
127
  }
125
- const authority = acceptResolvedDelegation(proof.verified.claims.delegation);
128
+ const identity = acceptResolvedDelegation(proof.verified.claims.delegation);
126
129
  let principal;
127
130
  try {
128
131
  principal = NodeId(context.verified.sub);
@@ -136,7 +139,7 @@ async function establishCaller(input, audience, verification, execution, policy)
136
139
  caller: Object.freeze({
137
140
  kind: 'authenticated',
138
141
  principal,
139
- authority,
142
+ identity,
140
143
  authentication: credential.evidence(context),
141
144
  }),
142
145
  });
@@ -147,6 +150,7 @@ async function establishCaller(input, audience, verification, execution, policy)
147
150
  throw protocolError('BACKEND_UNAVAILABLE', 'Credential issuer is unavailable.');
148
151
  }
149
152
  if (cause instanceof CredentialRejected ||
153
+ cause instanceof AuthValueError ||
150
154
  cause instanceof joseErrors.JOSEError ||
151
155
  cause instanceof protocolErrors.ProtocolError) {
152
156
  throw protocolError('AUTH_INVALID', 'Credential is invalid.');
@@ -154,6 +158,7 @@ async function establishCaller(input, audience, verification, execution, policy)
154
158
  throw cause;
155
159
  }
156
160
  }
161
+ /** Accept a Kernel delegation proof claim naming exactly one resolved caller Identity. */
157
162
  export function acceptResolvedDelegation(input) {
158
163
  if (input === null ||
159
164
  typeof input !== 'object' ||
@@ -164,5 +169,14 @@ export function acceptResolvedDelegation(input) {
164
169
  Reflect.get(input, 'v') !== 1) {
165
170
  throw new AuthValueError('AUTH_GRANT_INVALID', 'Expected resolved delegation.');
166
171
  }
167
- return grant.accept({ expr: Reflect.get(input, 'expr') });
172
+ const raw = Reflect.get(input, 'expr');
173
+ // grant.accept collapses duplicate operands (union(X, X) becomes X), so the leaf is checked as sent.
174
+ if (raw === null || typeof raw !== 'object' || Reflect.get(raw, 'kind') !== 'identity') {
175
+ throw new AuthValueError('AUTH_GRANT_INVALID', 'Expected one resolved caller Identity.');
176
+ }
177
+ const { expr } = grant.accept({ expr: raw });
178
+ if (expr.kind !== 'identity') {
179
+ throw new AuthValueError('AUTH_GRANT_INVALID', 'Expected one resolved caller Identity.');
180
+ }
181
+ return expr.id;
168
182
  }
@@ -7,13 +7,13 @@ export interface SignedCallback {
7
7
  readonly expiresAt: number;
8
8
  readonly delegateTtlSeconds: number;
9
9
  }
10
- export type CallbackGrantMode = 'caller' | 'self' | 'union';
10
+ export type CallbackMode = 'caller' | 'self';
11
11
  /** The Domain's own authority, independent of any caller. */
12
12
  export declare const selfIdentity: Readonly<{
13
13
  kind: 'identity';
14
14
  self: true;
15
15
  }>;
16
- /** Exact callback Grant expressions corresponding to the Kernel Domain graph modes. */
16
+ /** Exact single-identity callback authority for each Kernel Domain graph mode. */
17
17
  export declare function callbackIdentities(nested: string | Uint8Array): Readonly<{
18
18
  caller: Readonly<{
19
19
  kind: 'identity';
@@ -23,16 +23,6 @@ export declare function callbackIdentities(nested: string | Uint8Array): Readonl
23
23
  kind: 'identity';
24
24
  self: true;
25
25
  }>;
26
- union: Readonly<{
27
- kind: 'union';
28
- operands: readonly (Readonly<{
29
- kind: 'identity';
30
- self: true;
31
- }> | Readonly<{
32
- kind: 'identity';
33
- credential: string | Uint8Array<ArrayBufferLike>;
34
- }>)[];
35
- }>;
36
26
  }>;
37
27
  export declare function signDomainCallback(signing: SigningMaterial, issuer: IssuerId, subject: string, audience: IssuerId, execution: {
38
28
  readonly deadline: number;
@@ -6,17 +6,11 @@ export const maximumCallbackDelegationTtlSeconds = 60;
6
6
  const CALLBACK_DELEGATION_SKEW_SECONDS = 5;
7
7
  /** The Domain's own authority, independent of any caller. */
8
8
  export const selfIdentity = Object.freeze({ kind: 'identity', self: true });
9
- /** Exact callback Grant expressions corresponding to the Kernel Domain graph modes. */
9
+ /** Exact single-identity callback authority for each Kernel Domain graph mode. */
10
10
  export function callbackIdentities(nested) {
11
- const caller = Object.freeze({ kind: 'identity', credential: nested });
12
- const self = selfIdentity;
13
11
  return Object.freeze({
14
- caller,
15
- self,
16
- union: Object.freeze({
17
- kind: 'union',
18
- operands: Object.freeze([self, caller]),
19
- }),
12
+ caller: Object.freeze({ kind: 'identity', credential: nested }),
13
+ self: selfIdentity,
20
14
  });
21
15
  }
22
16
  export async function signDomainCallback(signing, issuer, subject, audience, execution) {
@@ -1,6 +1,13 @@
1
- import type { publication as serverPublication } from '@astrale-os/kernel-server';
2
- import * as publication from '@astrale-os/kernel-protocol/release/legacy';
1
+ import type { release as serverRelease } from '@astrale-os/kernel-server';
2
+ import * as release from '@astrale-os/kernel-protocol/release';
3
3
  import type { IssuerId } from '../../platform/auth/index.js';
4
4
  import type { SigningMaterial } from './signing.js';
5
- /** Create one stateless, nonce-bound public Delivery provider for an exact Publication. */
6
- export declare function publicationDelivery(signing: SigningMaterial, issuer: IssuerId, subject: string, deployed: publication.Publication): serverPublication.delivery.Provider;
5
+ type Served = release.DomainRelease | release.legacy.Publication;
6
+ /**
7
+ * Create one stateless, nonce-bound public Delivery provider for the exact document a deployment
8
+ * serves. It answers in the request's version: a Delivery v2 carrying the release for a v2
9
+ * request, and a Delivery v1 carrying the Publication (a release's frozen v3 projection) for the
10
+ * deprecated v1 request. A stable target's Publication answers v1 only.
11
+ */
12
+ export declare function releaseDelivery(signing: SigningMaterial, issuer: IssuerId, subject: string, deployed: Served): serverRelease.delivery.Provider;
13
+ export {};
@@ -1,34 +1,61 @@
1
- import * as publication from '@astrale-os/kernel-protocol/release/legacy';
1
+ import * as release from '@astrale-os/kernel-protocol/release';
2
2
  import { SignJWT } from 'jose';
3
3
  const ATTESTATION_TTL_SECONDS = 60;
4
- /** Create one stateless, nonce-bound public Delivery provider for an exact Publication. */
5
- export function publicationDelivery(signing, issuer, subject, deployed) {
4
+ /**
5
+ * Create one stateless, nonce-bound public Delivery provider for the exact document a deployment
6
+ * serves. It answers in the request's version: a Delivery v2 carrying the release for a v2
7
+ * request, and a Delivery v1 carrying the Publication (a release's frozen v3 projection) for the
8
+ * deprecated v1 request. A stable target's Publication answers v1 only.
9
+ */
10
+ export function releaseDelivery(signing, issuer, subject, deployed) {
11
+ const projection = deployed.version === 4 ? release.legacy.publication(deployed) : deployed;
6
12
  return Object.freeze({
7
13
  async create(request, context) {
8
14
  context.signal.throwIfAborted();
9
- const now = Math.floor(Date.now() / 1_000);
10
- const attestation = await new SignJWT({
11
- purpose: publication.delivery.PURPOSE,
15
+ if (request.version === 1) {
16
+ const attestation = await attest(signing, issuer, subject, request.kernel, {
17
+ purpose: release.legacy.delivery.PURPOSE,
18
+ nonce: request.nonce,
19
+ etag: projection.etag,
20
+ schemaRevision: projection.schema.revision,
21
+ });
22
+ context.signal.throwIfAborted();
23
+ return release.legacy.delivery.accept({
24
+ format: 'astrale.domain.delivery',
25
+ version: 1,
26
+ publication: projection,
27
+ attestation,
28
+ });
29
+ }
30
+ if (deployed.version !== 4) {
31
+ throw new TypeError('A Publication-backed deployment answers Delivery v1 only.');
32
+ }
33
+ const attestation = await attest(signing, issuer, subject, request.kernel, {
34
+ purpose: release.delivery.PURPOSE,
12
35
  nonce: request.nonce,
13
- etag: deployed.etag,
36
+ release: deployed.digest,
14
37
  schemaRevision: deployed.schema.revision,
15
- })
16
- .setProtectedHeader({
17
- alg: signing.algorithm,
18
- ...(signing.keyId === undefined ? {} : { kid: signing.keyId }),
19
- })
20
- .setIssuer(issuer)
21
- .setSubject(subject)
22
- .setAudience(request.kernel)
23
- .setExpirationTime(now + ATTESTATION_TTL_SECONDS)
24
- .sign(await signing.privateKey);
38
+ });
25
39
  context.signal.throwIfAborted();
26
- return publication.delivery.accept({
40
+ return release.delivery.accept({
27
41
  format: 'astrale.domain.delivery',
28
- version: 1,
29
- publication: deployed,
42
+ version: 2,
43
+ release: deployed,
30
44
  attestation,
31
45
  });
32
46
  },
33
47
  });
34
48
  }
49
+ async function attest(signing, issuer, subject, kernel, claims) {
50
+ const now = Math.floor(Date.now() / 1_000);
51
+ return new SignJWT(claims)
52
+ .setProtectedHeader({
53
+ alg: signing.algorithm,
54
+ ...(signing.keyId === undefined ? {} : { kid: signing.keyId }),
55
+ })
56
+ .setIssuer(issuer)
57
+ .setSubject(subject)
58
+ .setAudience(kernel)
59
+ .setExpirationTime(now + ATTESTATION_TTL_SECONDS)
60
+ .sign(await signing.privateKey);
61
+ }
@@ -1,6 +1,6 @@
1
1
  import type { Fetch } from '@astrale-os/kernel-client';
2
- import type * as publicationProtocol from '@astrale-os/kernel-protocol/release/legacy';
3
- import type { Issuer, exchange, publication } from '@astrale-os/kernel-server';
2
+ import type * as releaseProtocol from '@astrale-os/kernel-protocol/release';
3
+ import type { Issuer, exchange, release } from '@astrale-os/kernel-server';
4
4
  import type { IssuerId, JsonWebKey } from '../../platform/auth/index.js';
5
5
  import type { ClientSession } from '../../platform/client/session/index.js';
6
6
  import type { InvocationAuthority } from '../invocation/index.js';
@@ -10,7 +10,11 @@ import type { IdentityNetworkPolicy } from './jwks.js';
10
10
  export interface Identity extends Issuer, InvocationAuthority {
11
11
  readonly subject: string;
12
12
  readonly tokenExchange?: exchange.Provider;
13
- delivery(publication: publicationProtocol.Publication): publication.delivery.Provider;
13
+ /**
14
+ * Delivery for the exact document this deployment serves: Delivery v2 over its release and v1
15
+ * over its frozen v3 projection, or v1 over a stable target's Publication.
16
+ */
17
+ delivery(served: releaseProtocol.DomainRelease | releaseProtocol.legacy.Publication): release.delivery.Provider;
14
18
  /**
15
19
  * The Domain's own authority toward one Kernel for work no caller credential carries, such as a
16
20
  * durable run. Required to serve durable Workflows; the caller closes the Session.
@@ -1,5 +1,5 @@
1
1
  import { admit, authenticate, executorSession } from './authentication.js';
2
- import { publicationDelivery } from './delivery.js';
2
+ import { releaseDelivery } from './delivery.js';
3
3
  import { httpIssuer } from './errors.js';
4
4
  import { maximumExchangeTtl, tokenExchange } from './exchange.js';
5
5
  import { createVerificationBasisResolver } from './jwks.js';
@@ -49,7 +49,7 @@ export function createIdentity(input) {
49
49
  ? {}
50
50
  : { loadIssuerPublicKeys: input.loadIssuerPublicKeys }),
51
51
  ...(exchangeProvider === undefined ? {} : { tokenExchange: exchangeProvider }),
52
- delivery: (publication) => publicationDelivery(material, issuer, input.subject, publication),
52
+ delivery: (served) => releaseDelivery(material, issuer, input.subject, served),
53
53
  admit: (request) => admit(request, configuration),
54
54
  executor: (kernel, execution) => executorSession(kernel, execution, configuration),
55
55
  authenticate: (request) => authenticate(request.credential, request.via.issuer, request.context.execution, configuration),
@@ -1,6 +1,5 @@
1
1
  import type { HandlerRequest } from '@astrale-os/kernel-server';
2
- import type { AnonymousCaller, AuthenticatedCaller, ResolvedCallable } from '../../../application/action/index.js';
3
- import type { Release } from '../../../deployment/release/legacy/index.js';
2
+ import type { AnonymousCaller, ResolvedCallable } from '../../../application/action/index.js';
4
3
  import type { Domain } from '../../../platform/schema/index.js';
5
4
  import type { AuthenticatedInvocation, InvocationAuthority } from './authority.js';
6
5
  export interface AnonymousInvocation {
@@ -9,9 +8,5 @@ export interface AnonymousInvocation {
9
8
  readonly graph: null;
10
9
  close(): void;
11
10
  }
12
- interface AdmittedAuthenticatedInvocation extends Omit<AuthenticatedInvocation, 'caller'> {
13
- readonly caller: AuthenticatedCaller;
14
- }
15
- export type InvocationAuthentication = AnonymousInvocation | AdmittedAuthenticatedInvocation;
16
- export declare function authentication(callable: ResolvedCallable, request: HandlerRequest, release: Release, domain: Domain, authority: InvocationAuthority): Promise<InvocationAuthentication>;
17
- export {};
11
+ export type InvocationAuthentication = AnonymousInvocation | AuthenticatedInvocation;
12
+ export declare function authentication(callable: ResolvedCallable, request: HandlerRequest, domain: Domain, authority: InvocationAuthority): Promise<InvocationAuthentication>;
@@ -1,4 +1,4 @@
1
- import { grant, issuer } from '../../../platform/auth/index.js';
1
+ import { issuer } from '../../../platform/auth/index.js';
2
2
  import { bindSession } from '../../../platform/client/session/index.js';
3
3
  import { NodeId } from '../../../platform/graph/node/index.js';
4
4
  import { protocolError } from '../result/index.js';
@@ -9,7 +9,7 @@ const ANONYMOUS = Object.freeze({
9
9
  graph: null,
10
10
  close() { },
11
11
  });
12
- export async function authentication(callable, request, release, domain, authority) {
12
+ export async function authentication(callable, request, domain, authority) {
13
13
  const credential = request.credential;
14
14
  if (callable.auth === 'anonymous' && credential === undefined)
15
15
  return ANONYMOUS;
@@ -21,7 +21,6 @@ export async function authentication(callable, request, release, domain, authori
21
21
  const authenticated = await authority.authenticate({
22
22
  credential,
23
23
  via: requireVia(request),
24
- publication: release.publication,
25
24
  domain,
26
25
  context: request.context,
27
26
  });
@@ -40,7 +39,6 @@ export async function authentication(callable, request, release, domain, authori
40
39
  const graph = Object.freeze({
41
40
  caller: bindSession(graphInput.caller),
42
41
  self: bindSession(graphInput.self),
43
- union: bindSession(graphInput.union),
44
42
  });
45
43
  return Object.freeze({ caller, graph, close });
46
44
  }
@@ -62,8 +60,7 @@ function admitGraph(input) {
62
60
  Array.isArray(input) ||
63
61
  !Object.hasOwn(input, 'caller') ||
64
62
  !Object.hasOwn(input, 'self') ||
65
- !Object.hasOwn(input, 'union') ||
66
- Reflect.ownKeys(input).some((key) => key !== 'caller' && key !== 'self' && key !== 'union')) {
63
+ Reflect.ownKeys(input).some((key) => key !== 'caller' && key !== 'self')) {
67
64
  invalid();
68
65
  }
69
66
  return input;
@@ -79,29 +76,18 @@ function admitCaller(input) {
79
76
  invalid();
80
77
  if (!Object.hasOwn(input, 'kind') ||
81
78
  !Object.hasOwn(input, 'principal') ||
82
- !Object.hasOwn(input, 'authority') ||
79
+ !Object.hasOwn(input, 'identity') ||
83
80
  !Object.hasOwn(input, 'authentication') ||
84
- Reflect.ownKeys(input).some((key) => key !== 'kind' && key !== 'principal' && key !== 'authority' && key !== 'authentication') ||
81
+ Reflect.ownKeys(input).some((key) => key !== 'kind' && key !== 'principal' && key !== 'identity' && key !== 'authentication') ||
85
82
  Reflect.get(input, 'kind') !== 'authenticated') {
86
83
  invalid();
87
84
  }
88
- const principal = NodeId(Reflect.get(input, 'principal'));
89
- const authority = grant.accept(Reflect.get(input, 'authority'));
90
- const authentication = admitEvidence(Reflect.get(input, 'authentication'));
91
- const caller = {
85
+ return Object.freeze({
92
86
  kind: 'authenticated',
93
- get identity() {
94
- if (authority.expr.kind !== 'identity') {
95
- throw new TypeError('Caller authority does not resolve to one exact Identity.');
96
- }
97
- return authority.expr.id;
98
- },
99
- principal,
100
- authority,
101
- authentication,
102
- };
103
- Object.defineProperty(caller, 'identity', { enumerable: false });
104
- return Object.freeze(caller);
87
+ identity: NodeId(Reflect.get(input, 'identity')),
88
+ principal: NodeId(Reflect.get(input, 'principal')),
89
+ authentication: admitEvidence(Reflect.get(input, 'authentication')),
90
+ });
105
91
  }
106
92
  function admitEvidence(input) {
107
93
  if (input === null || typeof input !== 'object' || Array.isArray(input))
@@ -1,5 +1,4 @@
1
1
  import type * as invocation from '@astrale-os/kernel-protocol/invocation';
2
- import type * as publication from '@astrale-os/kernel-protocol/release/legacy';
3
2
  import type { HandlerRequest, InvocationContext } from '@astrale-os/kernel-server';
4
3
  import type { AuthenticatedCaller } from '../../../application/action/index.js';
5
4
  import type { BoundClientSession } from '../../../platform/client/session/index.js';
@@ -8,28 +7,35 @@ export interface InvocationAdmissionInput {
8
7
  readonly call: invocation.Call;
9
8
  readonly credential?: string;
10
9
  readonly via: invocation.Via | invocation.PublicationVia;
11
- readonly publication: publication.Publication;
12
10
  readonly domain: Domain;
13
11
  readonly context: InvocationContext;
14
12
  }
15
13
  export interface InvocationAuthenticationInput {
16
14
  readonly credential: string;
17
15
  readonly via: invocation.Via | invocation.PublicationVia;
18
- readonly publication: publication.Publication;
19
16
  readonly domain: Domain;
20
17
  readonly context: InvocationContext;
21
18
  }
22
19
  /** Authenticated capabilities before the SDK admits and derives application caller context. */
23
20
  export interface AuthenticatedInvocation {
24
- readonly caller: Omit<AuthenticatedCaller, 'identity'>;
25
- readonly graph: Readonly<Record<'caller' | 'self' | 'union', BoundClientSession>>;
21
+ readonly caller: AuthenticatedCaller;
22
+ readonly graph: Readonly<Record<'caller' | 'self', BoundClientSession>>;
26
23
  close(): void;
27
24
  }
28
25
  export interface InvocationAuthority {
26
+ /**
27
+ * The source Kernel's `Function.admit` of a remote call: resolves to the admitted target, or
28
+ * rejects with the public refusal. A refusal whose reason is `FUNCTION_MISS` (the Kernel no longer
29
+ * places the call on this deployment) is answered as the reserved miss, never as an error.
30
+ */
29
31
  admit(input: InvocationAdmissionInput): Promise<unknown>;
30
32
  authenticate(input: InvocationAuthenticationInput): Promise<AuthenticatedInvocation>;
31
33
  }
32
34
  /** Capture the execution Identity capability and receiver-bind both privileged operations. */
33
35
  export declare function authority(input: InvocationAuthority): InvocationAuthority;
34
- /** The routed witness of a remote call: a `ReleaseRef`, or the `PublicationRef` of a v3 pin. */
36
+ /**
37
+ * The routed witness of a remote call, already admitted by the Kernel Server against the served
38
+ * snapshot: the exact `ReleaseRef` of an immutable deployment, or the `PublicationRef` of a v3 pin
39
+ * (a release's exact projection, or a stable target's Publication).
40
+ */
35
41
  export declare function requireVia(request: HandlerRequest): invocation.Via | invocation.PublicationVia;
@@ -12,7 +12,11 @@ export function authority(input) {
12
12
  authenticate: receiver.authenticate.bind(receiver),
13
13
  });
14
14
  }
15
- /** The routed witness of a remote call: a `ReleaseRef`, or the `PublicationRef` of a v3 pin. */
15
+ /**
16
+ * The routed witness of a remote call, already admitted by the Kernel Server against the served
17
+ * snapshot: the exact `ReleaseRef` of an immutable deployment, or the `PublicationRef` of a v3 pin
18
+ * (a release's exact projection, or a stable target's Publication).
19
+ */
16
20
  export function requireVia(request) {
17
21
  if (request.via === undefined) {
18
22
  throw protocolError('VALIDATION_ERROR', 'Remote invocation requires Via.');
@@ -2,4 +2,4 @@ import type { HandlerDependencies } from '../../../application/dependency/index.
2
2
  import type { BoundClientSession } from '../../../platform/client/session/index.js';
3
3
  import type { Domain } from '../../../platform/schema/index.js';
4
4
  /** Bind each explicit authority to its admitted session; metadata remains inert. */
5
- export declare function bindDependencies<D extends Domain>(domain: D, sessions: Readonly<Record<'caller' | 'self' | 'union', BoundClientSession>>): HandlerDependencies<D>;
5
+ export declare function bindDependencies<D extends Domain>(domain: D, sessions: Readonly<Record<'caller' | 'self', BoundClientSession>>): HandlerDependencies<D>;
@@ -12,7 +12,6 @@ export function bindDependencies(domain, sessions) {
12
12
  dependencies[alias] = Object.freeze({
13
13
  caller: bindDependency(dependency, sessions.caller),
14
14
  self: bindDependency(dependency, sessions.self),
15
- union: bindDependency(dependency, sessions.union),
16
15
  });
17
16
  }
18
17
  return Object.freeze(dependencies);