/** * `@gemstack/ai-sdk/chat-mentions` - parse `@` agent mentions out of a chat * message and turn them into an orchestrator routing rule. * * A chat UX where the user types `@` to explicitly invoke an agent * (overriding the orchestrator's own routing judgment) is generic: chat * panels, Slack/Discord bots, CLIs. This ships the two reusable pieces every * such consumer would otherwise hand-roll: * * - {@link parseMentions} extracts and validates the tokens, returning the * matched slugs plus the message with the tokens stripped. * - {@link buildMentionRoutingRule} renders a system-prompt rule that forces * the orchestrator to dispatch the mentioned agents in order. * * Token shape: `@` where `` matches `[a-z0-9-]+`. A whitespace (or * start-of-string) is required before the `@` so `email@host` is not parsed as * a mention, and the right side is bounded by a non-word boundary so * `@seo-assistant.` does not eat the trailing punctuation. */ /** Global regex matching an `@` mention with its leading boundary. */ export declare const MENTION_REGEX: RegExp; export interface ParsedMentions { /** Slugs found in the message, lower-cased, in first-seen order, deduplicated. */ slugs: string[]; /** The message with every recognized `@` token removed and whitespace collapsed. */ cleaned: string; } /** * Parse `@` mentions from a message and validate them against a set of * known agent slugs. Unknown mentions (e.g. `@nope`) are left in the message * verbatim - they are plain text, not a routing signal. Matched tokens are * stripped and surrounding whitespace is collapsed, so the model sees only the * cleaned intent. * * `knownSlugs` accepts any iterable (array or `Set`); matching is * case-insensitive and the returned slugs are lower-cased. */ export declare function parseMentions(message: string, knownSlugs: Iterable): ParsedMentions; export interface MentionRoutingRuleOptions { /** * Name of the tool the orchestrator calls to dispatch an agent. * Default `'run_agent'`. */ toolName?: string; /** * The argument key on that tool carrying the agent slug. * Default `'agentSlug'`. */ argKey?: string; } /** * Build the system-prompt rule injected when a message carries one or more * validated mentions. The orchestrator is instructed to call the dispatch * tool (default `run_agent({ agentSlug })`) for each mentioned agent in order, * overriding its own routing decision. Returns `null` when `slugs` is empty so * callers can `if (rule) systemPrompt += rule` without a length check. */ export declare function buildMentionRoutingRule(slugs: readonly string[], opts?: MentionRoutingRuleOptions): string | null; //# sourceMappingURL=chat-mentions.d.ts.map