@openclaw/qqbot 2026.5.2 → 2026.5.3-beta.1

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 (203) hide show
  1. package/dist/api.js +646 -0
  2. package/dist/approval-cg0SVahb.js +94 -0
  3. package/dist/channel-N6Y_Rcjp.js +551 -0
  4. package/dist/channel-plugin-api.js +2 -0
  5. package/dist/channel.setup-ByCRAe5H.js +25 -0
  6. package/dist/config-D6545NkC.js +94 -0
  7. package/dist/config-schema-DFcjQw73.js +309 -0
  8. package/dist/exec-approvals-COUsM6wZ.js +138 -0
  9. package/dist/gateway-CmSUJKSt.js +6726 -0
  10. package/dist/handler-runtime-Bqm6N0WG.js +120 -0
  11. package/dist/index.js +29 -0
  12. package/dist/narrowing-BoieBTIU.js +25 -0
  13. package/dist/outbound-BJfhwrPg.js +1357 -0
  14. package/dist/request-context-DXtpwWui.js +921 -0
  15. package/dist/resolve-D_06fV6-.js +284 -0
  16. package/dist/runtime-BJAS3eXW.js +18 -0
  17. package/dist/runtime-api.js +2 -0
  18. package/dist/secret-contract-api.js +56 -0
  19. package/dist/sender-p-B14eLG.js +1987 -0
  20. package/dist/setup-entry.js +15 -0
  21. package/dist/setup-plugin-api.js +2 -0
  22. package/dist/string-normalize-Ci6NM5DE.js +98 -0
  23. package/dist/target-parser-Y0prnrXD.js +245 -0
  24. package/package.json +15 -6
  25. package/api.ts +0 -56
  26. package/channel-plugin-api.ts +0 -1
  27. package/index.ts +0 -29
  28. package/runtime-api.ts +0 -9
  29. package/setup-entry.ts +0 -9
  30. package/setup-plugin-api.ts +0 -3
  31. package/src/bridge/approval/capability.ts +0 -237
  32. package/src/bridge/approval/handler-runtime.ts +0 -204
  33. package/src/bridge/bootstrap.ts +0 -135
  34. package/src/bridge/channel-entry.ts +0 -18
  35. package/src/bridge/commands/framework-context-adapter.ts +0 -60
  36. package/src/bridge/commands/framework-registration.ts +0 -47
  37. package/src/bridge/commands/from-parser.test.ts +0 -86
  38. package/src/bridge/commands/from-parser.ts +0 -60
  39. package/src/bridge/commands/result-dispatcher.ts +0 -76
  40. package/src/bridge/config-shared.ts +0 -132
  41. package/src/bridge/config.ts +0 -111
  42. package/src/bridge/gateway.ts +0 -174
  43. package/src/bridge/logger.ts +0 -31
  44. package/src/bridge/narrowing.ts +0 -31
  45. package/src/bridge/plugin-version.test.ts +0 -146
  46. package/src/bridge/plugin-version.ts +0 -102
  47. package/src/bridge/runtime.ts +0 -25
  48. package/src/bridge/sdk-adapter.ts +0 -131
  49. package/src/bridge/setup/finalize.ts +0 -144
  50. package/src/bridge/setup/surface.ts +0 -34
  51. package/src/bridge/tools/channel.ts +0 -58
  52. package/src/bridge/tools/index.ts +0 -15
  53. package/src/bridge/tools/remind.test.ts +0 -124
  54. package/src/bridge/tools/remind.ts +0 -91
  55. package/src/channel.setup.ts +0 -33
  56. package/src/channel.ts +0 -288
  57. package/src/command-auth.test.ts +0 -62
  58. package/src/config-schema.ts +0 -84
  59. package/src/config.test.ts +0 -364
  60. package/src/engine/access/access-control.test.ts +0 -198
  61. package/src/engine/access/access-control.ts +0 -226
  62. package/src/engine/access/index.ts +0 -16
  63. package/src/engine/access/resolve-policy.test.ts +0 -59
  64. package/src/engine/access/resolve-policy.ts +0 -57
  65. package/src/engine/access/sender-match.test.ts +0 -60
  66. package/src/engine/access/sender-match.ts +0 -55
  67. package/src/engine/access/types.ts +0 -53
  68. package/src/engine/adapter/audio.port.ts +0 -27
  69. package/src/engine/adapter/commands.port.ts +0 -22
  70. package/src/engine/adapter/history.port.ts +0 -52
  71. package/src/engine/adapter/index.ts +0 -139
  72. package/src/engine/adapter/mention-gate.port.ts +0 -50
  73. package/src/engine/adapter/types.ts +0 -38
  74. package/src/engine/api/api-client.ts +0 -212
  75. package/src/engine/api/media-chunked.test.ts +0 -336
  76. package/src/engine/api/media-chunked.ts +0 -622
  77. package/src/engine/api/media.ts +0 -218
  78. package/src/engine/api/messages.ts +0 -293
  79. package/src/engine/api/retry.ts +0 -217
  80. package/src/engine/api/routes.ts +0 -95
  81. package/src/engine/api/token.ts +0 -271
  82. package/src/engine/approval/index.test.ts +0 -22
  83. package/src/engine/approval/index.ts +0 -224
  84. package/src/engine/commands/builtin/log-helpers.ts +0 -319
  85. package/src/engine/commands/builtin/register-all.ts +0 -17
  86. package/src/engine/commands/builtin/register-approve.ts +0 -201
  87. package/src/engine/commands/builtin/register-basic.ts +0 -95
  88. package/src/engine/commands/builtin/register-clear-storage.ts +0 -187
  89. package/src/engine/commands/builtin/register-logs.ts +0 -20
  90. package/src/engine/commands/builtin/register-streaming.ts +0 -137
  91. package/src/engine/commands/builtin/state.ts +0 -31
  92. package/src/engine/commands/slash-command-auth.ts +0 -48
  93. package/src/engine/commands/slash-command-handler.ts +0 -146
  94. package/src/engine/commands/slash-commands-impl.test.ts +0 -8
  95. package/src/engine/commands/slash-commands-impl.ts +0 -61
  96. package/src/engine/commands/slash-commands.ts +0 -199
  97. package/src/engine/config/credential-backup.test.ts +0 -88
  98. package/src/engine/config/credential-backup.ts +0 -107
  99. package/src/engine/config/credentials.ts +0 -76
  100. package/src/engine/config/group.test.ts +0 -234
  101. package/src/engine/config/group.ts +0 -299
  102. package/src/engine/config/resolve.test.ts +0 -152
  103. package/src/engine/config/resolve.ts +0 -283
  104. package/src/engine/config/setup-logic.ts +0 -84
  105. package/src/engine/engine-import-boundary.test.ts +0 -73
  106. package/src/engine/gateway/codec.ts +0 -47
  107. package/src/engine/gateway/constants.ts +0 -117
  108. package/src/engine/gateway/event-dispatcher.ts +0 -177
  109. package/src/engine/gateway/gateway-connection.ts +0 -371
  110. package/src/engine/gateway/gateway.ts +0 -291
  111. package/src/engine/gateway/inbound-attachments.test.ts +0 -126
  112. package/src/engine/gateway/inbound-attachments.ts +0 -360
  113. package/src/engine/gateway/inbound-context.ts +0 -195
  114. package/src/engine/gateway/inbound-pipeline.self-echo.test.ts +0 -218
  115. package/src/engine/gateway/inbound-pipeline.ts +0 -235
  116. package/src/engine/gateway/interaction-handler.ts +0 -220
  117. package/src/engine/gateway/message-queue.test.ts +0 -282
  118. package/src/engine/gateway/message-queue.ts +0 -499
  119. package/src/engine/gateway/outbound-dispatch.test.ts +0 -231
  120. package/src/engine/gateway/outbound-dispatch.ts +0 -575
  121. package/src/engine/gateway/reconnect.ts +0 -199
  122. package/src/engine/gateway/stages/access-stage.ts +0 -132
  123. package/src/engine/gateway/stages/assembly-stage.ts +0 -156
  124. package/src/engine/gateway/stages/content-stage.test.ts +0 -77
  125. package/src/engine/gateway/stages/content-stage.ts +0 -77
  126. package/src/engine/gateway/stages/envelope-stage.test.ts +0 -152
  127. package/src/engine/gateway/stages/envelope-stage.ts +0 -144
  128. package/src/engine/gateway/stages/group-gate-stage.ts +0 -292
  129. package/src/engine/gateway/stages/index.ts +0 -18
  130. package/src/engine/gateway/stages/quote-stage.ts +0 -113
  131. package/src/engine/gateway/stages/refidx-stage.ts +0 -62
  132. package/src/engine/gateway/stages/stub-contexts.ts +0 -116
  133. package/src/engine/gateway/types.ts +0 -264
  134. package/src/engine/gateway/typing-keepalive.ts +0 -79
  135. package/src/engine/group/activation.test.ts +0 -114
  136. package/src/engine/group/activation.ts +0 -147
  137. package/src/engine/group/history.test.ts +0 -314
  138. package/src/engine/group/history.ts +0 -321
  139. package/src/engine/group/mention.test.ts +0 -141
  140. package/src/engine/group/mention.ts +0 -197
  141. package/src/engine/group/message-gating.test.ts +0 -188
  142. package/src/engine/group/message-gating.ts +0 -216
  143. package/src/engine/messaging/decode-media-path.ts +0 -82
  144. package/src/engine/messaging/media-source.ts +0 -215
  145. package/src/engine/messaging/media-type-detect.ts +0 -37
  146. package/src/engine/messaging/outbound-audio-port.ts +0 -38
  147. package/src/engine/messaging/outbound-deliver.ts +0 -810
  148. package/src/engine/messaging/outbound-media-send.ts +0 -702
  149. package/src/engine/messaging/outbound-reply.ts +0 -27
  150. package/src/engine/messaging/outbound-result-helpers.ts +0 -54
  151. package/src/engine/messaging/outbound-types.ts +0 -45
  152. package/src/engine/messaging/outbound.ts +0 -485
  153. package/src/engine/messaging/reply-dispatcher.ts +0 -597
  154. package/src/engine/messaging/reply-limiter.ts +0 -164
  155. package/src/engine/messaging/sender.ts +0 -729
  156. package/src/engine/messaging/streaming-c2c.ts +0 -1192
  157. package/src/engine/messaging/streaming-media-send.ts +0 -544
  158. package/src/engine/messaging/target-parser.ts +0 -104
  159. package/src/engine/ref/format-message-ref.ts +0 -142
  160. package/src/engine/ref/format-ref-entry.test.ts +0 -60
  161. package/src/engine/ref/format-ref-entry.ts +0 -27
  162. package/src/engine/ref/store.ts +0 -208
  163. package/src/engine/ref/types.ts +0 -27
  164. package/src/engine/session/known-users.ts +0 -137
  165. package/src/engine/session/session-store.ts +0 -204
  166. package/src/engine/tools/channel-api.ts +0 -244
  167. package/src/engine/tools/remind-logic.test.ts +0 -280
  168. package/src/engine/tools/remind-logic.ts +0 -377
  169. package/src/engine/types.ts +0 -313
  170. package/src/engine/utils/attachment-tags.test.ts +0 -186
  171. package/src/engine/utils/attachment-tags.ts +0 -174
  172. package/src/engine/utils/audio.test.ts +0 -250
  173. package/src/engine/utils/audio.ts +0 -585
  174. package/src/engine/utils/data-paths.ts +0 -38
  175. package/src/engine/utils/diagnostics.ts +0 -109
  176. package/src/engine/utils/file-utils.test.ts +0 -72
  177. package/src/engine/utils/file-utils.ts +0 -225
  178. package/src/engine/utils/format.test.ts +0 -68
  179. package/src/engine/utils/format.ts +0 -70
  180. package/src/engine/utils/image-size.test.ts +0 -158
  181. package/src/engine/utils/image-size.ts +0 -249
  182. package/src/engine/utils/log.test.ts +0 -28
  183. package/src/engine/utils/log.ts +0 -61
  184. package/src/engine/utils/media-tags.test.ts +0 -32
  185. package/src/engine/utils/media-tags.ts +0 -177
  186. package/src/engine/utils/payload.test.ts +0 -68
  187. package/src/engine/utils/payload.ts +0 -145
  188. package/src/engine/utils/platform-storage-laziness.test.ts +0 -63
  189. package/src/engine/utils/platform.test.ts +0 -148
  190. package/src/engine/utils/platform.ts +0 -343
  191. package/src/engine/utils/request-context.ts +0 -60
  192. package/src/engine/utils/string-normalize.ts +0 -91
  193. package/src/engine/utils/stt.test.ts +0 -104
  194. package/src/engine/utils/stt.ts +0 -100
  195. package/src/engine/utils/text-parsing.test.ts +0 -29
  196. package/src/engine/utils/text-parsing.ts +0 -155
  197. package/src/engine/utils/upload-cache.ts +0 -96
  198. package/src/engine/utils/voice-text.ts +0 -15
  199. package/src/exec-approvals.ts +0 -218
  200. package/src/manifest-schema.test.ts +0 -56
  201. package/src/qqbot-test-support.ts +0 -29
  202. package/src/types.ts +0 -210
  203. package/tsconfig.json +0 -16
