@astrale-os/kernel-client 0.6.0-beta.86 → 0.6.0-beta.87

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 (104) hide show
  1. package/dist/auth/identity.d.ts +2 -1
  2. package/dist/client/credential.d.ts +2 -1
  3. package/dist/errors/stale-route-error.d.ts +4 -14
  4. package/dist/errors/stale-route-error.js +2 -13
  5. package/dist/errors/transport-error.d.ts +1 -1
  6. package/dist/graph/domain/domain.typecheck.js +1 -0
  7. package/dist/graph/index.d.ts +1 -1
  8. package/dist/graph/index.js +1 -1
  9. package/dist/schema/introspection.js +1 -5
  10. package/dist/schema/schema.js +4 -8
  11. package/dist/session/bound.d.ts +1 -1
  12. package/dist/session/bound.js +2 -1
  13. package/dist/session/content/api.d.ts +45 -0
  14. package/dist/session/content/api.js +28 -0
  15. package/dist/session/content/batch.d.ts +5 -0
  16. package/dist/session/content/batch.js +93 -0
  17. package/dist/session/content/index.d.ts +1 -0
  18. package/dist/session/content/index.js +1 -0
  19. package/dist/session/content/input.d.ts +9 -0
  20. package/dist/session/content/input.js +33 -0
  21. package/dist/session/content/parts.d.ts +36 -0
  22. package/dist/session/content/parts.js +154 -0
  23. package/dist/session/content/retry.d.ts +3 -0
  24. package/dist/session/content/retry.js +41 -0
  25. package/dist/session/content/wire.d.ts +12 -0
  26. package/dist/session/content/wire.js +60 -0
  27. package/dist/session/context/index.d.ts +1 -1
  28. package/dist/session/context/index.js +1 -1
  29. package/dist/session/context/limits.d.ts +0 -1
  30. package/dist/session/context/limits.js +0 -1
  31. package/dist/session/context/operation.d.ts +0 -1
  32. package/dist/session/context/operation.js +1 -1
  33. package/dist/session/context/policy.d.ts +0 -1
  34. package/dist/session/context/policy.js +0 -16
  35. package/dist/session/discovery/bundle.d.ts +4 -3
  36. package/dist/session/discovery/bundle.js +20 -21
  37. package/dist/session/discovery/discovery.d.ts +0 -3
  38. package/dist/session/discovery/discovery.js +6 -14
  39. package/dist/session/discovery/index.d.ts +0 -5
  40. package/dist/session/discovery/index.js +1 -2
  41. package/dist/session/discovery/release.d.ts +6 -5
  42. package/dist/session/discovery/release.js +3 -3
  43. package/dist/session/discovery/snapshot.d.ts +1 -8
  44. package/dist/session/discovery/snapshot.js +2 -2
  45. package/dist/session/exchange/domain.js +1 -1
  46. package/dist/session/exchange/source.d.ts +2 -1
  47. package/dist/session/index.d.ts +3 -2
  48. package/dist/session/index.js +1 -1
  49. package/dist/session/options.d.ts +65 -0
  50. package/dist/session/options.js +132 -0
  51. package/dist/session/routing/cache.d.ts +9 -14
  52. package/dist/session/routing/cache.js +17 -178
  53. package/dist/session/routing/dispatch.d.ts +4 -3
  54. package/dist/session/routing/dispatch.js +63 -113
  55. package/dist/session/routing/envelope.d.ts +3 -3
  56. package/dist/session/routing/expiry.d.ts +4 -0
  57. package/dist/session/routing/expiry.js +32 -0
  58. package/dist/session/routing/index.d.ts +4 -2
  59. package/dist/session/routing/index.js +4 -2
  60. package/dist/session/routing/integrity.d.ts +7 -0
  61. package/dist/session/routing/integrity.js +44 -0
  62. package/dist/session/routing/recovery.d.ts +16 -0
  63. package/dist/session/routing/recovery.js +41 -0
  64. package/dist/session/routing/result.d.ts +5 -0
  65. package/dist/session/routing/result.js +12 -0
  66. package/dist/session/routing/store.d.ts +23 -0
  67. package/dist/session/routing/store.js +99 -0
  68. package/dist/session/session.d.ts +6 -50
  69. package/dist/session/session.js +28 -134
  70. package/dist/session/session.typecheck.js +8 -3
  71. package/dist/session/views/catalog.d.ts +5 -9
  72. package/dist/session/views/catalog.js +12 -24
  73. package/dist/session/views/resolve.d.ts +1 -1
  74. package/dist/session/views/resolve.js +1 -1
  75. package/dist/store/entity-index.d.ts +1 -2
  76. package/dist/store/entity-index.js +0 -3
  77. package/dist/store/memory.js +2 -2
  78. package/dist/store/shape.d.ts +2 -1
  79. package/dist/transport/auto/decision.d.ts +3 -2
  80. package/dist/transport/http/admission.d.ts +5 -0
  81. package/dist/transport/http/admission.js +101 -0
  82. package/dist/transport/http/binary.d.ts +5 -0
  83. package/dist/transport/http/binary.js +70 -0
  84. package/dist/transport/http/configuration.d.ts +24 -0
  85. package/dist/transport/http/configuration.js +116 -0
  86. package/dist/transport/http/index.d.ts +2 -1
  87. package/dist/transport/http/response.d.ts +7 -0
  88. package/dist/transport/http/response.js +9 -0
  89. package/dist/transport/http/retired.d.ts +8 -0
  90. package/dist/transport/http/retired.js +28 -0
  91. package/dist/transport/http/transport.d.ts +1 -19
  92. package/dist/transport/http/transport.js +17 -299
  93. package/dist/transport/websocket/connection.d.ts +2 -1
  94. package/package.json +5 -5
  95. package/dist/session/content.d.ts +0 -27
  96. package/dist/session/content.js +0 -135
  97. package/dist/session/discovery/legacy/index.d.ts +0 -38
  98. package/dist/session/discovery/legacy/index.js +0 -38
  99. package/dist/session/discovery/legacy/intrinsic.d.ts +0 -33
  100. package/dist/session/discovery/legacy/intrinsic.js +0 -67
  101. package/dist/session/discovery/legacy/projection.d.ts +0 -8
  102. package/dist/session/discovery/legacy/projection.js +0 -17
  103. package/dist/session/discovery/legacy/publication.d.ts +0 -26
  104. package/dist/session/discovery/legacy/publication.js +0 -76
