@clawchatsai/connector 0.0.58 → 0.0.60

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.
Files changed (2) hide show
  1. package/dist/index.js +19 -28
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -764,7 +764,7 @@ async function handleSetup(token) {
764
764
  const msg = JSON.parse(raw.toString());
765
765
  if (msg.type === 'setup-complete') {
766
766
  clearTimeout(timeout);
767
- console.log(` User: ${msg.userId}`);
767
+ console.log(` User: ${msg.email || msg.userId}`);
768
768
  console.log(' Registering gateway... ✅');
769
769
  // Save initial config (schemaVersion 1 — will upgrade to 2 after TOTP enrollment)
770
770
  const config = {
@@ -792,28 +792,21 @@ async function handleSetup(token) {
792
792
  fs.mkdirSync(dataDir, { recursive: true });
793
793
  fs.mkdirSync(uploadsDir, { recursive: true });
794
794
  ws.close();
795
- // Ask if user wants to reuse TOTP from another gateway
796
- let reuseSecret;
797
- if (config.schemaVersion === 1) {
798
- const rlSetup = (await import('node:readline')).createInterface({ input: process.stdin, output: process.stdout });
799
- const askSetup = (q) => new Promise(r => rlSetup.question(q, r));
800
- console.log('');
801
- console.log(' 💡 Already have ClawChats on another gateway?');
802
- console.log(' Run \`openclaw clawchats show-totp\` on that machine and paste the secret below.');
803
- const reuseAnswer = await askSetup(' Paste existing TOTP secret to reuse it (or press Enter to set up new): ');
804
- rlSetup.close();
805
- if (reuseAnswer.trim())
806
- reuseSecret = reuseAnswer.trim();
807
- }
808
- // Enroll TOTP (interactive — requires stdin)
809
- const totpOk = await enrollTotp(config, reuseSecret);
795
+ // Enroll TOTP (interactive single readline for the whole flow)
796
+ const totpOk = await enrollTotp(config);
810
797
  if (!totpOk) {
811
798
  console.log('');
812
799
  console.log(' ⚠️ TOTP not configured. You can set it up later with: openclaw clawchats reauth');
813
800
  console.log(' ClawChats will not allow browser connections until 2FA is enabled.');
814
801
  }
815
- console.log(' ClawChats is ready!');
816
- console.log(' Open clawchats.ai in your browser to start chatting.');
802
+ console.log(' Setup complete!');
803
+ console.log('');
804
+ console.log(' Next steps:');
805
+ console.log(' 1. Restart your gateway: openclaw gateway restart');
806
+ console.log(' (or: systemctl --user restart openclaw-gateway)');
807
+ console.log(' 2. Open ClawChats: https://app.clawchats.ai');
808
+ console.log('');
809
+ console.log(' The gateway will connect automatically after restart.');
817
810
  resolve();
818
811
  }
819
812
  else if (msg.type === 'setup-error') {
@@ -833,11 +826,17 @@ async function handleSetup(token) {
833
826
  });
834
827
  });
835
828
  }
836
- async function enrollTotp(config, existingSecret) {
829
+ async function enrollTotp(config) {
837
830
  const readline = await import('node:readline');
838
831
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
839
832
  const ask = (q) => new Promise(r => rl.question(q, r));
840
833
  try {
834
+ // Ask once if the user wants to reuse a TOTP secret from another gateway
835
+ console.log('');
836
+ console.log(' 💡 Already have ClawChats on another gateway?');
837
+ console.log(' Run `openclaw clawchats show-totp` on that machine, then paste the secret below.');
838
+ const reuseAnswer = await ask(' Paste existing TOTP secret (or press Enter to set up new): ');
839
+ const existingSecret = reuseAnswer.trim() || undefined;
841
840
  let totpSecret;
842
841
  if (existingSecret) {
843
842
  // Reusing secret from another gateway — strip spaces, uppercase
@@ -947,15 +946,7 @@ async function handleReauth() {
947
946
  console.log(' ⚠️ This will invalidate all existing sessions.');
948
947
  console.log(' All connected browsers will need to re-authenticate.');
949
948
  console.log('');
950
- const readline = await import('node:readline');
951
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
952
- const ask = (q) => new Promise(r => rl.question(q, r));
953
- let existingSecret;
954
- const reuseAnswer = await ask(' Reuse TOTP from another gateway? Paste secret (or press Enter to generate new): ');
955
- rl.close();
956
- if (reuseAnswer.trim())
957
- existingSecret = reuseAnswer.trim();
958
- const success = await enrollTotp(config, existingSecret);
949
+ const success = await enrollTotp(config);
959
950
  if (success) {
960
951
  console.log(' All previous sessions have been invalidated.');
961
952
  console.log(' Restart the gateway for changes to take effect: systemctl --user restart openclaw-gateway');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawchatsai/connector",
3
- "version": "0.0.58",
3
+ "version": "0.0.60",
4
4
  "type": "module",
5
5
  "description": "ClawChats OpenClaw plugin — P2P tunnel + local API bridge",
6
6
  "main": "dist/index.js",