@openclaw/synology-chat 2026.7.2-beta.1 → 2026.7.2-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.
package/dist/api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as setSynologyRuntime, t as synologyChatPlugin } from "./channel-DJNRGYkN.js";
1
+ import { n as setSynologyRuntime, t as synologyChatPlugin } from "./channel-Hiv3SX8l.js";
2
2
  import { t as collectSynologyChatSecurityAuditFindings } from "./security-audit-DIsaxIaB.js";
3
3
  export { collectSynologyChatSecurityAuditFindings, setSynologyRuntime, synologyChatPlugin };
@@ -1,4 +1,4 @@
1
- import { i as resolveAccount, n as synologyChatSetupWizard, r as listAccountIds, t as synologyChatSetupAdapter } from "./setup-surface-pMbKFqU5.js";
1
+ import { i as resolveAccount, n as synologyChatSetupWizard, r as listAccountIds, t as synologyChatSetupAdapter } from "./setup-surface-CJtfU_Gw.js";
2
2
  import { t as collectSynologyChatSecurityAuditFindings } from "./security-audit-DIsaxIaB.js";
3
3
  import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
4
4
  import { createHybridChannelConfigAdapter, createScopedDmSecurityResolver } from "openclaw/plugin-sdk/channel-config-helpers";
@@ -14,6 +14,7 @@ import { createChannelApprovalAuth } from "openclaw/plugin-sdk/approval-auth-run
14
14
  import * as http from "node:http";
15
15
  import * as https from "node:https";
16
16
  import { safeParseJsonWithSchema, safeParseWithSchema } from "openclaw/plugin-sdk/extension-shared";
