mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-02 15:13:28 +08:00
Windows terminals emit control sequences (cursor movement, screen clearing) that leaked into session.tmp files and were injected verbatim into Claude's context on the next session start. Add a comprehensive stripAnsi() to utils.js that handles CSI, OSC, charset selection, and bare ESC sequences. Apply it in session-end.js (when extracting user messages from the transcript) and in session-start.js (safety net before injecting session content).
This commit is contained in:
@@ -21,6 +21,7 @@ const {
|
||||
readFile,
|
||||
writeFile,
|
||||
runCommand,
|
||||
stripAnsi,
|
||||
log
|
||||
} = require('../lib/utils');
|
||||
|
||||
@@ -58,8 +59,9 @@ function extractSessionSummary(transcriptPath) {
|
||||
: Array.isArray(rawContent)
|
||||
? rawContent.map(c => (c && c.text) || '').join(' ')
|
||||
: '';
|
||||
if (text.trim()) {
|
||||
userMessages.push(text.trim().slice(0, 200));
|
||||
const cleaned = stripAnsi(text).trim();
|
||||
if (cleaned) {
|
||||
userMessages.push(cleaned.slice(0, 200));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user