Commit Graph

15 Commits

Author SHA1 Message Date
bb0c274563 feat(browser): systemd 托管共享浏览器后端 + 全机 agent 标签页架构 v2.2.0
浏览器插件重新定位为本机所有 agent 的统一浏览器操作壳:

1. 主路径:homeagent-browser.service(systemd 托管)
   - chromium --headless --remote-debugging-port=9222
     --user-data-dir=<data>/browser_profiles/shared
   - 独立于 homed 生命周期,崩溃自动重启,登录态持久保存
   - 本机所有 agent(HomeAgent/pi/opencode/deepseekharness 等)
     共享同一实例:登录一次全机可用

2. 每 agent 一个标签页(CDP Target 隔离),同 source 复用已有标签页

3. browser_start 探测链:CDP 9222 在线 → 直连;服务已装未跑 →
   systemctl start 等待就绪;未安装 → 返回 need_install+guide 引导

4. 新工具 browser_install:探测 chromium 二进制 → 写 systemd 单元 →
   daemon-reload + enable --now → 验证 CDP → 返回全机共享使用指南
   (含其他 agent 经 connectOverCDP 接入的说明);无 root 权限时
   返回手动安装命令清单

5. failback:无法联网装 chromium 的机器,重试 start 自动降级本地
   spawn 临时模式(登录态不持久,仅保证功能可用)

工具链打包 v2.2.0 已部署验证:need_install 引导 / install 装服 /
start 复用与开新标签页全链路通过。
2026-08-26 12:22:15 +08:00
c945eace1a fix(webui): 附件死锁 + qq 插件文件发送收敛到 output 通道
1. webui 附件死锁修复(output_send__webui 发图 60s 超时根因)
   EventAgentOutput 订阅者已持 chatMu,附件分支调 addChatMsg(内部
   再次 Lock)——sync.Mutex 不可重入导致 Publish 永久阻塞,工具超时、
   图片永远发不出来。改为持锁状态下直接操作 chatHistory+persist。

2. qq 插件 image/file 分支收敛到 output 通道
   output_send__qq 的 type=image/file 此前只透传 payload 给 CQ 码,
   发本地文件必须绕道 upload_group_file 独立工具。现在与 voice 分支
   同模式:本地路径拷入 NapCat 共享目录转 file:///app/files/<name> URI,
   http(s)/file:// URL 保持透传。upload_group_file 保留作为群文件柜
   专用入口。

验证:工具链重编译 → qq.hmap 重打包 → pluginmgr overwrite 安装
(config_kept=true)→ agent 经 output_send__qq 用本地路径发图成功,
mascot.webp 已落共享目录。
2026-08-26 11:14:03 +08:00
ae42e486de feat(pluginmgr): 插件更新接口(upgrade/downgrade 保留配置)+ skill_install overwrite
内核 Registry 拆出 StopAndUnload:
- 停止并从注册表移除插件但保留 config_<name> 表
- 不触发 onRemove 回调(那是删除专用语义)
- RemovePlugin 改为追加清理配置表示清除,更新场景调 StopAndUnload

pluginmgr:
- installFromData/installFromURL/installFromPath 加 overwrite 参数
- 已存在+overwrite=true:StopAndUnload→备份旧目录→解压新包→失败回滚→
  返回 action=upgraded/downgraded/reinstalled+previous_version+config_kept
- 已存在+overwrite=false:返回 error+hint(指向 overwrite 用法)
- cmpVersion 点分版本号数字比较(非字典序)
- 测试覆盖:首次安装→重装拒绝→升级保留配置→降级→失败回滚

skill_install 加 overwrite 参数:
- 同名技能存在时先卸载旧实例+删除目录再安装新包

SDK PluginMgr 接口同步加 StopAndUnload(name string) error

工具链 plugindev 已重建到 /usr/local/bin(7/29→8/25 版本)
QQ 插件诊断日志版(webhook recv 到达+isAtBot 失败日志)已打包并
通过 upgrade 接口热更新部署,配置保留验证通过。
2026-08-25 22:02:17 +08:00
2089d41c0f sync: 同步 SDK PluginMgr API 与 dispatch 48/49/50 (vendored 副本) 2026-08-16 18:44:28 +08:00
0d963ed86f sync: 同步 SDK meta.go CABINumMin 兼容修复(与 SDK 仓一致) 2026-08-15 17:26:33 +08:00
710b1afdf9 C ABI v2: invoke_stage 写回 + ABI 版本对齐核心版本号 (v0.9.0)
- C ABI invoke_stage 增加 result 输出参数,外部插件 stage 回调可将修改后的
  StageContext(RawMessage/LLMText/FinalText/Response/ToolResults) 写回内核
- ABI 标识版本改为字符串 semver 与核心 Version 对齐(ABIVersion="0.9.0"),
  C 层协商用派生整数 CABINum=900(major*100+minor),不再使用独立数字编码
- version_min 保证 v0.8.x(800) 旧插件向后兼容可加载
- 修复工具循环 zen 兼容补位误伤首轮 system 上下文(仅尾部为 assistant/tool 时补位)
- 更新 README 项目状态说明
2026-08-15 15:38:57 +08:00
09faa2874a 插件删除回调:onRemove 生命周期(仅卸载触发,重载不触发)
- 公共 SDK(third_party/homeagent-sdk):RegisterOnRemoveHandler/RunOnRemoveHandlers
  (后注册先执行、幂等);内部 SDK PluginManager 接口新增 RemovePlugin
