@dmsdc-ai/aigentry-telepty 0.1.75 → 0.1.76

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 +10 -35
  2. package/package.json +1 -1
package/daemon.js CHANGED
@@ -966,26 +966,24 @@ app.post('/api/sessions/:id/inject', (req, res) => {
966
966
  }
967
967
  }
968
968
  if (!cmuxOk && !kittyOk) {
969
- // WS path: allow-bridge has its own prompt-ready queue
970
- const wsOk = writeToSession(finalPrompt);
969
+ // WS path: combine text + CR into single message.
970
+ // This guarantees CR delivery regardless of allow-bridge version —
971
+ // old allow-bridges with broken idle queue won't split text and CR.
972
+ const wsPayload = no_enter ? finalPrompt : finalPrompt + '\r';
973
+ const wsOk = writeToSession(wsPayload);
971
974
  if (!wsOk) {
972
975
  return res.status(503).json({ error: 'Process not connected' });
973
976
  }
974
977
  deliveryPath = 'ws';
975
- if (!session.ready) {
976
- console.log(`[INJECT] WS (not ready, allow-bridge will queue) for ${id}`);
977
- } else {
978
- console.log(`[INJECT] WS fallback for ${id}`);
979
- }
978
+ console.log(`[INJECT] WS ${no_enter ? '(no-enter)' : '(text+CR combined)'} for ${id}`);
980
979
  }
981
980
 
982
- if (!no_enter) {
981
+ if (!no_enter && deliveryPath !== 'ws') {
982
+ // CR only needed for cmux/kitty paths (WS already included CR in payload)
983
983
  setTimeout(() => {
984
984
  let submitted = false;
985
985
 
986
- // Use the SAME path that delivered text for CR to guarantee ordering
987
986
  if (deliveryPath === 'cmux') {
988
- // cmux: send-key return via same surface
989
987
  if (session.backend === 'cmux') {
990
988
  submitted = terminalBackend.cmuxSendEnter(id);
991
989
  if (submitted) console.log(`[INJECT] cmux submit for ${id}`);
@@ -995,7 +993,6 @@ app.post('/api/sessions/:id/inject', (req, res) => {
995
993
  if (submitted) console.log(`[INJECT] cmux session-level submit for ${id}`);
996
994
  }
997
995
  } else if (deliveryPath === 'kitty') {
998
- // kitty: send-text CR via same window (not osascript!)
999
996
  if (wid && sock) {
1000
997
  try {
1001
998
  require('child_process').execSync(`kitty @ --to unix:${sock} send-text --match id:${wid} $'\\r'`, {
@@ -1008,32 +1005,10 @@ app.post('/api/sessions/:id/inject', (req, res) => {
1008
1005
  }
1009
1006
  }
1010
1007
  }
1011
- // deliveryPath === 'ws' or any fallback:
1012
- // Try terminal-level submit first (bypasses PTY ICRNL which converts CR→LF)
1013
- // This matters for cmux/kitty sessions where text went via WS but
1014
- // the application expects CR(13) not LF(10) from Enter.
1015
- if (!submitted && session.backend === 'cmux') {
1016
- submitted = terminalBackend.cmuxSendEnter(id);
1017
- if (submitted) console.log(`[INJECT] cmux submit (fallback) for ${id}`);
1018
- }
1019
- if (!submitted && session.backend === 'cmux' && session.cmuxWorkspaceId) {
1020
- submitted = submitViaCmux(id);
1021
- if (submitted) console.log(`[INJECT] cmux session-level submit (fallback) for ${id}`);
1022
- }
1023
- if (!submitted && wid && sock) {
1024
- try {
1025
- require('child_process').execSync(`kitty @ --to unix:${sock} send-text --match id:${wid} $'\\r'`, {
1026
- timeout: 3000, stdio: ['pipe', 'pipe', 'pipe']
1027
- });
1028
- submitted = true;
1029
- console.log(`[INJECT] kitty submit (fallback) for ${id}`);
1030
- } catch {
1031
- session.kittyWindowId = null;
1032
- }
1033
- }
1008
+ // Final fallback for cmux/kitty paths
1034
1009
  if (!submitted) {
1035
1010
  writeToSession('\r');
1036
- console.log(`[INJECT] WS submit for ${id}`);
1011
+ console.log(`[INJECT] WS submit fallback for ${id}`);
1037
1012
  }
1038
1013
 
1039
1014
  // Update tab title (kitty-specific, safe to fail)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmsdc-ai/aigentry-telepty",
3
- "version": "0.1.75",
3
+ "version": "0.1.76",
4
4
  "main": "daemon.js",
5
5
  "bin": {
6
6
  "aigentry-telepty": "install.js",