@dmsdc-ai/aigentry-telepty 0.1.45 → 0.1.46
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 +19 -19
- package/package.json +1 -1
package/daemon.js
CHANGED
|
@@ -662,42 +662,42 @@ app.post('/api/sessions/:id/inject', (req, res) => {
|
|
|
662
662
|
if (!session.kittyWindowId && sock) session.kittyWindowId = findKittyWindowId(sock, id);
|
|
663
663
|
const wid = session.kittyWindowId;
|
|
664
664
|
|
|
665
|
-
|
|
666
|
-
writeToSession(finalPrompt);
|
|
667
|
-
|
|
665
|
+
let kittyOk = false;
|
|
668
666
|
if (wid && sock) {
|
|
669
|
-
// Kitty send-text
|
|
667
|
+
// Kitty send-text primary (bypasses allow bridge queue)
|
|
670
668
|
try {
|
|
671
669
|
const escaped = finalPrompt.replace(/\\/g, '\\\\').replace(/'/g, "'\\''");
|
|
672
670
|
require('child_process').execSync(`kitty @ --to unix:${sock} send-text --match id:${wid} '${escaped}'`, {
|
|
673
671
|
timeout: 5000, stdio: ['pipe', 'pipe', 'pipe']
|
|
674
672
|
});
|
|
673
|
+
kittyOk = true;
|
|
675
674
|
console.log(`[INJECT] Kitty send-text for ${id} (window ${wid})`);
|
|
676
675
|
} catch {}
|
|
676
|
+
}
|
|
677
|
+
if (!kittyOk) {
|
|
678
|
+
// Fallback: WS (works with new allow bridges that have queue flush)
|
|
679
|
+
writeToSession(finalPrompt);
|
|
680
|
+
console.log(`[INJECT] WS fallback for ${id}`);
|
|
681
|
+
}
|
|
677
682
|
|
|
678
|
-
|
|
679
|
-
|
|
683
|
+
if (!no_enter) {
|
|
684
|
+
setTimeout(() => {
|
|
685
|
+
if (wid && sock) {
|
|
680
686
|
try {
|
|
681
|
-
writeToSession('\r'); // WS \r for new bridges
|
|
682
687
|
require('child_process').execSync(`kitty @ --to unix:${sock} send-key --match id:${wid} Return`, {
|
|
683
688
|
timeout: 3000, stdio: ['pipe', 'pipe', 'pipe']
|
|
684
689
|
});
|
|
685
690
|
require('child_process').execSync(`kitty @ --to unix:${sock} set-tab-title --match id:${wid} '⚡ telepty :: ${id}'`, {
|
|
686
691
|
timeout: 2000, stdio: ['pipe', 'pipe', 'pipe']
|
|
687
692
|
});
|
|
688
|
-
} catch {
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
} else {
|
|
693
|
-
// No kitty — WS only
|
|
694
|
-
if (!no_enter) {
|
|
695
|
-
setTimeout(() => {
|
|
693
|
+
} catch {
|
|
694
|
+
writeToSession('\r');
|
|
695
|
+
}
|
|
696
|
+
} else {
|
|
696
697
|
writeToSession('\r');
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
}
|
|
698
|
+
}
|
|
699
|
+
}, 500);
|
|
700
|
+
submitResult = { deferred: true, strategy: kittyOk ? 'kitty_text_key' : 'ws_split_cr' };
|
|
701
701
|
}
|
|
702
702
|
} else {
|
|
703
703
|
// Spawned sessions: direct PTY write
|