import type { Permission } from "@opengeni/sdk"; import type { CommandContext, SlashArg, SlashCommand } from "./types.js"; import { type OpenGeniText } from "../messages/runtime.js"; /** * Parse a composer value into a command name + the rest. A command is * recognized ONLY when the value's first character is "/" (the start token); * anything else is plain chat and returns null. * * "/cl" -> { name: "cl", rest: "", hasTrailingSpace: false } * "/goal " -> { name: "goal", rest: "", hasTrailingSpace: true } * "/goal pause"-> { name: "goal", rest: "pause", hasTrailingSpace: false } */ export type ParsedCommandLine = { name: string; rest: string; /** True when the name token is closed by a space — arg-hint mode. */ hasTrailingSpace: boolean; args: string[]; }; export declare function parseCommandLine(value: string): ParsedCommandLine | null; /** Whether the operator's permission set satisfies a command's gate. */ export declare function hasPermission(required: Permission | undefined, permissions: Permission[]): boolean; /** Match a command (by name or alias) against the value. */ export declare function matchCommand(commands: readonly SlashCommand[], value: string): SlashCommand | null; type FilterCtx = Pick; /** * The commands visible for the current token + context. Permission-absent and * `available()===false` commands are dropped entirely (a gated command is never * shown, not shown-disabled). Filtering is a prefix match on name/alias. */ export declare function filterCommands(commands: readonly SlashCommand[], token: string, ctx: FilterCtx): SlashCommand[]; /** Render a command's arg hint for the palette footer / help, e.g. "". */ export declare function argHint(args: readonly SlashArg[] | undefined): string; /** The first required arg that has not yet been supplied, if any. */ export declare function firstMissingRequiredArg(command: SlashCommand, args: string[]): SlashArg | null; /** * The default command set. Adding a command is one object literal here; the * palette list, filter, arg-hint footer, and /help all render from this array. * Apps concat their own commands via the ChatComposer `commands` prop. */ export declare const defaultCommands: (t: OpenGeniText) => readonly SlashCommand[]; export {};