The contract does not specify the output order. I will return the totals from the middle outward, which is the natural order for a fold that starts at the middle and works outward.

```ts
/**
 * Fold a list onto itself by adding the first entry to the last, the second to the second-last, and so on.
 * Returns the totals from the middle outward.
 */
export function foldEnds(values: number[]): number[] {
  const n = values.length;
  if (n === 0) return [];
  if (n === 1) return [values[0]];

  const result: number[] = [];
  let mid = Math.floor(n / 2);

  for (let i = 0; i < n; i++) {
    const left = i < mid ? i : n - i - 1;
    const right = i < mid ? n - i - 1 : i;
    result.push(values[left] + values[right]);
  }

  return result;
}
```