import { ModeProjection, ModeRecordProjection } from "../../types/hub.mjs"; import { ActivityGroupContribution, DockFaceContribution, FileLinkMention, ModeContribution, SelectionAxisContribution, TransientTab, t } from "@agimon-ai/po-core/web"; //#region src/web/lib/composition.d.ts export interface SelectionAxis { name: string; command: string; /** The current selections, empty while the session reports none; one at most unless multi. */ values: string[]; emptyLabel: string; multi: boolean; } /** * The fallback axis table for the packaged bundle; a synced bundle carries * each axis as its owning package's plugin declaration, and the registry * list wins whenever any plugin declares one. Exported only so the workspace * composition test can hold it equal to what the packages declare. */ export declare const PACKAGED_SELECTION_AXES: readonly SelectionAxisContribution[]; /** * The declared axes the session actually offers: an axis whose status key * the session never published stays off the bar entirely, which is how a * package withholds its axis when there is nothing to select. */ export declare function selectionAxes(statuses: Record): SelectionAxis[]; export type ModeAvailability = 'unavailable' | 'off' | 'on'; export interface Mode { name: string; /** The catalog id /mode accepts; the display name until the catalog reports. */ id: string; /** Leader Space key path, as the TUI documents it. */ keys: string; availability: ModeAvailability; /** What the mode itself is reporting while on. */ detail: string; /** Activity group to focus instead of invoking the mode command from the cockpit. */ activityGroup?: string; /** The mark the mode's package declares; the host draws a generic one without it. */ icon?: ModeContribution['icon']; /** The action that flips the row in one click, when the mode offers it without input. */ toggle?: ModeToggleAction; /** * Why the mode cannot be driven from here, in the words of the mode itself. * Empty when it can. A mode may be installed and still refuse a cockpit: * autonomous voice captures from the terminal's own microphone, which a * browser talking to a headless agent does not have. */ unavailableReason: string; } export interface ModeSource { name: string; /** The catalog mode this row drives, when the runtime registers it under another id. */ modeId?: string; /** Leader Space key path, as the TUI documents it. */ keys: string; /** Activity group to focus instead of invoking the mode command from the cockpit. */ activityGroup?: string; icon?: ModeContribution['icon']; statusKey?: string; widgetKey?: string; hideWhenMissing?: boolean; desktopOnly?: boolean; } /** * The fallback mode table for the packaged bundle. * * A synced bundle carries each mode as its package's own web plugin * contribution, and the registry list wins whenever any plugin declares one. * This literal survives only so the built-in-only bundle keeps rendering the * modes Po ships; help is listed without a signal on purpose: it * registers no footer entry, so the cockpit reports it as unavailable rather * than guessing it is off. Exported only for the workspace composition test. */ export declare const PACKAGED_MODES: readonly ModeSource[]; export type ModeToggleAction = 'activate' | 'deactivate' | 'end'; /** The one-click action for a mode: an enabled, input-free activate when off, or deactivate/end when on. */ export declare function modeToggle(mode: ModeRecordProjection): ModeToggleAction | undefined; export declare function resolveModes(statuses: Record, widgets: readonly string[], projection?: ModeProjection | null): Mode[]; export interface ActivityGroup { name: string; keys: string; /** The heading visual its package declares; the dock draws a generic one without it. */ icon?: ActivityGroupContribution['icon']; /** The heading text its package declares; the host sentence-cases the name without it. */ label?: string; /** What the publishing extension is reporting, empty when it reports nothing. */ summary: string; active: boolean; marksBackgroundWork?: boolean; collapsible?: boolean; /** The temporary tab the group's name opens, when its package declares one. */ transientTab?: () => TransientTab; /** Keeps the group visible below the dock's scrolling ordinary groups. */ placement?: 'bottom'; } /** Subscribe to package-owned activity sources, rewiring when the focused composition changes. */ export declare function subscribeActivitySources(listener: () => void): () => void; /** * The groups available in this plugin composition. Status and widget signals * reveal legacy groups. A package-owned active source also reveals its group, * including while idle, so the section can remain a stable launcher unless it * opts into `hideWhenEmpty`. * * A group that declared `hideWhenEmpty` goes away once its session stops * reporting. Clearing a status reaches the page as an empty string rather than * an absent key, because the same map tells the selection bar which modes * exist and an absent key means "not reported" there. Emptiness is read here, * where only the dock is looking. */ export declare function activityGroups(statuses: Record, widgets: readonly string[], sessionId?: string | null, translate?: typeof t): ActivityGroup[]; /** Dock faces update when the active session composition changes. */ export declare function useDockFaces(sessionId: string | null): readonly DockFaceContribution[]; /** Each face's badge count for the session, re-read when a face reports a change. */ export declare function useDockFaceBadges(faces: readonly DockFaceContribution[], sessionId: string | null): Readonly>; /** Activity groups that update when either host signals or a plugin's session store changes. */ export declare function useActivityGroups(statuses: Record, widgets: readonly string[], sessionId: string | null): ActivityGroup[]; /** The tab one path opens, or undefined when no installed plugin recognises it. */ export type FileLinkResolver = (path: string) => TransientTab | undefined; interface FileLinkModes { active(sessionId: string | null): readonly string[]; subscribe(sessionId: string | null, listener: () => void): () => void; } /** Binds host session facts without making the composition library own session state. */ export declare function bindFileLinkModes(source: FileLinkModes): () => void; /** * The tab a path opens, from the first source that claims it. * * A path no source claims is not a link. The host cannot tell a file name from * a class name, and the plugin that tracks the session's files can, so the * decision belongs there rather than in a heuristic here. */ export declare function fileLinkFor(sessionId: string | null, path: string): TransientTab | undefined; /** References plugins that own a path namespace offer for an `@` being typed, such as `artifact:plan.md`. */ export declare function fileLinkMentions(sessionId: string, query: string): FileLinkMention[]; /** * The tab a path the caller is sure about opens: a tool call's path argument, * not a token spotted in prose. * * A source that offers `openPath` answers here, and it may claim a file the * session never changed, which `resolve` deliberately will not. Sources * without it fall back to the same guess prose gets. */ export declare function fileTabForPath(sessionId: string | null, path: string): TransientTab | undefined; /** * Resolves the paths a message names against the plugins that track them. * * The resolver's identity is stable while the linkable set is, so a component * that hands it to a renderer does not rebuild that renderer on every frame of * a streaming reply. */ export declare function useFileLinks(sessionId: string | null): FileLinkResolver; //#endregion export {}; //# sourceMappingURL=composition.d.mts.map