MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / extractFirstFrame

Function extractFirstFrame

source code/utils/staticRender.tsx:64–71  ·  view source on GitHub ↗

* Extracts content from the first complete frame in Ink's output. * Ink with non-TTY stdout outputs multiple frames, each wrapped in DEC synchronized * update sequences ([?2026h ... [?2026l). We only want the first frame's content.

(output: string)

Source from the content-addressed store, hash-verified

62 * update sequences ([?2026h ... [?2026l). We only want the first frame's content.
63 */
64function extractFirstFrame(output: string): string {
65 const startIndex = output.indexOf(SYNC_START);
66 if (startIndex === -1) return output;
67 const contentStart = startIndex + SYNC_START.length;
68 const endIndex = output.indexOf(SYNC_END, contentStart);
69 if (endIndex === -1) return output;
70 return output.slice(contentStart, endIndex);
71}
72
73/**
74 * Renders a React node to a string with ANSI escape codes (for terminal output).

Callers 1

renderToAnsiStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected