import { type LaunchRoutingContract } from '@sentropic/llm-mesh'; import { GatewayStateError, type GatewayStateStore, type StoredReceipt, type StoredSession, type StoredState } from './ports/gateway-state.js'; import type { StoredRequestAttempt } from './ports/gateway-state.js'; import type { RouteAttemptSettlement } from './route-flow-core.js'; export type { GatewayStateStore, StoredReceipt, StoredSession, StoredState }; export type SessionErrorCode = 'UNAUTHENTICATED' | 'INVALID-KEY' | 'REVOKED' | 'EXPIRED' | 'STORE-FAILED' | 'CORRUPT' | 'CONFLICT' | 'KEY-UNAVAILABLE' | 'AMBIGUOUS' | 'ALREADY-SETTLED' | 'BAD-SETTLEMENT' | 'MODEL-NOT-GRANTED' | 'NOT-FOUND'; export declare class GatewaySessionError extends GatewayStateError { constructor(message: string, code: SessionErrorCode); } export interface AcquireSessionInput { readonly routingContract?: LaunchRoutingContract; readonly ownerScopeRef: string; readonly workspaceRef: string; readonly clientSessionRef: string; readonly profiles?: readonly string[]; readonly models?: readonly string[]; readonly mappingRevision?: string; readonly ttlDays?: number; } export interface MigrateSessionPolicyInput { readonly ownerScopeRef: string; readonly sessionRef?: string; readonly workspaceRef?: string; readonly clientSessionRef?: string; readonly routingContract: LaunchRoutingContract; readonly expectedPolicyRevision?: string; } export interface IssuedSession { readonly sessionRef: string; /** Returned exclusively over authenticated acquisition, including recovery. */ readonly key?: string; readonly reacquired: boolean; readonly expiresAt: string; readonly policyRevision: string; } export interface CallerContext { readonly routingContract?: LaunchRoutingContract; readonly sessionRef: string; readonly ownerScopeRef: string; readonly workspaceRef: string; readonly clientSessionRef: string; readonly profiles: readonly string[]; readonly models: readonly string[]; readonly mappingRevision?: string; readonly policyRevision: string; readonly expiresAt: string; } declare const publicSession: (session: StoredSession) => { sessionRef: string; workspaceRef: string; clientSessionRef: string; expiresAt: string; revoked: boolean; policyRevision: string; }; export declare class GatewaySessionService { private readonly store; private readonly defaultTtlDays; constructor(store: GatewayStateStore, options?: { defaultTtlDays?: number; }); acquireSession(input: AcquireSessionInput): Promise; private acquireCommitted; /** * Single-writer migration import: preserves existing key bytes instead of * issuing new material. Rejects short keys, past expiry, and ambiguous * duplicates (including live gateway sessions); the caller quarantines. */ importSession(input: { ownerScopeRef: string; workspaceRef: string; clientSessionRef: string; keyMaterial: string; expiresAt: string; profiles?: readonly string[]; models?: readonly string[]; mappingRevision?: string; routingContract?: LaunchRoutingContract; }): Promise<{ sessionRef: string; expiresAt: string; receiptId: string; }>; private importCommitted; migrateSessionPolicy(input: MigrateSessionPolicyInput): Promise<{ sessionRef: string; expiresAt: string; policyRevision: string; receiptId: string; }>; resolveCaller(input: { sessionRef: string; key: string; }): Promise; resolveBearer(key: string): Promise; reconcilePending(): Promise; revokeSession(input: { ownerScopeRef: string; sessionRef: string; }): Promise<{ revoked: boolean; }>; private revokeCommitted; listSessions(input: { ownerScopeRef: string; }): Promise[]>; recordAttempt(input: { ownerScopeRef: string; sessionRef: string; requestId: string; model: string; originModel?: string; stageRewrites?: StoredReceipt['stageRewrites']; guardVerdict?: string; }): Promise; private recordCommitted; settleReceipt(input: { ownerScopeRef: string; receiptId: string; outcome: string; attempts?: readonly RouteAttemptSettlement[]; integrity?: StoredReceipt['integrity']; }): Promise; private settleCommitted; appendAttempt(input: { ownerScopeRef: string; receiptId: string; attempt: StoredRequestAttempt; }): Promise; readReceipt(input: { ownerScopeRef: string; receiptId: string; }): Promise; } //# sourceMappingURL=session-service.d.ts.map