/** * `auditGoal()` — the audit + goal primitive that gates autonomous * LLM execution in the 10% human / 90% LLM workflow. * * Contract: * - Calls an injected `LlmRunner` exactly once. * - Parses the LLM output as JSON and validates that the `audit` * array covers ALL six required dimensions * (correctness, completeness, scope, risks, alternatives, constraints). * - Throws `IncompleteAuditError` if the JSON is malformed or any * required dimension is missing. Callers MUST treat this as a * gate failure (return to human for re-prompting) — autonomous * work must never proceed on a partial audit. * * The `LlmRunner` interface is intentionally minimal so this * service is reusable by `final-review-service` and the slice * LLMArbitrator without forcing a particular provider implementation. */ import type { AuditGoalInput, AuditGoalOutput } from './audit-goal-types.js'; export interface LlmRunner { call(systemPrompt: string, userPrompt: string, opts: { maxTokens: number; }): Promise<{ output: string; /** * `input` / `output` are the counts an observability reader sums; `source` * says whether the provider reported them or the runner had to estimate * (optional so a runner that always has provider numbers — or a test fake — * need not state it). */ tokens: { input: number; output: number; source?: 'provider' | 'estimated'; }; }>; } export declare class IncompleteAuditError extends Error { readonly code: "INCOMPLETE_AUDIT"; constructor(message: string); } export declare function auditGoal(input: AuditGoalInput, llmRunner: LlmRunner): Promise;