- registry.RemovePlugin:runStopHandlers → Stop → 清理 plugins/sdkRefs/instances
  → runOnRemoveHandlers → toolCleaner.UnregisterPluginTools → cfgReg.RemoveDisabledPlugin
- pluginmgr.removePlugin 先调 Registry.RemovePlugin 再删目录
- 配置清理:PluginSettings.Remove(key)(内部 SettingsAPI + settingsImpl)
- 演示:timer 插件 onRemove 删 max_duration 键;plugindev 模板同步 onRemove 示例;
  SDK example/calendar cleanupData 删 events.json;manager plugins/uninstall 先停通道
2026-08-02 13:32:44 +08:00
76ef49e9a6 clawhubadapter: OpenClaw 通道插件兼容修复(gateway 生命周期桥 + channelRuntime + deliver 事件式输出)
- manager/main.js:makeChannelRuntime(dispatchReplyWithBufferedBlockDispatcher 入站 + deliver 出站
  绑定 + typingCallbacks)、startChannels/stopChannels(gateway.startAccount fire-and-forget 生命周期
  桥、listAccountIds/resolveAccount 规范签名 cfg 传参)、tools/call 通道分支无 outbound 走 deliver
  事件式发送、SIGTERM 优雅停靠、console 输出重定向 stderr 防 JSON-RPC 流污染
- plugin.go:channel_input 改 InjectInputSync 同步注入取回复并经 CallTool 回发通道(修复
  InjectInterruptText 无 ResponseCh 致回复静默丢弃);channel_status/channel_output 通知接入
- registry.go:channelStatus 状态缓存
- SDK:公共 IOInjector 增加 InjectInputSync(source, channel, text) string + ioAdapter 实现
- 生产验证:微信发消息 → pollLoop → dispatchReply → mock LLM 回文本 → deliver →
  ilink/bot/sendmessage status=200 送达
2026-08-02 13:03:49 +08:00
1013aa0aa9 feat(sdk): add RegisterStopHandler/RunStopHandlers and wire stop cleanup into registry lifecycle
- SDK PluginSDK gains RegisterStopHandler(fn func()) + RunStopHandlers()
  (LIFO, idempotent, cleared after running); synced to third_party copy
- Registry keeps per-plugin SDK refs (sdkRefs); StopAll/ReloadOne/
  DisablePlugin run handlers before calling Stop()
- timer built-in plugin demonstrates handler-based shutdown cleanup
- z_bridge (linux/windows templates) runs handlers before plugin.Stop()
2026-08-02 10:23:40 +08:00
3a5a16c916 bump version to v0.8.0 2026-07-29 15:45:24 +08:00
a899d777c3 sdk: embed non-toolchain SDK in third_party, add NoMemory/Cleaner support
- Embed sdk/, example/, meta/, go.mod from homeagent-sdk (no .git)
- Core .gitignore excludes SDK toolchain: bin/, tools/, package/
- RegisterInputChannel + ChannelDef(NoMemory, Cleaner) in SDK
- IOManager input channel registry with GetInputChannelDef
- eventloop: apply channel Cleaner/NoMemory to interrupt text
- context engine: channelDefLookup applied in textForVector
- document store: ChannelCleaner param for archive functions
- All callers/adapters updated with ChannelDef{} default
2026-07-29 14:48:23 +08:00
1f1233b823 refactor: P0-P3 fixes, C1 cleanup, architecture diagrams, go.work upgrade
- P0-1: ProviderError type + ReportStatus for precise 401/403 detection
- P0-2: Remove -config flag from deploy/homeagent.service
- P2-1: 5s debounce on context.go Save()
- P2-2→C1: Delete output_set_channel entirely
- P2-3: Extract mediaDataURL/mediaChat helpers
- P2-4: Dedup defaultSources var
- P3: Delete dead packages (embed/tokenizer/container/snapshot)
- P3: Delete dead functions (messagesToMap, RunStageAll)
- CL: Update .gitignore, docs, Makefile, gojieba removal
- Config: Delete config/config.yaml, update docs
- Arch: Remove EmitOutputTo from emitResponse
- CL-1: go.work 1.19→1.21
- Docs: Add Mermaid architecture diagrams to README
- Docs: Add kernel-rebuild requires plugin-rebuild note to PLUGIN_DEV.md
2026-07-12 11:42:56 +08:00
dad62516a8 fix: openclaw translateAndRegister uses full tool name for LLM visibility 2026-07-10 13:55:03 +08:00
b55f1dcf0e fix: cap distiller startup scan and switch to formal SDK module dependency
- replace vendored third_party/homeagent-sdk with formal module dependency
- keep canonical SDK via go.mod pinned commit
- optimize distiller startup loading to stream recent raw records only
- parse timestamps correctly and cap startup load to 5000 records
- remove quadratic string building in raw record parsing
- restore fast startup while preserving memory pipeline
2026-07-06 20:18:13 +08:00
50e5dec745 feat: converge dynamic plugins onto canonical homeagent-sdk
- Separate built-in plugin interface from external plugin interface
- Route dynamic plugin loading through homeagent-sdk/sdk using reflection
- Turn internal/sdk into an enhanced wrapper over canonical SDK types
- Vendor SDK repo snapshot under third_party/homeagent-sdk for stable builds
- Keep internal constructors/adapters for memory, knowledge, llm, settings
- Align dynamic QQ loading with canonical SDK chain
2026-07-06 19:27:51 +08:00