INNER CODE UNIT · TypeScript

boundedReadResult

yvgude/lean-ctx · packages/pi-lean-ctx/extensions/index.ts:237

function boundedReadResult(text: string, details: Record<string, unknown>, sourceText?: string) {
  const bounded = boundReadOutput(text, { sourceText });
  return {
    content: [{ type: "text" as const, text: bounded.text }],
    details: bounded.truncation ? { ...details, truncation: bounded.truncation } : details,
  };
}

function replaceTabs(text: string) {
  return text.replace(/\t/g, "    ");
}

function trimTrailingEmpty(lines: string[]) {
  let end = lines.length;
  while (end > 0 && lines[end - 1] === "") end--;
  return lines.slice(0, end);
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…