* Format persisted output result for tool response when output was truncated
( result: PersistedCommandOutput, exitDetails: ExitCodeDetails | undefined, workingDir: string, )
| 595 | * Format persisted output result for tool response when output was truncated |
| 596 | */ |
| 597 | function formatPersistedOutput( |
| 598 | result: PersistedCommandOutput, |
| 599 | exitDetails: ExitCodeDetails | undefined, |
| 600 | workingDir: string, |
| 601 | ): string { |
| 602 | const exitStatus = formatExitStatus(exitDetails) |
| 603 | const sizeStr = formatBytes(result.totalBytes) |
| 604 | const artifactId = result.artifactPath ? path.basename(result.artifactPath) : "" |
| 605 | |
| 606 | return [ |
| 607 | `Command executed in '${workingDir}'. ${exitStatus}`, |
| 608 | "", |
| 609 | `Output (${sizeStr}) persisted. Artifact ID: ${artifactId}`, |
| 610 | "", |
| 611 | "Preview:", |
| 612 | result.preview, |
| 613 | "", |
| 614 | "Use read_command_output tool to view full output if needed.", |
| 615 | ].join("\n") |
| 616 | } |
| 617 | |
| 618 | /** |
| 619 | * Format bytes to human-readable string |
no test coverage detected