17
+ import { readByteStreamWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
17
18
  import { sleep } from "openclaw/plugin-sdk/runtime-env";
18
19
  import { formatErrorMessage, resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-runtime";
19
20
  import { z } from "zod";
@@ -44,6 +45,8 @@ const synologyChatApprovalAuth = createChannelApprovalAuth({
44
45
  * Sends messages TO Synology Chat via the incoming webhook URL.
45
46
  */
46
47
  const MIN_SEND_INTERVAL_MS = 500;
48
+ /** user_list JSON can be larger than inbound webhook pre-auth payloads. */
49
+ const USER_LIST_RESPONSE_MAX_BYTES = 1 * 1024 * 1024;
47
50
  let lastSendTime = 0;
48
51
  let sendQueue = Promise.resolve();
49
52
  const ChatUserSchema = z.object({
@@ -127,29 +130,36 @@ async function fetchChatUsers(incomingUrl, allowInsecureSsl = false, log) {
127
130
  const transport = parsedUrl.protocol === "https:" ? https : http;
128
131
  const requestOptions = parsedUrl.protocol === "https:" ? { rejectUnauthorized: !allowInsecureSsl } : {};
129
132
  const req = transport.get(listUrl, requestOptions, (res) => {
130
- let data = "";
131
- res.on("data", (c) => {
132
- data += c.toString();
133
- });
134
- res.on("end", () => {
135
- const result = safeParseJsonWithSchema(ChatUserListResponseSchema, data);
136
- if (!result) {
137
- log?.warn("fetchChatUsers: failed to parse user_list response");
138
- finish(cached?.users ?? []);
139
- return;
140
- }
141
- if (result.success) {
142
- const users = result.data?.users ?? [];
143
- chatUserCache.set(listUrl, {
144
- users,
145
- cachedAt: now
133
+ (async () => {
134
+ try {
135
+ const data = await readByteStreamWithLimit(res, {
136
+ maxBytes: USER_LIST_RESPONSE_MAX_BYTES,
137
+ onOverflow: ({ maxBytes }) => /* @__PURE__ */ new Error(`user_list response exceeded ${maxBytes} bytes`)
146
138
  });
147
- finish(users);
148
- return;
139
+ if (settled) return;
140
+ const result = safeParseJsonWithSchema(ChatUserListResponseSchema, data.toString("utf8"));
141
+ if (!result) {
142
+ log?.warn("fetchChatUsers: failed to parse user_list response");
143
+ finish(cached?.users ?? []);
144
+ return;
145
+ }
146
+ if (result.success) {
147
+ const users = result.data?.users ?? [];
148
+ chatUserCache.set(listUrl, {
149
+ users,
150
+ cachedAt: now
151
+ });
152
+ finish(users);
153
+ return;
154
+ }
155
+ log?.warn(`fetchChatUsers: API returned success=${result.success}, using cached data`);
156
+ finish(cached?.users ?? []);
157
+ } catch (err) {
158
+ if (settled) return;
159
+ log?.warn(`fetchChatUsers: ${formatErrorMessage(err)}, using cached data`);
160
+ finish(cached?.users ?? []);
149
161
  }
150
- log?.warn(`fetchChatUsers: API returned success=${result.success}, using cached data`);
151
- finish(cached?.users ?? []);
152
- });
162
+ })();
153
163
  }).on("error", (err) => {
154
164
  log?.warn(`fetchChatUsers: HTTP error — ${err instanceof Error ? err.message : err}`);
155
165
  finish(cached?.users ?? []);
@@ -226,13 +236,10 @@ function doPost(url, body, allowInsecureSsl = false) {
226
236
  timeout: 3e4,
227
237
  rejectUnauthorized: !allowInsecureSsl
228
238
  }, (res) => {
229
- let data = "";
230
- res.on("data", (chunk) => {
231
- data += chunk.toString();
232
- });
233
239
  res.on("end", () => {
234
240
  resolve(res.statusCode === 200);
235
241
  });
242
+ res.resume();
236
243
  });
237
244
  req.on("error", reject);
238
245
  req.on("timeout", () => {
@@ -1,2 +1,2 @@
1
- import { t as synologyChatPlugin } from "./channel-DJNRGYkN.js";
1
+ import { t as synologyChatPlugin } from "./channel-Hiv3SX8l.js";
2
2
  export { synologyChatPlugin };
package/dist/setup-api.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as synologyChatSetupWizard, t as synologyChatSetupAdapter } from "./setup-surface-pMbKFqU5.js";
1
+ import { n as synologyChatSetupWizard, t as synologyChatSetupAdapter } from "./setup-surface-CJtfU_Gw.js";
2
2
  export { synologyChatSetupAdapter, synologyChatSetupWizard };
@@ -1,8 +1,8 @@
1
1
  import { parseStrictInteger } from "openclaw/plugin-sdk/number-runtime";
2
2
  import { normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
3
- import { DEFAULT_ACCOUNT_ID, listCombinedAccountIds, resolveMergedAccountConfig } from "openclaw/plugin-sdk/account-resolution";
3
+ import { DEFAULT_ACCOUNT_ID, hasConfiguredAccountValue, listCombinedAccountIds, resolveMergedAccountConfig } from "openclaw/plugin-sdk/account-resolution";
4
4
  import { resolveDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
5
- import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, createAllowFromSection, createSetupTranslator, createStandardChannelSetupStatus, formatDocsLink, mergeAllowFromEntries, normalizeAccountId, setSetupChannelEnabled, splitSetupEntries } from "openclaw/plugin-sdk/setup";
5
+ import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, createAllowFromSection, createSetupTranslator, createStandardChannelSetupStatus, defineTokenCredential, formatDocsLink, mergeAllowFromEntries, normalizeAccountId, setSetupChannelEnabled, splitSetupEntries } from "openclaw/plugin-sdk/setup";
6
6
  //#region extensions/synology-chat/src/accounts.ts
7
7
  /**
8
8
  * Account resolution: reads config from channels.synology-chat,
@@ -13,7 +13,7 @@ function getChannelConfig$1(cfg) {
13
13
  return cfg?.channels?.["synology-chat"];
14
14
  }
15
15
  function resolveImplicitAccountId(channelCfg) {
16
- return channelCfg.token || process.env.SYNOLOGY_CHAT_TOKEN ? DEFAULT_ACCOUNT_ID : void 0;
16
+ return hasConfiguredAccountValue(channelCfg.token) || hasConfiguredAccountValue(process.env.SYNOLOGY_CHAT_TOKEN) ? DEFAULT_ACCOUNT_ID : void 0;
17
17
  }
18
18
  function getRawAccountConfig$1(channelCfg, accountId) {
19
19
  if (accountId === DEFAULT_ACCOUNT_ID) return channelCfg;
@@ -238,8 +238,9 @@ const synologyChatSetupWizard = {
238
238
  title: t("wizard.synologyChat.setupTitle"),
239
239
  lines: SYNOLOGY_SETUP_HELP_LINES
240
240
  },
241
- credentials: [{
241
+ credentials: [defineTokenCredential({
242
242
  inputKey: "token",
243
+ configKey: "token",
243
244
  providerHint: channel,
244
245
  credentialLabel: "outgoing webhook token",
245
246
  preferredEnvVar: "SYNOLOGY_CHAT_TOKEN",
@@ -249,30 +250,25 @@ const synologyChatSetupWizard = {
249
250
  keepPrompt: t("wizard.synologyChat.tokenKeep"),
250
251
  inputPrompt: t("wizard.synologyChat.tokenInput"),
251
252
  allowEnv: ({ accountId }) => accountId === DEFAULT_ACCOUNT_ID$1,
252
- inspect: ({ cfg, accountId }) => {
253
- const account = resolveAccount(cfg, accountId);
254
- const raw = getRawAccountConfig(cfg, accountId);
255
- return {
256
- accountConfigured: isSynologyChatConfigured(cfg, accountId),
257
- hasConfiguredValue: Boolean(normalizeOptionalString(raw.token)),
258
- resolvedValue: normalizeOptionalString(account.token),
259
- envValue: accountId === DEFAULT_ACCOUNT_ID$1 ? normalizeOptionalString(process.env.SYNOLOGY_CHAT_TOKEN) : void 0
260
- };
261
- },
262
- applyUseEnv: async ({ cfg, accountId }) => patchSynologyChatAccountConfig({
263
- cfg,
264
- accountId,
265
- enabled: true,
266
- clearFields: ["token"],
267
- patch: {}
253
+ resolveAccount: ({ cfg, accountId }) => ({
254
+ config: getRawAccountConfig(cfg, accountId),
255
+ resolved: resolveAccount(cfg, accountId),
256
+ configured: isSynologyChatConfigured(cfg, accountId)
268
257
  }),
269
- applySet: async ({ cfg, accountId, resolvedValue }) => patchSynologyChatAccountConfig({
258
+ accountConfigured: (account) => account.configured,
259
+ hasConfiguredValue: (account) => Boolean(normalizeOptionalString(account.config.token)),
260
+ resolvedValue: (account) => normalizeOptionalString(account.resolved.token),
261
+ envValue: ({ accountId }) => accountId === DEFAULT_ACCOUNT_ID$1 ? normalizeOptionalString(process.env.SYNOLOGY_CHAT_TOKEN) : void 0,
262
+ patchAccount: ({ cfg, accountId, patch, clearFields }) => patchSynologyChatAccountConfig({
270
263
  cfg,
271
264
  accountId,
272
265
  enabled: true,
273
- patch: { token: resolvedValue }
274
- })
275
- }],
266
+ clearFields,
267
+ patch
268
+ }),
269
+ useEnv: { clearFields: ["token"] },
270
+ set: { value: "resolved" }
271
+ })],
276
272
  textInputs: [{
277
273
  inputKey: "url",
278
274
  message: t("wizard.synologyChat.incomingWebhookUrlPrompt"),
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@openclaw/synology-chat",
3
- "version": "2026.7.2-beta.1",
3
+ "version": "2026.7.2-beta.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/synology-chat",
9
- "version": "2026.7.2-beta.1",
9
+ "version": "2026.7.2-beta.2",
10
10
  "dependencies": {
11
11
  "zod": "4.4.3"
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/synology-chat",
3
- "version": "2026.7.2-beta.1",
3
+ "version": "2026.7.2-beta.2",
4
4
  "description": "Synology Chat channel plugin for OpenClaw channels and direct messages.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,10 +27,10 @@
27
27
  "minHostVersion": ">=2026.4.10"
28
28
  },
29
29
  "compat": {
30
- "pluginApi": ">=2026.7.2-beta.1"
30
+ "pluginApi": ">=2026.7.2-beta.2"
31
31
  },
32
32
  "build": {
33
- "openclawVersion": "2026.7.2-beta.1"
33
+ "openclawVersion": "2026.7.2-beta.2"
34
34
  },
35
35
  "release": {
36
36
  "publishToClawHub": true,
@@ -51,7 +51,7 @@
51
51
  "README.md"
52
52
  ],
53
53
  "peerDependencies": {
54
- "openclaw": ">=2026.7.2-beta.1"
54
+ "openclaw": ">=2026.7.2-beta.2"
55
55
  },
56
56
  "peerDependenciesMeta": {
57
57
  "openclaw": {