/** * `SdkDispatcher` — implements direct KernelAPI calls and hosted invocations * through the same SDK execution pipeline. * * Built once at server startup from the domain's `CompiledDomain` plus a typed * deps container and a private JWK. Per-method identity configs are * pre-resolved into a Map so dispatch is O(1) per call. * * Pipeline per call: * resolve method → authenticate → validate → resolve self → execute */ import type { AuthedKernelAPI, DispatchResult, KernelAPI } from '@astrale-os/kernel-api'; import type { CredentialInput, Path } from '@astrale-os/kernel-core'; import type { CompiledDomain } from '@astrale-os/kernel-core/domain'; import type { Invocation, Capabilities, Dispatcher } from '@astrale-os/kernel-server'; import type { MethodIndex } from './resolve.js'; export type SdkDispatcherConfig = { /** The compiled domain — source of the method layout and origin-addressed subs. */ compiled: CompiledDomain; /** Pre-built method map: ref → BoundMethod. */ methods: MethodIndex; /** Dependency container injected into every handler. */ deps: TDeps; /** Private key for signing outbound per-function credentials. */ privateKey: JsonWebKey; /** * The worker's identity (`iss`) for outbound per-function credentials — its * serving URL (e.g. `https://crm.test.com`), DECOUPLED from the domain's * addressing `origin`. Matches the `iss` the kernel pins on each node at * install (the URL it fetched the domain at). */ issuer: string; /** The worker's serving URL (`config.url`) — exposed to handlers as `ctx.env.url`. */ url: string; }; export declare class SdkDispatcher implements KernelAPI, Dispatcher { private readonly methods; private readonly deps; private readonly identities; private readonly issuer; private readonly url; private readonly privateKey; /** Built once from the compiled domain — drives typed self and handler kernel binding. */ private readonly binder; constructor(config: SdkDispatcherConfig); call(path: Path | string, credential: CredentialInput, params: unknown, self?: string): Promise; stream(path: Path | string, credential: CredentialInput, params: unknown, self?: string): Promise>; /** * SDK dispatch never redirects — the SDK server IS the remote destination. * Every call resolves locally; we just classify the return as value or stream * and hand it back to the invocation host. */ dispatch(path: Path | string, credential: CredentialInput, params: unknown, self?: string): Promise; invoke(invocation: Invocation, caps: Capabilities): Promise; as(credential: CredentialInput): AuthedKernelAPI; private run; private identityFor; } //# sourceMappingURL=dispatcher.d.ts.map