Skip to content

Commit 081e660

Browse files
committed
test(tui): split reset PTY fixture wiring
1 parent 16d9e9d commit 081e660

3 files changed

Lines changed: 14 additions & 12 deletions

File tree

‎src/tui/tui-pty-harness-fixture-test-support.ts‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { readFile, writeFile } from "node:fs/promises";
33
import path from "node:path";
44
import { pathToFileURL } from "node:url";
55
import { TUI_PTY_GAP_HISTORY_FIXTURE_SCRIPT } from "./tui-pty-gap-fixture-test-support.js";
6-
import { TUI_PTY_RESET_FIXTURE_SCRIPT } from "./tui-pty-reset-fixture-test-support.js";
6+
import { TUI_PTY_RESET_FIXTURE } from "./tui-pty-reset-fixture-test-support.js";
77
import { TUI_PTY_SESSION_SUBSCRIPTION_FIXTURE_SCRIPT } from "./tui-pty-subscription-fixture-test-support.js";
88
import { sleep, type PtyRun } from "./tui-pty-test-support.js";
99

@@ -33,10 +33,6 @@ export async function writeTuiPtyFixtureScript(dir: string) {
3333
const actionLogPath = process.env.OPENCLAW_TUI_PTY_LOG_PATH;
3434
const gatewayStatus = process.env.OPENCLAW_TUI_PTY_GATEWAY_STATUS ?? "fixture gateway ok";
3535
const startupDelayMs = Number(process.env.OPENCLAW_TUI_PTY_STARTUP_DELAY_MS ?? 0);
36-
const submitBurstWindowMs = Number(
37-
process.env.OPENCLAW_TUI_PTY_SUBMIT_BURST_WINDOW_MS ?? 0,
38-
);
39-
const ctrlCExitWindowMs = Number(process.env.OPENCLAW_TUI_PTY_CTRL_C_EXIT_WINDOW_MS ?? 0);
4036
const footerModel = process.env.OPENCLAW_TUI_PTY_MODEL;
4137
const footerThinkingLevel = process.env.OPENCLAW_TUI_PTY_THINKING_LEVEL;
4238
let verboseLevel = process.env.OPENCLAW_TUI_PTY_VERBOSE_LEVEL;
@@ -500,7 +496,7 @@ export async function writeTuiPtyFixtureScript(dir: string) {
500496
return { ok: true, key, entry: { ...sessionEntry(key), sessionId: "created-session" } };
501497
}
502498
503-
${TUI_PTY_RESET_FIXTURE_SCRIPT}
499+
${TUI_PTY_RESET_FIXTURE.methods}
504500
505501
async getGatewayStatus() {
506502
record("getGatewayStatus");
@@ -586,9 +582,7 @@ export async function writeTuiPtyFixtureScript(dir: string) {
586582
message: initialMessage,
587583
historyLimit: 5,
588584
title: "openclaw tui pty fixture",
589-
submitBurstWindowMs: submitBurstWindowMs > 0 ? submitBurstWindowMs : undefined,
590-
ctrlCExitWindowMs: ctrlCExitWindowMs > 0 ? ctrlCExitWindowMs : undefined,
591-
onSubmitBurstCaptured: (value) => record("submitBurstCaptured", { value }),
585+
${TUI_PTY_RESET_FIXTURE.options}
592586
});
593587
}
594588

‎src/tui/tui-pty-reset-fixture-test-support.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Generated fake-backend reset behavior for real PTY lifecycle proof.
2-
export const TUI_PTY_RESET_FIXTURE_SCRIPT = `
2+
export const TUI_PTY_RESET_FIXTURE = {
3+
methods: `
34
async resetSession(key: string, reason?: "new" | "reset") {
45
record("resetSession", { key, reason });
56
const releasePath = process.env.OPENCLAW_TUI_PTY_RESET_RELEASE_PATH;
@@ -19,4 +20,12 @@ export const TUI_PTY_RESET_FIXTURE_SCRIPT = `
1920
}
2021
return {};
2122
}
22-
`;
23+
`,
24+
options: `
25+
submitBurstWindowMs: (() => {
26+
const value = Number(process.env.OPENCLAW_TUI_PTY_SUBMIT_BURST_WINDOW_MS ?? 0);
27+
return value > 0 ? value : undefined;
28+
})(),
29+
onSubmitBurstCaptured: (value) => record("submitBurstCaptured", { value }),
30+
`,
31+
};

‎src/tui/tui-reset-transition-pty.e2e.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ describe("TUI reset transition PTY", () => {
3333
OPENCLAW_TUI_PTY_SUBMIT_BURST_WINDOW_MS: "1000",
3434
OPENCLAW_TUI_PTY_TYPE_CHUNK_SIZE: "1",
3535
OPENCLAW_TUI_PTY_TYPE_DELAY_MS: "2",
36-
OPENCLAW_TUI_PTY_CTRL_C_EXIT_WINDOW_MS: "5000",
3736
TERM_PROGRAM: "Apple_Terminal",
3837
NO_COLOR: undefined,
3938
},

0 commit comments

Comments
 (0)