@kodelyth/zalouser 2026.5.42 → 2026.6.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 (71) hide show
  1. package/klaw.plugin.json +286 -3
  2. package/package.json +19 -6
  3. package/api.ts +0 -9
  4. package/channel-plugin-api.ts +0 -3
  5. package/contract-api.ts +0 -2
  6. package/doctor-contract-api.ts +0 -1
  7. package/index.ts +0 -34
  8. package/runtime-api.ts +0 -62
  9. package/secret-contract-api.ts +0 -4
  10. package/setup-entry.ts +0 -9
  11. package/setup-plugin-api.ts +0 -2
  12. package/src/accounts.runtime.ts +0 -1
  13. package/src/accounts.test-mocks.ts +0 -14
  14. package/src/accounts.test.ts +0 -298
  15. package/src/accounts.ts +0 -136
  16. package/src/channel-api.ts +0 -16
  17. package/src/channel.adapters.ts +0 -432
  18. package/src/channel.directory.test.ts +0 -59
  19. package/src/channel.runtime.ts +0 -12
  20. package/src/channel.sendpayload.test.ts +0 -311
  21. package/src/channel.setup.test.ts +0 -30
  22. package/src/channel.setup.ts +0 -12
  23. package/src/channel.test.ts +0 -424
  24. package/src/channel.ts +0 -221
  25. package/src/config-schema.ts +0 -33
  26. package/src/directory.ts +0 -54
  27. package/src/doctor-contract.ts +0 -156
  28. package/src/doctor.test.ts +0 -87
  29. package/src/doctor.ts +0 -37
  30. package/src/group-policy.test.ts +0 -61
  31. package/src/group-policy.ts +0 -83
  32. package/src/message-sid.test.ts +0 -66
  33. package/src/message-sid.ts +0 -80
  34. package/src/monitor.account-scope.test.ts +0 -122
  35. package/src/monitor.group-gating.test.ts +0 -967
  36. package/src/monitor.send-mocks.ts +0 -20
  37. package/src/monitor.ts +0 -1057
  38. package/src/probe.test.ts +0 -60
  39. package/src/probe.ts +0 -35
  40. package/src/qr-temp-file.ts +0 -19
  41. package/src/reaction.test.ts +0 -19
  42. package/src/reaction.ts +0 -32
  43. package/src/runtime.ts +0 -9
  44. package/src/security-audit.test.ts +0 -83
  45. package/src/security-audit.ts +0 -71
  46. package/src/send-receipt.ts +0 -31
  47. package/src/send.test.ts +0 -424
  48. package/src/send.ts +0 -280
  49. package/src/session-route.ts +0 -121
  50. package/src/setup-core.ts +0 -36
  51. package/src/setup-surface.test.ts +0 -367
  52. package/src/setup-surface.ts +0 -481
  53. package/src/setup-test-helpers.ts +0 -42
  54. package/src/shared.ts +0 -92
  55. package/src/status-issues.test.ts +0 -31
  56. package/src/status-issues.ts +0 -55
  57. package/src/test-helpers.ts +0 -26
  58. package/src/text-styles.test.ts +0 -203
  59. package/src/text-styles.ts +0 -540
  60. package/src/tool.test.ts +0 -212
  61. package/src/tool.ts +0 -200
  62. package/src/types.ts +0 -127
  63. package/src/zalo-js.credentials.test.ts +0 -465
  64. package/src/zalo-js.test-mocks.ts +0 -89
  65. package/src/zalo-js.ts +0 -1889
  66. package/src/zca-client.test.ts +0 -27
  67. package/src/zca-client.ts +0 -259
  68. package/src/zca-constants.ts +0 -55
  69. package/src/zca-js-exports.d.ts +0 -22
  70. package/test-api.ts +0 -21
  71. package/tsconfig.json +0 -16
package/klaw.plugin.json CHANGED
@@ -3,16 +3,299 @@
3
3
  "activation": {
4
4
  "onStartup": false
5
5
  },
6
- "channels": ["zalouser"],
6
+ "channels": [
7
+ "zalouser"
8
+ ],
7
9
  "contracts": {
8
- "tools": ["zalouser"]
10
+ "tools": [
11
+ "zalouser"
12
+ ]
9
13
  },
