/** * Pure helpers for the shim-owned write_neo4j_cypher path. * Extracted from index.ts so the executeWrite tx body, response synthesis, * and value serialization can be unit-tested without the shim's top-level * process bootstrap (which spawns uvx and opens stdin/stdout pipes). * * The shim's index.ts wires these up: rewriter → shared driver → session. * executeWrite(tx => runWriteTxBody(...)) → response synth → stdout. */ export declare const ORPHAN_CHECK_CYPHER: string; export interface GraphTx { run(cypher: string, params?: Record): Promise<{ records: Array<{ keys: readonly string[]; get: (k: string | number) => unknown; }>; summary: { counters: { updates(): { nodesCreated: number; relationshipsCreated: number; propertiesSet: number; }; }; }; }>; } export interface GraphSession { executeWrite(work: (tx: GraphTx) => Promise): Promise; close(): Promise; } export interface GraphDriver { session(): GraphSession; } export declare class OrphanRollbackError extends Error { readonly orphanIds: string[]; readonly sampleLabels: string[]; constructor(orphanIds: string[], sampleLabels: string[]); } export interface AutoContext { agent: string; session: string; } export interface WriteTxOutcome { nodesCreated: number; relsCreated: number; propertiesSet: number; serializedRecords: Array>; } export declare function serializeValue(v: unknown): unknown; /** * Body of the executeWrite tx. Runs the rewritten cypher, captures counters, * runs the orphan check, throws OrphanRollbackError if any orphans remain * (executeWrite catches the throw and rolls back the entire tx). * * Caller is responsible for: (a) opening the session, (b) wrapping this in * `session.executeWrite(tx => runWriteTxBody(tx, ...))`, (c) calling close() * in finally, (d) translating the outcome / OrphanRollbackError into the * synthesised MCP response and audit log lines. */ export declare function runWriteTxBody(tx: GraphTx, rewrittenCypher: string, operatorParams: Record, autoCtx: AutoContext): Promise; export interface WriteSynthInput { nodesCreated: number; relsCreated: number; propertiesSet: number; records: Array>; } export declare function synthesiseWriteResponse(id: string | number, w: WriteSynthInput): string; export declare function synthesiseOrphanRollback(id: string | number, orphanCount: number, sampleLabels: string[]): string; export declare function synthesiseShimError(id: string | number, prefix: string, errMsg: string): string; //# sourceMappingURL=cypher-shim-write.d.ts.map