import type { Model } from "@oh-my-pi/pi-ai"; import type { ModelCompactionPoint } from "@oh-my-pi/pi-tui/overlays/model-browser"; import type { ContextWindowTiers } from "../config/model-registry.js"; import type { ScopeLike } from "../config/registry.js"; import type { Settings } from "../config/settings.js"; import { type CompactionSettings } from "./context-settings.js"; /** The compaction policy in force for `model`: the configured policy with its `compaction.modelThresholds` entry applied. */ export declare function resolveModelCompactionSettings(scope: ScopeLike, model: { provider: string; id: string; } | null | undefined): CompactionSettings; /** Where auto-compaction triggers for `model` and which setting decides it, for the model hub preview. */ export declare function describeModelCompactionPoint(scope: ScopeLike, model: Model): ModelCompactionPoint; /** * Where a compaction policy triggers on a window, and why: at a `fixed` token * count (`cappedFrom` the configured count when it is at or past the window, * which then compacts at the window less its reserve), or `scaled` to `share` * percent of `scaledFrom` (the entry's base when `fromBase`, else the window). * `share` is the configured percentage when one applies, else the reserve * policy's exact share, so fractions survive. */ export type ModelCompactionTrigger = { kind: "fixed"; tokens: number; cappedFrom?: number; } | { kind: "scaled"; tokens: number; share: number; scaledFrom: number; fromBase: boolean; }; /** * What a typed compaction limit would do to `model`: the window it runs on and * where it compacts (`trigger` undefined when auto-compaction is off), or with * no entry for empty input (`reset`). Undefined for input that does not parse * or fit, which {@link setModelCompactionPoint} reports on submit. */ export declare function planModelCompactionPoint(settings: Settings, model: Model, input: string, tiers: ContextWindowTiers | undefined): { reset: boolean; window: number | undefined; trigger: ModelCompactionTrigger | undefined; } | undefined; /** * Live preview line of a typed compaction limit for the hub field * ({@link planModelCompactionPoint} in words): `compacts at 340K ยท 85% of 400K * base`, prefixed `resets:` for empty input. */ export declare function previewModelCompactionPoint(settings: Settings, model: Model, input: string, tiers: ContextWindowTiers | undefined): string | undefined; /** * Outcome of {@link setModelCompactionPoint}: the entry written (`undefined` = * removed), that entry in words (`400,000-token base`, `reset`), and where the * model now compacts (`trigger`, and `summary` in words); or, before writing an * entry that opens `extendedWindow`, a warning to acknowledge first, with * `premiumFrom` set when compaction would let input reach that long-context * price tier. */ export type ModelCompactionPointUpdate = { kind: "saved"; entry: number | string | undefined; described: string; trigger: ModelCompactionTrigger | undefined; summary: string | undefined; } | { kind: "confirm"; message: string; extendedWindow: number; premiumFrom?: number; }; /** * Persist `input` (see {@link parseCompactionPointInput}) as `model`'s own * `compaction.modelThresholds` entry in the global config; empty input removes * it. A token count is the base the compaction policy scales (it stands in for * the window), so it may not exceed the largest window `model` can run with * (`tiers.extended`, else its current window); a fixed trigger (`f400k`) must * stay below it. Throws on unparseable or too-large input, and when a project * or higher-priority layer sets the same key, which would leave the global * write without effect. * * A base past `tiers.standard`, or a fixed trigger at or past it, opts the * model into its extended window (see `ModelRegistry.contextWindowTiers`); * unless extended context is already on, it is written only once `confirmed`, * and otherwise returns the warning to show. */ export declare function setModelCompactionPoint(settings: Settings, model: Model, input: string, options?: { tiers?: ContextWindowTiers; confirmed?: boolean; }): ModelCompactionPointUpdate;