@kodelyth/zalouser 2026.5.39 → 2026.5.42

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 (106) hide show
  1. package/README.md +120 -0
  2. package/api.ts +9 -0
  3. package/channel-plugin-api.ts +3 -0
  4. package/contract-api.ts +2 -0
  5. package/dist/accounts-DOefD_if.js +66 -0
  6. package/dist/accounts.runtime-KT101uuu.js +2 -0
  7. package/dist/api-DSWT4Dh_.js +133 -0
  8. package/dist/api.js +7 -0
  9. package/dist/channel-pby_3Sur.js +602 -0
  10. package/dist/channel-plugin-api.js +2 -0
  11. package/dist/channel.runtime-0aJ2O7Y8.js +25 -0
  12. package/dist/channel.setup-CqyWwqcQ.js +9 -0
  13. package/dist/contract-api.js +3 -0
  14. package/dist/doctor-contract-B9EvrW0j.js +128 -0
  15. package/dist/doctor-contract-api.js +2 -0
  16. package/dist/index.js +27 -0
  17. package/dist/monitor-CVtrUqyW.js +708 -0
  18. package/dist/runtime-api.js +19 -0
  19. package/dist/secret-contract-api.js +5 -0
  20. package/dist/security-audit-D_rftvs-.js +34 -0
  21. package/dist/send-uRjUB8mG.js +542 -0
  22. package/dist/session-route-CalHiv1d.js +92 -0
  23. package/dist/setup-entry.js +11 -0
  24. package/dist/setup-plugin-api.js +2 -0
  25. package/dist/setup-surface-Cfj4GQlB.js +360 -0
  26. package/dist/shared-DjK0e2FC.js +160 -0
  27. package/dist/test-api.js +5 -0
  28. package/dist/zalo-js-B80cRyDF.js +1285 -0
  29. package/doctor-contract-api.ts +1 -0
  30. package/index.ts +34 -0
  31. package/klaw.plugin.json +3 -286
  32. package/package.json +4 -4
  33. package/runtime-api.ts +62 -0
  34. package/secret-contract-api.ts +4 -0
  35. package/setup-entry.ts +9 -0
  36. package/setup-plugin-api.ts +2 -0
  37. package/src/accounts.runtime.ts +1 -0
  38. package/src/accounts.test-mocks.ts +14 -0
  39. package/src/accounts.test.ts +298 -0
  40. package/src/accounts.ts +136 -0
  41. package/src/channel-api.ts +16 -0
  42. package/src/channel.adapters.ts +432 -0
  43. package/src/channel.directory.test.ts +59 -0
  44. package/src/channel.runtime.ts +12 -0
  45. package/src/channel.sendpayload.test.ts +311 -0
  46. package/src/channel.setup.test.ts +30 -0
  47. package/src/channel.setup.ts +12 -0
  48. package/src/channel.test.ts +424 -0
  49. package/src/channel.ts +221 -0
  50. package/src/config-schema.ts +33 -0
  51. package/src/directory.ts +54 -0
  52. package/src/doctor-contract.ts +156 -0
  53. package/src/doctor.test.ts +87 -0
  54. package/src/doctor.ts +37 -0
  55. package/src/group-policy.test.ts +61 -0
  56. package/src/group-policy.ts +83 -0
  57. package/src/message-sid.test.ts +66 -0
  58. package/src/message-sid.ts +80 -0
  59. package/src/monitor.account-scope.test.ts +122 -0
  60. package/src/monitor.group-gating.test.ts +967 -0
  61. package/src/monitor.send-mocks.ts +20 -0
  62. package/src/monitor.ts +1057 -0
  63. package/src/probe.test.ts +60 -0
  64. package/src/probe.ts +35 -0
  65. package/src/qr-temp-file.ts +19 -0
  66. package/src/reaction.test.ts +19 -0
  67. package/src/reaction.ts +32 -0
  68. package/src/runtime.ts +9 -0
  69. package/src/security-audit.test.ts +83 -0
  70. package/src/security-audit.ts +71 -0
  71. package/src/send-receipt.ts +31 -0
  72. package/src/send.test.ts +424 -0
  73. package/src/send.ts +280 -0
  74. package/src/session-route.ts +121 -0
  75. package/src/setup-core.ts +36 -0
  76. package/src/setup-surface.test.ts +367 -0
  77. package/src/setup-surface.ts +481 -0
  78. package/src/setup-test-helpers.ts +42 -0
  79. package/src/shared.ts +92 -0
  80. package/src/status-issues.test.ts +31 -0
  81. package/src/status-issues.ts +55 -0
  82. package/src/test-helpers.ts +26 -0
  83. package/src/text-styles.test.ts +203 -0
  84. package/src/text-styles.ts +540 -0
  85. package/src/tool.test.ts +212 -0
  86. package/src/tool.ts +200 -0
  87. package/src/types.ts +127 -0
  88. package/src/zalo-js.credentials.test.ts +465 -0
  89. package/src/zalo-js.test-mocks.ts +89 -0
  90. package/src/zalo-js.ts +1889 -0
  91. package/src/zca-client.test.ts +27 -0
  92. package/src/zca-client.ts +259 -0
  93. package/src/zca-constants.ts +55 -0
  94. package/src/zca-js-exports.d.ts +22 -0
  95. package/test-api.ts +21 -0
  96. package/tsconfig.json +16 -0
  97. package/api.js +0 -7
  98. package/channel-plugin-api.js +0 -7
  99. package/contract-api.js +0 -7
  100. package/doctor-contract-api.js +0 -7
  101. package/index.js +0 -7
  102. package/runtime-api.js +0 -7
  103. package/secret-contract-api.js +0 -7
  104. package/setup-entry.js +0 -7
  105. package/setup-plugin-api.js +0 -7
  106. package/test-api.js +0 -7
