/** * Read-modify-write helper for investigation graph mutations. * * The backend API requires full graph replacement (PUT, not PATCH). * This helper abstracts: GET → mutate in memory → validate → PUT. */ import type { TaskFlowGraph } from './types.js'; /** * Minimal command interface used by the read-modify-write helpers. * BaseCommand.callKnownOperation is protected, so concrete command subclasses * must cast `this` when passing it to these helpers: * modifyTaskFlowGraph(this as CommandLike, ...) */ export type CommandLike = any; export interface TaskFlowRecord { graph: TaskFlowGraph; id: string; [key: string]: unknown; } /** * Fetch a taskflow by ID and return the full record. */ export declare function fetchTaskFlow(cmd: CommandLike, taskflowId: string): Promise; /** * Perform a read-modify-write cycle on a taskflow graph. * * 1. GET the taskflow * 2. Apply the mutate function to get a new graph * 3. Validate the new graph (errors abort, warnings display) * 4. PUT the updated taskflow * * Returns the mutate function's result (for commands that need extra data). */ export declare function modifyTaskFlowGraph(cmd: CommandLike, taskflowId: string, mutate: (graph: TaskFlowGraph) => { graph: TaskFlowGraph; result: T; }): Promise<{ graph: TaskFlowGraph; result: T; taskFlow: TaskFlowRecord; }>;