@tencent-connect/qqbot-nodejs 1.0.3 → 1.0.5
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/CHANGELOG.md +96 -0
- package/LICENSE +21 -0
- package/README.md +168 -85
- package/README.zh-CN.md +280 -0
- package/USAGE.md +87 -32
- package/dist/QQBot.d.ts +33 -3
- package/dist/QQBot.d.ts.map +1 -1
- package/dist/QQBot.js +84 -34
- package/dist/QQBot.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/protocol/api/token.d.ts.map +1 -1
- package/dist/protocol/api/token.js +29 -9
- package/dist/protocol/api/token.js.map +1 -1
- package/dist/protocol/gateway/constants.d.ts +6 -1
- package/dist/protocol/gateway/constants.d.ts.map +1 -1
- package/dist/protocol/gateway/constants.js +6 -1
- package/dist/protocol/gateway/constants.js.map +1 -1
- package/dist/protocol/gateway/errors.d.ts +22 -0
- package/dist/protocol/gateway/errors.d.ts.map +1 -0
- package/dist/protocol/gateway/errors.js +24 -0
- package/dist/protocol/gateway/errors.js.map +1 -0
- package/dist/protocol/gateway/gateway-connection.d.ts +45 -4
- package/dist/protocol/gateway/gateway-connection.d.ts.map +1 -1
- package/dist/protocol/gateway/gateway-connection.js +252 -143
- package/dist/protocol/gateway/gateway-connection.js.map +1 -1
- package/dist/protocol/gateway/reconnect.d.ts +24 -1
- package/dist/protocol/gateway/reconnect.d.ts.map +1 -1
- package/dist/protocol/gateway/reconnect.js +42 -6
- package/dist/protocol/gateway/reconnect.js.map +1 -1
- package/dist/protocol/index.d.ts +4 -3
- package/dist/protocol/index.d.ts.map +1 -1
- package/dist/protocol/index.js +3 -2
- package/dist/protocol/index.js.map +1 -1
- package/dist/protocol/utils/file-utils.d.ts +2 -2
- package/dist/protocol/utils/file-utils.js +2 -2
- package/dist/protocol/utils/image-size.d.ts +3 -3
- package/dist/protocol/utils/image-size.js +3 -3
- package/dist/protocol/utils/ref-index-store.d.ts +1 -1
- package/dist/protocol/utils/ref-index-store.js +1 -1
- package/package.json +23 -7
- package/src/QQBot.ts +93 -37
- package/src/index.ts +5 -0
- package/src/protocol/api/token.ts +34 -9
- package/src/protocol/gateway/constants.ts +6 -1
- package/src/protocol/gateway/errors.ts +32 -0
- package/src/protocol/gateway/gateway-connection.ts +288 -157
- package/src/protocol/gateway/reconnect.ts +61 -7
- package/src/protocol/index.ts +10 -1
- package/src/protocol/utils/file-utils.ts +2 -2
- package/src/protocol/utils/image-size.ts +3 -3
- package/src/protocol/utils/ref-index-store.ts +1 -1
package/src/protocol/index.ts
CHANGED
|
@@ -61,6 +61,8 @@ export {
|
|
|
61
61
|
GatewayCloseCode,
|
|
62
62
|
GatewayEvent,
|
|
63
63
|
GatewayOp,
|
|
64
|
+
HANDSHAKE_TIMEOUT_MS,
|
|
65
|
+
INVALID_SESSION_DELAY,
|
|
64
66
|
InteractionType,
|
|
65
67
|
MAX_QUICK_DISCONNECT_COUNT,
|
|
66
68
|
MAX_RECONNECT_ATTEMPTS,
|
|
@@ -69,7 +71,13 @@ export {
|
|
|
69
71
|
RECONNECT_DELAYS,
|
|
70
72
|
} from "./gateway/constants.js";
|
|
71
73
|
export { decodeGatewayMessageData, readOptionalMessageSceneExt } from "./gateway/codec.js";
|
|
72
|
-
export {
|
|
74
|
+
export {
|
|
75
|
+
ReconnectState,
|
|
76
|
+
resolveReconnectPolicy,
|
|
77
|
+
type CloseAction,
|
|
78
|
+
type ReconnectPolicy,
|
|
79
|
+
} from "./gateway/reconnect.js";
|
|
80
|
+
export { GatewayError, GatewayErrorCode } from "./gateway/errors.js";
|
|
73
81
|
export {
|
|
74
82
|
dispatchEvent,
|
|
75
83
|
type DispatchResult,
|
|
@@ -80,6 +88,7 @@ export {
|
|
|
80
88
|
export {
|
|
81
89
|
GatewayConnection,
|
|
82
90
|
type GatewayConnectionOptions,
|
|
91
|
+
type GatewayDisconnect,
|
|
83
92
|
type PersistedSession,
|
|
84
93
|
type SessionPersistencePort,
|
|
85
94
|
} from "./gateway/gateway-connection.js";
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Pure helpers: filename sanitization, size constants, file size formatting.
|
|
5
5
|
* The SDK does NOT bundle SSRF / remote-fetch logic — those are concerns
|
|
6
|
-
* of the host application
|
|
7
|
-
*
|
|
6
|
+
* of the host application and should be implemented at the integration
|
|
7
|
+
* layer.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { MediaFileType } from "../types.js";
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* The header parsers are all pure functions. URL probing requires a
|
|
7
7
|
* caller-provided {@link ImageBytesFetcher} so this module stays free of
|
|
8
|
-
* networking / SSRF concerns — the
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* networking / SSRF concerns — the embedding application is responsible
|
|
9
|
+
* for enforcing public-network-only / hostname-allowlist policies before
|
|
10
|
+
* any byte hits this code.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { Buffer } from "node:buffer";
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Path resolution is **delegated to the embedder** via the constructor:
|
|
15
15
|
* the SDK itself does not know where the host application wants its data
|
|
16
|
-
* (`~/.
|
|
16
|
+
* (e.g. `~/.myapp/qqbot/data/ref-index.jsonl`, `/var/lib/qqbot/...`).
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import fs from "node:fs";
|