mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-04 22:49:41 +02:00
fix(respawn): use screen -X stuff for reliable input delivery
When writing to an attached PTY connected to screen, the input doesn't reliably reach Claude CLI. This fix uses `screen -X stuff` command to send input directly to the screen session, bypassing the PTY attachment. Research findings: - Claude CLI uses Ink (React for CLI) for terminal UI - Ink's parseKeypress detects \r as key.return (Enter) - screen -X stuff with $'...' syntax reliably sends literal characters Changes: - Add ScreenManager.sendInput() using screen -X stuff - Modify Session.write() to prefer screen -X stuff when available - Keep \r as Enter key (what Ink expects for key.return) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -898,7 +898,18 @@ export class Session extends EventEmitter {
|
||||
}
|
||||
|
||||
// Send input to the PTY (for interactive sessions)
|
||||
// When using screen, prefers screen -X stuff for reliable input delivery
|
||||
write(data: string): void {
|
||||
// Try screen -X stuff first if we have a screen session
|
||||
// This is more reliable for sending Enter key to Claude CLI
|
||||
if (this._screenManager && this._screenSession) {
|
||||
const success = this._screenManager.sendInput(this.id, data);
|
||||
if (success) {
|
||||
return;
|
||||
}
|
||||
// Fall through to PTY write if screen command failed
|
||||
}
|
||||
|
||||
if (this.ptyProcess) {
|
||||
this.ptyProcess.write(data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user