@nextclaw/openclaw-compat 0.3.14 → 0.3.16

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/index.d.ts CHANGED
@@ -140,6 +140,25 @@ type OpenClawChannelAuthLoginResult = {
140
140
  accountId?: string | null;
141
141
  notes?: string[];
142
142
  };
143
+ type OpenClawChannelAuthStartResult = {
144
+ channel: string;
145
+ kind: "qr_code";
146
+ sessionId: string;
147
+ qrCode: string;
148
+ qrCodeUrl: string;
149
+ expiresAt: string;
150
+ intervalMs: number;
151
+ note?: string;
152
+ };
153
+ type OpenClawChannelAuthPollResult = {
154
+ channel: string;
155
+ status: "pending" | "scanned" | "authorized" | "expired" | "error";
156
+ message?: string;
157
+ nextPollMs?: number;
158
+ accountId?: string | null;
159
+ notes?: string[];
160
+ pluginConfig?: Record<string, unknown>;
161
+ };
143
162
  type OpenClawChannelAuth = {
144
163
  login?: (params: {
145
164
  cfg: Config;
@@ -150,6 +169,21 @@ type OpenClawChannelAuth = {
150
169
  baseUrl?: string | null;
151
170
  verbose?: boolean;
152
171
  }) => Promise<OpenClawChannelAuthLoginResult> | OpenClawChannelAuthLoginResult;
172
+ start?: (params: {
173
+ cfg: Config;
174
+ pluginId: string;
175
+ channelId: string;
176
+ pluginConfig?: Record<string, unknown>;
177
+ accountId?: string | null;
178
+ baseUrl?: string | null;
179
+ }) => Promise<OpenClawChannelAuthStartResult> | OpenClawChannelAuthStartResult;
180
+ poll?: (params: {
181
+ cfg: Config;
182
+ pluginId: string;
183
+ channelId: string;
184
+ pluginConfig?: Record<string, unknown>;
185
+ sessionId: string;
186
+ }) => Promise<OpenClawChannelAuthPollResult | null> | OpenClawChannelAuthPollResult | null;
153
187
  };
154
188
  type OpenClawChannelPlugin = {
155
189
  id: string;
@@ -440,6 +474,8 @@ declare function resolvePluginChannelMessageToolHints(params: {
440
474
  accountId?: string | null;
441
475
  }): string[];
442
476
  declare function getPluginUiMetadataFromRegistry(registry: PluginRegistry): PluginUiMetadata[];
477
+ declare function toPluginConfigView(config: Config, bindings: PluginChannelBinding[]): Record<string, unknown>;
478
+ declare function mergePluginConfigView(baseConfig: Config, pluginViewConfig: Record<string, unknown>, bindings: PluginChannelBinding[]): Config;
443
479
  declare function startPluginChannelGateways(params: {
444
480
  registry: PluginRegistry;
445
481
  logger?: PluginLogger;
@@ -716,4 +752,4 @@ declare function uninstallPlugin(params: {
716
752
  extensionsDir?: string;
717
753
  }): Promise<UninstallPluginResult>;
718
754
 
719
- export { DEFAULT_ACCOUNT_ID, type InstallPluginResult, type NormalizedPluginsConfig, type OpenClawChannelAgentPrompt, type OpenClawChannelAuth, type OpenClawChannelAuthLoginResult, type OpenClawChannelConfigAdapter, type OpenClawChannelConfigSchema, type OpenClawChannelGateway, type OpenClawChannelGatewayStartContext, type OpenClawChannelPlugin, type OpenClawChannelSetup, type OpenClawPluginApi, type OpenClawPluginChannelRegistration, type OpenClawPluginConfigSchema, type OpenClawPluginDefinition, type OpenClawPluginEngineOptions, type OpenClawPluginModule, type OpenClawPluginNcpAgentRuntimeRegistration, type OpenClawPluginTool, type OpenClawPluginToolContext, type OpenClawPluginToolFactory, type OpenClawPluginToolOptions, type OpenClawProviderPlugin, PLUGIN_MANIFEST_FILENAME, PLUGIN_MANIFEST_FILENAMES, type PackageManifest, type PluginCandidate, type PluginChannelBinding, type PluginChannelGatewayHandle, type PluginChannelRegistration, type PluginConfigUiHint, type PluginDiagnostic, type PluginDiscoveryResult, type PluginEngineRegistration, type PluginInstallLogger, type PluginInstallSource, type PluginInstallUpdate, type PluginKind, type PluginLoadOptions, type PluginLogger, type PluginManifest, type PluginManifestLoadResult, type PluginManifestRecord, type PluginManifestRegistry, type PluginNcpAgentRuntimeRegistration, type PluginOrigin, type PluginProviderRegistration, type PluginRecord, type PluginRegisterRuntime, type PluginRegistry, type PluginReplyDispatchParams, type PluginRuntime, type PluginRuntimeBridge, type PluginStatusReport, type PluginToolRegistration, type PluginUiMetadata, type UninstallActions, type UninstallPluginResult, type _CompatOnly, __nextclawPluginSdkCompat, addPluginLoadPath, buildChannelConfigSchema, buildOauthProviderAuthResult, buildPluginLoaderAliases, buildPluginStatusReport, createNextclawBuiltinChannelPlugin, createPluginRegisterRuntime, createPluginRuntime, disablePluginInConfig, discoverOpenClawPlugins, emptyPluginConfigSchema, enablePluginInConfig, getPackageManifestMetadata, getPluginChannelBindings, getPluginUiMetadataFromRegistry, installPluginFromArchive, installPluginFromDir, installPluginFromFile, installPluginFromNpmSpec, installPluginFromPath, loadOpenClawPlugins, loadPluginManifest, loadPluginManifestRegistry, loadPluginUiMetadata, normalizeAccountId, normalizePluginHttpPath, normalizePluginsConfig, recordPluginInstall, registerPluginWithApi, removePluginFromConfig, resolveEnableState, resolvePluginChannelMessageToolHints, resolvePluginInstallDir, resolvePluginManifestPath, resolveUninstallDirectoryTarget, resolveUninstallDirectoryTargets, setPluginRuntimeBridge, sleep, startPluginChannelGateways, stopPluginChannelGateways, toPluginUiMetadata, uninstallPlugin, validateJsonSchemaValue };
755
+ export { DEFAULT_ACCOUNT_ID, type InstallPluginResult, type NormalizedPluginsConfig, type OpenClawChannelAgentPrompt, type OpenClawChannelAuth, type OpenClawChannelAuthLoginResult, type OpenClawChannelAuthPollResult, type OpenClawChannelAuthStartResult, type OpenClawChannelConfigAdapter, type OpenClawChannelConfigSchema, type OpenClawChannelGateway, type OpenClawChannelGatewayStartContext, type OpenClawChannelPlugin, type OpenClawChannelSetup, type OpenClawPluginApi, type OpenClawPluginChannelRegistration, type OpenClawPluginConfigSchema, type OpenClawPluginDefinition, type OpenClawPluginEngineOptions, type OpenClawPluginModule, type OpenClawPluginNcpAgentRuntimeRegistration, type OpenClawPluginTool, type OpenClawPluginToolContext, type OpenClawPluginToolFactory, type OpenClawPluginToolOptions, type OpenClawProviderPlugin, PLUGIN_MANIFEST_FILENAME, PLUGIN_MANIFEST_FILENAMES, type PackageManifest, type PluginCandidate, type PluginChannelBinding, type PluginChannelGatewayHandle, type PluginChannelRegistration, type PluginConfigUiHint, type PluginDiagnostic, type PluginDiscoveryResult, type PluginEngineRegistration, type PluginInstallLogger, type PluginInstallSource, type PluginInstallUpdate, type PluginKind, type PluginLoadOptions, type PluginLogger, type PluginManifest, type PluginManifestLoadResult, type PluginManifestRecord, type PluginManifestRegistry, type PluginNcpAgentRuntimeRegistration, type PluginOrigin, type PluginProviderRegistration, type PluginRecord, type PluginRegisterRuntime, type PluginRegistry, type PluginReplyDispatchParams, type PluginRuntime, type PluginRuntimeBridge, type PluginStatusReport, type PluginToolRegistration, type PluginUiMetadata, type UninstallActions, type UninstallPluginResult, type _CompatOnly, __nextclawPluginSdkCompat, addPluginLoadPath, buildChannelConfigSchema, buildOauthProviderAuthResult, buildPluginLoaderAliases, buildPluginStatusReport, createNextclawBuiltinChannelPlugin, createPluginRegisterRuntime, createPluginRuntime, disablePluginInConfig, discoverOpenClawPlugins, emptyPluginConfigSchema, enablePluginInConfig, getPackageManifestMetadata, getPluginChannelBindings, getPluginUiMetadataFromRegistry, installPluginFromArchive, installPluginFromDir, installPluginFromFile, installPluginFromNpmSpec, installPluginFromPath, loadOpenClawPlugins, loadPluginManifest, loadPluginManifestRegistry, loadPluginUiMetadata, mergePluginConfigView, normalizeAccountId, normalizePluginHttpPath, normalizePluginsConfig, recordPluginInstall, registerPluginWithApi, removePluginFromConfig, resolveEnableState, resolvePluginChannelMessageToolHints, resolvePluginInstallDir, resolvePluginManifestPath, resolveUninstallDirectoryTarget, resolveUninstallDirectoryTargets, setPluginRuntimeBridge, sleep, startPluginChannelGateways, stopPluginChannelGateways, toPluginConfigView, toPluginUiMetadata, uninstallPlugin, validateJsonSchemaValue };
package/dist/index.js CHANGED
@@ -241,6 +241,58 @@ function getPluginUiMetadataFromRegistry(registry) {
241
241
  configUiHints: plugin.configUiHints
242
242
  }));
243
243
  }
244
+ function cloneConfig(value) {
245
+ return JSON.parse(JSON.stringify(value));
246
+ }
247
+ function resolveProjectedPluginChannelEnabled(params) {
248
+ const channelEnabled = typeof params.channelConfig?.enabled === "boolean" ? params.channelConfig.enabled : false;
249
+ return params.entryEnabled !== false && channelEnabled;
250
+ }
251
+ function toPluginConfigView(config, bindings) {
252
+ const view = cloneConfig(config);
253
+ const channels = view.channels && typeof view.channels === "object" && !Array.isArray(view.channels) ? { ...view.channels } : {};
254
+ for (const binding of bindings) {
255
+ const pluginEntry = config.plugins.entries?.[binding.pluginId];
256
+ const pluginConfig = pluginEntry?.config;
257
+ const normalizedChannelConfig = pluginConfig && typeof pluginConfig === "object" && !Array.isArray(pluginConfig) ? cloneConfig(pluginConfig) : {};
258
+ channels[binding.channelId] = {
259
+ ...normalizedChannelConfig,
260
+ enabled: resolveProjectedPluginChannelEnabled({
261
+ entryEnabled: pluginEntry?.enabled,
262
+ channelConfig: normalizedChannelConfig
263
+ })
264
+ };
265
+ }
266
+ view.channels = channels;
267
+ return view;
268
+ }
269
+ function mergePluginConfigView(baseConfig, pluginViewConfig, bindings) {
270
+ const next = cloneConfig(baseConfig);
271
+ const pluginChannels = pluginViewConfig.channels && typeof pluginViewConfig.channels === "object" && !Array.isArray(pluginViewConfig.channels) ? pluginViewConfig.channels : {};
272
+ const entries = { ...next.plugins.entries ?? {} };
273
+ for (const binding of bindings) {
274
+ if (!Object.prototype.hasOwnProperty.call(pluginChannels, binding.channelId)) {
275
+ continue;
276
+ }
277
+ const channelConfig = pluginChannels[binding.channelId];
278
+ if (!channelConfig || typeof channelConfig !== "object" || Array.isArray(channelConfig)) {
279
+ continue;
280
+ }
281
+ const normalizedChannelConfig = cloneConfig(channelConfig);
282
+ const projectedEnabled = typeof normalizedChannelConfig.enabled === "boolean" ? normalizedChannelConfig.enabled : void 0;
283
+ const currentEntry = entries[binding.pluginId] ?? {};
284
+ entries[binding.pluginId] = {
285
+ ...currentEntry,
286
+ ...projectedEnabled === true ? { enabled: true } : {},
287
+ config: normalizedChannelConfig
288
+ };
289
+ }
290
+ next.plugins = {
291
+ ...next.plugins,
292
+ entries
293
+ };
294
+ return next;
295
+ }
244
296
  async function startPluginChannelGateways(params) {
245
297
  const logger = params.logger;
246
298
  const diagnostics = [];
@@ -2520,6 +2572,7 @@ export {
2520
2572
  loadPluginManifest,
2521
2573
  loadPluginManifestRegistry,
2522
2574
  loadPluginUiMetadata,
2575
+ mergePluginConfigView,
2523
2576
  normalizeAccountId,
2524
2577
  normalizePluginHttpPath,
2525
2578
  normalizePluginsConfig,
@@ -2536,6 +2589,7 @@ export {
2536
2589
  sleep,
2537
2590
  startPluginChannelGateways,
2538
2591
  stopPluginChannelGateways,
2592
+ toPluginConfigView,
2539
2593
  toPluginUiMetadata,
2540
2594
  uninstallPlugin,
2541
2595
  validateJsonSchemaValue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/openclaw-compat",
3
- "version": "0.3.14",
3
+ "version": "0.3.16",
4
4
  "private": false,
5
5
  "description": "OpenClaw plugin compatibility layer for NextClaw.",
6
6
  "type": "module",
@@ -21,19 +21,19 @@
21
21
  "tar": "^7.4.3",
22
22
  "@nextclaw/channel-plugin-dingtalk": "0.2.11",
23
23
  "@nextclaw/channel-plugin-discord": "0.2.11",
24
+ "@nextclaw/channel-plugin-slack": "0.2.11",
25
+ "@nextclaw/channel-plugin-telegram": "0.2.11",
24
26
  "@nextclaw/channel-plugin-email": "0.2.11",
25
- "@nextclaw/channel-plugin-feishu": "0.2.11",
27
+ "@nextclaw/channel-plugin-weixin": "0.1.4",
26
28
  "@nextclaw/channel-plugin-qq": "0.2.11",
27
29
  "@nextclaw/channel-plugin-mochat": "0.2.11",
28
- "@nextclaw/channel-plugin-telegram": "0.2.11",
29
- "@nextclaw/channel-plugin-slack": "0.2.11",
30
+ "@nextclaw/channel-plugin-feishu": "0.2.11",
31
+ "@nextclaw/channel-plugin-wecom": "0.2.11",
30
32
  "@nextclaw/core": "0.9.11",
33
+ "@nextclaw/channel-plugin-whatsapp": "0.2.11",
31
34
  "@nextclaw/channel-runtime": "0.2.11",
32
35
  "@nextclaw/ncp": "0.3.1",
33
- "@nextclaw/ncp-toolkit": "0.4.1",
34
- "@nextclaw/channel-plugin-wecom": "0.2.11",
35
- "@nextclaw/channel-plugin-whatsapp": "0.2.11",
36
- "@nextclaw/channel-plugin-weixin": "0.1.3"
36
+ "@nextclaw/ncp-toolkit": "0.4.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^20.17.6",