From d0b19cf116397a67d2f7c147b1814fcebe0e3ea9 Mon Sep 17 00:00:00 2001 From: hzhang Date: Tue, 19 May 2026 15:59:08 +0100 Subject: [PATCH] feat: make notifyBotToken/adminUserId optional The client never sends pairing notifications (the server does); these Discord fields were required but unused. Make them optional + drop from the config schema's required list. Back-compat: still accepted if set. Co-Authored-By: Claude Opus 4.7 (1M context) --- package-lock.json | 8 ++++++++ plugin/core/config.ts | 26 +++++++++++++------------- plugin/openclaw.plugin.json | 2 +- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index df0c240..fde0945 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,10 +12,14 @@ }, "devDependencies": { "@types/node": "^25.5.2", + "openclaw": "file:/usr/lib/node_modules/openclaw", "typescript": "^5.6.3", "vitest": "^4.1.3" } }, + "../../../../../usr/lib/node_modules/openclaw": { + "dev": true + }, "node_modules/@emnapi/core": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.9.1.tgz", @@ -914,6 +918,10 @@ ], "license": "MIT" }, + "node_modules/openclaw": { + "resolved": "../../../../../usr/lib/node_modules/openclaw", + "link": true + }, "node_modules/pathe": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", diff --git a/plugin/core/config.ts b/plugin/core/config.ts index c8eada7..43a6119 100644 --- a/plugin/core/config.ts +++ b/plugin/core/config.ts @@ -1,8 +1,12 @@ export interface YonexusClientConfig { mainHost: string; identifier: string; - notifyBotToken: string; - adminUserId: string; + /** + * Optional. The client never sends pairing notifications (the server + * does); accepted for back-compat but no longer required. + */ + notifyBotToken?: string; + adminUserId?: string; } export class YonexusClientConfigError extends Error { @@ -44,15 +48,9 @@ export function validateYonexusClientConfig(raw: unknown): YonexusClientConfig { issues.push("identifier is required"); } + // Optional (back-compat): the client does not send notifications. const rawNotifyBotToken = source.notifyBotToken; - if (!isNonEmptyString(rawNotifyBotToken)) { - issues.push("notifyBotToken is required"); - } - const rawAdminUserId = source.adminUserId; - if (!isNonEmptyString(rawAdminUserId)) { - issues.push("adminUserId is required"); - } if (issues.length > 0) { throw new YonexusClientConfigError(issues); @@ -60,13 +58,15 @@ export function validateYonexusClientConfig(raw: unknown): YonexusClientConfig { const mainHost = (rawMainHost as string).trim(); const identifier = (rawIdentifier as string).trim(); - const notifyBotToken = (rawNotifyBotToken as string).trim(); - const adminUserId = (rawAdminUserId as string).trim(); return { mainHost, identifier, - notifyBotToken, - adminUserId + notifyBotToken: isNonEmptyString(rawNotifyBotToken) + ? rawNotifyBotToken.trim() + : undefined, + adminUserId: isNonEmptyString(rawAdminUserId) + ? rawAdminUserId.trim() + : undefined }; } diff --git a/plugin/openclaw.plugin.json b/plugin/openclaw.plugin.json index fd5c52e..54ec0fb 100644 --- a/plugin/openclaw.plugin.json +++ b/plugin/openclaw.plugin.json @@ -14,6 +14,6 @@ "notifyBotToken": { "type": "string" }, "adminUserId": { "type": "string" } }, - "required": ["mainHost", "identifier", "notifyBotToken", "adminUserId"] + "required": ["mainHost", "identifier"] } }