import { stripAllMentions } from './mention-targets.js'; export { stripAllMentions }; /** 取所有非本 bot 的【授权目标】(可以是真人,也可以是另一个 bot—— * 授权 bot 走同一条路,命中后写本群 chatGrants,放行其在本群拉起 chat-scope 会话)。 * 按 open_id 去重、保持 @ 顺序,支持一次 /grant @a @b、/revoke @a @b 批量处置。 * * **只取「命令词 /grant|/revoke 之后」出现的 @**:命令词之前的 @ 是「点名让哪个 bot 执行」 * (`@OperatorBot /grant @Grantee`),不是 grantee。否则 owner 一条 `@Claude @Codex /grant` * 把两个操作 bot 都前导 @ 了,每个 daemon 会把「另一个 bot」当成目标 → 两 bot 互相授权 * (实测 bug)。位置过滤仅在能拿到位置信息(text 形态的 key / post 的节点序)时生效; * 纯 mentions 的合成消息(无 content.text)退回历史「全部非本 bot」行为。 * 实现在 mention-targets.ts(与 /invite 共享)。 */ export declare function parseGrantTargets(message: any, botOpenId: string | undefined): Array<{ openId: string; name: string; }>; /** * 命令词之后是否存在**任何**目标 mention(含 app_id-only 的群外/协作 bot)。 * parseGrantTargets 会把 app_id-only 目标 .filter 掉,于是 `@OperatorBot /grant * @OtherBot(app_id-only)` 在 operator daemon 里 targets 会变空 → 若据此走裸 /grant * 整群授权分支 = 提权(owner 本意是授权某个 bot,却误对全群开放 talk)。用未过滤的 * raw 解析识别「指了目标但都不可按 open_id 授权」,让 handler fail closed 回 usage。 */ export declare function hasAnyTargetMention(message: any, botOpenId: string | undefined): boolean; /** 取第一个非本 bot 的目标(单目标场景的便捷封装)。 */ export declare function parseGrantTarget(message: any, botOpenId: string | undefined): { openId: string; name: string; } | undefined; /** * 解析 `/grant @x [N]` 里可选的消息额度 N。`text` 已 stripLeadingMentions(去开头 @bot), * 这里把剩余所有 `@` mention 也剥掉,剩下应只是 `/grant` 或 `/grant `。 * N 必须是唯一尾部正整数 token;0 / 负数 / 小数 / 多余尾巴 → { ok:false }(调用方回 usage)。 */ export declare function parseGrantQuota(text: string, mentions: any[]): { ok: true; quota?: number; } | { ok: false; }; /** * 本 bot 是否「只是作为 /grant、/revoke 的目标」被 @(@ 出现在命令词之后), * 而不是被前导 @ 点名执行命令的操作 bot。命中(仅目标)返回 true,调用方应静默放手—— * 否则异主目标 bot 会误回 owner_only、同主目标 bot 会把自己剔空后误开整群授权。 * 实现细节(text/post 双形态、key 前缀歧义规避、open_id + app_id 双判据)见 mention-targets.ts。 * botAppId(本 bot larkAppId)让 guard 也认 app_id 形态的本 bot @(协作 bot 常以 app_id 被 @)。 */ export declare function isGrantTargetOnly(message: any, botOpenId: string | undefined, botAppId?: string): boolean; /** 返回 true 表示已拦截(不再进入路由/spawn)。 */ export declare function tryHandleGrantCommand(larkAppId: string, message: any, senderOpenId: string | undefined): Promise; //# sourceMappingURL=grant-command.d.ts.map