import type { PlatformAdapter, ActionContext, ModalSubmitContext, MessageRef } from '../../platform/index.js'; export interface CommandSession { commandName: string; channel: string; messageRef?: MessageRef; data: Record; createdAt: number; } export interface ActionBinding { actionId: string; handler: (ctx: ActionContext) => Promise; } export interface ModalBinding { callbackId: string; handler: (ctx: ModalSubmitContext) => Promise; } export declare class CommandActionRouter { private actionHandlers; private modalHandlers; private sessions; private _adapter; private _bound; getAdapter(): PlatformAdapter | null; /** * Register all actions and modals for a single command. * Action IDs are automatically qualified with "cmd::" to avoid collisions * with other subsystems (ask_user_question_*, hook_plan_*). * Throws on duplicate actionId or callbackId. */ registerCommand(commandName: string, config: { actions?: ActionBinding[]; modals?: ModalBinding[]; }): void; /** * Register all stored handlers with the platform adapter. * Called once during startup after all commands have registered their actions. */ bindToAdapter(adapter: PlatformAdapter): void; /** Generate a session key and store state. Returns the key for use as action value. */ createSession(channel: string, commandName: string, data: Record, messageRef?: MessageRef): string; getSession(key: string): CommandSession | undefined; deleteSession(key: string): void; /** Look up all sessions for a given channel (for cleanup on !new). */ getSessionsByChannel(channel: string): CommandSession[]; /** Clear all sessions for a channel (e.g., on !new). */ clearChannelSessions(channel: string): void; }