@dmsdc-ai/aigentry-telepty 0.1.29 → 0.1.31
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 +10 -11
- package/package.json +1 -1
package/daemon.js
CHANGED
|
@@ -416,21 +416,19 @@ function submitViaPty(session) {
|
|
|
416
416
|
// Send text directly to Kitty tab via remote control (bypasses allow bridge entirely)
|
|
417
417
|
function sendViaKitty(sessionId, text) {
|
|
418
418
|
const { execSync } = require('child_process');
|
|
419
|
-
|
|
419
|
+
// Find kitty socket: /tmp/kitty-sock or /tmp/kitty-sock-PID
|
|
420
|
+
const fs = require('fs');
|
|
420
421
|
let socket = null;
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
break;
|
|
426
|
-
} catch { /* skip */ }
|
|
427
|
-
}
|
|
422
|
+
try {
|
|
423
|
+
const files = fs.readdirSync('/tmp').filter(f => f.startsWith('kitty-sock'));
|
|
424
|
+
if (files.length > 0) socket = '/tmp/' + files[0];
|
|
425
|
+
} catch { /* /tmp not readable */ }
|
|
428
426
|
if (!socket) return false;
|
|
429
427
|
|
|
430
428
|
try {
|
|
431
|
-
// Match by
|
|
429
|
+
// Match by cmdline containing session ID (works even when CLI overwrites tab title)
|
|
432
430
|
const escaped = text.replace(/\\/g, '\\\\').replace(/'/g, "'\\''");
|
|
433
|
-
execSync(`kitty @ --to unix:${socket} send-text --match
|
|
431
|
+
execSync(`kitty @ --to unix:${socket} send-text --match cmdline:${sessionId} '${escaped}'`, {
|
|
434
432
|
timeout: 3000, stdio: ['pipe', 'pipe', 'pipe']
|
|
435
433
|
});
|
|
436
434
|
console.log(`[KITTY] Sent ${text.length} chars to ${sessionId}`);
|
|
@@ -1047,7 +1045,8 @@ wss.on('connection', (ws, req) => {
|
|
|
1047
1045
|
};
|
|
1048
1046
|
sessions[sessionId] = autoSession;
|
|
1049
1047
|
console.log(`[WS] Auto-registered wrapped session ${sessionId} on reconnect`);
|
|
1050
|
-
//
|
|
1048
|
+
// Trigger CLI redraw via kitty Ctrl+L after short delay
|
|
1049
|
+
setTimeout(() => sendViaKitty(sessionId, '\x0c'), 1000);
|
|
1051
1050
|
} else {
|
|
1052
1051
|
session.clients.add(ws);
|
|
1053
1052
|
}
|