feat(lark): add Lark bot channel frontend#3149
Open
0x0101010 wants to merge 3 commits into
Open
Conversation
- New internal/larkbot package with session manager, event adapter, approval handler, and streaming output via SDK Channel module - LarkConfig with env-first credential resolution (app_id_env / app_secret_env) - Progressive streaming with local buffer + async flush (200ms ticker) - Interactive approval cards and ask select menus via OnCardAction - Multi-tenant session router with TTL expiry and concurrency limits - CLI: reasonix lark subcommand - Config: RenderTOML includes [lark] section for setup scaffolding - Clean output: model text in stream, tool summary + token count in one markdown message - Dependency: github.com/larksuite/oapi-sdk-go/v3 v3.9.4 - Tests: config resolution, session router lifecycle
…shal RenderTOML only serializes sections it knows about, so new sections (e.g. [lark]) were silently dropped when SaveTo overwrote the file. Switch SaveTo to use toml.Marshal for existing files, which auto- serializes all struct fields. First-run scaffolding still uses RenderTOML for commented house style.
Contributor
|
v2版本应该是暂时不考虑IM通道的,核心定位是高缓存的编程工具而不是OpenClaw式的AI助手,另外目前可以通过cc-connect实现了https://github.com/chenhg5/cc-connect,建议还是关注其他issue解决比较好🙂 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary / 概述
Adds a Lark (飞书) bot channel frontend to Reasonix, enabling users to interact with Reasonix through Lark chat — ask coding questions in a group or DM, get agent responses as progressive streaming messages, approve/deny tool calls via interactive card buttons.
为 Reasonix 添加 Lark(飞书)机器人通道前端,用户可以在飞书聊天中与 Reasonix 交互——群聊或私聊提问、流式查看 agent 回复、通过交互卡片审批工具调用。
Features / 功能
Lark Bot Frontend / 飞书机器人前端
多租户会话管理:按聊天隔离会话,支持 TTL 过期和并发限制
ch.Stream(), with local buffer + async flush流式渐进输出:模型文本通过
ch.Stream()实时流式输出,本地缓冲 + 异步刷新ApprovalRequest→ Lark card buttons →Controller.Approve()交互审批卡片:审批请求 → 飞书卡片按钮 →
Controller.Approve()干净输出:模型文本一条流式消息,工具摘要 + token 统计合并为一条 markdown 消息
[lark]section with env-first credential resolution (app_id_env/app_secret_env), matching Provider pattern配置:
[lark]段,支持app_id_env/app_secret_env(与 Provider 的api_key_env模式一致)reasonix larksubcommandCLI:
reasonix lark子命令Config Merge Fix / 配置保存修复
SaveTo()usestoml.Marshal()for existing files instead of fullRenderTOML()rewrite, preserving unrecognized TOML sections (e.g.[lark]) across savesSaveTo()对已有文件使用toml.Marshal()而非全量覆写,确保新 section 不被丢弃RenderTOML()for commented house style首次创建仍使用
RenderTOML()生成带注释的脚手架配置Files Changed / 文件变更
internal/larkbot/(new / 新增)internal/config/config.goLarkConfigstruct + accessor methodsinternal/config/render.go[lark]section inRenderTOML()internal/config/edit.gotoml.Marshal()internal/cli/cli.go+lark.goreasonix larksubcommandgo.mod/go.sumgithub.com/larksuite/oapi-sdk-go/v3v3.9.4reasonix.example.toml[lark]config sectionDependencies / 依赖
github.com/larksuite/oapi-sdk-go/v3v3.9.4 (MIT)gorilla/websocketv1.5.0 (MIT),gogo/protobufv1.3.2 (BSD)Testing / 测试
${VAR}expansion配置解析:默认值、环境变量回退、
${VAR}展开会话路由:创建、过期、驱逐、并发限制
RenderTOML()合并保存:已有文件保留未识别段,新文件使用脚手架
手动集成:与真实飞书应用端到端测试