@dmsdc-ai/aigentry-telepty 0.1.26 → 0.1.28
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/cli.js +5 -0
- package/daemon.js +22 -13
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -745,6 +745,11 @@ async function main() {
|
|
|
745
745
|
wsReady = true;
|
|
746
746
|
if (reconnectAttempts > 0) {
|
|
747
747
|
console.error(`\n\x1b[32m⚡ Reconnected to daemon. Inject restored.\x1b[0m`);
|
|
748
|
+
// Force CLI redraw by triggering SIGWINCH (resize +1/-1)
|
|
749
|
+
const origCols = child.cols || process.stdout.columns || 80;
|
|
750
|
+
const origRows = child.rows || process.stdout.rows || 30;
|
|
751
|
+
child.resize(origCols - 1, origRows);
|
|
752
|
+
setTimeout(() => child.resize(origCols, origRows), 150);
|
|
748
753
|
}
|
|
749
754
|
reconnectAttempts = 0;
|
|
750
755
|
});
|
package/daemon.js
CHANGED
|
@@ -562,19 +562,28 @@ app.post('/api/sessions/:id/inject', (req, res) => {
|
|
|
562
562
|
}
|
|
563
563
|
|
|
564
564
|
let submitResult = null;
|
|
565
|
-
if (!
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
565
|
+
if (!writeToSession(finalPrompt)) {
|
|
566
|
+
return res.status(503).json({ error: 'Wrap process is not connected' });
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
if (!no_enter) {
|
|
570
|
+
if (session.type === 'wrapped') {
|
|
571
|
+
// Wrapped sessions: send text via WS, then Enter via osascript (bypasses allow bridge prompt-ready gate)
|
|
572
|
+
// First try combined \r via WS, then fall back to osascript
|
|
573
|
+
setTimeout(() => {
|
|
574
|
+
// Try osascript keystroke (works regardless of allow bridge version)
|
|
575
|
+
const osascriptOk = submitViaOsascript(id, 'enter');
|
|
576
|
+
if (osascriptOk) {
|
|
577
|
+
console.log(`[INJECT+SUBMIT] osascript Enter for ${id}`);
|
|
578
|
+
} else {
|
|
579
|
+
// Fallback: send \r via WS (works if allow bridge has prompt-ready bypass)
|
|
580
|
+
const wsOk = writeToSession('\r');
|
|
581
|
+
console.log(`[INJECT+SUBMIT] WS \\r fallback for ${id}: ${wsOk ? 'success' : 'failed'}`);
|
|
582
|
+
}
|
|
583
|
+
}, 500);
|
|
584
|
+
submitResult = { deferred: true, strategy: 'osascript_enter' };
|
|
585
|
+
} else {
|
|
586
|
+
// Spawned sessions: send \r separately after delay (proven split_cr strategy)
|
|
578
587
|
setTimeout(() => {
|
|
579
588
|
const ok = writeToSession('\r');
|
|
580
589
|
console.log(`[INJECT+SUBMIT] Split \\r for ${id}: ${ok ? 'success' : 'failed'}`);
|