import { T as ToolHost } from '../tool-host-BBSaU7IJ.cjs'; import { J as JsonObject } from '../types-ITRQFAir.cjs'; import { B as Bridge } from '../types-D_H2f-wF.cjs'; import { DocNode, DocTree, TreeOp, DocReducer, StagePolicy } from '@particle-academy/fancy-doc-commons'; /** Host-provided access to the document tree. */ interface DocAdapter { /** Read the current tree. */ get(): DocTree; /** Replace the tree — host wires this to its `onChange` / `setState`. */ set(next: DocTree): void; /** Optional fancy-screens screen id, for presence scoping. */ screenId?: string; /** Mint a fresh, unique node id. Default: `-`. */ newId?(): string; } /** * A domain op tool beyond the built-in add/update/remove/move — lets a surface * expose its own ops (e.g. cms `set_style`) through the same undo + activity path. */ interface DocOpTool { /** Verb, prefixed with the surface (e.g. `set_style` → `cms_set_style`). */ verb: string; description: string; properties: Record; required: string[]; /** Build the op from the args (or return `{ error }`). */ build(args: JsonObject, tree: DocTree): TOp | { error: string; }; /** Node id this op targets (for the activity target + undo label). */ targetId?(args: JsonObject): string | undefined; } interface DocBridgeOptions> { adapter: DocAdapter; /** Tool-name prefix + activity kind (e.g. `"cms"` → `cms_add`, kind `"cms"`). */ surface: string; agent?: { id: string; name?: string; color?: string; }; /** Reducer for reduce + invert. Default: the substrate `treeReducer()`. */ reducer?: DocReducer, TOp>; /** Build a full node from the core fields + props (fill surface defaults, e.g. `style`). */ makeNode?: (core: { id: string; type: string; parent: string | null; order: string; }, props: Record) => N; /** Domain op tools beyond the built-ins. */ opTools?: DocOpTool[]; /** Decide auto-apply vs. confirm per op. Default: everything auto-applies. */ stagePolicy?: StagePolicy; /** Fired when an op is staged pending human confirmation. */ onPending?: (staged: { id: string; op: TOp; label: string; }) => void; /** Summarize a node for describe/list. Default: id/type/parent + prop keys. */ describeNode?: (node: N) => Record; } /** Register the generic doc-surface bridge. Returns a {@link Bridge}. */ declare function registerDocBridge>(host: ToolHost, options: DocBridgeOptions): Bridge; export { type DocAdapter, type DocBridgeOptions, type DocOpTool, registerDocBridge };