/** * Menu rendering types and pure label/data helpers. * * The menu concern is split out from the per-chat driver so that the mapping * from a menu id / end-reason / goal phase to a localized label, and the * workspace listing, can be tested and reused without the driver's runtime * state. Everything here is a pure function of its arguments (no `this`). * @module dsh-connect/menus */ import type { Messages } from "./i18n.js"; import type { InboundMessage, OutboundTarget, TurnReason } from "./types.js"; export type MenuId = "root" | "workspace" | "chat" | "settings" | "model" | "reasoning" | "notify" | "language" | "progress"; export interface MenuItem { id: string; label: string; /** Leaf action: after it runs, the menu returns to the root menu on the same card. */ leaf?: boolean; /** * `messageId` is the menu card id: pass it to `openMenu` to navigate in place, * or close the card. A returned string is sent to the chat as the action's * result feedback before the menu returns, so every button press answers * visibly instead of leaving the user to guess whether it worked. */ onSelect: (target: OutboundTarget, msg: InboundMessage, messageId: string) => Promise; } /** Localized menu title for a menu id. */ export declare function menuTitle(menuId: MenuId, t: Messages): string; /** Named root-menu sections: workspace / chat (1 col), task / system (2 col). */ export declare function rootMenuSections(t: Messages): readonly { title: string; ids: readonly string[]; columnsPerRow?: number; }[]; /** Localized label for a turn end reason. */ export declare function reasonLabel(reason: TurnReason, t: Messages): string; /** Localized label for a goal phase. */ export declare function goalPhaseLabel(phase: string, t: Messages): string; export interface WorkspaceInfo { path: string; title: string; } /** Dedupe (case-insensitive, trailing-slash-normalized) the workspace candidates. */ export declare function listWorkspaces(opts: { registry?: { list?: () => readonly { path: string; title: string; }[]; } | undefined; workDir: string; currentDirLabel: string; workspaces: readonly string[]; }): WorkspaceInfo[]; /** * Which render mode a menu should use. Data-heavy menus (model / session / * workspace) collapse to a single select_static so the card stays compact; * every other menu stays a button grid — a full menu must never read as a * single closed/empty select. This is a pure function so it can be unit-tested * (a naive "auto when many options" collapses settings/language etc. too). */ export declare function menuRender(menuId: MenuId): "dropdown" | "buttons"; /** * Selectable proactive progress-reminder intervals (in milliseconds), shared by * the settings submenu and the `/progress` command so they never drift apart. * `0` turns the reminder off. * * This is deliberately independent of the *notify* level: a "result"-only chat * (which suppresses reasoning / tool-call noise and the liveness heartbeat) * still gets proactive progress reminders while a task stays silent, so a long * run never looks frozen. */ export declare const PROGRESS_PRESET_MS: readonly number[]; //# sourceMappingURL=menus.d.ts.map