@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.
Files changed (54) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/LICENSE +21 -0
  3. package/README.md +168 -85
  4. package/README.zh-CN.md +280 -0
  5. package/USAGE.md +87 -32
  6. package/dist/QQBot.d.ts +33 -3
  7. package/dist/QQBot.d.ts.map +1 -1
  8. package/dist/QQBot.js +84 -34
  9. package/dist/QQBot.js.map +1 -1
  10. package/dist/index.d.ts +3 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +2 -0
  13. package/dist/index.js.map +1 -1
  14. package/dist/protocol/api/token.d.ts.map +1 -1
  15. package/dist/protocol/api/token.js +29 -9
  16. package/dist/protocol/api/token.js.map +1 -1
  17. package/dist/protocol/gateway/constants.d.ts +6 -1
  18. package/dist/protocol/gateway/constants.d.ts.map +1 -1
  19. package/dist/protocol/gateway/constants.js +6 -1
  20. package/dist/protocol/gateway/constants.js.map +1 -1
  21. package/dist/protocol/gateway/errors.d.ts +22 -0
  22. package/dist/protocol/gateway/errors.d.ts.map +1 -0
  23. package/dist/protocol/gateway/errors.js +24 -0
  24. package/dist/protocol/gateway/errors.js.map +1 -0
  25. package/dist/protocol/gateway/gateway-connection.d.ts +45 -4
  26. package/dist/protocol/gateway/gateway-connection.d.ts.map +1 -1
  27. package/dist/protocol/gateway/gateway-connection.js +252 -143
  28. package/dist/protocol/gateway/gateway-connection.js.map +1 -1
  29. package/dist/protocol/gateway/reconnect.d.ts +24 -1
  30. package/dist/protocol/gateway/reconnect.d.ts.map +1 -1
  31. package/dist/protocol/gateway/reconnect.js +42 -6
  32. package/dist/protocol/gateway/reconnect.js.map +1 -1
  33. package/dist/protocol/index.d.ts +4 -3
  34. package/dist/protocol/index.d.ts.map +1 -1
  35. package/dist/protocol/index.js +3 -2
  36. package/dist/protocol/index.js.map +1 -1
  37. package/dist/protocol/utils/file-utils.d.ts +2 -2
  38. package/dist/protocol/utils/file-utils.js +2 -2
  39. package/dist/protocol/utils/image-size.d.ts +3 -3
  40. package/dist/protocol/utils/image-size.js +3 -3
  41. package/dist/protocol/utils/ref-index-store.d.ts +1 -1
  42. package/dist/protocol/utils/ref-index-store.js +1 -1
  43. package/package.json +23 -7
  44. package/src/QQBot.ts +93 -37
  45. package/src/index.ts +5 -0
  46. package/src/protocol/api/token.ts +34 -9
  47. package/src/protocol/gateway/constants.ts +6 -1
  48. package/src/protocol/gateway/errors.ts +32 -0
  49. package/src/protocol/gateway/gateway-connection.ts +288 -157
  50. package/src/protocol/gateway/reconnect.ts +61 -7
  51. package/src/protocol/index.ts +10 -1
  52. package/src/protocol/utils/file-utils.ts +2 -2
  53. package/src/protocol/utils/image-size.ts +3 -3
  54. package/src/protocol/utils/ref-index-store.ts +1 -1
@@ -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 { ReconnectState, type CloseAction } from "./gateway/reconnect.js";
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 (e.g. an OpenClaw plugin) and should be
7
- * implemented at the integration layer.
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 OpenClaw plugin (or any embedder) is
9
- * responsible for enforcing public-network-only / hostname-allowlist
10
- * policies before any byte hits this code.
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
- * (`~/.openclaw/qqbot/data/ref-index.jsonl`, `/var/lib/qqbot/...`, etc).
16
+ * (e.g. `~/.myapp/qqbot/data/ref-index.jsonl`, `/var/lib/qqbot/...`).
17
17
  */
18
18
 
19
19
  import fs from "node:fs";