@openclaw/zalouser 2026.5.2 → 2026.5.3-beta.2

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 (95) hide show
  1. package/dist/accounts-C00IMUgd.js +63 -0
  2. package/dist/accounts.runtime-uG7S8cXT.js +2 -0
  3. package/dist/api-BRwdUWuS.js +139 -0
  4. package/dist/api.js +7 -0
  5. package/dist/channel-ou_w_2j-.js +484 -0
  6. package/dist/channel-plugin-api.js +2 -0
  7. package/dist/channel.runtime-C9WxiAiR.js +25 -0
  8. package/dist/channel.setup-CiDeBFrn.js +10 -0
  9. package/dist/contract-api.js +3 -0
  10. package/dist/doctor-contract-DgqHp8E2.js +128 -0
  11. package/dist/doctor-contract-api.js +2 -0
  12. package/dist/index.js +27 -0
  13. package/dist/monitor-Cg7K_s_s.js +705 -0
  14. package/dist/runtime-QNU7vLgI.js +106 -0
  15. package/dist/runtime-api.js +22 -0
  16. package/dist/secret-contract-api.js +5 -0
  17. package/dist/security-audit-BZLhil-V.js +34 -0
  18. package/dist/send-BsmySxe3.js +534 -0
  19. package/dist/session-route-C0-Xr8bt.js +92 -0
  20. package/dist/setup-core-CqipqY98.js +40 -0
  21. package/dist/setup-entry.js +11 -0
  22. package/dist/setup-plugin-api.js +2 -0
  23. package/dist/setup-surface-NCOuKu-l.js +359 -0
  24. package/dist/shared-DSy8aIUx.js +120 -0
  25. package/dist/test-api.js +5 -0
  26. package/dist/zalo-js-CHCUlY3c.js +1279 -0
  27. package/package.json +15 -6
  28. package/api.ts +0 -9
  29. package/channel-plugin-api.ts +0 -3
  30. package/contract-api.ts +0 -2
  31. package/doctor-contract-api.ts +0 -1
  32. package/index.ts +0 -34
  33. package/runtime-api.ts +0 -67
  34. package/secret-contract-api.ts +0 -4
  35. package/setup-entry.ts +0 -9
  36. package/setup-plugin-api.ts +0 -2
  37. package/src/accounts.runtime.ts +0 -1
  38. package/src/accounts.test-mocks.ts +0 -14
  39. package/src/accounts.test.ts +0 -266
  40. package/src/accounts.ts +0 -131
  41. package/src/channel-api.ts +0 -20
  42. package/src/channel.adapters.ts +0 -391
  43. package/src/channel.directory.test.ts +0 -59
  44. package/src/channel.runtime.ts +0 -12
  45. package/src/channel.sendpayload.test.ts +0 -172
  46. package/src/channel.setup.test.ts +0 -33
  47. package/src/channel.setup.ts +0 -12
  48. package/src/channel.test.ts +0 -377
  49. package/src/channel.ts +0 -219
  50. package/src/config-schema.ts +0 -33
  51. package/src/directory.ts +0 -54
  52. package/src/doctor-contract.ts +0 -156
  53. package/src/doctor.test.ts +0 -77
  54. package/src/doctor.ts +0 -37
  55. package/src/group-policy.test.ts +0 -61
  56. package/src/group-policy.ts +0 -83
  57. package/src/message-sid.test.ts +0 -66
  58. package/src/message-sid.ts +0 -80
  59. package/src/monitor.account-scope.test.ts +0 -107
  60. package/src/monitor.group-gating.test.ts +0 -816
  61. package/src/monitor.send-mocks.ts +0 -20
  62. package/src/monitor.ts +0 -1044
  63. package/src/probe.test.ts +0 -60
  64. package/src/probe.ts +0 -35
  65. package/src/qr-temp-file.ts +0 -22
  66. package/src/reaction.test.ts +0 -19
  67. package/src/reaction.ts +0 -32
  68. package/src/runtime.ts +0 -9
  69. package/src/security-audit.test.ts +0 -80
  70. package/src/security-audit.ts +0 -71
  71. package/src/send.test.ts +0 -395
  72. package/src/send.ts +0 -272
  73. package/src/session-route.ts +0 -121
  74. package/src/setup-core.ts +0 -33
  75. package/src/setup-surface.test.ts +0 -363
  76. package/src/setup-surface.ts +0 -470
  77. package/src/setup-test-helpers.ts +0 -42
  78. package/src/shared.ts +0 -92
  79. package/src/status-issues.test.ts +0 -31
  80. package/src/status-issues.ts +0 -58
  81. package/src/test-helpers.ts +0 -26
  82. package/src/text-styles.test.ts +0 -203
  83. package/src/text-styles.ts +0 -540
  84. package/src/tool.test.ts +0 -212
  85. package/src/tool.ts +0 -210
  86. package/src/types.ts +0 -125
  87. package/src/zalo-js.credentials.test.ts +0 -465
  88. package/src/zalo-js.test-mocks.ts +0 -89
  89. package/src/zalo-js.ts +0 -1911
  90. package/src/zca-client.test.ts +0 -24
  91. package/src/zca-client.ts +0 -259
  92. package/src/zca-constants.ts +0 -55
  93. package/src/zca-js-exports.d.ts +0 -22
  94. package/test-api.ts +0 -21
  95. package/tsconfig.json +0 -16
