@astrale-os/kernel-client 0.6.0-beta.16 → 0.6.0-beta.17

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.
@@ -1,7 +1,6 @@
1
1
  import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
2
2
  import type { Call, Result } from '../../client/index.js';
3
3
  import type { SessionOperation, SessionPolicy } from '../context/index.js';
4
- import type { SessionDiscovery } from '../discovery/index.js';
5
4
  import type { SessionAuth } from './auth.js';
6
5
  import type { RouteCache } from './cache.js';
7
6
  import type { ClientPoolCapability } from './envelope.js';
@@ -16,7 +15,6 @@ export interface SessionDispatcherOptions {
16
15
  readonly cache: RouteCache;
17
16
  readonly policy: Readonly<SessionPolicy>;
18
17
  readonly envelopeTransport: SessionEnvelopeTransport;
19
- readonly discovery: SessionDiscovery;
20
18
  readonly requireOpen: () => void;
21
19
  }
22
20
  export declare class SessionDispatcher {
@@ -27,7 +25,6 @@ export declare class SessionDispatcher {
27
25
  private followSource;
28
26
  private dispatchDestinationWithRecovery;
29
27
  private dispatchDestination;
30
- private sourceKernel;
31
28
  }
32
29
  export declare function requireResultKind<Kind extends 'value' | 'stream' | 'binary'>(expected: Kind, result: Result): Extract<Result, {
33
30
  kind: Kind;
@@ -15,8 +15,8 @@ export class SessionDispatcher {
15
15
  // Authority is resolved before warm lookup so changed credentials or delegation cannot reuse a
16
16
  // carrier minted for a different caller partition.
17
17
  const auth = await resolveAuth(this.state.auth, call, operation);
18
- const source = await this.sourceKernel(operation);
19
- const cacheKey = await this.state.cache.key(source.issuer, call, auth, expected);
18
+ const source = this.state.kernel;
19
+ const cacheKey = await this.state.cache.key(source, call, auth, expected);
20
20
  const dispatch = Object.freeze({
21
21
  call,
22
22
  auth,
@@ -46,7 +46,7 @@ export class SessionDispatcher {
46
46
  if (result.kind !== 'redirect')
47
47
  return result;
48
48
  const redirect = result.redirect;
49
- if (redirect.route.via.issuer !== state.source.issuer) {
49
+ if (redirect.route.via.issuer !== state.source) {
50
50
  throw new ClientError('Redirect issuer differs from the session-pinned source Kernel identity.');
51
51
  }
52
52
  requireExpectedPublication(redirect.route, state.expected);
@@ -55,7 +55,7 @@ export class SessionDispatcher {
55
55
  }
56
56
  async dispatchDestinationWithRecovery(learned, state, options, operation, trace) {
57
57
  try {
58
- return await this.dispatchDestination(learned, state.call, options, operation, state.expected, trace);
58
+ return await this.dispatchDestination(learned, state.call, options, operation, state.source, state.expected, trace);
59
59
  }
60
60
  catch (cause) {
61
61
  const stale = isAdmittedStaleRouteError(cause);
@@ -79,8 +79,8 @@ export class SessionDispatcher {
79
79
  return this.followSource(refreshed, state, options, operation);
80
80
  }
81
81
  }
82
- async dispatchDestination(learned, call, options, operation, expected, trace) {
83
- if (learned.route.via.issuer !== (await this.sourceKernel(operation)).issuer) {
82
+ async dispatchDestination(learned, call, options, operation, source, expected, trace) {
83
+ if (learned.route.via.issuer !== source) {
84
84
  throw new ClientError('Learned route issuer differs from the session-pinned source Kernel.');
85
85
  }
86
86
  requireExpectedPublication(learned.route, expected);
@@ -97,13 +97,6 @@ export class SessionDispatcher {
97
97
  }
98
98
  return result;
99
99
  }
100
- async sourceKernel(operation) {
101
- const snapshot = await this.state.discovery.snapshot(operation);
102
- if (snapshot.kernel !== this.state.kernel) {
103
- throw new ClientError('Session discovery returned another Kernel identity.');
104
- }
105
- return Object.freeze({ issuer: snapshot.publication.identity.issuer });
106
- }
107
100
  }
108
101
  function isRouteCompatibilityConflict(input) {
109
102
  if (!(input instanceof ResponseError))
@@ -87,7 +87,6 @@ export class ClientSession {
87
87
  cache: this.routes,
88
88
  policy,
89
89
  envelopeTransport: admitEnvelopeTransport(options.envelopeTransport ?? 'http'),
90
- discovery: this.discovery,
91
90
  requireOpen: () => this.requireOpen(),
92
91
  });
93
92
  this.schema = createSchema((request, options) => this.dispatch(request, options), {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrale-os/kernel-client",
3
- "version": "0.6.0-beta.16",
3
+ "version": "0.6.0-beta.17",
4
4
  "description": "Universal Client — protocol-first, transport-agnostic",
5
5
  "keywords": [
6
6
  "astrale",