MCPcopy Create free account
hub / github.com/apache/maka / formatPtyControlOperation

Function formatPtyControlOperation

packages/cli/src/pi-transcript-tools.ts:686–713  ·  view source on GitHub ↗
(
  operation: ShellRunOperation | undefined,
  args: unknown,
)

Source from the content-addressed store, hash-verified

684}
685
686function formatPtyControlOperation(
687 operation: ShellRunOperation | undefined,
688 args: unknown,
689): string {
690 if (operation?.kind !== 'pty_control') return 'Background terminal interaction failed';
691 const parts: string[] = [];
692 if (operation.input) {
693 const preview = readWriteStdinInputPreview(args);
694 const action = operation.input.queued ? 'Entered' : 'Not entered';
695 if (preview) {
696 parts.push(
697 preview.truncated
698 ? `${action}: ${preview.text}… · ${operation.input.bytes} bytes total`
699 : `${action}: ${preview.text}`,
700 );
701 } else {
702 parts.push(`${action} ${operation.input.bytes} bytes`);
703 }
704 }
705 if (operation.resize) {
706 const size = `${operation.resize.cols}x${operation.resize.rows}`;
707 if (!operation.resize.applied) parts.push(`Did not resize to ${size}`);
708 else if (operation.resize.changed) parts.push(`Resized to ${size}`);
709 else if (!operation.input) parts.push(`Size already ${size}`);
710 }
711 if (operation.failed) parts.push('Background terminal interaction failed');
712 return parts.join(' · ') || 'Background terminal interaction completed';
713}
714
715function toolInputSummary(entry: MakaPiToolEntry): string {
716 const input = entry.input;

Callers 2

compactToolSummaryFunction · 0.85
renderToolResultFunction · 0.85

Calls 3

joinMethod · 0.80
pushMethod · 0.65

Tested by

no test coverage detected