@cxyhhhhh/openclaw-qqbot 1.6.7-alpha.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.
- package/LICENSE +22 -0
- package/README.md +470 -0
- package/README.zh.md +465 -0
- package/bin/qqbot-cli.js +243 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +26 -0
- package/dist/src/admin-resolver.d.ts +33 -0
- package/dist/src/admin-resolver.js +157 -0
- package/dist/src/api.d.ts +264 -0
- package/dist/src/api.js +777 -0
- package/dist/src/channel.d.ts +29 -0
- package/dist/src/channel.js +452 -0
- package/dist/src/config.d.ts +56 -0
- package/dist/src/config.js +278 -0
- package/dist/src/credential-backup.d.ts +31 -0
- package/dist/src/credential-backup.js +66 -0
- package/dist/src/deliver-debounce.d.ts +74 -0
- package/dist/src/deliver-debounce.js +174 -0
- package/dist/src/gateway.d.ts +18 -0
- package/dist/src/gateway.js +2021 -0
- package/dist/src/group-history.d.ts +136 -0
- package/dist/src/group-history.js +226 -0
- package/dist/src/image-server.d.ts +87 -0
- package/dist/src/image-server.js +570 -0
- package/dist/src/inbound-attachments.d.ts +60 -0
- package/dist/src/inbound-attachments.js +248 -0
- package/dist/src/known-users.d.ts +100 -0
- package/dist/src/known-users.js +263 -0
- package/dist/src/message-gating.d.ts +53 -0
- package/dist/src/message-gating.js +107 -0
- package/dist/src/message-queue.d.ts +86 -0
- package/dist/src/message-queue.js +257 -0
- package/dist/src/onboarding.d.ts +10 -0
- package/dist/src/onboarding.js +203 -0
- package/dist/src/outbound-deliver.d.ts +48 -0
- package/dist/src/outbound-deliver.js +392 -0
- package/dist/src/outbound.d.ts +205 -0
- package/dist/src/outbound.js +926 -0
- package/dist/src/proactive.d.ts +170 -0
- package/dist/src/proactive.js +399 -0
- package/dist/src/ref-index-store.d.ts +70 -0
- package/dist/src/ref-index-store.js +250 -0
- package/dist/src/reply-dispatcher.d.ts +35 -0
- package/dist/src/reply-dispatcher.js +311 -0
- package/dist/src/request-context.d.ts +18 -0
- package/dist/src/request-context.js +30 -0
- package/dist/src/runtime.d.ts +3 -0
- package/dist/src/runtime.js +10 -0
- package/dist/src/session-store.d.ts +52 -0
- package/dist/src/session-store.js +254 -0
- package/dist/src/slash-commands.d.ts +77 -0
- package/dist/src/slash-commands.js +1461 -0
- package/dist/src/startup-greeting.d.ts +30 -0
- package/dist/src/startup-greeting.js +97 -0
- package/dist/src/streaming.d.ts +250 -0
- package/dist/src/streaming.js +914 -0
- package/dist/src/stt.d.ts +21 -0
- package/dist/src/stt.js +70 -0
- package/dist/src/tools/channel.d.ts +16 -0
- package/dist/src/tools/channel.js +234 -0
- package/dist/src/tools/remind.d.ts +2 -0
- package/dist/src/tools/remind.js +248 -0
- package/dist/src/types.d.ts +364 -0
- package/dist/src/types.js +17 -0
- package/dist/src/typing-keepalive.d.ts +27 -0
- package/dist/src/typing-keepalive.js +64 -0
- package/dist/src/update-checker.d.ts +34 -0
- package/dist/src/update-checker.js +160 -0
- package/dist/src/utils/audio-convert.d.ts +98 -0
- package/dist/src/utils/audio-convert.js +755 -0
- package/dist/src/utils/chunked-upload.d.ts +59 -0
- package/dist/src/utils/chunked-upload.js +289 -0
- package/dist/src/utils/file-utils.d.ts +61 -0
- package/dist/src/utils/file-utils.js +172 -0
- package/dist/src/utils/image-size.d.ts +51 -0
- package/dist/src/utils/image-size.js +234 -0
- package/dist/src/utils/media-send.d.ts +148 -0
- package/dist/src/utils/media-send.js +456 -0
- package/dist/src/utils/media-tags.d.ts +14 -0
- package/dist/src/utils/media-tags.js +164 -0
- package/dist/src/utils/payload.d.ts +112 -0
- package/dist/src/utils/payload.js +186 -0
- package/dist/src/utils/pkg-version.d.ts +5 -0
- package/dist/src/utils/pkg-version.js +51 -0
- package/dist/src/utils/platform.d.ts +137 -0
- package/dist/src/utils/platform.js +390 -0
- package/dist/src/utils/ssrf-guard.d.ts +25 -0
- package/dist/src/utils/ssrf-guard.js +91 -0
- package/dist/src/utils/text-parsing.d.ts +32 -0
- package/dist/src/utils/text-parsing.js +69 -0
- package/dist/src/utils/upload-cache.d.ts +34 -0
- package/dist/src/utils/upload-cache.js +93 -0
- package/index.ts +31 -0
- package/node_modules/@eshaz/web-worker/LICENSE +201 -0
- package/node_modules/@eshaz/web-worker/README.md +134 -0
- package/node_modules/@eshaz/web-worker/browser.js +17 -0
- package/node_modules/@eshaz/web-worker/cjs/browser.js +16 -0
- package/node_modules/@eshaz/web-worker/cjs/node.js +219 -0
- package/node_modules/@eshaz/web-worker/index.d.ts +4 -0
- package/node_modules/@eshaz/web-worker/node.js +223 -0
- package/node_modules/@eshaz/web-worker/package.json +54 -0
- package/node_modules/@wasm-audio-decoders/common/index.js +5 -0
- package/node_modules/@wasm-audio-decoders/common/package.json +36 -0
- package/node_modules/@wasm-audio-decoders/common/src/WASMAudioDecoderCommon.js +231 -0
- package/node_modules/@wasm-audio-decoders/common/src/WASMAudioDecoderWorker.js +129 -0
- package/node_modules/@wasm-audio-decoders/common/src/puff/README +67 -0
- package/node_modules/@wasm-audio-decoders/common/src/puff/build_puff.js +31 -0
- package/node_modules/@wasm-audio-decoders/common/src/puff/puff.c +863 -0
- package/node_modules/@wasm-audio-decoders/common/src/puff/puff.h +35 -0
- package/node_modules/@wasm-audio-decoders/common/src/utilities.js +3 -0
- package/node_modules/@wasm-audio-decoders/common/types.d.ts +7 -0
- package/node_modules/mpg123-decoder/README.md +265 -0
- package/node_modules/mpg123-decoder/dist/mpg123-decoder.min.js +185 -0
- package/node_modules/mpg123-decoder/dist/mpg123-decoder.min.js.map +1 -0
- package/node_modules/mpg123-decoder/index.js +8 -0
- package/node_modules/mpg123-decoder/package.json +58 -0
- package/node_modules/mpg123-decoder/src/EmscriptenWasm.js +464 -0
- package/node_modules/mpg123-decoder/src/MPEGDecoder.js +200 -0
- package/node_modules/mpg123-decoder/src/MPEGDecoderWebWorker.js +21 -0
- package/node_modules/mpg123-decoder/types.d.ts +30 -0
- package/node_modules/silk-wasm/LICENSE +21 -0
- package/node_modules/silk-wasm/README.md +85 -0
- package/node_modules/silk-wasm/lib/index.cjs +16 -0
- package/node_modules/silk-wasm/lib/index.d.ts +70 -0
- package/node_modules/silk-wasm/lib/index.mjs +16 -0
- package/node_modules/silk-wasm/lib/silk.wasm +0 -0
- package/node_modules/silk-wasm/lib/utils.d.ts +4 -0
- package/node_modules/silk-wasm/package.json +39 -0
- package/node_modules/simple-yenc/.github/FUNDING.yml +1 -0
- package/node_modules/simple-yenc/.prettierignore +1 -0
- package/node_modules/simple-yenc/LICENSE +7 -0
- package/node_modules/simple-yenc/README.md +163 -0
- package/node_modules/simple-yenc/dist/esm.js +1 -0
- package/node_modules/simple-yenc/dist/index.js +1 -0
- package/node_modules/simple-yenc/package.json +50 -0
- package/node_modules/simple-yenc/rollup.config.js +27 -0
- package/node_modules/simple-yenc/src/simple-yenc.js +302 -0
- package/node_modules/ws/LICENSE +20 -0
- package/node_modules/ws/README.md +548 -0
- package/node_modules/ws/browser.js +8 -0
- package/node_modules/ws/index.js +13 -0
- package/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/ws/lib/constants.js +19 -0
- package/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/ws/lib/permessage-deflate.js +528 -0
- package/node_modules/ws/lib/receiver.js +706 -0
- package/node_modules/ws/lib/sender.js +602 -0
- package/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/ws/lib/websocket-server.js +554 -0
- package/node_modules/ws/lib/websocket.js +1393 -0
- package/node_modules/ws/package.json +69 -0
- package/node_modules/ws/wrapper.mjs +8 -0
- package/openclaw.plugin.json +17 -0
- package/package.json +67 -0
- package/preload.cjs +33 -0
- package/scripts/cleanup-legacy-plugins.sh +124 -0
- package/scripts/link-sdk-core.cjs +185 -0
- package/scripts/postinstall-link-sdk.js +113 -0
- package/scripts/proactive-api-server.ts +369 -0
- package/scripts/send-proactive.ts +293 -0
- package/scripts/set-markdown.sh +156 -0
- package/scripts/test-sendmedia.ts +116 -0
- package/scripts/upgrade-via-npm.ps1 +451 -0
- package/scripts/upgrade-via-npm.sh +528 -0
- package/scripts/upgrade-via-source.sh +916 -0
- package/skills/qqbot-channel/SKILL.md +263 -0
- package/skills/qqbot-channel/references/api_references.md +521 -0
- package/skills/qqbot-media/SKILL.md +60 -0
- package/skills/qqbot-remind/SKILL.md +149 -0
- package/src/admin-resolver.ts +181 -0
- package/src/api.ts +1138 -0
- package/src/channel.ts +477 -0
- package/src/config.ts +347 -0
- package/src/credential-backup.ts +72 -0
- package/src/deliver-debounce.ts +229 -0
- package/src/gateway.ts +2257 -0
- package/src/group-history.ts +328 -0
- package/src/image-server.ts +675 -0
- package/src/inbound-attachments.ts +321 -0
- package/src/known-users.ts +353 -0
- package/src/message-gating.ts +190 -0
- package/src/message-queue.ts +349 -0
- package/src/onboarding.ts +274 -0
- package/src/openclaw-plugin-sdk.d.ts +587 -0
- package/src/outbound-deliver.ts +473 -0
- package/src/outbound.ts +1119 -0
- package/src/proactive.ts +530 -0
- package/src/ref-index-store.ts +335 -0
- package/src/reply-dispatcher.ts +334 -0
- package/src/request-context.ts +39 -0
- package/src/runtime.ts +14 -0
- package/src/session-store.ts +303 -0
- package/src/slash-commands.ts +1615 -0
- package/src/startup-greeting.ts +120 -0
- package/src/streaming.ts +1102 -0
- package/src/stt.ts +86 -0
- package/src/tools/channel.ts +281 -0
- package/src/tools/remind.ts +300 -0
- package/src/types.ts +386 -0
- package/src/typing-keepalive.ts +59 -0
- package/src/update-checker.ts +174 -0
- package/src/utils/audio-convert.ts +859 -0
- package/src/utils/chunked-upload.ts +419 -0
- package/src/utils/file-utils.ts +193 -0
- package/src/utils/image-size.ts +266 -0
- package/src/utils/media-send.ts +585 -0
- package/src/utils/media-tags.ts +182 -0
- package/src/utils/payload.ts +265 -0
- package/src/utils/pkg-version.ts +54 -0
- package/src/utils/platform.ts +435 -0
- package/src/utils/ssrf-guard.ts +102 -0
- package/src/utils/text-parsing.ts +75 -0
- package/src/utils/upload-cache.ts +128 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 将 SILK/AMR 语音文件转换为 WAV 格式
|
|
3
|
+
*
|
|
4
|
+
* @param inputPath 输入文件路径(.amr / .silk / .slk)
|
|
5
|
+
* @param outputDir 输出目录(默认与输入文件同目录)
|
|
6
|
+
* @returns 转换后的 WAV 文件路径,失败返回 null
|
|
7
|
+
*/
|
|
8
|
+
export declare function convertSilkToWav(inputPath: string, outputDir?: string): Promise<{
|
|
9
|
+
wavPath: string;
|
|
10
|
+
duration: number;
|
|
11
|
+
} | null>;
|
|
12
|
+
/**
|
|
13
|
+
* 判断是否为语音附件(根据 content_type 或文件扩展名)
|
|
14
|
+
*/
|
|
15
|
+
export declare function isVoiceAttachment(att: {
|
|
16
|
+
content_type?: string;
|
|
17
|
+
filename?: string;
|
|
18
|
+
}): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 格式化语音时长为可读字符串
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatDuration(durationMs: number): string;
|
|
23
|
+
export declare function isAudioFile(filePath: string, mimeType?: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* 判断语音是否需要转码(参考企微 wecom-app 的 shouldTranscodeWecomVoice)
|
|
26
|
+
*
|
|
27
|
+
* QQ Bot API 原生支持 WAV/MP3/SILK 三种格式,其他格式需要先转码。
|
|
28
|
+
* 使用 MIME + 扩展名双重判断,避免仅靠扩展名导致误判。
|
|
29
|
+
*
|
|
30
|
+
* @param filePath 音频文件路径
|
|
31
|
+
* @param mimeType 可选的 MIME 类型
|
|
32
|
+
* @returns true 表示需要转码,false 表示可以直传
|
|
33
|
+
*/
|
|
34
|
+
export declare function shouldTranscodeVoice(filePath: string, mimeType?: string): boolean;
|
|
35
|
+
export interface TTSConfig {
|
|
36
|
+
baseUrl: string;
|
|
37
|
+
apiKey: string;
|
|
38
|
+
model: string;
|
|
39
|
+
voice: string;
|
|
40
|
+
/** Azure OpenAI 风格:使用 api-key header 而非 Bearer token */
|
|
41
|
+
authStyle?: "bearer" | "api-key";
|
|
42
|
+
/** 附加在 URL 后的查询参数,如 Azure 的 api-version */
|
|
43
|
+
queryParams?: Record<string, string>;
|
|
44
|
+
/** 自定义速度(默认不传) */
|
|
45
|
+
speed?: number;
|
|
46
|
+
}
|
|
47
|
+
export declare function resolveTTSConfig(cfg: Record<string, unknown>): TTSConfig | null;
|
|
48
|
+
export declare function textToSpeechPCM(text: string, ttsCfg: TTSConfig): Promise<{
|
|
49
|
+
pcmBuffer: Buffer;
|
|
50
|
+
sampleRate: number;
|
|
51
|
+
}>;
|
|
52
|
+
export declare function pcmToSilk(pcmBuffer: Buffer, sampleRate: number): Promise<{
|
|
53
|
+
silkBuffer: Buffer;
|
|
54
|
+
duration: number;
|
|
55
|
+
}>;
|
|
56
|
+
export declare function textToSilk(text: string, ttsCfg: TTSConfig, outputDir: string): Promise<{
|
|
57
|
+
silkPath: string;
|
|
58
|
+
silkBase64: string;
|
|
59
|
+
duration: number;
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* 将本地音频文件转换为 QQ Bot 可上传的 Base64
|
|
63
|
+
*
|
|
64
|
+
* QQ Bot API 支持直传 WAV、MP3、SILK 三种格式,其他格式仍需转换。
|
|
65
|
+
* 转换策略:
|
|
66
|
+
*
|
|
67
|
+
* 1. WAV / MP3 / SILK → 直传(跳过转换)
|
|
68
|
+
* 2. 有 ffmpeg → ffmpeg 万能解码为 PCM → silk-wasm 编码
|
|
69
|
+
* 支持: ogg, opus, aac, flac, wma, m4a, pcm 等所有 ffmpeg 支持的格式
|
|
70
|
+
* 3. 无 ffmpeg → WASM fallback(仅支持 pcm, wav)
|
|
71
|
+
*
|
|
72
|
+
* @param directUploadFormats - 自定义直传格式列表,覆盖默认值。传 undefined 使用 QQ_NATIVE_UPLOAD_FORMATS
|
|
73
|
+
*/
|
|
74
|
+
export declare function audioFileToSilkBase64(filePath: string, directUploadFormats?: string[]): Promise<string | null>;
|
|
75
|
+
/**
|
|
76
|
+
* 将音频文件转码为 SILK,**输出到临时文件**(供分片上传使用)。
|
|
77
|
+
*
|
|
78
|
+
* 如果文件已经是 QQ 原生格式(WAV/MP3/SILK)或已经是 SILK 编码,
|
|
79
|
+
* 则直接返回原文件路径(不需要转码)。
|
|
80
|
+
*
|
|
81
|
+
* @returns 转码后的文件路径,或 null 表示转码失败
|
|
82
|
+
*/
|
|
83
|
+
export declare function audioFileToSilkFile(filePath: string, directUploadFormats?: string[]): Promise<string | null>;
|
|
84
|
+
/**
|
|
85
|
+
* 等待文件就绪(轮询直到文件出现且大小稳定)
|
|
86
|
+
* 用于 TTS 生成后等待文件写入完成
|
|
87
|
+
*
|
|
88
|
+
* 优化策略:
|
|
89
|
+
* - 文件出现后如果持续 0 字节超过 emptyGiveUpMs(默认 10s),快速失败
|
|
90
|
+
* - 文件未出现超过 noFileGiveUpMs(默认 15s),快速失败
|
|
91
|
+
* - 整体超时 timeoutMs 作为最终兜底
|
|
92
|
+
*
|
|
93
|
+
* @param filePath 文件路径
|
|
94
|
+
* @param timeoutMs 最大等待时间(默认 30 秒)
|
|
95
|
+
* @param pollMs 轮询间隔(默认 500ms)
|
|
96
|
+
* @returns 文件大小(字节),超时或文件始终为空返回 0
|
|
97
|
+
*/
|
|
98
|
+
export declare function waitForFile(filePath: string, timeoutMs?: number, pollMs?: number): Promise<number>;
|