@siftd/connect-agent 0.2.29 → 0.2.30

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/agent.js +18 -7
  2. package/package.json +1 -1
package/dist/agent.js CHANGED
@@ -10,13 +10,13 @@ function stripAnsi(str) {
10
10
  return str.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, '');
11
11
  }
12
12
  /**
13
- * Self-update: npm install latest and restart
13
+ * Self-update: npm install latest and auto-restart
14
14
  * Called from webapp banner or update command
15
15
  */
16
16
  async function performSelfUpdate() {
17
17
  console.log('[AGENT] === SELF-UPDATE STARTING ===');
18
18
  try {
19
- // Just do it - npm install latest
19
+ // Install the latest version
20
20
  console.log('[AGENT] Running: npm install -g @siftd/connect-agent@latest');
21
21
  execSync('npm install -g @siftd/connect-agent@latest', {
22
22
  encoding: 'utf8',
@@ -24,13 +24,24 @@ async function performSelfUpdate() {
24
24
  stdio: 'inherit', // Show output in real-time
25
25
  timeout: 180000
26
26
  });
27
- console.log('[AGENT] Update installed. Restarting in 2 seconds...');
28
- // Restart the agent
27
+ console.log('[AGENT] Update installed. Auto-restarting...');
28
+ // Spawn a new agent process that will outlive this one
29
+ // Use a small delay script so the old process can exit cleanly
30
+ const restartScript = `sleep 2 && npx @siftd/connect-agent start`;
31
+ const child = spawn('/bin/bash', ['-c', restartScript], {
32
+ detached: true,
33
+ stdio: 'ignore',
34
+ env: process.env
35
+ });
36
+ // Unref so this process can exit while child continues
37
+ child.unref();
38
+ console.log('[AGENT] === AUTO-RESTART SCHEDULED ===');
39
+ // Give the response time to send, then exit
29
40
  setTimeout(() => {
30
- console.log('[AGENT] === RESTARTING ===');
41
+ console.log('[AGENT] Exiting for restart...');
31
42
  process.exit(0);
32
- }, 2000);
33
- return '✅ Update installed. Restarting...';
43
+ }, 1000);
44
+ return '✅ Update installed. Auto-restarting in 2 seconds...';
34
45
  }
35
46
  catch (error) {
36
47
  const msg = error instanceof Error ? error.message : String(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siftd/connect-agent",
3
- "version": "0.2.29",
3
+ "version": "0.2.30",
4
4
  "description": "Master orchestrator agent - control Claude Code remotely via web",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",