@clawchatsai/connector 0.0.26 → 0.0.28
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 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13,7 +13,6 @@ import * as fs from 'node:fs';
|
|
|
13
13
|
import * as http from 'node:http';
|
|
14
14
|
import * as path from 'node:path';
|
|
15
15
|
import { SignalingClient } from './signaling-client.js';
|
|
16
|
-
import { WebRTCPeerManager } from './webrtc-peer.js';
|
|
17
16
|
import { dispatchRpc } from './shim.js';
|
|
18
17
|
import { checkForUpdates, performUpdate } from './updater.js';
|
|
19
18
|
import { initAuth, handleAuthMessage, cleanupAuth } from './auth-handler.js';
|
|
@@ -83,11 +82,17 @@ async function ensureNativeModules(ctx) {
|
|
|
83
82
|
const modPkg = JSON.parse(fs.readFileSync(path.join(modDir, 'package.json'), 'utf-8'));
|
|
84
83
|
const installCmd = modPkg.scripts?.install;
|
|
85
84
|
if (installCmd) {
|
|
85
|
+
// Add local .bin dirs to PATH so prebuild-install and other local binaries resolve.
|
|
86
|
+
// Check both the module's own node_modules/.bin (hoisted deps) and the plugin-level one.
|
|
87
|
+
const localBin = [
|
|
88
|
+
path.join(modDir, 'node_modules', '.bin'),
|
|
89
|
+
path.join(pluginDir, 'node_modules', '.bin'),
|
|
90
|
+
].join(':');
|
|
86
91
|
execFileSync('sh', ['-c', installCmd], {
|
|
87
92
|
cwd: modDir,
|
|
88
93
|
stdio: 'pipe',
|
|
89
94
|
timeout: 120_000,
|
|
90
|
-
env: { ...process.env, npm_config_node_gyp: '' },
|
|
95
|
+
env: { ...process.env, PATH: `${localBin}:${process.env.PATH ?? ''}`, npm_config_node_gyp: '' },
|
|
91
96
|
});
|
|
92
97
|
}
|
|
93
98
|
else {
|
|
@@ -204,7 +209,8 @@ async function startClawChats(ctx, api) {
|
|
|
204
209
|
ctx.logger.error(`Account suspended: ${reason}`);
|
|
205
210
|
broadcastToClients({ type: 'account-suspended', reason });
|
|
206
211
|
});
|
|
207
|
-
// 6. Initialize WebRTC peer manager
|
|
212
|
+
// 6. Initialize WebRTC peer manager (lazy import — native module must be built first)
|
|
213
|
+
const { WebRTCPeerManager } = await import('./webrtc-peer.js');
|
|
208
214
|
webrtcPeer = new WebRTCPeerManager();
|
|
209
215
|
webrtcPeer.on('datachannel', (dc, connectionId) => {
|
|
210
216
|
ctx.logger.info(`Browser connected via DataChannel: ${connectionId}`);
|