import type { SessionState } from "../auth-session-port.ts"; import type { ProductFeatureStatus } from "../product-features-port.ts"; import type { RuntimeCapabilitySnapshot } from "../runtime-capabilities-port.ts"; import type { StoragePort } from "../storage-port.ts"; export type { SessionState } from "../auth-session-port.ts"; export type { ProductFeatureStatus }; export type { RuntimeCapabilitySnapshot }; /** * Features add their driving API through module augmentation. The application * owns the registry contract without importing any concrete feature. */ export interface ApplicationFeatureInputs {} export type ApplicationFeatureId = Extract< keyof ApplicationFeatureInputs, string >; export type ColorSchemePreference = "system" | "light" | "dark"; export type RenderFailureReport = Readonly<{ routeId: string; buildId: string; boundaryName: "route" | "feature"; }>; export type RouteChangedReport = Readonly<{ routeId: string; buildId: string; }>; export type ReleaseSummary = Readonly<{ buildId: string; releaseId: string; configSchemaVersion: string; /** Legacy V1 scalar; absent once the release manifest is V2. */ apiContractVersion?: string; /** §5.2 contract set identity for a V2 release manifest. */ contractSetDigest?: string; }>; export type ApplicationApi = Readonly<{ session: Readonly<{ getSnapshot(): SessionState; subscribe(listener: () => void): () => void; beginSignIn(returnTo?: string): Promise; signOut(): Promise; recover(): Promise<"restored" | "no-session">; }>; preferences: Readonly<{ getColorScheme(): ColorSchemePreference; setColorScheme( preference: ColorSchemePreference, ): ReturnType; }>; diagnostics: Readonly<{ reportRenderFailure(report: RenderFailureReport): void; reportRouteChanged(report: RouteChangedReport): void; }>; runtime: Readonly<{ getReleaseSummary(): Promise; /** * §3.5. The static selection reduced by the runtime overrides. Presentation * reads capability state here instead of importing the composition root. */ getCapabilitySnapshot(): RuntimeCapabilitySnapshot; /** * §3.5. Which product features this build contains and which of them the * runtime document switched off. Presentation reads state here; it never * learns how to reach a feature the build left out. */ getFeatureSnapshot(): readonly ProductFeatureStatus[]; isFeatureActive(featureId: string): boolean; }>; recovery: Readonly<{ recoverChunk(input: Readonly<{ chunkId: string; failureKind: "CHUNK_LOAD_FAILURE" | "DEPLOY_MISMATCH"; }>): Promise< | Readonly<{ action: "reload-once"; releasePair: string }> | Readonly<{ action: "support"; reason: string }> >; }>; features: Readonly<{ has(featureId: string): featureId is ApplicationFeatureId; get( featureId: FeatureId, ): ApplicationFeatureInputs[FeatureId]; }>; }>;