import type { ServerMessage, RestartRequiredMessage, SourceCoherenceMessage } from '@memoarchitect/tools'; import type { BuilderRegistries } from '@memoarchitect/tools'; export interface DevServerOptions { port: number; projectRoot: string; /** Client application root supplied by the caller (for example Architect). */ webPackagePath: string; initialMessages: ServerMessage[]; /** Frozen ontology registries from bootstrap — used to validate diagrams/layouts on load */ ontologyRegistries?: BuilderRegistries; /** * Absolute roots of installed ontology packages. Authoring never writes * into these — they are read-only library content. */ ontologyRoots?: string[]; /** Per-package relationship files from project config. */ relationshipFiles?: Record; /** Configured canonical relationship file from project config. */ canonicalRelationshipFile?: string; /** * Last-chance rewrite of the client's HTML shell, applied to both the Vite * and prebuilt-dist paths. Tools hosts a client it does not own, so * anything the client needs inlined ahead of its bundle — Architect splices * in its feature grants this way — goes through here rather than teaching * the server a vocabulary that belongs to the client. */ transformClientHtml?: (html: string) => string; /** Notified whenever a browser WebSocket connects or disconnects. */ onClientCountChanged?: (count: number) => void; } export interface DevServer { /** The port actually bound — the requested one, or the assigned one for port 0. */ readonly port: number; /** Replace the current state and push it to every client. */ broadcast(messages: ServerMessage[], changedSourceIds?: readonly string[]): void; /** * Send transient messages to connected clients without recording them as * state. A client connecting later must not be told about an event it was * not present for — a stale "your file just changed" is worse than silence. */ notify(messages: ServerMessage[]): void; /** Match watcher events to writes accepted through this server. */ consumeWriteTransactions(files: readonly string[]): { matched: Record; escalationFile?: string; }; /** Reject every model mutation until a clean runtime is relaunched. */ lockMutations(message: RestartRequiredMessage): void; /** * Publish whether the project source currently compiles. * * An incoherent source holds model mutations — the dependency closure is * unknown, so a write cannot be placed safely — but it never demands a * restart, and passing a coherent payload releases the hold. That is the * difference between a typo and a stale semantic environment. */ setSourceCoherence(payload: SourceCoherenceMessage['payload']): void; close(): void; } /** Exported so the lockout boundary is mechanically testable. */ export declare function isModelMutationMessage(type: string): boolean; /** * Project/model state is reconciled over the MEMO WebSocket. Vite must never * turn these writes into a browser reload, even when a local ontology package * is symlinked beneath Vite's dependency graph. */ export declare function isModelOwnedWatchPath(path: string): boolean; /** Resolve only project-owned screen captures, under either capture root. */ export declare function resolveProjectAssetRequest(projectRoot: string, requestUrl: string): string | undefined; export declare function createDevServer(options: DevServerOptions): Promise; //# sourceMappingURL=dev-server.d.ts.map