centaurus-cli 2.8.2 → 2.8.4

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 (43) hide show
  1. package/dist/cli-adapter.d.ts +7 -0
  2. package/dist/cli-adapter.d.ts.map +1 -1
  3. package/dist/cli-adapter.js +66 -1
  4. package/dist/cli-adapter.js.map +1 -1
  5. package/dist/tools/file-ops.d.ts.map +1 -1
  6. package/dist/tools/file-ops.js +69 -14
  7. package/dist/tools/file-ops.js.map +1 -1
  8. package/dist/tools/find-files.d.ts +1 -0
  9. package/dist/tools/find-files.d.ts.map +1 -1
  10. package/dist/tools/find-files.js +77 -13
  11. package/dist/tools/find-files.js.map +1 -1
  12. package/dist/tools/grep-search.d.ts.map +1 -1
  13. package/dist/tools/grep-search.js +68 -15
  14. package/dist/tools/grep-search.js.map +1 -1
  15. package/dist/ui/components/App.d.ts.map +1 -1
  16. package/dist/ui/components/App.js +12 -4
  17. package/dist/ui/components/App.js.map +1 -1
  18. package/dist/ui/components/InputBox.d.ts +1 -0
  19. package/dist/ui/components/InputBox.d.ts.map +1 -1
  20. package/dist/ui/components/InputBox.js +10 -2
  21. package/dist/ui/components/InputBox.js.map +1 -1
  22. package/dist/ui/components/InteractiveShell.d.ts.map +1 -1
  23. package/dist/ui/components/InteractiveShell.js +1 -59
  24. package/dist/ui/components/InteractiveShell.js.map +1 -1
  25. package/dist/ui/components/MessageDisplay.d.ts.map +1 -1
  26. package/dist/ui/components/MessageDisplay.js +8 -0
  27. package/dist/ui/components/MessageDisplay.js.map +1 -1
  28. package/dist/ui/components/StreamingMessageDisplay.d.ts.map +1 -1
  29. package/dist/ui/components/StreamingMessageDisplay.js +8 -0
  30. package/dist/ui/components/StreamingMessageDisplay.js.map +1 -1
  31. package/dist/ui/components/ToolExecutionMessage.d.ts.map +1 -1
  32. package/dist/ui/components/ToolExecutionMessage.js +61 -35
  33. package/dist/ui/components/ToolExecutionMessage.js.map +1 -1
  34. package/dist/utils/file.d.ts +40 -0
  35. package/dist/utils/file.d.ts.map +1 -1
  36. package/dist/utils/file.js +164 -0
  37. package/dist/utils/file.js.map +1 -1
  38. package/dist/utils/terminal-output.d.ts +23 -0
  39. package/dist/utils/terminal-output.d.ts.map +1 -0
  40. package/dist/utils/terminal-output.js +94 -0
  41. package/dist/utils/terminal-output.js.map +1 -0
  42. package/models-config.json +5 -5
  43. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-output.d.ts","sourceRoot":"","sources":["../../src/utils/terminal-output.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA6EzD"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Utility for processing terminal output with proper carriage return handling.
