@openclaw/zalouser 2026.5.14-beta.1 → 2026.5.16-beta.1

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.
@@ -3,7 +3,7 @@ import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runti
3
3
  //#region extensions/zalouser/src/accounts.ts
4
4
  let zalouserAccountsRuntimePromise;
5
5
  async function loadZalouserAccountsRuntime() {
6
- zalouserAccountsRuntimePromise ??= import("./accounts.runtime-B4Mw_Xgv.js");
6
+ zalouserAccountsRuntimePromise ??= import("./accounts.runtime-BtpFX7w7.js");
7
7
  return await zalouserAccountsRuntimePromise;
8
8
  }
9
9
  const { listAccountIds: listZalouserAccountIds, resolveDefaultAccountId: resolveDefaultZalouserAccountId } = createAccountListHelpers("zalouser");
@@ -1,2 +1,2 @@
1
- import { n as getZaloUserInfo, t as checkZaloAuthenticated } from "./zalo-js-KeIEcTqZ.js";
1
+ import { n as getZaloUserInfo, t as checkZaloAuthenticated } from "./zalo-js-QSY2SsUF.js";
2
2
  export { checkZaloAuthenticated, getZaloUserInfo };
@@ -1,11 +1,11 @@
1
- import "./setup-surface-Cz9-SO_8.js";
2
- import "./setup-core-CqipqY98.js";
3
- import { r as parseZalouserOutboundTarget } from "./session-route-81QGCeV2.js";
4
- import "./channel-D4jRkVKJ.js";
5
- import "./security-audit-BZLhil-V.js";
6
- import { i as listZaloFriendsMatching, n as getZaloUserInfo, s as listZaloGroupsMatching, t as checkZaloAuthenticated } from "./zalo-js-KeIEcTqZ.js";
7
- import "./channel.setup-Bfi-3_EI.js";
8
- import { i as sendMessageZalouser, n as sendImageZalouser, r as sendLinkZalouser } from "./send-CH7XlJaj.js";
1
+ import "./setup-surface-BOEnAElK.js";
2
+ import "./shared-BZ67dMHg.js";
3
+ import "./channel-ChrMP7B9.js";
4
+ import { r as parseZalouserOutboundTarget } from "./session-route-DWMin5CB.js";
5
+ import "./security-audit-DUQOetcM.js";
6
+ import { i as listZaloFriendsMatching, n as getZaloUserInfo, s as listZaloGroupsMatching, t as checkZaloAuthenticated } from "./zalo-js-QSY2SsUF.js";
7
+ import "./channel.setup-q1_Y8eHR.js";
8
+ import { i as sendMessageZalouser, n as sendImageZalouser, r as sendLinkZalouser } from "./send-SPumHuhS.js";
9
9
  import { stringEnum } from "openclaw/plugin-sdk/channel-actions";
10
10
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
11
11
  import { Type } from "typebox";
package/dist/api.js CHANGED
@@ -1,7 +1,7 @@
1
- import { n as zalouserSetupWizard } from "./setup-surface-Cz9-SO_8.js";
2
- import { n as zalouserSetupAdapter, t as createZalouserSetupWizardProxy } from "./setup-core-CqipqY98.js";
3
- import { t as zalouserPlugin } from "./channel-D4jRkVKJ.js";
4
- import { n as isZalouserMutableGroupEntry, t as collectZalouserSecurityAuditFindings } from "./security-audit-BZLhil-V.js";
5
- import { t as zalouserSetupPlugin } from "./channel.setup-Bfi-3_EI.js";
6
- import { t as createZalouserTool } from "./api-CaGurb-M.js";
1
+ import { n as zalouserSetupWizard } from "./setup-surface-BOEnAElK.js";
2
+ import { n as createZalouserSetupWizardProxy, r as zalouserSetupAdapter } from "./shared-BZ67dMHg.js";
3
+ import { t as zalouserPlugin } from "./channel-ChrMP7B9.js";
4
+ import { n as isZalouserMutableGroupEntry, t as collectZalouserSecurityAuditFindings } from "./security-audit-DUQOetcM.js";
5
+ import { t as zalouserSetupPlugin } from "./channel.setup-q1_Y8eHR.js";
6
+ import { t as createZalouserTool } from "./api-Cn_gTKvR.js";
7
7
  export { collectZalouserSecurityAuditFindings, createZalouserSetupWizardProxy, createZalouserTool, isZalouserMutableGroupEntry, zalouserPlugin, zalouserSetupAdapter, zalouserSetupPlugin, zalouserSetupWizard };
