import { T as ToolHost } from '../tool-host-BqJRPr_T.js'; import { B as Bridge } from '../types-D_TzdBsK.js'; import '../types-ITRQFAir.js'; /** * Loose grid types — the public state shape of `@particle-academy/fancy-grid`, * mirrored here rather than imported. * * Same reason the scene bridge mirrors fancy-3d's descriptor: a bridge must not * drag its surface package into every consumer's tree. fancy-grid keeps * TanStack Table and Virtual as PEERS specifically so nothing bundles them, and * an `import type` here would still make fancy-grid a build-time dependency of * agent-integrations. The state is four small JSON shapes; the coupling is not * worth it. */ type GridSort = { id: string; desc: boolean; }; type GridFilter = { id: string; value: string; }; type GridPagination = { pageIndex: number; pageSize: number; }; type GridState = { sorting?: GridSort[]; filters?: GridFilter[]; /** Keyed by row id — see the grid's `getRowId`. */ rowSelection?: Record; pagination?: GridPagination; }; type GridBridgeAdapter = { id: string; title?: string; screenId?: string; /** Controlled state — the same object the grid's `onStateChange` emits. */ getState: () => GridState; setState: (next: GridState) => void; /** * Column ids an agent may address. Supplied so a tool can REJECT an unknown * column instead of writing a sort nothing applies — a silently ignored sort * looks identical to a grid that simply is not sorted. */ getColumnIds?: () => string[]; /** Row ids currently on screen, for `grid_select_rows` validation. */ getRowIds?: () => string[]; /** * Write one cell. Absent when the grid is read-only, in which case * `grid_edit_cell` is not registered at all rather than failing at call time * — an agent should discover the capability from the tool list. */ editCell?: (rowId: string, columnId: string, value: unknown) => void | Promise; }; type GridBridgeOptions = { adapter: GridBridgeAdapter; agent?: { id: string; name?: string; color?: string; }; /** * Gate writes behind a human confirmation. `grid_edit_cell` is the only * mutation that changes DATA rather than view state, so it is the one that * matters here — sorting a grid is not a trust-but-verify action. */ pendingMode?: boolean; onPending?: (staged: { id: string; label: string; apply: () => void | Promise; }) => void; }; /** * registerGridBridge — MCP access to a `fancy-grid` surface. * * `grid_sort`, `grid_filter`, `grid_select_rows` and `grid_edit_cell`, plus a * read tool. View state (sort / filter / selection / page) goes through one * `setState` channel because that is how the grid is controlled — a bridge that * mutated pieces separately would drift from what the component actually * accepts. */ declare function registerGridBridge(host: ToolHost, options: GridBridgeOptions): Bridge; export { type GridBridgeAdapter, type GridBridgeOptions, type GridFilter, type GridPagination, type GridSort, type GridState, registerGridBridge };