@@ -1,24 +0,0 @@
1
- import { describe, expect, it, vi } from "vitest";
2
-
3
- describe("zca-client runtime loading", () => {
4
- it("does not import zca-js until a session is created", async () => {
5
- vi.clearAllMocks();
6
- const runtimeFactory = vi.fn(() => ({
7
- Zalo: class MockZalo {
8
- constructor(public readonly options?: { logging?: boolean; selfListen?: boolean }) {}
9
- },
10
- }));
11
-
12
- vi.doMock("zca-js", runtimeFactory);
13
-
14
- const zcaClient = await import("./zca-client.js");
15
- expect(runtimeFactory).not.toHaveBeenCalled();
16
-
17
- const client = await zcaClient.createZalo({ logging: false, selfListen: true });
18
-
19
- expect(runtimeFactory).toHaveBeenCalledTimes(1);
20
- expect(client).toMatchObject({
21
- options: { logging: false, selfListen: true },
22
- });
23
- });
24
- });
package/src/zca-client.ts DELETED
@@ -1,259 +0,0 @@
1
- import {
2
- LoginQRCallbackEventType,
3
- Reactions,
4
- TextStyle,
5
- ThreadType,
6
- type Style,
7
- } from "./zca-constants.js";
8
-
9
- type ZcaJsRuntime = {
10
- Zalo: unknown;
11
- };
12
- let zcaJsRuntimePromise: Promise<ZcaJsRuntime> | null = null;
13
-
14
- async function loadZcaJsRuntime(): Promise<ZcaJsRuntime> {
15
- // Keep zca-js behind a runtime boundary so bundled metadata/contracts can load
16
- // without resolving its optional WebSocket dependency tree.
17
- zcaJsRuntimePromise ??= import("zca-js").then((mod) => mod as unknown as ZcaJsRuntime);
18
- return await zcaJsRuntimePromise;
19
- }
20
-
21
- export { LoginQRCallbackEventType, Reactions, TextStyle, ThreadType };
22
- export type { Style };
23
-
24
- export type Credentials = {
25
- imei: string;
26
- cookie: unknown;
27
- userAgent: string;
28
- language?: string;
29
- };
30
-
31
- export type User = {
32
- userId: string;
33
- username: string;
34
- displayName: string;
35
- zaloName: string;
36
- avatar: string;
37
- };
38
-
39
- export type GroupInfo = {
40
- groupId: string;
41
- name: string;
42
- totalMember?: number;
43
- memberIds?: unknown[];
44
- currentMems?: Array<{
45
- id?: unknown;
46
- dName?: string;
47
- zaloName?: string;
48
- avatar?: string;
49
- }>;
50
- };
51
-
52
- export type Message = {
53
- type: number;
54
- threadId: string;
55
- isSelf: boolean;
56
- data: Record<string, unknown>;
57
- };
58
-
59
- export type LoginQRCallbackEvent =
60
- | {
61
- type: 0;
62
- data: {
63
- code: string;
64
- image: string;
65
- };
66
- actions: {
67
- saveToFile: (qrPath?: string) => Promise<unknown>;
68
- retry: () => unknown;
69
- abort: () => unknown;
70
- };
71
- }
72
- | {
73
- type: 1;
74
- data: null;
75
- actions: {
76
- retry: () => unknown;
77
- abort: () => unknown;
78
- };
79
- }
80
- | {
81
- type: 2;
82
- data: {
83
- avatar: string;
84
- display_name: string;
85
- };
86
- actions: {
87
- retry: () => unknown;
88
- abort: () => unknown;
89
- };
90
- }
91
- | {
92
- type: 3;
93
- data: {
94
- code: string;
95
- };
96
- actions: {
97
- retry: () => unknown;
98
- abort: () => unknown;
99
- };
100
- }
101
- | {
102
- type: 4;
103
- data: {
104
- cookie: unknown;
105
- imei: string;
106
- userAgent: string;
107
- };
108
- actions: null;
109
- };
110
-
111
- export type Listener = {
112
- on(event: "message", callback: (message: Message) => void): void;
113
- on(event: "error", callback: (error: unknown) => void): void;
114
- on(event: "closed", callback: (code: number, reason: string) => void): void;
115
- off(event: "message", callback: (message: Message) => void): void;
116
- off(event: "error", callback: (error: unknown) => void): void;
117
- off(event: "closed", callback: (code: number, reason: string) => void): void;
118
- start(opts?: { retryOnClose?: boolean }): void;
119
- stop(): void;
120
- };
121
-
122
- type DeliveryEventMessage = {
123
- msgId: string;
124
- cliMsgId: string;
125
- uidFrom: string;
126
- idTo: string;
127
- msgType: string;
128
- st: number;
129
- at: number;
130
- cmd: number;
131
- ts: string | number;
132
- };
133
-
134
- type DeliveryEventMessages = DeliveryEventMessage | DeliveryEventMessage[];
135
-
136
- export type API = {
137
- listener: Listener;
138
- getContext(): {
139
- imei: string;
140
- userAgent: string;
141
- language?: string;
142
- };
143
- getCookie(): {
144
- toJSON(): {
145
- cookies: unknown[];
146
- };
147
- };
148
- fetchAccountInfo(): Promise<User | { profile: User }>;
149
- getAllFriends(): Promise<User[]>;
150
- getOwnId(): string;
151
- getAllGroups(): Promise<{
152
- gridVerMap: Record<string, string>;
153
- }>;
154
- getGroupInfo(groupId: string | string[]): Promise<{
155
- gridInfoMap: Record<string, GroupInfo & { memVerList?: unknown }>;
156
- }>;
157
- getGroupMembersInfo(memberId: string | string[]): Promise<{
158
- profiles: Record<
159
- string,
160
- {
161
- id?: string;
162
- displayName?: string;
163
- zaloName?: string;
164
- avatar?: string;
165
- }
166
- >;
167
- }>;
168
- sendMessage(
169
- message: string | Record<string, unknown>,
170
- threadId: string,
171
- type?: number,
172
- ): Promise<{
173
- msgId?: string | number;
174
- message?: { msgId?: string | number } | null;
175
- attachment?: Array<{ msgId?: string | number }>;
176
- }>;
177
- uploadAttachment(
178
- sources:
179
- | string
180
- | {
181
- data: Buffer;
182
- filename: `${string}.${string}`;
183
- metadata: {
184
- totalSize: number;
185
- width?: number;
186
- height?: number;
187
- };
188
- }
189
- | Array<
190
- | string
191
- | {
192
- data: Buffer;
193
- filename: `${string}.${string}`;
194
- metadata: {
195
- totalSize: number;
196
- width?: number;
197
- height?: number;
198
- };
199
- }
200
- >,
201
- threadId: string,
202
- type?: number,
203
- ): Promise<
204
- Array<{
205
- fileType: "image" | "video" | "others";
206
- fileUrl?: string;
207
- msgId?: string | number;
208
- fileId?: string;
209
- fileName?: string;
210
- }>
211
- >;
212
- sendVoice(
213
- options: {
214
- voiceUrl: string;
215
- ttl?: number;
216
- },
217
- threadId: string,
218
- type?: number,
219
- ): Promise<{ msgId?: string | number }>;
220
- sendLink(
221
- payload: { link: string; msg?: string },
222
- threadId: string,
223
- type?: number,
224
- ): Promise<{ msgId?: string | number }>;
225
- sendTypingEvent(threadId: string, type?: number, destType?: number): Promise<{ status: number }>;
226
- addReaction(
227
- icon: string | { rType: number; source: number; icon: string },
228
- dest: {
229
- data: {
230
- msgId: string;
231
- cliMsgId: string;
232
- };
233
- threadId: string;
234
- type: number;
235
- },
236
- ): Promise<unknown>;
237
- sendDeliveredEvent(
238
- isSeen: boolean,
239
- messages: DeliveryEventMessages,
240
- type?: number,
241
- ): Promise<unknown>;
242
- sendSeenEvent(messages: DeliveryEventMessages, type?: number): Promise<unknown>;
243
- };
244
-
245
- type ZaloCtor = new (options?: { logging?: boolean; selfListen?: boolean }) => {
246
- login(credentials: Credentials): Promise<API>;
247
- loginQR(
248
- options?: { userAgent?: string; language?: string; qrPath?: string },
249
- callback?: (event: LoginQRCallbackEvent) => unknown,
250
- ): Promise<API>;
251
- };
252
-
253
- export async function createZalo(
254
- options?: ConstructorParameters<ZaloCtor>[0],
255
- ): Promise<InstanceType<ZaloCtor>> {
256
- const zcaJs = await loadZcaJsRuntime();
257
- const Zalo = zcaJs.Zalo as ZaloCtor;
258
- return new Zalo(options);
259
- }
@@ -1,55 +0,0 @@
1
- export const ThreadType = {
2
- User: 0,
3
- Group: 1,
4
- } as const;
5
-
6
- export const LoginQRCallbackEventType = {
7
- QRCodeGenerated: 0,
8
- QRCodeExpired: 1,
9
- QRCodeScanned: 2,
10
- QRCodeDeclined: 3,
11
- GotLoginInfo: 4,
12
- } as const;
13
-
14
- export const Reactions = {
15
- HEART: "/-heart",
16
- LIKE: "/-strong",
17
- HAHA: ":>",
18
- WOW: ":o",
19
- CRY: ":-((",
20
- ANGRY: ":-h",
21
- NONE: "",
22
- } as const;
23
-
24
- // Mirror zca-js sendMessage style constants locally because the package root
25
- // typing surface does not consistently expose TextStyle/Style to tsgo.
26
- export const TextStyle = {
27
- Bold: "b",
28
- Italic: "i",
29
- Underline: "u",
30
- StrikeThrough: "s",
31
- Red: "c_db342e",
32
- Orange: "c_f27806",
33
- Yellow: "c_f7b503",
34
- Green: "c_15a85f",
35
- Small: "f_13",
36
- Big: "f_18",
37
- UnorderedList: "lst_1",
38
- OrderedList: "lst_2",
39
- Indent: "ind_$",
40
- } as const;
41
-
42
- type TextStyleValue = (typeof TextStyle)[keyof typeof TextStyle];
43
-
44
- export type Style =
45
- | {
46
- start: number;
47
- len: number;
48
- st: Exclude<TextStyleValue, typeof TextStyle.Indent>;
49
- }
50
- | {
51
- start: number;
52
- len: number;
53
- st: typeof TextStyle.Indent;
54
- indentSize?: number;
55
- };
@@ -1,22 +0,0 @@
1
- declare module "zca-js" {
2
- export const ThreadType: {
3
- User: number;
4
- Group: number;
5
- };
6
-
7
- export const LoginQRCallbackEventType: {
8
- QRCodeGenerated: number;
9
- QRCodeExpired: number;
10
- QRCodeScanned: number;
11
- QRCodeDeclined: number;
12
- GotLoginInfo: number;
13
- };
14
-
15
- export const Reactions: Record<string, string>;
16
-
17
- export class Zalo {
18
- constructor(options?: { logging?: boolean; selfListen?: boolean });
19
- login(credentials: unknown): Promise<unknown>;
20
- loginQR(options?: unknown, callback?: (event: unknown) => unknown): Promise<unknown>;
21
- }
22
- }
package/test-api.ts DELETED
@@ -1,21 +0,0 @@
1
- export { sendMessageZalouser } from "./src/send.js";
2
- export { parseZalouserOutboundTarget } from "./src/session-route.js";
3
- export {
4
- checkZcaAuthenticated,
5
- getZcaUserInfo,
6
- listZalouserAccountIds,
7
- resolveDefaultZalouserAccountId,
8
- resolveZalouserAccountSync,
9
- } from "./src/accounts.js";
10
- export {
11
- checkZaloAuthenticated,
12
- getZaloUserInfo,
13
- listZaloFriendsMatching,
14
- listZaloGroupMembers,
15
- listZaloGroupsMatching,
16
- logoutZaloProfile,
17
- resolveZaloAllowFromEntries,
18
- resolveZaloGroupsByEntries,
19
- startZaloQrLogin,
20
- waitForZaloQrLogin,
21
- } from "./src/zalo-js.js";
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
- }