@dmsdc-ai/aigentry-telepty 0.1.32 → 0.1.33
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/daemon.js +15 -5
- package/package.json +1 -1
package/daemon.js
CHANGED
|
@@ -454,11 +454,21 @@ function sendViaKitty(sessionId, text) {
|
|
|
454
454
|
}
|
|
455
455
|
|
|
456
456
|
try {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
457
|
+
// Split text and CR — send-text for content, send-key for Enter
|
|
458
|
+
const hasCr = text.endsWith('\r') || text.endsWith('\n');
|
|
459
|
+
const textOnly = hasCr ? text.slice(0, -1) : text;
|
|
460
|
+
if (textOnly.length > 0) {
|
|
461
|
+
const escaped = textOnly.replace(/\\/g, '\\\\').replace(/'/g, "'\\''");
|
|
462
|
+
execSync(`kitty @ --to unix:${socket} send-text --match id:${windowId} '${escaped}'`, {
|
|
463
|
+
timeout: 3000, stdio: ['pipe', 'pipe', 'pipe']
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
if (hasCr) {
|
|
467
|
+
execSync(`kitty @ --to unix:${socket} send-key --match id:${windowId} Return`, {
|
|
468
|
+
timeout: 3000, stdio: ['pipe', 'pipe', 'pipe']
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
console.log(`[KITTY] Sent ${textOnly.length} chars${hasCr ? ' + Return' : ''} to ${sessionId} (window ${windowId})`);
|
|
462
472
|
return true;
|
|
463
473
|
} catch (err) {
|
|
464
474
|
console.error(`[KITTY] Failed for ${sessionId}:`, err.message);
|