๐คฏ LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
/**
* Feishu/Lark reactions are a **named enum**, not unicode.
*
* `POST /im/v1/messages/{id}/reactions` takes `reaction_type.emoji_type`
* values like `OK` / `MUSCLE` / `FIRE` and rejects anything else with
* `231001 reaction type is invalid`. Every other platform we support takes
* unicode, so callers speak unicode โ this module is the single translation
* point between them. Without it every reaction on Feishu/Lark fails, and
* because both call sites swallow reaction errors the only symptom is that the
* bot never appears to acknowledge anything.
*
* It lives in the adapter package, next to `LarkApiClient`, for the same reason
* `decodeLarkThreadId` does: `LarkAdapter` and the server-side bot platform
* client both need it, and two copies of an enum this fiddly would drift.
*
* Only enum names taken from Feishu's published emoji list appear here (the
* `ๅธธ็จๅผ` table in `protocol-spec.md` ยง5.1, plus the full list it links to at
* https://open.feishu.cn/document/server-docs/im-v1/message-reaction/emojis-introduce).
* Do NOT add a value guessed from Feishu's UI โ an undocumented `emoji_type` is
* just another `231001`. The casing is Feishu's own and is inconsistent on
* purpose (`THUMBSUP` but `ThumbsDown`, `OnIt`, `CheckMark`, `Trophy`).
*/
const FEISHU_EMOJI_TYPES = [
// ๆญฃ้ข / ่ฎคๅฏ
'OK',
'THUMBSUP',
'THANKS',
'MUSCLE',
'APPLAUSE',
'FISTBUMP',
'JIAYI',
'DONE',
'LGTM',
// ็ฌ่ธ
'SMILE',
'LAUGH',
'LOL',
'LOVE',
'WINK',
'JOYFUL',
'WOW',
'YEAH',
// ๆฒไผค
'SOB',
'CRY',
'FROWN',
'SPEECHLESS',
// ๆๅฟ
'ThumbsDown',
'HIGHFIVE',
'WAVE',
'SALUTE',
// ็ฉๅ
'HEART',
'ROSE',
'FIRE',
'PARTY',
'BEER',
'CAKE',
'GIFT',
'Trophy',
// ่ฟ่กไธญ โ the states the bot bridge cycles through
'OnIt',
'THINKING',
'Typing',
'OneSecond',
// ็ฌฆๅท
'POOP',
'HEARTBROKEN',
'CheckMark',
'CrossMark',
'Hundred',
] as const;
/** Lower-cased enum name โ the exact-cased value Feishu expects. */
const CANONICAL_BY_LOWERCASE = new Map(
FEISHU_EMOJI_TYPES.map((name) => [name.toLowerCase(), name]),
);
/**
* Unicode โ Feishu `emoji_type`.
*
* The first three entries are what the bot bridge actually sends on every run
* (`RECEIVED_REACTION_EMOJI` / `THINKING_REACTION_EMOJI` /
* `WORKING_REACTION_EMOJI` in `../const.ts`) โ keep them mapped or the
* progress reactions go dark again. The rest cover what an agent plausibly
* passes to the `reactToMessage` tool, whose schema asks for unicode.
*/
const EMOJI_TYPE_BY_UNICODE: Record<string, (typeof FEISHU_EMOJI_TYPES)[number]> = {
'โค': 'HEART',
'โค๏ธ': 'HEART',
'โก': 'OnIt', // bridge: a tool call is running โ ใๅค็ไธญใ
'โ
': 'CheckMark',
'โ': 'CrossMark',
'๐น': 'ROSE',
'๐': 'GIFT',
'๐': 'CAKE',
'๐': 'PARTY',
'๐บ': 'BEER',
'๐': 'OK', // bridge: the bot has picked the message up โ ใๅฅฝ็ใ
'๐': 'WAVE',
'๐': 'OK',
'๐': 'THUMBSUP',
'๐': 'ThumbsDown',
'๐': 'APPLAUSE',
'๐': 'FISTBUMP',
'๐': 'HEARTBROKEN',
'๐ฉ': 'POOP',
'๐ช': 'MUSCLE',
'๐ฏ': 'Hundred',
'๐ฅ': 'FIRE',
'๐': 'FROWN',
'๐': 'HIGHFIVE',
'๐': 'THANKS',
'๐ค': 'THINKING', // bridge: the agent is reasoning โ ใๆ่ใ
'๐คฃ': 'LOL',
'๐ฅณ': 'PARTY',
'๐ซก': 'SALUTE',
'๐': 'SMILE',
'๐': 'LOL',
'๐': 'SMILE',
'๐': 'LAUGH',
'๐': 'SMILE',
'๐': 'WINK',
'๐': 'LOVE',
'๐ฎ': 'WOW',
'๐ฒ': 'WOW',
'๐ถ': 'SPEECHLESS',
'๐ข': 'CRY',
'๐ญ': 'SOB',
'๐': 'OK',
};
/**
* Resolve a Feishu/Lark `emoji_type` from what a caller supplied.
*
* Accepts either a unicode emoji (what the bridge and the tool schema use) or
* an `emoji_type` name the caller already knows, in any casing. Returns
* `undefined` when there is no documented equivalent โ callers decide what
* that means for them, but nobody may pass the raw input through: doing so is
* a guaranteed `231001`.
*/
export const toFeishuEmojiType = (emoji: string | null | undefined): string | undefined => {
if (!emoji) return undefined;
const trimmed = emoji.trim();
if (!trimmed) return undefined;
return EMOJI_TYPE_BY_UNICODE[trimmed] ?? CANONICAL_BY_LOWERCASE.get(trimmed.toLowerCase());
};
/** Every `emoji_type` this module can produce, for error messages. */
export const supportedFeishuEmojiTypes = (): string[] => [...FEISHU_EMOJI_TYPES];