import type { Mention, MentionGroup } from "@skaile/workspaces/types"; /** * Re-exported from `@skaile/workspaces/types` so consumers can import mention * types directly from `@skaile/workspaces/session` without a separate dependency. */ export type { Mention, MentionGroup }; /** * Consumer-provided resolver that maps @mention tokens to users and groups. * * The platform provides an implementation backed by Prisma and the live * presence service. Tests use lightweight mocks. * * @example * ```ts * const resolver: MentionResolver = { * resolveUser: (name) => db.users.findByName(name), * resolveGroup: (group) => presence.getMemberIds(group), * getOnlineUserIds: () => presence.getOnlineIds(), * } * ``` * * @docLink packages/session/api-reference#mention-resolver */ export interface MentionResolver { /** * Resolve a `@name` token to a user record. * * @param name - The token after the `@` symbol (case-insensitive lookup). * @returns User record, or null if the name is not found. */ resolveUser(name: string): { userId: string; name: string; } | null; /** * Resolve a group mention token to the list of member user IDs. * * @param group - The well-known group name (e.g. `"agent"`, `"all"`). * @returns Array of member user IDs belonging to the group. */ resolveGroup(group: MentionGroup): string[]; /** Return the IDs of users currently online (used by the `here` and `humans_here` groups). */ getOnlineUserIds(): string[]; } /** * Scan `text` for @token patterns and return resolved {@link Mention} objects. * * - Well-known group tokens (`agent`, `humans`, `humans_here`, `here`, `all`) * are resolved via {@link MentionResolver.resolveGroup}. * - All other tokens are resolved via {@link MentionResolver.resolveUser}. * - Tokens that cannot be resolved are silently ignored. * - Results are sorted by character offset ascending. * * @param text - Raw message text to scan for `@token` patterns. * @param resolver - Resolver that maps tokens to users and groups. * @returns Resolved mentions ordered by position in text. * @docLink packages/session/api-reference#mention-resolver */ export declare function parseMentions(text: string, resolver: MentionResolver): Mention[]; /** * Returns true if `userId` is directly mentioned or is a member of any * group mention's resolved list. * * @param userId - The user ID to check (e.g. from the auth context). * @param mentions - Parsed mentions from {@link parseMentions}. * @docLink packages/session/api-reference#mention-resolver */ export declare function isMentioned(userId: string, mentions: Mention[]): boolean; /** * True if any mention is a custom mention of the given kind. * * Consumers use this to check for platform-specific mention kinds (e.g. * `"assistant"`) that the SDK parser does not produce — only consumers * construct custom mentions. * * @param mentions - Mention list from the message or consumer-constructed. * @param kind - The consumer-defined kind string to match. */ export declare function isAddressedByKind(mentions: Mention[], kind: string): boolean; /** * Returns true if the agent is addressed by any mention in the list. * * The groups `@agent`, `@here`, and `@all` address the agent. `@humans` * and `@humans_here` do not. Individual user mentions are also not matched * here — agent addressing is group-based. * * @param mentions - Parsed mentions from {@link parseMentions}. * @docLink packages/session/api-reference#mention-resolver */ export declare function isAgentAddressed(mentions: Mention[]): boolean; //# sourceMappingURL=mentions.d.ts.map