import type { CommandArgs, Serializable } from '../types'; import type { JobManager } from './JobManager'; export type CommandRun = (args: CommandArgs) => Promise | Serializable; export interface CommandSpec { background?: boolean; run: CommandRun; } export type CommandEntry = CommandRun | CommandSpec; /** Shared state handed to every command group at construction. */ export interface CommandContext { jobs: JobManager; } /** * A command group bundles a set of related subcommands. `commands` is keyed by * the FULL command id (e.g. "tabs.close") so groups spanning multiple * namespaces (dom/extract/page, storage, session/clients) register * uniformly. `namespace` is documentation/grouping only. */ export abstract class CommandGroup { constructor(protected readonly ctx: CommandContext) {} abstract readonly namespace: string; abstract readonly commands: Record; }