@linjz/opencode-qqbot 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -39
- package/bin/openqq-setup.mjs +50 -50
- package/bin/openqq.js +47 -47
- package/dist/opencode-qqbot-plugin.js +10 -1
- package/dist/openqq-bot.js +360 -69
- package/package.json +69 -61
- package/src/_FOLDER.md +19 -19
- package/src/bridge.ts +934 -796
- package/src/commands.ts +554 -514
- package/src/config.ts +121 -121
- package/src/core/bot-launcher.ts +146 -134
- package/src/core/card-approval.ts +146 -146
- package/src/core/context-buffer.ts +78 -78
- package/src/core/delivery.ts +284 -284
- package/src/core/discovery.ts +151 -151
- package/src/core/error-rescue.ts +33 -0
- package/src/core/file-log.ts +45 -45
- package/src/core/form-bridge.ts +304 -304
- package/src/core/inflight-journal.ts +212 -151
- package/src/core/instance-lock.ts +122 -122
- package/src/core/linkwatch.ts +195 -195
- package/src/core/message-queue.ts +80 -0
- package/src/core/mirror.ts +173 -173
- package/src/core/permission.ts +301 -301
- package/src/core/reply-limiter.ts +106 -106
- package/src/core/send-media.ts +90 -90
- package/src/core/util.ts +8 -8
- package/src/index.ts +162 -162
- package/src/opencode/_FOLDER.md +11 -11
- package/src/opencode/client.ts +387 -386
- package/src/opencode/eventstream.ts +138 -138
- package/src/opencode/history.ts +143 -143
- package/src/opencode/mirror.ts +65 -65
- package/src/opencode/sessions.ts +158 -158
- package/src/plugin-entry.ts +112 -112
- package/src/qq/_FOLDER.md +13 -13
- package/src/qq/api.ts +539 -539
- package/src/qq/gateway.ts +492 -492
- package/src/qq/media.ts +219 -204
- package/src/qq/sender.ts +300 -300
- package/src/qq/types.ts +154 -152
- package/tsconfig.json +24 -24
package/package.json
CHANGED
|
@@ -1,61 +1,69 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@linjz/opencode-qqbot",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "QQ Bot for OpenCode AI - chat with AI coding assistant via QQ",
|
|
6
|
-
"exports": {
|
|
7
|
-
".": "./dist/opencode-qqbot-plugin.js"
|
|
8
|
-
},
|
|
9
|
-
"bin": {
|
|
10
|
-
"openqq": "./bin/openqq.js",
|
|
11
|
-
"openqq-setup": "./bin/openqq-setup.mjs"
|
|
12
|
-
},
|
|
13
|
-
"scripts": {
|
|
14
|
-
"dev": "bun run --watch src/index.ts",
|
|
15
|
-
"start": "bun run src/index.ts",
|
|
16
|
-
"typecheck": "tsc --noEmit",
|
|
17
|
-
"test": "bun run test/decision-cases.ts && bun run test/milestone-cases.ts && bun run test/attachment-cases.ts && bun run test/r2-hardening-cases.ts && bun run test/e1-mirror-digest.ts && bun run test/mask-headers-cases.ts && bun run test/perm-mock.ts && bun run test/discovery-cases.ts && bun run test/linkwatch-cases.ts && bun run test/reply-limiter-cases.ts && bun run test/card-approval-cases.ts && bun run test/message-split-cases.ts && bun run test/sync-batch1-cases.ts && bun run test/stream-stagger-cases.ts && bun run test/history-render-cases.ts && bun run test/stall-nudge-cases.ts && bun run test/interaction-watch-cases.ts && bun run test/quote-voice-dedup-cases.ts && bun run test/send-media-cases.ts && bun run test/rival-absorb-cases.ts && bun run test/inflight-recovery-cases.ts && bun run test/plugin-launcher-cases.ts",
|
|
18
|
-
"test:e2e": "bun run test/watch-history-e2e.ts && bun run test/d1-subagent-ask-e2e.ts && bun run test/d2-conflict-e2e.ts && bun run test/perm-e2e.ts && bun run test/perm-real-e2e.ts",
|
|
19
|
-
"verify": "bun run typecheck && bun run test",
|
|
20
|
-
"verify:full": "bun run verify && bun run test:e2e",
|
|
21
|
-
"build:bundle": "bun build src/index.ts --outfile=dist/openqq-bot.js --target=node",
|
|
22
|
-
"build:plugin": "bun build src/plugin-entry.ts --outfile=dist/opencode-qqbot-plugin.js --target=bun --external @opencode/plugin --external effect",
|
|
23
|
-
"deploy:plugin": "bun run build:bundle && bun run build:plugin && bun scripts/deploy-plugin.mjs",
|
|
24
|
-
"prepublishOnly": "bun run build:bundle && bun run build:plugin"
|
|
25
|
-
},
|
|
26
|
-
"files": [
|
|
27
|
-
"bin",
|
|
28
|
-
"src",
|
|
29
|
-
"dist",
|
|
30
|
-
"tsconfig.json"
|
|
31
|
-
],
|
|
32
|
-
"keywords": [
|
|
33
|
-
"opencode-plugin",
|
|
34
|
-
"opencode",
|
|
35
|
-
"qq",
|
|
36
|
-
"qqbot",
|
|
37
|
-
"bot",
|
|
38
|
-
"ai",
|
|
39
|
-
"coding-assistant"
|
|
40
|
-
],
|
|
41
|
-
"license": "MIT",
|
|
42
|
-
"repository": {
|
|
43
|
-
"type": "git",
|
|
44
|
-
"url": "https://github.com/linjz3376/opencode-qqbot"
|
|
45
|
-
},
|
|
46
|
-
"dependencies": {
|
|
47
|
-
"@opencode-ai/sdk": "^1.2.20",
|
|
48
|
-
"ws": "^8.18.0"
|
|
49
|
-
},
|
|
50
|
-
"peerDependencies": {
|
|
51
|
-
"@opencode/plugin": "^2.0.0",
|
|
52
|
-
"effect": "^4.0.0"
|
|
53
|
-
},
|
|
54
|
-
"
|
|
55
|
-
"@opencode/plugin":
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"effect":
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@linjz/opencode-qqbot",
|
|
3
|
+
"version": "0.3.6",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "QQ Bot for OpenCode AI - chat with AI coding assistant via QQ",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./dist/opencode-qqbot-plugin.js"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"openqq": "./bin/openqq.js",
|
|
11
|
+
"openqq-setup": "./bin/openqq-setup.mjs"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev": "bun run --watch src/index.ts",
|
|
15
|
+
"start": "bun run src/index.ts",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
17
|
+
"test": "bun run test/decision-cases.ts && bun run test/milestone-cases.ts && bun run test/attachment-cases.ts && bun run test/r2-hardening-cases.ts && bun run test/e1-mirror-digest.ts && bun run test/mask-headers-cases.ts && bun run test/perm-mock.ts && bun run test/discovery-cases.ts && bun run test/linkwatch-cases.ts && bun run test/reply-limiter-cases.ts && bun run test/card-approval-cases.ts && bun run test/message-split-cases.ts && bun run test/sync-batch1-cases.ts && bun run test/stream-stagger-cases.ts && bun run test/history-render-cases.ts && bun run test/stall-nudge-cases.ts && bun run test/interaction-watch-cases.ts && bun run test/quote-voice-dedup-cases.ts && bun run test/send-media-cases.ts && bun run test/rival-absorb-cases.ts && bun run test/inflight-recovery-cases.ts && bun run test/plugin-launcher-cases.ts && bun run test/pi-absorb-cases.ts",
|
|
18
|
+
"test:e2e": "bun run test/watch-history-e2e.ts && bun run test/d1-subagent-ask-e2e.ts && bun run test/d2-conflict-e2e.ts && bun run test/perm-e2e.ts && bun run test/perm-real-e2e.ts",
|
|
19
|
+
"verify": "bun run typecheck && bun run test",
|
|
20
|
+
"verify:full": "bun run verify && bun run test:e2e",
|
|
21
|
+
"build:bundle": "bun build src/index.ts --outfile=dist/openqq-bot.js --target=node",
|
|
22
|
+
"build:plugin": "bun build src/plugin-entry.ts --outfile=dist/opencode-qqbot-plugin.js --target=bun --external @opencode/plugin --external effect",
|
|
23
|
+
"deploy:plugin": "bun run build:bundle && bun run build:plugin && bun scripts/deploy-plugin.mjs",
|
|
24
|
+
"prepublishOnly": "bun run build:bundle && bun run build:plugin"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"bin",
|
|
28
|
+
"src",
|
|
29
|
+
"dist",
|
|
30
|
+
"tsconfig.json"
|
|
31
|
+
],
|
|
32
|
+
"keywords": [
|
|
33
|
+
"opencode-plugin",
|
|
34
|
+
"opencode",
|
|
35
|
+
"qq",
|
|
36
|
+
"qqbot",
|
|
37
|
+
"bot",
|
|
38
|
+
"ai",
|
|
39
|
+
"coding-assistant"
|
|
40
|
+
],
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://github.com/linjz3376/opencode-qqbot"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@opencode-ai/sdk": "^1.2.20",
|
|
48
|
+
"ws": "^8.18.0"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@opencode/plugin": "^2.0.0",
|
|
52
|
+
"effect": "^4.0.0"
|
|
53
|
+
},
|
|
54
|
+
"peerDependenciesMeta": {
|
|
55
|
+
"@opencode/plugin": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
58
|
+
"effect": {
|
|
59
|
+
"optional": true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@opencode/plugin": "^2.0.0",
|
|
64
|
+
"@types/node": "^22.0.0",
|
|
65
|
+
"@types/ws": "^8.5.0",
|
|
66
|
+
"effect": "^4.0.0",
|
|
67
|
+
"typescript": "^5.9.0"
|
|
68
|
+
}
|
|
69
|
+
}
|
package/src/_FOLDER.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
# src
|
|
2
|
-
|
|
3
|
-
OpenCode QQ Bot 源码根目录。QQ 消息 -> OpenCode AI -> QQ 回复。
|
|
4
|
-
|
|
5
|
-
## 文件
|
|
6
|
-
|
|
7
|
-
| 文件 | 职责 |
|
|
8
|
-
|------|------|
|
|
9
|
-
| config.ts | 环境变量加载 + 校验 |
|
|
10
|
-
| bridge.ts | 核心桥接: QQ 消息 -> OpenCode -> QQ 回复 |
|
|
11
|
-
| commands.ts | 命令系统: /new /stop /status /sessions /help /model /agent /rename |
|
|
12
|
-
| index.ts | 入口: 启动编排 + 优雅关闭 |
|
|
13
|
-
|
|
14
|
-
## 子目录
|
|
15
|
-
|
|
16
|
-
| 目录 | 职责 |
|
|
17
|
-
|------|------|
|
|
18
|
-
| qq/ | QQ Bot 接入层 (WebSocket + REST API + 消息收发) |
|
|
19
|
-
| opencode/ | OpenCode 对接层 (SDK + SSE 事件 + 会话管理) |
|
|
1
|
+
# src
|
|
2
|
+
|
|
3
|
+
OpenCode QQ Bot 源码根目录。QQ 消息 -> OpenCode AI -> QQ 回复。
|
|
4
|
+
|
|
5
|
+
## 文件
|
|
6
|
+
|
|
7
|
+
| 文件 | 职责 |
|
|
8
|
+
|------|------|
|
|
9
|
+
| config.ts | 环境变量加载 + 校验 |
|
|
10
|
+
| bridge.ts | 核心桥接: QQ 消息 -> OpenCode -> QQ 回复 |
|
|
11
|
+
| commands.ts | 命令系统: /new /stop /status /sessions /help /model /agent /rename |
|
|
12
|
+
| index.ts | 入口: 启动编排 + 优雅关闭 |
|
|
13
|
+
|
|
14
|
+
## 子目录
|
|
15
|
+
|
|
16
|
+
| 目录 | 职责 |
|
|
17
|
+
|------|------|
|
|
18
|
+
| qq/ | QQ Bot 接入层 (WebSocket + REST API + 消息收发) |
|
|
19
|
+
| opencode/ | OpenCode 对接层 (SDK + SSE 事件 + 会话管理) |
|