@@ -0,0 +1 @@
1
+ export { normalizeCompatibilityConfig, legacyConfigRules } from "./src/doctor-contract.js";
package/index.ts ADDED
@@ -0,0 +1,34 @@
1
+ import {
2
+ type AnyAgentTool,
3
+ defineBundledChannelEntry,
4
+ loadBundledEntryExportSync,
5
+ } from "klaw/plugin-sdk/channel-entry-contract";
6
+
7
+ function createZalouserTool(context?: unknown): AnyAgentTool {
8
+ const createTool = loadBundledEntryExportSync<(context?: unknown) => AnyAgentTool>(
9
+ import.meta.url,
10
+ {
11
+ specifier: "./api.js",
12
+ exportName: "createZalouserTool",
13
+ },
14
+ );
15
+ return createTool(context);
16
+ }
17
+
18
+ export default defineBundledChannelEntry({
19
+ id: "zalouser",
20
+ name: "Zalo Personal",
21
+ description: "Zalo personal account messaging via native zca-js integration",
22
+ importMetaUrl: import.meta.url,
23
+ plugin: {
24
+ specifier: "./channel-plugin-api.js",
25
+ exportName: "zalouserPlugin",
26
+ },
27
+ runtime: {
28
+ specifier: "./runtime-api.js",
29
+ exportName: "setZalouserRuntime",
30
+ },
31
+ registerFull(api) {
32
+ api.registerTool((ctx) => createZalouserTool(ctx), { name: "zalouser" });
33
+ },
34
+ });
package/klaw.plugin.json CHANGED
@@ -3,299 +3,16 @@
3
3
  "activation": {
4
4
  "onStartup": false
5
5
  },
6
- "channels": [
7
- "zalouser"
8
- ],
6
+ "channels": ["zalouser"],
9
7
  "contracts": {
10
- "tools": [
11
- "zalouser"
12
- ]
8
+ "tools": ["zalouser"]
13
9
  },
14
10
  "channelEnvVars": {
15
- "zalouser": [
16
- "ZALOUSER_PROFILE",
17
- "ZCA_PROFILE"
18
- ]
11
+ "zalouser": ["ZALOUSER_PROFILE", "ZCA_PROFILE"]
19
12
  },
