Add pi-tool-display (compact tool rendering, adaptive diffs) + pi-lsp-extension (LSP diagnostics/hover/definitions) — vendored from npm 0.5.0 / 1.3.0

This commit is contained in:
2026-08-05 07:07:51 +10:00
parent b13022a6fd
commit 41cc33d141
92 changed files with 27025 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
export interface WriteCallSummaryOptions {
hasContent: boolean;
hasDetailedResultHeader: boolean;
}
export function splitWriteContentLines(content: string): string[] {
if (!content) {
return [];
}
const normalized = content.replace(/\r/g, "");
const lines = normalized.split("\n");
if (lines.length > 0 && lines[lines.length - 1] === "") {
lines.pop();
}
return lines;
}
export function countWriteContentLines(value: unknown): number {
return typeof value === "string" ? splitWriteContentLines(value).length : 0;
}
export function getWriteContentSizeBytes(value: unknown): number {
return typeof value === "string" ? Buffer.byteLength(value, "utf8") : 0;
}
export function shouldRenderWriteCallSummary(
options: WriteCallSummaryOptions,
): boolean {
return options.hasContent && !options.hasDetailedResultHeader;
}