MCPcopy Create free account
hub / github.com/Noumena-Network/code / waitForPromptRows

Function waitForPromptRows

src/ink/wrapperPtyInputContract.test.ts:25–41  ·  view source on GitHub ↗
(
  fixture: WrapperTmuxFixture,
  predicate: (rows: string[]) => boolean,
  timeoutMs = 2_000,
)

Source from the content-addressed store, hash-verified

23const liveFixtures: WrapperTmuxFixture[] = []
24
25async function waitForPromptRows(
26 fixture: WrapperTmuxFixture,
27 predicate: (rows: string[]) => boolean,
28 timeoutMs = 2_000,
29): Promise<string | null> {
30 const deadline = Date.now() + timeoutMs
31 let pane = ''
32 while (Date.now() < deadline) {
33 pane = capturePane(fixture.session, { startLine: 0 })
34 const promptRows = readVisibleRows(readPromptBand(pane, { rowsBelow: 3 }))
35 if (predicate(promptRows)) {
36 return pane
37 }
38 await Bun.sleep(50)
39 }
40 return null
41}
42
43async function enterMultilinePrompt(fixture: WrapperTmuxFixture): Promise<string> {
44 let pane = ''

Callers 1

enterMultilinePromptFunction · 0.85

Calls 4

capturePaneFunction · 0.85
readVisibleRowsFunction · 0.85
readPromptBandFunction · 0.85
sleepMethod · 0.80

Tested by

no test coverage detected