@deepseek-harness-tui/dsh-tui 0.7.1 → 0.7.3

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 (127) hide show
  1. package/README.md +7 -5
  2. package/bin/dsh-tui.js +42 -1
  3. package/cordis.patch.yml +10 -0
  4. package/lib/types/commands.js +1 -1
  5. package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
  6. package/lib/types/components/GoalTodoPanel.js +6 -1
  7. package/lib/types/components/HistorySearchDialog.d.ts.map +1 -1
  8. package/lib/types/components/HistorySearchDialog.js +5 -1
  9. package/lib/types/components/LoadedContextPanel.d.ts.map +1 -1
  10. package/lib/types/components/LoadedContextPanel.js +1 -1
  11. package/lib/types/components/MessageList.d.ts.map +1 -1
  12. package/lib/types/components/MessageList.js +5 -1
  13. package/lib/types/components/PromptInput.d.ts.map +1 -1
  14. package/lib/types/components/PromptInput.js +52 -74
  15. package/lib/types/components/SearchBox.d.ts +4 -0
  16. package/lib/types/components/SearchBox.d.ts.map +1 -1
  17. package/lib/types/components/SearchBox.js +101 -2
  18. package/lib/types/components/Spinner/SpinnerAnimationRow.d.ts +4 -1
  19. package/lib/types/components/Spinner/SpinnerAnimationRow.d.ts.map +1 -1
  20. package/lib/types/components/Spinner/SpinnerAnimationRow.js +10 -5
  21. package/lib/types/components/WorkingSpinner.d.ts +3 -1
  22. package/lib/types/components/WorkingSpinner.d.ts.map +1 -1
  23. package/lib/types/components/WorkingSpinner.js +2 -2
  24. package/lib/types/components/design-system/ThemedText.d.ts +9 -3
  25. package/lib/types/components/design-system/ThemedText.d.ts.map +1 -1
  26. package/lib/types/components/design-system/ThemedText.js +3 -5
  27. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
  28. package/lib/types/components/questions/AskUserQuestionPanel.js +52 -8
  29. package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
  30. package/lib/types/components/questions/PlanReviewPanel.js +12 -3
  31. package/lib/types/components/sessions/SessionListRow.d.ts +26 -0
  32. package/lib/types/components/sessions/SessionListRow.d.ts.map +1 -0
  33. package/lib/types/components/sessions/SessionListRow.js +35 -0
  34. package/lib/types/components/sessions/SessionPreview.d.ts +25 -0
  35. package/lib/types/components/sessions/SessionPreview.d.ts.map +1 -0
  36. package/lib/types/components/sessions/SessionPreview.js +60 -0
  37. package/lib/types/dsh-adapter/channel.d.ts +19 -4
  38. package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
  39. package/lib/types/dsh-adapter/channel.js +76 -82
  40. package/lib/types/dsh-adapter/compat/index.d.ts +1 -1
  41. package/lib/types/dsh-adapter/compat/index.d.ts.map +1 -1
  42. package/lib/types/dsh-adapter/compat/index.js +1 -1
  43. package/lib/types/dsh-adapter/compat/sessionLog.d.ts +8 -0
  44. package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -1
  45. package/lib/types/dsh-adapter/compat/sessionLog.js +1 -1
  46. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  47. package/lib/types/dsh-adapter/index.js +10 -1
  48. package/lib/types/dsh-adapter/packaged-presets.d.ts +22 -0
  49. package/lib/types/dsh-adapter/packaged-presets.d.ts.map +1 -0
  50. package/lib/types/dsh-adapter/packaged-presets.js +93 -0
  51. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  52. package/lib/types/dsh-adapter/plugin.js +53 -7
  53. package/lib/types/dsh-adapter/presets.d.ts +16 -0
  54. package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
  55. package/lib/types/dsh-adapter/presets.js +23 -0
  56. package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
  57. package/lib/types/dsh-adapter/providerWizard.js +3 -1
  58. package/lib/types/dsh-adapter/sessions/digest.d.ts +29 -0
  59. package/lib/types/dsh-adapter/sessions/digest.d.ts.map +1 -0
  60. package/lib/types/dsh-adapter/sessions/digest.js +224 -0
  61. package/lib/types/dsh-adapter/sessions/frames.d.ts +100 -0
  62. package/lib/types/dsh-adapter/sessions/frames.d.ts.map +1 -0
  63. package/lib/types/dsh-adapter/sessions/frames.js +246 -0
  64. package/lib/types/dsh-adapter/sessions/header.d.ts +50 -0
  65. package/lib/types/dsh-adapter/sessions/header.d.ts.map +1 -0
  66. package/lib/types/dsh-adapter/sessions/header.js +62 -0
  67. package/lib/types/dsh-adapter/sessions/index.d.ts +17 -0
  68. package/lib/types/dsh-adapter/sessions/index.d.ts.map +1 -0
  69. package/lib/types/dsh-adapter/sessions/index.js +15 -0
  70. package/lib/types/dsh-adapter/sessions/list.d.ts +41 -0
  71. package/lib/types/dsh-adapter/sessions/list.d.ts.map +1 -0
  72. package/lib/types/dsh-adapter/sessions/list.js +213 -0
  73. package/lib/types/dsh-adapter/sessions/store.d.ts +48 -0
  74. package/lib/types/dsh-adapter/sessions/store.d.ts.map +1 -0
  75. package/lib/types/dsh-adapter/sessions/store.js +164 -0
  76. package/lib/types/dsh-adapter/sessions/types.d.ts +142 -0
  77. package/lib/types/dsh-adapter/sessions/types.d.ts.map +1 -0
  78. package/lib/types/dsh-adapter/sessions/types.js +14 -0
  79. package/lib/types/i18n.d.ts +150 -22
  80. package/lib/types/i18n.d.ts.map +1 -1
  81. package/lib/types/i18n.js +45 -9
  82. package/lib/types/ink/components/Text.d.ts +9 -1
  83. package/lib/types/ink/components/Text.d.ts.map +1 -1
  84. package/lib/types/ink/components/Text.js +7 -6
  85. package/lib/types/ink/ink.d.ts.map +1 -1
  86. package/lib/types/ink/ink.js +4 -2
  87. package/lib/types/ink/log-update.d.ts.map +1 -1
  88. package/lib/types/ink/log-update.js +76 -9
  89. package/lib/types/ink/parse-keypress.d.ts.map +1 -1
  90. package/lib/types/ink/parse-keypress.js +4 -1
  91. package/lib/types/ink/terminal.d.ts +40 -4
  92. package/lib/types/ink/terminal.d.ts.map +1 -1
  93. package/lib/types/ink/terminal.js +57 -5
  94. package/lib/types/ink/termio/tokenize.d.ts +6 -0
  95. package/lib/types/ink/termio/tokenize.d.ts.map +1 -1
  96. package/lib/types/ink/termio/tokenize.js +18 -4
  97. package/lib/types/screens/Chat.d.ts +3 -2
  98. package/lib/types/screens/Chat.d.ts.map +1 -1
  99. package/lib/types/screens/Chat.js +104 -160
  100. package/lib/types/screens/SessionBrowser.d.ts +37 -0
  101. package/lib/types/screens/SessionBrowser.d.ts.map +1 -0
  102. package/lib/types/screens/SessionBrowser.js +452 -0
  103. package/lib/types/sessionHistory.d.ts +0 -8
  104. package/lib/types/sessionHistory.d.ts.map +1 -1
  105. package/lib/types/sessions/format.d.ts +117 -0
  106. package/lib/types/sessions/format.d.ts.map +1 -0
  107. package/lib/types/sessions/format.js +244 -0
  108. package/lib/types/sessions/view.d.ts +125 -0
  109. package/lib/types/sessions/view.d.ts.map +1 -0
  110. package/lib/types/sessions/view.js +234 -0
  111. package/lib/types/update.d.ts +21 -7
  112. package/lib/types/update.d.ts.map +1 -1
  113. package/lib/types/update.js +66 -16
  114. package/lib/types/utils/paths.d.ts.map +1 -1
  115. package/lib/types/utils/paths.js +4 -1
  116. package/package.json +37 -9
  117. package/presets/liangshen/.dsh-tui-managed.json +5 -0
  118. package/presets/liangshen/agent.cordis.yml +389 -0
  119. package/presets/liangshen/compaction-epoch.mjs +81 -0
  120. package/presets/liangshen/custom-bash.mjs +126 -0
  121. package/presets/liangshen/instruction-hint.mjs +181 -0
  122. package/presets/liangshen/preset.yml +3 -0
  123. package/presets/liangshen/skill-search.mjs +142 -0
  124. package/presets/liangshen/tool-bootstrap.mjs +300 -0
  125. package/lib/types/components/ResumePicker.d.ts +0 -26
  126. package/lib/types/components/ResumePicker.d.ts.map +0 -1
  127. package/lib/types/components/ResumePicker.js +0 -50
