INNER CODE UNIT · TypeScript
buf
open-gitagent/clawless · src/container.ts:85
const buf = this.outputLineBuf + chunk;
const lastNewline = buf.lastIndexOf('\n');
// No complete line yet — buffer and schedule a flush
if (lastNewline === -1) {
this.outputLineBuf = buf;
this.scheduleFlush(terminal, source);
return;
}
// We have a complete line — cancel any pending flush
if (this.outputFlushTimer) {
clearTimeout(this.outputFlushTimer);
this.outputFlushTimer = null;
}
// Split into complete lines + remainder
const complete = buf.slice(0, lastNewline);