3
+ *
4
+ * When commands output text with \r (carriage return), it means "go back to the start
5
+ * of the line" - used for spinners, progress bars, and other dynamic output.
6
+ *
7
+ * This module provides functions to correctly process such output so that only the
8
+ * final rendered state is preserved (not intermediate states that should be overwritten).
9
+ */
10
+ /**
11
+ * Process terminal output to properly handle carriage returns and ANSI sequences.
12
+ *
13
+ * This function simulates how a terminal would render the output:
14
+ * - \r (carriage return) moves cursor to the start of the line
15
+ * - \x1b[H (cursor home) also moves cursor to start - PTY uses this instead of \r
16
+ * - Subsequent text overwrites from the beginning
17
+ * - ANSI cursor sequences are handled appropriately
18
+ *
19
+ * @param raw - Raw terminal output with potential \r and ANSI sequences
20
+ * @returns Processed output with only the final rendered state
21
+ */
22
+ export function processTerminalOutput(raw) {
23
+ if (!raw)
24
+ return '';
25
+ // CRITICAL: Convert cursor home sequences (\x1b[H) to \r BEFORE other processing
26
+ // PTY terminals often use \x1b[H instead of \r for spinners/progress bars
27
+ // This must happen first so that carriage return handling works correctly
28
+ let cleaned = raw.replace(/\x1b\[H/g, '\r');
29
+ // Now strip other ANSI cursor movement sequences that could break the layout
30
+ // These include: cursor up/down/left/right, cursor position set, cursor save/restore, erase line/screen
31
+ // We keep color codes (handled by stripAnsi later) but handle cursor manipulation
32
+ cleaned = cleaned
33
+ // OSC sequences (Operating System Commands): \x1b]...\x07 or \x1b]...\x1b\\
34
+ // This includes hyperlinks (\x1b]8;;url\x1b\\text\x1b]8;;\x1b\\), title changes, etc.
35
+ .replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g, '')
36
+ // Also handle malformed/partial OSC sequences that may end with common terminators
37
+ .replace(/\x1b\][^\x07]*\x07/g, '')
38
+ // Erase in display: \x1b[J, \x1b[0J, \x1b[1J, \x1b[2J, \x1b[3J - remove without adding newlines
39
+ .replace(/\x1b\[\d*J/g, '')
40
+ // Cursor position: \x1b[n;mH or \x1b[n;mf - REPLACE WITH NEWLINE to preserve line structure
41
+ .replace(/\x1b\[\d+;\d+[Hf]/g, '\n')
42
+ // Simple cursor home without row/col: \x1b[H - already converted to \r above
43
+ .replace(/\x1b\[\d*[Hf]/g, '')
44
+ // Cursor down movement: \x1b[nB - REPLACE WITH NEWLINE
45
+ .replace(/\x1b\[\d*B/g, '\n')
46
+ // Cursor up/right/left: \x1b[nA (up), \x1b[nC (right), \x1b[nD (left) - just strip
47
+ .replace(/\x1b\[\d*[ACD]/g, '')
48
+ // Cursor save/restore: \x1b[s, \x1b[u, \x1b7, \x1b8
49
+ .replace(/\x1b\[[su]/g, '')
50
+ .replace(/\x1b[78]/g, '')
51
+ // Erase in line: \x1b[K, \x1b[0K, \x1b[1K, \x1b[2K
52
+ .replace(/\x1b\[\d*K/g, '')
53
+ // Scroll up/down: \x1b[nS, \x1b[nT
54
+ .replace(/\x1b\[\d*[ST]/g, '')
55
+ // Hide/show cursor: \x1b[?25h, \x1b[?25l
56
+ .replace(/\x1b\[\?25[hl]/g, '')
57
+ // Other DEC private mode sequences: \x1b[?...h, \x1b[?...l (like alternate screen)
58
+ .replace(/\x1b\[\?\d+[hl]/g, '')
59
+ // VT sequences for special modes
60
+ .replace(/\x1b\[\?\d+[a-zA-Z]/g, '')
61
+ // Erase character: \x1b[nX - strip (used for clearing parts of line)
62
+ .replace(/\x1b\[\d*X/g, '')
63
+ // SGR (Select Graphic Rendition) reset: \x1b[m
64
+ .replace(/\x1b\[m/g, '')
65
+ // Strip any remaining escape sequences ending with letters that might leak through
66
+ .replace(/\x1b\[\d*[a-zA-Z]/g, '');
67
+ // Clean up multiple consecutive newlines (max 2)
68
+ cleaned = cleaned.replace(/\n{3,}/g, '\n\n');
69
+ // Split by newlines first, then process each "line segment" for carriage returns
70
+ const segments = cleaned.split('\n');
71
+ const processedLines = [];
72
+ for (const segment of segments) {
73
+ // Split by \r and take the last non-empty part (simulates cursor returning to start)
74
+ const parts = segment.split('\r');
75
+ let finalLine = '';
76
+ for (const part of parts) {
77
+ if (part.length === 0)
78
+ continue;
79
+ // If the new part is shorter than current line, it overwrites from the start
80
+ // If longer or equal, it replaces the line
81
+ if (part.length >= finalLine.length) {
82
+ finalLine = part;
83
+ }
84
+ else {
85
+ // Overwrite from the beginning, keep the rest
86
+ finalLine = part + finalLine.slice(part.length);
87
+ }
88
+ }
89
+ processedLines.push(finalLine.trimEnd());
90
+ }
91
+ // Join and remove leading empty lines
92
+ return processedLines.join('\n').replace(/^\n+/, '');
93
+ }
94
+ //# sourceMappingURL=terminal-output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-output.js","sourceRoot":"","sources":["../../src/utils/terminal-output.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAW;IAC7C,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IAEpB,iFAAiF;IACjF,0EAA0E;IAC1E,0EAA0E;IAC1E,IAAI,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAE5C,6EAA6E;IAC7E,wGAAwG;IACxG,kFAAkF;IAClF,OAAO,GAAG,OAAO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M,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC7B,qFAAqF;QACrF,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,SAAS,GAAG,EAAE,CAAC;QAEnB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;gBAAE,SAAS;YAEhC,6EAA6E;YAC7E,2CAA2C;YAC3C,IAAI,IAAI,CAAC,MAAM,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;gBAClC,SAAS,GAAG,IAAI,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACJ,8CAA8C;gBAC9C,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACpD,CAAC;QACL,CAAC;QAED,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,sCAAsC;IACtC,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACzD,CAAC"}
@@ -18,7 +18,7 @@
18
18
  "temperature": 0.1,
19
19
  "topP": 0.95,
20
20
  "topK": 64,
21
- "maxOutputTokens": 8192
21
+ "maxOutputTokens": 32768
22
22
  }
23
23
  },
24
24
  {
@@ -39,7 +39,7 @@
39
39
  "temperature": 0.1,
40
40
  "topP": 0.95,
41
41
  "topK": 64,
42
- "maxOutputTokens": 8192
42
+ "maxOutputTokens": 32768
43
43
  }
44
44
  },
45
45
  {
@@ -59,7 +59,7 @@
59
59
  "temperature": 0.1,
60
60
  "topP": 0.95,
61
61
  "topK": 64,
62
- "maxOutputTokens": 8192
62
+ "maxOutputTokens": 32768
63
63
  }
64
64
  },
65
65
  {
@@ -79,7 +79,7 @@
79
79
  "temperature": 0.1,
80
80
  "topP": 0.95,
81
81
  "topK": 64,
82
- "maxOutputTokens": 8192
82
+ "maxOutputTokens": 32768
83
83
  }
84
84
  },
85
85
  {
@@ -99,7 +99,7 @@
99
99
  "temperature": 0.1,
100
100
  "topP": 0.95,
101
101
  "topK": 64,
102
- "maxOutputTokens": 8192
102
+ "maxOutputTokens": 32768
103
103
  }
104
104
  }
105
105
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "centaurus-cli",
3
- "version": "2.8.2",
3
+ "version": "2.8.4",
4
4
  "description": "A powerful command-line AI coding assistant with Google Gemini support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",