@xmoxmo/bncr 0.3.1 → 0.3.2
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 +9 -2
- package/index.ts +12 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -251,6 +251,13 @@ var ensurePluginNodeModulesLink = (targetRoot) => {
|
|
|
251
251
|
}
|
|
252
252
|
fs.symlinkSync(targetRoot, linkPath, linkType);
|
|
253
253
|
};
|
|
254
|
+
var runtimeSourceDir = (() => {
|
|
255
|
+
const direct = path.join(pluginDir, "src");
|
|
256
|
+
if (fs.existsSync(path.join(direct, "channel.ts"))) return direct;
|
|
257
|
+
const parent = path.join(pluginDir, "..", "src");
|
|
258
|
+
if (fs.existsSync(path.join(parent, "channel.ts"))) return parent;
|
|
259
|
+
return direct;
|
|
260
|
+
})();
|
|
254
261
|
var ensureOpenClawSdkResolution = () => {
|
|
255
262
|
if (canResolveSdkCore()) return;
|
|
256
263
|
let lastError = "";
|
|
@@ -273,7 +280,7 @@ var loadRuntimeSync = () => {
|
|
|
273
280
|
if (runtime) return runtime;
|
|
274
281
|
ensureOpenClawSdkResolution();
|
|
275
282
|
try {
|
|
276
|
-
const mod = pluginRequire("
|
|
283
|
+
const mod = pluginRequire(path.join(runtimeSourceDir, "channel.ts"));
|
|
277
284
|
runtime = {
|
|
278
285
|
createBncrBridge: mod.createBncrBridge,
|
|
279
286
|
createBncrChannelPlugin: mod.createBncrChannelPlugin
|
|
@@ -281,7 +288,7 @@ var loadRuntimeSync = () => {
|
|
|
281
288
|
return runtime;
|
|
282
289
|
} catch (error) {
|
|
283
290
|
const detail = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
284
|
-
throw new Error(`bncr failed to load channel runtime after dependency bootstrap: ${detail}`);
|
|
291
|
+
throw new Error(`bncr failed to load channel runtime after dependency bootstrap from ${runtimeSourceDir}: ${detail}`);
|
|
285
292
|
}
|
|
286
293
|
};
|
|
287
294
|
var getIdentityId = (obj, prefix) => {
|
package/index.ts
CHANGED
|
@@ -251,6 +251,16 @@ const ensurePluginNodeModulesLink = (targetRoot: string) => {
|
|
|
251
251
|
fs.symlinkSync(targetRoot, linkPath, linkType as fs.symlink.Type);
|
|
252
252
|
};
|
|
253
253
|
|
|
254
|
+
const runtimeSourceDir = (() => {
|
|
255
|
+
const direct = path.join(pluginDir, 'src');
|
|
256
|
+
if (fs.existsSync(path.join(direct, 'channel.ts'))) return direct;
|
|
257
|
+
|
|
258
|
+
const parent = path.join(pluginDir, '..', 'src');
|
|
259
|
+
if (fs.existsSync(path.join(parent, 'channel.ts'))) return parent;
|
|
260
|
+
|
|
261
|
+
return direct;
|
|
262
|
+
})();
|
|
263
|
+
|
|
254
264
|
const ensureOpenClawSdkResolution = () => {
|
|
255
265
|
if (canResolveSdkCore()) return;
|
|
256
266
|
|
|
@@ -279,7 +289,7 @@ const loadRuntimeSync = (): LoadedRuntime => {
|
|
|
279
289
|
if (runtime) return runtime;
|
|
280
290
|
ensureOpenClawSdkResolution();
|
|
281
291
|
try {
|
|
282
|
-
const mod = pluginRequire('
|
|
292
|
+
const mod = pluginRequire(path.join(runtimeSourceDir, 'channel.ts')) as ChannelModule;
|
|
283
293
|
runtime = {
|
|
284
294
|
createBncrBridge: mod.createBncrBridge,
|
|
285
295
|
createBncrChannelPlugin: mod.createBncrChannelPlugin,
|
|
@@ -287,7 +297,7 @@ const loadRuntimeSync = (): LoadedRuntime => {
|
|
|
287
297
|
return runtime;
|
|
288
298
|
} catch (error) {
|
|
289
299
|
const detail = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
290
|
-
throw new Error(`bncr failed to load channel runtime after dependency bootstrap: ${detail}`);
|
|
300
|
+
throw new Error(`bncr failed to load channel runtime after dependency bootstrap from ${runtimeSourceDir}: ${detail}`);
|
|
291
301
|
}
|
|
292
302
|
};
|
|
293
303
|
|