10
14
  "channelEnvVars": {
11
- "zalouser": ["ZALOUSER_PROFILE", "ZCA_PROFILE"]
15
+ "zalouser": [
16
+ "ZALOUSER_PROFILE",
17
+ "ZCA_PROFILE"
18
+ ]
12
19
  },
13
20
  "configSchema": {
14
21
  "type": "object",
15
22
  "additionalProperties": false,
16
23
  "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
+ }
17
300
  }
18
301
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kodelyth/zalouser",
3
- "version": "2026.5.42",
3
+ "version": "2026.6.2",
4
4
  "description": "Klaw Zalo Personal Account plugin via native zca-js integration",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,15 +13,19 @@
13
13
  "zod": "4.4.3"
14
14
  },
15
15
  "devDependencies": {
16
- "@kodelyth/plugin-sdk": "1.0.1",
17
- "@kodelyth/klaw": "2026.5.42"
16
+ "@kodelyth/plugin-sdk": "workspace:*",
17
+ "@kodelyth/klaw": "workspace:*"
18
18
  },
19
19
  "peerDependencies": {
20
- "@kodelyth/klaw": ">=2026.5.19"
20
+ "@kodelyth/klaw": ">=2026.5.19",
21
+ "klaw": ">=2026.5.39"
21
22
  },
22
23
  "peerDependenciesMeta": {
23
24
  "@kodelyth/klaw": {
24
25
  "optional": true
26
+ },
27
+ "klaw": {
28
+ "optional": true
25
29
  }
26
30
  },
27
31
  "klaw": {
@@ -62,6 +66,15 @@
62
66
  "release": {
63
67
  "publishToClawHub": true,
64
68
  "publishToNpm": true
65
- }
66
- }
69
+ },
70
+ "runtimeExtensions": [
71
+ "./dist/index.js"
72
+ ],
73
+ "runtimeSetupEntry": "./dist/setup-entry.js"
74
+ },
75
+ "files": [
76
+ "dist/**",
77
+ "klaw.plugin.json",
78
+ "README.md"
79
+ ]
67
80
  }
package/api.ts DELETED
@@ -1,9 +0,0 @@
1
- export { zalouserPlugin } from "./src/channel.js";
2
- export { zalouserSetupPlugin } from "./src/channel.setup.js";
3
- export { createZalouserTool } from "./src/tool.js";
4
- export { createZalouserSetupWizardProxy, zalouserSetupAdapter } from "./src/setup-core.js";
5
- export { zalouserSetupWizard } from "./src/setup-surface.js";
6
- export {
7
- collectZalouserSecurityAuditFindings,
8
- isZalouserMutableGroupEntry,
9
- } from "./src/security-audit.js";
@@ -1,3 +0,0 @@
1
- // Keep bundled channel entry imports narrow so bootstrap/discovery paths do
2
- // not drag setup-only or tool runtime surfaces into lightweight plugin loads.
3
- export { zalouserPlugin } from "./src/channel.js";
package/contract-api.ts DELETED
@@ -1,2 +0,0 @@
1
- export { collectZalouserSecurityAuditFindings } from "./src/security-audit.js";
2
- export { legacyConfigRules, normalizeCompatibilityConfig } from "./src/doctor-contract.js";
@@ -1 +0,0 @@
1
- export { normalizeCompatibilityConfig, legacyConfigRules } from "./src/doctor-contract.js";
package/index.ts DELETED
@@ -1,34 +0,0 @@
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/runtime-api.ts DELETED
@@ -1,62 +0,0 @@
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";
@@ -1,4 +0,0 @@
1
- // Zalo User does not expose secret-contract surfaces.
2
- export const secretTargetRegistryEntries: readonly [] = [];
3
-
4
- export function collectRuntimeConfigAssignments(): void {}
package/setup-entry.ts DELETED
@@ -1,9 +0,0 @@
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
- });
@@ -1,2 +0,0 @@
1
- // Keep setup-entry imports narrow so setup loads do not pull tool surfaces.
2
- export { zalouserSetupPlugin } from "./src/channel.setup.js";
@@ -1 +0,0 @@
1
- export { checkZaloAuthenticated, getZaloUserInfo } from "./zalo-js.js";
@@ -1,14 +0,0 @@
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
- });