A Feishu bot that forwards chat messages to Codex and returns results in chat.
Warning
This project is currently in beta, and breaking changes may happen at any time.
npm i @debbl/relay@latest -g- Node.js 20+ and
pnpm. codexCLI installed and logged in (codex login).- Feishu app with bot capability enabled create-bot.
- Feishu event subscription enabled for
im.message.receive_v1. - Feishu bot permissions:
- P2P messages to bot.
- Group messages
@bot (or all group messages if you prefer).
Relay reads configuration only from ~/.relay/config.json.
Run pnpm dev once to auto-generate a template file (the process exits after creation), then edit:
~/.relay/config.jsonConfig fields:
{
"locale": "en",
"env": {
"BASE_DOMAIN": "https://open.feishu.cn",
"APP_ID": "your_app_id",
"APP_SECRET": "your_app_secret",
"BOT_OPEN_ID": "ou_xxx",
"CODEX_BIN": "codex",
"CODEX_TIMEOUT_MS": null
}
}- Required fields (inside
env):BASE_DOMAIN,APP_ID,APP_SECRET. - Optional fields:
locale(root level, supported values:en,zh; default:en; unsupported value falls back toenwith a warning).BOT_OPEN_ID(empty or missing means disabled).CODEX_BIN(default:codex).CODEX_TIMEOUT_MS(default: no timeout; if set, must be a positive integer).
cd <your_project>
relay- Send a text message to the bot.
- Bot replies immediately with a processing echo:
Received. Processing task: <task preview>
- Bot sends final Codex result when done.
- After
/new, the first normal prompt is used directly as the session title (with normalization and truncation).
- Any text message is handled.
- Bot only handles messages that
@the bot. - Session is isolated by
group + sender(different users in same group do not share context).
/helpshow help./new [default|plan]create a new conversation (default mode if omitted)./mode <default|plan>switch mode for current conversation./statusshow current thread info./projectsshow current fixed workspace root./resetclear current conversation.
- Relay stores session index at
~/.relay/sessions.jsonand restores active sessions after restart. - The index stores thread ids and basic metadata only; full session transcripts are in
~/.codex/sessions. - Relay fixes workspace root to the process startup directory (
process.cwd()). - Relay checks npm for newer
@debbl/relayversions at startup and prints a warning when an update is available. - Set
RELAY_SKIP_UPDATE_CHECK=1to disable the startup update check. - Ensure process user can read/write
~/.codex/sessions. - Ensure process user can read/write
~/.relay/sessions.json. .env.localis no longer used for runtime config.
pnpm i18n:extract
pnpm lint
pnpm typecheck
pnpm test