/** * Transient emphasis for the status line. * * Every change this highlights already has an authoritative record. Compaction * and permission changes are Harness-backed durable Session events that replay * with the session; a model or reasoning change is applied to the local * selection and acknowledged in committed native scrollback for this window. In * every case a busy agent can scroll the acknowledgement away within seconds, so * the change can happen off-screen. This module adds a short-lived reading that * borrows the status line's activity segment for a few seconds and then yields * it back — emphasis, never a second record. * * Three rules keep it from becoming something else: * * - A notice only ever describes a fact an authoritative source already * established. It is derived from a Harness session event or from the * before/after of a selection the frontend actually applied, never from * command-result prose. * - Event-derived notices are read ONLY from the live `session/event` path. * The shared history projector stays pure, so replaying an old compaction or * permission switch never claims it just happened. * - There is one slot. A newer notice replaces the older one outright and gets * a fresh lifetime; nothing queues, and nothing is resurrected. * @module dshline/attention */ import type { ModelSelectionRef } from '@deepseek-ai/dsh-agent'; import type { SessionEvent } from '@deepseek-ai/dsh-session'; /** * One status-line emphasis. * * Presentation data only: the text is composed here, the renderer decides how * to style it, and nothing persists or replays it. */ export interface AttentionNotice { /** The complete segment to draw, already phrased for a reader. */ readonly text: string; } /** * How long a notice occupies the status line. * * Long enough to read one short phrase after looking up from the transcript, * short enough that it cannot be mistaken for a persistent mode. Deliberately * not configurable: a setting for four seconds of transient chrome would cost * more attention than it saves. */ export declare const ATTENTION_DURATION_MS = 4000; /** The attachment-scoped owner of the single attention slot. */ export interface AttentionController { /** The notice to draw right now, read fresh on every status frame. */ current(): AttentionNotice | undefined; /** * Replace the current notice, restarting the lifetime. `undefined` is * ignored rather than clearing, so a caller may pass a helper's result * directly. * @param notice - the notice to show. */ show(notice: AttentionNotice | undefined): void; /** Cancel the pending deadline and forget the notice. Idempotent. */ dispose(): void; } /** * Create the one notice slot for an attachment. * * The slot owns a single timeout, never a scheduler: showing cancels the prior * deadline and starts a fresh one, so an older callback cannot fire and retire * the notice that replaced it. The deadline is unref'd so a countdown never * keeps the process alive on its own. * @param draw - request a live-region repaint; called on show and on expiry. * @returns the controller the attachment registers with its session scope. */ export declare function createAttentionController(draw: () => void): AttentionController; /** * The notice a model-route change earns, if the route actually moved. * * Provider and model are compared, and nothing else: the reasoning effort * travels with the route but is not itself a route change, and a `done` from * the picker is a successful operation rather than a state transition. A first * selection, where there was no route before, is a change too. * @param before - the route in force before the selection ran. * @param after - the route in force after it. * @returns the notice, or undefined when the route is unchanged. */ export declare function modelRouteAttention(before: ModelSelectionRef['current'], after: ModelSelectionRef['current']): AttentionNotice | undefined; /** * The notice a reasoning-effort change earns, if the stored effort moved. * * The comparison is the stored selection, not the adapter's advertised default: * an absent effort and the provider's own default are distinct facts, and only * the stored one changing is a state transition worth showing. * @param before - the effort stored before the instruction. * @param after - the effort stored after it. * @returns the notice, or undefined when the stored effort is unchanged. */ export declare function reasoningAttention(before: string | undefined, after: string | undefined): AttentionNotice | undefined; /** * The notice one LIVE session event earns, or undefined for every other event. * * Called only from the attachment's `session/event` listener. The shared * history projector must never call it, because a resumed session replays old * compactions and permission switches through that projector and must not * flash them as if they had just happened. * * Two structured domains, deliberately not a registry: a compaction summary is * the model's working context materially changing, and a `permission/preset` is * the one durable event Harness publishes precisely to carry the user's chosen * preset. The knob events that follow a preset switch are ignored — they are * the same user change, and one change gets one notice. * @param event - one committed event delivered on the live path. * @returns the notice, or undefined when this event earns none. */ export declare function liveSessionAttention(event: SessionEvent): AttentionNotice | undefined; //# sourceMappingURL=attention.d.ts.map