import { ContextProjection, ModeProjection } from "../../types/hub.mjs"; //#region src/web/lib/contextComposition.d.ts /** * What the session is composed of, as opposed to what it is doing. * * The activity dock answers "what is running"; this answers "what is loaded and * what does carrying it cost". A group is a mode, because a mode is the thing a * reader can actually switch off: grouping by source would name the mechanism * rather than the decision. Rows inside a group are ordered by source kind so * the session's own extensions read before anything a server or plugin added. */ export type ContextGroupKind = 'preset' | 'mode' | 'domain' | 'shared' | 'core'; export type ContextItemSource = 'extension' | 'mcp' | 'plugin' | 'core'; export interface ContextItem { name: string; itemKind: 'tool' | 'skill'; source: ContextItemSource; /** The package or server that registered it. */ owner: string; /** Estimated tokens, or null while the runtime has not reported a figure. */ tokens: number | null; active: boolean; } export interface ContextGroup { id: string; label: string; kind: ContextGroupKind; /** A short qualifier shown beside the label, e.g. a pending switch. */ detail: string; items: ContextItem[]; /** Subtotal across active items, or null when no item carries a figure. */ tokens: number | null; /** What the group's gated items would add if switched on. */ inactiveTokens: number; } /** * The composition the session is running under. * * Until the runtime publishes its inventory every group is empty, which is the * honest reading: the modes are known from the footer the session already * publishes, the tools they brought are not. */ export declare function contextGroups(statuses: Record, widgets: readonly string[], projection?: ModeProjection | null, items?: readonly ContextItem[], attribution?: Readonly>): ContextGroup[]; /** * The runtime's own grouping, used as published. * * Once the session reports a composition it already knows which mode admitted * each tool, which is a join the page cannot make for itself. Re-deriving it * here from status strings would only be able to disagree. */ export declare function projectedGroups(projection: ContextProjection): ContextGroup[]; /** The whole composition's estimate, or null while nothing is priced. */ export declare function totalTokens(groups: readonly ContextGroup[]): number | null; /** * One package, server, or plugin inside a mode, with what it costs. * * A mode can admit two dozen tools from a dozen packages, and a flat list of * those names says nothing about which dependency to reconsider. The package is * the unit that gets added or removed, so it is the unit worth totalling. */ export interface ContextOwner { owner: string; /** Every tool a single owner registers shares one source kind. */ source: ContextItemSource; items: ContextItem[]; tokens: number; inactiveTokens: number; } /** The scope is noise once the rows beneath already name the package. */ export declare function ownerLabel(owner: string): string; export declare function ownersOf(group: ContextGroup): ContextOwner[]; /** What every gated item across the composition would add if switched on. */ export declare function inactiveTotal(groups: readonly ContextGroup[]): number; //#endregion //# sourceMappingURL=contextComposition.d.mts.map