import type { Act, ChatOpts, ReportLine, TurnRecord, TurnReturned } from '../contract/vocabulary.js'; import type { ToolPort } from '../contract/ports.js'; import type { CompiledAgent } from '../cards/cards.js'; import type { DeliveryFact } from './delivery-facts.js'; import type { Masker } from './masker.js'; import type { Rulebook } from './rulebook.js'; import type { StatusClerk } from './status-clerk.js'; import type { ModelSeat } from './model-seat.js'; import type { PromptWriter } from './prompt-writer.js'; import type { FinishDesk } from './finish-desk.js'; import type { DeliveryWriter } from './delivery-writer.js'; import type { Session } from './session.js'; /** The report line the record contradicts: among the acts of that tool (and target, * where the line names one), NONE settled with the word the line claims. An act * retried into a different standing supports the word it reached — the record's * own history is not a contradiction of its outcome. */ export declare function contradictedLine(report: readonly ReportLine[], acts: readonly Act[]): ReportLine | undefined; /** The report line about a tool NOTHING touched this turn: a claimed word with no act * behind it is a claim about nothing — the desk spoke an outcome instead of making * the call. The honest no-act row, `no_tool_called`, passes; every other word needs * at least one act of its tool on the record for `contradictedLine` to weigh. */ export declare function unactedLine(report: readonly ReportLine[], acts: readonly Act[]): ReportLine | undefined; /** What the records of this turn carry, harvested once: every canonical AMOUNT and * every IDENTIFIER. The sources are the OPERATOR'S own messages, the contract's own * facts as the desk was handed them, the turn's and the history's args, results and * sentences, and the turn's own owed facts — every line * the engine mints and demands the reply carry is a record the reply may stand on. * The engine's own corrections are not records and never ground anything — a figure * named in a redrive stays as ungrounded as it was. */ export interface GroundedRecords { readonly amounts: ReadonlySet; readonly ids: ReadonlySet; } export declare function groundedRecords(operatorTexts: readonly string[], acts: readonly Act[], facts: readonly DeliveryFact[], stated?: readonly string[]): GroundedRecords; /** Every canonical amount a text states that the records do not carry. A figure worked * out at the desk — a product, a sum — grounds on nothing. Two things leave the text * first: this prompt's own fact labels, whose number counts the block and names no * amount, and the identifiers THE RECORDS CARRY, so the digits inside a record's name * for a thing are never read as an amount. A token that merely wears the shape of an * identifier and names nothing on the record stays in the text and answers for its * digits. */ export declare function ungroundedAmounts(text: string, records: GroundedRecords): readonly string[]; /** The one sentence both walks send back — the desk's draft and the delivered words * answer to the same law. */ export declare function ungroundedSentence(subject: string, ungrounded: readonly string[]): string; /** What this turn's done reads returned, one JSON string per distinct result. */ export declare function readMaterial(acts: readonly Act[]): readonly string[]; /** A done read's identifiers are the record's answer. Prose that carries not one * of them delivered nothing the reads returned — an identifier the operator already * typed is not an answer, it is the question read back. Reads that return no * identifiers (an empty log, a not-found) demand nothing. */ export declare function proseDropsReads(acts: readonly Act[], prose: string): boolean; export interface TurnDeps { readonly compiled: CompiledAgent; readonly seat: ModelSeat; readonly toolPort: ToolPort; readonly rulebook: Rulebook; readonly clerk: StatusClerk; readonly masker: Masker; readonly promptWriter: PromptWriter; readonly finishDesk: FinishDesk; readonly deliveryWriter: DeliveryWriter; } export declare class Turn { private readonly deps; /** The metered port of the run in flight — every call it serves books its cost. */ private metered; constructor(deps: TurnDeps); run(session: Session, userText: string, opts?: ChatOpts): Promise; /** EVERY DETERMINISTIC REFUSAL a closing message earns: the declared reply guards, * the owed facts (carried, expressed, and never invented), the figure walk and the * engine's own labels. One funnel — the writer is the same desk either way. * * `reportIsKept` says whether this turn seals the report the desk files. A turn the * MODEL closes seals it, so the rulers that read it charge it: the honesty floor and * a report line the record contradicts. A turn the ENGINE closes discards it, and a * refusal earned on a discarded line would cost the operator the deterministic floor * — the record dump — in exchange for nothing any record holds. */ private replyViolations; /** 'sealed' = the finish landed clean · 'redrive' = correction sent. The reply * pipe: the deterministic funnel → the judged pass on the session's own seat → * the delivered walk → seal. The message the desk wrote IS the delivery. */ private tryFinish; /** The model EDITS its rejected finish rather than regenerating blind: the attempt * rides back as its own words, the correction names what to change. */ private sendBack; /** The declared rewrites, applied to every candidate the operator could receive. */ private rewrite; /** What the words the operator would receive are read for: the figure walk first — * the SAME law the desk's own draft answered to, one stage later — then the prose * reader. Returns the correction to send and the mark it leaves, or null. */ private deliveryRefusal; /** THE DESK'S CLOSE-STEP. The engine ended the turn — a consent question stands, or * the retries are spent — so no finish of the model's closed it, and the desk is * given one more step in ITS OWN conversation to write the words the operator * reads: the same system, the same tool cards, the same acts, and one user message * carrying the numbered owed facts and the order to write. The same funnel charges * what comes back, and a refusal redrives the desk on that same prefix. */ private engineClose; /** A report row naming a target none of this turn's calls of that tool carried claims a * question nobody put to the surface. The engine drops it on the spot, on the record, * and the rest of the reply is checked as written — no correction is spent on a row * that cannot exist. */ private withoutImpossibleRows; /** A held act whose closing report line reads `refused` is withdrawn: the question * closes `withdrawn`, its code licenses nothing, and the act stands on the record as * not-done/blocked with the withdrawal as its owed refusal. The operator is never * handed a code for an act the desk itself has just refused. Answers whether any * question was withdrawn. */ private withdrawRefusedHolds; /** What a result check found, owed to the operator as a note: the check's own words * where it spoke, and the guard's rule where it did not. A result that fails its * declared check is never reported as a plain success — the note rides the delivery * and the reply has to express it. */ private findingNotes; /** The close-step itself: null when the desk cannot be asked or does not pay. */ private closeStep; } //# sourceMappingURL=turn.d.ts.map