@astrale-os/kernel-protocol 0.5.0-beta.9 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/dist/artifact/index.d.ts +1 -1
  2. package/dist/artifact/index.js +1 -1
  3. package/dist/artifact/ref.d.ts +2 -0
  4. package/dist/artifact/ref.js +4 -3
  5. package/dist/codecs/index.d.ts +1 -2
  6. package/dist/codecs/index.js +1 -2
  7. package/dist/codecs/media-types.d.ts +0 -1
  8. package/dist/codecs/media-types.js +0 -1
  9. package/dist/errors/index.d.ts +1 -0
  10. package/dist/errors/index.js +1 -0
  11. package/dist/errors/retry.d.ts +25 -0
  12. package/dist/errors/retry.js +46 -0
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/invocation/admission.d.ts +2 -2
  16. package/dist/invocation/admission.js +5 -5
  17. package/dist/invocation/binary.d.ts +1 -0
  18. package/dist/invocation/binary.js +21 -4
  19. package/dist/invocation/binding-codecs.d.ts +3 -2
  20. package/dist/invocation/binding-codecs.js +1 -6
  21. package/dist/invocation/delegate.d.ts +0 -20
  22. package/dist/invocation/delegate.js +2 -34
  23. package/dist/invocation/http/binary.d.ts +3 -1
  24. package/dist/invocation/http/binary.js +6 -1
  25. package/dist/invocation/http/index.d.ts +2 -1
  26. package/dist/invocation/http/index.js +2 -1
  27. package/dist/invocation/http/negotiation.js +3 -10
  28. package/dist/invocation/http/request.d.ts +11 -0
  29. package/dist/invocation/http/request.js +69 -0
  30. package/dist/invocation/index.d.ts +5 -4
  31. package/dist/invocation/index.js +4 -3
  32. package/dist/invocation/maintenance.d.ts +14 -0
  33. package/dist/invocation/maintenance.js +18 -0
  34. package/dist/invocation/redirect.d.ts +10 -12
  35. package/dist/invocation/redirect.js +10 -22
  36. package/dist/invocation/request.d.ts +3 -0
  37. package/dist/invocation/request.js +9 -2
  38. package/dist/invocation/response.d.ts +6 -1
  39. package/dist/invocation/response.js +26 -15
  40. package/dist/invocation/routing.d.ts +14 -4
  41. package/dist/invocation/routing.js +35 -20
  42. package/dist/invocation/schema.d.ts +6 -4
  43. package/dist/invocation/schema.js +5 -11
  44. package/dist/invocation/service-reason.d.ts +20 -15
  45. package/dist/invocation/service-reason.js +27 -19
  46. package/dist/invocation/stale-route.d.ts +3 -3
  47. package/dist/invocation/target.d.ts +5 -2
  48. package/dist/invocation/target.js +25 -3
  49. package/dist/invocation/websocket/binary.js +1 -0
  50. package/dist/invocation/websocket/index.d.ts +1 -1
  51. package/dist/invocation/websocket/index.js +1 -1
  52. package/dist/invocation/websocket/subprotocol.d.ts +1 -2
  53. package/dist/invocation/websocket/subprotocol.js +3 -4
  54. package/dist/issuer/claims.d.ts +7 -0
  55. package/dist/issuer/claims.js +7 -0
  56. package/dist/issuer/index.d.ts +2 -0
  57. package/dist/issuer/index.js +2 -0
  58. package/dist/issuer/paths.d.ts +2 -0
  59. package/dist/issuer/paths.js +1 -0
  60. package/dist/issuer/workflow-engine.d.ts +18 -0
  61. package/dist/issuer/workflow-engine.js +59 -0
  62. package/dist/{publication → release}/bindings/callable.js +6 -6
  63. package/dist/release/bindings/invocation.js +13 -0
  64. package/dist/release/bindings/view.d.ts +11 -0
  65. package/dist/release/bindings/view.js +54 -0
  66. package/dist/release/build.d.ts +6 -0
  67. package/dist/release/build.js +7 -0
  68. package/dist/release/bundle-admission.d.ts +21 -0
  69. package/dist/{publication → release}/bundle-admission.js +15 -20
  70. package/dist/{publication → release}/bundle-descriptor.js +6 -6
  71. package/dist/release/bundle-evidence.d.ts +3 -0
  72. package/dist/release/bundle-evidence.js +13 -0
  73. package/dist/{publication → release}/bundle.d.ts +5 -2
  74. package/dist/{publication → release}/bundle.js +13 -7
  75. package/dist/{publication → release}/delivery/attestation.d.ts +1 -0
  76. package/dist/{publication → release}/delivery/claims.d.ts +7 -2
  77. package/dist/{publication → release}/delivery/claims.js +20 -13
  78. package/dist/release/delivery/delivery.d.ts +11 -0
  79. package/dist/{publication → release}/delivery/delivery.js +7 -12
  80. package/dist/{publication → release}/delivery/error.d.ts +2 -0
  81. package/dist/{publication → release}/delivery/error.js +1 -0
  82. package/dist/{publication → release}/delivery/index.d.ts +5 -1
  83. package/dist/{publication → release}/delivery/index.js +4 -0
  84. package/dist/{publication → release}/delivery/limits.d.ts +2 -1
  85. package/dist/release/delivery/limits.js +5 -0
  86. package/dist/{publication → release}/delivery/request.d.ts +10 -9
  87. package/dist/{publication → release}/delivery/request.js +9 -10
  88. package/dist/{publication → release}/delivery-declaration.js +4 -4
  89. package/dist/release/delivery-endpoint.js +22 -0
  90. package/dist/release/digest.d.ts +13 -0
  91. package/dist/{publication/etag.js → release/digest.js} +1 -6
  92. package/dist/release/error.d.ts +7 -0
  93. package/dist/release/error.js +11 -0
  94. package/dist/release/index.d.ts +17 -0
  95. package/dist/release/index.js +10 -0
  96. package/dist/release/issuer.d.ts +5 -0
  97. package/dist/release/issuer.js +34 -0
  98. package/dist/release/manifest.d.ts +6 -0
  99. package/dist/release/manifest.js +22 -0
  100. package/dist/release/reference.d.ts +26 -0
  101. package/dist/release/reference.js +70 -0
  102. package/dist/release/release.d.ts +60 -0
  103. package/dist/release/release.js +125 -0
  104. package/dist/release/requirements.d.ts +41 -0
  105. package/dist/release/requirements.js +306 -0
  106. package/dist/{publication → release}/route.js +24 -24
  107. package/dist/{publication → release}/schema.js +4 -4
  108. package/dist/release/served.d.ts +27 -0
  109. package/dist/release/served.js +56 -0
  110. package/dist/release/shape.d.ts +8 -0
  111. package/dist/routes/admission.d.ts +1 -1
  112. package/dist/routes/admission.js +7 -85
  113. package/dist/routes/binding.d.ts +3 -3
  114. package/dist/routes/binding.js +11 -21
  115. package/dist/routes/compiler.d.ts +2 -2
  116. package/dist/routes/compiler.js +7 -3
  117. package/dist/routes/credential.d.ts +12 -2
  118. package/dist/routes/credential.js +9 -4
  119. package/dist/routes/decode.d.ts +5 -2
  120. package/dist/routes/decode.js +24 -17
  121. package/dist/routes/deployment-retired.d.ts +30 -0
  122. package/dist/routes/deployment-retired.js +96 -0
  123. package/dist/routes/encode.js +12 -5
  124. package/dist/routes/entries.d.ts +23 -0
  125. package/dist/routes/entries.js +150 -0
  126. package/dist/routes/evidence.d.ts +3 -3
  127. package/dist/routes/evidence.js +7 -33
  128. package/dist/routes/header.d.ts +9 -0
  129. package/dist/routes/header.js +34 -0
  130. package/dist/routes/index.d.ts +2 -2
  131. package/dist/routes/index.js +2 -2
  132. package/dist/routes/mapping.d.ts +1 -1
  133. package/dist/routes/mapping.js +4 -4
  134. package/dist/routes/match.d.ts +1 -1
  135. package/dist/routes/placement.d.ts +2 -2
  136. package/dist/routes/plan.d.ts +1 -1
  137. package/dist/routes/request.d.ts +3 -1
  138. package/dist/routes/reservation.d.ts +4 -2
  139. package/dist/routes/reservation.js +14 -8
  140. package/dist/routes/routing.d.ts +18 -6
  141. package/dist/routes/routing.js +28 -49
  142. package/dist/routes/select.d.ts +1 -1
  143. package/dist/routes/table.d.ts +3 -2
  144. package/dist/routes/target.d.ts +5 -0
  145. package/dist/routes/target.js +16 -0
  146. package/dist/routes/template.d.ts +0 -1
  147. package/dist/routes/template.js +0 -3
  148. package/dist/runtime/artifact.d.ts +5 -4
  149. package/dist/runtime/artifact.js +7 -4
  150. package/dist/runtime/index.d.ts +1 -1
  151. package/dist/runtime/index.js +1 -1
  152. package/dist/schema/installation/codec.d.ts +9 -0
  153. package/dist/schema/installation/codec.js +82 -0
  154. package/dist/schema/installation/index.d.ts +2 -0
  155. package/dist/schema/installation/index.js +1 -0
  156. package/dist/schema/installation/introspection/codec.d.ts +5 -2
  157. package/dist/schema/installation/introspection/codec.js +319 -193
  158. package/dist/schema/installation/introspection/index.d.ts +2 -2
  159. package/dist/schema/installation/introspection/index.js +1 -1
  160. package/dist/schema/installation/introspection/result.d.ts +84 -25
  161. package/dist/schema/installation/result.d.ts +15 -0
  162. package/dist/schema/installation/result.js +1 -0
  163. package/package.json +21 -75
  164. package/dist/codecs/msgpack.d.ts +0 -4
  165. package/dist/codecs/msgpack.js +0 -50
  166. package/dist/publication/bindings/invocation.js +0 -13
  167. package/dist/publication/bindings/view.d.ts +0 -7
  168. package/dist/publication/bindings/view.js +0 -28
  169. package/dist/publication/bundle-admission.d.ts +0 -4
  170. package/dist/publication/bundle-evidence.d.ts +0 -3
  171. package/dist/publication/bundle-evidence.js +0 -13
  172. package/dist/publication/content.d.ts +0 -10
  173. package/dist/publication/delivery/delivery.d.ts +0 -9
  174. package/dist/publication/delivery/limits.js +0 -4
  175. package/dist/publication/delivery-endpoint.js +0 -22
  176. package/dist/publication/error.d.ts +0 -7
  177. package/dist/publication/error.js +0 -11
  178. package/dist/publication/etag.d.ts +0 -6
  179. package/dist/publication/index.d.ts +0 -17
  180. package/dist/publication/index.js +0 -10
  181. package/dist/publication/manifest.d.ts +0 -6
  182. package/dist/publication/manifest.js +0 -30
  183. package/dist/publication/publication.d.ts +0 -36
  184. package/dist/publication/publication.js +0 -133
  185. package/dist/publication/reference.d.ts +0 -17
  186. package/dist/publication/reference.js +0 -68
  187. package/dist/publication/requirements.d.ts +0 -26
  188. package/dist/publication/requirements.js +0 -180
  189. package/dist/routes/release-unavailable.d.ts +0 -8
  190. package/dist/routes/release-unavailable.js +0 -32
  191. /package/dist/{publication → release}/bindings/callable.d.ts +0 -0
  192. /package/dist/{publication → release}/bindings/index.d.ts +0 -0
  193. /package/dist/{publication → release}/bindings/index.js +0 -0
  194. /package/dist/{publication → release}/bindings/invocation.d.ts +0 -0
  195. /package/dist/{publication → release}/bundle-descriptor.d.ts +0 -0
  196. /package/dist/{publication → release}/declaration.d.ts +0 -0
  197. /package/dist/{publication → release}/declaration.js +0 -0
  198. /package/dist/{publication → release}/delivery/attestation.js +0 -0
  199. /package/dist/{publication → release}/delivery-declaration.d.ts +0 -0
  200. /package/dist/{publication → release}/delivery-endpoint.d.ts +0 -0
  201. /package/dist/{publication → release}/route.d.ts +0 -0
  202. /package/dist/{publication → release}/schema.d.ts +0 -0
  203. /package/dist/{publication/content.js → release/shape.js} +0 -0
