import { type SceneAnimationCancellationReason } from "@skenora/contracts"; import { Engine } from "@babylonjs/core/Engines/engine.js"; import type { EngineOptions } from "@babylonjs/core/Engines/thinEngine.js"; import { Scene } from "@babylonjs/core/scene.js"; import { type EntityRecord, type TransformValue, type MaterialOverride, type MaterialSlotDescriptor, type MaterialExecutionPolicy, type CapabilityAvailability, type RuntimeQualityPolicy, type RuntimeQualityState, type SceneDocumentData, type SourceNodeDescriptor, type CapabilityDescription, type RuntimeBackendSnapshot, type RuntimeProbeReport, type GpuProgramCacheSnapshot, type SceneCostReport, type SceneCostSamplingOptions } from "@skenora/contracts"; import { EventHub } from "@skenora/events"; import { type SkenoraPlugin } from "@skenora/plugins"; import type { ResourceResolver } from "@skenora/resources"; import { RuntimeNativeAttachmentRegistry } from "../systems/native-attachment-registry.js"; import { RuntimeServiceRegistry } from "../systems/runtime-service-registry.js"; import { type RuntimeTransformLeaseOptions, type RuntimeTransformWriteLease } from "../systems/runtime-transform-leases.js"; import { RuntimeTransientEntities, type RuntimeTransientLimits } from "../systems/runtime-transient-entities.js"; import { CameraController } from "../systems/camera-controller.js"; import { AnnotationProjector } from "../projection/annotation-projector.js"; import type { RuntimeEntityProjectionChange } from "../projection/entity-projection-registry.js"; import { ViewportController } from "../presentation/viewport-controller.js"; import { type RuntimeLoop } from "../systems/runtime-loop.js"; export type { RuntimeLoop, RuntimeSystem, RuntimeSystemPhase, RuntimeTickContext, RuntimeLoopState, } from "../systems/runtime-loop.js"; import { type RuntimeNodeDescriptor, type RuntimeNodeFilter, type RuntimeNodeStatistics } from "../inspection/node-tools.js"; import { RuntimeCapabilityRegistry } from "./runtime-capability-registry.js"; import { type LoadDocumentOptions } from "./runtime-document-coordinator.js"; import type { RuntimeEventMap } from "./runtime-events.js"; import { queryStaticSurface } from "../inspection/static-surface.js"; export type { LoadDocumentOptions } from "./runtime-document-coordinator.js"; export type { RuntimeEventMap } from "./runtime-events.js"; export interface RuntimeSessionOptions { antialias?: boolean; engineOptions?: EngineOptions; /** Whether render size follows the browser device pixel ratio. */ adaptToDeviceRatio?: boolean; events?: EventHub; autoResize?: boolean; /** Host-owned budgets and enablement for explicitly authored materials. */ materialPolicy?: MaterialExecutionPolicy; /** Optional host limits; authored style remains unchanged in the document. */ qualityPolicy?: RuntimeQualityPolicy; /** Authoring never auto-starts document behavior; playback honors autoStart. */ executionMode?: RuntimeExecutionMode; plugins?: readonly RuntimePlugin[]; transientLimits?: RuntimeTransientLimits; /** Explicitly retain unavailable extension data for a degraded view. Default is strict. */ nativeAttachmentPolicy?: "strict" | "preserve"; /** @deprecated Use plugins. */ extensions?: readonly RuntimeExtension[]; } export type RuntimeExecutionMode = "authoring" | "playback"; export interface RuntimeExecutionSnapshot { readonly generation: number; readonly simulationReady: boolean; readonly behaviorsRunning: boolean; readonly loop: import("../systems/runtime-loop.js").RuntimeLoopState | null; readonly services: readonly import("../systems/runtime-service-registry.js").RuntimeServiceState[]; readonly transients: readonly import("../systems/runtime-transient-entities.js").RuntimeTransientEntityState[]; } export type RuntimePlugin = SkenoraPlugin; /** @deprecated Use {@link RuntimePlugin}. */ export type RuntimeExtension = RuntimePlugin; export type RuntimeDocumentSetting = "extensions" | "camera" | "cameraPaths" | "environment" | "ground" | "fog" | "weather" | "lights" | "materials" | "textureAnimations" | "animationTracks" | "animationClips" | "postProcess"; export declare class RuntimeSession { #private; readonly canvas: HTMLCanvasElement; readonly engine: Engine; readonly scene: Scene; readonly annotations: AnnotationProjector; readonly viewport: ViewportController; readonly events: EventHub; readonly capabilities: RuntimeCapabilityRegistry; readonly nativeAttachments: RuntimeNativeAttachmentRegistry; readonly services: RuntimeServiceRegistry; readonly importedAnimations: import("@skenora/contracts").ImportedAnimations; readonly executionMode: RuntimeExecutionMode; readonly materialPolicy: Readonly>; readonly qualityPolicy: Readonly; constructor(canvas: HTMLCanvasElement, options?: RuntimeSessionOptions); get viewportCamera(): CameraController | null; captureView(): import("@skenora/contracts").SceneViewState; restoreView(state: import("@skenora/contracts").SceneViewState): void; cancelFocus(): void; observeView(options?: import("../presentation/view-observation.js").SceneViewImageOptions): Promise; get rendering(): boolean; /** Whether document-authored auto behaviors are currently running. */ get behaviorsRunning(): boolean; getQualityState(): RuntimeQualityState | null; /** Serializable observation of the active Babylon backend and device caps. */ getBackendSnapshot(): RuntimeBackendSnapshot; /** Explicit, bounded diagnostics. Does not start or resume the render loop. */ sampleSceneCost(options?: SceneCostSamplingOptions): Promise; getGpuProgramCacheSnapshot(): GpuProgramCacheSnapshot; /** Explicit render/readback evidence; never run during initialization. */ probe(): Promise; classifyEntityChange(entity: Readonly, path: readonly (string | number)[]): RuntimeEntityProjectionChange; describeMaterialSlots(entityId: string): readonly MaterialSlotDescriptor[]; getMaterialPreparationObservation(materialId: string): { scope: "surface"; status: import("@skenora/contracts").MaterialPreparationEvent["status"]; observedAt: number; projectionGeneration: number; } | null; /** Managed continuous input owns the complete authored root transform. */ claimEntityTransform(entityId: string, onRevoked: (reason: SceneAnimationCancellationReason) => void, includeCamera?: boolean): () => void; acquireEntityTransform(options: RuntimeTransformLeaseOptions): RuntimeTransformWriteLease; subscribeClock(listener: (deltaMs: number) => void): () => void; /** Trusted optional animation adapters reuse the session's existing owners. */ getImportedAnimationMixerPorts(): import("../systems/managed-imported-animation.js").ManagedImportedAnimationPorts; get simulationReady(): boolean; get transients(): RuntimeTransientEntities; getRuntimeSnapshot(): RuntimeExecutionSnapshot; describeModelNodes(entityId: string): readonly SourceNodeDescriptor[]; getLoadedModelInformation(entityId: string, options?: import("@skenora/contracts").ModelInformationOptions): import("@skenora/contracts").LoadedModelInformation | null; get projectionGeneration(): number; queryStaticSurface(ray: import("@skenora/contracts").StaticSurfaceRay): ReturnType; captureManagedTransforms(entityIds: readonly string[]): Record; frameModelPart(entityId: string, partId: string, generation: number): void; describeModelNodeTree(entityId: string, filter?: RuntimeNodeFilter): readonly RuntimeNodeDescriptor[]; getModelStatistics(entityId: string): RuntimeNodeStatistics; describeModelMaterials(entityId: string): readonly MaterialOverride[]; /** Captures document-owned runtime edits without serializing Babylon internals. */ captureDocument(source: Readonly): SceneDocumentData; updateEntity(entity: Readonly): void; applyDocumentSettings(document: Readonly, settings?: readonly RuntimeDocumentSetting[]): Promise; /** Data-only observation of this composition; does not load optional chunks. */ getCapabilityDescriptions(): readonly CapabilityDescription[]; getCapabilityAvailability(): readonly CapabilityAvailability[]; loadDocument(document: Readonly, resources: ResourceResolver, options?: LoadDocumentOptions): Promise; /** Starts document-authored auto behaviors without enabling editor tools. */ startDocumentBehaviors(): void; /** Stops document-authored auto behaviors while keeping the scene loaded. */ stopDocumentBehaviors(authoringDocument?: Readonly): void; centerImportedModelsAtOrigin(): boolean; resize(): void; pause(): void; resume(): void; /** Host systems run during playback or explicit authoring preview only. */ get loop(): RuntimeLoop; install(plugin: RuntimePlugin): () => void; showGrid(visible: boolean): Promise; get backgroundVisible(): boolean; setBackgroundVisible(visible: boolean): void; dispose(): void; } //# sourceMappingURL=runtime-session.d.ts.map