omp-qqbot1.2.0
Bridge the omp coding agent into QQ private chats, with remote tool-call approval
Built for omp
The author tagged this package omp-package.
Reports 0
No reports yet.
Readme
omp-qqbot
Bridge the omp coding agent into QQ private (C2C) chats: send a message from QQ and let the agent work on the machine where omp runs — with remote approval before it executes sensitive tools.
pi-qqbot(gitee.com/zxh126/pi-qqbot)的 omp 移植版。QQ 协议层、多 bot 抢占锁、队列、审批、进度汇报、附件收发、脱敏等核心逻辑与 pi 版一致;宿主耦合层按 omp 的扩展 API 重写。
Install
# 从 npm 安装(已发布)
omp plugin install omp-qqbot
# 之后升级
omp plugin install omp-qqbot@latest # 或在 omp TUI 里 /reload 前重复执行一次 install
# 或从本地目录安装(开发模式,改动即时生效)
omp plugin link /e/Projects/omp-qqbot
或临时验证(不落盘):
omp -e /e/Projects/omp-qqbot/index.ts
Then create the config file ~/.omp/agent/omp-qqbot.json:
{
"appId": "YOUR_APP_ID",
"appSecret": "YOUR_APP_SECRET",
"sandbox": true,
"allowlist": [],
"markdownReply": false,
"approve": {
"tools": ["bash", "powershell", "write", "edit"],
"remember": true
},
"queue": { "max": 20, "ack": true },
"commands": {
"allowReload": false,
"allowQuit": false,
"allowSession": true
},
"progress": { "enabled": true, "intervalMs": 15000 }
}
从 pi 版迁移:omp-qqbot 不再自动读取旧的
~/.pi/agent/pi-qqbot.json(两侧锁互不可见,回退会让 pi 与 omp 两个进程用同一批 appId 各自连同一个 bot,被平台双连接互踢)。请手动复制一次,配置项与 pi 版完全同构,见 pi 版 README:cp ~/.pi/agent/pi-qqbot.json ~/.omp/agent/omp-qqbot.json外发文件审批:
"files": { "forceApproval": true }恢复旧的「每次单独确认」门禁(默认false,普通规则——qq_send_file列进approve.tools才问,且受「以后都同意」/记忆影响)。
Credentials can also come from environment variables (single-bot setup only). omp-qqbot only reads its own OMP_ prefix — pi-qqbot's QQ_BOT_* / PI_QQBOT_* names are deliberately ignored so the two tools can never pick up the same appId from one shared environment:
| Variable | Effect |
|---|---|
OMP_QQBOT_APPID / OMP_QQBOT_APPSECRET |
Single-bot credentials, same as writing appId/appSecret in the config |
OMP_QQBOT_ACCOUNT |
Pin one account by name or appId; it then skips auto-claiming (debug / fixed slot) |
OMP_QQBOT_PROGRESS_MS |
Override progress.intervalMs |
Directory variables keep the host's names because omp itself reads them: PI_CODING_AGENT_DIR (agent dir, i.e. where this plugin's config/lock/owner/logs live) and PI_CONFIG_DIR (config root, agent dir = <root>/agent).
Features
| Feature | Description |
|---|---|
| Chat-driven agent | QQ 私聊消息送进当前 omp 会话;回复自动分片发回 QQ。 |
| Message queue | 任务运行中收到的 QQ 消息排队而不是拒绝;当前 run 收尾后自动执行。/cancel 例外:立即中止并清空队列。 |
| Remote approval | 运行 bash / powershell / write / edit(或配置的其他工具)前先在 QQ 里询问;markdownReply: true 且平台开通 markdown 权限时带内联按钮,纯文本回复随时可用。 |
| Remote-context notice | 每会话第一条 QQ 消息开跑时向系统提示注入「远程用户」说明(omp 的 before_agent_start 系统提示分段替换实现),压缩后自动重新注入。 |
| Session-scoped "always allow" | 回复「以后都同意」后本会话内全部放行;「取消自动同意」恢复。 |
| Single-instance lock | 一台机器只由一个 omp 进程托管一个 bot;其余进程待命,5s 重扫自动接管。 |
| Cancel a running task | /cancel(或「取消」「停」)立即中止当前 run、终止待审批、清空队列、丢弃半截回复。 |
| Progress reports | 任务运行中每 15s 推送进度摘要;/progress off / /progress on 或「别汇报了」「恢复汇报」随时开关;等审批期间自动暂缓。 |
| Secret redaction | 发往 QQ / 落盘日志的内容统一脱敏:Authorization、QQ token、sk-…/ghp_…/AKIA…/JWT/PEM、token=/password=、URL userinfo、长高熵串。 |
| Images & files | QQ 附件下载到临时目录,以「图片路径 」等标记行交给 agent;/sendfile <路径> 或自然语言让 agent 调 qq_send_file 工具把本机文件发回 QQ(图片/视频/语音直显,其余文件卡片)。外发是否审批由 files.forceApproval 决定(默认不强制,走普通审批规则)。
|
| Billing notice | 模型接口 402/401/429/套餐限制时用中文说清「哪家、哪个模型、服务端原话」,不再无声失败。恢复动作(充值//login//model)在本机 TUI 做。 |
| Built-in commands | /status /queue /progress /reset /cancel /sendfile /model /thinking /compact /help |
Usage
启动 omp(扩展加载后自动抢 bot、连网关),然后在 QQ 里给 bot 发消息即可。
QQ 侧命令
| Command | Description |
|---|---|
/status |
bot、忙闲、来源、队列、自动同意、待审批、自动汇报状态 |
/queue |
查看队列;/queue clear 清空;/queue drop <编号> 删一条 |
/progress |
立即推送一次进度;/progress off / on 暂停/恢复自动汇报 |
/reset |
清空回复缓冲、审批记忆与自动同意(不换会话) |
/cancel |
中断当前任务并清空队列(别名:/stop /abort「取消」「停」等) |
/sendfile <路径> |
把本机文件发到你的 QQ |
/model [provider/model] |
查看/切换模型(走 omp 的模型目录与解析) |
/thinking [等级] |
查看/切换思考等级(off…max) |
/compact [指令] |
压缩上下文 |
/help |
帮助 |
会话级命令(QQ 侧受限)
omp 只在命令上下文(registerCommand handler)里提供 reload / newSession / branch / navigateTree / switchSession。因此:
- 本机 TUI 里
/qq reload|new|tree|fork|clone|resume完整可用(会创建编号选择列表); - QQ 侧发
/reload、/new、/tree、/fork、/clone、/resume会得到明确回执,指引到主机 TUI 执行,不会假装执行。
其余 QQ 侧可用的接管命令:/compact、/quit、/session、/name、/model、/thinking、/sendfile(受 commands.allow* 门禁,默认 allowReload=false、allowQuit=false)。
Porting notes(与 pi 版的差异)
| pi 版 | omp 版 |
|---|---|
agent_settled 收尾事件 |
omp 无此事件 → agent_end(willContinue: true 视为中间收尾,不发回复、不派发队列);/cancel 保留 8s 强制解锁看门狗 |
before_agent_start 里改 systemPromptOptions.sections/promptGuidelines |
omp 通过返回值链式替换:return { systemPrompt: [...base, section] } |
审批「停止」返回 { terminate: true } |
omp 的 tool_call 结果没有 terminate → block 该工具并 ctx.abort() 中止整轮 |
sendUserMessage(text, { expandPromptTemplates, deliverAs: "followUp" }) |
omp 的 sendUserMessage 不解释命令/模板:空闲直接开跑;宿主非空闲(本机 TUI 在跑)时入队稍后重试,绝不 steer 进别人的轮次 |
passthrough 派发扩展命令 / 提示模板 / /skill: |
omp 未向消息开放命令通道 → 已知扩展命令回执指引 TUI 执行 |
/tree /fork /clone /resume QQ 侧编号选择 |
会话跳转 API 仅命令上下文 → QQ 侧回执指引;TUI 侧 /qq 可用(fork/clone 落到 omp 的 branch(),语义为「从该条目开新会话文件」) |
| 凭据接手(QQ 发新 key / endpoint+key 注册 provider) | 依赖 pi 的 auth.json/models.json 私有格式,omp 凭据存储不同,v1 未移植;报错只转告分类与原文 |
/update 自更新(pi update) |
omp 无对应 CLI 机制,未移植;升级 = git pull + 重装 + TUI /reload |
destructiveHint 元数据兜底审批 |
omp 无此元数据 → 审批范围 = 配置 approve.tools + 外发硬性门禁(files.forceApproval=true 时的 qq_send_file,默认 false) |
~/.pi/agent/ 配置/锁/日志 |
~/.omp/agent/(配置不回退读旧 pi-qqbot.json,需手动复制;PI_CONFIG_DIR / PI_CODING_AGENT_DIR 与 omp 同规则) |
Development
npm install
npm run typecheck # tsc --noEmit
npm test # 三个冒烟:生命周期(回复刷送/队列/取消)+ agent 目录自建 + 配置不回退
配置文件位置(~/.omp/agent/omp-qqbot.json)字段、多 bot(qqbots)、附件/发送上限、远端提醒等详细说明见 pi 版 README——同名配置项行为一致。
变更历史见 CHANGELOG.md。
License
MIT