Skip to content

功能: 飞书/Telegram/QQ 旁路提问 (/btw) + 修复会话恢复与代理劫持#194

Closed
Xiaoyuan-Liu wants to merge 7 commits intoriba2534:mainfrom
Xiaoyuan-Liu:main
Closed

功能: 飞书/Telegram/QQ 旁路提问 (/btw) + 修复会话恢复与代理劫持#194
Xiaoyuan-Liu wants to merge 7 commits intoriba2534:mainfrom
Xiaoyuan-Liu:main

Conversation

@Xiaoyuan-Liu
Copy link

@Xiaoyuan-Liu Xiaoyuan-Liu commented Mar 16, 2026

问题描述

  1. 新增 /btw 旁路提问功能,允许用户在 Agent 执行任务期间通过轻量级独立通道提问,不打断主对话流
  2. 修复 thinking signature 无效导致会话恢复失败
  3. 修复 npm 代理劫持飞书 API

实现方案

/btw 旁路提问

后端(src/index.tssrc/web.tssrc/types.ts

  • 新增 handleBtwCommand() + streamBtwAnswer() 处理 /btw 斜杠命令
  • Claude API --print 模式流式回答,基于最近对话上下文
  • WebSocket btw_response 消息类型广播到 Web 端

IM 渠道(src/feishu.tssrc/telegram.tssrc/qq.ts

  • 飞书/Telegram/QQ 均支持 /btw 命令拦截和回复

前端(web/src/components/chat/web/src/stores/chat.ts

  • 新增 BtwBubble.tsx 组件展示旁路问答气泡
  • chat store 新增 btwResponses/btwLoading 状态管理

工具函数(src/im-command-utils.ts

  • 新增 buildBtwTranscript() 构建对话摘要(纯函数,无副作用)

会话恢复修复(container/agent-runner/src/index.ts

  • 新增 isInvalidThinkingSignatureError() 检测 thinking block signature 无效的 400 错误
  • 识别为 sessionResumeFailed,清除旧 session 后自动重试

代理劫持修复(src/index.tsMakefile

  • 进程启动时清除 npm_config_proxy / npm_config_https_proxy
  • make start 改为直接调用 node dist/index.js

Test plan

  • /btw 命令在飞书中正确拦截和回复
  • Web 端 btw 气泡正常展示
  • make typecheck 通过
  • 飞书 WebSocket 连接正常
  • 飞书消息收发正常

🤖 Generated with Claude Code

@Xiaoyuan-Liu Xiaoyuan-Liu reopened this Mar 16, 2026
@Xiaoyuan-Liu Xiaoyuan-Liu changed the title 修复: thinking signature 无效 + npm 代理劫持飞书 API 功能: 飞书/Telegram/QQ 旁路提问 (/btw) + 修复会话恢复与代理劫持 Mar 16, 2026
Xiaoyuan-Liu and others added 3 commits March 17, 2026 11:00
1. agent-runner: 新增 isInvalidThinkingSignatureError() 检测,将 thinking block
   signature 无效错误识别为 sessionResumeFailed,清除旧 session 后自动重试
2. src/index.ts: 进程启动时清除 npm_config_proxy 环境变量,防止 npm run 注入的
   代理设置劫持飞书等外部 API 请求(axios 会读取该变量)
3. Makefile: start 目标改为直接调用 node,避免 npm run 注入代理变量

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts:
#	Makefile
#	web/src/components/chat/MessageList.tsx
# Conflicts:
#	Makefile
#	web/src/components/chat/MessageList.tsx
liuxiaoyuan.101010 and others added 2 commits March 18, 2026 15:55
web-context.ts: 同时保留 executeBtw (PR#194) 和 triggerTaskRun (main) 方法

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Xiaoyuan-Liu
Copy link
Author

将使用干净的 commit 历史重新提交(清理 Git 身份信息)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant