import type { McpToolContext } from '#blokkli/agent/app/types'; import type { ComponentParams } from './index.js'; export type Phase = 'streaming' | 'approval' | 'error'; export type FieldState = { uuid: string; fieldName: string; fieldLabel: string; status: 'pending' | 'streaming' | 'done'; mode: 'full' | 'patch' | null; fullValue: string; operations: Array<{ search: string; replace: string; }>; /** Accumulated operations across all retry attempts (for details display). */ allOperations: Array<{ search: string; replace: string; }>; currentSearch: string; baseValue: string; /** The original value before any streaming attempts. */ originalBaseValue: string; }; type OverrideEntry = { uuid: string; fieldName: string; element: HTMLElement | null; setValue: (value: string) => void; restore: () => void; originalValue: string; }; /** * Owns the streaming subsystem of the `delegate_text_rewrite` tool: SSE transport, * the event state machine, markup buffering, live-DOM overrides, and the readability * retry loop. The component keeps the approval UI and emits. * * `phase`/`errorMessage` live here because the streaming code is their primary * writer (and `phase` doubles as a control-flow signal — e.g. an SSE `error` event * sets `phase='error'` mid-stream); owning them keeps that flow intact. The * composable never calls `emit`: a user cancel surfaces via `start()`'s * `{ cancelled }` result, and the success fall-through invokes the injected * `onComplete` (the component's `transitionToApproval`). */ export declare function useFieldRewriteStream(options: { context: McpToolContext; params: ComponentParams; onComplete: () => void; }): { phase: any; errorMessage: any; streamingTitle: any; streamUsage: any; fieldStates: any; findFieldState: (uuid: string, fieldName: string) => FieldState | undefined; findOverride: (uuid: string, fieldName: string) => OverrideEntry | undefined; start: () => Promise<{ cancelled: boolean; }>; restoreAll: () => void; abort: () => void; dispose: () => void; }; export {};