@dmsdc-ai/aigentry-telepty 0.1.36 → 0.1.37

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 +25 -24
  2. package/package.json +1 -1
package/daemon.js CHANGED
@@ -633,35 +633,36 @@ app.post('/api/sessions/:id/inject', (req, res) => {
633
633
 
634
634
  let submitResult = null;
635
635
  if (session.type === 'wrapped' && !no_enter) {
636
- // Wrapped sessions: try kitty remote control first (bypasses allow bridge entirely)
637
- const kittyPayload = finalPrompt + '\r';
638
- const kittyOk = sendViaKitty(id, kittyPayload);
639
- if (kittyOk) {
640
- submitResult = { strategy: 'kitty_remote' };
641
- console.log(`[INJECT+SUBMIT] Kitty remote for ${id}`);
642
- } else {
643
- // Fallback: WS text + osascript/WS Enter
644
- if (!writeToSession(finalPrompt)) {
645
- return res.status(503).json({ error: 'Wrap process is not connected' });
646
- }
647
- setTimeout(() => {
648
- const osascriptOk = submitViaOsascript(id, 'enter');
649
- if (!osascriptOk) {
636
+ // Hybrid: text via WS (allow bridge handles it), Enter via kitty send-key
637
+ if (!writeToSession(finalPrompt)) {
638
+ return res.status(503).json({ error: 'Wrap process is not connected' });
639
+ }
640
+ setTimeout(() => {
641
+ // Try kitty send-key Return (reliable for all CLIs)
642
+ const windowId = findKittyWindowId(findKittySocket(), id);
643
+ if (windowId) {
644
+ try {
645
+ const { execSync } = require('child_process');
646
+ execSync(`kitty @ --to unix:${findKittySocket()} send-key --match id:${windowId} Return`, {
647
+ timeout: 3000, stdio: ['pipe', 'pipe', 'pipe']
648
+ });
649
+ console.log(`[INJECT+SUBMIT] WS text + kitty Return for ${id} (window ${windowId})`);
650
+ } catch {
650
651
  writeToSession('\r');
651
- console.log(`[INJECT+SUBMIT] WS \\r last-resort for ${id}`);
652
+ console.log(`[INJECT+SUBMIT] WS text + WS \\r fallback for ${id}`);
652
653
  }
653
- }, 500);
654
- submitResult = { deferred: true, strategy: 'osascript_fallback' };
655
- }
654
+ } else {
655
+ writeToSession('\r');
656
+ console.log(`[INJECT+SUBMIT] WS text + WS \\r (no kitty window) for ${id}`);
657
+ }
658
+ }, 500);
659
+ submitResult = { deferred: true, strategy: 'ws_text_kitty_return' };
656
660
  } else if (session.type === 'wrapped') {
657
661
  // no_enter=true for wrapped
658
- const kittyOk = sendViaKitty(id, finalPrompt);
659
- if (!kittyOk) {
660
- if (!writeToSession(finalPrompt)) {
661
- return res.status(503).json({ error: 'Wrap process is not connected' });
662
- }
662
+ if (!writeToSession(finalPrompt)) {
663
+ return res.status(503).json({ error: 'Wrap process is not connected' });
663
664
  }
664
- submitResult = { strategy: kittyOk ? 'kitty_remote_no_enter' : 'ws_no_enter' };
665
+ submitResult = { strategy: 'ws_no_enter' };
665
666
  } else {
666
667
  if (!writeToSession(finalPrompt)) {
667
668
  return res.status(503).json({ error: 'Wrap process is not connected' });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmsdc-ai/aigentry-telepty",
3
- "version": "0.1.36",
3
+ "version": "0.1.37",
4
4
  "main": "daemon.js",
5
5
  "bin": {
6
6
  "aigentry-telepty": "install.js",