/** * Prompt rendering of harness state: a compact overview for injection, a * shorter routing overview, and the recent refinement history. * @module dsh-continual-harness */ import type { Session } from '@deepseek-ai/dsh-session'; import type { HarnessState, RefinementKind, RefinementResult } from './types.ts'; /** Default per-kind entry cap in the full overview. */ export declare const DEFAULT_ENTRIES_PER_KIND = 6; /** Default index length in stable-anchor mode. */ export declare const DEFAULT_INDEX_LINES = 15; /** What the injected block is ranked against. */ export type InjectionAnchor = 'query' | 'stable'; /** Header note that tells the model how the stable block's index was chosen. */ export declare const STABLE_ANCHOR_NOTE = "session opening request + project cwd (stable for this session; read entries on demand)"; /** Default content truncation length. */ export declare const DEFAULT_CONTENT_MAX_CHARS = 180; /** Default refinement history length in the overview. */ export declare const DEFAULT_REFINEMENTS_IN_OVERVIEW = 5; /** Default per-kind cap in the routing overview. */ export declare const DEFAULT_OVERVIEW_PER_KIND = 40; /** Max query length fed to ranking. */ export declare const MAX_QUERY_CHARS = 400; /** Full-message acknowledgement phrases dropped from the query. */ export declare const ACK_PHRASES: ReadonlySet; /** * Build the ranked-injection query from the most recent effective direct-user * message. * * Reads the session's derived history rather than the event log: that array is * the current model-visible projection (a raw event with no surface marker is * absent, a compaction replace removes shadowed nodes, and plugin-owned message * changes arrive already applied), which is the transcript the query ranks * against. It also avoids `snapshotEvents()`, a synchronous history read whose * new uses are prohibited. */ export declare function buildQueryFromSession(session: Session, maxChars?: number): string; /** Text ranked against in stable mode: the session's opening request plus its project identity. */ export declare function buildStableAnchor(session: Session, maxChars?: number): string; /** * Split a ranking query into the terms that actually get matched. * * The query is a whole user message, so matching it as one substring matched * nothing in practice: over the live state a natural Chinese sentence scored * zero hits, which silently degraded injection to pure recency and made every * entry outside the newest `maxPerKind` unreachable. Terms are matched * individually instead, and a CJK run is matched as two-character shingles * because single Chinese characters are far too common to discriminate. */ export declare function queryTerms(query: string): string[]; /** * Structured injection render: ranked overview, scope-qualified keys, and the * subset of those keys that actually matched the anchor (`matchedKeys`). * * `matchedKeys` exists so callers can tell a response to the current question * apart from recency filler: a follow-up message that matches nothing still * reorders the selection, and re-injecting on that alone would trade relevant * experience for the newest entries. * * With `indexLines`, the per-kind sections shrink to counts and one ranked * index of `indexLines` id lines replaces them. The index is what a * session-stable anchor can afford to rerender: it carries routing hints at a * fraction of the tokens, so a block that must stay byte-stable across turns * stays small, and detail moves to on-demand reads through the tool. * * `project` orders the index by ownership before relevance. A session-stable * anchor is built from the opening request, whose terms are corpus-wide on this * state (measured: `dsh` df=26, `harness` df=20 against 75 entries, both dropped * as non-discriminative, leaving an index 80% identical to plain recency), and * no amount of term weighting recovers a fact that is not in the text. Ownership * is that fact: entries of the working project first, project-agnostic entries * next, other projects' entries last — a rank, never a filter, so a mis-tagged * entry is outranked rather than silently unreachable. */ export declare function formatHarnessStateForPromptStructured(state: HarnessState, query: string, opts: { maxPerKind?: number; sessionId: string; isLocal: (kind: RefinementKind, id: string) => boolean; indexLines?: number; anchorNote?: string; project?: string; }): { overview: string; injectedKeys: string[]; matchedKeys: string[]; }; /** Render a shorter routing overview (more entries, truncated content). */ export declare function overviewForPrompt(state: HarnessState): string; /** Render the recent refinement history fed to the planner. */ export declare function historyForPrompt(results: RefinementResult[], max?: number): string; //# sourceMappingURL=render.d.ts.map