@@ -1,21 +1,123 @@
1
- import { a as resolveZalouserAccountSync, i as resolveDefaultZalouserAccountId, r as listZalouserAccountIds, t as checkZcaAuthenticated } from "./accounts-iV_px99V.js";
2
- import { a as isNumericTargetId, i as isDangerousNameMatchingEnabled, n as DEFAULT_ACCOUNT_ID, o as normalizeAccountId, r as chunkTextForOutbound, s as sendPayloadWithChunkedTextAndMedia, t as createZalouserPluginBase } from "./shared-BwUAKszU.js";
3
- import { a as resolveZalouserReactionMessageIds, o as buildZalouserGroupCandidates, s as findZalouserGroupEntry, t as getZalouserRuntime } from "./runtime-nbWip_ng.js";
4
- import { n as zalouserSetupAdapter, r as writeQrDataUrlToTempFile, t as createZalouserSetupWizardProxy } from "./setup-core-CqipqY98.js";
5
- import { i as resolveZalouserOutboundSessionRoute, n as parseZalouserDirectoryGroupId, r as parseZalouserOutboundTarget, t as normalizeZalouserTarget } from "./session-route-81QGCeV2.js";
1
+ import { a as resolveZalouserAccountSync, i as resolveDefaultZalouserAccountId, r as listZalouserAccountIds, t as checkZcaAuthenticated } from "./accounts-CTecjIqR.js";
2
+ import { a as DEFAULT_ACCOUNT_ID, c as isNumericTargetId, i as writeQrDataUrlToTempFile, l as normalizeAccountId, n as createZalouserSetupWizardProxy, o as chunkTextForOutbound, r as zalouserSetupAdapter, s as isDangerousNameMatchingEnabled, t as createZalouserPluginBase, u as sendPayloadWithChunkedTextAndMedia } from "./shared-BZ67dMHg.js";
3
+ import { i as resolveZalouserOutboundSessionRoute, n as parseZalouserDirectoryGroupId, r as parseZalouserOutboundTarget, t as normalizeZalouserTarget } from "./session-route-DWMin5CB.js";
6
4
  import { createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
7
5
  import { createAccountStatusSink } from "openclaw/plugin-sdk/channel-lifecycle";
8
6
  import { buildPassiveProbedChannelStatusSummary, coerceStatusIssueAccountId, readStatusIssueFields } from "openclaw/plugin-sdk/extension-shared";
9
7
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
10
8
  import { createAsyncComputedAccountStatusAdapter, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
11
- import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
9
+ import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
12
10
  import { createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers";
13
11
  import { defineChannelMessageAdapter } from "openclaw/plugin-sdk/channel-message";
14
12
  import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing";
15
13
  import { createEmptyChannelResult, createRawChannelSendResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
16
14
  import { createStaticReplyToModeResolver } from "openclaw/plugin-sdk/conversation-runtime";
15
+ import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
16
+ //#region extensions/zalouser/src/group-policy.ts
17
+ function toGroupCandidate(value) {
18
+ return value?.trim() ?? "";
19
+ }
20
+ function normalizeZalouserGroupSlug(raw) {
21
+ const trimmed = normalizeOptionalLowercaseString(raw) ?? "";
22
+ if (!trimmed) return "";
23
+ return trimmed.replace(/^#/, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
24
+ }
25
+ function buildZalouserGroupCandidates(params) {
26
+ const seen = /* @__PURE__ */ new Set();
27
+ const out = [];
28
+ const push = (value) => {
29
+ const normalized = toGroupCandidate(value);
30
+ if (!normalized || seen.has(normalized)) return;
31
+ seen.add(normalized);
32
+ out.push(normalized);
33
+ };
34
+ const groupId = toGroupCandidate(params.groupId);
35
+ const groupChannel = toGroupCandidate(params.groupChannel);
36
+ const groupName = toGroupCandidate(params.groupName);
37
+ push(groupId);
38
+ if (params.includeGroupIdAlias === true && groupId) push(`group:${groupId}`);
39
+ if (params.allowNameMatching !== false) {
40
+ push(groupChannel);
41
+ push(groupName);
42
+ if (groupName) push(normalizeZalouserGroupSlug(groupName));
43
+ }
44
+ if (params.includeWildcard !== false) push("*");
45
+ return out;
46
+ }
47
+ function findZalouserGroupEntry(groups, candidates) {
48
+ if (!groups) return;
49
+ for (const candidate of candidates) {
50
+ const entry = groups[candidate];
51
+ if (entry) return entry;
52
+ }
53
+ }
54
+ function isZalouserGroupEntryAllowed(entry) {
55
+ if (!entry) return false;
56
+ return entry.allow !== false && entry.enabled !== false;
57
+ }
58
+ //#endregion
59
+ //#region extensions/zalouser/src/message-sid.ts
60
+ function toMessageSidPart(value) {
61
+ if (typeof value === "string") return value.trim();
62
+ if (typeof value === "number" && Number.isFinite(value)) return String(Math.trunc(value));
63
+ return "";
64
+ }
65
+ function parseZalouserMessageSidFull(value) {
66
+ const raw = toMessageSidPart(value);
67
+ if (!raw) return null;
68
+ const [msgIdPart, cliMsgIdPart] = raw.split(":").map((entry) => entry.trim());
69
+ if (!msgIdPart || !cliMsgIdPart) return null;
70
+ return {
71
+ msgId: msgIdPart,
72
+ cliMsgId: cliMsgIdPart
73
+ };
74
+ }
75
+ function resolveZalouserReactionMessageIds(params) {
76
+ const explicitMessageId = toMessageSidPart(params.messageId);
77
+ const explicitCliMsgId = toMessageSidPart(params.cliMsgId);
78
+ if (explicitMessageId && explicitCliMsgId) return {
79
+ msgId: explicitMessageId,
80
+ cliMsgId: explicitCliMsgId
81
+ };
82
+ const parsedFromCurrent = parseZalouserMessageSidFull(params.currentMessageId);
83
+ if (parsedFromCurrent) return parsedFromCurrent;
84
+ const currentRaw = toMessageSidPart(params.currentMessageId);
85
+ if (!currentRaw) return null;
86
+ if (explicitMessageId && !explicitCliMsgId) return {
87
+ msgId: explicitMessageId,
88
+ cliMsgId: currentRaw
89
+ };
90
+ if (!explicitMessageId && explicitCliMsgId) return {
91
+ msgId: currentRaw,
92
+ cliMsgId: explicitCliMsgId
93
+ };
94
+ return {
95
+ msgId: currentRaw,
96
+ cliMsgId: currentRaw
97
+ };
98
+ }
99
+ function formatZalouserMessageSidFull(params) {
100
+ const msgId = toMessageSidPart(params.msgId);
101
+ const cliMsgId = toMessageSidPart(params.cliMsgId);
102
+ if (!msgId && !cliMsgId) return;
103
+ if (msgId && cliMsgId) return `${msgId}:${cliMsgId}`;
104
+ return msgId || cliMsgId || void 0;
105
+ }
106
+ function resolveZalouserMessageSid(params) {
107
+ const msgId = toMessageSidPart(params.msgId);
108
+ const cliMsgId = toMessageSidPart(params.cliMsgId);
109
+ if (msgId || cliMsgId) return msgId || cliMsgId;
110
+ return toMessageSidPart(params.fallback) || void 0;
111
+ }
112
+ //#endregion
113
+ //#region extensions/zalouser/src/runtime.ts
114
+ const { setRuntime: setZalouserRuntime, getRuntime: getZalouserRuntime } = createPluginRuntimeStore({
115
+ pluginId: "zalouser",
116
+ errorMessage: "Zalouser runtime not initialized"
117
+ });
118
+ //#endregion
17
119
  //#region extensions/zalouser/src/channel.adapters.ts
18
- const loadZalouserChannelRuntime$1 = createLazyRuntimeModule(() => import("./channel.runtime-DKtPzBr_.js"));
120
+ const loadZalouserChannelRuntime$1 = createLazyRuntimeModule(() => import("./channel.runtime-oMRJXO6B.js"));
19
121
  const ZALOUSER_TEXT_CHUNK_LIMIT = 2e3;
20
122
  function resolveZalouserQrProfile(accountId) {
21
123
  const normalized = normalizeAccountId(accountId);
@@ -346,8 +448,8 @@ function collectZalouserStatusIssues(accounts) {
346
448
  }
347
449
  //#endregion
348
450
  //#region extensions/zalouser/src/channel.ts
349
- const loadZalouserChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-DKtPzBr_.js"));
350
- const zalouserSetupWizardProxy = createZalouserSetupWizardProxy(async () => (await import("./setup-surface-Cz9-SO_8.js").then((n) => n.t)).zalouserSetupWizard);
451
+ const loadZalouserChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-oMRJXO6B.js"));
452
+ const zalouserSetupWizardProxy = createZalouserSetupWizardProxy(async () => (await import("./setup-surface-BOEnAElK.js").then((n) => n.t)).zalouserSetupWizard);
351
453
  function mapUser(params) {
352
454
  return {
353
455
  kind: "user",
@@ -464,7 +566,7 @@ const zalouserPlugin = createChatChannelPlugin({
464
566
  setStatus: ctx.setStatus
465
567
  });
466
568
  ctx.log?.info(`[${account.accountId}] starting zalouser provider${userLabel}`);
467
- const { monitorZalouserProvider } = await import("./monitor-j5lov4Dd.js");
569
+ const { monitorZalouserProvider } = await import("./monitor-CZ3mU8vM.js");
468
570
  return monitorZalouserProvider({
469
571
  account,
470
572
  config: ctx.cfg,
@@ -497,4 +599,4 @@ const zalouserPlugin = createChatChannelPlugin({
497
599
  outbound: zalouserOutboundAdapter
498
600
  });
499
601
  //#endregion
500
- export { zalouserPlugin as t };
602
+ export { resolveZalouserMessageSid as a, isZalouserGroupEntryAllowed as c, formatZalouserMessageSidFull as i, getZalouserRuntime as n, buildZalouserGroupCandidates as o, setZalouserRuntime as r, findZalouserGroupEntry as s, zalouserPlugin as t };
@@ -1,2 +1,2 @@
1
- import { t as zalouserPlugin } from "./channel-D4jRkVKJ.js";
1
+ import { t as zalouserPlugin } from "./channel-ChrMP7B9.js";
2
2
  export { zalouserPlugin };
@@ -1,6 +1,6 @@
1
- import { t as collectZalouserSecurityAuditFindings } from "./security-audit-BZLhil-V.js";
2
- import { a as listZaloGroupMembers, b as waitForZaloQrLogin, c as logoutZaloProfile, i as listZaloFriendsMatching, n as getZaloUserInfo, s as listZaloGroupsMatching, y as startZaloQrLogin } from "./zalo-js-KeIEcTqZ.js";
3
- import { a as sendReactionZalouser, i as sendMessageZalouser } from "./send-CH7XlJaj.js";
1
+ import { t as collectZalouserSecurityAuditFindings } from "./security-audit-DUQOetcM.js";
2
+ import { a as listZaloGroupMembers, b as waitForZaloQrLogin, c as logoutZaloProfile, i as listZaloFriendsMatching, n as getZaloUserInfo, s as listZaloGroupsMatching, y as startZaloQrLogin } from "./zalo-js-QSY2SsUF.js";
3
+ import { a as sendReactionZalouser, i as sendMessageZalouser } from "./send-SPumHuhS.js";
4
4
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
5
5
  //#region extensions/zalouser/src/probe.ts
6
6
  async function probeZalouser(profile, timeoutMs) {
@@ -1,6 +1,5 @@
1
- import { n as zalouserSetupWizard } from "./setup-surface-Cz9-SO_8.js";
2
- import { t as createZalouserPluginBase } from "./shared-BwUAKszU.js";
3
- import { n as zalouserSetupAdapter } from "./setup-core-CqipqY98.js";
1
+ import { n as zalouserSetupWizard } from "./setup-surface-BOEnAElK.js";
2
+ import { r as zalouserSetupAdapter, t as createZalouserPluginBase } from "./shared-BZ67dMHg.js";
4
3
  //#region extensions/zalouser/src/channel.setup.ts
5
4
  const zalouserSetupPlugin = { ...createZalouserPluginBase({
6
5
  setupWizard: zalouserSetupWizard,
@@ -1,3 +1,3 @@
1
- import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-DgqHp8E2.js";
2
- import { t as collectZalouserSecurityAuditFindings } from "./security-audit-BZLhil-V.js";
1
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-BIY2IHB_.js";
2
+ import { t as collectZalouserSecurityAuditFindings } from "./security-audit-DUQOetcM.js";
3
3
  export { collectZalouserSecurityAuditFindings, legacyConfigRules, normalizeCompatibilityConfig };
@@ -1,2 +1,2 @@
1
- import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-DgqHp8E2.js";
1
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-BIY2IHB_.js";
2
2
  export { legacyConfigRules, normalizeCompatibilityConfig };
@@ -1,6 +1,6 @@
1
- import { c as isZalouserGroupEntryAllowed, i as resolveZalouserMessageSid, o as buildZalouserGroupCandidates, r as formatZalouserMessageSidFull, s as findZalouserGroupEntry, t as getZalouserRuntime } from "./runtime-nbWip_ng.js";
2
- import { o as listZaloGroups, r as listZaloFriends, u as resolveZaloGroupContext, v as startZaloListener } from "./zalo-js-KeIEcTqZ.js";
3
- import { i as sendMessageZalouser, o as sendSeenZalouser, s as sendTypingZalouser, t as sendDeliveredZalouser } from "./send-CH7XlJaj.js";
1
+ import { a as resolveZalouserMessageSid, c as isZalouserGroupEntryAllowed, i as formatZalouserMessageSidFull, n as getZalouserRuntime, o as buildZalouserGroupCandidates, s as findZalouserGroupEntry } from "./channel-ChrMP7B9.js";
2
+ import { o as listZaloGroups, r as listZaloFriends, u as resolveZaloGroupContext, v as startZaloListener } from "./zalo-js-QSY2SsUF.js";
3
+ import { i as sendMessageZalouser, o as sendSeenZalouser, s as sendTypingZalouser, t as sendDeliveredZalouser } from "./send-SPumHuhS.js";
4
4
  import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
5
5
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
6
6
  import { mergeAllowlist, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
@@ -11,7 +11,7 @@ import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pair
11
11
  import { resolveDefaultGroupPolicy, resolveOpenProviderRuntimeGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/runtime-group-policy";
12
12
  import { implicitMentionKindWhen, resolveInboundMentionDecision } from "openclaw/plugin-sdk/channel-inbound";
13
13
  import { resolveStableChannelMessageIngress } from "openclaw/plugin-sdk/channel-ingress-runtime";
14
- import { DEFAULT_GROUP_HISTORY_LIMIT, buildPendingHistoryContextFromMap, clearHistoryEntriesIfEnabled, recordPendingHistoryEntryIfEnabled } from "openclaw/plugin-sdk/reply-history";
14
+ import { DEFAULT_GROUP_HISTORY_LIMIT, createChannelHistoryWindow } from "openclaw/plugin-sdk/reply-history";
15
15
  //#region extensions/zalouser/src/monitor.ts
16
16
  const ZALOUSER_TEXT_LIMIT = 2e3;
17
17
  function buildNameIndex(items, nameFn) {
@@ -296,6 +296,7 @@ async function processMessage(message, account, config, core, runtime, historySt
296
296
  }
297
297
  });
298
298
  const historyKey = isGroup ? route.sessionKey : void 0;
299
+ const channelHistory = createChannelHistoryWindow({ historyMap: historyState.groupHistories });
299
300
  const requireMention = isGroup ? resolveGroupRequireMention({
300
301
  groupId: chatId,
301
302
  groupName,
@@ -337,8 +338,7 @@ async function processMessage(message, account, config, core, runtime, historySt
337
338
  return;
338
339
  }
339
340
  if (isGroup && mentionDecision.shouldSkip) {
340
- recordPendingHistoryEntryIfEnabled({
341
- historyMap: historyState.groupHistories,
341
+ channelHistory.record({
342
342
  historyKey: historyKey ?? "",
343
343
  limit: historyState.historyLimit,
344
344
  entry: historyKey && rawBody ? {
@@ -378,8 +378,7 @@ async function processMessage(message, account, config, core, runtime, historySt
378
378
  envelope: envelopeOptions,
379
379
  body: rawBody
380
380
  });
381
- const combinedBody = isGroup && historyKey ? buildPendingHistoryContextFromMap({
382
- historyMap: historyState.groupHistories,
381
+ const combinedBody = isGroup && historyKey ? channelHistory.buildPendingContext({
383
382
  historyKey,
384
383
  limit: historyState.historyLimit,
385
384
  currentMessage: body,
@@ -391,11 +390,10 @@ async function processMessage(message, account, config, core, runtime, historySt
391
390
  body: `${entry.sender}: ${entry.body}${entry.messageId ? ` [id:${entry.messageId}]` : ""}`
392
391
  })
393
392
  }) : body;
394
- const inboundHistory = isGroup && historyKey && historyState.historyLimit > 0 ? (historyState.groupHistories.get(historyKey) ?? []).map((entry) => ({
395
- sender: entry.sender,
396
- body: entry.body,
397
- timestamp: entry.timestamp
398
- })) : void 0;
393
+ const inboundHistory = isGroup && historyKey && historyState.historyLimit > 0 ? channelHistory.buildInboundHistory({
394
+ historyKey,
395
+ limit: historyState.historyLimit
396
+ }) : void 0;
399
397
  const normalizedTo = isGroup ? `zalouser:group:${chatId}` : `zalouser:${chatId}`;
400
398
  const messageSid = resolveZalouserMessageSid({
401
399
  msgId: message.msgId,
@@ -512,8 +510,7 @@ async function processMessage(message, account, config, core, runtime, historySt
512
510
  runtime.error?.(`zalouser: failed updating session meta: ${String(err)}`);
513
511
  } }
514
512
  });
515
- if (isGroup && historyKey) clearHistoryEntriesIfEnabled({
516
- historyMap: historyState.groupHistories,
513
+ if (isGroup && historyKey) channelHistory.clear({
517
514
  historyKey,
518
515
  limit: historyState.historyLimit
519
516
  });
@@ -1,10 +1,9 @@
1
- import { n as zalouserSetupWizard } from "./setup-surface-Cz9-SO_8.js";
2
- import { n as setZalouserRuntime } from "./runtime-nbWip_ng.js";
3
- import { n as zalouserSetupAdapter, t as createZalouserSetupWizardProxy } from "./setup-core-CqipqY98.js";
4
- import { t as zalouserPlugin } from "./channel-D4jRkVKJ.js";
5
- import { n as isZalouserMutableGroupEntry, t as collectZalouserSecurityAuditFindings } from "./security-audit-BZLhil-V.js";
6
- import { t as zalouserSetupPlugin } from "./channel.setup-Bfi-3_EI.js";
7
- import { t as createZalouserTool } from "./api-CaGurb-M.js";
1
+ import { n as zalouserSetupWizard } from "./setup-surface-BOEnAElK.js";
2
+ import { n as createZalouserSetupWizardProxy, r as zalouserSetupAdapter } from "./shared-BZ67dMHg.js";
3
+ import { r as setZalouserRuntime, t as zalouserPlugin } from "./channel-ChrMP7B9.js";
4
+ import { n as isZalouserMutableGroupEntry, t as collectZalouserSecurityAuditFindings } from "./security-audit-DUQOetcM.js";
5
+ import { t as zalouserSetupPlugin } from "./channel.setup-q1_Y8eHR.js";
6
+ import { t as createZalouserTool } from "./api-Cn_gTKvR.js";
8
7
  import { buildBaseAccountStatusSnapshot } from "openclaw/plugin-sdk/status-helpers";
9
8
  import { formatAllowFromLowercase, mergeAllowlist, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
10
9
  import { DEFAULT_ACCOUNT_ID, buildChannelConfigSchema, normalizeAccountId } from "openclaw/plugin-sdk/core";
@@ -1,4 +1,4 @@
1
- import { S as TextStyle, _ as sendZaloTypingEvent, f as sendZaloDeliveredEvent, g as sendZaloTextMessage, h as sendZaloSeenEvent, m as sendZaloReaction, p as sendZaloLink, x as createZalouserSendReceipt } from "./zalo-js-KeIEcTqZ.js";
1
+ import { S as TextStyle, _ as sendZaloTypingEvent, f as sendZaloDeliveredEvent, g as sendZaloTextMessage, h as sendZaloSeenEvent, m as sendZaloReaction, p as sendZaloLink, x as createZalouserSendReceipt } from "./zalo-js-QSY2SsUF.js";
2
2
  //#region extensions/zalouser/src/text-styles.ts
3
3
  const ESCAPE_SENTINEL_START = "";
4
4
  const ESCAPE_SENTINEL_END = "";
@@ -1,2 +1,2 @@
1
- import { t as zalouserSetupPlugin } from "./channel.setup-Bfi-3_EI.js";
1
+ import { t as zalouserSetupPlugin } from "./channel.setup-q1_Y8eHR.js";
2
2
  export { zalouserSetupPlugin };
@@ -1,7 +1,7 @@
1
- import { a as resolveZalouserAccountSync, i as resolveDefaultZalouserAccountId, r as listZalouserAccountIds, t as checkZcaAuthenticated } from "./accounts-iV_px99V.js";
2
- import { r as writeQrDataUrlToTempFile } from "./setup-core-CqipqY98.js";
3
- import { b as waitForZaloQrLogin, c as logoutZaloProfile, d as resolveZaloGroupsByEntries, l as resolveZaloAllowFromEntries, y as startZaloQrLogin } from "./zalo-js-KeIEcTqZ.js";
4
- import { DEFAULT_ACCOUNT_ID, addWildcardAllowFrom, formatCliCommand, formatDocsLink, formatResolvedUnresolvedNote, mergeAllowFromEntries, normalizeAccountId, patchScopedAccountConfig } from "openclaw/plugin-sdk/setup";
1
+ import { a as resolveZalouserAccountSync, i as resolveDefaultZalouserAccountId, r as listZalouserAccountIds, t as checkZcaAuthenticated } from "./accounts-CTecjIqR.js";
2
+ import { i as writeQrDataUrlToTempFile } from "./shared-BZ67dMHg.js";
3
+ import { b as waitForZaloQrLogin, c as logoutZaloProfile, d as resolveZaloGroupsByEntries, l as resolveZaloAllowFromEntries, y as startZaloQrLogin } from "./zalo-js-QSY2SsUF.js";
4
+ import { DEFAULT_ACCOUNT_ID, addWildcardAllowFrom, createSetupTranslator, formatCliCommand, formatDocsLink, formatResolvedUnresolvedNote, mergeAllowFromEntries, normalizeAccountId, patchScopedAccountConfig } from "openclaw/plugin-sdk/setup";
5
5
  //#region \0rolldown/runtime.js
6
6
  var __defProp = Object.defineProperty;
7
7
  var __exportAll = (all, no_symbols) => {
@@ -16,12 +16,13 @@ var __exportAll = (all, no_symbols) => {
16
16
  //#endregion
17
17
  //#region extensions/zalouser/src/setup-surface.ts
18
18
  var setup_surface_exports = /* @__PURE__ */ __exportAll({ zalouserSetupWizard: () => zalouserSetupWizard });
19
+ const t = createSetupTranslator();
19
20
  const channel = "zalouser";
20
- const ZALOUSER_ALLOW_FROM_PLACEHOLDER = "Alice, 123456789, or leave empty to configure later";
21
- const ZALOUSER_GROUPS_PLACEHOLDER = "Family, Work, 123456789, or leave empty for now";
22
- const ZALOUSER_DM_ACCESS_TITLE = "Zalo Personal DM access";
23
- const ZALOUSER_ALLOWLIST_TITLE = "Zalo Personal allowlist";
24
- const ZALOUSER_GROUPS_TITLE = "Zalo groups";
21
+ const ZALOUSER_ALLOW_FROM_PLACEHOLDER = t("wizard.zalouser.allowFromPlaceholder");
22
+ const ZALOUSER_GROUPS_PLACEHOLDER = t("wizard.zalouser.groupsPlaceholder");
23
+ const ZALOUSER_DM_ACCESS_TITLE = t("wizard.zalouser.dmAccessTitle");
24
+ const ZALOUSER_ALLOWLIST_TITLE = t("wizard.zalouser.allowlistTitle");
25
+ const ZALOUSER_GROUPS_TITLE = t("wizard.zalouser.groupsTitle");
25
26
  function parseZalouserEntries(raw) {
26
27
  return raw.split(/[\n,;]+/g).map((entry) => entry.trim()).filter(Boolean);
27
28
  }
@@ -83,12 +84,12 @@ function ensureZalouserPluginEnabled(cfg) {
83
84
  }
84
85
  async function noteZalouserHelp(prompter) {
85
86
  await prompter.note([
86
- "Zalo Personal Account login via QR code.",
87
+ t("wizard.zalouser.helpQrLogin"),
87
88
  "",
88
- "This plugin uses zca-js directly (no external CLI dependency).",
89
+ t("wizard.zalouser.helpZcaJs"),
89
90
  "",
90
91
  `Docs: ${formatDocsLink("/channels/zalouser", "zalouser")}`
91
- ].join("\n"), "Zalo Personal Setup");
92
+ ].join("\n"), t("wizard.zalouser.setupTitle"));
92
93
  }
93
94
  async function promptZalouserAllowFrom(params) {
94
95
  const { cfg, prompter, accountId } = params;
@@ -99,15 +100,15 @@ async function promptZalouserAllowFrom(params) {
99
100
  const existingAllowFrom = resolved.config.allowFrom ?? [];
100
101
  while (true) {
101
102
  const parts = parseZalouserEntries(await prompter.text({
102
- message: "Zalouser allowFrom (name or user id)",
103
+ message: t("wizard.zalouser.allowFromPrompt"),
103
104
  placeholder: ZALOUSER_ALLOW_FROM_PLACEHOLDER,
104
105
  initialValue: existingAllowFrom.length > 0 ? existingAllowFrom.join(", ") : void 0
105
106
  }));
106
107
  if (parts.length === 0) {
107
108
  await prompter.note([
108
- "No DM allowlist entries added yet.",
109
- "Direct chats will stay blocked until you add people later.",
110
- `Tip: use \`${formatCliCommand("openclaw directory peers list --channel zalouser")}\` to look up people after onboarding.`
109
+ t("wizard.zalouser.noDmAllowlist"),
110
+ t("wizard.zalouser.directChatsBlocked"),
111
+ t("wizard.zalouser.peersLookupTip", { command: formatCliCommand("openclaw directory peers list --channel zalouser") })
111
112
  ].join("\n"), ZALOUSER_ALLOWLIST_TITLE);
112
113
  return setZalouserAccountScopedConfig(cfg, accountId, {
113
114
  dmPolicy: "allowlist",
@@ -120,7 +121,7 @@ async function promptZalouserAllowFrom(params) {
120
121
  });
121
122
  const unresolved = resolvedEntries.filter((item) => !item.resolved).map((item) => item.input);
122
123
  if (unresolved.length > 0) {
123
- await prompter.note(`Could not resolve: ${unresolved.join(", ")}. Use numeric user ids or exact friend names.`, ZALOUSER_ALLOWLIST_TITLE);
124
+ await prompter.note(t("wizard.zalouser.couldNotResolve", { entries: unresolved.join(", ") }), ZALOUSER_ALLOWLIST_TITLE);
124
125
  continue;
125
126
  }
126
127
  const unique = mergeAllowFromEntries(existingAllowFrom, resolvedEntries.filter((item) => item.resolved && item.id).map((item) => item.id));
@@ -167,33 +168,33 @@ async function promptZalouserQuickstartDmPolicy(params) {
167
168
  const existingAllowFrom = resolved.config.allowFrom ?? [];
168
169
  const existingLabel = existingAllowFrom.length > 0 ? existingAllowFrom.join(", ") : "unset";
169
170
  await prompter.note([
170
- "Direct chats are configured separately from group chats.",
171
- "- pairing (default): unknown people get a pairing code",
172
- "- allowlist: only listed people can DM",
173
- "- open: anyone can DM",
174
- "- disabled: ignore DMs",
171
+ t("wizard.zalouser.dmHelpSeparate"),
172
+ t("wizard.zalouser.dmHelpPairing"),
173
+ t("wizard.zalouser.dmHelpAllowlist"),
174
+ t("wizard.zalouser.dmHelpOpen"),
175
+ t("wizard.zalouser.dmHelpDisabled"),
175
176
  "",
176
177
  `Current: dmPolicy=${existingPolicy}, allowFrom=${existingLabel}`,
177
- "If you choose allowlist now, you can leave it empty and add people later."
178
+ t("wizard.zalouser.dmHelpAllowlistEmpty")
178
179
  ].join("\n"), ZALOUSER_DM_ACCESS_TITLE);
179
180
  const policy = await prompter.select({
180
- message: "Zalo Personal DM policy",
181
+ message: t("wizard.zalouser.dmPolicyPrompt"),
181
182
  options: [
182
183
  {
183
184
  value: "pairing",
184
- label: "Pairing (recommended)"
185
+ label: t("wizard.channels.dmPolicyPairing")
185
186
  },
186
187
  {
187
188
  value: "allowlist",
188
- label: "Allowlist (specific users only)"
189
+ label: t("wizard.channels.dmPolicyAllowlistOption")
189
190
  },
190
191
  {
191
192
  value: "open",
192
- label: "Open (public inbound DMs)"
193
+ label: t("wizard.channels.dmPolicyOpenOption")
193
194
  },
194
195
  {
195
196
  value: "disabled",
196
- label: "Disabled (ignore DMs)"
197
+ label: t("wizard.channels.dmPolicyDisabledOption")
197
198
  }
198
199
  ],
199
200
  initialValue: existingPolicy
@@ -208,10 +209,10 @@ async function promptZalouserQuickstartDmPolicy(params) {
208
209
  const zalouserSetupWizard = {
209
210
  channel,
210
211
  status: {
211
- configuredLabel: "logged in",
212
- unconfiguredLabel: "needs QR login",
213
- configuredHint: "recommended · logged in",
214
- unconfiguredHint: "recommended · QR login",
212
+ configuredLabel: t("wizard.channels.statusLoggedIn"),
213
+ unconfiguredLabel: t("wizard.channels.statusNeedsQrLogin"),
214
+ configuredHint: t("wizard.channels.statusRecommendedLoggedIn"),
215
+ unconfiguredHint: t("wizard.channels.statusRecommendedQrLogin"),
215
216
  configuredScore: 1,
216
217
  unconfiguredScore: 15,
217
218
  resolveConfigured: async ({ cfg, accountId }) => {
@@ -235,7 +236,7 @@ const zalouserSetupWizard = {
235
236
  if (!await checkZcaAuthenticated(account.profile)) {
236
237
  await noteZalouserHelp(prompter);
237
238
  if (await prompter.confirm({
238
- message: "Login via QR code now?",
239
+ message: t("wizard.zalouser.loginQrPrompt"),
239
240
  initialValue: true
240
241
  })) {
241
242
  const start = await startZaloQrLogin({
@@ -246,23 +247,23 @@ const zalouserSetupWizard = {
246
247
  const qrPath = await writeQrDataUrlToTempFile(start.qrDataUrl, account.profile);
247
248
  await prompter.note([
248
249
  start.message,
249
- qrPath ? `QR image saved to: ${qrPath}` : "Could not write QR image file; use gateway web login UI instead.",
250
- "Scan + approve on phone, then continue."
251
- ].join("\n"), "QR Login");
250
+ qrPath ? t("wizard.zalouser.qrImageSaved", { path: qrPath }) : t("wizard.zalouser.qrImageWriteFailed"),
251
+ t("wizard.zalouser.scanApproveContinue")
252
+ ].join("\n"), t("wizard.zalouser.qrLoginTitle"));
252
253
  if (await prompter.confirm({
253
- message: "Did you scan and approve the QR on your phone?",
254
+ message: t("wizard.zalouser.qrScannedPrompt"),
254
255
  initialValue: true
255
256
  })) {
256
257
  const waited = await waitForZaloQrLogin({
257
258
  profile: account.profile,
258
259
  timeoutMs: 12e4
259
260
  });
260
- await prompter.note(waited.message, waited.connected ? "Success" : "Login pending");
261
+ await prompter.note(waited.message, waited.connected ? t("common.done") : t("wizard.zalouser.loginPendingTitle"));
261
262
  }
262
- } else await prompter.note(start.message, "Login pending");
263
+ } else await prompter.note(start.message, t("wizard.zalouser.loginPendingTitle"));
263
264
  }
264
265
  } else if (!await prompter.confirm({
265
- message: "Zalo Personal already logged in. Keep session?",
266
+ message: t("wizard.zalouser.keepSessionPrompt"),
266
267
  initialValue: true
267
268
  })) {
268
269
  await logoutZaloProfile(account.profile);
@@ -273,12 +274,12 @@ const zalouserSetupWizard = {
273
274
  });
274
275
  if (start.qrDataUrl) {
275
276
  const qrPath = await writeQrDataUrlToTempFile(start.qrDataUrl, account.profile);
276
- await prompter.note([start.message, qrPath ? `QR image saved to: ${qrPath}` : void 0].filter(Boolean).join("\n"), "QR Login");
277
+ await prompter.note([start.message, qrPath ? t("wizard.zalouser.qrImageSaved", { path: qrPath }) : void 0].filter(Boolean).join("\n"), t("wizard.zalouser.qrLoginTitle"));
277
278
  const waited = await waitForZaloQrLogin({
278
279
  profile: account.profile,
279
280
  timeoutMs: 12e4
280
281
  });
281
- await prompter.note(waited.message, waited.connected ? "Success" : "Login pending");
282
+ await prompter.note(waited.message, waited.connected ? t("common.done") : t("wizard.zalouser.loginPendingTitle"));
282
283
  }
283
284
  }
284
285
  next = setZalouserAccountScopedConfig(next, accountId, { profile: account.profile !== "default" ? account.profile : void 0 }, {
@@ -312,10 +313,10 @@ const zalouserSetupWizard = {
312
313
  resolveAllowlist: async ({ cfg, accountId, entries, prompter }) => {
313
314
  if (entries.length === 0) {
314
315
  await prompter.note([
315
- "No group allowlist entries added yet.",
316
- "Group chats will stay blocked until you add groups later.",
317
- `Tip: use \`${formatCliCommand("openclaw directory groups list --channel zalouser")}\` after onboarding to find group IDs.`,
318
- "Mention requirement stays on by default for groups you allow later."
316
+ t("wizard.zalouser.noGroupAllowlist"),
317
+ t("wizard.zalouser.groupChatsBlocked"),
318
+ t("wizard.zalouser.groupsLookupTip", { command: formatCliCommand("openclaw directory groups list --channel zalouser") }),
319
+ t("wizard.zalouser.groupMentionRequirement")
319
320
  ].join("\n"), ZALOUSER_GROUPS_TITLE);
320
321
  return [];
321
322
  }
@@ -338,7 +339,7 @@ const zalouserSetupWizard = {
338
339
  if (resolution) await prompter.note(resolution, ZALOUSER_GROUPS_TITLE);
339
340
  return keys;
340
341
  } catch (err) {
341
- await prompter.note(`Group lookup failed; keeping entries as typed. ${String(err)}`, ZALOUSER_GROUPS_TITLE);
342
+ await prompter.note(t("wizard.zalouser.groupLookupFailed", { error: String(err) }), ZALOUSER_GROUPS_TITLE);
342
343
  return entries.map((entry) => entry.trim()).filter(Boolean);
343
344
  }
344
345
  },
@@ -1,6 +1,6 @@
1
- import { a as resolveZalouserAccountSync, i as resolveDefaultZalouserAccountId, r as listZalouserAccountIds, t as checkZcaAuthenticated } from "./accounts-iV_px99V.js";
2
- import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-DgqHp8E2.js";
3
- import { n as isZalouserMutableGroupEntry } from "./security-audit-BZLhil-V.js";
1
+ import { a as resolveZalouserAccountSync, i as resolveDefaultZalouserAccountId, r as listZalouserAccountIds, t as checkZcaAuthenticated } from "./accounts-CTecjIqR.js";
2
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-BIY2IHB_.js";
3
+ import { n as isZalouserMutableGroupEntry } from "./security-audit-DUQOetcM.js";
4
4
  import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
5
5
  import { AllowFromListSchema, DmPolicySchema, GroupPolicySchema, MarkdownConfigSchema, ToolPolicySchema, buildCatchallMultiAccountChannelSchema, buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
6
6
  import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/core";
@@ -8,9 +8,49 @@ import { isDangerousNameMatchingEnabled as isDangerousNameMatchingEnabled$1 } fr
8
8
  import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
9
9
  import { isNumericTargetId, sendPayloadWithChunkedTextAndMedia } from "openclaw/plugin-sdk/reply-payload";
10
10
  import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
11
+ import fsp from "node:fs/promises";
12
+ import path from "node:path";
13
+ import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
14
+ import { createDelegatedSetupWizardProxy, createPatchedAccountSetupAdapter, createSetupTranslator } from "openclaw/plugin-sdk/setup-runtime";
11
15
  import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
12
16
  import { z } from "zod";
13
17
  import { createDangerousNameMatchingMutableAllowlistWarningCollector } from "openclaw/plugin-sdk/channel-policy";
18
+ //#region extensions/zalouser/src/qr-temp-file.ts
19
+ async function writeQrDataUrlToTempFile(qrDataUrl, profile) {
20
+ const base64 = (qrDataUrl.trim().match(/^data:image\/png;base64,(.+)$/i)?.[1] ?? "").trim();
21
+ if (!base64) return null;
22
+ const safeProfile = profile.replace(/[^a-zA-Z0-9_-]+/g, "-") || "default";
23
+ const filePath = path.join(resolvePreferredOpenClawTmpDir(), `openclaw-zalouser-qr-${safeProfile}.png`);
24
+ await fsp.writeFile(filePath, Buffer.from(base64, "base64"));
25
+ return filePath;
26
+ }
27
+ //#endregion
28
+ //#region extensions/zalouser/src/setup-core.ts
29
+ const t = createSetupTranslator();
30
+ const channel = "zalouser";
31
+ const zalouserSetupAdapter = createPatchedAccountSetupAdapter({
32
+ channelKey: channel,
33
+ validateInput: () => null,
34
+ buildPatch: () => ({})
35
+ });
36
+ function createZalouserSetupWizardProxy(loadWizard) {
37
+ return createDelegatedSetupWizardProxy({
38
+ channel,
39
+ loadWizard,
40
+ status: {
41
+ configuredLabel: t("wizard.channels.statusLoggedIn"),
42
+ unconfiguredLabel: t("wizard.channels.statusNeedsQrLogin"),
43
+ configuredHint: t("wizard.channels.statusRecommendedLoggedIn"),
44
+ unconfiguredHint: t("wizard.channels.statusRecommendedQrLogin"),
45
+ configuredScore: 1,
46
+ unconfiguredScore: 15
47
+ },
48
+ credentials: [],
49
+ delegatePrepare: true,
50
+ delegateFinalize: true
51
+ });
52
+ }
53
+ //#endregion
14
54
  //#region extensions/zalouser/src/config-schema.ts
15
55
  const groupConfigSchema = z.object({
16
56
  enabled: z.boolean().optional(),
@@ -117,4 +157,4 @@ function createZalouserPluginBase(params) {
117
157
  };
118
158
  }
119
159
  //#endregion
120
- export { isNumericTargetId as a, isDangerousNameMatchingEnabled$1 as i, DEFAULT_ACCOUNT_ID as n, normalizeAccountId as o, chunkTextForOutbound as r, sendPayloadWithChunkedTextAndMedia as s, createZalouserPluginBase as t };
160
+ export { DEFAULT_ACCOUNT_ID as a, isNumericTargetId as c, writeQrDataUrlToTempFile as i, normalizeAccountId as l, createZalouserSetupWizardProxy as n, chunkTextForOutbound as o, zalouserSetupAdapter as r, isDangerousNameMatchingEnabled$1 as s, createZalouserPluginBase as t, sendPayloadWithChunkedTextAndMedia as u };
package/dist/test-api.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a as resolveZalouserAccountSync, i as resolveDefaultZalouserAccountId, n as getZcaUserInfo, r as listZalouserAccountIds, t as checkZcaAuthenticated } from "./accounts-iV_px99V.js";
2
- import { r as parseZalouserOutboundTarget } from "./session-route-81QGCeV2.js";
3
- import { a as listZaloGroupMembers, b as waitForZaloQrLogin, c as logoutZaloProfile, d as resolveZaloGroupsByEntries, i as listZaloFriendsMatching, l as resolveZaloAllowFromEntries, n as getZaloUserInfo, s as listZaloGroupsMatching, t as checkZaloAuthenticated, y as startZaloQrLogin } from "./zalo-js-KeIEcTqZ.js";
4
- import { i as sendMessageZalouser } from "./send-CH7XlJaj.js";
1
+ import { a as resolveZalouserAccountSync, i as resolveDefaultZalouserAccountId, n as getZcaUserInfo, r as listZalouserAccountIds, t as checkZcaAuthenticated } from "./accounts-CTecjIqR.js";
2
+ import { r as parseZalouserOutboundTarget } from "./session-route-DWMin5CB.js";
3
+ import { a as listZaloGroupMembers, b as waitForZaloQrLogin, c as logoutZaloProfile, d as resolveZaloGroupsByEntries, i as listZaloFriendsMatching, l as resolveZaloAllowFromEntries, n as getZaloUserInfo, s as listZaloGroupsMatching, t as checkZaloAuthenticated, y as startZaloQrLogin } from "./zalo-js-QSY2SsUF.js";
4
+ import { i as sendMessageZalouser } from "./send-SPumHuhS.js";
5
5
  export { checkZaloAuthenticated, checkZcaAuthenticated, getZaloUserInfo, getZcaUserInfo, listZaloFriendsMatching, listZaloGroupMembers, listZaloGroupsMatching, listZalouserAccountIds, logoutZaloProfile, parseZalouserOutboundTarget, resolveDefaultZalouserAccountId, resolveZaloAllowFromEntries, resolveZaloGroupsByEntries, resolveZalouserAccountSync, sendMessageZalouser, startZaloQrLogin, waitForZaloQrLogin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/zalouser",
3
- "version": "2026.5.14-beta.1",
3
+ "version": "2026.5.16-beta.1",
4
4
  "description": "OpenClaw Zalo Personal Account plugin via native zca-js integration",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,7 +17,7 @@
17
17
  "openclaw": "workspace:*"
18
18
  },
19
19
  "peerDependencies": {
20
- "openclaw": ">=2026.5.14-beta.1"
20
+ "openclaw": ">=2026.5.16-beta.1"
21
21
  },
22
22
  "peerDependenciesMeta": {
23
23
  "openclaw": {
@@ -54,10 +54,10 @@
54
54
  "minHostVersion": ">=2026.4.10"
55
55
  },
56
56
  "compat": {
57
- "pluginApi": ">=2026.5.14-beta.1"
57
+ "pluginApi": ">=2026.5.16-beta.1"
58
58
  },
59
59
  "build": {
60
- "openclawVersion": "2026.5.14-beta.1"
60
+ "openclawVersion": "2026.5.16-beta.1"
61
61
  },
62
62
  "release": {
63
63
  "publishToClawHub": true,
@@ -1,106 +0,0 @@
1
- import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-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 };
@@ -1,40 +0,0 @@
1
- import fsp from "node:fs/promises";
2
- import path from "node:path";
3
- import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
4
- import { createDelegatedSetupWizardProxy, createPatchedAccountSetupAdapter } from "openclaw/plugin-sdk/setup-runtime";
5
- //#region extensions/zalouser/src/qr-temp-file.ts
6
- async function writeQrDataUrlToTempFile(qrDataUrl, profile) {
7
- const base64 = (qrDataUrl.trim().match(/^data:image\/png;base64,(.+)$/i)?.[1] ?? "").trim();
8
- if (!base64) return null;
9
- const safeProfile = profile.replace(/[^a-zA-Z0-9_-]+/g, "-") || "default";
10
- const filePath = path.join(resolvePreferredOpenClawTmpDir(), `openclaw-zalouser-qr-${safeProfile}.png`);
11
- await fsp.writeFile(filePath, Buffer.from(base64, "base64"));
12
- return filePath;
13
- }
14
- //#endregion
15
- //#region extensions/zalouser/src/setup-core.ts
16
- const channel = "zalouser";
17
- const zalouserSetupAdapter = createPatchedAccountSetupAdapter({
18
- channelKey: channel,
19
- validateInput: () => null,
20
- buildPatch: () => ({})
21
- });
22
- function createZalouserSetupWizardProxy(loadWizard) {
23
- return createDelegatedSetupWizardProxy({
24
- channel,
25
- loadWizard,
26
- status: {
27
- configuredLabel: "logged in",
28
- unconfiguredLabel: "needs QR login",
29
- configuredHint: "recommended · logged in",
30
- unconfiguredHint: "recommended · QR login",
31
- configuredScore: 1,
32
- unconfiguredScore: 15
33
- },
34
- credentials: [],
35
- delegatePrepare: true,
36
- delegateFinalize: true
37
- });
38
- }
39
- //#endregion
40
- export { zalouserSetupAdapter as n, writeQrDataUrlToTempFile as r, createZalouserSetupWizardProxy as t };