@@ -1,55 +1,19 @@
1
1
  import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
2
2
  import type { PathLike } from '@astrale-os/kernel-core/path';
3
3
  import type { Domain } from '@astrale-os/kernel-dsl/v1/domain';
4
- import type { publication } from '@astrale-os/kernel-protocol';
5
4
  import type { AuthApi } from '../auth/index.js';
6
5
  import type { Call, Input, Result } from '../client/index.js';
7
6
  import type { DomainBinding, GraphApi } from '../graph/index.js';
8
- import type { ClientFactory, ClientPool as ClientPoolType } from '../pool/index.js';
9
7
  import type { SchemaApi } from '../schema/index.js';
10
- import type { ClientWarning } from '../transport/auto/index.js';
11
- import type { Fetch } from '../transport/http/index.js';
12
- import type { WebSocketConstructor } from '../transport/websocket/index.js';
13
- import type { ContentApi } from './content.js';
8
+ import type { ContentApi } from './content/index.js';
14
9
  import type { SessionControlOptions, SessionPolicy } from './context/index.js';
15
10
  import type { SessionCredential } from './credential/index.js';
16
11
  import type { IntrinsicRelease, SessionSnapshot } from './discovery/index.js';
17
- import type { SessionExchangeOptions, SessionExchangeRequest } from './exchange/index.js';
12
+ import type { SessionExchangeRequest } from './exchange/index.js';
18
13
  import type { CallableReference, InputModeOfReference, InputOfReference, OutputOfReference } from './reference.js';
19
- import type { SessionRouteStore, SessionAuth, SessionEnvelopeTransport, SessionRequestOptions, SessionRequestOptionsWithBody } from './routing/index.js';
14
+ import type { SessionRequestOptions, SessionRequestOptionsWithBody } from './routing/index.js';
20
15
  import type { ViewCatalog } from './views/index.js';