@@ -1 +1 @@
1
- export { accept, identify, type Digest, type Ref } from './ref.js';
1
+ export { accept, canonicalMediaType, identify, type Digest, type Ref } from './ref.js';
@@ -1 +1 @@
1
- export { accept, identify } from './ref.js';
1
+ export { accept, canonicalMediaType, identify } from './ref.js';
@@ -8,3 +8,5 @@ export interface Ref {
8
8
  export declare function accept(input: unknown): Ref;
9
9
  /** Identify exact bytes under one canonical media type. */
10
10
  export declare function identify(bytes: Uint8Array, mediaType: string): Ref;
11
+ /** Canonicalize one portable artifact media type, retaining token parameters and their values. */
12
+ export declare function canonicalMediaType(input: string): string;
@@ -18,7 +18,7 @@ export function accept(input) {
18
18
  }
19
19
  return Object.freeze({
20
20
  digest: value.digest,
21
- mediaType: normalizeMediaType(value.mediaType),
21
+ mediaType: canonicalMediaType(value.mediaType),
22
22
  size: value.size,
23
23
  });
24
24
  }
@@ -31,11 +31,12 @@ export function identify(bytes, mediaType) {
31
31
  hexadecimal += byte.toString(16).padStart(2, '0');
32
32
  return Object.freeze({
33
33
  digest: `sha256:${hexadecimal}`,
34
- mediaType: normalizeMediaType(mediaType),
34
+ mediaType: canonicalMediaType(mediaType),
35
35
  size: bytes.byteLength,
36
36
  });
37
37
  }
