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

Function captureAttachedTmuxTrace

src/testing/tmuxHarness.ts:435–480  ·  view source on GitHub ↗
(
  session: IsolatedTmuxSession,
  steps: readonly TmuxAttachedTraceStep[],
  opts?: CaptureAttachedTmuxTraceOptions,
)

Source from the content-addressed store, hash-verified

433}
434
435export async function captureAttachedTmuxTrace(
436 session: IsolatedTmuxSession,
437 steps: readonly TmuxAttachedTraceStep[],
438 opts?: CaptureAttachedTmuxTraceOptions,
439): Promise<TmuxTraceFrame[]> {
440 const client = await attachTmuxClient(session, {
441 timeoutMs: opts?.attachTimeoutMs,
442 })
443
444 try {
445 const initialDelayMs = opts?.initialDelayMs ?? 0
446 if (initialDelayMs > 0) {
447 await delay(initialDelayMs)
448 }
449
450 const frames: TmuxTraceFrame[] = []
451 if (opts?.captureInitial ?? true) {
452 frames.push(
453 capturePaneFrame(
454 session,
455 opts?.initialLabel ?? 'initial',
456 opts?.paneCapture,
457 ),
458 )
459 }
460
461 for (const step of steps) {
462 if (step.input !== undefined && step.input.length > 0) {
463 await sendAttachedClientInput(client, step.input, step.settleMs ?? 50)
464 } else {
465 const settleMs = step.settleMs ?? 0
466 if (settleMs > 0) {
467 await delay(settleMs)
468 }
469 }
470
471 if (step.capture ?? true) {
472 frames.push(capturePaneFrame(session, step.label, opts?.paneCapture))
473 }
474 }
475
476 return frames
477 } finally {
478 await detachTmuxClient(session, client)
479 }
480}

Callers 1

Calls 5

attachTmuxClientFunction · 0.85
capturePaneFrameFunction · 0.85
sendAttachedClientInputFunction · 0.85
detachTmuxClientFunction · 0.85
delayFunction · 0.70

Tested by

no test coverage detected