/** * Backend refine draft adapter for the logic-trace extension. * * Implements the `LogicTraceDraftRunner` seam (see logic-trace.ts) on top of * the backend from/refine pipeline instead of the local LLM agent loop: * 1. `remote_refine_aexol_content` — submits the CURRENT remote logic.aexol * content plus a compressed merge instruction prompt (full-spec rewrite, * "merge, never append-only", grammar + leak rules) and the serialized * recent-activity delta. Answers `{ ok, task: { id, status } }`. The * session model is intentionally NOT sent — the backend resolves the * team's default model. * 2. `remote_get_from_task` — polled locally (NOT via remote_wait_task, * whose internal wait exceeds the MCP client's 30s fetch abort) until a * terminal status or the configured timeout. Answers * `{ ok, task: { id, status, aexolCode, … } }`. * 3. COMPLETED with an `aexolCode` → `{ submitted: { content, changed } }` * where `changed` is a plain string comparison against the current * remote content. * 4. Anything else (FAILED / CANCELLED / poll timeout / missing content / * any error) → `{}` — the empty outcome is the seam's fallback signal * and attemptLogicTraceSync retries with the local draft runner. The * adapter NEVER throws past the seam. * * This file only adapts the draft STEP; the downstream sanitize → parser * gate → hash dedupe → push flow stays in logic-trace.ts untouched. */ import { AexolMcpClient } from "../mcp-client.js"; import type { LogicTraceDraftRunner } from "./logic-trace.js"; /** Default cadence between `remote_get_from_task` polls. */ export declare const DEFAULT_DRAFT_BACKEND_POLL_INTERVAL_MS = 2000; /** Default total wait for a refine task to reach a terminal status. */ export declare const DEFAULT_DRAFT_BACKEND_POLL_TIMEOUT_MS = 120000; export interface BackendRefineDraftRunnerOptions { /** Bootstrapped Aexol backend MCP client (from the extension's bootstrap). */ client: AexolMcpClient; /** Bound Studio project id (every remote_* call carries it). */ projectId: string; /** * Bound team id — injected on every refine/get call so team access * resolves to the BOUND project's team, not the token's first membership. */ teamId?: string; /** Poll cadence for `remote_get_from_task` (default 2s). */ pollIntervalMs?: number; /** Total wait for a terminal task status (default 120s). */ pollTimeoutMs?: number; /** Optional retry hint forwarded to `remote_refine_aexol_content`. */ maxRetries?: number; /** Optional guidance forwarded to `remote_refine_aexol_content`. */ guidance?: string; /** * Constraint block (grammar + leak rules) merged into the refinement * prompt. Supplied by the caller so the adapter stays decoupled from the * logic-trace grammar constant. Only the shared leak-rule list is imported * from logic-trace.ts directly, and it is read lazily inside * buildRefinementPrompt (never at module-eval time) to stay safe within * the logic-trace ↔ backend-draft import cycle. */ promptRules?: string; /** Injectable sleep (tests). */ sleep?: (ms: number) => Promise; } /** * Build a `LogicTraceDraftRunner` that delegates the .aexol draft step to the * backend from/refine pipeline. See the module doc for the outcome contract. */ export declare function createBackendRefineDraftRunner(options: BackendRefineDraftRunnerOptions): LogicTraceDraftRunner; //# sourceMappingURL=logic-trace-backend-draft.d.ts.map