@@ -18,6 +18,20 @@ export type Progress = {
18
18
  * @returns true when the terminal supports OSC 9;4 progress reporting.
19
19
  */
20
20
  export declare function isProgressReportingAvailable(): boolean;
21
+ /**
22
+ * True when running inside a JetBrains IDE terminal (JediTerm). The IDE
23
+ * injects `TERMINAL_EMULATOR=JetBrains-JediTerm` into the pty environment of
24
+ * its local terminal sessions and sets no TERM_PROGRAM, so this is the only
25
+ * reliable local-JediTerm marker; it is also not forwarded over SSH by
26
+ * default (sshd only sends TERM), matching the local-terminal scope of the
27
+ * behaviors it gates.
28
+ *
29
+ * JediTerm's emulation diverges from xterm.js in exactly the places the
30
+ * renderer cares about (DEC 2026 support, DECSTBM semantics), so it is
31
+ * detected explicitly rather than left to TERM/TERM_PROGRAM fallbacks.
32
+ * @returns true when the process runs in a JetBrains IDE terminal.
33
+ */
34
+ export declare function isJetBrainsIdeTerminal(): boolean;
21
35
  /**
22
36
  * Checks if the terminal supports DEC mode 2026 (synchronized output).
23
37
  * When supported, BSU/ESU sequences prevent visible flicker during redraws.
@@ -53,16 +67,23 @@ export declare function supportsExtendedKeys(): boolean;
53
67
  /**
54
68
  * True when win32-input-mode (DECSET 9001, `CSI ? 9001 h`) should drive
55
69
  * keyboard input. This is a ConPTY feature — both Windows Terminal and
56
- * classic conhost switch into it when the app emits the sequence, so a
57
- * platform check alone covers both. In this mode every key arrives as a
58
- * full INPUT_RECORD (`CSI Vk;Sc;Uc;Kd;Cs;Rc _`), the only encoding that
70
+ * classic conhost switch into it when the app emits the sequence. In this
71
+ * mode every key arrives as a full INPUT_RECORD
72
+ * (`CSI Vk;Sc;Uc;Kd;Cs;Rc _`), the only encoding that
59
73
  * preserves Enter's Shift/Ctrl bits on Windows (issue #147). It replaces
60
74
  * the kitty/modifyOtherKeys push — callers must treat them as mutually
61
75
  * exclusive. Non-ConPTY Windows terminals (mintty via winpty) ignore the
62
76
  * unknown private mode and fall back to classic VT input unchanged.
77
+ *
78
+ * Embedded xterm.js hosts may identify as `TERM_PROGRAM=vscode` while using
79
+ * the xterm.js engine version as TERM_PROGRAM_VERSION (Termy 1.4.1 reports
80
+ * 6.0.0). They do not provide native ConPTY's input-mode contract: enabling
81
+ * 9001 can reduce arrows/mouse sequences to their trailing A-D/M bytes and
82
+ * interfere with IME commits (issue #215). Native VS Code reports its own
83
+ * 1.x application version and retains win32-input-mode support.
63
84
  * @returns true on native Windows (never in WSL — platform is linux there).
64
85
  */
65
- export declare function supportsWin32InputMode(): boolean;
86
+ export declare function supportsWin32InputMode(platform?: NodeJS.Platform, termProgram?: string | undefined, termProgramVersion?: string | undefined): boolean;
66
87
  /**
67
88
  * True if the terminal scrolls the viewport when it receives cursor-up
68
89
  * sequences that reach above the visible area. On Windows, conhost's
@@ -79,6 +100,21 @@ export declare function hasCursorUpViewportYankBug(): boolean;
79
100
  * so callers can pass a sync-skip hint gated to specific modes.
80
101
  */
81
102
  export declare const SYNC_OUTPUT_SUPPORTED: boolean;
103
+ /**
104
+ * Whether the DECSTBM hardware-scroll optimization may be used to paint
105
+ * ScrollBox scrolls. Called once per frame — the same env reads as the
106
+ * SYNC_OUTPUT_SUPPORTED gate, so the extra cost is a single comparison.
107
+ *
108
+ * JediTerm is explicitly excluded even though it implements DEC 2026: its
109
+ * scroll-region (DECSTBM) + CSI S/T handling deviates from xterm and, when
110
+ * driven per-frame by a diffing renderer, corrupts the screen progressively
111
+ * as content scrolls (the "JetBrains terminal slowly garbles" bug class).
112
+ * The diff engine falls back to repainting the shifted rows cell-by-cell,
113
+ * which every terminal renders identically. Same gate as upstream Claude
114
+ * Code, which hard-disables DECSTBM on JetBrains terminals.
115
+ * @returns true when DECSTBM scroll optimization is safe on this terminal.
116
+ */
117
+ export declare function isDecstbmSafe(): boolean;
82
118
  /**
83
119
  * The output streams a terminal renders to.
84
120
  */
@@ -1 +1 @@
1
- {"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../../src/ink/terminal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAKtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAKtC;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,eAAe,CAAA;IAC1D,UAAU,CAAC,EA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OAAO,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,IAAI,OAAO,CAwDvD;AAcD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEnD;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAGnC;AAyBD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAG9C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,WAAW,GAAE,MAAM,GAAG,SAAoC,EAC1D,kBAAkB,GAAE,MAAM,GAAG,SAA4C,GACxE,OAAO,CAOT;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,IAAI,OAAO,CAEpD;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,SAAkC,CAAA;AAEpE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAuBD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,EAAE,QAAQ,CAAA;IAChB,MAAM,EAAE,QAAQ,CAAA;CACjB,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,eAAe,UAAQ,GACtB,IAAI,CAqEN"}
@@ -48,6 +48,22 @@ export function isProgressReportingAvailable() {
48
48
  }
49
49
  return false;
50
50
  }
51
+ /**
52
+ * True when running inside a JetBrains IDE terminal (JediTerm). The IDE
53
+ * injects `TERMINAL_EMULATOR=JetBrains-JediTerm` into the pty environment of
54
+ * its local terminal sessions and sets no TERM_PROGRAM, so this is the only
55
+ * reliable local-JediTerm marker; it is also not forwarded over SSH by
56
+ * default (sshd only sends TERM), matching the local-terminal scope of the
57
+ * behaviors it gates.
58
+ *
59
+ * JediTerm's emulation diverges from xterm.js in exactly the places the
60
+ * renderer cares about (DEC 2026 support, DECSTBM semantics), so it is
61
+ * detected explicitly rather than left to TERM/TERM_PROGRAM fallbacks.
62
+ * @returns true when the process runs in a JetBrains IDE terminal.
63
+ */
64
+ export function isJetBrainsIdeTerminal() {
65
+ return process.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';
66
+ }
51
67
  /**
52
68
  * Checks if the terminal supports DEC mode 2026 (synchronized output).
53
69
  * When supported, BSU/ESU sequences prevent visible flicker during redraws.
@@ -71,6 +87,14 @@ export function isSynchronizedOutputSupported() {
71
87
  termProgram === 'alacritty') {
72
88
  return true;
73
89
  }
90
+ // JetBrains IDE terminals (JediTerm) implement DEC 2026 synchronized
91
+ // output; TERM_PROGRAM is unset there (only TERMINAL_EMULATOR is), so the
92
+ // env list above never matches. Frames wrapped in BSU/ESU land atomically
93
+ // in JediTerm's reworked block renderer — the same guarantee VS Code gets
94
+ // via TERM_PROGRAM=vscode — which keeps its partial-update reflow from
95
+ // scrambling continuously-updated screens.
96
+ if (isJetBrainsIdeTerminal())
97
+ return true;
74
98
  // kitty sets TERM=xterm-kitty or KITTY_WINDOW_ID
75
99
  if (term?.includes('kitty') || process.env.KITTY_WINDOW_ID)
76
100
  return true;
@@ -170,17 +194,28 @@ export function supportsExtendedKeys() {
170
194
  /**
171
195
  * True when win32-input-mode (DECSET 9001, `CSI ? 9001 h`) should drive
172
196
  * keyboard input. This is a ConPTY feature — both Windows Terminal and
173
- * classic conhost switch into it when the app emits the sequence, so a
174
- * platform check alone covers both. In this mode every key arrives as a
175
- * full INPUT_RECORD (`CSI Vk;Sc;Uc;Kd;Cs;Rc _`), the only encoding that
197
+ * classic conhost switch into it when the app emits the sequence. In this
198
+ * mode every key arrives as a full INPUT_RECORD
199
+ * (`CSI Vk;Sc;Uc;Kd;Cs;Rc _`), the only encoding that
176
200
  * preserves Enter's Shift/Ctrl bits on Windows (issue #147). It replaces
177
201
  * the kitty/modifyOtherKeys push — callers must treat them as mutually
178
202
  * exclusive. Non-ConPTY Windows terminals (mintty via winpty) ignore the
179
203
  * unknown private mode and fall back to classic VT input unchanged.
204
+ *
205
+ * Embedded xterm.js hosts may identify as `TERM_PROGRAM=vscode` while using
206
+ * the xterm.js engine version as TERM_PROGRAM_VERSION (Termy 1.4.1 reports
207
+ * 6.0.0). They do not provide native ConPTY's input-mode contract: enabling
208
+ * 9001 can reduce arrows/mouse sequences to their trailing A-D/M bytes and
209
+ * interfere with IME commits (issue #215). Native VS Code reports its own
210
+ * 1.x application version and retains win32-input-mode support.
180
211
  * @returns true on native Windows (never in WSL — platform is linux there).
181
212
  */
