@dmsdc-ai/aigentry-telepty 0.1.45 → 0.1.47

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 +22 -21
  2. package/package.json +1 -1
package/daemon.js CHANGED
@@ -633,8 +633,9 @@ app.post('/api/sessions/:id/inject', (req, res) => {
633
633
  if (from && !prompt.startsWith('[from:')) {
634
634
  finalPrompt = `[from: ${from}] [reply-to: ${reply_to}] ${prompt}`;
635
635
  }
636
- // Append reply guide when reply_to is set (self-contained reply instructions)
637
- if (reply_to && reply_to !== id) {
636
+ // Append reply guide when reply_to is set, UNLESS message contains termination signal
637
+ const TERMINATION_SIGNALS = /no further reply needed|thread closed|closed on .+ side|ack received|ack-only|회신 불필요|스레드 종료/i;
638
+ if (reply_to && reply_to !== id && !TERMINATION_SIGNALS.test(prompt)) {
638
639
  finalPrompt += `\n\n---\n[reply-to: ${reply_to}] 위 세션에 회신이 필요합니다. 답변 시 아래 명령을 실행하세요:\ntelepty inject --from ${id} ${reply_to} "답변 내용"\n---`;
639
640
  }
640
641
  const inject_id = crypto.randomUUID();
@@ -662,42 +663,42 @@ app.post('/api/sessions/:id/inject', (req, res) => {
662
663
  if (!session.kittyWindowId && sock) session.kittyWindowId = findKittyWindowId(sock, id);
663
664
  const wid = session.kittyWindowId;
664
665
 
665
- // Always send via WS too (for new allow bridges with queue flush)
666
- writeToSession(finalPrompt);
667
-
666
+ let kittyOk = false;
668
667
  if (wid && sock) {
669
- // Kitty send-text for reliable text delivery
668
+ // Kitty send-text primary (bypasses allow bridge queue)
670
669
  try {
671
670
  const escaped = finalPrompt.replace(/\\/g, '\\\\').replace(/'/g, "'\\''");
672
671
  require('child_process').execSync(`kitty @ --to unix:${sock} send-text --match id:${wid} '${escaped}'`, {
673
672
  timeout: 5000, stdio: ['pipe', 'pipe', 'pipe']
674
673
  });
674
+ kittyOk = true;
675
675
  console.log(`[INJECT] Kitty send-text for ${id} (window ${wid})`);
676
676
  } catch {}
677
+ }
678
+ if (!kittyOk) {
679
+ // Fallback: WS (works with new allow bridges that have queue flush)
680
+ writeToSession(finalPrompt);
681
+ console.log(`[INJECT] WS fallback for ${id}`);
682
+ }
677
683
 
678
- if (!no_enter) {
679
- setTimeout(() => {
684
+ if (!no_enter) {
685
+ setTimeout(() => {
686
+ if (wid && sock) {
680
687
  try {
681
- writeToSession('\r'); // WS \r for new bridges
682
688
  require('child_process').execSync(`kitty @ --to unix:${sock} send-key --match id:${wid} Return`, {
683
689
  timeout: 3000, stdio: ['pipe', 'pipe', 'pipe']
684
690
  });
685
691
  require('child_process').execSync(`kitty @ --to unix:${sock} set-tab-title --match id:${wid} '⚡ telepty :: ${id}'`, {
686
692
  timeout: 2000, stdio: ['pipe', 'pipe', 'pipe']
687
693
  });
688
- } catch {}
689
- }, 500);
690
- submitResult = { deferred: true, strategy: 'kitty_text_key' };
691
- }
692
- } else {
693
- // No kitty — WS only
694
- if (!no_enter) {
695
- setTimeout(() => {
694
+ } catch {
695
+ writeToSession('\r');
696
+ }
697
+ } else {
696
698
  writeToSession('\r');
697
- console.log(`[INJECT+SUBMIT] WS-only split_cr for ${id}`);
698
- }, 300);
699
- submitResult = { deferred: true, strategy: 'ws_split_cr' };
700
- }
699
+ }
700
+ }, 500);
701
+ submitResult = { deferred: true, strategy: kittyOk ? 'kitty_text_key' : 'ws_split_cr' };
701
702
  }
702
703
  } else {
703
704
  // Spawned sessions: direct PTY write
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmsdc-ai/aigentry-telepty",
3
- "version": "0.1.45",
3
+ "version": "0.1.47",
4
4
  "main": "daemon.js",
5
5
  "bin": {
6
6
  "aigentry-telepty": "install.js",