@@ -1,218 +0,0 @@
1
- import { resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runtime";
2
- import {
3
- createChannelExecApprovalProfile,
4
- isChannelExecApprovalClientEnabledFromConfig,
5
- matchesApprovalRequestFilters,
6
- } from "openclaw/plugin-sdk/approval-client-runtime";
7
- import { resolveApprovalRequestChannelAccountId } from "openclaw/plugin-sdk/approval-native-runtime";
8
- import type {
9
- ExecApprovalRequest,
10
- PluginApprovalRequest,
11
- } from "openclaw/plugin-sdk/approval-runtime";
12
- import type { OpenClawConfig } from "openclaw/plugin-sdk/config-types";
13
- import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
14
- import {
15
- normalizeLowercaseStringOrEmpty,
16
- normalizeOptionalString,
17
- } from "openclaw/plugin-sdk/text-runtime";
18
- import { listQQBotAccountIds, resolveQQBotAccount } from "./bridge/config.js";
19
- import type { QQBotExecApprovalConfig } from "./types.js";
20
-
21
- function normalizeApproverId(value: string | number): string | undefined {
22
- const trimmed = normalizeOptionalString(String(value));
23
- return trimmed || undefined;
24
- }
25
-
26
- export function resolveQQBotExecApprovalConfig(params: {
27
- cfg: OpenClawConfig;
28
- accountId?: string | null;
29
- }): QQBotExecApprovalConfig | undefined {
30
- const account = resolveQQBotAccount(params.cfg, params.accountId);
31
- const config = account.config.execApprovals;
32
- if (!config) {
33
- return undefined;
34
- }
35
- return {
36
- ...config,
37
- enabled: account.enabled && account.secretSource !== "none" ? config.enabled : false,
38
- };
39
- }
40
-
41
- function getQQBotExecApprovalApprovers(params: {
42
- cfg: OpenClawConfig;
43
- accountId?: string | null;
44
- }): string[] {
45
- const accountConfig = resolveQQBotAccount(params.cfg, params.accountId).config;
46
- return resolveApprovalApprovers({
47
- explicit: resolveQQBotExecApprovalConfig(params)?.approvers,
48
- allowFrom: accountConfig.allowFrom,
49
- normalizeApprover: normalizeApproverId,
50
- });
51
- }
52
-
53
- function countQQBotExecApprovalEligibleAccounts(params: {
54
- cfg: OpenClawConfig;
55
- request: ExecApprovalRequest | PluginApprovalRequest;
56
- }): number {
57
- return listQQBotAccountIds(params.cfg).filter((accountId) => {
58
- const account = resolveQQBotAccount(params.cfg, accountId);
59
- if (!account.enabled || account.secretSource === "none") {
60
- return false;
61
- }
62
- const config = resolveQQBotExecApprovalConfig({
63
- cfg: params.cfg,
64
- accountId,
65
- });
66
- return (
67
- isChannelExecApprovalClientEnabledFromConfig({
68
- enabled: config?.enabled,
69
- approverCount: getQQBotExecApprovalApprovers({ cfg: params.cfg, accountId }).length,
70
- }) &&
71
- matchesApprovalRequestFilters({
72
- request: params.request.request,
73
- agentFilter: config?.agentFilter,
74
- sessionFilter: config?.sessionFilter,
75
- fallbackAgentIdFromSessionKey: true,
76
- })
77
- );
78
- }).length;
79
- }
80
-
81
- function matchesQQBotRequestAccount(params: {
82
- cfg: OpenClawConfig;
83
- accountId?: string | null;
84
- request: ExecApprovalRequest | PluginApprovalRequest;
85
- }): boolean {
86
- const turnSourceChannel = normalizeLowercaseStringOrEmpty(
87
- params.request.request.turnSourceChannel,
88
- );
89
- const boundAccountId = resolveApprovalRequestChannelAccountId({
90
- cfg: params.cfg,
91
- request: params.request,
92
- channel: "qqbot",
93
- });
94
- if (turnSourceChannel && turnSourceChannel !== "qqbot" && !boundAccountId) {
95
- return (
96
- countQQBotExecApprovalEligibleAccounts({
97
- cfg: params.cfg,
98
- request: params.request,
99
- }) <= 1
100
- );
101
- }
102
- return (
103
- !boundAccountId ||
104
- !params.accountId ||
105
- normalizeAccountId(boundAccountId) === normalizeAccountId(params.accountId)
106
- );
107
- }
108
-
109
- /**
110
- * Count QQBot accounts that could actually deliver a native approval
111
- * message — i.e. accounts that are enabled and have resolvable secrets.
112
- * Disabled or unconfigured accounts never spawn a handler, so they
113
- * must not contribute to the single-account shortcut in the fallback
114
- * ownership check below.
115
- */
116
- function countQQBotFallbackEligibleAccounts(cfg: OpenClawConfig): number {
117
- return listQQBotAccountIds(cfg).filter((accountId) => {
118
- const account = resolveQQBotAccount(cfg, accountId);
119
- return account.enabled && account.secretSource !== "none";
120
- }).length;
121
- }
122
-
123
- /**
124
- * Fallback account-ownership check — applied when `execApprovals` is NOT
125
- * configured for any QQBot account. In this mode every enabled account
126
- * handler would otherwise race to deliver the same approval to its own
127
- * openid namespace, so we must enforce per-account isolation.
128
- *
129
- * Rules:
130
- * - If the request carries a bound account (via `turnSourceAccountId`
131
- * or session binding), only the handler whose `accountId` matches it
132
- * delivers the approval. This is strict: a handler with an unknown
133
- * `accountId` (null/undefined) must not claim a bound request.
134
- * - If no account is bound, only deliver when there is a single
135
- * *eligible* QQBot account (enabled + secret resolved). Disabled or
136
- * unconfigured accounts never deliver anyway, so they shouldn't
137
- * block the remaining single account from handling the approval.
138
- * Multiple eligible accounts cannot safely race because openids are
139
- * account-scoped — cross-account delivery hits the QQ Bot API with
140
- * a mismatched token and fails.
141
- */
142
- function matchesQQBotFallbackRequestAccount(params: {
143
- cfg: OpenClawConfig;
144
- accountId?: string | null;
145
- request: ExecApprovalRequest | PluginApprovalRequest;
146
- }): boolean {
147
- const boundAccountId = resolveApprovalRequestChannelAccountId({
148
- cfg: params.cfg,
149
- request: params.request,
150
- channel: "qqbot",
151
- });
152
-
153
- if (boundAccountId) {
154
- if (!params.accountId) {
155
- return false;
156
- }
157
- return normalizeAccountId(boundAccountId) === normalizeAccountId(params.accountId);
158
- }
159
-
160
- return countQQBotFallbackEligibleAccounts(params.cfg) <= 1;
161
- }
162
-
163
- /**
164
- * Minimal structural shape required to evaluate per-account ownership.
165
- *
166
- * The SDK types (`ExecApprovalRequest` / `PluginApprovalRequest`) and the
167
- * channel-local approval request types (see `engine/approval/index.ts`)
168
- * share the same logical fields but differ on bookkeeping metadata
169
- * (e.g. `createdAtMs`), so we accept any object exposing the relevant
170
- * routing fields. Consumers can pass either flavor safely.
171
- */
172
- type QQBotApprovalAccountOwnershipRequest = {
173
- request: {
174
- sessionKey?: string | null;
175
- turnSourceChannel?: string | null;
176
- turnSourceTo?: string | null;
177
- turnSourceAccountId?: string | null;
178
- };
179
- };
180
-
181
- /**
182
- * Unified per-account ownership check used by both the profile and
183
- * fallback approval paths. Dispatches to the profile rules when the
184
- * current account has `execApprovals` configured, otherwise uses the
185
- * fallback rules.
186
- *
187
- * This is the single source of truth for "does this QQBot handler own
188
- * this approval request?" and is consumed by both the capability
189
- * gate (shouldHandle) and the lazy native runtime adapter.
190
- */
191
- export function matchesQQBotApprovalAccount(params: {
192
- cfg: OpenClawConfig;
193
- accountId?: string | null;
194
- request: QQBotApprovalAccountOwnershipRequest;
195
- }): boolean {
196
- const normalized = {
197
- cfg: params.cfg,
198
- accountId: params.accountId,
199
- request: params.request as unknown as ExecApprovalRequest | PluginApprovalRequest,
200
- };
201
- if (resolveQQBotExecApprovalConfig(normalized) !== undefined) {
202
- return matchesQQBotRequestAccount(normalized);
203
- }
204
- return matchesQQBotFallbackRequestAccount(normalized);
205
- }
206
-
207
- const qqbotExecApprovalProfile = createChannelExecApprovalProfile({
208
- resolveConfig: resolveQQBotExecApprovalConfig,
209
- resolveApprovers: getQQBotExecApprovalApprovers,
210
- matchesRequestAccount: matchesQQBotRequestAccount,
211
- fallbackAgentIdFromSessionKey: true,
212
- requireClientEnabledForLocalPromptSuppression: false,
213
- });
214
-
215
- export const isQQBotExecApprovalClientEnabled = qqbotExecApprovalProfile.isClientEnabled;
216
- export const isQQBotExecApprovalApprover = qqbotExecApprovalProfile.isApprover;
217
- export const isQQBotExecApprovalAuthorizedSender = qqbotExecApprovalProfile.isAuthorizedSender;
218
- export const shouldHandleQQBotExecApprovalRequest = qqbotExecApprovalProfile.shouldHandleRequest;
@@ -1,56 +0,0 @@
1
- import fs from "node:fs";
2
- import { validateJsonSchemaValue } from "openclaw/plugin-sdk/config-schema";
3
- import { describe, expect, it } from "vitest";
4
-
5
- const manifest = JSON.parse(
6
- fs.readFileSync(new URL("../openclaw.plugin.json", import.meta.url), "utf-8"),
7
- ) as { configSchema: Record<string, unknown> };
8
- const manifestConfigSchemaCacheKey = "qqbot.manifest.config-schema";
9
-
10
- describe("qqbot manifest schema", () => {
11
- it("accepts top-level speech overrides", () => {
12
- const result = validateJsonSchemaValue({
13
- schema: manifest.configSchema,
14
- cacheKey: manifestConfigSchemaCacheKey,
15
- value: {
16
- tts: {
17
- provider: "openai",
18
- baseUrl: "https://example.com/v1",
19
- apiKey: "tts-key",
20
- model: "gpt-4o-mini-tts",
21
- voice: "alloy",
22
- authStyle: "api-key",
23
- queryParams: {
24
- format: "wav",
25
- },
26
- speed: 1.1,
27
- },
28
- stt: {
29
- provider: "openai",
30
- baseUrl: "https://example.com/v1",
31
- apiKey: "stt-key",
32
- model: "whisper-1",
33
- },
34
- },
35
- });
36
-
37
- expect(result.ok).toBe(true);
38
- });
39
-
40
- it("accepts defaultAccount", () => {
41
- const result = validateJsonSchemaValue({
42
- schema: manifest.configSchema,
43
- cacheKey: manifestConfigSchemaCacheKey,
44
- value: {
45
- defaultAccount: "bot2",
46
- accounts: {
47
- bot2: {
48
- appId: "654321",
49
- },
50
- },
51
- },
52
- });
53
-
54
- expect(result.ok).toBe(true);
55
- });
56
- });
@@ -1,29 +0,0 @@
1
- import type { OpenClawConfig } from "openclaw/plugin-sdk/config-types";
2
-
3
- export function makeQqbotSecretRefConfig(): OpenClawConfig {
4
- return {
5
- channels: {
6
- qqbot: {
7
- appId: "123456",
8
- clientSecret: {
9
- source: "env",
10
- provider: "default",
11
- id: "QQBOT_CLIENT_SECRET",
12
- },
13
- },
14
- },
15
- } as OpenClawConfig;
16
- }
17
-
18
- export function makeQqbotDefaultAccountConfig(): OpenClawConfig {
19
- return {
20
- channels: {
21
- qqbot: {
22
- defaultAccount: "bot2",
23
- accounts: {
24
- bot2: { appId: "123456" },
25
- },
26
- },
27
- },
28
- } as OpenClawConfig;
29
- }
package/src/types.ts DELETED
@@ -1,210 +0,0 @@
1
- import type { SecretInput } from "openclaw/plugin-sdk/secret-input";
2
- import type { QQBotDmPolicy, QQBotGroupPolicy } from "./engine/access/index.js";
3
-
4
- export type { QQBotDmPolicy, QQBotGroupPolicy };
5
-
6
- /** QQ Bot base config. */
7
- export interface QQBotConfig {
8
- appId: string;
9
- clientSecret?: SecretInput;
10
- clientSecretFile?: string;
11
- }
12
-
13
- /** Resolved QQ Bot account config used at runtime. */
14
- export interface ResolvedQQBotAccount {
15
- accountId: string;
16
- name?: string;
17
- enabled: boolean;
18
- appId: string;
19
- clientSecret: string;
20
- secretSource: "config" | "file" | "env" | "none";
21
- /** Additional system prompt text. */
22
- systemPrompt?: string;
23
- /** Whether markdown output is enabled. Defaults to true. */
24
- markdownSupport: boolean;
25
- config: QQBotAccountConfig;
26
- }
27
-
28
- /** QQBot-native exec approval delivery + approver authorization. */
29
- export interface QQBotExecApprovalConfig {
30
- enabled?: boolean | "auto";
31
- approvers?: string[];
32
- agentFilter?: string[];
33
- sessionFilter?: string[];
34
- target?: "dm" | "channel" | "both";
35
- }
36
-
37
- /** QQ Bot account config from user settings. */
38
- export interface QQBotAccountConfig {
39
- enabled?: boolean;
40
- name?: string;
41
- appId?: string;
42
- clientSecret?: SecretInput;
43
- clientSecretFile?: string;
44
- /**
45
- * Sender allowlist for direct-message access control and command
46
- * authorization. Entries accept raw openids, `qqbot:OPENID` prefixed
47
- * form, and the `"*"` wildcard. Matching is case-insensitive.
48
- *
49
- * Semantics depend on {@link dmPolicy}:
50
- * - `dmPolicy="open"` (default when allowFrom is empty or contains `"*"`)
51
- * — everyone can DM the bot; the list only influences command gating.
52
- * - `dmPolicy="allowlist"` (default when a non-wildcard list is configured)
53
- * — only listed openids may DM the bot; other DMs are dropped.
54
- * - `dmPolicy="disabled"` — all DMs are dropped regardless of this list.
55
- *
56
- * For group access, see {@link groupAllowFrom} / {@link groupPolicy}.
57
- */
58
- allowFrom?: string[];
59
- /**
60
- * Group-scoped sender allowlist. If omitted, group access falls back to
61
- * {@link allowFrom}. Set explicitly when the group whitelist needs to
62
- * differ from the DM whitelist.
63
- */
64
- groupAllowFrom?: string[];
65
- /**
66
- * DM access policy. Defaults:
67
- * - omitted + allowFrom empty/wildcard → `"open"`
68
- * - omitted + allowFrom non-wildcard → `"allowlist"`
69
- */
70
- dmPolicy?: QQBotDmPolicy;
71
- /**
72
- * Group access policy. Defaults mirror {@link dmPolicy}: if either
73
- * `groupAllowFrom` or `allowFrom` has a non-wildcard entry the policy
74
- * is `"allowlist"`, otherwise `"open"`.
75
- */
76
- groupPolicy?: QQBotGroupPolicy;
77
- /** Optional system prompt prepended to user messages. */
78
- systemPrompt?: string;
79
- /** Whether markdown output is enabled. Defaults to true. */
80
- markdownSupport?: boolean;
81
- /** QQBot-native exec approval delivery + approver authorization. */
82
- execApprovals?: QQBotExecApprovalConfig;
83
- /**
84
- * @deprecated Use audioFormatPolicy.uploadDirectFormats instead.
85
- * Legacy list of formats that can upload directly without SILK conversion.
86
- */
87
- voiceDirectUploadFormats?: string[];
88
- /**
89
- * Audio format policy covering inbound STT and outbound upload behavior.
90
- */
91
- audioFormatPolicy?: AudioFormatPolicy;
92
- /**
93
- * Whether public URLs should be uploaded to QQ directly. Defaults to true.
94
- */
95
- urlDirectUpload?: boolean;
96
- /**
97
- * Upgrade guide URL returned by `/bot-upgrade`.
98
- */
99
- upgradeUrl?: string;
100
- /**
101
- * Upgrade command mode.
102
- * - "doc": show an upgrade guide link
103
- * - "hot-reload": run an in-place npm update flow
104
- */
105
- upgradeMode?: "doc" | "hot-reload";
106
- /**
107
- * Block streaming + optional QQ C2C official stream API.
108
- * - `true`: same as `mode: "partial"` and `c2cStreamApi: true` (recommended).
109
- * - `false` / omitted: no official C2C stream for this account (see object form for fine control).
110
- * - Object (legacy / advanced): `mode` "partial" | "off", `c2cStreamApi` for C2C `/stream_messages`.
111
- */
112
- streaming?:
113
- | boolean
114
- | {
115
- mode?: "off" | "partial";
116
- /** @deprecated Prefer `streaming: true`. */
117
- c2cStreamApi?: boolean;
118
- };
119
- }
120
-
121
- /** Audio format policy controlling which formats can skip transcoding. */
122
- export interface AudioFormatPolicy {
123
- /**
124
- * Formats supported directly by the STT provider.
125
- */
126
- sttDirectFormats?: string[];
127
- /**
128
- * Formats QQ accepts directly for outbound uploads.
129
- */
130
- uploadDirectFormats?: string[];
131
- /**
132
- * Whether outbound audio transcoding is enabled. Defaults to true.
133
- */
134
- transcodeEnabled?: boolean;
135
- }
136
-
137
- /** Rich-media attachment metadata. */
138
- export interface MessageAttachment {
139
- content_type: string;
140
- filename?: string;
141
- height?: number;
142
- width?: number;
143
- size?: number;
144
- url: string;
145
- voice_wav_url?: string;
146
- asr_refer_text?: string;
147
- }
148
-
149
- /** C2C message event payload. */
150
- export interface C2CMessageEvent {
151
- author: {
152
- id: string;
153
- union_openid: string;
154
- user_openid: string;
155
- };
156
- content: string;
157
- id: string;
158
- timestamp: string;
159
- message_scene?: {
160
- source: string;
161
- /** ext can contain ref_msg_idx and msg_idx values. */
162
- ext?: string[];
163
- };
164
- attachments?: MessageAttachment[];
165
- }
166
-
167
- /** Guild @-message event payload. */
168
- export interface GuildMessageEvent {
169
- id: string;
170
- channel_id: string;
171
- guild_id: string;
172
- content: string;
173
- timestamp: string;
174
- author: {
175
- id: string;
176
- username?: string;
177
- bot?: boolean;
178
- };
179
- member?: {
180
- nick?: string;
181
- joined_at?: string;
182
- };
183
- attachments?: MessageAttachment[];
184
- }
185
-
186
- /** Group @-message event payload. */
187
- export interface GroupMessageEvent {
188
- author: {
189
- id: string;
190
- member_openid: string;
191
- };
192
- content: string;
193
- id: string;
194
- timestamp: string;
195
- group_id: string;
196
- group_openid: string;
197
- message_scene?: {
198
- source: string;
199
- ext?: string[];
200
- };
201
- attachments?: MessageAttachment[];
202
- }
203
-
204
- /** WebSocket event payload. */
205
- export interface WSPayload {
206
- op: number;
207
- d?: unknown;
208
- s?: number;
209
- t?: string;
210
- }
package/tsconfig.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "extends": "../tsconfig.package-boundary.base.json",
3
- "compilerOptions": {
4
- "rootDir": "."
5
- },
6
- "include": ["./*.ts", "./src/**/*.ts"],
7
- "exclude": [
8
- "./**/*.test.ts",
9
- "./dist/**",
10
- "./node_modules/**",
11
- "./src/test-support/**",
12
- "./src/**/*test-helpers.ts",
13
- "./src/**/*test-harness.ts",
14
- "./src/**/*test-support.ts"
15
- ]
16
- }