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

Function sendAttachedClientInput

src/testing/tmuxHarness.ts:314–336  ·  view source on GitHub ↗
(
  client: TmuxAttachedClient,
  input: string,
  settleMs = 50,
)

Source from the content-addressed store, hash-verified

312}
313
314export async function sendAttachedClientInput(
315 client: TmuxAttachedClient,
316 input: string,
317 settleMs = 50,
318): Promise<void> {
319 if (client.process.stdin.destroyed) {
320 throw new Error('Attached tmux client stdin is closed')
321 }
322
323 await new Promise<void>((resolve, reject) => {
324 client.process.stdin.write(input, error => {
325 if (error) {
326 reject(error)
327 return
328 }
329 resolve()
330 })
331 })
332
333 if (settleMs > 0) {
334 await delay(settleMs)
335 }
336}
337
338function parsePaneMetrics(output: string): Omit<TmuxTraceFrame, 'label' | 'pane'> {
339 const [cursorX, cursorY, historySize, paneWidth, paneHeight] = output

Callers 1

captureAttachedTmuxTraceFunction · 0.85

Calls 3

delayFunction · 0.70
resolveFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected