@nextclaw/openclaw-compat 0.3.21 → 0.3.23

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
@@ -478,6 +478,7 @@ declare function toPluginConfigView(config: Config, bindings: PluginChannelBindi
478
478
  declare function mergePluginConfigView(baseConfig: Config, pluginViewConfig: Record<string, unknown>, bindings: PluginChannelBinding[]): Config;
479
479
  declare function startPluginChannelGateways(params: {
480
480
  registry: PluginRegistry;
481
+ config?: Config;
481
482
  logger?: PluginLogger;
482
483
  }): Promise<{
483
484
  handles: PluginChannelGatewayHandle[];
package/dist/index.js CHANGED
@@ -297,12 +297,16 @@ async function startPluginChannelGateways(params) {
297
297
  const logger = params.logger;
298
298
  const diagnostics = [];
299
299
  const handles = [];
300
- for (const binding of getPluginChannelBindings(params.registry)) {
300
+ const bindings = getPluginChannelBindings(params.registry);
301
+ const configView = params.config ? toPluginConfigView(params.config, bindings) : void 0;
302
+ for (const binding of bindings) {
301
303
  const gateway = binding.channel.gateway;
302
304
  if (!gateway?.startAccount) {
303
305
  continue;
304
306
  }
305
- const accountIdsRaw = binding.channel.config?.listAccountIds?.() ?? [binding.channel.config?.defaultAccountId?.() ?? "default"];
307
+ const accountIdsRaw = binding.channel.config?.listAccountIds?.(configView) ?? [
308
+ binding.channel.config?.defaultAccountId?.(configView) ?? "default"
309
+ ];
306
310
  const accountIds = Array.from(
307
311
  new Set(accountIdsRaw.map((id) => typeof id === "string" ? id.trim() : "").filter(Boolean))
308
312
  );
@@ -1324,23 +1328,6 @@ function loadPluginUiMetadata(params) {
1324
1328
  return toPluginUiMetadata(registry.plugins);
1325
1329
  }
1326
1330
 
1327
- // src/plugins/plugin-loader-jiti.ts
1328
- import createJitiImport from "jiti";
1329
- var createJiti = createJitiImport;
1330
- function createPluginJiti(aliases) {
1331
- return createJiti(import.meta.url, {
1332
- interopDefault: true,
1333
- esmResolve: true,
1334
- extensions: [".ts", ".tsx", ".mts", ".cts", ".js", ".mjs", ".cjs", ".json"],
1335
- alias: aliases,
1336
- // Plugin install/upgrade is expected to hot-apply at runtime. Disable
1337
- // Jiti's persistent/native require cache so a reload always sees the
1338
- // latest plugin code on disk instead of reusing a stale in-memory module.
1339
- requireCache: false,
1340
- cache: false
1341
- });
1342
- }
1343
-
1344
1331
  // src/plugins/plugin-loader-aliases.ts
1345
1332
  import fs5 from "fs";
1346
1333
  import path5 from "path";
@@ -1479,26 +1466,20 @@ function buildPluginLoaderAliases(pluginRoot) {
1479
1466
  return aliases;
1480
1467
  }
1481
1468
 
1482
- // src/plugins/bundled-plugin-loader.ts
1483
- function resolveBundledPluginEntry(require2, packageName, diagnostics, resolvePackageRootFromEntry3) {
1484
- try {
1485
- const entryFile = require2.resolve(packageName);
1486
- return {
1487
- entryFile,
1488
- rootDir: resolvePackageRootFromEntry3(entryFile)
1489
- };
1490
- } catch (err) {
1491
- diagnostics.push({
1492
- level: "error",
1493
- source: packageName,
1494
- message: `bundled plugin package not resolvable: ${String(err)}`
1495
- });
1496
- return null;
1497
- }
1498
- }
1499
- function loadBundledPluginModule(entryFile, rootDir) {
1500
- const pluginJiti = createPluginJiti(buildPluginLoaderAliases(rootDir));
1501
- return pluginJiti(entryFile);
1469
+ // src/plugins/plugin-loader-jiti.ts
1470
+ import createJitiImport from "jiti";
1471
+ var createJiti = createJitiImport;
1472
+ function createPluginJiti(aliases) {
1473
+ return createJiti(import.meta.url, {
1474
+ interopDefault: true,
1475
+ extensions: [".ts", ".tsx", ".mts", ".cts", ".js", ".mjs", ".cjs", ".json"],
1476
+ alias: aliases,
1477
+ // Plugin install/upgrade is expected to hot-apply at runtime. Disable
1478
+ // Jiti's persistent/native require cache so a reload always sees the
1479
+ // latest plugin code on disk instead of reusing a stale in-memory module.
1480
+ requireCache: false,
1481
+ cache: false
1482
+ });
1502
1483
  }
1503
1484
 
1504
1485
  // src/plugins/schema-validator.ts
@@ -2105,19 +2086,22 @@ function resolvePluginModuleExport(moduleExport) {
2105
2086
  function appendBundledChannelPlugins(params) {
2106
2087
  const require2 = createRequire2(import.meta.url);
2107
2088
  for (const packageName of BUNDLED_CHANNEL_PLUGIN_PACKAGES) {
2108
- const resolvedEntry = resolveBundledPluginEntry(
2109
- require2,
2110
- packageName,
2111
- params.registry.diagnostics,
2112
- resolvePackageRootFromEntry
2113
- );
2114
- if (!resolvedEntry) {
2089
+ let entryFile = "";
2090
+ let rootDir = "";
2091
+ try {
2092
+ entryFile = require2.resolve(packageName);
2093
+ rootDir = resolvePackageRootFromEntry(entryFile);
2094
+ } catch (err) {
2095
+ params.registry.diagnostics.push({
2096
+ level: "error",
2097
+ source: packageName,
2098
+ message: `bundled plugin package not resolvable: ${String(err)}`
2099
+ });
2115
2100
  continue;
2116
2101
  }
2117
- const { entryFile, rootDir } = resolvedEntry;
2118
2102
  let moduleExport = null;
2119
2103
  try {
2120
- moduleExport = loadBundledPluginModule(entryFile, rootDir);
2104
+ moduleExport = params.jiti(entryFile);
2121
2105
  } catch (err) {
2122
2106
  params.registry.diagnostics.push({
2123
2107
  level: "error",
@@ -2231,9 +2215,11 @@ function loadOpenClawPlugins(options) {
2231
2215
  reservedEngineKinds,
2232
2216
  reservedNcpAgentRuntimeKinds
2233
2217
  });
2218
+ const bundledPluginJiti = createPluginJiti(buildPluginLoaderAliases());
2234
2219
  appendBundledChannelPlugins({
2235
2220
  registry,
2236
2221
  runtime: registerRuntime,
2222
+ jiti: bundledPluginJiti,
2237
2223
  normalizedConfig: normalized
2238
2224
  });
2239
2225
  if (!loadExternalPlugins) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/openclaw-compat",
3
- "version": "0.3.21",
3
+ "version": "0.3.23",
4
4
  "private": false,
5
5
  "description": "OpenClaw plugin compatibility layer for NextClaw.",
6
6
  "type": "module",
@@ -19,21 +19,21 @@
19
19
  "jiti": "^1.21.7",
20
20
  "jszip": "^3.10.1",
21
21
  "tar": "^7.4.3",
22
- "@nextclaw/channel-plugin-dingtalk": "0.2.13",
23
- "@nextclaw/channel-plugin-feishu": "0.2.15",
24
- "@nextclaw/channel-plugin-email": "0.2.13",
25
- "@nextclaw/channel-plugin-slack": "0.2.13",
26
- "@nextclaw/channel-plugin-discord": "0.2.13",
27
- "@nextclaw/channel-runtime": "0.3.0",
28
- "@nextclaw/channel-plugin-weixin": "0.1.7",
29
- "@nextclaw/channel-plugin-mochat": "0.2.13",
22
+ "@nextclaw/channel-plugin-feishu": "0.2.16",
23
+ "@nextclaw/channel-plugin-dingtalk": "0.2.12",
24
+ "@nextclaw/channel-plugin-email": "0.2.12",
25
+ "@nextclaw/channel-plugin-discord": "0.2.12",
26
+ "@nextclaw/channel-plugin-mochat": "0.2.12",
27
+ "@nextclaw/channel-plugin-qq": "0.2.12",
28
+ "@nextclaw/channel-plugin-wecom": "0.2.12",
29
+ "@nextclaw/channel-plugin-weixin": "0.1.6",
30
+ "@nextclaw/channel-runtime": "0.2.12",
31
+ "@nextclaw/core": "0.9.12",
30
32
  "@nextclaw/ncp": "0.3.2",
31
- "@nextclaw/channel-plugin-wecom": "0.2.13",
32
- "@nextclaw/channel-plugin-qq": "0.2.13",
33
33
  "@nextclaw/ncp-toolkit": "0.4.2",
34
- "@nextclaw/core": "0.10.0",
35
- "@nextclaw/channel-plugin-whatsapp": "0.2.13",
36
- "@nextclaw/channel-plugin-telegram": "0.2.13"
34
+ "@nextclaw/channel-plugin-slack": "0.2.12",
35
+ "@nextclaw/channel-plugin-telegram": "0.2.12",
36
+ "@nextclaw/channel-plugin-whatsapp": "0.2.12"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^20.17.6",