@dmsdc-ai/aigentry-telepty 0.1.19 → 0.1.20
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 +11 -1
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -770,9 +770,19 @@ async function main() {
|
|
|
770
770
|
}
|
|
771
771
|
});
|
|
772
772
|
|
|
773
|
+
// Intercept terminal title escape sequences and prefix with session ID
|
|
774
|
+
const titlePrefix = `\u26A1 ${sessionId}`;
|
|
775
|
+
function rewriteTitleSequences(output) {
|
|
776
|
+
// Match OSC title sequences: \x1b]0;TITLE\x07 or \x1b]2;TITLE\x07
|
|
777
|
+
return output.replace(/\x1b\]([02]);([^\x07]*)\x07/g, (match, code, title) => {
|
|
778
|
+
return `\x1b]${code};${titlePrefix} | ${title}\x07`;
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
|
|
773
782
|
// Relay PTY output to current terminal + send to daemon for attach clients
|
|
774
783
|
child.onData((data) => {
|
|
775
|
-
|
|
784
|
+
const rewritten = rewriteTitleSequences(data);
|
|
785
|
+
process.stdout.write(rewritten);
|
|
776
786
|
if (wsReady && daemonWs.readyState === 1) {
|
|
777
787
|
daemonWs.send(JSON.stringify({ type: 'output', data }));
|
|
778
788
|
}
|