The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 04:30 UTC
Revert "fix(web): terminal controls no longer cover the first line" (#30493)
Julius Marminge committed
Nov 3, 2026 at 16:17 UTC
66e6217b9303be978c7f19df6895bd332e84548e
8 files changed
+88
-559
apps/web/src/components/ThreadTerminalDrawer.tsx
+88
-56
@@ -1777,53 +1777,6 @@ export default function ThreadTerminalDrawer({
1777
);
1778
}
1779
1780
- // The single-terminal row and the split sidebar header share these controls,
1781
- // so neither layout floats them over terminal text.
1782
- const terminalActions = (
1783
- <div className="inline-flex h-full items-stretch">
1784
- <TerminalActionButton
1785
- disabled={!canOperateTerminal}
1786
- className={`inline-flex h-full items-center px-1 text-foreground/90 transition-colors ${
1787
- hasReachedSplitLimit
1788
- ? "cursor-not-allowed opacity-64 hover:bg-transparent"
1789
- : "hover:bg-accent/70"
1790
- }`}
1791
- onClick={onSplitTerminalAction}
1792
- label={splitTerminalActionLabel}
1793
- >
1794
- <SquareSplitHorizontal className="size-3.25" />
1795
- </TerminalActionButton>
1796
- <TerminalActionButton
1797
- disabled={!canOperateTerminal}
1798
- className={`inline-flex h-full items-center border-l border-border/70 px-1 text-foreground/90 transition-colors ${
1799
- hasReachedSplitLimit
1800
- ? "cursor-not-allowed opacity-64 hover:bg-transparent"
1801
- : "hover:bg-accent/70"
1802
- }`}
1803
- onClick={onSplitTerminalVerticalAction}
1804
- label={splitTerminalVerticalActionLabel}
1805
- >
1806
- <SquareSplitVertical className="size-3.25" />
1807
- </TerminalActionButton>
1808
- <TerminalActionButton
1809
- disabled={!canOperateTerminal}
1810
- className="inline-flex h-full items-center border-l border-border/70 px-1 text-foreground/90 transition-colors hover:bg-accent/70"
1811
- onClick={onNewTerminalAction}
1812
- label={newTerminalActionLabel}
1813
- >
1814
- <Plus className="size-3.25" />
1815
- </TerminalActionButton>
1816
- <TerminalActionButton
1817
- disabled={!canOperateTerminal}
1818
- className="inline-flex h-full items-center border-l border-border/70 px-1 text-foreground/90 transition-colors hover:bg-accent/70"
1819
- onClick={() => confirmCloseTerminal(resolvedActiveTerminalId)}
1820
- label={closeTerminalActionLabel}
1821
- >
1822
- <Trash2 className="size-3.25" />
1823
- </TerminalActionButton>
1824
- </div>
1825
- );
1826
-
1780
return (
1781
<aside
1782
ref={drawerRef}
@@ -1848,14 +1801,52 @@ export default function ThreadTerminalDrawer({
1801
) : null}
1802
1803
{!hasTerminalSidebar && (
1851
- <div
1852
- className={cn(
1853
- "flex shrink-0 items-stretch justify-end border-b border-border/70",
1854
- // The drawer's resize strip covers its top 6px; keep the buttons below it.
1855
- isPanel ? "h-[22px]" : "h-7 pt-1.5",
1856
- )}
1857
- >
1858
- {terminalActions}
1804
+ <div className="pointer-events-none absolute right-2 top-2 z-20">
1805
+ <div className="pointer-events-auto inline-flex items-center overflow-hidden rounded-md border border-border/80 bg-background shadow-xs">
1806
+ <TerminalActionButton
1807
+ disabled={!canOperateTerminal}
1808
+ className={`p-1 text-foreground/90 transition-colors ${
1809
+ hasReachedSplitLimit
1810
+ ? "cursor-not-allowed opacity-64 hover:bg-transparent"
1811
+ : "hover:bg-accent"
1812
+ }`}
1813
+ onClick={onSplitTerminalAction}
1814
+ label={splitTerminalActionLabel}
1815
+ >
1816
+ <SquareSplitHorizontal className="size-3.25" />
1817
+ </TerminalActionButton>
1818
+ <div className="h-4 w-px bg-border/80" />
1819
+ <TerminalActionButton
1820
+ disabled={!canOperateTerminal}
1821
+ className={`p-1 text-foreground/90 transition-colors ${
1822
+ hasReachedSplitLimit
1823
+ ? "cursor-not-allowed opacity-64 hover:bg-transparent"
1824
+ : "hover:bg-accent"
1825
+ }`}
1826
+ onClick={onSplitTerminalVerticalAction}
1827
+ label={splitTerminalVerticalActionLabel}
1828
+ >
1829
+ <SquareSplitVertical className="size-3.25" />
1830
+ </TerminalActionButton>
1831
+ <div className="h-4 w-px bg-border/80" />
1832
+ <TerminalActionButton
1833
+ disabled={!canOperateTerminal}
1834
+ className="p-1 text-foreground/90 transition-colors hover:bg-accent"
1835
+ onClick={onNewTerminalAction}
1836
+ label={newTerminalActionLabel}
1837
+ >
1838
+ <Plus className="size-3.25" />
1839
+ </TerminalActionButton>
1840
+ <div className="h-4 w-px bg-border/80" />
1841
+ <TerminalActionButton
1842
+ disabled={!canOperateTerminal}
1843
+ className="p-1 text-foreground/90 transition-colors hover:bg-accent"
1844
+ onClick={() => confirmCloseTerminal(resolvedActiveTerminalId)}
1845
+ label={closeTerminalActionLabel}
1846
+ >
1847
+ <Trash2 className="size-3.25" />
1848
+ </TerminalActionButton>
1849
+ </div>
1850
</div>
1851
)}
1852
@@ -1887,7 +1878,48 @@ export default function ThreadTerminalDrawer({
1878
{hasTerminalSidebar && (
1879
<aside className="flex w-36 min-w-36 flex-col border border-border/70 bg-muted/10">
1880
<div className="flex h-[22px] items-stretch justify-end border-b border-border/70">
1890
- {terminalActions}
1881
+ <div className="inline-flex h-full items-stretch">
1882
+ <TerminalActionButton
1883
+ disabled={!canOperateTerminal}
1884
+ className={`inline-flex h-full items-center px-1 text-foreground/90 transition-colors ${
1885
+ hasReachedSplitLimit
1886
+ ? "cursor-not-allowed opacity-64 hover:bg-transparent"
1887
+ : "hover:bg-accent/70"
1888
+ }`}
1889
+ onClick={onSplitTerminalAction}
1890
+ label={splitTerminalActionLabel}
1891
+ >
1892
+ <SquareSplitHorizontal className="size-3.25" />
1893
+ </TerminalActionButton>
1894
+ <TerminalActionButton
1895
+ disabled={!canOperateTerminal}
1896
+ className={`inline-flex h-full items-center border-l border-border/70 px-1 text-foreground/90 transition-colors ${
1897
+ hasReachedSplitLimit
1898
+ ? "cursor-not-allowed opacity-64 hover:bg-transparent"
1899
+ : "hover:bg-accent/70"
1900
+ }`}
1901
+ onClick={onSplitTerminalVerticalAction}
1902
+ label={splitTerminalVerticalActionLabel}
1903
+ >
1904
+ <SquareSplitVertical className="size-3.25" />
1905
+ </TerminalActionButton>
1906
+ <TerminalActionButton
1907
+ disabled={!canOperateTerminal}
1908
+ className="inline-flex h-full items-center border-l border-border/70 px-1 text-foreground/90 transition-colors hover:bg-accent/70"
1909
+ onClick={onNewTerminalAction}
1910
+ label={newTerminalActionLabel}
1911
+ >
1912
+ <Plus className="size-3.25" />
1913
+ </TerminalActionButton>
1914
+ <TerminalActionButton
1915
+ disabled={!canOperateTerminal}
1916
+ className="inline-flex h-full items-center border-l border-border/70 px-1 text-foreground/90 transition-colors hover:bg-accent/70"
1917
+ onClick={() => confirmCloseTerminal(resolvedActiveTerminalId)}
1918
+ label={closeTerminalActionLabel}
1919
+ >
1920
+ <Trash2 className="size-3.25" />
1921
+ </TerminalActionButton>
1922
+ </div>
1923
</div>
1924
1925
<div className="min-h-0 flex-1 overflow-y-auto px-1 py-1">
apps/web/test/fixtures/terminal-layout/capture.mjs
deleted
-52
@@ -1,52 +0,0 @@
1
-export const frozenTime = Date.UTC(2026, 9, 21, 22, 30);
2
-
3
-// Freeze wall-clock labels without changing animation or recording timing.
4
-export function freezeClock() {
5
- const RealDate = globalThis.__evidenceRealDate ?? Date;
6
- globalThis.__evidenceRealDate = RealDate;
7
- globalThis.Date = class extends RealDate {
8
- constructor(...args) {
9
- super(...(args.length ? args : [frozenTime]));
10
- }
11
- static now() {
12
- return frozenTime;
13
- }
14
- };
15
-}
16
-
17
-export async function metadata(provenance) {
18
- await document.fonts.ready;
19
- const box = (selector) =>
20
- [...document.querySelectorAll(selector)].map((el) => {
21
- const r = el.getBoundingClientRect();
22
- return { x: r.x, y: r.y, width: r.width, height: r.height };
23
- });
24
- return {
25
- ...provenance,
26
- userAgent: navigator.userAgent,
27
- platform: navigator.platform,
28
- locale: navigator.language,
29
- timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
30
- frozenTime: new Date().toISOString(),
31
- devicePixelRatio,
32
- viewport: { width: innerWidth, height: innerHeight },
33
- visualViewportScale: visualViewport.scale,
34
- rootFontSize: getComputedStyle(document.documentElement).fontSize,
35
- rootClass: document.documentElement.className,
36
- fonts: [...document.fonts]
37
- .filter((f) => f.status === "loaded")
38
- .map((f) => ({ family: f.family, style: f.style, weight: f.weight })),
39
- terminal: box("[data-thread-terminal-drawer]"),
40
- canvases: box("canvas"),
41
- composer: box('[role="textbox"][contenteditable="true"]'),
42
- scroll: [...document.querySelectorAll("*")]
43
- .filter((e) => e.scrollTop || e.scrollLeft)
44
- .map((e) => ({
45
- tag: e.tagName,
46
- className: e.className,
47
- top: e.scrollTop,
48
- left: e.scrollLeft,
49
- })),
50
- reducedMotion: matchMedia("(prefers-reduced-motion: reduce)").matches,
51
- };
52
-}
apps/web/test/fixtures/terminal-layout/driver.mjs
deleted
-85
@@ -1,85 +0,0 @@
1
-import * as NodeChildProcess from "node:child_process";
2
-import * as NodeFSP from "node:fs/promises";
3
-import * as NodePath from "node:path";
4
-
5
-// The caller supplies the harness's T3 preview tool dispatcher, not Playwright.
6
-export async function createDriver(
7
- callPreview,
8
- { tabId, outputDir, repoDir, run, phase, sourceTreeSha },
9
-) {
10
- await NodeFSP.mkdir(outputDir, { recursive: true });
11
- await NodeFSP.mkdir("/tmp/t3-terminal-evidence", { recursive: true });
12
- const events = [];
13
- const captures = [];
14
- const started = Date.now();
15
- const git = (...args) =>
16
- NodeChildProcess.execFileSync("git", args, { cwd: repoDir, encoding: "utf8" }).trim();
17
- const provenance = {
18
- headSha: git("rev-parse", "HEAD"),
19
- sourceTreeSha,
20
- terminalBlob: git("hash-object", "apps/web/src/components/ThreadTerminalDrawer.tsx"),
21
- workingTreeStatus: git("status", "--short"),
22
- phase,
23
- };
24
- let milestones;
25
- let pendingMilestones;
26
- const decode = (result) =>
27
- result.structuredContent ??
28
- JSON.parse(result.content.find((item) => item.type === "text").text);
29
- // Watch before the action that starts a shell, so fast prompts cannot race the watcher.
30
- const arm = async () => {
31
- await milestones?.return();
32
- milestones = NodeFSP.watch("/tmp/t3-terminal-evidence");
33
- pendingMilestones = milestones.next();
34
- };
35
- const call = async (name, args = {}) => {
36
- if (name === "press" && args.key === "Enter") await arm();
37
- const result = await callPreview(name, { ...args, tabId });
38
- events.push({ run, ms: Date.now() - started, op: name, args, isError: !!result.isError });
39
- if (result.isError) throw new Error(JSON.stringify(result));
40
- return decode(result);
41
- };
42
- const evaluate = async (expression) => (await call("evaluate", { expression })).value;
43
- const driver = {
44
- call,
45
- evaluate,
46
- arm,
47
- ready: async (pane) => {
48
- if (!milestones) throw new Error(`Terminal readiness for ${pane} was not armed`);
49
- for (;;) {
50
- const event = await pendingMilestones;
51
- if (event.done) throw new Error("Terminal readiness watcher ended");
52
- if (event.value.filename === `ready-${pane}`) break;
53
- pendingMilestones = milestones.next();
54
- }
55
- await milestones.return();
56
- milestones = undefined;
57
- pendingMilestones = undefined;
58
- },
59
- columns: async () =>
60
- Number(
61
- (await NodeFSP.readFile("/tmp/t3-terminal-evidence/input-size", "utf8"))
62
- .trim()
63
- .split(/\s+/)[1],
64
- ),
65
- note: async (note, data) => events.push({ run, ms: Date.now() - started, note, data }),
66
- checkpoint: async (checkpoint) => {
67
- const meta = await evaluate(
68
- `(async()=>{const m=await import('/test/fixtures/terminal-layout/capture.mjs');return m.metadata(${JSON.stringify(provenance)})})()`,
69
- );
70
- const snapshot = await call("snapshot", { save: true });
71
- const target = NodePath.join(outputDir, `${run}-${checkpoint}.png`);
72
- await NodeFSP.copyFile(snapshot.screenshotPath, target);
73
- captures.push({ run, checkpoint, path: target, meta });
74
- events.push({ run, ms: Date.now() - started, checkpoint, path: target });
75
- },
76
- finish: async () => {
77
- await milestones?.return();
78
- await NodeFSP.writeFile(
79
- NodePath.join(outputDir, `${run}.json`),
80
- JSON.stringify({ provenance, events, captures }, null, 2),
81
- );
82
- },
83
- };
84
- return driver;
85
-}
apps/web/test/fixtures/terminal-layout/manifest.json
deleted
-38
@@ -1,38 +0,0 @@
1
-{
2
- "frozenUtc": "2026-10-21T22:30:00.000Z",
3
- "viewports": {
4
- "W": [1440, 900],
5
- "N": [390, 900]
6
- },
7
- "themes": ["light", "dark"],
8
- "static": ["P1-W-L", "P1-W-D", "P1-N-L", "P1-N-D", "D1-W-L", "D1-W-D", "D1-N-L", "D1-N-D"],
9
- "recordings": ["RP-W-D", "RP-N-L", "RD-W-D", "RD-N-L"],
10
- "permissionUnavailable": ["Q1-N-L", "Q2-W-D"],
11
- "shellCommand": "bash <checkout>/apps/web/test/fixtures/terminal-layout/shell.sh A",
12
- "drawerHeight": 280,
13
- "diff": {
14
- "zero": {
15
- "threshold": 0,
16
- "gain": 8
17
- },
18
- "thresholded": {
19
- "threshold": 8,
20
- "gain": 8
21
- },
22
- "raw": {
23
- "threshold": 0,
24
- "gain": 1
25
- }
26
- },
27
- "historical": {
28
- "baselineApp": "70e5e384dab96a1d1e4a253ee5a9415ed5d8ce30",
29
- "afterApp": "ec679087f9029cc9be36fc76e1f95e2ffb692dce"
30
- },
31
- "baselineApp": "b5a226e49c52ecab4ddc2d678a7012d97e651a6a",
32
- "afterApp": "Resolve HEAD at capture time; includes finalized fixtures",
33
- "terminalBlobs": {
34
- "before": "0a12a6535c2d56325ef3193068b44c5ef08eb4b2",
35
- "after": "9626c2640b7d20fc38c972ed6fd3af250a434c16"
36
- },
37
- "setup": "Pair an isolated dev server; createDriver dispatches T3 preview tools for one owned tab; setup creates a fresh draft and shell. Call replay with the returned threadRef/threadKey. Use typeFirstLine for pending-input captures. Stop the server before seed.mjs."
38
-}
apps/web/test/fixtures/terminal-layout/replay.mjs
deleted
-196
@@ -1,196 +0,0 @@
1
-// The driver invokes only T3 preview tools. Each checkpoint saves the whole viewport.
2
-export async function replay(driver, { mode, width, shellPath, threadRef, threadKey }) {
3
- const owner = mode === "RP" ? "right-panel" : "drawer";
4
- const surface = `[data-terminal-owner="${owner}"]`;
5
- const action = (name) => `${surface} button[aria-label^="${name}"]`;
6
- const call = driver.call;
7
- const read = driver.evaluate;
8
- const checkpoint = driver.checkpoint;
9
- await read(
10
- `globalThis.driverThreadRef = ${JSON.stringify(threadRef)}; globalThis.driverThreadKey = ${JSON.stringify(threadKey)}`,
11
- );
12
- const press = (key, modifiers) => call("press", { key, modifiers });
13
- const click = (locator) => call("click", { locator });
14
- const quotedShellPath = `'${shellPath.replaceAll("'", "'\\''")}'`;
15
- const command = async (text) => {
16
- await press("c", ["Control"]);
17
- await call("type", { locator: `${surface} textarea:focus`, text });
18
- await press("Enter");
19
- };
20
- const seed = async (pane, index) => {
21
- await click(`${surface} canvas >> nth=${index}`);
22
- await command(`bash ${quotedShellPath} ${pane}`);
23
- await driver.ready(pane);
24
- };
25
- const reset = async () => {
26
- const n = await read(`document.querySelectorAll('${surface} canvas').length`);
27
- for (let i = 0; i < n; i++) {
28
- await click(`${surface} canvas >> nth=${i}`);
29
- await command("fixture_reset");
30
- await driver.ready(String.fromCharCode(65 + i));
31
- }
32
- };
33
- const close = async () => {
34
- await click(action("Close Terminal ("));
35
- await call("wait_for", { locator: '[role="alertdialog"]' });
36
- await click('role=button[name="Confirm"]');
37
- await call("wait_for", { locator: `${surface} canvas` });
38
- };
39
- await reset();
40
- await checkpoint("single");
41
- for (const name of [
42
- "Split Terminal Horizontally",
43
- "Split Terminal Vertically",
44
- "New Terminal",
45
- "Close Terminal (",
46
- ]) {
47
- await call("hover", { locator: action(name) });
48
- await call("wait_for", { locator: '[role="dialog"]' });
49
- }
50
- await checkpoint("tooltip");
51
- const hit = await read(
52
- `(()=>{const b=document.querySelector('${action("Split Terminal Horizontally")}');const r=b.getBoundingClientRect();return {x:r.x+r.width/2,y:r.y+2,label:b.getAttribute('aria-label'),hit:document.elementFromPoint(r.x+r.width/2,r.y+2)?.closest('button')?.getAttribute('aria-label')}})()`,
53
- );
54
- await driver.note("top2px horizontal split hit test", hit);
55
- await call("click", { x: hit.x, y: hit.y });
56
- await seed("B", 1);
57
- await reset();
58
- await checkpoint("S-H");
59
- for (const [pane, index] of [
60
- ["C", 2],
61
- ["D", 3],
62
- ]) {
63
- await click(action("Split Terminal Horizontally"));
64
- await seed(pane, index);
65
- }
66
- await reset();
67
- await call("hover", { locator: action("Split Terminal Horizontally") });
68
- await call("wait_for", { text: "max 4 per group" });
69
- try {
70
- await click(action("Split Terminal Horizontally"));
71
- } catch (error) {
72
- await driver.note("Limit control rejected the pointer attempt", { error: String(error) });
73
- }
74
- const count = await read(`document.querySelectorAll('${surface} canvas').length`);
75
- if (count !== 4) throw Error(`Expected four panes, received ${count}`);
76
- await checkpoint("L");
77
- for (let i = 0; i < 3; i++) await close();
78
- await reset();
79
- await checkpoint("single-after-horizontal");
80
- await click(action("Split Terminal Vertically"));
81
- await seed("B", 1);
82
- await reset();
83
- await checkpoint("S-V");
84
- await close();
85
- await reset();
86
- await click(action("New Terminal"));
87
- await seed("B", 0);
88
- await checkpoint(mode === "RP" ? "new-tab" : "G");
89
- if (mode === "RP") {
90
- const tab = (index) =>
91
- `[data-right-panel-tab-list] [data-active-tab] button:not([aria-label]):visible >> nth=${index}`;
92
- await click(tab(0));
93
- await reset();
94
- await click(tab(1));
95
- await close();
96
- if (width > 980) {
97
- await call("drag", {
98
- source: '[role="separator"].cursor-col-resize:visible',
99
- target: '[role="textbox"][contenteditable="true"]',
100
- });
101
- await checkpoint("width-drag");
102
- await click('button[aria-label="Maximize panel"]:visible');
103
- await checkpoint("maximized");
104
- await click('button[aria-label="Restore panel size"]:visible');
105
- await call("drag", {
106
- source: '[role="separator"].cursor-col-resize:visible',
107
- target: 'button[aria-label="Toggle right panel"]:visible',
108
- });
109
- }
110
- await click('button[aria-label="Toggle right panel"]:visible');
111
- await checkpoint("hidden");
112
- await click('button[aria-label="Toggle right panel"]:visible');
113
- } else {
114
- const session = (index) =>
115
- `${surface} [class~="group/tab"] > button:not([aria-label]) >> nth=${index}`;
116
- await click(session(0));
117
- await reset();
118
- await click(session(1));
119
- await close();
120
- await click('button[aria-label="Toggle thread details panel"]:visible');
121
- await driver.arm();
122
- await click(
123
- 'button[aria-label="Run Evidence deterministic terminal with deliberately long label"]',
124
- );
125
- await call("wait_for", { locator: `${surface} canvas` });
126
- await click('button[aria-label="Toggle thread details panel"]:visible');
127
- await driver.ready("G");
128
- await checkpoint("G-long-label");
129
- await close();
130
- await click(`${surface} canvas`);
131
- await press("d", ["Control"]);
132
- await seed("B", 1);
133
- await checkpoint("shortcut-split");
134
- await close();
135
- await call("drag", { source: `${surface} > .cursor-row-resize`, target: `${surface} canvas` });
136
- await reset();
137
- await checkpoint("minimum-height");
138
- await read(
139
- `(async()=>{const m=await import('/src/terminalUiStateStore.ts');m.useTerminalUiStateStore.getState().setTerminalHeight(driverThreadRef,280)})()`,
140
- );
141
- await click('button[aria-label="Toggle terminal drawer"]:visible');
142
- await click('button[aria-label="Toggle terminal drawer"]:visible');
143
- await call("wait_for", { locator: `${surface} canvas` });
144
- await driver.note("restore preferred height through existing store action", { height: 280 });
145
- await call("type", {
146
- locator: '[role="textbox"][contenteditable="true"]',
147
- text: Array.from({ length: 12 }, (_, i) => "Composer fixture line " + (i + 1)).join("\n"),
148
- });
149
- await read(
150
- `(async()=>{const m=await import('/src/hooks/useSettings.ts');await m.updateClientSettings({fontSizeTerminal:18})})()`,
151
- );
152
- await reset();
153
- await checkpoint("constrained-font18");
154
- await call("type", {
155
- locator: '[role="textbox"][contenteditable="true"]',
156
- text: "",
157
- clear: true,
158
- });
159
- await read(
160
- `(async()=>{const m=await import('/src/hooks/useSettings.ts');await m.updateClientSettings({fontSizeTerminal:12})})()`,
161
- );
162
- await click(`${surface} canvas`);
163
- await command("fixture_scrollback");
164
- await driver.ready("A");
165
- await read(
166
- `document.querySelector('${surface} canvas').dispatchEvent(new WheelEvent('wheel',{deltaY:-1000,bubbles:true,cancelable:true}))`,
167
- );
168
- await checkpoint("scroll-up");
169
- await read(
170
- `document.querySelector('${surface} canvas').dispatchEvent(new WheelEvent('wheel',{deltaY:1000,bubbles:true,cancelable:true}))`,
171
- );
172
- await checkpoint("scroll-down");
173
- await click('button[aria-label="Toggle terminal drawer"]:visible');
174
- await checkpoint("hidden");
175
- await click('button[aria-label="Toggle terminal drawer"]:visible');
176
- }
177
- await reset();
178
- await checkpoint("reopened");
179
- await click(action("Close Terminal ("));
180
- await click('role=button[name="Cancel"]');
181
- await checkpoint("close-cancel");
182
- await click(action("Close Terminal ("));
183
- await click('role=button[name="Confirm"]');
184
- await checkpoint("E-last-close");
185
- if (mode === "RP") {
186
- const open = await read(
187
- `JSON.parse(localStorage.getItem('t3code:right-panel-state:v2')).state.byThreadKey[driverThreadKey]?.isOpen === true`,
188
- );
189
- if (!open) await click('button[aria-label="Toggle right panel"]:visible');
190
- await click('role=button[name="Terminal T"]');
191
- } else {
192
- await click('button[aria-label="Toggle terminal drawer"]:visible');
193
- }
194
- await seed("A", 0);
195
- await checkpoint("new-usable-single");
196
-}
apps/web/test/fixtures/terminal-layout/seed.mjs
deleted
-36
@@ -1,36 +0,0 @@
1
-import * as NodeFSP from "node:fs/promises";
2
-import * as NodeOS from "node:os";
3
-import * as NodePath from "node:path";
4
-import * as NodeURL from "node:url";
5
-
6
-// Run with the isolated server stopped: node seed.mjs <T3-home> <project-id>.
7
-// The app creates projects/drafts normally; this adds only the named script.
8
-const [home, projectId] = process.argv.slice(2);
9
-if (!home || !projectId) throw new Error("Usage: node seed.mjs <isolated-T3-home> <project-id>");
10
-const resolvedHome = await NodeFSP.realpath(home);
11
-const liveHome = await NodeFSP.realpath(NodePath.join(NodeOS.homedir(), ".t3"));
12
-if (resolvedHome === liveHome || resolvedHome.startsWith(liveHome + NodePath.sep)) {
13
- throw new Error("Refusing to write live T3 state");
14
-}
15
-const target = NodePath.join(resolvedHome, "userdata/settings.json");
16
-const settings = JSON.parse(
17
- await NodeFSP.readFile(target, "utf8").catch((error) => {
18
- if (error.code === "ENOENT") return "{}";
19
- throw error;
20
- }),
21
-);
22
-const shellPath = NodeURL.fileURLToPath(new URL("./shell.sh", import.meta.url));
23
-const script = {
24
- id: "evidence-deterministic-t",
25
- name: "Evidence deterministic terminal with deliberately long label",
26
- command: `bash '${shellPath.replaceAll("'", "'\\''")}' G`,
27
- icon: "play",
28
- runOnWorktreeCreate: false,
29
-};
30
-settings.projectScriptOverrides ??= {};
31
-const previous = settings.projectScriptOverrides[projectId] ?? [];
32
-settings.projectScriptOverrides[projectId] = [
33
- ...previous.filter((item) => item.id !== script.id),
34
- script,
35
-];
36
-await NodeFSP.writeFile(target, JSON.stringify(settings, null, 2) + "\n");
apps/web/test/fixtures/terminal-layout/setup.mjs
deleted
-62
@@ -1,62 +0,0 @@
1
-// Start an isolated dev server and pair its Browser panel before calling this.
2
-// callPreview dispatches names to T3 preview_* tools; it must keep one owned tab.
3
-export async function setup(driver, { width, theme, mode, shellPath, projectName = "server" }) {
4
- const { call, evaluate } = driver;
5
- await call("resize", { mode: "freeform", width, height: 900 });
6
- await call("set_appearance", { colorScheme: theme });
7
- await evaluate(`(async()=>{
8
- const capture=await import('/test/fixtures/terminal-layout/capture.mjs');
9
- capture.freezeClock();
10
- const settings=await import('/src/hooks/useSettings.ts');
11
- await settings.updateClientSettings({fontSizeTerminal:12});
12
- localStorage.setItem('t3code:theme',${JSON.stringify(theme)});
13
- window.dispatchEvent(new StorageEvent('storage',{key:'t3code:theme',newValue:${JSON.stringify(theme)}}));
14
- })()`);
15
- await call("click", {
16
- locator: `button[aria-label=${JSON.stringify(`New thread in ${projectName}`)}]`,
17
- });
18
- await call("wait_for", { locator: '[role="textbox"][contenteditable="true"]' });
19
- const context = await evaluate(`(()=>{
20
- const draftId=location.pathname.split('/').at(-1);
21
- const draft=JSON.parse(localStorage['t3code:composer-drafts:v1']).state.draftThreadsByThreadKey[draftId];
22
- if(!draft) throw Error('Expected a newly created draft');
23
- const threadRef={environmentId:draft.environmentId,threadId:draft.threadId};
24
- return {route:location.pathname,threadRef,threadKey:draft.environmentId+':'+draft.threadId};
25
- })()`);
26
- const sidebarOpen = await evaluate(
27
- `document.querySelector('button[aria-label="Toggle main sidebar"]')?.getAttribute('aria-pressed')==='true'`,
28
- );
29
- if (sidebarOpen) await call("click", { locator: 'button[aria-label="Toggle main sidebar"]' });
30
- if (mode === "RP") {
31
- await call("click", { locator: 'button[aria-label="Toggle right panel"]' });
32
- await call("click", { locator: 'role=button[name="Terminal T"]' });
33
- } else {
34
- await call("click", { locator: 'button[aria-label="Toggle terminal drawer"]' });
35
- }
36
- const surface = `[data-terminal-owner="${mode === "RP" ? "right-panel" : "drawer"}"]`;
37
- await call("wait_for", { locator: `${surface} canvas` });
38
- await call("click", { locator: `${surface} canvas` });
39
- await call("press", { key: "c", modifiers: ["Control"] });
40
- const quotedPath = `'${shellPath.replaceAll("'", "'\\''")}'`;
41
- await call("type", { locator: `${surface} textarea:focus`, text: `bash ${quotedPath} A` });
42
- await call("press", { key: "Enter" });
43
- await driver.ready("A");
44
- return context;
45
-}
46
-
47
-// This leaves real unexecuted shell input and its cursor on the first row.
48
-export async function typeFirstLine(driver, { mode, columns }) {
49
- const surface = `[data-terminal-owner="${mode === "RP" ? "right-panel" : "drawer"}"]`;
50
- await driver.call("click", { locator: `${surface} canvas` });
51
- await driver.call("press", { key: "c", modifiers: ["Control"] });
52
- await driver.call("type", { locator: `${surface} textarea:focus`, text: "fixture_input" });
53
- await driver.call("press", { key: "Enter" });
54
- await driver.ready("input");
55
- const terminalColumns = columns ?? (await driver.columns());
56
- const prefix = "printf '%s\\n' '";
57
- const suffix = "RIGHT'";
58
- const text =
59
- prefix + "typed-".padEnd(terminalColumns - 2 - prefix.length - suffix.length, "x") + suffix;
60
- await driver.call("type", { locator: `${surface} textarea:focus`, text });
61
- return text;
62
-}
apps/web/test/fixtures/terminal-layout/shell.sh
deleted
-34
@@ -1,34 +0,0 @@
1
-#!/usr/bin/env bash
2
-if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
3
- set -eu
4
- mkdir -p /tmp/t3-terminal-evidence
5
- exec env -i HOME=/tmp/t3-terminal-evidence PATH=/usr/bin:/bin TERM=xterm-256color LANG=C.UTF-8 LC_ALL=C.UTF-8 EVIDENCE_PANE="${1:-A}" bash --noprofile --rcfile "$0" -i
6
-fi
7
-cd /tmp/t3-terminal-evidence
8
-HISTFILE=/dev/null
9
-set +o history
10
-fixture_prompt() {
11
- local width fill
12
- width=$(stty size); width=${width##* }
13
- printf -v fill '%*s' "$((width > 12 ? width - 12 : 1))" ''
14
- PS1="\[\e[36m\]LEFT-${fill// /-}-RIGHT\[\e[0m\]\n\[\e[32m\]pane ${EVIDENCE_PANE} READY\[\e[0m\] ANSI blue: \[\e[34m\]0123456789\[\e[0m\]\nevidence:/fixture $ "
15
- printf '\033[?25l'
16
- stty size > /tmp/t3-terminal-evidence/input-size
17
- printf '%s\n' "$EVIDENCE_PANE" > "/tmp/t3-terminal-evidence/ready-${EVIDENCE_PANE}"
18
-}
19
-fixture_reset() { printf '\033[3J\033[H\033[2J'; }
20
-fixture_scrollback() {
21
- local n
22
- for ((n=1;n<=80;n++)); do printf 'SCROLL %03d | deterministic terminal output | RIGHT\n' "$n"; done
23
-}
24
-PROMPT_COMMAND=fixture_prompt
25
-fixture_reset
26
-
27
-# Leave the next command on the first physical line with a steady visible cursor.
28
-fixture_input() {
29
- PROMPT_COMMAND=
30
- PS1=
31
- printf '\033[3J\033[H\033[2J\033[?25h\033[2 q'
32
- stty size > /tmp/t3-terminal-evidence/input-size
33
- printf 'input\n' > /tmp/t3-terminal-evidence/ready-input
34
-}