Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

545 B
Raw Blame
// Exact-text assertions compare a turn without its per-turn clock line, whose minute depends on when the test runs.
// Most engines lead with the clock; Codex trails it (see withTrailingTurnClock), so both ends are stripped.
import { TURN_CLOCK_LEAD } from "../turn-clock.ts";

const CLOCK_LEAD = new RegExp(`${TURN_CLOCK_LEAD}[^\\n]*\\n\\n`, "g");
const CLOCK_TAIL = new RegExp(`\\n\\n${TURN_CLOCK_LEAD}[^\\n]*$`, "g");

export function withoutTurnClock(text: string): string {
  return text.replace(CLOCK_LEAD, "").replace(CLOCK_TAIL, "");
}