@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 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.23";
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.23';
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 better-sqlite3 is usable; if not, rebuild it automatically.
65
+ // Check if native modules are usable; if not, rebuild them automatically.
66
66
  const pluginDir = path.resolve(__dirname, '..');
67
- const bindingPath = path.join(pluginDir, 'node_modules', 'better-sqlite3', 'build', 'Release', 'better_sqlite3.node');
68
- if (fs.existsSync(bindingPath))
69
- return; // already built
70
- ctx.logger.info('Building native modules (first run)...');
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
- try {
73
- execFileSync('npm', ['rebuild', 'better-sqlite3'], {
74
- cwd: pluginDir,
75
- stdio: 'pipe',
76
- timeout: 120_000,
77
- });
78
- ctx.logger.info('Native modules ready.');
79
- }
80
- catch (e) {
81
- ctx.logger.error(`Failed to build native modules: ${e.message}`);
82
- ctx.logger.error('Try running manually: cd ~/.openclaw/extensions/connector && npm rebuild better-sqlite3');
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawchatsai/connector",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "type": "module",
5
5
  "description": "ClawChats OpenClaw plugin — P2P tunnel + local API bridge",
6
6
  "main": "dist/index.js",