@dmsdc-ai/aigentry-telepty 0.1.86 → 0.1.88

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 (3) hide show
  1. package/cli.js +28 -6
  2. package/daemon.js +2 -2
  3. package/package.json +1 -1
package/cli.js CHANGED
@@ -334,8 +334,22 @@ function printSessionInfo(session, options = {}) {
334
334
  console.log('');
335
335
  }
336
336
 
337
+ function resolveTeleptyEntryPoint() {
338
+ // After npm upgrade, process.argv[1] still points to the OLD version's cli.js.
339
+ // Resolve the current telepty binary from PATH, which npm updates on install.
340
+ try {
341
+ const cmd = process.platform === 'win32' ? 'where telepty' : 'which telepty';
342
+ const binPath = execSync(cmd, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim().split('\n')[0];
343
+ if (binPath && fs.existsSync(binPath)) {
344
+ return fs.realpathSync(binPath);
345
+ }
346
+ } catch {}
347
+ return process.argv[1];
348
+ }
349
+
337
350
  function startDetachedDaemon() {
338
- const cp = spawn(process.argv[0], [process.argv[1], 'daemon'], {
351
+ const entryPoint = resolveTeleptyEntryPoint();
352
+ const cp = spawn(process.argv[0], [entryPoint, 'daemon'], {
339
353
  detached: true,
340
354
  stdio: 'ignore'
341
355
  });
@@ -391,7 +405,11 @@ async function repairLocalDaemon(options = {}) {
391
405
  startDetachedDaemon();
392
406
  await new Promise((resolve) => setTimeout(resolve, 1000));
393
407
  const meta = await getDaemonMeta('127.0.0.1');
394
- return { stopped: results.stopped.length, failed: results.failed.length, meta };
408
+ const versionMatch = meta && meta.version === pkg.version;
409
+ if (meta && !versionMatch) {
410
+ process.stdout.write(`\x1b[33m⚠️ Daemon restarted but version mismatch (running v${meta.version}, expected v${pkg.version})\x1b[0m\n`);
411
+ }
412
+ return { stopped: results.stopped.length, failed: results.failed.length, meta, versionMatch };
395
413
  }
396
414
 
397
415
  function getDiscoveryHosts() {
@@ -455,10 +473,14 @@ async function ensureDaemonRunning(options = {}) {
455
473
  });
456
474
 
457
475
  if (sessionsRes.ok && hasCapabilities) {
458
- return;
459
- }
460
-
461
- if (sessionsRes.ok && !meta) {
476
+ // Version mismatch: running daemon is older than installed CLI
477
+ if (meta && meta.version !== pkg.version) {
478
+ process.stdout.write(`\x1b[33m⚙️ Daemon version mismatch (running v${meta.version}, installed v${pkg.version}). Restarting...\x1b[0m\n`);
479
+ cleanupDaemonProcesses();
480
+ } else {
481
+ return;
482
+ }
483
+ } else if (sessionsRes.ok && !meta) {
462
484
  process.stdout.write('\x1b[33m⚙️ Found an older local telepty daemon. Restarting it...\x1b[0m\n');
463
485
  cleanupDaemonProcesses();
464
486
  } else if (sessionsRes.ok && meta) {
package/daemon.js CHANGED
@@ -825,8 +825,8 @@ app.post('/api/sessions/spawn', (req, res) => {
825
825
  app.post('/api/sessions/register', (req, res) => {
826
826
  const { session_id, command, cwd = process.cwd(), backend, cmux_workspace_id, cmux_surface_id, term_program, term } = req.body;
827
827
  if (!session_id) return res.status(400).json({ error: 'session_id is required' });
828
- // Entitlement: check session limit for new registrations
829
- if (!sessions[session_id]) {
828
+ // Entitlement: check session limit for new registrations (exempt aterm — embedded IPC, no PTY cost)
829
+ if (!sessions[session_id] && req.body.delivery_type !== 'aterm') {
830
830
  const sessionCount = Object.keys(sessions).length;
831
831
  const ent = checkEntitlement({ feature: 'telepty.multi_session', currentUsage: sessionCount });
832
832
  if (!ent.allowed) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmsdc-ai/aigentry-telepty",
3
- "version": "0.1.86",
3
+ "version": "0.1.88",
4
4
  "main": "daemon.js",
5
5
  "bin": {
6
6
  "aigentry-telepty": "install.js",