File size: 645 Bytes
253e783
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Link-understanding formatter appends normalized fetched-link summaries to the agent-visible message body.
import { normalizeStringEntries } from "@openclaw/normalization-core/string-normalization";

/** Appends normalized link-understanding outputs to the agent-visible body. */
export function formatLinkUnderstandingBody(params: { body?: string; outputs: string[] }): string {
  const outputs = normalizeStringEntries(params.outputs);
  if (outputs.length === 0) {
    return params.body ?? "";
  }

  const base = (params.body ?? "").trim();
  if (!base) {
    return outputs.join("\n");
  }
  return `${base}\n\n${outputs.join("\n")}`;
}