@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
@@ -0,0 +1,106 @@
1
+ import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/text-runtime";
2
+ import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
3
+ //#region extensions/zalouser/src/group-policy.ts
4
+ function toGroupCandidate(value) {
5
+ return value?.trim() ?? "";
6
+ }
7
+ function normalizeZalouserGroupSlug(raw) {
8
+ const trimmed = normalizeOptionalLowercaseString(raw) ?? "";
9
+ if (!trimmed) return "";
10
+ return trimmed.replace(/^#/, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
11
+ }
12
+ function buildZalouserGroupCandidates(params) {
13
+ const seen = /* @__PURE__ */ new Set();
14
+ const out = [];
15
+ const push = (value) => {
16
+ const normalized = toGroupCandidate(value);
17
+ if (!normalized || seen.has(normalized)) return;
18
+ seen.add(normalized);
19
+ out.push(normalized);
20
+ };
21
+ const groupId = toGroupCandidate(params.groupId);
22
+ const groupChannel = toGroupCandidate(params.groupChannel);
23
+ const groupName = toGroupCandidate(params.groupName);
24
+ push(groupId);
25
+ if (params.includeGroupIdAlias === true && groupId) push(`group:${groupId}`);
26
+ if (params.allowNameMatching !== false) {
27
+ push(groupChannel);
28
+ push(groupName);
29
+ if (groupName) push(normalizeZalouserGroupSlug(groupName));
30
+ }
31
+ if (params.includeWildcard !== false) push("*");
32
+ return out;
33
+ }
34
+ function findZalouserGroupEntry(groups, candidates) {
35
+ if (!groups) return;
36
+ for (const candidate of candidates) {
37
+ const entry = groups[candidate];
38
+ if (entry) return entry;
39
+ }
40
+ }
41
+ function isZalouserGroupEntryAllowed(entry) {
42
+ if (!entry) return false;
43
+ return entry.allow !== false && entry.enabled !== false;
44
+ }
45
+ //#endregion
46
+ //#region extensions/zalouser/src/message-sid.ts
47
+ function toMessageSidPart(value) {
48
+ if (typeof value === "string") return value.trim();
49
+ if (typeof value === "number" && Number.isFinite(value)) return String(Math.trunc(value));
50
+ return "";
51
+ }
52
+ function parseZalouserMessageSidFull(value) {
53
+ const raw = toMessageSidPart(value);
54
+ if (!raw) return null;
55
+ const [msgIdPart, cliMsgIdPart] = raw.split(":").map((entry) => entry.trim());
56
+ if (!msgIdPart || !cliMsgIdPart) return null;
57
+ return {
58
+ msgId: msgIdPart,
59
+ cliMsgId: cliMsgIdPart
60
+ };
61
+ }
62
+ function resolveZalouserReactionMessageIds(params) {
63
+ const explicitMessageId = toMessageSidPart(params.messageId);
64
+ const explicitCliMsgId = toMessageSidPart(params.cliMsgId);
65
+ if (explicitMessageId && explicitCliMsgId) return {
66
+ msgId: explicitMessageId,
67
+ cliMsgId: explicitCliMsgId
68
+ };
69
+ const parsedFromCurrent = parseZalouserMessageSidFull(params.currentMessageId);
70
+ if (parsedFromCurrent) return parsedFromCurrent;
71
+ const currentRaw = toMessageSidPart(params.currentMessageId);
72
+ if (!currentRaw) return null;
73
+ if (explicitMessageId && !explicitCliMsgId) return {
74
+ msgId: explicitMessageId,
75
+ cliMsgId: currentRaw
76
+ };
77
+ if (!explicitMessageId && explicitCliMsgId) return {
78
+ msgId: currentRaw,
79
+ cliMsgId: explicitCliMsgId
80
+ };
81
+ return {
82
+ msgId: currentRaw,
83
+ cliMsgId: currentRaw
84
+ };
85
+ }
86
+ function formatZalouserMessageSidFull(params) {
87
+ const msgId = toMessageSidPart(params.msgId);
88
+ const cliMsgId = toMessageSidPart(params.cliMsgId);
89
+ if (!msgId && !cliMsgId) return;
90
+ if (msgId && cliMsgId) return `${msgId}:${cliMsgId}`;
91
+ return msgId || cliMsgId || void 0;
92
+ }
93
+ function resolveZalouserMessageSid(params) {
94
+ const msgId = toMessageSidPart(params.msgId);
95
+ const cliMsgId = toMessageSidPart(params.cliMsgId);
96
+ if (msgId || cliMsgId) return msgId || cliMsgId;
97
+ return toMessageSidPart(params.fallback) || void 0;
98
+ }
99
+ //#endregion
100
+ //#region extensions/zalouser/src/runtime.ts
101
+ const { setRuntime: setZalouserRuntime, getRuntime: getZalouserRuntime } = createPluginRuntimeStore({
102
+ pluginId: "zalouser",
103
+ errorMessage: "Zalouser runtime not initialized"
104
+ });
105
+ //#endregion
106
+ export { resolveZalouserReactionMessageIds as a, isZalouserGroupEntryAllowed as c, resolveZalouserMessageSid as i, setZalouserRuntime as n, buildZalouserGroupCandidates as o, formatZalouserMessageSidFull as r, findZalouserGroupEntry as s, getZalouserRuntime as t };
@@ -0,0 +1,22 @@
1
+ import { n as zalouserSetupWizard } from "./setup-surface-NCOuKu-l.js";
2
+ import { n as setZalouserRuntime } from "./runtime-QNU7vLgI.js";
3
+ import { n as zalouserSetupAdapter, t as createZalouserSetupWizardProxy } from "./setup-core-CqipqY98.js";
4
+ import { t as zalouserPlugin } from "./channel-ou_w_2j-.js";
5
+ import { n as isZalouserMutableGroupEntry, t as collectZalouserSecurityAuditFindings } from "./security-audit-BZLhil-V.js";
6
+ import { t as zalouserSetupPlugin } from "./channel.setup-CiDeBFrn.js";
7
+ import { t as createZalouserTool } from "./api-BRwdUWuS.js";
8
+ import { buildBaseAccountStatusSnapshot } from "openclaw/plugin-sdk/status-helpers";
9
+ import { formatAllowFromLowercase, mergeAllowlist, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
10
+ import { DEFAULT_ACCOUNT_ID, buildChannelConfigSchema, normalizeAccountId } from "openclaw/plugin-sdk/core";
11
+ import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
12
+ import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
13
+ import { deliverTextOrMediaReply, isNumericTargetId, resolveSendableOutboundReplyParts, sendPayloadWithChunkedTextAndMedia } from "openclaw/plugin-sdk/reply-payload";
14
+ import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pairing";
15
+ import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
16
+ import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
17
+ import { resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
18
+ import { resolveInboundMentionDecision } from "openclaw/plugin-sdk/channel-inbound";
19
+ import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline";
20
+ import { resolveSenderCommandAuthorization } from "openclaw/plugin-sdk/command-auth";
21
+ import { evaluateGroupRouteAccessForPolicy, resolveSenderScopedGroupPolicy } from "openclaw/plugin-sdk/group-access";
22
+ export { DEFAULT_ACCOUNT_ID, buildBaseAccountStatusSnapshot, buildChannelConfigSchema, chunkTextForOutbound, collectZalouserSecurityAuditFindings, createChannelPairingController, createChannelReplyPipeline, createZalouserSetupWizardProxy, createZalouserTool, deliverTextOrMediaReply, evaluateGroupRouteAccessForPolicy, formatAllowFromLowercase, isDangerousNameMatchingEnabled, isNumericTargetId, isZalouserMutableGroupEntry, loadOutboundMediaFromUrl, mergeAllowlist, normalizeAccountId, resolveDefaultGroupPolicy, resolveInboundMentionDecision, resolveOpenProviderRuntimeGroupPolicy, resolvePreferredOpenClawTmpDir, resolveSendableOutboundReplyParts, resolveSenderCommandAuthorization, resolveSenderScopedGroupPolicy, sendPayloadWithChunkedTextAndMedia, setZalouserRuntime, summarizeMapping, warnMissingProviderGroupPolicyFallbackOnce, zalouserPlugin, zalouserSetupAdapter, zalouserSetupPlugin, zalouserSetupWizard };
@@ -0,0 +1,5 @@
1
+ //#region extensions/zalouser/secret-contract-api.ts
2
+ const secretTargetRegistryEntries = [];
3
+ function collectRuntimeConfigAssignments() {}
4
+ //#endregion
5
+ export { collectRuntimeConfigAssignments, secretTargetRegistryEntries };
@@ -0,0 +1,34 @@
1
+ import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
2
+ //#region extensions/zalouser/src/security-audit.ts
3
+ function isZalouserMutableGroupEntry(raw) {
4
+ const text = raw.trim();
5
+ if (!text || text === "*") return false;
6
+ const normalized = text.replace(/^(zalouser|zlu):/i, "").replace(/^group:/i, "").trim();
7
+ if (!normalized) return false;
8
+ if (/^\d+$/.test(normalized)) return false;
9
+ return !/^g-\S+$/i.test(normalized);
10
+ }
11
+ function collectZalouserSecurityAuditFindings(params) {
12
+ const zalouserCfg = params.account.config ?? {};
13
+ const accountId = params.accountId?.trim() || params.account.accountId || "default";
14
+ const dangerousNameMatchingEnabled = isDangerousNameMatchingEnabled(zalouserCfg);
15
+ const zalouserPathPrefix = params.orderedAccountIds.length > 1 || params.hasExplicitAccountPath ? `channels.zalouser.accounts.${accountId}` : "channels.zalouser";
16
+ const mutableGroupEntries = /* @__PURE__ */ new Set();
17
+ const groups = zalouserCfg.groups;
18
+ if (groups && typeof groups === "object" && !Array.isArray(groups)) for (const key of Object.keys(groups)) {
19
+ if (!isZalouserMutableGroupEntry(key)) continue;
20
+ mutableGroupEntries.add(`${zalouserPathPrefix}.groups:${key}`);
21
+ }
22
+ if (mutableGroupEntries.size === 0) return [];
23
+ const examples = Array.from(mutableGroupEntries).slice(0, 5);
24
+ const more = mutableGroupEntries.size > examples.length ? ` (+${mutableGroupEntries.size - examples.length} more)` : "";
25
+ return [{
26
+ checkId: "channels.zalouser.groups.mutable_entries",
27
+ severity: dangerousNameMatchingEnabled ? "info" : "warn",
28
+ title: dangerousNameMatchingEnabled ? "Zalouser group routing uses break-glass name matching" : "Zalouser group routing contains mutable group entries",
29
+ detail: dangerousNameMatchingEnabled ? `Zalouser group-name routing is explicitly enabled via dangerouslyAllowNameMatching. This mutable-identity mode is operator-selected break-glass behavior and out-of-scope for vulnerability reports by itself. Found: ${examples.join(", ")}${more}.` : `Zalouser group auth is ID-only by default, so unresolved group-name or slug entries are ignored for auth and can drift from the intended trusted group. Found: ${examples.join(", ")}${more}.`,
30
+ remediation: dangerousNameMatchingEnabled ? "Prefer stable Zalo group IDs (for example group:<id> or provider-native g- ids), then disable dangerouslyAllowNameMatching." : "Prefer stable Zalo group IDs in channels.zalouser.groups, or explicitly opt in with dangerouslyAllowNameMatching=true if you accept mutable group-name matching."
31
+ }];
32
+ }
33
+ //#endregion
34
+ export { isZalouserMutableGroupEntry as n, collectZalouserSecurityAuditFindings as t };