remote-cli-agent 0.3.0 → 0.3.2

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.
@@ -45,8 +45,14 @@ function doConnect() {
45
45
  }
46
46
  });
47
47
  ws.on('close', (code, reason) => {
48
- console.log(`Disconnected from server (code: ${code}, reason: ${reason.toString() || 'unknown'})`);
48
+ const reasonStr = reason.toString() || 'unknown';
49
+ console.log(`Disconnected from server (code: ${code}, reason: ${reasonStr})`);
49
50
  isConnected = false;
51
+ // Don't reconnect if we were replaced - another instance is already connected
52
+ if (reasonStr === 'Replaced by new connection') {
53
+ console.log('Another agent instance took over. Exiting.');
54
+ process.exit(0);
55
+ }
50
56
  scheduleReconnect();
51
57
  });
52
58
  ws.on('error', (err) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remote-cli-agent",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "remote-cli": "./dist/index.js"
@@ -9,7 +9,7 @@
9
9
  "build": "tsc",
10
10
  "start": "node dist/index.js",
11
11
  "dev": "tsx src/index.ts",
12
- "postinstall": "node -e \"const fs=require('fs'),p=require('path'),d=p.join(__dirname,'node_modules','node-pty','prebuilds');try{fs.readdirSync(d).forEach(a=>{const h=p.join(d,a,'spawn-helper');try{fs.chmodSync(h,0o755);console.log('Fixed permissions:',h)}catch{}})}catch{}\"",
12
+ "postinstall": "node -e \"const fs=require('fs'),p=require('path');try{const r=require.resolve('node-pty/package.json'),d=p.join(p.dirname(r),'prebuilds');fs.readdirSync(d).forEach(a=>{const h=p.join(d,a,'spawn-helper');try{fs.chmodSync(h,493);console.log('Fixed:',h)}catch{}})}catch(e){console.log('postinstall skip:',e.message)}\"",
13
13
  "prepublishOnly": "npm run build"
14
14
  },
15
15
  "dependencies": {