38
- function normalizeMediaType(input) {
38
+ /** Canonicalize one portable artifact media type, retaining token parameters and their values. */
39
+ export function canonicalMediaType(input) {
39
40
  const [essence, ...parametersInput] = input.split(';');
40
41
  const [rawType, rawSubtype, ...extra] = essence.trim().split('/');
41
42
  if (rawType === undefined ||
@@ -1,4 +1,3 @@
1
1
  export { DecodeError, type Codec, type EncodedEnvelope } from './codec.js';
2
2
  export { json } from './json.js';
3
- export { CONTENT_TYPE_JSON, CONTENT_TYPE_MSGPACK } from './media-types.js';
4
- export { loadMsgpack } from './msgpack.js';
3
+ export { CONTENT_TYPE_JSON } from './media-types.js';
@@ -1,4 +1,3 @@
1
1
  export { DecodeError } from './codec.js';
2
2
  export { json } from './json.js';
3
- export { CONTENT_TYPE_JSON, CONTENT_TYPE_MSGPACK } from './media-types.js';
4
- export { loadMsgpack } from './msgpack.js';
3
+ export { CONTENT_TYPE_JSON } from './media-types.js';
@@ -1,2 +1 @@
1
1
  export declare const CONTENT_TYPE_JSON: 'application/vnd.astrale+json';
2
- export declare const CONTENT_TYPE_MSGPACK: 'application/vnd.astrale.msgpack';
@@ -1,2 +1 @@
1
1
  export const CONTENT_TYPE_JSON = 'application/vnd.astrale+json';
2
- export const CONTENT_TYPE_MSGPACK = 'application/vnd.astrale.msgpack';
@@ -3,3 +3,4 @@ export { httpStatusOf } from './http-status.js';
3
3
  export { acceptPayload, type ErrorPayload } from './payload.js';
4
4
  export { ProtocolError } from './protocol-error.js';
5
5
  export { acceptReason, reasonOf, type ErrorReason } from './reason.js';
6
+ export { MAXIMUM_RETRY_AFTER_MS, RETRY_REASONS, retryAfterField, retryAfterOf, retryReason, type RetryReason, type RetryReasonCode, } from './retry.js';
@@ -3,3 +3,4 @@ export { httpStatusOf } from './http-status.js';
3
3
  export { acceptPayload } from './payload.js';
4
4
  export { ProtocolError } from './protocol-error.js';
5
5
  export { acceptReason, reasonOf } from './reason.js';
6
+ export { MAXIMUM_RETRY_AFTER_MS, RETRY_REASONS, retryAfterField, retryAfterOf, retryReason, } from './retry.js';
@@ -0,0 +1,25 @@
1
+ import type { ErrorPayload } from './payload.js';
2
+ import type { ErrorReason } from './reason.js';
3
+ /**
4
+ * Reasons for a request refused before any work was admitted. The same request may be sent again
5
+ * once `retryAfterMs` has elapsed; every other public error keeps its own retry meaning.
6
+ */
7
+ export declare const RETRY_REASONS: Readonly<{
8
+ /** A bounded Kernel resource is exhausted. */
9
+ readonly CAPACITY_EXHAUSTED: 'CAPACITY_EXHAUSTED';
10
+ /** The server stopped admitting work before it shuts down. */
11
+ readonly SERVER_DRAINING: 'SERVER_DRAINING';
12
+ /** The Instance is under a maintenance session that admits only its root operator. */
13
+ readonly INSTANCE_MAINTENANCE: 'INSTANCE_MAINTENANCE';
14
+ }>;
15
+ export type RetryReasonCode = (typeof RETRY_REASONS)[keyof typeof RETRY_REASONS];
16
+ export type RetryReason<Code extends RetryReasonCode = RetryReasonCode> = ErrorReason<Code, {
17
+ readonly retryAfterMs: number;
18
+ }>;
19
+ /** One hour bounds a hint that only schedules the next attempt. */
20
+ export declare const MAXIMUM_RETRY_AFTER_MS = 3600000;
21
+ export declare function retryReason<Code extends RetryReasonCode>(code: Code, retryAfterMs: number): RetryReason<Code>;
22
+ /** Return the retry delay of a back-pressure, draining or maintenance refusal, and nothing else. */
23
+ export declare function retryAfterOf(error: ErrorPayload): number | undefined;
24
+ /** Present a retry delay as an HTTP `Retry-After` delta in whole seconds, rounded up. */
25
+ export declare function retryAfterField(retryAfterMs: number): string;
@@ -0,0 +1,46 @@
1
+ import { CODES } from './codes.js';
2
+ import { reasonOf } from './reason.js';
3
+ /**
4
+ * Reasons for a request refused before any work was admitted. The same request may be sent again
5
+ * once `retryAfterMs` has elapsed; every other public error keeps its own retry meaning.
6
+ */
7
+ export const RETRY_REASONS = Object.freeze({
8
+ /** A bounded Kernel resource is exhausted. */
9
+ CAPACITY_EXHAUSTED: 'CAPACITY_EXHAUSTED',
10
+ /** The server stopped admitting work before it shuts down. */
11
+ SERVER_DRAINING: 'SERVER_DRAINING',
12
+ /** The Instance is under a maintenance session that admits only its root operator. */
13
+ INSTANCE_MAINTENANCE: 'INSTANCE_MAINTENANCE',
14
+ });
15
+ /** One hour bounds a hint that only schedules the next attempt. */
16
+ export const MAXIMUM_RETRY_AFTER_MS = 3_600_000;
17
+ const CODES_SET = new Set(Object.values(RETRY_REASONS));
18
+ export function retryReason(code, retryAfterMs) {
19
+ if (!CODES_SET.has(code))
20
+ throw new TypeError('Retry reason code is invalid.');
21
+ if (!isRetryAfter(retryAfterMs))
22
+ throw new TypeError('Retry reason retryAfterMs is invalid.');
23
+ return Object.freeze({ code, details: Object.freeze({ retryAfterMs }) });
24
+ }
25
+ /** Return the retry delay of a back-pressure, draining or maintenance refusal, and nothing else. */
26
+ export function retryAfterOf(error) {
27
+ if (error.code !== CODES.BACKEND_UNAVAILABLE)
28
+ return undefined;
29
+ const reason = reasonOf(error.data);
30
+ if (reason === undefined || !CODES_SET.has(reason.code))
31
+ return undefined;
32
+ const retryAfterMs = reason.details.retryAfterMs;
33
+ return isRetryAfter(retryAfterMs) ? retryAfterMs : undefined;
34
+ }
35
+ /** Present a retry delay as an HTTP `Retry-After` delta in whole seconds, rounded up. */
36
+ export function retryAfterField(retryAfterMs) {
37
+ if (!isRetryAfter(retryAfterMs))
38
+ throw new TypeError('Retry-After delay is invalid.');
39
+ return String(Math.ceil(retryAfterMs / 1_000));
40
+ }
41
+ function isRetryAfter(input) {
42
+ return (typeof input === 'number' &&
43
+ Number.isSafeInteger(input) &&
44
+ input >= 0 &&
45
+ input <= MAXIMUM_RETRY_AFTER_MS);
46
+ }
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export * as artifact from './artifact/index.js';
2
2
  export * as invocation from './invocation/index.js';
3
3
  export * as codecs from './codecs/index.js';
4
4
  export * as errors from './errors/index.js';
5
- export * as publication from './publication/index.js';
5
+ export * as release from './release/index.js';
6
6
  export * as schema from './schema/index.js';
7
7
  export * as routes from './routes/index.js';
8
8
  export * as issuer from './issuer/index.js';
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ export * as artifact from './artifact/index.js';
2
2
  export * as invocation from './invocation/index.js';
3
3
  export * as codecs from './codecs/index.js';
4
4
  export * as errors from './errors/index.js';
5
- export * as publication from './publication/index.js';
5
+ export * as release from './release/index.js';
6
6
  export * as schema from './schema/index.js';
7
7
  export * as routes from './routes/index.js';
8
8
  export * as issuer from './issuer/index.js';
@@ -3,7 +3,7 @@ import { NodePath } from '@astrale-os/kernel-core/path';
3
3
  import { Key } from '@astrale-os/kernel-dsl/v1/addressing';
4
4
  import { type Object as ValueObject } from '@astrale-os/kernel-dsl/value';
5
5
  import type { ErrorPayload } from '../errors/index.js';
6
- import type { Etag } from '../publication/index.js';
6
+ import type { Sha256Digest } from '../release/digest.js';
7
7
  import { type RequestId } from './correlation.js';
8
8
  import { type InvocationId } from './identity.js';
9
9
  export declare function portableObject(input: unknown, label: string): ValueObject;
@@ -16,7 +16,7 @@ export declare function nodePath(input: unknown, label: string): NodePath;
16
16
  export declare function issuerId(input: unknown, label: string): IssuerId;
17
17
  export declare function string(input: unknown, label: string): string;
18
18
  export declare function count(input: unknown, label: string): number;
19
- export declare function digest(input: unknown, label: string): Etag;
19
+ export declare function digest(input: unknown, label: string): Sha256Digest;
20
20
  export declare function callableKey(input: unknown, label: string): Key.Callable;
21
21
  export declare function errorPayload(input: unknown, label: string): ErrorPayload;
22
22
  export declare function acceptHeaders(input: unknown): Readonly<Record<string, string>>;
@@ -2,14 +2,14 @@ import { AuthValueError } from '@astrale-os/kernel-core/auth/error';
2
2
  import { accept as acceptIssuer } from '@astrale-os/kernel-core/auth/issuer';
3
3
  import { NodePath, PathError } from '@astrale-os/kernel-core/path';
4
4
  import { callableAddress, Key } from '@astrale-os/kernel-dsl/v1/addressing';
5
- import { accept as acceptValue, BoundaryError, } from '@astrale-os/kernel-dsl/value';
5
+ import { acceptForRead, BoundaryError, } from '@astrale-os/kernel-dsl/value';
6
6
  import { CODES, acceptPayload, ProtocolError } from '../errors/index.js';
7
7
  import { acceptRequestId } from './correlation.js';
8
8
  import { acceptInvocationId, InvocationError } from './identity.js';
9
9
  export function portableObject(input, label) {
10
- let cloned;
10
+ let snapshot;
11
11
  try {
12
- cloned = acceptValue(input);
12
+ snapshot = acceptForRead(input);
13
13
  }
14
14
  catch (cause) {
15
15
  if (cause instanceof BoundaryError) {
@@ -17,9 +17,9 @@ export function portableObject(input, label) {
17
17
  }
18
18
  throw cause;
19
19
  }
20
- if (!isValueObject(cloned))
20
+ if (!isValueObject(snapshot))
21
21
  invalid(`${label} must be an object`);
22
- return cloned;
22
+ return snapshot;
23
23
  }
24
24
  export function exactDataObject(input, label) {
25
25
  if (input === null || typeof input !== 'object' || Array.isArray(input)) {
@@ -6,6 +6,7 @@ export interface BinaryResponse {
6
6
  readonly invocation: InvocationId;
7
7
  readonly body: Uint8Array;
8
8
  readonly mediaType: string;
9
+ readonly status: number;
9
10
  readonly headers?: Readonly<Record<string, string>>;
10
11
  }
11
12
  export declare function decodeBinaryResponse(input: unknown): BinaryResponse;
@@ -1,6 +1,14 @@
1
+ import { canonicalMediaType } from '../artifact/index.js';
1
2
  import { acceptHeaders, exactDataObject, exactFields, invalid, invocation, requestId, required, string, } from './admission.js';
2
- const FIELDS = new Set(['kind', 'requestId', 'invocation', 'body', 'mediaType', 'headers']);
3
- const MEDIA_TYPE = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/u;
3
+ const FIELDS = new Set([
4
+ 'kind',
5
+ 'requestId',
6
+ 'invocation',
7
+ 'body',
8
+ 'mediaType',
9
+ 'status',
10
+ 'headers',
11
+ ]);
4
12
  export function decodeBinaryResponse(input) {
5
13
  const object = exactDataObject(input, 'binary response');
6
14
  exactFields(object, FIELDS, 'binary response');
@@ -9,9 +17,17 @@ export function decodeBinaryResponse(input) {
9
17
  invalid('binary response.kind must be "binary"');
10
18
  if (!(object.body instanceof Uint8Array))
11
19
  invalid('binary response.body must be a Uint8Array');
12
- const mediaType = string(object.mediaType, 'binary response.mediaType');
13
- if (!MEDIA_TYPE.test(mediaType))
20
+ let mediaType;
21
+ try {
22
+ mediaType = canonicalMediaType(string(object.mediaType, 'binary response.mediaType'));
23
+ }
24
+ catch {
14
25
  invalid('binary response.mediaType is invalid');
26
+ }
27
+ const status = object.status ?? 200;
28
+ if (!Number.isInteger(status) || status < 200 || status > 599) {
29
+ invalid('binary response.status is invalid');
30
+ }
15
31
  const headers = object.headers === undefined ? undefined : acceptHeaders(object.headers);
16
32
  return Object.freeze({
17
33
  kind: 'binary',
@@ -19,6 +35,7 @@ export function decodeBinaryResponse(input) {
19
35
  invocation: invocation(object.invocation, 'binary response.invocation'),
20
36
  body: new Uint8Array(object.body),
21
37
  mediaType,
38
+ status: status,
22
39
  ...(headers === undefined ? {} : { headers }),
23
40
  });
24
41
  }
@@ -1,8 +1,9 @@
1
1
  import type { Codec } from '../codecs/codec.js';
2
- export type CodecProfile = 'json' | 'msgpack';
3
- export interface SupportedCodec {
2
+ type CodecProfile = 'json';
3
+ interface SupportedCodec {
4
4
  readonly codec: Codec;
5
5
  readonly profile: CodecProfile;
6
6
  }
7
7
  export declare function codecProfile(codec: Codec): CodecProfile | undefined;
8
8
  export declare function admitSupportedCodecs(supported: readonly Codec[]): readonly SupportedCodec[];
9
+ export {};
@@ -1,11 +1,6 @@
1
1
  import { json } from '../codecs/json.js';
2
- import { isMsgpackCodec } from '../codecs/msgpack.js';
3
2
  export function codecProfile(codec) {
4
- if (codec === json)
5
- return 'json';
6
- if (isMsgpackCodec(codec))
7
- return 'msgpack';
8
- return undefined;
3
+ return codec === json ? 'json' : undefined;
9
4
  }
10
5
  export function admitSupportedCodecs(supported) {
11
6
  if (!Array.isArray(supported))
@@ -1,24 +1,4 @@
1
- export declare namespace Delegate {
2
- type Expr = {
3
- readonly kind: 'identity';
4
- readonly self: true;
5
- } | {
6
- readonly kind: 'identity';
7
- readonly credential: string;
8
- } | {
9
- readonly kind: 'union';
10
- readonly operands: readonly Expr[];
11
- } | {
12
- readonly kind: 'intersect';
13
- readonly operands: readonly Expr[];
14
- } | {
15
- readonly kind: 'exclude';
16
- readonly base: Expr;
17
- readonly excluded: readonly Expr[];
18
- };
19
- }
20
1
  export interface Delegate {
21
2
  readonly ttlSeconds: number;
22
- readonly attenuation?: Delegate.Expr;
23
3
  }
24
4
  export declare function acceptDelegate(input: unknown): Delegate;
@@ -1,6 +1,5 @@
1
- import { AuthValueError, grant } from '@astrale-os/kernel-core/auth';
2
1
  import { exactDataObject, exactFields, invalid, required } from './admission.js';
3
- const FIELDS = new Set(['ttlSeconds', 'attenuation']);
2
+ const FIELDS = new Set(['ttlSeconds']);
4
3
  export function acceptDelegate(input) {
5
4
  const object = exactDataObject(input, 'delegate');
6
5
  exactFields(object, FIELDS, 'delegate');
@@ -8,36 +7,5 @@ export function acceptDelegate(input) {
8
7
  if (!Number.isSafeInteger(object.ttlSeconds) || object.ttlSeconds < 1) {
9
8
  invalid('delegate.ttlSeconds must be a positive safe integer');
10
9
  }
11
- let attenuation;
12
- if (object.attenuation !== undefined) {
13
- try {
14
- attenuation = grant.acceptUnresolved({ v: 1, expr: object.attenuation }).expr;
15
- }
16
- catch (cause) {
17
- if (cause instanceof AuthValueError)
18
- invalid('delegate.attenuation must be a valid expression');
19
- throw cause;
20
- }
21
- requireTextCredentials(attenuation);
22
- }
23
- return Object.freeze({
24
- ttlSeconds: object.ttlSeconds,
25
- ...(attenuation === undefined ? {} : { attenuation: attenuation }),
26
- });
27
- }
28
- function requireTextCredentials(input) {
29
- if (input.kind === 'identity') {
30
- if ('credential' in input && typeof input.credential !== 'string') {
31
- invalid('delegate.attenuation credentials must be non-empty text');
32
- }
33
- return;
34
- }
35
- if (input.kind === 'exclude') {
36
- requireTextCredentials(input.base);
37
- for (const operand of input.excluded)
38
- requireTextCredentials(operand);
39
- return;
40
- }
41
- for (const operand of input.operands)
42
- requireTextCredentials(operand);
10
+ return Object.freeze({ ttlSeconds: object.ttlSeconds });
43
11
  }
@@ -1,11 +1,13 @@
1
1
  import { type InvocationId } from '../identity.js';
2
2
  export declare const BINARY_HEADERS_FIELD: 'x-astrale-binary-headers';
3
+ export declare const BINARY_DELIVERY_FIELD: 'x-astrale-binary-delivery';
4
+ export declare const STREAMING_BINARY_DELIVERY: 'streaming';
3
5
  export declare const REQUEST_ID_FIELD: 'x-astrale-request-id';
4
6
  export declare const INVOCATION_FIELD: 'x-astrale-invocation';
5
7
  export declare const MAXIMUM_INVOCATION_FIELD_BYTES = 8192;
6
8
  /** Encode one admitted InvocationId as percent-encoded source plus opaque ID. */
7
9
  export declare function encodeInvocationId(input: InvocationId): string;
8
- /** Decode one complete finite-binary InvocationId field. */
10
+ /** Decode one complete binary InvocationId field. */
9
11
  export declare function decodeInvocationId(input: string | null): InvocationId;
10
12
  export declare function isApplicationBinaryHeader(name: string): boolean;
11
13
  export declare function encodeBinaryHeaderNames(headers: Readonly<Record<string, string>> | undefined): string;
@@ -1,6 +1,9 @@
1
1
  import { CODES, ProtocolError } from '../../errors/index.js';
2
2
  import { acceptInvocationId } from '../identity.js';
3
+ import { BINARY_LENGTH_FIELD } from './request.js';
3
4
  export const BINARY_HEADERS_FIELD = 'x-astrale-binary-headers';
5
+ export const BINARY_DELIVERY_FIELD = 'x-astrale-binary-delivery';
6
+ export const STREAMING_BINARY_DELIVERY = 'streaming';
4
7
  export const REQUEST_ID_FIELD = 'x-astrale-request-id';
5
8
  export const INVOCATION_FIELD = 'x-astrale-invocation';
6
9
  export const MAXIMUM_INVOCATION_FIELD_BYTES = 8_192;
@@ -33,6 +36,8 @@ const RESERVED = new Set([
33
36
  'www-authenticate',
34
37
  EMPTY_MANIFEST,
35
38
  BINARY_HEADERS_FIELD,
39
+ BINARY_DELIVERY_FIELD,
40
+ BINARY_LENGTH_FIELD,
36
41
  INVOCATION_FIELD,
37
42
  REQUEST_ID_FIELD,
38
43
  'x-astrale-stream-framing',
@@ -52,7 +57,7 @@ export function encodeInvocationId(input) {
52
57
  }
53
58
  return encoded;
54
59
  }
55
- /** Decode one complete finite-binary InvocationId field. */
60
+ /** Decode one complete binary InvocationId field. */
56
61
  export function decodeInvocationId(input) {
57
62
  if (input === null ||
58
63
  input.length === 0 ||
@@ -1,4 +1,5 @@
1
- export { BINARY_HEADERS_FIELD, decodeBinaryHeaderNames, decodeInvocationId, encodeBinaryHeaderNames, encodeInvocationId, isApplicationBinaryHeader, MAXIMUM_INVOCATION_FIELD_BYTES, INVOCATION_FIELD, REQUEST_ID_FIELD, } from './binary.js';
1
+ export { BINARY_DELIVERY_FIELD, BINARY_HEADERS_FIELD, decodeBinaryHeaderNames, decodeInvocationId, encodeBinaryHeaderNames, encodeInvocationId, isApplicationBinaryHeader, MAXIMUM_INVOCATION_FIELD_BYTES, INVOCATION_FIELD, REQUEST_ID_FIELD, STREAMING_BINARY_DELIVERY, } from './binary.js';
2
2
  export { codecForContentType, negotiateResponseCodec } from './negotiation.js';
3
+ export { BINARY_LENGTH_FIELD, BINARY_REQUEST_CONTENT_TYPE, decodeBinaryLength, decodeBinaryRequestEnvelope, encodeBinaryRequestEnvelope, MAXIMUM_REQUEST_ENVELOPE_BYTES, REQUEST_ENVELOPE_FIELD, } from './request.js';
3
4
  export { encodeStreamFrame, LENGTH_PREFIX_V1, STREAM_FRAMING_FIELD } from './stream.js';
4
5
  export { BAGGAGE_FIELD, decodeTraceHeaders, encodeTraceHeaders, TRACEPARENT_FIELD, TRACESTATE_FIELD, } from './trace.js';
@@ -1,4 +1,5 @@
1
- export { BINARY_HEADERS_FIELD, decodeBinaryHeaderNames, decodeInvocationId, encodeBinaryHeaderNames, encodeInvocationId, isApplicationBinaryHeader, MAXIMUM_INVOCATION_FIELD_BYTES, INVOCATION_FIELD, REQUEST_ID_FIELD, } from './binary.js';
1
+ export { BINARY_DELIVERY_FIELD, BINARY_HEADERS_FIELD, decodeBinaryHeaderNames, decodeInvocationId, encodeBinaryHeaderNames, encodeInvocationId, isApplicationBinaryHeader, MAXIMUM_INVOCATION_FIELD_BYTES, INVOCATION_FIELD, REQUEST_ID_FIELD, STREAMING_BINARY_DELIVERY, } from './binary.js';
2
2
  export { codecForContentType, negotiateResponseCodec } from './negotiation.js';
3
+ export { BINARY_LENGTH_FIELD, BINARY_REQUEST_CONTENT_TYPE, decodeBinaryLength, decodeBinaryRequestEnvelope, encodeBinaryRequestEnvelope, MAXIMUM_REQUEST_ENVELOPE_BYTES, REQUEST_ENVELOPE_FIELD, } from './request.js';
3
4
  export { encodeStreamFrame, LENGTH_PREFIX_V1, STREAM_FRAMING_FIELD } from './stream.js';
4
5
  export { BAGGAGE_FIELD, decodeTraceHeaders, encodeTraceHeaders, TRACEPARENT_FIELD, TRACESTATE_FIELD, } from './trace.js';
@@ -1,4 +1,4 @@
1
- import { CONTENT_TYPE_JSON, CONTENT_TYPE_MSGPACK } from '../../codecs/index.js';
1
+ import { CONTENT_TYPE_JSON } from '../../codecs/index.js';
2
2
  import { admitSupportedCodecs } from '../binding-codecs.js';
3
3
  const TOKEN = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/u;
4
4
  const QVALUE = /^(?:0(?:\.\d{0,3})?|1(?:\.0{0,3})?)$/u;
@@ -9,11 +9,7 @@ export function codecForContentType(contentType, supported) {
9
9
  const mediaType = parseContentType(contentType);
10
10
  if (mediaType === undefined)
11
11
  return undefined;
12
- const profile = mediaType === CONTENT_TYPE_JSON
13
- ? 'json'
14
- : mediaType === CONTENT_TYPE_MSGPACK
15
- ? 'msgpack'
16
- : undefined;
12
+ const profile = mediaType === CONTENT_TYPE_JSON ? 'json' : undefined;
17
13
  return admitted.find((entry) => entry.profile === profile)?.codec;
18
14
  }
19
15
  export function negotiateResponseCodec(accept, requestCodec, supported) {
@@ -27,7 +23,7 @@ export function negotiateResponseCodec(accept, requestCodec, supported) {
27
23
  if (ranges.length === 0)
28
24
  return undefined;
29
25
  const candidates = admitted.flatMap((entry) => {
30
- const [type, subtype] = contentTypeOf(entry.profile).split('/');
26
+ const [type, subtype] = CONTENT_TYPE_JSON.split('/');
31
27
  const governing = ranges
32
28
  .filter((range) => range.mediaParameters === 0 &&
33
29
  (range.type === '*' || range.type === type) &&
@@ -56,9 +52,6 @@ export function negotiateResponseCodec(accept, requestCodec, supported) {
56
52
  });
57
53
  return candidates[0]?.codec;
58
54
  }
59
- function contentTypeOf(profile) {
60
- return profile === 'json' ? CONTENT_TYPE_JSON : CONTENT_TYPE_MSGPACK;
61
- }
62
55
  function parseContentType(input) {
63
56
  if (splitOutsideQuotes(input, ',')?.length !== 1)
64
57
  return undefined;
@@ -0,0 +1,11 @@
1
+ import { type Request } from '../request.js';
2
+ export declare const REQUEST_ENVELOPE_FIELD: 'x-astrale-request';
3
+ export declare const BINARY_LENGTH_FIELD: 'x-astrale-binary-length';
4
+ export declare const BINARY_REQUEST_CONTENT_TYPE: 'application/octet-stream';
5
+ export declare const MAXIMUM_REQUEST_ENVELOPE_BYTES = 8192;
6
+ /** Decode one declared byte count: a canonical unsigned decimal within the safe integer range. */
7
+ export declare function decodeBinaryLength(input: string): number | undefined;
8
+ /** Encode one canonical V2 Request into the binary-request HTTP field. */
9
+ export declare function encodeBinaryRequestEnvelope(input: Request): string;
10
+ /** Decode one bounded base64url JSON V2 Request from the binary-request HTTP field. */
11
+ export declare function decodeBinaryRequestEnvelope(input: string | null): Request;
@@ -0,0 +1,69 @@
1
+ import { json } from '../../codecs/index.js';
2
+ import { CODES, ProtocolError } from '../../errors/index.js';
3
+ import { decodeRequest } from '../request.js';
4
+ export const REQUEST_ENVELOPE_FIELD = 'x-astrale-request';
5
+ export const BINARY_LENGTH_FIELD = 'x-astrale-binary-length';
6
+ export const BINARY_REQUEST_CONTENT_TYPE = 'application/octet-stream';
7
+ export const MAXIMUM_REQUEST_ENVELOPE_BYTES = 8_192;
8
+ const BASE64URL = /^[A-Za-z0-9_-]+$/u;
9
+ const MAXIMUM_ENCODED_BYTES = Math.ceil(MAXIMUM_REQUEST_ENVELOPE_BYTES / 3) * 4;
10
+ const DECIMAL = /^(?:0|[1-9][0-9]*)$/u;
11
+ /** Decode one declared byte count: a canonical unsigned decimal within the safe integer range. */
12
+ export function decodeBinaryLength(input) {
13
+ if (!DECIMAL.test(input))
14
+ return undefined;
15
+ const length = Number(input);
16
+ return Number.isSafeInteger(length) ? length : undefined;
17
+ }
18
+ /** Encode one canonical V2 Request into the binary-request HTTP field. */
19
+ export function encodeBinaryRequestEnvelope(input) {
20
+ const request = decodeRequest(input);
21
+ const encoded = json.encode(request);
22
+ if (typeof encoded !== 'string')
23
+ throw new TypeError('JSON Request codec returned non-text output.');
24
+ const bytes = new TextEncoder().encode(encoded);
25
+ if (bytes.byteLength > MAXIMUM_REQUEST_ENVELOPE_BYTES)
26
+ return invalid();
27
+ return btoa(String.fromCharCode(...bytes))
28
+ .replaceAll('+', '-')
29
+ .replaceAll('/', '_')
30
+ .replace(/=+$/u, '');
31
+ }
32
+ /** Decode one bounded base64url JSON V2 Request from the binary-request HTTP field. */
33
+ export function decodeBinaryRequestEnvelope(input) {
34
+ if (input === null ||
35
+ input.length === 0 ||
36
+ input.length > MAXIMUM_ENCODED_BYTES ||
37
+ !BASE64URL.test(input)) {
38
+ return invalid();
39
+ }
40
+ let bytes;
41
+ try {
42
+ const binary = atob(input.replaceAll('-', '+').replaceAll('_', '/') + '='.repeat((4 - (input.length % 4)) % 4));
43
+ bytes = Uint8Array.from(binary, (character) => character.charCodeAt(0));
44
+ }
45
+ catch {
46
+ return invalid();
47
+ }
48
+ if (bytes.byteLength > MAXIMUM_REQUEST_ENVELOPE_BYTES)
49
+ return invalid();
50
+ try {
51
+ // Require canonical base64url so alternate encodings cannot name the same envelope.
52
+ const canonical = btoa(String.fromCharCode(...bytes))
53
+ .replaceAll('+', '-')
54
+ .replaceAll('/', '_')
55
+ .replace(/=+$/u, '');
56
+ if (canonical !== input)
57
+ return invalid();
58
+ return decodeRequest(json.decode(bytes));
59
+ }
60
+ catch {
61
+ return invalid();
62
+ }
63
+ }
64
+ function invalid() {
65
+ throw new ProtocolError({
66
+ code: CODES.INVALID_REQUEST,
67
+ message: 'HTTP binary Request envelope is invalid.',
68
+ });
69
+ }
@@ -5,16 +5,17 @@ export { acceptIdempotencyKey, HTTP_IDEMPOTENCY_KEY, MAXIMUM_IDEMPOTENCY_KEY_LEN
5
5
  export { acceptInvocationId, InvocationError, MAXIMUM_INVOCATION_ID_LENGTH, sameInvocationId, type InvocationId, } from './identity.js';
6
6
  export * as http from './http/index.js';
7
7
  export { acceptDelegate, type Delegate } from './delegate.js';
8
+ export { acceptMaintenance, MAXIMUM_MAINTENANCE_SESSION_LENGTH, type Maintenance, type MaintenanceSession, } from './maintenance.js';
8
9
  export { decodeMiss, miss, type Miss } from './miss.js';
9
10
  export { acceptRoute, acceptRedirection, decodeRedirectResponse, remoteRoute, type RemoteBindingInput, type Redirection, type RedirectResponse, type Route, } from './redirect.js';
10
11
  export { decodeRequest, type Request } from './request.js';
11
12
  export { admitTrace, MAXIMUM_TRACEPARENT_BYTES, MAXIMUM_TRACESTATE_BYTES, MAXIMUM_TRACESTATE_MEMBERS, type Trace, } from './trace.js';
12
- export { acceptRouting, type Refresh, type Routing, type Via } from './routing.js';
13
+ export { acceptRouting, routedDigest, routedRevision, type Refresh, type Routing, type Via, } from './routing.js';
13
14
  export { acceptSchemaTarget, type SchemaTarget } from './schema.js';
14
- export { decodeResponse, type ErrorResponse, type Response, type ResponseContext, type SuccessResponse, } from './response.js';
15
- export { SCHEMA_UPGRADE_REQUIRED, SCHEMA_REVISION_MISMATCH, SERVICE_CANDIDATE_INVALID, SERVICE_TRUST_REQUIRED, SERVICE_UNAVAILABLE, serviceErrorOf, type SchemaUpgradeRequiredDetails, type SchemaUpgradeRequiredReason, type SchemaRevisionMismatchDetails, type SchemaRevisionMismatchReason, type ServiceCandidateInvalidDetails, type ServiceCandidateInvalidReason, type ServiceErrorPayload, type ServiceReason, type ServiceTrustRequiredDetails, type ServiceTrustRequiredReason, type ServiceUnavailableDetails, type ServiceUnavailableReason, } from './service-reason.js';
15
+ export { decodeResponse, type ErrorResponse, type ExecutionResponse, type Response, type ResponseContext, type SuccessResponse, } from './response.js';
16
+ export { CALLABLE_FINGERPRINT_MISMATCH, DEPLOYMENT_RETIRED, SERVICE_CANDIDATE_INVALID, SERVICE_TRUST_REQUIRED, SERVICE_UNAVAILABLE, serviceErrorOf, type CallableFingerprintMismatchDetails, type CallableFingerprintMismatchReason, type DeploymentRetiredDetails, type DeploymentRetiredReason, type ServiceCandidateInvalidDetails, type ServiceCandidateInvalidReason, type ServiceErrorPayload, type ServiceReason, type ServiceTrustRequiredDetails, type ServiceTrustRequiredReason, type ServiceUnavailableDetails, type ServiceUnavailableReason, } from './service-reason.js';
16
17
  export { decodeStale, stale, type Stale } from './stale-route.js';
17
18
  export { decodeStreamFrame, type StreamEndFrame, type StreamErrorFrame, type StreamFrame, type StreamItemFrame, type StreamStartFrame, } from './stream.js';
18
- export { acceptCall, type Call } from './target.js';
19
+ export { Target, targetPath, acceptCall, type Call } from './target.js';
19
20
  export { VERSION, type Version } from './version.js';
20
21
  export * as websocket from './websocket/index.js';
@@ -5,16 +5,17 @@ export { acceptIdempotencyKey, HTTP_IDEMPOTENCY_KEY, MAXIMUM_IDEMPOTENCY_KEY_LEN
5
5
  export { acceptInvocationId, InvocationError, MAXIMUM_INVOCATION_ID_LENGTH, sameInvocationId, } from './identity.js';
6
6
  export * as http from './http/index.js';
7
7
  export { acceptDelegate } from './delegate.js';
8
+ export { acceptMaintenance, MAXIMUM_MAINTENANCE_SESSION_LENGTH, } from './maintenance.js';
8
9
  export { decodeMiss, miss } from './miss.js';
9
10
  export { acceptRoute, acceptRedirection, decodeRedirectResponse, remoteRoute, } from './redirect.js';
10
11
  export { decodeRequest } from './request.js';
11
12
  export { admitTrace, MAXIMUM_TRACEPARENT_BYTES, MAXIMUM_TRACESTATE_BYTES, MAXIMUM_TRACESTATE_MEMBERS, } from './trace.js';
12
- export { acceptRouting } from './routing.js';
13
+ export { acceptRouting, routedDigest, routedRevision, } from './routing.js';
13
14
  export { acceptSchemaTarget } from './schema.js';
14
15
  export { decodeResponse, } from './response.js';
15
- export { SCHEMA_UPGRADE_REQUIRED, SCHEMA_REVISION_MISMATCH, SERVICE_CANDIDATE_INVALID, SERVICE_TRUST_REQUIRED, SERVICE_UNAVAILABLE, serviceErrorOf, } from './service-reason.js';
16
+ export { CALLABLE_FINGERPRINT_MISMATCH, DEPLOYMENT_RETIRED, SERVICE_CANDIDATE_INVALID, SERVICE_TRUST_REQUIRED, SERVICE_UNAVAILABLE, serviceErrorOf, } from './service-reason.js';
16
17
  export { decodeStale, stale } from './stale-route.js';
17
18
  export { decodeStreamFrame, } from './stream.js';
18
- export { acceptCall } from './target.js';
19
+ export { Target, targetPath, acceptCall } from './target.js';
19
20
  export { VERSION } from './version.js';
20
21
  export * as websocket from './websocket/index.js';
@@ -0,0 +1,14 @@
1
+ declare const MAINTENANCE_SESSION: unique symbol;
2
+ /** Identity of the install Execution that owns one maintenance session; it grants no authority. */
3
+ export type MaintenanceSession = string & {
4
+ readonly [MAINTENANCE_SESSION]: true;
5
+ };
6
+ /** Source-Kernel guard naming the maintenance session a root request expects to act within. */
7
+ export interface Maintenance {
8
+ readonly session: MaintenanceSession;
9
+ }
10
+ /** An Execution identifier: 1-255 ASCII characters drawn from `[A-Za-z0-9._-]`. */
11
+ export declare const MAXIMUM_MAINTENANCE_SESSION_LENGTH = 255;
12
+ /** Admit one exact maintenance guard without deciding whether its session is active. */
13
+ export declare function acceptMaintenance(input: unknown): Maintenance;
14
+ export {};