/** * Binds Stage-1 relevance selections to exact prior dialogue sources for * the planner and completion evaluator. Current requests, standing provider constraints, * instructions, runtime feedback and tool evidence are never selectable away. * Absent, malformed or stale selections preserve the complete original context. */ import type { CompletionContextSelection } from "../types/components.js"; import type { JSONSchema } from "../types/model.js"; import type { ContextObject, ContextSegmentEvent } from "./context-object.js"; /** Runtime-only proof from the owner-scoped approval reader. Serialized/model * metadata cannot mint this symbol; complete original receipt bytes stay intact. */ export declare const HISTORICAL_EFFECT_TERMINALS: unique symbol; export interface HistoricalEffectTerminal { requestSourceEventId: string; originalReceiptHash: string; terminalReceipt: unknown; state: "done" | "rejected" | "expired"; } /** Shared source-selection policy; each stage supplies its request-local binding. */ export declare const COMPLETION_CONTEXT_SELECTION_INSTRUCTIONS = "History selection: use the source map to select original facts, applicable standing constraints/corrections, referents and explicitly continued unfinished work in completionContext. Assign each source once; its exact text remains intact. Completed tasks are not pending, and task-scoped restrictions do not automatically become standing rules. Preserve corrections and original speaker attribution; navigation receipts follow their request.\nUse relevant_prior_dialogue with complete=true when dependencies are resolved (an empty selection is valid), otherwise all_prior_dialogue with complete=false. Exhaustive dialogue coverage needs all originals; live-record questions need tools. Use the sourceSetId required by the response schema. Current request, system/provider constraints and receipts remain complete; selection proves relevance, never execution."; /** Shared static and registered Stage-1 wire schema. */ export declare const COMPLETION_CONTEXT_SCHEMA: { type: string; additionalProperties: false; properties: { mode: { type: string; enum: string[]; description: string; }; sourceSetId: { type: string; pattern: string; description: string; }; complete: { type: string; description: string; }; relevantSourceIds: { type: string; items: { type: string; pattern: string; }; }; constraintSourceIds: { type: string; items: { type: string; pattern: string; }; }; referentSourceIds: { type: string; items: { type: string; pattern: string; }; }; pendingIntentSourceIds: { type: string; items: { type: string; pattern: string; }; }; }; required: string[]; }; /** Initial and repair requests both offer the exact current identity. The * third argument remains accepted for existing callers; host validation and * request-local token binding still decide whether a selection can apply. */ export declare function withRequiredCompletionSourceIdentity(schema: JSONSchema, context: ContextObject, _exactRepair?: boolean): JSONSchema; /** Strict selector parsing; invalid optional hints mean full context. */ export declare function parseCompletionContextSelection(value: unknown): CompletionContextSelection | undefined; /** Collect complete, unambiguous sources in order. Callers needing only entries * need not compute a turn-bound hash; selection still uses completionContextSources. */ export declare function collectCompletionContextSources(context: ContextObject): Array<{ id: string; event: ContextSegmentEvent; }>; /** Historical navigation and owner-declared read observations follow their * original requests, never current state or mutation authority. Completion may * also defer validated historical outcomes for reviewed omitted requests; * canonical history and planning evidence remain complete by default. * Only known, unambiguous request bindings may follow a history projection. * Unknown or malformed records stay inline; originals are never modified. */ export declare function selectHistoricalNavigation(context: ContextObject, includedEventIds: ReadonlySet, options?: { historicalEffects?: boolean | "settled"; }): ContextObject; /** Compact IDs are bound to the exact turn, room, identities and source bytes. */ export declare function completionContextSources(context: ContextObject): { sourceSetId: string; sources: Array<{ id: string; event: ContextSegmentEvent; }>; }; /** Relevance is applied only after source binding and complete category checks. */ export declare function selectCompletionContext(context: ContextObject, options?: { historicalEffects?: boolean | "settled"; }): { context: ContextObject; applied: boolean; omittedSourceCount: number; selection?: CompletionContextSelection; }; /** Tokenized retrieval queries are diagnostics, not authored dialogue. Keep the * complete array in the source event and restore it through RESTORE_CONTEXT; * preserve all other routing, permission, patch, and execution fields inline. */ export declare function referencePlannerQueryTokens(context: ContextObject): { context: ContextObject; applied: boolean; };