20
13
  "configSchema": {
21
14
  "type": "object",
22
15
  "additionalProperties": false,
23
16
  "properties": {}
24
- },
25
- "channelConfigs": {
26
- "zalouser": {
27
- "schema": {
28
- "$schema": "http://json-schema.org/draft-07/schema#",
29
- "type": "object",
30
- "properties": {
31
- "name": {
32
- "type": "string"
33
- },
34
- "enabled": {
35
- "type": "boolean"
36
- },
37
- "markdown": {
38
- "type": "object",
39
- "properties": {
40
- "tables": {
41
- "type": "string",
42
- "enum": [
43
- "off",
44
- "bullets",
45
- "code",
46
- "block"
47
- ]
48
- }
49
- },
50
- "additionalProperties": false
51
- },
52
- "profile": {
53
- "type": "string"
54
- },
55
- "dangerouslyAllowNameMatching": {
56
- "type": "boolean"
57
- },
58
- "dmPolicy": {
59
- "type": "string",
60
- "enum": [
61
- "pairing",
62
- "allowlist",
63
- "open",
64
- "disabled"
65
- ]
66
- },
67
- "allowFrom": {
68
- "type": "array",
69
- "items": {
70
- "anyOf": [
71
- {
72
- "type": "string"
73
- },
74
- {
75
- "type": "number"
76
- }
77
- ]
78
- }
79
- },
80
- "historyLimit": {
81
- "type": "integer",
82
- "minimum": 0,
83
- "maximum": 9007199254740991
84
- },
85
- "groupAllowFrom": {
86
- "type": "array",
87
- "items": {
88
- "anyOf": [
89
- {
90
- "type": "string"
91
- },
92
- {
93
- "type": "number"
94
- }
95
- ]
96
- }
97
- },
98
- "groupPolicy": {
99
- "default": "allowlist",
100
- "type": "string",
101
- "enum": [
102
- "open",
103
- "disabled",
104
- "allowlist"
105
- ]
106
- },
107
- "groups": {
108
- "type": "object",
109
- "properties": {},
110
- "additionalProperties": {
111
- "type": "object",
112
- "properties": {
113
- "enabled": {
114
- "type": "boolean"
115
- },
116
- "requireMention": {
117
- "type": "boolean"
118
- },
119
- "tools": {
120
- "type": "object",
121
- "properties": {
122
- "allow": {
123
- "type": "array",
124
- "items": {
125
- "type": "string"
126
- }
127
- },
128
- "alsoAllow": {
129
- "type": "array",
130
- "items": {
131
- "type": "string"
132
- }
133
- },
134
- "deny": {
135
- "type": "array",
136
- "items": {
137
- "type": "string"
138
- }
139
- }
140
- },
141
- "additionalProperties": false
142
- }
143
- },
144
- "additionalProperties": false
145
- }
146
- },
147
- "messagePrefix": {
148
- "type": "string"
149
- },
150
- "responsePrefix": {
151
- "type": "string"
152
- },
153
- "accounts": {
154
- "type": "object",
155
- "properties": {},
156
- "additionalProperties": {
157
- "type": "object",
158
- "properties": {
159
- "name": {
160
- "type": "string"
161
- },
162
- "enabled": {
163
- "type": "boolean"
164
- },
165
- "markdown": {
166
- "type": "object",
167
- "properties": {
168
- "tables": {
169
- "type": "string",
170
- "enum": [
171
- "off",
172
- "bullets",
173
- "code",
174
- "block"
175
- ]
176
- }
177
- },
178
- "additionalProperties": false
179
- },
180
- "profile": {
181
- "type": "string"
182
- },
183
- "dangerouslyAllowNameMatching": {
184
- "type": "boolean"
185
- },
186
- "dmPolicy": {
187
- "type": "string",
188
- "enum": [
189
- "pairing",
190
- "allowlist",
191
- "open",
192
- "disabled"
193
- ]
194
- },
195
- "allowFrom": {
196
- "type": "array",
197
- "items": {
198
- "anyOf": [
199
- {
200
- "type": "string"
201
- },
202
- {
203
- "type": "number"
204
- }
205
- ]
206
- }
207
- },
208
- "historyLimit": {
209
- "type": "integer",
210
- "minimum": 0,
211
- "maximum": 9007199254740991
212
- },
213
- "groupAllowFrom": {
214
- "type": "array",
215
- "items": {
216
- "anyOf": [
217
- {
218
- "type": "string"
219
- },
220
- {
221
- "type": "number"
222
- }
223
- ]
224
- }
225
- },
226
- "groupPolicy": {
227
- "default": "allowlist",
228
- "type": "string",
229
- "enum": [
230
- "open",
231
- "disabled",
232
- "allowlist"
233
- ]
234
- },
235
- "groups": {
236
- "type": "object",
237
- "properties": {},
238
- "additionalProperties": {
239
- "type": "object",
240
- "properties": {
241
- "enabled": {
242
- "type": "boolean"
243
- },
244
- "requireMention": {
245
- "type": "boolean"
246
- },
247
- "tools": {
248
- "type": "object",
249
- "properties": {
250
- "allow": {
251
- "type": "array",
252
- "items": {
253
- "type": "string"
254
- }
255
- },
256
- "alsoAllow": {
257
- "type": "array",
258
- "items": {
259
- "type": "string"
260
- }
261
- },
262
- "deny": {
263
- "type": "array",
264
- "items": {
265
- "type": "string"
266
- }
267
- }
268
- },
269
- "additionalProperties": false
270
- }
271
- },
272
- "additionalProperties": false
273
- }
274
- },
275
- "messagePrefix": {
276
- "type": "string"
277
- },
278
- "responsePrefix": {
279
- "type": "string"
280
- }
281
- },
282
- "required": [
283
- "groupPolicy"
284
- ],
285
- "additionalProperties": false
286
- }
287
- },
288
- "defaultAccount": {
289
- "type": "string"
290
- }
291
- },
292
- "required": [
293
- "groupPolicy"
294
- ],
295
- "additionalProperties": false
296
- },
297
- "label": "Zalo Personal",
298
- "description": "Zalo personal account via QR code login."
299
- }
300
17
  }
