201 Commits

Author SHA1 Message Date
Mingkuan
e74be7a3f8 Release/1.7.1 (#247)
* feat: 添加审批功能(Inline Keyboard 按钮交互)

- 新增 approval-handler.ts:监听 Gateway 审批事件,发送带 Inline Keyboard 的审批消息
- api.ts:添加 sendC2CMessageWithInlineKeyboard / sendGroupMessageWithInlineKeyboard
- gateway.ts:处理 Inline Keyboard 按钮回调,注册/注销 approval-handler
- channel.ts:配置 execApprovals(3.28)和 approvals(3.31+)抑制框架 Forwarder 重复通知
- types.ts:添加 InlineKeyboard / KeyboardButton 等 Keyboard 类型定义
- openclaw-plugin-sdk.d.ts:补充 approval-runtime 模块声明

* feat: 增加outbound过滤

* feat: 新增审批相关配置

1. 斜杠指令当遇到报错的时候,支持将文本代理给模型来回复用户

* feat: 新增gateway审批路由注册

* feat: 新增gateway审批路由注册

* feat: 修复低版本发现的问题

1. 3.11版本兼容性处理,动态加载gateway依赖
2. 兼容3.28版本,声明审批功能可用
3. 恢复默认配置的文案修改

* feat: 修复gateway依赖加载失败问题

* feat: update 1.7.1 release
2026-04-03 03:12:30 +08:00
Mingkuan
2ea3dbf452 Release/1.7.0 (#243)
* feat: support raw msg ref

* fix: mention msg content

* fix: qqmedia tag

* feat: parse msgrefid

* feat: 流式消息能力增强、斜杠指令扩展与媒体标签处理优化

## 流式消息 (streaming)
- 支持流式消息引用:回复时携带引用消息 ID,通过 message_reference 字段传递
- 重构回复边界(reply boundary)机制:检测到模型返回新回复(文本前缀不匹配)时,
  不再终结当前会话并创建新 controller,改为在已有内容后拼接 "\n\n" 分隔符,
  在同一流式会话中继续发送,移除 onReplyBoundary 回调及 gateway 中的重建逻辑
- 移除遇到未闭合媒体标签时提前终结流式会话的逻辑,改为继续正常流式发送安全文本
  部分(performFlush 内置的 stripIncompleteMediaTag 已能保证安全),等待下次
  onPartialReply 带来更多文本后标签自然闭合
- 移除 sendStreamChunk / doStartStreaming 中冗余的 resp.code 错误检查
- streaming 阶段状态转换新增 idle 回退(首分片发送失败时可回退到 idle)
- sendC2CStreamMessage 返回类型从 StreamMessageResponse 统一为 MessageResponse;
  仅终结分片(DONE)触发 sendAndNotify 引用回调,中间分片直接调用 apiRequest
- 移除 types.ts 中不再使用的 StreamMessage / PendingReply 等冗余类型定义
- 补充 streaming-controller 测试用例:覆盖回复边界检测、多段拼接连续发送、
  sentIndex 连续性等场景

## 斜杠指令 (slash-commands)
- 新增 /bot-streaming on|off 指令,支持用户在私聊中查看和切换流式消息开关,
  修改后即时生效并持久化到 openclaw.json 配置文件
- 指令仅在 c2c(私聊)场景下可用,群聊场景下返回提示信息

## API 模块 (api)
- 引入 ApiLogger 接口与 setApiLogger 注入机制,将 api 模块内散落的
  console.log/error 调用统一替换为可注入的 log 实例,便于日志分级和集中管理
- gateway 启动时自动调用 setApiLogger 注入框架 log 实例
- startBackgroundTokenRefresh 中将参数名 log 改为 refreshLog,
  避免与模块级 log 变量冲突

## 网关 (gateway)
- 简化 StreamingController 创建流程:移除 createStreamingController 工厂函数
  及 onReplyBoundary 回调注册,直接内联创建 controller
- dispatch 失败时统一输出错误日志,包含是否收到过响应的信息

## 媒体标签处理 (media-send)
- 修复 splitMessageByMediaTags 中正则贪婪匹配导致的字符异常问题,
  改为非贪婪匹配避免跨标签吞并内容
- 新增代码块感知逻辑(isInsideCodeBlock):在匹配媒体标签前先识别并排除
  围栏代码块(```)区域,避免代码块中的标签被误当作媒体资源处理
- hasMediaTags / findFirstClosedMediaTag / splitByMediaTags 均集成代码块过滤
- findFirstClosedMediaTag 不再对 textBefore 做 trim 和多余换行合并处理
- 新增 code-block-media-tag 测试文件,覆盖代码块内标签忽略、混合内容拆分、
  嵌套代码块、未闭合代码块等边界场景

* ci: 添加插件测试环境流水线流程

* fix: 文件超2G错误信息优化

* fix: 优化文件上传兜底文案

* fix(api): 流式消息不存储引用,移除 DONE 分片的 sendAndNotify 回调

* feat: update ref struct

* fix(ref); 移除引用中暂时无用的赋值。

* feat: 支持自然语言更新版本

* feat(qqbot-upgrade): 声音qqbot-upgrade skill

* feat: 增加/bot-streaming不支持时的默认回复

* refactor: 重构升级脚本降级架构 v4 + 安全扫描绕过 + 内置插件禁用

## 降级架构重构
- 两级降级:Level 1 原生命令 → Level 2 npm pack + openclaw install 本地目录
- Level 1 去掉无效的多源重试(ClawHub 限流时换 npm 源无意义)
- Level 2 多源重试(npm pack 直接走 npm registry,真正绕过 ClawHub)

## 安全扫描绕过(openclaw ≥2026.3.30)
- ≥3.30 跳过 update 路径(update 不支持 --dangerously-force-unsafe-install)
- Level 2 传解压后的目录路径而非 tarball(绕过 installPluginFromArchive 漏传 flag 的 bug)
- 版本检测:仅 ≥3.30 时加 --dangerously-force-unsafe-install

## 内置插件冲突处理
- 默认禁用内置冲突插件(openclaw ≥2026.3.31 内置了 qqbot)
- 安装前清理历史遗留 ID(qqbot/openclaw-qq)的 entries/installs/allow
- 安装后验证内置插件确实已禁用

## 其它优化
- update 超时从 1000s 缩短至 180s(失败更快降级)
- install 前清除配置中的插件记录(避免 already exists)
- 精简告警信息:超时提示静默化,重试中间失败去掉 ⚠️
- 步骤标签对齐 [1/4]~[4/4]

* feat: inject OpenClaw version into User-Agent via runtime

- Add PluginRuntime.version field to openclaw-plugin-sdk.d.ts
- Replace static PLUGIN_USER_AGENT const with getPluginUserAgent() function
  so the OpenClaw version can be updated after runtime injection
- Add setOpenClawVersion() to api.ts for runtime to call
- Call setOpenClawVersion(runtime.version) in setQQBotRuntime()
- Update all PLUGIN_USER_AGENT usages to getPluginUserAgent()
- Fall back to OPENCLAW_VERSION / OPENCLAW_SERVICE_VERSION env vars
  before runtime is available

* fix: remove env-based OpenClaw version fallback

Reading version from process.env is a security risk as env vars
can be tampered. Use runtime.version exclusively; fall back to
"unknown" until runtime is injected.

* fix(upgrade): 切换 gateway.reload.mode=hot 防止安装期间配置写入触发 cgroup kill

问题根因:
- openclaw gateway restart 使用 systemctl --user restart
- systemd 默认 KillMode=control-group,重启时清理整个 cgroup
- 安装流程多次写 openclaw.json,hybrid 模式下触发 restart,脚本被杀

修复:
- snapshot_config 提前到所有写操作前(含 disable_builtin_plugins)
- 安装窗口开始时切换 gateway.reload.mode=hot(热更新不重启)
- 新增 restore_reload_mode():有原值 config set 恢复,无原值 config unset 删除
- cleanup_on_exit 和 [4/4] 前均调用恢复,正常/异常退出均兜底

* fix: 修复windows下路径编码异常导致文件发送错误的问题

* feat: add preferOver to disable built-in qqbot plugin

* feat: 插件升级skill优化

* feat: 更新skill的仓库名

* feat: update 1.7.0 changelog

* Merge branch 'feat/1.7.0-revertskill' into 'main' (merge request !44)

feat: revert qqbot-upgrade skill

---------

Co-authored-by: cxyhhhhh <chenxuyang.win@qq.com>
2026-04-02 16:51:19 +08:00
rianli
8c8d30393f fix/upgrade-script-config-cleanup (merge request !27)
Squash merge branch 'fix/upgrade-script-config-cleanup' into 'main'
1. 升级脚本与热更指令稳定性优化 2.升级脚本性能优化 3.提醒功能多账户 Bug 修复
2026-03-30 12:28:03 +00:00
cxyhhhhh
06470266b4 feat: parse face 2026-03-26 16:46:56 +08:00
cxyhhhhh
8afec9c0c8 feat: del join group msg 2026-03-26 16:46:56 +08:00
cxyhhhhh
3a20b01f31 feat: update changelog 2026-03-26 16:46:56 +08:00
cxyhhhhh
13f2194eed feat: update config 2026-03-26 16:46:56 +08:00
cxyhhhhh
c66872b205 fix: adjust media context 2026-03-26 16:46:56 +08:00
cxyhhhhh
048468d1b1 feat: add agent config 2026-03-26 16:46:56 +08:00
cxyhhhhh
263539e5cd feat: update query config 2026-03-26 16:46:56 +08:00
cxyhhhhh
136aab5767 fix: update config 2026-03-26 16:46:56 +08:00
cxyhhhhh
6909c6280d feat: optimize logic 2026-03-26 16:46:56 +08:00
cxyhhhhh
2d76f0c5e9 feat: update interaction event 2026-03-26 16:46:56 +08:00
cxyhhhhh
4a3abfeeff feat: adjust merged reply context 2026-03-26 16:46:56 +08:00
cxyhhhhh
f7989d88e4 feat: update group config 2026-03-26 16:46:56 +08:00
cxyhhhhh
0e8cccdf10 feat: add interaction event 2026-03-26 16:46:56 +08:00
cxyhhhhh
6eec33ee8c feat: support group messages 2026-03-26 16:46:56 +08:00
sophiasong
cf6481f312 fix: 调整上传失败兜底文案 2026-03-26 16:40:24 +08:00
sophiasong
4d1a07293b fix: fix FALLBACK_MSG 2026-03-26 14:29:53 +08:00
sophiasong
bd1c515109 fix: 调整文件上传重试逻辑兜底文案 2026-03-26 14:24:25 +08:00
sophiasong
d4e7a46b21 fix: fix Concurrency 2026-03-26 14:11:00 +08:00
sophiasong
bdc5471a93 fix: fix file fallback message 2026-03-26 04:08:16 +08:00
sophiasong
babb8febbf fix: fix upload concurrency 2026-03-26 03:21:22 +08:00
leoqlin
ffac229e6e Merge branch 'fix/finish_upload' into 'main' (merge request !12)
fix: adjust file upload concurrency
2026-03-25 16:49:20 +00:00
sophiasong
8da81ca325 fix: adjust file upload concurrency 2026-03-26 00:46:54 +08:00
rianli
f078f0d2f5 fix: preload.cjs 改为同步 require 加载 ESM,修复框架检测不到 register/activate 的问题
- preload.cjs: 移除异步 import() + Proxy 方案,改用 Node 22 原生 CJS require ESM
- package.json: 添加 postbuild 脚本,build 后自动同步产物到 extensions 目录
- upgrade-via-source.sh: 安装后将 extensions 副本替换为 symlink 指向源码目录
2026-03-25 23:41:08 +08:00
rianli
64b33cdb1e Merge remote-tracking branch 'woa/main' into feat/cherry-pick-upgrade-preload 2026-03-25 23:31:01 +08:00
sophiasong
fee0888782 Merge branch 'fix/stream' into 'main' (merge request !10)
fix: 修复回复边界判断失败导致内容被重复发送的问题
2026-03-25 15:04:18 +00:00
leoqlin
0c95d0e014 fix: 修复回复边界判断失败导致内容被重复发送的问题 2026-03-25 23:02:55 +08:00
sophiasong
5bad892db6 fix: finish_upload add retry 2026-03-25 22:20:43 +08:00
rianli
006e43d8fb feat: download upgrade script from remote instead of using local version
fireHotUpgrade now fetches upgrade-via-npm.sh from
https://raw.githubusercontent.com/tencent-connect/openclaw-qqbot/main/scripts/
with fallback to local script on failure.
2026-03-25 20:05:48 +08:00
leoqlin
e9405960ad fix: 修复多条消息时流式没有重启的问题 2026-03-25 19:50:09 +08:00
leoqlin
1a88c7baa7 feat: v1.6.6 — 流式消息(C2C)+ 媒体发送队列重构 + ApiError 结构化错误
- 新增 StreamingController 流式消息控制器,C2C 私聊 AI 回复以打字机效果实时推送
- 新增 sendC2CStreamMessage 流式 API 封装(/v2/users/{openid}/stream_messages)
- 新增 ApiError 结构化错误类,携带 HTTP status 和 path,支持按状态码重试/降级
- 新增 media-send.ts 公共媒体标签解析与发送队列,outbound.ts 和 streaming.ts 共用
- 新增 streaming/streamingConfig 账户配置项,支持按账户控制流式开关和节流间隔
- 新增 strip-incomplete-media-tag 和 streaming-controller 单元测试
- 重构 outbound.ts 媒体发送逻辑为调用公共模块,消除约 100 行重复代码
- audio-convert.ts 日志从 console.log 降级为 console.debug,减少生产日志噪音
- gateway.ts 集成流式控制器:per-message 创建、onPartialReply 回调、dispatch 后收尾
- 删除已清空的 user-messages.ts
- bump version to 1.6.6
2026-03-25 18:36:53 +08:00
sophiasong
580a93f5cb fix: fix bot-clear-storage text 2026-03-25 17:36:23 +08:00
sophiasong
a281055133 feat: add chunked upload for large files 2026-03-25 17:01:43 +08:00
rianli
e06a4ed801 feat: v1.6.5-alpha.7 — openclaw 3.23+ runtime 兼容处理
- gateway: onError/catch 检测 'Unable to resolve plugin runtime module' 错误,给用户发可操作提示
- gateway: 启动时预检 dispatchReply API 是否可用,提前告警
- upgrade-via-npm.sh: 添加 openclaw 版本检测并在 banner 中展示
- bump version to 1.6.5-alpha.7
2026-03-24 18:40:19 +08:00
rianli
097ab73fb6 feat: /bot-upgrade 改为 doc/hot-reload 开关模式 + 升级脚本增强
- /bot-upgrade 新增 upgradeMode 开关: doc(默认)只展示升级指引, hot-reload 保留完整热更新流程
- upgrade-via-npm.sh: 增加 openclaw 3.23+ 配置严格校验兼容(临时移除 channels.qqbot)
- upgrade-via-npm.sh: 增加 postinstall-link-sdk 执行、backup 目录清理、preflight 验证
- upgrade-via-source.sh: 同步 postinstall-link-sdk 和 backup 清理逻辑
2026-03-24 18:05:53 +08:00
rianli
9822eeeff3 fix: 兼容 openclaw 3.23 配置严格校验,install 前临时移除 channels.qqbot
- upgrade-via-npm.sh: install/update 前备份并移除 channels.qqbot,完成后恢复
- 解决 3.23+ 因 qqbot 非内置 channel id 导致 plugins install 校验失败的问题
- bump version to 1.6.5-alpha.4
2026-03-24 14:24:25 +08:00
rianli
366a4f5ece feat: admin appid isolation & silence non-bot-upgrade greeting
- Add request-context for appId isolation across admin operations
- Silence startup greeting when no upgrade-greeting-target file exists
  (console restart / script upgrade / first install won't send messages)
- Only send upgrade notification when triggered via /bot-upgrade command
- Upgrade scripts improvements for multi-bot support
- Remind tool appId isolation fix
2026-03-23 22:16:38 +08:00
rianli
c2d97d506a feat: admin openid 按 appId 隔离存储 + 升级问候调试日志
- admin marker 文件从 admin-{accountId}.json 改为 admin-{accountId}-{appId}.json
- 旧版文件自动迁移:读取时 fallback 旧路径并自动写入新路径
- loadUpgradeGreetingTargetOpenId 增加详细调试日志
- resolveAdminOpenId 签名增加 appId
- safeName 提取为公共函数复用
2026-03-23 16:14:48 +08:00
rianli
9361fe68cb chore: remove alpha version references from docs and help text 2026-03-22 03:00:09 +08:00
rianli
fa16f1daf5 fix: disable hot-upgrade on Windows (win32) 2026-03-22 02:01:58 +08:00
rianli
b298e0d891 feat: upgrade to alpha.44 - use PowerShell + spawn detached for Windows hot-reload, resolve full CLI path from where/which 2026-03-22 01:55:12 +08:00
rianli
e570e33b62 fix: Windows 热更新兼容性修复 + 日志搜索路径扩展
- fix: Windows 上 execFileSync 缺少 shell:true 导致无法执行 .cmd wrapper
- fix: checkUpgradeCompatibility 将版本检测 unknown 和非主流架构降级为警告,不阻断升级
- feat: collectCandidateLogDirs 新增 /tmp 和系统临时目录扫描
- chore: bump version to 1.6.4-alpha.24
2026-03-21 21:49:52 +08:00
rianli
d1623cfd34 fix: use whitelist media dir for downloads & preserve channel credentials on cleanup
- inbound-attachments.ts: getQQBotDataDir('downloads') → getQQBotMediaDir('downloads')
- outbound.ts: url-fallback downloads → getQQBotMediaDir (whitelist safe dir)
- cleanup-legacy-plugins.sh: stop deleting channels.* (preserves appid/secret credentials)
2026-03-21 15:46:15 +08:00
rianli
a2646998e1 feat: download media to openclaw safe dir & init api config with markdownSupport 2026-03-21 15:31:01 +08:00
rianli
bb075c2669 refactor: extract 9 modules from gateway.ts
- stt.ts, startup-greeting.ts, typing-keepalive.ts, utils/text-parsing.ts
- admin-resolver.ts, message-queue.ts, reply-dispatcher.ts
- inbound-attachments.ts, outbound-deliver.ts
- Add clearUserQueue/executeImmediate to message-queue for urgent commands

gateway.ts: ~2950 → ~1400 lines
2026-03-21 15:30:55 +08:00
rianli
d5e4243c11 feat: add qqbot_remind tool & rename skill qqbot-cron → qqbot-remind
- Add src/tools/remind.ts: remind tool with time parsing, cron/once job building
- Rename skills/qqbot-cron → skills/qqbot-remind for semantic consistency
- Update all plugin.json refs and gateway.ts skill path
- Fix Chinese quote parse error (use single-quoted string)
2026-03-21 12:41:27 +08:00
rianli
4678b6c7fe fix: switchPluginSourceToNpm 原子写入,防止升级时 openclaw.json 被损坏
- JSON.parse 加 try-catch 防御,遇到已损坏的配置文件直接跳过
- 改用 write-to-tmp + renameSync 原子替换,避免写入中途崩溃损坏配置
- 写后二次读取校验临时文件完整性,确认无误后才 rename
- 校验范围从 channels.qqbot 扩大到整个 channels 对象
2026-03-20 22:40:25 +08:00
rianli
d1d8727384 feat: v1.6.4-alpha.12 - 热更新指令、实时版本检查、凭证备份保护
- 新增 /bot-upgrade 指令,支持聊天窗口内一键热更新
- 新增 /bot-logs 日志导出指令,支持多日志源聚合
- 新增 qqbot_channel_api 通用频道 API 代理工具
- getUpdateInfo() 改为异步实时查询 npm registry
- isConfigured 增加 credential-backup 兜底检查,防止凭证丢失后无法恢复
- switchPluginSourceToNpm 增加 channels 写后校验,防止竞态覆盖
- 新增 credential-backup.ts 凭证备份模块
- 升级脚本增加凭证备份保护逻辑
2026-03-20 02:38:00 +08:00