@nextclaw/openclaw-compat 0.3.19 → 0.3.21
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.js +48 -29
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -1324,6 +1324,23 @@ function loadPluginUiMetadata(params) {
|
|
|
1324
1324
|
return toPluginUiMetadata(registry.plugins);
|
|
1325
1325
|
}
|
|
1326
1326
|
|
|
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
|
+
|
|
1327
1344
|
// src/plugins/plugin-loader-aliases.ts
|
|
1328
1345
|
import fs5 from "fs";
|
|
1329
1346
|
import path5 from "path";
|
|
@@ -1455,26 +1472,33 @@ function buildScopedPackageAliases(scope, pluginRoot) {
|
|
|
1455
1472
|
function buildPluginLoaderAliases(pluginRoot) {
|
|
1456
1473
|
const aliases = buildScopedPackageAliases("@nextclaw", pluginRoot);
|
|
1457
1474
|
const pluginSdkAlias = resolvePluginSdkAlias();
|
|
1458
|
-
|
|
1475
|
+
const shouldUseCompatPluginSdkAlias = shouldAliasHostPackage(pluginRoot, "openclaw");
|
|
1476
|
+
if (pluginSdkAlias && shouldUseCompatPluginSdkAlias) {
|
|
1459
1477
|
aliases["openclaw/plugin-sdk"] = pluginSdkAlias;
|
|
1460
1478
|
}
|
|
1461
1479
|
return aliases;
|
|
1462
1480
|
}
|
|
1463
1481
|
|
|
1464
|
-
// src/plugins/plugin-loader
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
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);
|
|
1478
1502
|
}
|
|
1479
1503
|
|
|
1480
1504
|
// src/plugins/schema-validator.ts
|
|
@@ -2081,22 +2105,19 @@ function resolvePluginModuleExport(moduleExport) {
|
|
|
2081
2105
|
function appendBundledChannelPlugins(params) {
|
|
2082
2106
|
const require2 = createRequire2(import.meta.url);
|
|
2083
2107
|
for (const packageName of BUNDLED_CHANNEL_PLUGIN_PACKAGES) {
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
level: "error",
|
|
2092
|
-
source: packageName,
|
|
2093
|
-
message: `bundled plugin package not resolvable: ${String(err)}`
|
|
2094
|
-
});
|
|
2108
|
+
const resolvedEntry = resolveBundledPluginEntry(
|
|
2109
|
+
require2,
|
|
2110
|
+
packageName,
|
|
2111
|
+
params.registry.diagnostics,
|
|
2112
|
+
resolvePackageRootFromEntry
|
|
2113
|
+
);
|
|
2114
|
+
if (!resolvedEntry) {
|
|
2095
2115
|
continue;
|
|
2096
2116
|
}
|
|
2117
|
+
const { entryFile, rootDir } = resolvedEntry;
|
|
2097
2118
|
let moduleExport = null;
|
|
2098
2119
|
try {
|
|
2099
|
-
moduleExport =
|
|
2120
|
+
moduleExport = loadBundledPluginModule(entryFile, rootDir);
|
|
2100
2121
|
} catch (err) {
|
|
2101
2122
|
params.registry.diagnostics.push({
|
|
2102
2123
|
level: "error",
|
|
@@ -2210,11 +2231,9 @@ function loadOpenClawPlugins(options) {
|
|
|
2210
2231
|
reservedEngineKinds,
|
|
2211
2232
|
reservedNcpAgentRuntimeKinds
|
|
2212
2233
|
});
|
|
2213
|
-
const bundledPluginJiti = createPluginJiti(buildPluginLoaderAliases());
|
|
2214
2234
|
appendBundledChannelPlugins({
|
|
2215
2235
|
registry,
|
|
2216
2236
|
runtime: registerRuntime,
|
|
2217
|
-
jiti: bundledPluginJiti,
|
|
2218
2237
|
normalizedConfig: normalized
|
|
2219
2238
|
});
|
|
2220
2239
|
if (!loadExternalPlugins) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/openclaw-compat",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
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-discord": "0.2.13",
|
|
23
|
-
"@nextclaw/channel-plugin-qq": "0.2.13",
|
|
24
|
-
"@nextclaw/channel-plugin-mochat": "0.2.13",
|
|
25
22
|
"@nextclaw/channel-plugin-dingtalk": "0.2.13",
|
|
26
|
-
"@nextclaw/channel-plugin-
|
|
23
|
+
"@nextclaw/channel-plugin-feishu": "0.2.15",
|
|
24
|
+
"@nextclaw/channel-plugin-email": "0.2.13",
|
|
27
25
|
"@nextclaw/channel-plugin-slack": "0.2.13",
|
|
28
|
-
"@nextclaw/
|
|
26
|
+
"@nextclaw/channel-plugin-discord": "0.2.13",
|
|
29
27
|
"@nextclaw/channel-runtime": "0.3.0",
|
|
28
|
+
"@nextclaw/channel-plugin-weixin": "0.1.7",
|
|
29
|
+
"@nextclaw/channel-plugin-mochat": "0.2.13",
|
|
30
30
|
"@nextclaw/ncp": "0.3.2",
|
|
31
|
-
"@nextclaw/channel-plugin-
|
|
32
|
-
"@nextclaw/channel-plugin-
|
|
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/
|
|
34
|
+
"@nextclaw/core": "0.10.0",
|
|
35
35
|
"@nextclaw/channel-plugin-whatsapp": "0.2.13",
|
|
36
|
-
"@nextclaw/channel-plugin-
|
|
36
|
+
"@nextclaw/channel-plugin-telegram": "0.2.13"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^20.17.6",
|