MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / appendCapped

Function appendCapped

src/tools/browser/process-registry.ts:46–52  ·  view source on GitHub ↗

Truncate a buffer from the front, keeping the tail.

(buf: string, chunk: string)

Source from the content-addressed store, hash-verified

44
45/** Truncate a buffer from the front, keeping the tail. */
46function appendCapped(buf: string, chunk: string): string {
47 const combined = buf + chunk;
48 if (combined.length <= MAX_BUFFER_BYTES) return combined;
49 // Drop the oldest 25% to avoid copying on every single line of output.
50 const keepFrom = Math.floor(MAX_BUFFER_BYTES * 0.75);
51 return '…[earlier output truncated]…\n' + combined.slice(combined.length - keepFrom);
52}
53
54export interface StartOptions {
55 name: string;

Callers 1

startFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected