@clawchatsai/connector 0.0.53 → 0.0.55

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.
@@ -13,6 +13,7 @@ export interface PluginConfig {
13
13
  userId: string;
14
14
  serverUrl: string;
15
15
  apiKey: string;
16
+ gatewayId?: string;
16
17
  gatewayToken?: string;
17
18
  devicePrivateKey?: string;
18
19
  schemaVersion: number;
package/dist/index.js CHANGED
@@ -163,6 +163,26 @@ async function startClawChats(ctx, api, mediaStash) {
163
163
  ctx.logger.error('No gateway token available. Re-run: openclaw clawchats setup <token>');
164
164
  return;
165
165
  }
166
+ // Check for model definitions with 'input' set but missing 'image' — they silently drop attachments.
167
+ _imageRestrictedModels = [];
168
+ try {
169
+ const providers = gwCfg?.['models']?.['providers'] ?? {};
170
+ for (const provider of Object.values(providers)) {
171
+ if (Array.isArray(provider.models)) {
172
+ for (const m of provider.models) {
173
+ if (Array.isArray(m.input) && !m.input.includes('image')) {
174
+ _imageRestrictedModels.push(m.id ?? '(unknown)');
175
+ }
176
+ }
177
+ }
178
+ }
179
+ if (_imageRestrictedModels.length > 0) {
180
+ ctx.logger.warn(`[clawchats] image-restricted models detected (missing "image" input): ${_imageRestrictedModels.join(', ')}`);
181
+ }
182
+ }
183
+ catch {
184
+ // Non-fatal: config parse issue, just skip the check
185
+ }
166
186
  // 3. Ensure native modules are built (OpenClaw installs with --ignore-scripts)
167
187
  await ensureNativeModules(ctx);
168
188
  // 4. Import server.js and create app instance with plugin paths
@@ -193,7 +213,16 @@ async function startClawChats(ctx, api, mediaStash) {
193
213
  }
194
214
  });
195
215
  // 5. Connect to signaling server
196
- signaling = new SignalingClient(config.serverUrl, config.userId, config.apiKey);
216
+ const _hostname = (() => { try {
217
+ return require('os').hostname();
218
+ }
219
+ catch {
220
+ return undefined;
221
+ } })();
222
+ signaling = new SignalingClient(config.serverUrl, config.userId, config.apiKey, {
223
+ gatewayId: config.gatewayId,
224
+ hostname: _hostname,
225
+ });
197
226
  signaling.on('connected', () => {
198
227
  ctx.logger.info('Connected to signaling server');
199
228
  });
@@ -412,9 +441,8 @@ function setupDataChannelHandler(dc, connectionId, ctx) {
412
441
  // Warn if any models have image support disabled in openclaw.json
413
442
  if (_imageRestrictedModels.length > 0) {
414
443
  dc.send(JSON.stringify({
415
- type: 'clawchats',
416
- event: 'image-capability-warning',
417
- models: _imageRestrictedModels,
444
+ type: 'gateway-event',
445
+ payload: JSON.stringify({ type: 'clawchats', event: 'image-capability-warning', models: _imageRestrictedModels }),
418
446
  }));
419
447
  }
420
448
  // Persist backup code changes if any were consumed
@@ -700,14 +728,6 @@ async function handleSetup(token) {
700
728
  const openclawConfigPath = path.join(process.env.HOME || '/root', '.openclaw', 'openclaw.json');
701
729
  const openclawConfig = JSON.parse(fs.readFileSync(openclawConfigPath, 'utf8'));
702
730
  gatewayToken = openclawConfig.gateway?.auth?.token || openclawConfig.auth?.token || openclawConfig.token || '';
703
- // Check for model definitions that have 'input' set without 'image' — these silently drop image attachments.
704
- const modelDefs = openclawConfig?.models?.definitions ?? [];
705
- _imageRestrictedModels = modelDefs
706
- .filter(def => Array.isArray(def.input) && !def.input.includes('image'))
707
- .map(def => def.id ?? '(unknown)');
708
- if (_imageRestrictedModels.length > 0) {
709
- console.warn(`[clawchats] image-restricted models detected: ${_imageRestrictedModels.join(', ')}`);
710
- }
711
731
  }
712
732
  catch {
713
733
  console.error('Could not read gateway token from ~/.openclaw/openclaw.json');
@@ -744,6 +764,7 @@ async function handleSetup(token) {
744
764
  userId: msg.userId,
745
765
  serverUrl: tokenData.serverUrl,
746
766
  apiKey,
767
+ gatewayId: msg.gatewayId,
747
768
  gatewayToken,
748
769
  schemaVersion: 1,
749
770
  installedAt: new Date().toISOString(),
@@ -17,6 +17,8 @@ export declare class SignalingClient extends EventEmitter {
17
17
  private readonly serverUrl;
18
18
  private readonly userId;
19
19
  private readonly apiKey;
20
+ private readonly gatewayId?;
21
+ private readonly hostname?;
20
22
  private ws;
21
23
  /** True only after gateway-auth-ok has been received. */
22
24
  private _connected;
@@ -31,7 +33,10 @@ export declare class SignalingClient extends EventEmitter {
31
33
  private reconnectTimer;
32
34
  /** Timer handle for ping-timeout watchdog. */
33
35
  private pingWatchdog;
34
- constructor(serverUrl: string, userId: string, apiKey: string);
36
+ constructor(serverUrl: string, userId: string, apiKey: string, opts?: {
37
+ gatewayId?: string;
38
+ hostname?: string;
39
+ });
35
40
  /** Returns true when gateway-auth-ok has been received on the current socket. */
36
41
  get isConnected(): boolean;
37
42
  /**
@@ -33,6 +33,8 @@ export class SignalingClient extends EventEmitter {
33
33
  serverUrl;
34
34
  userId;
35
35
  apiKey;
36
+ gatewayId;
37
+ hostname;
36
38
  ws = null;
37
39
  /** True only after gateway-auth-ok has been received. */
38
40
  _connected = false;
@@ -47,11 +49,13 @@ export class SignalingClient extends EventEmitter {
47
49
  reconnectTimer = null;
48
50
  /** Timer handle for ping-timeout watchdog. */
49
51
  pingWatchdog = null;
50
- constructor(serverUrl, userId, apiKey) {
52
+ constructor(serverUrl, userId, apiKey, opts) {
51
53
  super();
52
54
  this.serverUrl = serverUrl;
53
55
  this.userId = userId;
54
56
  this.apiKey = apiKey;
57
+ this.gatewayId = opts?.gatewayId;
58
+ this.hostname = opts?.hostname;
55
59
  }
56
60
  // -------------------------------------------------------------------------
57
61
  // Public API
@@ -132,6 +136,8 @@ export class SignalingClient extends EventEmitter {
132
136
  userId: this.userId,
133
137
  apiKey: this.apiKey,
134
138
  pluginVersion: PLUGIN_VERSION,
139
+ ...(this.gatewayId ? { gatewayId: this.gatewayId } : {}),
140
+ ...(this.hostname ? { hostname: this.hostname } : {}),
135
141
  });
136
142
  // Resolve the connect() promise: the socket is open and auth is in flight
137
143
  settle();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawchatsai/connector",
3
- "version": "0.0.53",
3
+ "version": "0.0.55",
4
4
  "type": "module",
5
5
  "description": "ClawChats OpenClaw plugin — P2P tunnel + local API bridge",
6
6
  "main": "dist/index.js",