import type { Node } from "@babylonjs/core/node.js"; import type { Scene } from "@babylonjs/core/scene.js"; import { type SceneNativeAttachment, type SceneNativeAttachmentContract, type SceneDocumentData } from "@skenora/contracts"; import type { ResourceResolver, ResourceScope } from "@skenora/resources"; export interface NativeAttachmentState { readonly id: string; readonly capability: string; readonly version: number; readonly projectionGeneration: number; readonly status: "registered" | "preparing" | "ready" | "failed" | "disposed"; readonly diagnostic?: string; } export interface NativeAttachmentContext { readonly scene: Scene; /** Borrowed target; implementation must never dispose it. */ readonly target: Node; readonly document: Readonly; readonly record: Readonly; readonly resources: ResourceScope; readonly signal: AbortSignal; /** Register owned objects/listeners immediately, before another await. */ own(cleanup: () => void): void; subscribeClock(listener: (deltaMs: number) => void): () => void; } export interface NativeAttachmentInstance { validate?(document: Readonly, record: Readonly): void; /** Synchronous changes restricted to contract.updateFields; structural edits recreate. */ update?(record: Readonly): void; dispose(): void; } export interface NativeAttachmentImplementation { readonly contract: SceneNativeAttachmentContract; /** Trusted composition-time dependency on document service record IDs. */ readonly requiresServices?: readonly string[]; create(context: NativeAttachmentContext): NativeAttachmentInstance | Promise; } export interface NativeAttachmentRegistryPorts { readonly scene: Scene; resolveTarget(record: Readonly, document: Readonly, generation: number): Node; subscribeClock(listener: (deltaMs: number) => void): () => void; publish(state: NativeAttachmentState): void; } interface Source { document: Readonly; resources: ResourceResolver; generation: number; policy: "strict" | "preserve"; signal?: AbortSignal; isCurrent(): boolean; } /** Domain registry installed through RuntimePlugin; no second plugin host or render loop. */ export declare class RuntimeNativeAttachmentRegistry { #private; readonly ports: NativeAttachmentRegistryPorts; constructor(ports: NativeAttachmentRegistryPorts); register(implementation: NativeAttachmentImplementation): () => void; contracts(): readonly SceneNativeAttachmentContract[]; getStates(): readonly NativeAttachmentState[]; get ready(): boolean; disposeServiceDependencies(serviceId: string): void; refreshServiceDependencies(): void; preflight(document: Readonly, policy?: "strict" | "preserve"): void; /** Called when a newer document is queued, so obsolete async work stops promptly. */ invalidate(document: Readonly): void; reconcile(source: Source): Promise; whenReady(): Promise; reset(): void; dispose(): void; } export {}; //# sourceMappingURL=native-attachment-registry.d.ts.map