nstantpage-agent 0.5.9 → 0.5.11

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/cli.js CHANGED
@@ -25,7 +25,7 @@ const program = new Command();
25
25
  program
26
26
  .name('nstantpage')
27
27
  .description('Local development agent for nstantpage.com — run projects on your machine, preview in the cloud')
28
- .version('0.5.8');
28
+ .version('0.5.10');
29
29
  program
30
30
  .command('login')
31
31
  .description('Authenticate with nstantpage.com')
@@ -24,7 +24,7 @@ import { getConfig, getProjectConfig, setProjectConfig, clearProjectConfig, getD
24
24
  import { TunnelClient } from '../tunnel.js';
25
25
  import { LocalServer } from '../localServer.js';
26
26
  import { PackageInstaller } from '../packageInstaller.js';
27
- const VERSION = '0.5.8';
27
+ const VERSION = '0.5.10';
28
28
  /**
29
29
  * Resolve the backend API base URL.
30
30
  * - If --backend is passed, use it
@@ -426,50 +426,31 @@ export class LocalServer {
426
426
  }
427
427
  }
428
428
  if (!ptyProcess && !shell) {
429
+ // Fallback: raw spawn (no PTY, limited interactivity but works everywhere)
430
+ // NOTE: 'script' wrapper doesn't work with piped stdio (tcgetattr fails),
431
+ // so we skip it and go straight to raw shell spawn.
429
432
  try {
430
- if (process.platform === 'darwin') {
431
- // macOS fallback: use 'script' to allocate a PTY
432
- shell = spawn('script', ['-q', '/dev/null', shellCmd], {
433
- cwd: spawnCwd,
434
- env: shellEnv,
435
- stdio: ['pipe', 'pipe', 'pipe'],
436
- });
437
- }
438
- else if (process.platform === 'linux') {
439
- // Linux fallback: 'script' with -c flag
440
- shell = spawn('script', ['-qc', shellCmd, '/dev/null'], {
441
- cwd: spawnCwd,
442
- env: shellEnv,
443
- stdio: ['pipe', 'pipe', 'pipe'],
444
- });
445
- }
446
- else {
447
- // Windows / other: raw spawn (limited interactivity)
433
+ shell = spawn(shellCmd, ['-i'], {
434
+ cwd: spawnCwd,
435
+ env: shellEnv,
436
+ stdio: ['pipe', 'pipe', 'pipe'],
437
+ });
438
+ }
439
+ catch (spawnErr) {
440
+ console.warn(` [Terminal] Interactive shell failed: ${spawnErr.message} — trying non-interactive`);
441
+ try {
448
442
  shell = spawn(shellCmd, [], {
449
443
  cwd: spawnCwd,
450
444
  env: shellEnv,
451
445
  stdio: ['pipe', 'pipe', 'pipe'],
452
446
  });
453
447
  }
454
- }
455
- catch (scriptErr) {
456
- console.warn(` [Terminal] script fallback failed: ${scriptErr.message} — trying raw spawn`);
457
- }
458
- }
459
- // Last resort: raw spawn with no PTY
460
- if (!ptyProcess && !shell) {
461
- try {
462
- shell = spawn(shellCmd, [], {
463
- cwd: spawnCwd,
464
- env: shellEnv,
465
- stdio: ['pipe', 'pipe', 'pipe'],
466
- });
467
- }
468
- catch (rawErr) {
469
- console.error(` [Terminal] All spawn methods failed: ${rawErr.message}`);
470
- res.statusCode = 500;
471
- this.json(res, { success: false, error: `Failed to spawn terminal: ${rawErr.message}` });
472
- return;
448
+ catch (rawErr) {
449
+ console.error(` [Terminal] All spawn methods failed: ${rawErr.message}`);
450
+ res.statusCode = 500;
451
+ this.json(res, { success: false, error: `Failed to spawn terminal: ${rawErr.message}` });
452
+ return;
453
+ }
473
454
  }
474
455
  }
475
456
  const session = {
@@ -592,7 +573,7 @@ export class LocalServer {
592
573
  connected: true,
593
574
  projectId: this.options.projectId,
594
575
  agent: {
595
- version: '0.5.8',
576
+ version: '0.5.10',
596
577
  hostname: os.hostname(),
597
578
  platform: `${os.platform()} ${os.arch()}`,
598
579
  },
package/dist/tunnel.js CHANGED
@@ -63,7 +63,7 @@ export class TunnelClient {
63
63
  // Send enhanced agent info with capabilities and deviceId
64
64
  this.send({
65
65
  type: 'agent-info',
66
- version: '0.5.8',
66
+ version: '0.5.10',
67
67
  hostname: os.hostname(),
68
68
  platform: `${os.platform()} ${os.arch()}`,
69
69
  deviceId: getDeviceId(),
@@ -163,11 +163,12 @@ export class TunnelClient {
163
163
  handleWsOpen(wsId, sessionId, _projectId) {
164
164
  const session = getTerminalSession(sessionId);
165
165
  if (!session) {
166
- // Session not found — send error and close
166
+ // Session not found — send a 'closed' event (not 'error') so
167
+ // the frontend stops reconnecting instead of showing a red banner.
167
168
  this.send({
168
169
  type: 'ws-data',
169
170
  wsId,
170
- data: JSON.stringify({ type: 'error', message: `Session ${sessionId} not found` }),
171
+ data: JSON.stringify({ type: 'closed', message: `Session ${sessionId} no longer exists`, sessionNotFound: true }),
171
172
  });
172
173
  this.send({ type: 'ws-close', wsId });
173
174
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nstantpage-agent",
3
- "version": "0.5.9",
3
+ "version": "0.5.11",
4
4
  "description": "Local development agent for nstantpage.com — run your projects locally, preview in the cloud. Replaces cloud containers for faster builds.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -60,6 +60,6 @@
60
60
  "typescript": "^5.5.0"
61
61
  },
62
62
  "optionalDependencies": {
63
- "node-pty": "^1.1.0"
63
+ "node-pty": "^1.2.0-beta.11"
64
64
  }
65
65
  }