182
- export function supportsWin32InputMode() {
183
- return process.platform === 'win32';
213
+ export function supportsWin32InputMode(platform = process.platform, termProgram = process.env.TERM_PROGRAM, termProgramVersion = process.env.TERM_PROGRAM_VERSION) {
214
+ if (platform !== 'win32')
215
+ return false;
216
+ const version = coerce(termProgramVersion);
217
+ const isEmbeddedXtermJs = termProgram === 'vscode' && version !== null && version.major >= 5;
218
+ return !isEmbeddedXtermJs;
184
219
  }
185
220
  /**
186
221
  * True if the terminal scrolls the viewport when it receives cursor-up
@@ -200,6 +235,23 @@ export function hasCursorUpViewportYankBug() {
200
235
  * so callers can pass a sync-skip hint gated to specific modes.
201
236
  */
202
237
  export const SYNC_OUTPUT_SUPPORTED = isSynchronizedOutputSupported();
238
+ /**
239
+ * Whether the DECSTBM hardware-scroll optimization may be used to paint
240
+ * ScrollBox scrolls. Called once per frame — the same env reads as the
241
+ * SYNC_OUTPUT_SUPPORTED gate, so the extra cost is a single comparison.
242
+ *
243
+ * JediTerm is explicitly excluded even though it implements DEC 2026: its
244
+ * scroll-region (DECSTBM) + CSI S/T handling deviates from xterm and, when
245
+ * driven per-frame by a diffing renderer, corrupts the screen progressively
246
+ * as content scrolls (the "JetBrains terminal slowly garbles" bug class).
247
+ * The diff engine falls back to repainting the shifted rows cell-by-cell,
248
+ * which every terminal renders identically. Same gate as upstream Claude
249
+ * Code, which hard-disables DECSTBM on JetBrains terminals.
250
+ * @returns true when DECSTBM scroll optimization is safe on this terminal.
251
+ */
252
+ export function isDecstbmSafe() {
253
+ return SYNC_OUTPUT_SUPPORTED && !isJetBrainsIdeTerminal();
254
+ }
203
255
  /**
204
256
  * Render forensics: when DSH_TUI_RENDER_LOG names a file path, every painted
205
257
  * frame's raw ANSI bytes append to it (one JSON-escaped line per frame,
@@ -31,6 +31,12 @@ type TokenizerOptions = {
31
31
  * output streams, and enabling this there swallows display text. Default false.
32
32
  */
33
33
  x10Mouse?: boolean;
34
+ /**
35
+ * Emit standalone C0/DEL input controls as sequence tokens instead of
36
+ * merging them with adjacent text. Intended for stdin key parsing; output
37
+ * parsers leave this disabled so controls such as BEL and Tab remain text.
38
+ */
39
+ splitInputControls?: boolean;
34
40
  };
