@howaboua/pi-codex-conversion 1.0.12 → 1.0.13
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.
package/package.json
CHANGED
|
@@ -70,6 +70,7 @@ export interface ExecSessionManagerOptions {
|
|
|
70
70
|
defaultWriteYieldTimeMs?: number;
|
|
71
71
|
minNonInteractiveExecYieldTimeMs?: number;
|
|
72
72
|
minEmptyWriteYieldTimeMs?: number;
|
|
73
|
+
maxSessionBufferChars?: number;
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
const DEFAULT_EXEC_YIELD_TIME_MS = 10_000;
|
|
@@ -80,6 +81,7 @@ const MIN_NON_INTERACTIVE_EXEC_YIELD_TIME_MS = 5_000;
|
|
|
80
81
|
const MIN_EMPTY_WRITE_YIELD_TIME_MS = 5_000;
|
|
81
82
|
const MAX_YIELD_TIME_MS = 30_000;
|
|
82
83
|
const MAX_COMMAND_HISTORY = 256;
|
|
84
|
+
const DEFAULT_MAX_SESSION_BUFFER_CHARS = 256 * 1024 * 1024;
|
|
83
85
|
|
|
84
86
|
function resolveWorkdir(baseCwd: string, workdir?: string): string {
|
|
85
87
|
if (!workdir) return baseCwd;
|
|
@@ -359,6 +361,7 @@ export function createExecSessionManager(options: ExecSessionManagerOptions = {}
|
|
|
359
361
|
MAX_YIELD_TIME_MS,
|
|
360
362
|
Math.max(MIN_YIELD_TIME_MS, options.minEmptyWriteYieldTimeMs ?? MIN_EMPTY_WRITE_YIELD_TIME_MS),
|
|
361
363
|
);
|
|
364
|
+
const maxSessionBufferChars = Math.max(1024, options.maxSessionBufferChars ?? DEFAULT_MAX_SESSION_BUFFER_CHARS);
|
|
362
365
|
|
|
363
366
|
function rememberCommand(sessionId: number, command: string): void {
|
|
364
367
|
commandHistory.set(sessionId, command);
|
|
@@ -388,6 +391,10 @@ export function createExecSessionManager(options: ExecSessionManagerOptions = {}
|
|
|
388
391
|
if (text.length === 0) return;
|
|
389
392
|
session.buffer =
|
|
390
393
|
session.kind === "pty" ? applyTerminalOutput(session, text) : `${session.buffer}${normalizePipeOutput(text)}`;
|
|
394
|
+
if (session.buffer.length > maxSessionBufferChars) {
|
|
395
|
+
session.buffer = session.buffer.slice(-maxSessionBufferChars);
|
|
396
|
+
session.emittedBuffer = "";
|
|
397
|
+
}
|
|
391
398
|
notify(session);
|
|
392
399
|
}
|
|
393
400
|
|