/** * HotReloader — Live code reload for HoloScript templates * * Pipeline: Snapshot → Parse → Diff → Migrate → Validate → Swap → (Rollback) * * Handles the 7-step transactional state update process: * [1] Snapshot current state (copy-on-write) * [2] Parse new template AST * [3] Compute schema diff * [4] Run migration chain (v_old → v_old+1 → ... → v_new) * [5] Validate migrated state against new schema * [6] Atomic swap: replace old instances with migrated state * [7] On failure at any step: rollback to snapshot */ import type { HoloTemplate, HoloValue } from '@holoscript/core'; import { type SchemaDiffResult, type MigrationChain } from '@holoscript/core'; export interface HotReloadResult { success: boolean; templateName: string; oldVersion: number; newVersion: number; diff: SchemaDiffResult; migrationChain: MigrationChain | null; instancesMigrated: number; rollback: boolean; error?: string; warnings: string[]; } export interface TemplateInstance { __holo_id: string; templateName: string; version: number; state: Map; } export interface HotReloaderOptions { devMode?: boolean; onWarning?: (msg: string) => void; onReload?: (result: HotReloadResult) => void; onRollback?: (result: HotReloadResult) => void; } export type MigrationExecutor = (instance: TemplateInstance, migrationBody: any) => Promise | void; export declare class HotReloader { private templates; private instances; private devMode; private onWarning; private onReload; private onRollback; private migrationExecutor; constructor(options?: HotReloaderOptions); /** * Set the migration executor — the function that runs migration statement bodies. * This decouples the HotReloader from the runtime's statement interpreter. */ setMigrationExecutor(executor: MigrationExecutor): void; /** * Register a template. Called on initial load. */ registerTemplate(template: HoloTemplate): void; /** * Register a live instance of a template. */ registerInstance(instance: TemplateInstance): void; /** * Unregister an instance (e.g., on destroy). */ unregisterInstance(holoId: string): void; /** * Hot-reload a template. This is the main entry point. * * Steps: * 1. Snapshot all instances of the template * 2. Diff old vs new state schema * 3. Build migration chain if needed * 4. Apply migrations to all instances * 5. Validate and swap * 6. Rollback on failure */ reload(newTemplate: HoloTemplate): Promise; /** * Get all registered templates. */ getTemplates(): Map; /** * Get all instances of a template. */ getInstances(templateName: string): TemplateInstance[]; } //# sourceMappingURL=HotReloader.d.ts.map