/** * Keyed status-line contributions — pi's `ctx.ui.setStatus(key, text)`. * Each plugin owns a key; setting text shows it, setting undefined clears * it. The TUI renders all contributions as one joined line above the prompt * (host-owned rendering: plugins supply text, never layout). * * Same split as the dialogs seam: a cordis-free store the chat screen * subscribes to, and a thin cordis service validating untrusted text. */ import { Context, Service } from '@deepseek-ai/cordis'; /** One rendered contribution. */ export interface TuiStatusEntry { readonly key: string; readonly text: string; } /** Cordis-free keyed-text store. Render order is first-set order (Map * insertion order), so a plugin's line never jumps around on updates. */ export declare class TuiStatusStore { private readonly listeners; private readonly entries; private snapshot; /** Set or clear (undefined/empty) one key. */ set(key: string, text: string | undefined, token?: number, owner?: object): void; /** Current contributions, first-set first (stable between changes). */ getSnapshot(): readonly TuiStatusEntry[]; /** Host runtime uses this to enforce that one activation cannot rewrite or * clear another activation's keyed contribution. */ ownerOf(key: string): object | undefined; /** Clear `key` only while it still holds the write tagged `token` — a * stale disposer must not wipe a newer contribution (even one with * identical text). Returns true when this call actually cleared. */ clearIf(key: string, token: number, owner?: object): boolean; /** Drop everything (teardown). */ clear(): void; subscribe(listener: () => void): () => void; private emit; } declare module '@deepseek-ai/cordis' { interface Context { tuiStatus: TuiStatusRuntime; } } /** * `ctx.tuiStatus` — plugin-facing status contributions. Invalid keys and * oversized text are rejected with a logger warning instead of throwing: * a status line must never take the TUI down. */ export declare class TuiStatusRuntime extends Service { constructor(ctx: Context); /** * Set (or clear with `undefined`) the contribution for `key`. Keys are * plugin-namespaced by convention (`my-plugin`, `my-plugin:detail`); * control chars are stripped and text is capped at 200 cells. Text is * scalar-only: string/number/boolean are coerced to string, anything else * is refused with a warning (never rendered as "[object Object]", never * silently treated as a clear). * * Returns a disposer that clears the contribution IF the key still holds * exactly this write (a later set — even of identical text — wins over a * stale disposer). The CALLER scopes it to its own fiber * (`ctx.effect(() => dispose)`) — the same contract as * `tuiShortcuts`/`tuiScenes`: a service method only sees the service's own * ctx, so per-plugin cleanup cannot happen here. Without that, an unloaded * or hot-reloaded plugin would leave its line behind forever. * * The optional trailing `identity` (the plugin's own ctx) only feeds the * effect ledger's pluginId — omitting it records `undeclared`, never a * guess (C-060 honest identity). */ set(key: string, text: string | number | boolean | undefined, identity?: Context): () => void; } export declare function getHostStatusStore(runtime: TuiStatusRuntime | undefined): TuiStatusStore | undefined; export default TuiStatusRuntime; //# sourceMappingURL=status.d.ts.map