@clawchatsai/connector 0.0.54 → 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
@@ -213,7 +213,16 @@ async function startClawChats(ctx, api, mediaStash) {
213
213
  }
214
214
  });
215
215
  // 5. Connect to signaling server
216
- 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
+ });
217
226
  signaling.on('connected', () => {
218
227
  ctx.logger.info('Connected to signaling server');
219
228
  });
@@ -755,6 +764,7 @@ async function handleSetup(token) {
755
764
  userId: msg.userId,
756
765
  serverUrl: tokenData.serverUrl,
757
766
  apiKey,
767
+ gatewayId: msg.gatewayId,
758
768
  gatewayToken,
759
769
  schemaVersion: 1,
760
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.54",
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",