@nextclaw/openclaw-compat 0.3.23 → 0.3.24

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.
Files changed (2) hide show
  1. package/dist/index.js +75 -28
  2. package/package.json +15 -15
package/dist/index.js CHANGED
@@ -1328,6 +1328,23 @@ function loadPluginUiMetadata(params) {
1328
1328
  return toPluginUiMetadata(registry.plugins);
1329
1329
  }
1330
1330
 
1331
+ // src/plugins/plugin-loader-jiti.ts
1332
+ import createJitiImport from "jiti";
1333
+ var createJiti = createJitiImport;
1334
+ function createPluginJiti(aliases) {
1335
+ return createJiti(import.meta.url, {
1336
+ interopDefault: true,
1337
+ esmResolve: true,
1338
+ extensions: [".ts", ".tsx", ".mts", ".cts", ".js", ".mjs", ".cjs", ".json"],
1339
+ alias: aliases,
1340
+ // Plugin install/upgrade is expected to hot-apply at runtime. Disable
1341
+ // Jiti's persistent/native require cache so a reload always sees the
1342
+ // latest plugin code on disk instead of reusing a stale in-memory module.
1343
+ requireCache: false,
1344
+ cache: false
1345
+ });
1346
+ }
1347
+
1331
1348
  // src/plugins/plugin-loader-aliases.ts
1332
1349
  import fs5 from "fs";
1333
1350
  import path5 from "path";
