@clawchatsai/connector 0.0.2 → 0.0.4

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
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * Spec: specs/multitenant-p2p.md sections 6.1-6.2
11
11
  */
12
- export declare const PLUGIN_ID = "tunnel";
12
+ export declare const PLUGIN_ID = "connector";
13
13
  export declare const PLUGIN_VERSION = "0.0.1";
14
14
  interface PluginServiceContext {
15
15
  stateDir: string;
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ import { dispatchRpc } from './shim.js';
18
18
  import { checkForUpdates, performUpdate } from './updater.js';
19
19
  // Inline from shared/api-version.ts to avoid rootDir conflict
20
20
  const CURRENT_API_VERSION = 1;
21
- export const PLUGIN_ID = 'tunnel';
21
+ export const PLUGIN_ID = 'connector';
22
22
  export const PLUGIN_VERSION = '0.0.1';
23
23
  /** Max DataChannel message size (~256KB, leave room for envelope) */
24
24
  const MAX_DC_MESSAGE_SIZE = 256 * 1024;
@@ -31,7 +31,7 @@ let healthServer = null;
31
31
  // ---------------------------------------------------------------------------
32
32
  // Config helpers
33
33
  // ---------------------------------------------------------------------------
34
- const CONFIG_DIR = path.join(process.env.HOME || '/root', '.openclaw', 'shellchat');
34
+ const CONFIG_DIR = path.join(process.env.HOME || '/root', '.openclaw', 'shellchats');
35
35
  const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
36
36
  const RUNTIME_FILE = path.join(CONFIG_DIR, 'runtime.json');
37
37
  function loadConfig() {
@@ -53,7 +53,7 @@ function loadConfig() {
53
53
  async function startShellChat(ctx, api) {
54
54
  const config = loadConfig();
55
55
  if (!config) {
56
- ctx.logger.info('ShellChat not configured. Run: openclaw shellchat setup <token>');
56
+ ctx.logger.info('ShellChats not configured. Run: openclaw shellchats setup <token>');
57
57
  return;
58
58
  }
59
59
  // 1. Check for updates
@@ -64,7 +64,7 @@ async function startShellChat(ctx, api) {
64
64
  try {
65
65
  await performUpdate();
66
66
  ctx.logger.info(`Updated to ${update.latest}. Requesting graceful restart...`);
67
- api.runtime.requestRestart?.('shellchat update');
67
+ api.runtime.requestRestart?.('shellchats update');
68
68
  return; // will restart with new version
69
69
  }
70
70
  catch (e) {
@@ -77,12 +77,12 @@ async function startShellChat(ctx, api) {
77
77
  const gwAuth = gwCfg?.['gateway']?.['auth'];
78
78
  const gatewayToken = gwAuth?.['token'] || config.gatewayToken || '';
79
79
  if (!gatewayToken) {
80
- ctx.logger.error('No gateway token available. Re-run: openclaw shellchat setup <token>');
80
+ ctx.logger.error('No gateway token available. Re-run: openclaw shellchats setup <token>');
81
81
  return;
82
82
  }
83
83
  // 3. Import server.js and create app instance with plugin paths
84
- const dataDir = path.join(ctx.stateDir, 'shellchat', 'data');
85
- const uploadsDir = path.join(ctx.stateDir, 'shellchat', 'uploads');
84
+ const dataDir = path.join(ctx.stateDir, 'shellchats', 'data');
85
+ const uploadsDir = path.join(ctx.stateDir, 'shellchats', 'uploads');
86
86
  // Dynamic import of server.js (plain JS, no type declarations)
87
87
  // @ts-expect-error — server.js is plain JS with no .d.ts
88
88
  const serverModule = await import('../server.js');
@@ -375,10 +375,10 @@ async function handleSetup(token) {
375
375
  return;
376
376
  }
377
377
  if (new Date(tokenData.expiresAt) < new Date()) {
378
- console.error('Setup token has expired. Generate a new one from shellchat.example.com.');
378
+ console.error('Setup token has expired. Generate a new one from clawchats.ai.');
379
379
  return;
380
380
  }
381
- console.log('Setting up ShellChat...');
381
+ console.log('Setting up ShellChats...');
382
382
  console.log(` Server: ${tokenData.serverUrl}`);
383
383
  // Generate API key for signaling server auth
384
384
  const { randomBytes } = await import('node:crypto');
@@ -435,8 +435,8 @@ async function handleSetup(token) {
435
435
  const uploadsDir = path.join(CONFIG_DIR, 'uploads');
436
436
  fs.mkdirSync(dataDir, { recursive: true });
437
437
  fs.mkdirSync(uploadsDir, { recursive: true });
438
- console.log(' ShellChat is ready!');
439
- console.log(' Open shellchat.example.com in your browser to start chatting.');
438
+ console.log(' ShellChats is ready!');
439
+ console.log(' Open clawchats.ai in your browser to start chatting.');
440
440
  ws.close();
441
441
  resolve();
442
442
  }
@@ -460,7 +460,7 @@ async function handleStatus() {
460
460
  runtime = JSON.parse(fs.readFileSync(RUNTIME_FILE, 'utf8'));
461
461
  }
462
462
  catch {
463
- console.log('ShellChat: offline (service not running)');
463
+ console.log('ShellChats: offline (service not running)');
464
464
  return;
465
465
  }
466
466
  // Verify PID is alive
@@ -468,7 +468,7 @@ async function handleStatus() {
468
468
  process.kill(runtime.pid, 0);
469
469
  }
470
470
  catch {
471
- console.log('ShellChat: offline (stale runtime file)');
471
+ console.log('ShellChats: offline (stale runtime file)');
472
472
  try {
473
473
  fs.unlinkSync(RUNTIME_FILE);
474
474
  }
@@ -487,20 +487,20 @@ async function handleStatus() {
487
487
  req.setTimeout(3000, () => { req.destroy(); reject(new Error('timeout')); });
488
488
  });
489
489
  const status = JSON.parse(body);
490
- console.log(`ShellChat Plugin v${status.version}`);
490
+ console.log(`ShellChats Plugin v${status.version}`);
491
491
  console.log(`Uptime: ${Math.floor(status.uptime)}s`);
492
492
  console.log(`Gateway: ${status.gateway.connected ? 'connected' : 'disconnected'}`);
493
493
  console.log(`Signaling: ${status.signaling.connected ? 'connected' : 'disconnected'}`);
494
494
  console.log(`Clients: ${status.clients.active}`);
495
495
  }
496
496
  catch {
497
- console.log('ShellChat: offline (could not reach service)');
497
+ console.log('ShellChats: offline (could not reach service)');
498
498
  }
499
499
  }
500
500
  async function handleReset() {
501
501
  try {
502
502
  fs.rmSync(CONFIG_DIR, { recursive: true, force: true });
503
- console.log('ShellChat data removed. Plugin disconnected.');
503
+ console.log('ShellChats data removed. Plugin disconnected.');
504
504
  }
505
505
  catch (e) {
506
506
  console.error(`Reset failed: ${e.message}`);
@@ -511,32 +511,32 @@ async function handleReset() {
511
511
  // ---------------------------------------------------------------------------
512
512
  const plugin = {
513
513
  id: PLUGIN_ID,
514
- name: 'ShellChat',
515
- description: 'Connects your gateway to ShellChat via WebRTC P2P',
514
+ name: 'ShellChats',
515
+ description: 'Connects your gateway to ShellChats via WebRTC P2P',
516
516
  register(api) {
517
517
  // Background service: signaling + gateway bridge + future WebRTC
518
518
  api.registerService({
519
- id: 'shellchat-service',
519
+ id: 'connector-service',
520
520
  start: (ctx) => startShellChat(ctx, api),
521
521
  stop: (ctx) => stopShellChat(ctx),
522
522
  });
523
523
  // CLI commands
524
524
  api.registerCli((ctx) => {
525
- const cmd = ctx.program.command('shellchat');
525
+ const cmd = ctx.program.command('shellchats');
526
526
  cmd.command('setup <token>')
527
- .description('Set up ShellChat with a setup token')
527
+ .description('Set up ShellChats with a setup token')
528
528
  .action((token) => handleSetup(String(token)));
529
529
  cmd.command('status')
530
- .description('Show ShellChat connection status')
530
+ .description('Show ShellChats connection status')
531
531
  .action(() => handleStatus());
532
532
  cmd.command('reset')
533
- .description('Disconnect and remove all ShellChat data')
533
+ .description('Disconnect and remove all ShellChats data')
534
534
  .action(() => handleReset());
535
535
  });
536
536
  // Slash command for status from any channel
537
537
  api.registerCommand({
538
- name: 'shellchat',
539
- description: 'Show ShellChat tunnel status',
538
+ name: 'shellchats',
539
+ description: 'Show ShellChats tunnel status',
540
540
  handler: () => ({ text: formatStatus() }),
541
541
  });
542
542
  },
@@ -1,7 +1,7 @@
1
1
  {
2
- "id": "shellchat",
3
- "name": "ShellChat",
4
- "description": "Connects your OpenClaw gateway to ShellChat via WebRTC P2P",
2
+ "id": "connector",
3
+ "name": "ShellChats",
4
+ "description": "Connects your OpenClaw gateway to ShellChats via WebRTC P2P",
5
5
  "kind": "integration",
6
6
  "configSchema": {
7
7
  "type": "object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawchatsai/connector",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "description": "ShellChat OpenClaw plugin — P2P tunnel + local API bridge",
6
6
  "main": "dist/index.js",