{"_id":"@alexlikevibe/lark-channel-bridge","name":"@alexlikevibe/lark-channel-bridge","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@alexlikevibe/lark-channel-bridge","version":"0.1.0","description":"Bridge Feishu/Lark messenger with local CLI coding agents","type":"module","packageManager":"pnpm@10.33.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"repository":{"type":"git","url":"git+https://github.com/iefnaf/lark-coding-agent-bridge.git"},"bugs":{"url":"https://github.com/iefnaf/lark-coding-agent-bridge/issues"},"homepage":"https://github.com/iefnaf/lark-coding-agent-bridge#readme","bin":{"lark-channel-bridge":"bin/lark-channel-bridge.mjs"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","build":"tsup","typecheck":"tsc --noEmit","test":"vitest run","test:unit":"vitest run tests/unit --passWithNoTests","test:integration":"vitest run tests/integration --passWithNoTests","test:process":"vitest run tests/process --passWithNoTests","ci:local":"git diff --check && pnpm test && pnpm typecheck && pnpm build","ci:platform":"pnpm test && pnpm typecheck && pnpm build","prepare":"npm run build","prepublishOnly":"pnpm typecheck && pnpm build"},"dependencies":{"@clack/prompts":"^1.4.0","@larksuite/channel":"^0.2.0","commander":"^12.1.0","cross-spawn":"^7.0.6","graceful-fs":"^4.2.11","proper-lockfile":"^4.1.2","qrcode-terminal":"^0.12.0"},"devDependencies":{"@types/cross-spawn":"^6.0.6","@types/graceful-fs":"^4.1.9","@types/node":"^22.10.0","@types/proper-lockfile":"^4.1.4","@types/qrcode-terminal":"^0.12.2","tsup":"^8.3.5","typescript":"^5.6.3","vitest":"^2.1.8"},"engines":{"node":">=20.12.0"},"pnpm":{"onlyBuiltDependencies":["esbuild","protobufjs"]},"keywords":["feishu","lark","claude","claude-code","codex","cli","channel","bridge"],"license":"MIT","gitHead":"5db80b044ae0e46eb07a547e7360d8cfe927bdc5","_id":"@alexlikevibe/lark-channel-bridge@0.1.0","_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-b1pTGyNvw6W9hJd0yO3828VG0qfJEM3CjROC2odkLulrWvP88ZVb+tvn6VWIOiW8jGeyMcxrPXbVruSmp77O2Q==","shasum":"f4943696ac52cff629bd4fab36e1387ae60eca7f","tarball":"https://registry.npmjs.org/@alexlikevibe/lark-channel-bridge/-/lark-channel-bridge-0.1.0.tgz","fileCount":8,"unpackedSize":615289,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIA2cvqF56P/ihP/iUaC6kqqNErCOi0y8/UMdMPmG5XvcAiBUwviq2hm8oU0yFPAN0qqDtN+8kyBVSu8sC9F91HFEHg=="}]},"_npmUser":{"name":"alexlikevibe","email":"gfanfei@gmail.com"},"directories":{},"maintainers":[{"name":"alexlikevibe","email":"gfanfei@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/lark-channel-bridge_0.1.0_1783073247325_0.2453953548525638"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-03T10:07:27.122Z","0.1.0":"2026-07-03T10:07:27.483Z","modified":"2026-07-03T10:07:27.720Z"},"maintainers":[{"name":"alexlikevibe","email":"gfanfei@gmail.com"}],"description":"Bridge Feishu/Lark messenger with local CLI coding agents","homepage":"https://github.com/iefnaf/lark-coding-agent-bridge#readme","keywords":["feishu","lark","claude","claude-code","codex","cli","channel","bridge"],"repository":{"type":"git","url":"git+https://github.com/iefnaf/lark-coding-agent-bridge.git"},"bugs":{"url":"https://github.com/iefnaf/lark-coding-agent-bridge/issues"},"license":"MIT","readme":"# lark-channel-bridge\n\n把飞书 / Lark 消息和本地 Claude Code 或 Codex CLI 打通的轻量 bot。用一条命令启动，扫码绑定 PersonalAgent 应用，然后在飞书里和本机编程助手对话，让它读图、处理文件、改代码。\n\n[English README](./README.md)\n\n关于能实现的效果，详情可以阅读[飞书文档](https://larkcommunity.feishu.cn/docx/OaRIdFIRFoLM3xxTmKwcetHqn5e)\n\n## 主要功能\n\n- 在飞书私聊直接发消息，或在群里 `@bot`，把任务转给本机 Claude Code / Codex CLI。\n- **流式卡片**：文本回复和工具调用实时更新在同一张卡片上。\n- **COT 过程消息**：可选先发一条过程消息展示 agent 的阶段性文本和工具调用，再单独发送最终答案。\n- **会话延续**：每个聊天、话题或文档评论有自己的会话，不会互相串。\n- **排队与消息合并**：短时间连续发送的消息会合并处理；任务运行中收到的普通消息会排队到下一轮，`/new`、`/cd`、`/ws use`、`/stop` 这类命令可以中断当前任务。\n- **多工作空间**：用 `/cd` 切换当前项目，用 `/ws` 保存和复用常用项目目录。\n- **图片 / 文件**：直接发给 bot，bridge 下载到本地后交给本机 agent 处理。\n- **卡片按钮**：`/help`、`/ws list`、`/status` 返回可点击的交互卡片。\n\n## 前置条件\n\n- Node.js **>= 20.12.0**\n- 本机至少安装并登录一个 agent：\n  - Claude Code：`claude`，安装说明：https://docs.anthropic.com/en/docs/claude-code/quickstart\n  - Codex CLI：`codex`，安装说明：https://developers.openai.com/codex/cli\n  - pi：`pi`，安装说明：https://pi.dev\n- 一个飞书 / Lark PersonalAgent 应用。首次启动的扫码向导可以帮你创建并绑定。\n\n## 安装\n\n```bash\nnpm i -g @alexlikevibe/lark-channel-bridge\n# 或\npnpm add -g @alexlikevibe/lark-channel-bridge\n```\n\n## 首次启动\n\n```bash\nlark-channel-bridge run\n```\n\n第一次运行会进入扫码向导：\n\n1. 终端渲染二维码。\n2. 用飞书 App 扫码。\n3. 选择或创建 PersonalAgent 应用。\n4. 如果终端提示，选择本次要初始化的 agent。\n5. 成功后配置写入 `~/.lark-channel/config.json`。\n\n没有指定项目目录也可以启动。bridge 会创建一个 profile 托管的默认工作目录；启动后在飞书里发送 `/cd <path>` 切到实际项目。\n\n如果已经有 PersonalAgent app，可以在初始化时传 `--app-id` 跳过创建应用流程；命令会提示输入 App Secret。\n\n```bash\nlark-channel-bridge run --app-id cli_xxx\n# 或直接初始化并启动后台服务\nlark-channel-bridge start --app-id cli_xxx\n```\n\nLark 国际版应用可加 `--tenant lark`。\n\n## 后台运行\n\n`run` 适合首次配置和前台调试。确认 bot 能正常收发消息后，先用 `Ctrl-C` 停掉前台进程，再用系统服务常驻后台：\n\n```bash\nlark-channel-bridge start\nlark-channel-bridge status\nlark-channel-bridge stop\n```\n\n服务层命令必须先全局安装，不能直接用 `npx`。daemon 的 launchd plist / systemd unit / Windows 任务会记录 bridge CLI 的路径；如果这个路径来自 npm 临时缓存，缓存清掉后 daemon 就起不来。`run` 用 `npx` 单次启动没问题。\n\n服务层命令按 profile 注册，每个 profile 有独立服务：\n\n```bash\nlark-channel-bridge start [--profile <name>]\nlark-channel-bridge stop [--profile <name>]\nlark-channel-bridge restart [--profile <name>]\nlark-channel-bridge status [--profile <name>]\nlark-channel-bridge unregister [--profile <name>]\n```\n\n平台映射：\n- **macOS**：launchd 用户代理 `ai.lark-channel-bridge.bot.<profile>`\n- **Linux**：systemd 用户单元 `lark-channel-bridge.bot.<profile>.service`\n- **Windows**：Task Scheduler 任务 `LarkChannelBridge.Bot.<profile>`，launcher 是 `.cmd`\n\ndaemon 日志在 `~/.lark-channel/profiles/<profile>/logs/daemon/`。\n\ndaemon 服务不会继承执行 `start` 时 shell 里的任意环境变量。如果后台 agent/provider 需要 API key 或代理配置，请写入 daemon env 文件：\n\n```env\n# ~/.lark-channel/daemon.env                    # 所有 profile 共享\n# ~/.lark-channel/profiles/<profile>/daemon.env # profile 级覆盖\nZAI_CODING_CN_API_KEY=xxx\nHTTPS_PROXY=http://127.0.0.1:7890\n```\n\n修改后需要重启服务。env 文件只提供凭据和环境配置，不负责选择 provider 或模型；如果同时存在多个 provider key，实际使用哪个 provider/模型仍由底层 agent CLI 和 profile 的模型偏好决定。\n\n### 多 profile：分别运行 Claude、Codex 和 pi\n\n默认情况下，bridge 使用当前激活的 profile；可以通过 `profile use <name>` 切换。每个 profile 会维护独立的应用凭据、会话、工作目录和日志。只有在需要同时连接多个 PersonalAgent 应用，或分别运行 Claude、Codex 和 pi 时，才需要创建多个 profile：\n\n```bash\nlark-channel-bridge start --profile claude --agent claude\nlark-channel-bridge start --profile codex --agent codex\nlark-channel-bridge start --profile pi --agent pi\n```\n\n例如只重启 Codex bot：\n\n```bash\nlark-channel-bridge restart --profile codex\nlark-channel-bridge status --profile codex\n```\n\n## 命令速查\n\n### 宿主 CLI\n\n```text\nlark-channel-bridge run [--profile <name>] [--agent claude|codex|pi] [--workspace <path>] [-c <config>]\nlark-channel-bridge migrate [--profile <name>] [--agent claude|codex|pi]\nlark-channel-bridge ps\nlark-channel-bridge kill <id|#>\nlark-channel-bridge --help\n```\n\n`profile use <name>` 会切换后续默认启动使用的 profile。需要同时跑 Claude / Codex 两个 bot、连接多套 PersonalAgent 应用，或做脚本化部署时，再使用这些 profile 管理命令：\n\n```bash\nlark-channel-bridge profile create claude --agent claude\nlark-channel-bridge profile create codex --agent codex\nlark-channel-bridge profile create pi --agent pi\nlark-channel-bridge profile list\nlark-channel-bridge profile use <name>\nlark-channel-bridge profile remove <name>\nlark-channel-bridge profile remove <name> --purge --yes\nlark-channel-bridge profile export <name> [--output ./profile.json] [--force]\nlark-channel-bridge profile export <name> --include-secrets --yes\n```\n\n`profile remove` 默认归档本地状态，也可以删除当前激活的 profile。若还剩其他 profile，会自动切到下一个；若这是最后一个 profile，会清空 root config，之后可以用同名重新创建。只有加 `--purge --yes` 才会永久删除。`profile export` 默认脱敏 app secret；只有加 `--include-secrets --yes` 才会导出敏感配置。\n\n如果某个 profile 被建成了错误的 agent 类型，先 `stop` 或 `unregister --profile <name>` 清理对应后台服务，再 `profile remove <name>`，然后用正确的 `--agent` 重新创建。\n\n### 飞书内斜杠命令\n\n| 命令 | 作用 |\n|---|---|\n| `/new`, `/reset` | 清空当前会话 |\n| `/cd <path>` | 切换工作目录并重置会话 |\n| `/ws list` | 列出命名工作空间 |\n| `/ws save <name>` | 把当前工作目录保存为命名工作空间 |\n| `/ws use <name>` | 切换到命名工作空间 |\n| `/ws remove <name>` | 删除命名工作空间 |\n| `/resume` | 恢复同 agent、工作目录、权限模式兼容的历史会话 |\n| `/status` | 查看 profile、agent、工作目录、会话、lark-cli 身份和运行状态 |\n| `/config` | 调整展示偏好、访问控制和 lark-cli 身份策略 |\n| `/invite user @某人` | 允许用户私聊使用 bot |\n| `/invite admin @某人` | 添加访问控制管理员 |\n| `/invite group` | 允许当前群使用 bot |\n| `/invite all group` | 允许 bot 所在的所有群使用 |\n| `/remove user @某人`, `/remove admin @某人`, `/remove group` | 移除访问控制条目 |\n| `/stop` | 停止当前 run，也可点卡片停止按钮 |\n| `/timeout [N\\|off\\|default]` | 设置或清除当前会话的 idle watchdog |\n| `/ps` | 列出本机 bridge 进程 |\n| `/exit <id\\|#>` | 停止指定 bridge 进程 |\n| `/reconnect` | 强制 WebSocket 重连 |\n| `/doctor [描述]` | 执行低敏诊断 |\n| `/help` | 帮助卡片 |\n\n私聊不需要 @。群和话题群默认必须 `@bot`；`@all` 会被忽略。支持的云文档评论里 @bot 就会触发回复。\n\n## 回复展示与 COT\n\n`/config` 可以调整三类展示选项：\n\n- **消息回复方式**：`消息卡片` 流式更新最终回复；`纯文本` 在 run 完成后一次性发送。\n- **工具调用显示**：控制最终回复卡片 / markdown 中是否展示工具块。\n- **COT 过程消息**：`关闭` 只发送最终回复；`简略` 先用 COT 消息展示 agent 的过程文本和工具摘要；`详细` 还会展示工具参数和截断后的输出。\n\n开启 COT 后，bridge 会把过程消息和最终答案拆成两条消息。过程消息用于追踪 agent 做了什么；最终答案仍由 agent 原始文本生成，bridge 不做启发式过滤。若 agent 把最终答案也作为普通流式文本输出，COT 过程消息中可能会出现对应片段。\n\n## lark-cli 身份策略\n\n每个 profile 都使用当前 profile 的 lark-cli 目录：`~/.lark-channel/profiles/<profile>/lark-cli`。agent 子进程会收到指向这个目录的 `LARKSUITE_CLI_CONFIG_DIR`，所以一个 profile 里的个人授权不会共享给另一个 profile。\n\n默认策略是 `bot-only`：lark-cli 使用应用 / bot 身份，不访问个人资源。当用户为了日历、邮箱、云盘等个人资源完成授权后，当前 profile 可以切到 `user-default`，保留应用身份，同时允许已授权的用户身份。owner/admin 可以在 `/config` 查看或切换这个策略；`/status` 会用 `lark-cli: app` 或 `lark-cli: user-ready` 展示当前摘要。\n\n## 工作目录\n\n每个 profile 都可以有一个默认工作目录：`workspaces.default`。新建 profile 时可以传 `--workspace <path>` 作为初始目录；没传时 bridge 会创建一个 profile 托管的默认工作目录。\n\n下面只是 profile 里的字段片段，不要整段覆盖 `config.json`；请改对应 profile 下的 `workspaces` 字段。\n\n```json\n{\n  \"workspaces\": {\n    \"default\": \"/Users/me/.lark-channel-workspaces/claude/default\"\n  }\n}\n```\n\nbridge 会检查所选目录存在、是目录，并且不是 `/`、Home 根、系统目录或临时目录根这类范围过大的位置。工作目录只是 agent run 的当前目录，不是文件系统 sandbox；agent 实际能访问哪些文件仍取决于本机 agent 进程及其权限模式。\n\n## 权限模式\n\n推荐给用户配置的是 `permissions.defaultAccess` 和 `permissions.maxAccess`。新 profile 默认两项都是 `full`，以保持 bridge 的本地工具、授权流程、文件写入等能力完整可用。如需收紧权限，可以改成 `workspace` 或 `read-only`；收紧后本地工具执行、登录 / 授权流程、文件写入等能力可能受限。\n\n下面只是 profile 里的字段片段，不要整段覆盖 `config.json`；请改对应 profile 下的 `permissions` 字段。\n\n```json\n{\n  \"permissions\": {\n    \"defaultAccess\": \"full\",\n    \"maxAccess\": \"full\"\n  }\n}\n```\n\n模式映射：\n\n| Bridge access | Claude permission mode | Codex mode | Pi mode |\n|---|---|---|---|\n| `full` | `bypassPermissions` | `danger-full-access` | 无限制 |\n| `workspace` | `acceptEdits` | `workspace-write` | 无限制 |\n| `read-only` | `plan` | `read-only` | `--tools read,grep,find,ls` |\n\npi 目前没有内置的 workspace 级沙箱：`workspace` 和 `full` 对 pi 而言行为相同（不加 `--tools` 限制）。需要更强隔离的用户应自行为 pi 做容器化 — 详见 https://pi.dev。\n\n旧版 `sandbox` 字段仍可读取。bridge 保存 profile 后，会把该设置迁移为 canonical `permissions`。\n\n## 数据目录\n\n| 路径 | 内容 |\n|---|---|\n| `~/.lark-channel/config.json` | root config，包含 profiles 和 active profile |\n| `~/.lark-channel/active-profile` | 最近选择的 profile |\n| `~/.lark-channel/profiles/<profile>/sessions.json` | 会话状态 |\n| `~/.lark-channel/profiles/<profile>/sessions.json.catalog.json` | agent-aware 会话索引 |\n| `~/.lark-channel/profiles/<profile>/workspaces.json` | 当前和命名工作空间绑定 |\n| `~/.lark-channel/profiles/<profile>/secrets.enc` | profile 本地加密 secret |\n| `~/.lark-channel/profiles/<profile>/lark-cli/` | 当前 profile 的 lark-cli 目录 |\n| `~/.lark-channel/profiles/<profile>/media/` | 附件缓存 |\n| `~/.lark-channel/profiles/<profile>/logs/` | 结构化运行日志 |\n| `~/.lark-channel/registry/processes.json` | 本机进程注册表 |\n| `~/.lark-channel/registry/locks/` | profile lock 和 app lock |\n\n设置 `LARK_CHANNEL_HOME=/path/to/state` 可以迁移整棵本地状态目录。`LARK_CHANNEL_LOG_DAYS` 可以调整日志保留天数。\n\n## 访问控制\n\n**聊天访问默认是私有的：开箱即用时，只有\"你\"能在私聊和群聊里用这个 bot。** 这里的\"你\" = 创建 / 拥有这个飞书应用的人（也就是扫码把 bot 建起来的那位）。bot 会自动从飞书查出谁是应用 owner，所以**一个人用聊天入口完全不用配置**——你私聊它、在任意群里 @它都正常工作，其他人的聊天消息会被静默忽略（bot 不会回\"你没权限\"，免得暴露自己的存在）。云文档评论按文档权限生效，见下文。\n\n想让别的同事或某些群也能用，就把他们加进下面三类名单：\n\n| 名单 | 控制谁 | 加入 | 移除 |\n|------|--------|------|------|\n| **允许私聊的用户** | 谁可以私聊 bot | `/invite user @某人` | `/remove user @某人` |\n| **响应的群** | bot 在哪些群里对**群内所有人**响应 | `/invite group`（当前群）/ `/invite all group`（bot 所在的全部群） | `/remove group`（当前群） |\n| **管理员** | 谁能改设置、并能在任意群用 bot | `/invite admin @某人` | `/remove admin @某人` |\n\n> `/invite`、`/remove` 这些命令只有**你（创建者）和管理员**能发。命令里 @ 的是**对方**（不是 @ bot），bot 会自动把 @ 解析成对应的人，你不用手动去找 ID。\n\n### 两种\"畅通无阻\"的身份\n\n- **你（创建者）**：不受任何名单限制——私聊、任意群、所有命令都能用，而且**永远锁不死自己**：哪怕名单配乱了，回到 bot 私聊发 `/config` 总能进来。在飞书后台把应用 owner 转给别人后，bot 也会自动跟着切换。\n- **管理员**：能私聊、能用 `/config` 等管理命令，而且**不受\"响应的群\"名单限制**——无论群在不在名单里，bot 都会回他们。适合给一起维护 bot 的同事。\n\n### 几种常见配置\n\n- **只给自己用** → 什么都不用做，默认就是。\n- **让某个同事能私聊 bot** → `/invite user @他`\n- **让某个工作群里所有人都能用** → 在那个群里发 `/invite group`\n- **第一次配，想把 bot 已经在的群一次性全开放** → 发 `/invite all group` 一键拉取 bot 所在的全部群加入名单，之后再用 `/remove group` 删掉不想要的\n- **再拉个人一起当管理员** → `/invite admin @他`\n\n### 还需要知道的\n\n- 改完**下一条消息**就生效，不用重启。\n- **群里默认要先 @bot 才会回**（私聊不用 @）。这是另一个独立开关（`/config` →\"群里需要 @ bot\"），和上面的名单是两回事。\n- 陌生人发消息一律静默丢弃，不会有任何回复。唯一的例外：有人在一个还没开放的群里 @bot，bot 会回一句友好提示，告诉他可以让管理员发 `/invite group` 开放这个群。\n- 云文档评论按文档权限生效：能在支持的文档里评论并 @bot 的人可以触发回复。\n\n### 高级：直接改配置文件\n\n不想在飞书里点的话，`/invite`、`/config` 背后写的是 `~/.lark-channel/config.json` 中对应 profile 的 `access` 字段。空白名单表示这个名单没人，不表示所有人都能用。下面只是 profile 里的字段片段，不要整段覆盖 `config.json`：\n\n```json\n{\n  \"schemaVersion\": 2,\n  \"profiles\": {\n    \"claude\": {\n      \"agentKind\": \"claude\",\n      \"access\": {\n        \"allowedUsers\": [\"ou_xxxxxxxxxxxxx\"],\n        \"allowedChats\": [\"oc_xxxxxxxxxxxxx\"],\n        \"admins\": [\"ou_xxxxxxxxxxxxx\"],\n        \"requireMentionInGroup\": true\n      }\n    }\n  }\n}\n```\n\n`allowedUsers` / `admins` 填用户 `open_id`，`allowedChats` 填群 `chat_id`。手动找 ID 最简单的办法：让对方给 bot 发条消息（群里就 @ 它一下），然后看当前 profile 的日志：\n\n```bash\ngrep '\"event\":\"enter\"' ~/.lark-channel/profiles/<profile>/logs/bridge-$(date +%Y%m%d).jsonl | tail -5\n```\n\n每行都带 `chatId`（群 / 私聊 ID）和 `senderId`（用户 `open_id`）。手改完后**重启 bridge**，或在允许的 admin 上下文里发 `/reconnect` 让它生效。日常调整还是 `/invite` / `/config` 更省事，直接改文件主要用于部署脚本预填。\n\n## 云文档评论\n\n云文档评论不再需要单独绑定工作目录或维护文档白名单。支持的文档评论里 @bot 后，bridge 会在同一个评论线程里回复。评论运行复用文档级 session key；没有记录过文档 cwd 时回退到用户 home 目录。\n\n## 常见问题\n\n**bot 没反应 / agent 不回复**：通常是本机 `claude`、`codex` 或 `pi` CLI 没登录，或者当前会话指向了不存在的工作目录。发 `/status` 看当前状态；`/new` 重开会话往往就好。\n\n**agent 子进程假死（卡片停在最后一帧不动）**：支持 idle 探活。agent 一段时间没输出就会被 SIGTERM kill，卡片末尾会标出自动终止原因。默认关闭。开启方式：`/config` 设全局值（分钟），或 `/timeout 10` 只对当前会话生效；`/timeout off` 关掉当前会话的探活；`/timeout default` 清掉会话覆盖，回退到全局设置。\n\n**图片发过去 agent 说看不到**：升级到最新版，0.1.0 之前的版本有文件名去重 bug。\n\n## 测试与 CI\n\n本地检查：\n\n```bash\npnpm test\npnpm typecheck\npnpm build\n```\n\n`pnpm test` 包含 unit、integration 和 process-level adapter 测试。CI 在 macOS、Ubuntu、Windows 上执行 `pnpm install --frozen-lockfile`、`pnpm test`、`pnpm typecheck` 和 `pnpm build`。\n\n## 可选：遥测（Telemetry）\n\n默认情况下 bridge **不上报任何数据**：没有指标、没有日志离开你的机器，也不引入任何遥测依赖。下面这个钩子在你主动开启前完全是空操作。\n\n想接自己的监控时，用环境变量指向一个 default export（或导出 `createAdapter`）`AdapterFactory` 的模块：\n\n```bash\nLARK_CHANNEL_TELEMETRY_MODULE=your-telemetry-package lark-channel-bridge start\n```\n\n该模块会收到每一条 `log.*` 事件，以及错误 / 指标钩子，转发到任何你想要的地方。接口从包根导出：\n\n```ts\nimport type { AdapterFactory, TelemetryAdapter, TelemetryEvent } from 'lark-channel-bridge';\n\nconst createAdapter: AdapterFactory = (meta) => ({\n  emit(event) {/* 上报事件 */},\n  recordError(err, ctx) {/* 上报异常 */},\n  recordMetric(name, value, tags) {/* 上报指标 */},\n  flush(timeoutMs) {/* 冲刷缓冲事件 */},\n});\nexport default createAdapter;\n```\n\n模块不存在、工厂函数不合法、或者 adapter 抛错，都会降级为空操作——遥测永远不会阻止 bridge 启动，也不会打断日志。\n\n## 许可\n\n[MIT](./LICENSE)\n\n<img src=\"./assets/feedback-group-qr.png\" alt=\"飞书反馈群二维码\" width=\"360\">\n","readmeFilename":"README.zh.md","_rev":"1-6828b48b9ccf7be8da139ebbca51eda9"}