21
- export interface ClientSessionOptions {
22
- /** Exact canonical source Kernel identity; its invocation and discovery endpoints are derived. */
23
- readonly kernel: string;
24
- readonly fetch?: Fetch;
25
- readonly client?: ClientFactory;
26
- readonly pool?: Pick<ClientPoolType, 'clientFor'>;
27
- readonly websocket?: WebSocketConstructor;
28
- readonly auth?: SessionAuth;
29
- /**
30
- * Present each Domain callable with a credential its declaring Domain exchanges for the `auth`
31
- * caller, so the Domain is the principal and the caller is `auth`. Kernel and local callables keep
32
- * the `auth` credential. `connect` defaults to `auto` when `auth` is present; `new ClientSession`
33
- * keeps source authority when this option is omitted. `{ mode: 'source' }` keeps it for every Call.
34
- */
35
- readonly exchange?: SessionExchangeOptions;
36
- /** Optional caller-owned persistence for bounded confidential route artifacts. */
37
- readonly routeStore?: SessionRouteStore;
38
- readonly policy: SessionPolicy;
39
- readonly envelopeTransport?: SessionEnvelopeTransport;
40
- readonly onWarning?: (warning: ClientWarning) => void;
41
- /** Bounds the source Kernel's own `release.json`. */
42
- readonly maximumReleaseBytes?: number;
43
- /**
44
- * Bounds every Publication the Session reads: the version 3 `domain.json` a Host that predates
45
- * `release.json` serves, and the Publications Schema results carry.
46
- */
47
- readonly maximumPublicationBytes?: number;
48
- readonly maximumBundleBytes?: number;
49
- readonly maximumResponseBytes?: number;
50
- readonly timeoutMs?: number;
51
- readonly schemaLifecycleTimeoutMs?: number;
52
- }
16
+ import { type ClientSessionOptions } from './options.js';
53
17
  export type ConnectOptions = Omit<ClientSessionOptions, 'kernel' | 'policy'> & {
54
18
  readonly url: string;
55
19
  readonly policy?: SessionPolicy;
@@ -61,7 +25,7 @@ export declare class ClientSession {
61
25
  readonly graph: GraphApi;
62
26
  readonly auth: AuthApi;
63
27
  readonly content: ContentApi;
64
- private readonly ownedPool?;
28
+ private readonly ownedPool;
65
29
  private readonly discovery;
66
30
  private readonly dispatcher;
67
31
  private readonly lifecycle;
@@ -81,17 +45,9 @@ export declare class ClientSession {
81
45
  */
82
46
  exchange(domain: string, options?: SessionExchangeRequest): Promise<SessionCredential>;
83
47
  /**
84
- * Revalidate the source Kernel's own release (`release.json`) without acquiring its bundle or
85
- * Views; a Host that predates intrinsic `release.json` yields its version 3 Publication instead.
48
+ * Revalidate the source Kernel's own release (`release.json`) without acquiring its bundle or Views.
86
49
  */
87
50
  release(options?: SessionControlOptions): Promise<IntrinsicRelease>;
88
- /**
89
- * Revalidate the intrinsic release and return its v3 document: the Host's own version 3
90
- * Publication, or the frozen v3 projection of its `DomainRelease`.
91
- *
92
- * @deprecated Use `release()`. Deleted when no supported Host predates intrinsic `release.json`.
93
- */
94
- publication(options?: SessionControlOptions): Promise<publication.Publication>;
95
51
  snapshot(options?: SessionControlOptions): Promise<SessionSnapshot>;
96
52
  /**
97
53
  * Resolve the View catalog of one installed Domain. Only an exact Domain Path `/:<origin>` is
@@ -1,22 +1,19 @@
1
1
  import { Path } from '@astrale-os/kernel-core/path';
2
2
  import { callableFingerprint } from '@astrale-os/kernel-dsl/v1/schema/fingerprint';
3
3
  import { createAuth } from '../auth/auth.js';
4
- import { Client, acceptCall } from '../client/index.js';
4
+ import { acceptCall } from '../client/index.js';
5
5
  import { SessionError } from '../errors/index.js';
6
6
  import { createDomainBinding } from '../graph/domain/binding.js';
7
7
  import { createGraph } from '../graph/index.js';
8
- import { ClientPool } from '../pool/index.js';
9
- import { createSchema, DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS } from '../schema/index.js';
10
- import { AutoTransport } from '../transport/auto/index.js';
11
- import { HttpTransport } from '../transport/http/index.js';
12
- import { WebSocketTransport } from '../transport/websocket/index.js';
8
+ import { createSchema } from '../schema/index.js';
13
9
  import { admitFunction } from './admission.js';
14
- import { createContentApi } from './content.js';
15
- import { admitControlOptions, admitPolicy, createSessionOperation, DEFAULT_MAXIMUM_BUNDLE_BYTES, DEFAULT_MAXIMUM_PUBLICATION_BYTES, DEFAULT_MAXIMUM_RELEASE_BYTES, DEFAULT_MAXIMUM_RESPONSE_BYTES, DEFAULT_TIMEOUT_MS, admitKernel, allowEndpoint, kernelInvocationEndpoint, platformDuration, positive, } from './context/index.js';
10
+ import { createContentApi } from './content/index.js';
11
+ import { admitControlOptions, allowEndpoint, createSessionOperation } from './context/index.js';
16
12
  import { createSessionDiscovery } from './discovery/index.js';
17
- import { acquireDomainCredential, admitExchangeOptions, admitExchangeRequest, createSessionExchange, } from './exchange/index.js';
13
+ import { acquireDomainCredential, admitExchangeRequest, createSessionExchange, } from './exchange/index.js';
14
+ import { acceptSessionOptions } from './options.js';
18
15
  import { admitReference } from './reference.js';
19
- import { admitEnvelopeTransport, admitInvocationOptions, admitSessionAuth, requireResultKind, RouteCache, SessionDispatcher, } from './routing/index.js';
16
+ import { admitInvocationOptions, requireResultKind, SessionDispatcher } from './routing/index.js';
20
17
  import { domainViewCatalog, resolveViewsFor } from './views/index.js';
21
18
  const DEFAULT_SESSION_POLICY = Object.freeze({ maximumRouteAgeMs: 60_000 });
22
19
  /** Caller-owned discovery and redirect-following conversation with one exact source Kernel. */
@@ -37,91 +34,53 @@ export class ClientSession {
37
34
  admitDomainViews;
38
35
  closed = false;
39
36
  constructor(options) {
40
- if (options === null || typeof options !== 'object') {
41
- throw new TypeError('ClientSession options are invalid.');
42
- }
43
- const policy = admitPolicy(options.policy);
37
+ const settled = acceptSessionOptions(options);
38
+ const { kernel, sourceEndpoint, policy, fetch, pool, auth } = settled;
39
+ const { maximumReleaseBytes, maximumBundleBytes, maximumResponseBytes } = settled;
40
+ this.kernel = kernel;
41
+ this.timeoutMs = settled.timeoutMs;
42
+ this.ownedPool = settled.ownedPool;
43
+ this.routes = settled.routes;
44
44
  this.admitDomainViews = (input, domain) => domainViewCatalog(input, domain, policy);
45
- this.kernel = admitKernel(options.kernel, policy.allowInsecureHttp === true);
46
- const sourceEndpoint = kernelInvocationEndpoint(this.kernel);
47
- const fetch = options.fetch ?? globalThis.fetch;
48
- if (typeof fetch !== 'function')
49
- throw new TypeError('ClientSession requires Fetch.');
50
- const fetchImpl = options.fetch === undefined ? fetch.bind(globalThis) : fetch;
51
- if (options.client !== undefined && options.pool !== undefined) {
52
- throw new TypeError('ClientSession accepts either client or pool, not both.');
53
- }
54
- const maximumReleaseBytes = positive(options.maximumReleaseBytes ?? DEFAULT_MAXIMUM_RELEASE_BYTES, 'maximumReleaseBytes');
55
- const maximumPublicationBytes = positive(options.maximumPublicationBytes ?? DEFAULT_MAXIMUM_PUBLICATION_BYTES, 'maximumPublicationBytes');
56
- const maximumBundleBytes = positive(options.maximumBundleBytes ?? DEFAULT_MAXIMUM_BUNDLE_BYTES, 'maximumBundleBytes');
57
- const maximumResponseBytes = positive(options.maximumResponseBytes ?? DEFAULT_MAXIMUM_RESPONSE_BYTES, 'maximumResponseBytes');
58
- const timeoutMs = platformDuration(options.timeoutMs ?? DEFAULT_TIMEOUT_MS, 'timeoutMs');
59
- const schemaLifecycleTimeoutMs = platformDuration(options.schemaLifecycleTimeoutMs ?? DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS, 'schemaLifecycleTimeoutMs');
60
- this.timeoutMs = timeoutMs;
61
- const websocketAvailable = options.client !== undefined ||
62
- options.pool !== undefined ||
63
- options.websocket !== undefined ||
64
- typeof WebSocket === 'function';
65
- const client = options.client ??
66
- defaultClientFactory({
67
- fetch: fetchImpl,
68
- ...(options.websocket === undefined ? {} : { websocket: options.websocket }),
69
- ...(options.onWarning === undefined ? {} : { onWarning: options.onWarning }),
70
- maximumResponseBytes,
71
- timeoutMs,
72
- });
73
- let pool;
74
- if (options.pool === undefined) {
75
- const ownedPool = new ClientPool({ client });
76
- this.ownedPool = ownedPool;
77
- pool = admitClientPool(ownedPool);
78
- }
79
- else {
80
- pool = admitClientPool(options.pool);
81
- }
82
45
  this.discovery = createSessionDiscovery({
83
- kernel: this.kernel,
84
- fetch: fetchImpl,
46
+ kernel,
47
+ fetch,
85
48
  policy,
86
49
  maximumReleaseBytes,
87
- maximumPublicationBytes,
88
50
  maximumBundleBytes,
89
51
  requireOpen: () => this.requireOpen(),
90
52
  acquisitionOperation: () => this.operation(undefined),
91
53
  });
92
- this.routes = new RouteCache(policy.maximumRouteAgeMs, undefined, options.routeStore);
93
- const auth = admitSessionAuth(options.auth);
94
- const exchange = admitExchangeOptions(options.exchange, auth);
95
54
  this.exchangeDependencies = Object.freeze({
96
- kernel: this.kernel,
55
+ kernel,
97
56
  source: () => {
98
57
  allowEndpoint(sourceEndpoint, policy);
99
58
  return pool.clientFor({ transport: 'http', url: sourceEndpoint });
100
59
  },
101
60
  ...(auth === undefined ? {} : { auth }),
102
- fetch: fetchImpl,
61
+ fetch,
103
62
  policy,
104
- limits: { maximumPublicationBytes, maximumBundleBytes },
63
+ limits: { maximumReleaseBytes, maximumBundleBytes },
105
64
  maximumResponseBytes,
106
65
  operation: (signal) => this.operation(signal === undefined ? undefined : { signal }),
107
66
  });
108
67
  this.callExchange =
109
- exchange === undefined || auth === undefined
68
+ settled.exchange === undefined || auth === undefined
110
69
  ? undefined
111
- : createSessionExchange({ ...this.exchangeDependencies, auth }, exchange);
70
+ : createSessionExchange({ ...this.exchangeDependencies, auth }, settled.exchange);
112
71
  this.dispatcher = new SessionDispatcher({
113
- kernel: this.kernel,
72
+ kernel,
114
73
  sourceEndpoint,
115
74
  pool,
116
- websocketAvailable,
75
+ websocketAvailable: settled.websocketAvailable,
117
76
  auth,
118
77
  ...(this.callExchange === undefined ? {} : { exchange: this.callExchange }),
119
78
  cache: this.routes,
120
79
  policy,
121
- envelopeTransport: admitEnvelopeTransport(options.envelopeTransport ?? 'http'),
80
+ envelopeTransport: settled.envelopeTransport,
122
81
  requireOpen: () => this.requireOpen(),
123
82
  streamingHttp: {
124
- fetch: fetchImpl,
83
+ fetch,
125
84
  maximumResponseBytes: 100 * 1024 * 1024,
126
85
  timeoutMs: 30 * 60 * 1_000,
127
86
  },
@@ -131,9 +90,9 @@ export class ClientSession {
131
90
  dispatch: (target, input, operation, body) => this.dispatcher.dispatchHttp({ target, input }, {}, operation, body),
132
91
  });
133
92
  this.schema = createSchema((request, options) => this.dispatch(request, options), {
134
- maximumPublicationBytes,
93
+ maximumReleaseBytes,
135
94
  maximumBundleBytes,
136
- lifecycleTimeoutMs: schemaLifecycleTimeoutMs,
95
+ lifecycleTimeoutMs: settled.schemaLifecycleTimeoutMs,
137
96
  });
138
97
  this.graph = createGraph((call, options) => this.call(call, options));
139
98
  this.auth = createAuth((target, input, options) => this.call({ target, input }, options), (call, options) => {
@@ -155,21 +114,11 @@ export class ClientSession {
155
114
  return acquireDomainCredential(this.exchangeDependencies, request, this.operation(request.control));
156
115
  }
157
116
  /**
158
- * Revalidate the source Kernel's own release (`release.json`) without acquiring its bundle or
159
- * Views; a Host that predates intrinsic `release.json` yields its version 3 Publication instead.
117
+ * Revalidate the source Kernel's own release (`release.json`) without acquiring its bundle or Views.
160
118
  */
161
119
  release(options) {
162
120
  return this.discovery.release(this.operation(admitControlOptions(options)));
163
121
  }
164
- /**
165
- * Revalidate the intrinsic release and return its v3 document: the Host's own version 3
166
- * Publication, or the frozen v3 projection of its `DomainRelease`.
167
- *
168
- * @deprecated Use `release()`. Deleted when no supported Host predates intrinsic `release.json`.
169
- */
170
- publication(options) {
171
- return this.discovery.publication(this.operation(admitControlOptions(options)));
172
- }
173
122
  snapshot(options) {
174
123
  return this.discovery.snapshot(this.operation(admitControlOptions(options)));
175
124
  }
@@ -281,58 +230,3 @@ export function connect(options) {
281
230
  policy: rest.policy ?? DEFAULT_SESSION_POLICY,
282
231
  });
283
232
  }
284
- function admitClientPool(input) {
285
- if (input === null ||
286
- typeof input !== 'object' ||
287
- typeof input.clientFor !== 'function') {
288
- throw new TypeError('Session client pool capability is invalid.');
289
- }
290
- return Object.freeze({
291
- clientFor: (target) => admitPooledClient(input.clientFor.call(input, target)),
292
- });
293
- }
294
- function admitPooledClient(input) {
295
- if (input === null ||
296
- typeof input !== 'object' ||
297
- typeof input.dispatch !== 'function' ||
298
- typeof input.as !== 'function' ||
299
- typeof input.close !== 'function') {
300
- throw new TypeError('Session client pool capability returned an invalid Client.');
301
- }
302
- return input;
303
- }
304
- function defaultClientFactory(options) {
305
- return (target) => {
306
- switch (target.transport) {
307
- case 'http':
308
- return new Client({
309
- transport: new HttpTransport({
310
- url: target.url,
311
- fetch: options.fetch,
312
- timeoutMs: options.timeoutMs,
313
- maximumResponseBytes: options.maximumResponseBytes,
314
- }),
315
- });
316
- case 'websocket':
317
- return new Client({
318
- transport: new WebSocketTransport({
319
- url: target.url,
320
- timeoutMs: options.timeoutMs,
321
- maximumResponseBytes: options.maximumResponseBytes,
322
- ...(options.websocket === undefined ? {} : { websocket: options.websocket }),
323
- }),
324
- });
325
- case 'auto':
326
- return new Client({
327
- transport: new AutoTransport({
328
- endpoints: target.endpoints,
329
- fetch: options.fetch,
330
- timeoutMs: options.timeoutMs,
331
- maximumResponseBytes: options.maximumResponseBytes,
332
- ...(options.websocket === undefined ? {} : { websocket: options.websocket }),
333
- ...(options.onWarning === undefined ? {} : { onWarning: options.onWarning }),
334
- }),
335
- });
336
- }
337
- };
338
- }
@@ -14,9 +14,11 @@ void request;
14
14
  void snapshot;
15
15
  const observedRelease = session.release(control);
16
16
  void observedRelease;
17
- void observedRelease.then((current) => current.version === 4 ? current.build.digest : current.etag);
18
- const observedPublication = session.publication(control);
19
- void observedPublication;
17
+ void observedRelease.then((current) => current.build.digest);
18
+ // @ts-expect-error Publication discovery is absent from the public Session.
19
+ void session.publication(control);
20
+ // @ts-expect-error A coherent snapshot contains only its canonical release.
21
+ void snapshot.publication;
20
22
  const admitted = session.auth.admit({
21
23
  target: Path.parse('/:example.test:function.write'),
22
24
  input: {},
@@ -71,6 +73,7 @@ if (isBinaryInput(registerInput))
71
73
  const registrationInput = valueSchema()(registerInput);
72
74
  const booleanOutput = valueSchema()({ type: 'boolean' });
73
75
  const typedDomain = schema.resolve(defineSchema('client.input-witness.typecheck', {
76
+ name: 'Test Domain',
74
77
  dependencies: { kernel: KernelSchema },
75
78
  functions: {
76
79
  registerIdentity: func({
@@ -155,6 +158,7 @@ const abstractMethod = method({
155
158
  abstract: true,
156
159
  });
157
160
  const abstractDomain = schema.resolve(defineSchema('client.reference.typecheck', {
161
+ name: 'Test Domain',
158
162
  classes: {
159
163
  AbstractItem: nodeClass({ abstract: true, methods: { abstractMethod } }),
160
164
  },
@@ -166,6 +170,7 @@ const reminderOutput = valueSchema()({
166
170
  additionalProperties: false,
167
171
  });
168
172
  const durableDomain = schema.resolve(defineSchema('client.durable.typecheck', {
173
+ name: 'Test Domain',
169
174
  classes: {
170
175
  Invoice: nodeClass({
171
176
  methods: {
@@ -1,23 +1,19 @@
1
1
  import type { Key, bundle } from '@astrale-os/kernel-dsl/v1';
2
- import type { publication } from '@astrale-os/kernel-protocol';
2
+ import type { DomainRelease } from '@astrale-os/kernel-protocol/release';
3
3
  import { type ResolvedView } from '@astrale-os/kernel-core/schema/kernel/syscalls/view-resolution';
4
4
  export type { ResolvedView } from '@astrale-os/kernel-core/schema/kernel/syscalls/view-resolution';
5
5
  import type { SessionPolicy } from '../context/index.js';
6
- /** One verified View declaration joined with its owning Publication and provenance. */
6
+ /** One verified View declaration joined with its owning Release and provenance. */
7
7
  /** Immutable canonical-key-ordered inventory of Views resolved under one Session revision. */
8
8
  export interface ViewCatalog {
9
9
  readonly entrypoint?: ResolvedView;
10
10
  readonly views: readonly ResolvedView[];
11
11
  }
12
- /**
13
- * Every View targets its owning Domain. A legacy Class-targeted declaration that an earlier DSL
14
- * persisted is ignored here, exactly as Runtime View resolution ignores it.
15
- */
16
- export declare function rootViewCatalog(publication: publication.Publication, artifact: bundle.Bundle, policy: Readonly<SessionPolicy>): ViewCatalog;
12
+ /** Join each root Domain View to its exact release binding. */
13
+ export declare function rootViewCatalog(release: DomainRelease, artifact: bundle.Bundle, policy: Readonly<SessionPolicy>): ViewCatalog;
17
14
  export declare function catalogFromKeys(root: ViewCatalog, keys: readonly Key.View[]): ViewCatalog;
18
15
  /**
19
16
  * Re-admit one Runtime-resolved Domain View catalog at the Client trust boundary. Only Views that
20
- * the requested Domain declares for itself are kept, so an earlier Kernel that still resolved Class
21
- * targets can never widen the per-Domain catalog.
17
+ * the requested Domain declares for itself are kept.
22
18
  */
23
19
  export declare function domainViewCatalog(input: unknown, domain: Key.Origin, policy: Readonly<SessionPolicy>): ViewCatalog;
@@ -2,23 +2,15 @@ import { acceptViewResolution, } from '@astrale-os/kernel-core/schema/kernel/sys
2
2
  import { Key as ViewKey } from '@astrale-os/kernel-dsl/v1/addressing';
3
3
  import { ClientError } from '../../errors/index.js';
4
4
  import { allowEndpoint } from '../context/index.js';
5
- /**
6
- * Every View targets its owning Domain. A legacy Class-targeted declaration that an earlier DSL
7
- * persisted is ignored here, exactly as Runtime View resolution ignores it.
8
- */
9
- export function rootViewCatalog(publication, artifact, policy) {
10
- const legacy = new Set();
11
- const views = publication.bindings.views
5
+ /** Join each root Domain View to its exact release binding. */
6
+ export function rootViewCatalog(release, artifact, policy) {
7
+ const views = release.bindings.views
12
8
  .flatMap((binding) => {
13
9
  allowEndpoint(binding.href, policy);
14
10
  const declaration = artifact.root.views[viewName(binding.view)];
15
11
  if (declaration === undefined) {
16
12
  throw new ClientError('Published View has no verified root declaration.');
17
13
  }
18
- if (declaration.target.kind !== 'domain') {
19
- legacy.add(binding.view);
20
- return [];
21
- }
22
14
  const { ref: _ref, ...viewDeclaration } = declaration;
23
15
  return [
24
16
  Object.freeze({
@@ -26,23 +18,20 @@ export function rootViewCatalog(publication, artifact, policy) {
26
18
  declaration: Object.freeze(viewDeclaration),
27
19
  href: binding.href,
28
20
  handshake: binding.handshake,
29
- ...(binding.iframe === undefined ? {} : { iframe: binding.iframe }),
30
21
  ...(binding.host === undefined ? {} : { host: binding.host }),
31
- issuer: publication.identity.issuer,
32
- etag: publication.etag,
33
- revision: publication.schema.revision,
22
+ issuer: release.identity.issuer,
23
+ release: release.digest,
24
+ revision: release.schema.revision,
34
25
  }),
35
26
  ];
36
27
  })
37
28
  .sort((left, right) => compareKeys(left.key, right.key));
38
29
  const catalogViews = Object.freeze(views);
39
- const entrypointRef = publication.manifest?.entrypoint;
30
+ const entrypointRef = artifact.root.entrypoint;
40
31
  const entrypointKey = entrypointRef === undefined ? undefined : ViewKey.of(entrypointRef);
41
- const entrypoint = entrypointKey === undefined || legacy.has(entrypointKey)
42
- ? undefined
43
- : catalogViews.find(({ key }) => key === entrypointKey);
44
- if (entrypointKey !== undefined && !legacy.has(entrypointKey) && entrypoint === undefined) {
45
- throw new ClientError('Published View entrypoint has no verified Publication binding.');
32
+ const entrypoint = entrypointKey === undefined ? undefined : catalogViews.find(({ key }) => key === entrypointKey);
33
+ if (entrypointKey !== undefined && entrypoint === undefined) {
34
+ throw new ClientError('Published View entrypoint has no verified Release binding.');
46
35
  }
47
36
  return Object.freeze({
48
37
  ...(entrypoint === undefined ? {} : { entrypoint }),
@@ -61,8 +50,7 @@ export function catalogFromKeys(root, keys) {
61
50
  }
62
51
  /**
63
52
  * Re-admit one Runtime-resolved Domain View catalog at the Client trust boundary. Only Views that
64
- * the requested Domain declares for itself are kept, so an earlier Kernel that still resolved Class
65
- * targets can never widen the per-Domain catalog.
53
+ * the requested Domain declares for itself are kept.
66
54
  */
67
55
  export function domainViewCatalog(input, domain, policy) {
68
56
  let resolution;
@@ -72,7 +60,7 @@ export function domainViewCatalog(input, domain, policy) {
72
60
  catch (cause) {
73
61
  throw new ClientError('Resolved View catalog is invalid.', { cause });
74
62
  }
75
- const views = resolution.views.filter((view) => view.declaration.target.kind === 'domain' && ViewKey.origin(view.key) === domain);
63
+ const views = resolution.views.filter((view) => ViewKey.origin(view.key) === domain);
76
64
  for (const view of views)
77
65
  allowEndpoint(view.href, policy);
78
66
  return Object.freeze({ views: Object.freeze(views) });
@@ -7,7 +7,7 @@ export type ViewInvoker = (call: Call, operation: SessionOperation) => Promise<I
7
7
  export type ViewCatalogAdmission = (input: unknown, domain: Key.Origin) => ViewCatalog;
8
8
  /**
9
9
  * Resolve the per-Domain View catalog through the canonical source Kernel call, then admit its
10
- * installed-Publication projection. Every View targets its owning Domain, so only an exact Domain
10
+ * installed Release evidence. Every View targets its owning Domain, so only an exact Domain
11
11
  * Path `/:<origin>` is meaningful; any other Path is refused before the call.
12
12
  */
13
13
  export declare function resolveViewsFor(invoke: ViewInvoker, admitCatalog: ViewCatalogAdmission, domain: PathLike, operation: SessionOperation): Promise<ViewCatalog>;
@@ -3,7 +3,7 @@ import { view } from '@astrale-os/kernel-core/schema/kernel/syscalls/references'
3
3
  import { call } from '../../client/index.js';
4
4
  /**
5
5
  * Resolve the per-Domain View catalog through the canonical source Kernel call, then admit its
6
- * installed-Publication projection. Every View targets its owning Domain, so only an exact Domain
6
+ * installed Release evidence. Every View targets its owning Domain, so only an exact Domain
7
7
  * Path `/:<origin>` is meaningful; any other Path is refused before the call.
8
8
  */
9
9
  export async function resolveViewsFor(invoke, admitCatalog, domain, operation) {
@@ -1,4 +1,4 @@
1
- import type { Edge, EdgeKey } from '@astrale-os/kernel-core/graph/edge';
1
+ import type { Edge } from '@astrale-os/kernel-core/graph/edge';
2
2
  import type { Node, NodeId } from '@astrale-os/kernel-core/graph/node';
3
3
  import type { QueryResult } from '@astrale-os/kernel-core/graph/query';
4
4
  export interface FactReferences {
@@ -19,4 +19,3 @@ export declare class EntityIndex {
19
19
  sweep(reachableNodes: ReadonlySet<NodeId>, reachableEdges: ReadonlySet<string>): void;
20
20
  clear(): void;
21
21
  }
22
- export declare function edgeIdentity(key: EdgeKey): string;
@@ -86,9 +86,6 @@ export class EntityIndex {
86
86
  this.edges.clear();
87
87
  }
88
88
  }
89
- export function edgeIdentity(key) {
90
- return encodeEdgeKey(key);
91
- }
92
89
  function signature(value) {
93
90
  return JSON.stringify(value);
94
91
  }
@@ -1,7 +1,7 @@
1
1
  import { encodeEdgeKey } from '@astrale-os/kernel-core/graph/edge';
2
2
  import { ClientError } from '../errors/index.js';
3
3
  import { retainDerivedQueryProvenance } from '../graph/provenance.js';
4
- import { edgeIdentity, EntityIndex } from './entity-index.js';
4
+ import { EntityIndex } from './entity-index.js';
5
5
  import { OptimisticOverlay } from './optimistic.js';
6
6
  import { COLD_SNAPSHOT, QueryShape } from './shape.js';
7
7
  export class GraphMemory {
@@ -225,7 +225,7 @@ export class GraphMemory {
225
225
  const edge = item.edge.kind === 'reference'
226
226
  ? item.edge
227
227
  : (() => {
228
- const value = this.entities.edge(edgeIdentity(item.edge.value));
228
+ const value = this.entities.edge(encodeEdgeKey(item.edge.value));
229
229
  return value === undefined
230
230
  ? undefined
231
231
  : Object.freeze({ kind: 'value', value: materializeEdge(value) });
@@ -4,7 +4,7 @@ import type { DomainDependency } from '@astrale-os/kernel-dsl/v1/schema';
4
4
  import type { QueryPageRequest } from '../graph/index.js';
5
5
  import type { FactReferences } from './entity-index.js';
6
6
  import type { StoreQueryResponse, StoreSnapshot } from './store.js';
7
- export type ShapeState = StoreSnapshot['state'];
7
+ type ShapeState = StoreSnapshot['state'];
8
8
  export declare class QueryShape {
9
9
  readonly key: string;
10
10
  readonly ast: QueryAST;
@@ -26,3 +26,4 @@ export declare class QueryShape {
26
26
  referencesAny(nodes: ReadonlySet<NodeId>, edges: ReadonlySet<string>): boolean;
27
27
  }
28
28
  export declare const COLD_SNAPSHOT: StoreSnapshot;
29
+ export {};
@@ -1,5 +1,5 @@
1
- export type AutoSelection = 'websocket' | 'http';
2
- export type AutoDecisionTicket = {
1
+ type AutoSelection = 'websocket' | 'http';
2
+ type AutoDecisionTicket = {
3
3
  readonly kind: 'selected';
4
4
  readonly selection: AutoSelection;
5
5
  } | {
@@ -20,3 +20,4 @@ export declare class AutoDecision {
20
20
  release(): void;
21
21
  close(): void;
22
22
  }
23
+ export {};
@@ -0,0 +1,5 @@
1
+ import * as protocol from '@astrale-os/kernel-protocol/invocation';
2
+ import type { TransportResult } from '../index.js';
3
+ import { type ResponseContext } from './response.js';
4
+ /** Admit exactly one response representation, preserving reserved-control precedence. */
5
+ export declare function admitResponse(response: Response, requestId: protocol.RequestId, context: ResponseContext): Promise<TransportResult>;