@@ -1361,6 +1378,31 @@ function resolvePluginSdkAliasFile(params) {
1361
1378
  function resolvePluginSdkAlias() {
1362
1379
  return resolvePluginSdkAliasFile({ srcFile: "index.ts", distFile: "index.js" });
1363
1380
  }
1381
+ function resolvePluginShimFile(relativePath) {
1382
+ try {
1383
+ const modulePath = fileURLToPath(import.meta.url);
1384
+ const isProduction = process.env.NODE_ENV === "production";
1385
+ let cursor = path5.dirname(modulePath);
1386
+ for (let i = 0; i < 6; i += 1) {
1387
+ const srcCandidate = path5.join(cursor, "src", "plugins", "shims", relativePath);
1388
+ const distCandidate = path5.join(cursor, "dist", "plugins", "shims", relativePath.replace(/\.ts$/, ".js"));
1389
+ const candidates = isProduction ? [distCandidate, srcCandidate] : [srcCandidate, distCandidate];
1390
+ for (const candidate of candidates) {
1391
+ if (fs5.existsSync(candidate)) {
1392
+ return candidate;
1393
+ }
1394
+ }
1395
+ const parent = path5.dirname(cursor);
1396
+ if (parent === cursor) {
1397
+ break;
1398
+ }
1399
+ cursor = parent;
1400
+ }
1401
+ } catch {
1402
+ return null;
1403
+ }
1404
+ return null;
1405
+ }
1364
1406
  function collectExportStringValues(value, values) {
1365
1407
  if (typeof value === "string") {
1366
1408
  values.push(value);
@@ -1463,23 +1505,33 @@ function buildPluginLoaderAliases(pluginRoot) {
1463
1505
  if (pluginSdkAlias && shouldUseCompatPluginSdkAlias) {
1464
1506
  aliases["openclaw/plugin-sdk"] = pluginSdkAlias;
1465
1507
  }
1508
+ const piCodingAgentShim = resolvePluginShimFile("pi-coding-agent.ts");
1509
+ if (piCodingAgentShim) {
1510
+ aliases["@mariozechner/pi-coding-agent"] = piCodingAgentShim;
1511
+ }
1466
1512
  return aliases;
1467
1513
  }
1468
1514
 
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
- });
1515
+ // src/plugins/bundled-plugin-loader.ts
1516
+ function resolveBundledPluginEntry(require2, packageName, diagnostics, resolvePackageRootFromEntry3) {
1517
+ try {
1518
+ const entryFile = require2.resolve(packageName);
1519
+ return {
1520
+ entryFile,
1521
+ rootDir: resolvePackageRootFromEntry3(entryFile)
1522
+ };
1523
+ } catch (err) {
1524
+ diagnostics.push({
1525
+ level: "error",
1526
+ source: packageName,
1527
+ message: `bundled plugin package not resolvable: ${String(err)}`
1528
+ });
1529
+ return null;
1530
+ }
1531
+ }
1532
+ function loadBundledPluginModule(entryFile, rootDir) {
1533
+ const pluginJiti = createPluginJiti(buildPluginLoaderAliases(rootDir));
1534
+ return pluginJiti(entryFile);
1483
1535
  }
1484
1536
 
1485
1537
  // src/plugins/schema-validator.ts
@@ -2086,22 +2138,19 @@ function resolvePluginModuleExport(moduleExport) {
2086
2138
  function appendBundledChannelPlugins(params) {
2087
2139
  const require2 = createRequire2(import.meta.url);
2088
2140
  for (const packageName of BUNDLED_CHANNEL_PLUGIN_PACKAGES) {
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
- });
2141
+ const resolvedEntry = resolveBundledPluginEntry(
2142
+ require2,
2143
+ packageName,
2144
+ params.registry.diagnostics,
2145
+ resolvePackageRootFromEntry
2146
+ );
2147
+ if (!resolvedEntry) {
2100
2148
  continue;
2101
2149
  }
2150
+ const { entryFile, rootDir } = resolvedEntry;
2102
2151
  let moduleExport = null;
2103
2152
  try {
2104
- moduleExport = params.jiti(entryFile);
2153
+ moduleExport = loadBundledPluginModule(entryFile, rootDir);
2105
2154
  } catch (err) {
2106
2155
  params.registry.diagnostics.push({
2107
2156
  level: "error",
@@ -2215,11 +2264,9 @@ function loadOpenClawPlugins(options) {
2215
2264
  reservedEngineKinds,
2216
2265
  reservedNcpAgentRuntimeKinds
2217
2266
  });
2218
- const bundledPluginJiti = createPluginJiti(buildPluginLoaderAliases());
2219
2267
  appendBundledChannelPlugins({
2220
2268
  registry,
2221
2269
  runtime: registerRuntime,
2222
- jiti: bundledPluginJiti,
2223
2270
  normalizedConfig: normalized
2224
2271
  });
2225
2272
  if (!loadExternalPlugins) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/openclaw-compat",
3
- "version": "0.3.23",
3
+ "version": "0.3.24",
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-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",
22
+ "@nextclaw/channel-plugin-dingtalk": "0.2.14",
23
+ "@nextclaw/channel-plugin-email": "0.2.14",
24
+ "@nextclaw/channel-plugin-discord": "0.2.14",
25
+ "@nextclaw/channel-plugin-feishu": "0.2.17",
26
+ "@nextclaw/channel-plugin-mochat": "0.2.14",
27
+ "@nextclaw/channel-plugin-slack": "0.2.14",
28
+ "@nextclaw/channel-plugin-telegram": "0.2.14",
29
+ "@nextclaw/channel-plugin-qq": "0.2.14",
30
+ "@nextclaw/channel-plugin-weixin": "0.1.8",
31
+ "@nextclaw/channel-plugin-wecom": "0.2.14",
32
+ "@nextclaw/channel-plugin-whatsapp": "0.2.14",
33
+ "@nextclaw/channel-runtime": "0.4.0",
34
+ "@nextclaw/core": "0.11.0",
32
35
  "@nextclaw/ncp": "0.3.2",
33
- "@nextclaw/ncp-toolkit": "0.4.2",
34
- "@nextclaw/channel-plugin-slack": "0.2.12",
35
- "@nextclaw/channel-plugin-telegram": "0.2.12",
36
- "@nextclaw/channel-plugin-whatsapp": "0.2.12"
36
+ "@nextclaw/ncp-toolkit": "0.4.2"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^20.17.6",