import type { Scene } from "@babylonjs/core/scene.js"; import { type CapabilityDescription, type SceneDocumentData, type SceneRuntimeService, type SceneRuntimeServiceContract, type JsonValue } from "@skenora/contracts"; import type { ResourceResolver, ResourceScope } from "@skenora/resources"; import type { RuntimeSession } from "../core/runtime-session.js"; export interface RuntimeServiceState { readonly id: string; readonly capability: string; readonly version: number; readonly generation: number; readonly required: boolean; readonly status: "registered" | "preparing" | "ready" | "running" | "failed" | "disposed"; readonly diagnostic?: string; readonly state?: JsonValue; } export interface RuntimeServiceContext { readonly runtime: RuntimeSession; readonly scene: Scene; readonly document: Readonly; readonly record: Readonly; readonly resources: ResourceScope; readonly generation: number; readonly signal: AbortSignal; own(cleanup: () => void): void; isCurrent(): boolean; } export interface RuntimeServiceInstance { start?(): void; stop?(): void; reset?(): void; getState?(): JsonValue; invoke?(operation: string, input: JsonValue, signal?: AbortSignal): JsonValue | Promise; dispose(): void; } export interface RuntimeServiceImplementation { readonly contract: SceneRuntimeServiceContract; readonly description?: CapabilityDescription; prepare(context: RuntimeServiceContext): RuntimeServiceInstance | Promise; } export interface RuntimeServiceSource { readonly document: Readonly; readonly resources: ResourceResolver; readonly generation: number; readonly signal?: AbortSignal; isCurrent(): boolean; } interface Ports { runtime: RuntimeSession; scene: Scene; publish(state: RuntimeServiceState): void; changed(): void; beforeDispose(id: string): void; report(error: unknown): void; } /** Narrow document-scoped preparation. Plugin registration remains synchronous. */ export declare class RuntimeServiceRegistry { #private; readonly ports: Ports; constructor(ports: Ports); register(implementation: RuntimeServiceImplementation): () => void; contracts(): readonly SceneRuntimeServiceContract[]; getDescriptions(): readonly CapabilityDescription[]; /** Identity is the document record ID, not its capability ID. */ get(recordId: string): T | null; require(recordId: string): T; invoke(recordId: string, operation: string, input: JsonValue, options?: { signal?: AbortSignal; }): Promise; get ready(): boolean; getStates(): readonly RuntimeServiceState[]; preflight(document: Readonly): void; /** Release borrowed material projections before the material owner replaces them. */ invalidateMaterials(document: Readonly): void; reconcile(source: RuntimeServiceSource): Promise; whenReady(): Promise; start(): void; stop(reset?: boolean): void; reset(): void; dispose(): void; } export {}; //# sourceMappingURL=runtime-service-registry.d.ts.map