import { type Ocr18Language } from './ocr-18-language-routing.js'; import { type Ocr18Detection } from './ocr-18-multi.js'; import { type DelegateFile, type DelegatePreview, type DelegateRuleGroup, type RulesResult } from './ocr-18-delegate-payload.js'; import { type Ocr18Range, type Ocr18State } from './ocr-multilang-adapter.js'; export type DelegateSelectedFile = { readonly path: string; readonly status: string; readonly insertions: number; readonly deletions: number; readonly language: Ocr18Language | null; /** The glob that selected this file, or `null` when no rule group claimed it. */ readonly pattern: string | null; }; export type DelegatePacketState = 'no-routed-language' | 'unsupported-files-only' | 'ocr-unavailable' | 'awaiting-envelope'; export type DelegatePacket = { readonly schema_version: '1'; readonly mode: 'delegate'; readonly state: DelegatePacketState; readonly findings: null; readonly rid: string; readonly session: string; readonly git: { readonly from: string | null; readonly to: string | null; readonly commit: string | null; }; readonly detection: { readonly languages: readonly Ocr18Language[]; readonly changed_file_count: number; readonly unsupported_files: readonly string[]; }; readonly cost: { readonly total_files: number; readonly reviewable_count: number; readonly excluded_count: number; readonly total_insertions: number; readonly total_deletions: number; } | null; readonly selected_files: readonly DelegateSelectedFile[]; readonly excluded_files: readonly DelegateFile[]; readonly rules: readonly DelegateRuleGroup[]; readonly warnings: readonly string[]; readonly raw_output: string | null; }; export type DelegatePacketInput = { readonly rid: string; readonly session: string; readonly range: Ocr18Range; readonly detection: Ocr18Detection; readonly preview: DelegatePreview | null; readonly rules: readonly DelegateRuleGroup[]; readonly unavailable: string | null; }; export declare function buildDelegatePacket(input: DelegatePacketInput): DelegatePacket; /** Rule resolution in batches, merged by `source|pattern` — the key the rule text is resolved on. */ export declare function collectDelegateRules(cwd: string, paths: readonly string[], range: Ocr18Range, timeoutMs?: number): RulesResult; /** * A rid is ONE path segment: it names the packet file under the session's * `rd/ocr-delegate/` directory, so a separator or a traversal value would move * the write somewhere the caller did not name. */ export declare function isDelegateRid(value: string): boolean; export type CollectDelegateOptions = { readonly cwd: string; readonly rid: string; readonly session: string; readonly range: Ocr18Range; readonly timeoutMs?: number; }; export type DelegatePacketResult = { readonly packet: DelegatePacket; readonly failure: { readonly state: Ocr18State; readonly rawOutput: string; } | null; }; /** * Phase 1. Writes nothing; the caller owns the path and the durable write. * * No routed language skips BOTH invocations, exactly like the API path: spawning * OCR to discover there is nothing to review is the cost that guard exists for. */ export declare function collectDelegatePacket(options: CollectDelegateOptions): DelegatePacketResult; export declare function writeDelegatePacket(packetPath: string, packet: DelegatePacket): void;