fix(single-line): join lines by split and trim instead of a backtracking regex

/\s*[\r\n]+\s*/g backtracks over every start position of a long
whitespace run, so 50,000 spaces took over a second. Split on line breaks,
trim each line, drop blank ones and join with a space: linear, and a
leading or trailing blank line no longer leaves a space behind. A prompt
without a line break is still returned unchanged. session-auto-ops now
imports toSingleLine from the utils barrel like respawn-controller.

Co-Authored-By: Christian Haberl <116439789+christianhaberl@users.noreply.github.com>
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
committed 2026-10-21 08:03:53 +02:00
1 parent 225fdbf505
commit 3b747774f1
3 files changed
+36 -11

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@
import { EventEmitter } from 'node:events';
import { detectUsageLimitPause } from './usage-limit-patterns.js';
import { toSingleLine } from './utils/single-line.js';
import { toSingleLine } from './utils/index.js';
// ============================================================================
// Timing Constants