301
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kodelyth/zalouser",
3
- "version": "2026.5.39",
3
+ "version": "2026.5.42",
4
4
  "description": "Klaw Zalo Personal Account plugin via native zca-js integration",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "devDependencies": {
16
16
  "@kodelyth/plugin-sdk": "1.0.1",
17
- "@kodelyth/klaw": "2026.5.41"
17
+ "@kodelyth/klaw": "2026.5.42"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@kodelyth/klaw": ">=2026.5.19"
@@ -26,9 +26,9 @@
26
26
  },
27
27
  "klaw": {
28
28
  "extensions": [
29
- "./index.js"
29
+ "./index.ts"
30
30
  ],
31
- "setupEntry": "./setup-entry.js",
31
+ "setupEntry": "./setup-entry.ts",
32
32
  "channel": {
33
33
  "id": "zalouser",
34
34
  "label": "Zalo Personal",
package/runtime-api.ts ADDED
@@ -0,0 +1,62 @@
1
+ export {
2
+ collectZalouserSecurityAuditFindings,
3
+ createZalouserSetupWizardProxy,
4
+ createZalouserTool,
5
+ isZalouserMutableGroupEntry,
6
+ zalouserPlugin,
7
+ zalouserSetupAdapter,
8
+ zalouserSetupPlugin,
9
+ zalouserSetupWizard,
10
+ } from "./api.js";
11
+ export { setZalouserRuntime } from "./src/runtime.js";
12
+ export type { ReplyPayload } from "klaw/plugin-sdk/reply-runtime";
13
+ export type {
14
+ BaseProbeResult,
15
+ ChannelAccountSnapshot,
16
+ ChannelDirectoryEntry,
17
+ ChannelGroupContext,
18
+ ChannelMessageActionAdapter,
19
+ ChannelStatusIssue,
20
+ } from "klaw/plugin-sdk/channel-contract";
21
+ export type {
22
+ KlawConfig,
23
+ GroupToolPolicyConfig,
24
+ MarkdownTableMode,
25
+ } from "klaw/plugin-sdk/config-contracts";
26
+ export type {
27
+ PluginRuntime,
28
+ AnyAgentTool,
29
+ ChannelPlugin,
30
+ KlawPluginToolContext,
31
+ } from "klaw/plugin-sdk/core";
32
+ export type { RuntimeEnv } from "klaw/plugin-sdk/runtime";
33
+ export {
34
+ DEFAULT_ACCOUNT_ID,
35
+ buildChannelConfigSchema,
36
+ normalizeAccountId,
37
+ } from "klaw/plugin-sdk/core";
38
+ export { chunkTextForOutbound } from "klaw/plugin-sdk/text-chunking";
39
+ export { isDangerousNameMatchingEnabled } from "klaw/plugin-sdk/dangerous-name-runtime";
40
+ export {
41
+ resolveDefaultGroupPolicy,
42
+ resolveOpenProviderRuntimeGroupPolicy,
43
+ warnMissingProviderGroupPolicyFallbackOnce,
44
+ } from "klaw/plugin-sdk/runtime-group-policy";
45
+ export {
46
+ mergeAllowlist,
47
+ summarizeMapping,
48
+ formatAllowFromLowercase,
49
+ } from "klaw/plugin-sdk/allow-from";
50
+ export { resolveInboundMentionDecision } from "klaw/plugin-sdk/channel-inbound";
51
+ export { createChannelPairingController } from "klaw/plugin-sdk/channel-pairing";
52
+ export { createChannelMessageReplyPipeline } from "klaw/plugin-sdk/channel-message";
53
+ export { buildBaseAccountStatusSnapshot } from "klaw/plugin-sdk/status-helpers";
54
+ export { loadOutboundMediaFromUrl } from "klaw/plugin-sdk/outbound-media";
55
+ export {
56
+ deliverTextOrMediaReply,
57
+ isNumericTargetId,
58
+ resolveSendableOutboundReplyParts,
59
+ sendPayloadWithChunkedTextAndMedia,
60
+ type OutboundReplyPayload,
61
+ } from "klaw/plugin-sdk/reply-payload";
62
+ export { resolvePreferredKlawTmpDir } from "klaw/plugin-sdk/temp-path";
@@ -0,0 +1,4 @@
1
+ // Zalo User does not expose secret-contract surfaces.
2
+ export const secretTargetRegistryEntries: readonly [] = [];
3
+
4
+ export function collectRuntimeConfigAssignments(): void {}
package/setup-entry.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { defineBundledChannelSetupEntry } from "klaw/plugin-sdk/channel-entry-contract";
2
+
3
+ export default defineBundledChannelSetupEntry({
4
+ importMetaUrl: import.meta.url,
5
+ plugin: {
6
+ specifier: "./setup-plugin-api.js",
7
+ exportName: "zalouserSetupPlugin",
8
+ },
9
+ });
@@ -0,0 +1,2 @@
1
+ // Keep setup-entry imports narrow so setup loads do not pull tool surfaces.
2
+ export { zalouserSetupPlugin } from "./src/channel.setup.js";
@@ -0,0 +1 @@
1
+ export { checkZaloAuthenticated, getZaloUserInfo } from "./zalo-js.js";
@@ -0,0 +1,14 @@
1
+ import { vi } from "vitest";
2
+ import { createDefaultResolvedZalouserAccount } from "./test-helpers.js";
3
+
4
+ vi.mock("./accounts.js", () => {
5
+ return {
6
+ listZalouserAccountIds: () => ["default"],
7
+ resolveDefaultZalouserAccountId: () => "default",
8
+ resolveZalouserAccountSync: () => createDefaultResolvedZalouserAccount(),
9
+ resolveZalouserAccount: async () => createDefaultResolvedZalouserAccount(),
10
+ listEnabledZalouserAccounts: async () => [createDefaultResolvedZalouserAccount()],
11
+ getZcaUserInfo: async () => null,
12
+ checkZcaAuthenticated: async () => false,
13
+ };
14
+ });