35
41
  /**
36
42
  * Create a streaming tokenizer for terminal input.
@@ -1 +1 @@
1
- {"version":3,"file":"tokenize.d.ts","sourceRoot":"","sources":["../../../../src/ink/termio/tokenize.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,sEAAsE;AACtE,MAAM,MAAM,KAAK,GACb;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAYvC,8EAA8E;AAC9E,MAAM,MAAM,SAAS,GAAG;IACtB,0CAA0C;IAC1C,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,CAAA;IAC5B,8CAA8C;IAC9C,KAAK,IAAI,KAAK,EAAE,CAAA;IAChB,4BAA4B;IAC5B,KAAK,IAAI,IAAI,CAAA;IACb,2CAA2C;IAC3C,MAAM,IAAI,MAAM,CAAA;CACjB,CAAA;AAED,KAAK,gBAAgB,GAAG;IACtB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAmCrE"}
1
+ {"version":3,"file":"tokenize.d.ts","sourceRoot":"","sources":["../../../../src/ink/termio/tokenize.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,sEAAsE;AACtE,MAAM,MAAM,KAAK,GACb;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAYvC,8EAA8E;AAC9E,MAAM,MAAM,SAAS,GAAG;IACtB,0CAA0C;IAC1C,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,CAAA;IAC5B,8CAA8C;IAC9C,KAAK,IAAI,KAAK,EAAE,CAAA;IAChB,4BAA4B;IAC5B,KAAK,IAAI,IAAI,CAAA;IACb,2CAA2C;IAC3C,MAAM,IAAI,MAAM,CAAA;CACjB,CAAA;AAED,KAAK,gBAAgB,GAAG;IACtB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,CA4CrE"}
@@ -5,7 +5,7 @@
5
5
  * Unlike the Parser which interprets sequences semantically, this just
6
6
  * identifies boundaries for use by keyboard input parsing.
7
7
  */
