xonecas.io
64875
Mc

mini-coder / commit fbc02c0

fix: handle CTRL+D during LLM turns to exit cleanly

- Add CTRL+D (\x04) detection to getTurnControlAction
- Add CTRL+D detection to getSubagentControlAction
- CTRL+D now triggers quit action during active turns

xonecas2026-03-14 fbc02c0fb7b633be8f89691b2ce4c8f52987ef37 parent a789a52

1 file changed

src/cli/input-control.ts+4−2
@@ -1,15 +1,17 @@
11 const ESC = "\x1B";
22 const CTRL_C = "\x03";
3+const CTRL_D = "\x04";
34
45 const ESC_BYTE = ESC.charCodeAt(0);
56 const CTRL_C_BYTE = CTRL_C.charCodeAt(0);
7+const CTRL_D_BYTE = CTRL_D.charCodeAt(0);
68
79 export function getTurnControlAction(
810 chunk: Uint8Array,
911 ): "cancel" | "quit" | null {
1012 if (chunk.length === 1 && chunk[0] === ESC_BYTE) return "cancel";
1113 for (const byte of chunk) {
12- if (byte === CTRL_C_BYTE) return "quit";
14+ if (byte === CTRL_C_BYTE || byte === CTRL_D_BYTE) return "quit";
1315 }
1416 return null;
1517 }
@@ -18,7 +20,7 @@ export function getSubagentControlAction(
1820 chunk: Uint8Array,
1921 ): "cancel" | "quit" | null {
2022 for (const byte of chunk) {
21- if (byte === CTRL_C_BYTE) return "quit";
23+ if (byte === CTRL_C_BYTE || byte === CTRL_D_BYTE) return "quit";
2224 }
2325 for (const byte of chunk) {
2426 if (byte === ESC_BYTE) return "cancel";