/** * Salience: how much the next step depends on each message. * * The compaction pass chose what to keep by position — the floor, the * last few turns, the last few tool results — and a fact stated in the * middle of a long turn aged out at the same rate as chatter. This gives * every message a number instead, from four things the kernel can * observe without a model: * * recency how many messages ago, decayed with a half-life; * relevance BM25 against the goal — the task, the requirements, the * open plan items, the latest intent; * utility whether it was USED: a tool result whose paths and * identifiers reappear in a later tool input or assistant * turn; an instruction from the user; * redundancy whether a later message says the same thing — a repeated * read, the same error twice — so the older copy yields. * * What no score may cross is stated as `protected`: the leading system * run, `retain` markers with the turn they pull in, the most recent * turns, and the other half of a tool-call pair. Pure, like `plan.ts`: * no turn, no logger, no provider, so it can be asked without one. */ import type { Message } from '../../types/message/index.js'; export interface SalienceWeights { readonly recency: number; readonly relevance: number; readonly utility: number; readonly redundancy: number; } export declare const DEFAULT_SALIENCE_WEIGHTS: SalienceWeights; export interface SalienceConfig { /** Messages after which recency has halved. */ readonly halfLifeMessages: number; /** Estimated Jaccard at or above which two messages are the same thing. */ readonly duplicateThreshold: number; readonly weights: SalienceWeights; } export declare const DEFAULT_SALIENCE_CONFIG: SalienceConfig; export type ProtectedReason = 'system-floor' | 'retain' | 'recent' | 'pair'; export interface ScoredMessage { readonly index: number; readonly role: Message['role']; /** Estimated tokens of the message, including rich content and tool inputs. */ readonly tokens: number; readonly recency: number; readonly relevance: number; readonly utility: number; readonly redundancy: number; /** The weighted sum; meaningful only relative to the other messages of the same pass. */ readonly salience: number; readonly protected: ProtectedReason | null; } export interface ScoreOptions { /** The goal vector as text: task statement, requirements, open plan items, latest intent. */ readonly goal: string; /** How many trailing messages are protected as recent. */ readonly keepRecentMessages: number; readonly config?: Partial; } /** The model-visible text of a message, with an assistant's tool inputs. */ export declare function messageText(message: Message): string; export declare function scoreMessages(messages: readonly Message[], options: ScoreOptions): ScoredMessage[]; //# sourceMappingURL=score.d.ts.map