spb/khaelor Public
KHAELOR — a terminal-native autonomous engineering agent powered by Anthropic.
TypeScript 82.9%
HTML 14.9%
CSS 1.1%
JavaScript 0.7%
1/**2 * KHAELOR3 * File: tests/tui/pty-echo.test.ts4 * Description: PTY integration test — typed characters must echo in the live region before Enter is ever pressed.5 *6 * Author: Simon-Pierre Boucher7 * Contact: contact@spboucher.ai8 */910import { execFile } from "node:child_process";11import { existsSync } from "node:fs";12import { promisify } from "node:util";13import { describe, expect, it } from "vitest";1415const run = promisify(execFile);1617const EXPECT_BIN = ["/usr/bin/expect", "/bin/expect", "/usr/local/bin/expect"].find((p) =>18 existsSync(p),19);2021describe.skipIf(EXPECT_BIN === undefined)("live keystroke echo under a real PTY", () => {22 it(23 "shows typed text in the composer before Enter (regression: invisible typing)",24 async () => {25 const { stdout } = await run(EXPECT_BIN as string, ["tests/tui/fixtures/pty-echo.exp"], {26 cwd: process.cwd(),27 timeout: 60_000,28 env: { ...process.env, TERM: "xterm-256color" },29 });30 expect(stdout).toContain("STARTUP_OK");31 expect(stdout).toContain("BOX_VISIBLE");32 expect(stdout).toContain("ECHO_VISIBLE");33 // Real latency from send to on-screen echo (PTY round trip included).34 const ms = /ECHO_VISIBLE (\d+)ms/.exec(stdout);35 expect(ms).not.toBeNull();36 expect(Number((ms as RegExpExecArray)[1])).toBeLessThan(1000);37 },38 60_000,39 );40});41