@clawchatsai/connector 0.0.23 → 0.0.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.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -17
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Spec: specs/multitenant-p2p.md sections 6.1-6.2
|
|
11
11
|
*/
|
|
12
12
|
export declare const PLUGIN_ID = "connector";
|
|
13
|
-
export declare const PLUGIN_VERSION = "0.0.
|
|
13
|
+
export declare const PLUGIN_VERSION = "0.0.24";
|
|
14
14
|
interface PluginServiceContext {
|
|
15
15
|
stateDir: string;
|
|
16
16
|
logger: {
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import { generateSessionSecret } from './session-token.js';
|
|
|
22
22
|
// Inline from shared/api-version.ts to avoid rootDir conflict
|
|
23
23
|
const CURRENT_API_VERSION = 1;
|
|
24
24
|
export const PLUGIN_ID = 'connector';
|
|
25
|
-
export const PLUGIN_VERSION = '0.0.
|
|
25
|
+
export const PLUGIN_VERSION = '0.0.24';
|
|
26
26
|
/** Max DataChannel message size (~256KB, leave room for envelope) */
|
|
27
27
|
const MAX_DC_MESSAGE_SIZE = 256 * 1024;
|
|
28
28
|
/** Active DataChannel connections: connectionId → send function */
|
|
@@ -62,24 +62,30 @@ function saveConfig(config) {
|
|
|
62
62
|
// ---------------------------------------------------------------------------
|
|
63
63
|
async function ensureNativeModules(ctx) {
|
|
64
64
|
// OpenClaw installs plugins with --ignore-scripts, which skips native module compilation.
|
|
65
|
-
// Check if
|
|
65
|
+
// Check if native modules are usable; if not, rebuild them automatically.
|
|
66
66
|
const pluginDir = path.resolve(__dirname, '..');
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
const modules = [
|
|
68
|
+
{ name: 'better-sqlite3', binding: 'build/Release/better_sqlite3.node' },
|
|
69
|
+
{ name: 'node-datachannel', binding: 'build/Release/node_datachannel.node' },
|
|
70
|
+
];
|
|
71
|
+
const missing = modules.filter(m => !fs.existsSync(path.join(pluginDir, 'node_modules', m.name, m.binding)));
|
|
72
|
+
if (missing.length === 0)
|
|
73
|
+
return; // all built
|
|
74
|
+
ctx.logger.info(`Building native modules (first run): ${missing.map(m => m.name).join(', ')}...`);
|
|
71
75
|
const { execFileSync } = await import('node:child_process');
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
for (const mod of missing) {
|
|
77
|
+
try {
|
|
78
|
+
execFileSync('npm', ['rebuild', mod.name], {
|
|
79
|
+
cwd: pluginDir,
|
|
80
|
+
stdio: 'pipe',
|
|
81
|
+
timeout: 120_000,
|
|
82
|
+
});
|
|
83
|
+
ctx.logger.info(`${mod.name} ready.`);
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
ctx.logger.error(`Failed to build ${mod.name}: ${e.message}`);
|
|
87
|
+
ctx.logger.error(`Try manually: cd ~/.openclaw/extensions/connector && npm rebuild ${mod.name}`);
|
|
88
|
+
}
|
|
83
89
|
}
|
|
84
90
|
}
|
|
85
91
|
async function startClawChats(ctx, api) {
|