@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.
Files changed (42) hide show
  1. package/README.md +74 -39
  2. package/bin/openqq-setup.mjs +50 -50
  3. package/bin/openqq.js +47 -47
  4. package/dist/opencode-qqbot-plugin.js +10 -1
  5. package/dist/openqq-bot.js +360 -69
  6. package/package.json +69 -61
  7. package/src/_FOLDER.md +19 -19
  8. package/src/bridge.ts +934 -796
  9. package/src/commands.ts +554 -514
  10. package/src/config.ts +121 -121
  11. package/src/core/bot-launcher.ts +146 -134
  12. package/src/core/card-approval.ts +146 -146
  13. package/src/core/context-buffer.ts +78 -78
  14. package/src/core/delivery.ts +284 -284
  15. package/src/core/discovery.ts +151 -151
  16. package/src/core/error-rescue.ts +33 -0
  17. package/src/core/file-log.ts +45 -45
  18. package/src/core/form-bridge.ts +304 -304
  19. package/src/core/inflight-journal.ts +212 -151
  20. package/src/core/instance-lock.ts +122 -122
  21. package/src/core/linkwatch.ts +195 -195
  22. package/src/core/message-queue.ts +80 -0
  23. package/src/core/mirror.ts +173 -173
  24. package/src/core/permission.ts +301 -301
  25. package/src/core/reply-limiter.ts +106 -106
  26. package/src/core/send-media.ts +90 -90
  27. package/src/core/util.ts +8 -8
  28. package/src/index.ts +162 -162
  29. package/src/opencode/_FOLDER.md +11 -11
  30. package/src/opencode/client.ts +387 -386
  31. package/src/opencode/eventstream.ts +138 -138
  32. package/src/opencode/history.ts +143 -143
  33. package/src/opencode/mirror.ts +65 -65
  34. package/src/opencode/sessions.ts +158 -158
  35. package/src/plugin-entry.ts +112 -112
  36. package/src/qq/_FOLDER.md +13 -13
  37. package/src/qq/api.ts +539 -539
  38. package/src/qq/gateway.ts +492 -492
  39. package/src/qq/media.ts +219 -204
  40. package/src/qq/sender.ts +300 -300
  41. package/src/qq/types.ts +154 -152
  42. package/tsconfig.json +24 -24
package/package.json CHANGED
@@ -1,61 +1,69 @@
1
- {
2
- "name": "@linjz/opencode-qqbot",
3
- "version": "0.3.5",
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
- "devDependencies": {
55
- "@opencode/plugin": "^2.0.0",
56
- "@types/node": "^22.0.0",
57
- "@types/ws": "^8.5.0",
58
- "effect": "^4.0.0",
59
- "typescript": "^5.9.0"
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 事件 + 会话管理) |