@dmsdc-ai/aigentry-telepty 0.1.32 → 0.1.34

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/daemon.js +22 -11
  2. package/package.json +1 -1
package/daemon.js CHANGED
@@ -429,12 +429,13 @@ function findKittyWindowId(socket, sessionId) {
429
429
  for (const osw of data) {
430
430
  for (const tab of osw.tabs) {
431
431
  for (const w of tab.windows) {
432
- const cmds = (w.foreground_processes || []).map(p => (p.cmdline || []).join(' ')).join(' ');
433
- // Check full process tree cmdline for session ID
434
- if (cmds.includes(sessionId)) return w.id;
435
- // Also check the window's own cmdline/title
436
- const allCmds = JSON.stringify(w);
437
- if (allCmds.includes(sessionId)) return w.id;
432
+ // Only check process cmdlines for --id SESSION_ID pattern (not output text)
433
+ for (const p of (w.foreground_processes || [])) {
434
+ const cmd = (p.cmdline || []).join(' ');
435
+ if (cmd.includes('--id ' + sessionId) || cmd.includes('--id=' + sessionId)) {
436
+ return w.id;
437
+ }
438
+ }
438
439
  }
439
440
  }
440
441
  }
@@ -454,11 +455,21 @@ function sendViaKitty(sessionId, text) {
454
455
  }
455
456
 
456
457
  try {
457
- const escaped = text.replace(/\\/g, '\\\\').replace(/'/g, "'\\''");
458
- execSync(`kitty @ --to unix:${socket} send-text --match id:${windowId} '${escaped}'`, {
459
- timeout: 3000, stdio: ['pipe', 'pipe', 'pipe']
460
- });
461
- console.log(`[KITTY] Sent ${text.length} chars to ${sessionId} (window ${windowId})`);
458
+ // Split text and CR — send-text for content, send-key for Enter
459
+ const hasCr = text.endsWith('\r') || text.endsWith('\n');
460
+ const textOnly = hasCr ? text.slice(0, -1) : text;
461
+ if (textOnly.length > 0) {
462
+ const escaped = textOnly.replace(/\\/g, '\\\\').replace(/'/g, "'\\''");
463
+ execSync(`kitty @ --to unix:${socket} send-text --match id:${windowId} '${escaped}'`, {
464
+ timeout: 3000, stdio: ['pipe', 'pipe', 'pipe']
465
+ });
466
+ }
467
+ if (hasCr) {
468
+ execSync(`kitty @ --to unix:${socket} send-key --match id:${windowId} Return`, {
469
+ timeout: 3000, stdio: ['pipe', 'pipe', 'pipe']
470
+ });
471
+ }
472
+ console.log(`[KITTY] Sent ${textOnly.length} chars${hasCr ? ' + Return' : ''} to ${sessionId} (window ${windowId})`);
462
473
  return true;
463
474
  } catch (err) {
464
475
  console.error(`[KITTY] Failed for ${sessionId}:`, err.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmsdc-ai/aigentry-telepty",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "main": "daemon.js",
5
5
  "bin": {
6
6
  "aigentry-telepty": "install.js",