8
- import { C0, ESC_TYPE, isEscFinal } from './ansi.js';
8
+ import { C0, ESC_TYPE, isC0, isEscFinal } from './ansi.js';
9
9
  import { isCSIFinal, isCSIIntermediate, isCSIParam } from './csi.js';
10
10
  /**
11
11
  * Create a streaming tokenizer for terminal input.
@@ -24,15 +24,16 @@ export function createTokenizer(options) {
24
24
  let currentState = 'ground';
25
25
  let currentBuffer = '';
26
26
  const x10Mouse = options?.x10Mouse ?? false;
27
+ const splitInputControls = options?.splitInputControls ?? false;
27
28
  return {
28
29
  feed(input) {
29
- const result = tokenize(input, currentState, currentBuffer, false, x10Mouse);
30
+ const result = tokenize(input, currentState, currentBuffer, false, x10Mouse, splitInputControls);
30
31
  currentState = result.state.state;
31
32
  currentBuffer = result.state.buffer;
32
33
  return result.tokens;
33
34
  },
34
35
  flush() {
35
- const result = tokenize('', currentState, currentBuffer, true, x10Mouse);
36
+ const result = tokenize('', currentState, currentBuffer, true, x10Mouse, splitInputControls);
36
37
  currentState = result.state.state;
37
38
  currentBuffer = result.state.buffer;
38
39
  return result.tokens;
@@ -46,7 +47,7 @@ export function createTokenizer(options) {
46
47
  },
47
48
  };
48
49
  }
49
- function tokenize(input, initialState, initialBuffer, flush, x10Mouse) {
50
+ function tokenize(input, initialState, initialBuffer, flush, x10Mouse, splitInputControls) {
50
51
  const tokens = [];
51
52
  const result = {
52
53
  state: initialState,
@@ -82,6 +83,19 @@ function tokenize(input, initialState, initialBuffer, flush, x10Mouse) {
82
83
  result.state = 'escape';
83
84
  i++;
84
85
  }
86
+ else if (splitInputControls &&
87
+ isC0(code) &&
88
+ code !== C0.CR &&
89
+ code !== C0.LF) {
90
+ // stdin.read() can coalesce printable text and interactive control
91
+ // keys into one chunk. Keep Backspace, Tab, Ctrl+C, etc. as their
92
+ // own tokens so parseKeypress can expose the corresponding key
93
+ // flags instead of leaking the control byte into prompt text.
94
+ // CR/LF stay in text chunks for the Windows piped-line fallback.
95
+ flushText();
96
+ i++;
97
+ emitSequence(data.slice(i - 1, i));
98
+ }
85
99
  else {
86
100
  i++;
87
101
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { Channel } from '../dsh-adapter/channel.js';
2
+ import { type Channel } from '../dsh-adapter/channel.js';
3
3
  import type { QuestionStore } from '../dsh-adapter/questions.js';
4
4
  import { ApprovalStore } from '../dsh-adapter/approvals.js';
5
5
  export declare function Chat({ channel, questionStore, approvalStore, onExit, onUpdate, fullscreen, trajectorySeen: trajectorySeenProp, }: {
@@ -16,7 +16,8 @@ export declare function Chat({ channel, questionStore, approvalStore, onExit, on
16
16
  onUpdate?: () => void;
17
17
  /**
18
18
  * True when the host already wrapped this tree in `<AlternateScreen>`
19
- * (`fullscreen: true`). The trajectory scene needs this: entering the alt
19
+ * (`fullscreen: true`). Both full-screen surfaces need this — the trajectory
20
+ * scene and the session browser: entering the alt
20
21
  * screen a second time is harmless, but the inner unmount's DEC 1049 exit
21
22
  * would drop the whole app back to the main screen.
22
23
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/screens/Chat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,KAAK,EAAE,OAAO,EAAuC,MAAM,2BAA2B,CAAA;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AA2H3D,wBAAgB,IAAI,CAAC,EACnB,OAAO,EACP,aAAa,EACb,aAAa,EACb,MAAM,EACN,QAAQ,EACR,UAAkB,EAClB,cAAc,EAAE,kBAAkB,GACnC,EAAE;IACD,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE,aAAa,CAAA;IAC5B;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,qBA65DA"}
1
+ {"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/screens/Chat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,OAAO,EAAqB,KAAK,OAAO,EAAsD,M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