@k-electron/k-bench 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,294 @@
1
+ import { execFile, spawn } from "node:child_process";
2
+ import { userInfo } from "node:os";
3
+ import { promisify } from "node:util";
4
+ import * as pty from "node-pty";
5
+ const execFileAsync = promisify(execFile);
6
+ /** Every Session is a tmux session named `kb-<session id>` on the instance's socket. */
7
+ const PREFIX = "kb-";
8
+ /** The Session-scoped tmux user option that holds a Session's Bell; set means rung. */
9
+ const BELL_OPTION = "@kb-bell";
10
+ /** The tmux `wait-for` channel signalled whenever a Bell may have been raised or cleared. */
11
+ const BELL_CHANNEL = "kb-bell-changed";
12
+ /** How long a Bell watch waits before trying again after tmux failed it unexpectedly. */
13
+ const BELL_WATCH_RETRY_MS = 1_000;
14
+ /** Applied to the instance's tmux server whenever a Session is created (idempotent). */
15
+ function serverConfiguration() {
16
+ return [
17
+ // tmux starts this as a login shell, so the owner's PATH and aliases are present
18
+ // even though launchd provides a bare environment.
19
+ ["set", "-g", "default-shell", userInfo().shell || "/bin/zsh"],
20
+ ["set", "-g", "default-terminal", "tmux-256color"],
21
+ ["set", "-g", "status", "off"],
22
+ ["set", "-g", "mouse", "on"],
23
+ ["set", "-g", "set-clipboard", "on"],
24
+ ["set", "-g", "terminal-features[100]", "xterm*:clipboard"],
25
+ ["set", "-g", "history-limit", "50000"],
26
+ ["set", "-g", "window-size", "latest"],
27
+ ["setw", "-g", "monitor-bell", "on"],
28
+ ["set", "-g", "bell-action", "any"],
29
+ // The Bell, and the one place that decides what viewing a Session means for it: a tmux
30
+ // client attached to it, which is what a browser terminal is. It lives in tmux (ADR-0002),
31
+ // so it survives a k-bench restart and is raised with no browser attached. tmux runs
32
+ // these hooks in its own single thread, so no bell can slip between deciding and acting:
33
+ // - a bell is recorded only while no client is attached to the Session that rang;
34
+ // - a client attaching clears the Session's Bell, whenever it rang before.
35
+ // Both signal the Bell channel, so the server can announce the change (`watchBells`).
36
+ [
37
+ "set-hook",
38
+ "-g",
39
+ "alert-bell",
40
+ `if-shell -F "#{==:#{session_attached},0}" { set-option ${BELL_OPTION} 1 ; wait-for -S ${BELL_CHANNEL} }`,
41
+ ],
42
+ [
43
+ "set-hook",
44
+ "-g",
45
+ "client-attached",
46
+ `set-option -u ${BELL_OPTION} ; wait-for -S ${BELL_CHANNEL}`,
47
+ ],
48
+ ];
49
+ }
50
+ /**
51
+ * Hides every tmux command line behind Session-shaped operations. It holds no state about
52
+ * Sessions: everything it knows about one it asks tmux (ADR-0002).
53
+ */
54
+ export class TmuxDriver {
55
+ socket;
56
+ /** Bell watches, which a new tmux server must wake (see `watchBells`). */
57
+ bellWatches = new Set();
58
+ constructor(socket) {
59
+ this.socket = socket;
60
+ }
61
+ env() {
62
+ // A k-bench server started from inside a tmux pane must not think it is nested.
63
+ const { TMUX: _tmux, TMUX_PANE: _pane, ...env } = process.env;
64
+ return env;
65
+ }
66
+ baseArgs() {
67
+ return ["-u", "-L", this.socket];
68
+ }
69
+ async run(...commands) {
70
+ const args = [...this.baseArgs()];
71
+ commands.forEach((command, index) => {
72
+ if (index > 0)
73
+ args.push(";");
74
+ args.push(...command);
75
+ });
76
+ const { stdout } = await execFileAsync("tmux", args, { env: this.env() });
77
+ return stdout;
78
+ }
79
+ /** Starts a shell for the Session in `folder`, configuring the tmux server as needed. */
80
+ async createSession(id, folder) {
81
+ await this.run(...serverConfiguration(), [
82
+ "new-session",
83
+ "-d",
84
+ "-s",
85
+ PREFIX + id,
86
+ "-c",
87
+ folder,
88
+ ]);
89
+ // This may have started the tmux server, which a Bell watch idles without.
90
+ for (const watch of this.bellWatches)
91
+ watch.serverStarted();
92
+ }
93
+ /**
94
+ * Applies the configuration to a tmux server that is already running, such as one a
95
+ * previous version of k-bench configured. Does nothing when no tmux server is running.
96
+ */
97
+ async configure() {
98
+ try {
99
+ await this.run(...serverConfiguration());
100
+ }
101
+ catch (error) {
102
+ if (!isNoServer(error))
103
+ throw error;
104
+ }
105
+ }
106
+ /**
107
+ * Calls `onChange` soon after any Session's Bell is raised or cleared (and now and then
108
+ * when nothing changed), until stopped. Changes are missed only while no tmux server runs,
109
+ * when there are no Bells to change.
110
+ */
111
+ watchBells(onChange) {
112
+ const watch = new BellWatcher([...this.baseArgs(), "wait-for", BELL_CHANNEL], this.env(), {
113
+ onChange,
114
+ onStop: () => this.bellWatches.delete(watch),
115
+ });
116
+ this.bellWatches.add(watch);
117
+ watch.start();
118
+ return watch;
119
+ }
120
+ async killSession(id) {
121
+ try {
122
+ await this.run(["kill-session", "-t", `=${PREFIX}${id}`]);
123
+ }
124
+ catch (error) {
125
+ if (!isNoSuchSession(error))
126
+ throw error;
127
+ }
128
+ }
129
+ /** The Sessions whose shell is currently alive on this socket, with their Bells. */
130
+ async listSessions() {
131
+ let stdout;
132
+ try {
133
+ stdout = await this.run([
134
+ "list-sessions",
135
+ "-F",
136
+ `#{session_name} #{${BELL_OPTION}}`,
137
+ ]);
138
+ }
139
+ catch (error) {
140
+ if (isNoServer(error))
141
+ return [];
142
+ throw error;
143
+ }
144
+ return stdout
145
+ .split("\n")
146
+ .filter((line) => line.startsWith(PREFIX))
147
+ .map((line) => {
148
+ const [name = "", bell = ""] = line.split(" ");
149
+ return { id: name.slice(PREFIX.length), bell: bell !== "" };
150
+ });
151
+ }
152
+ /**
153
+ * The size the Session's shell sees: that of its tmux pane's terminal. tmux resizes that
154
+ * terminal some time after the window (at most once every 250ms per tmux pane), so the
155
+ * window's size can be ahead of it. tmux names the terminal; `stty` reads its size.
156
+ */
157
+ async shellSize(id) {
158
+ const tmuxPaneTty = (await this.run([
159
+ "display-message",
160
+ "-p",
161
+ "-t",
162
+ // The trailing colon names the Session's current window. Without it tmux 3.8
163
+ // finds no window and prints an empty value, without failing.
164
+ `=${PREFIX}${id}:`,
165
+ "#{pane_tty}",
166
+ ])).trim();
167
+ // `-f` is the macOS spelling (the Host is a Mac); it prints "<rows> <cols>".
168
+ const { stdout } = await execFileAsync("stty", ["-f", tmuxPaneTty, "size"]);
169
+ const [rows, cols] = stdout.trim().split(" ").map(Number);
170
+ return { cols: cols ?? 0, rows: rows ?? 0 };
171
+ }
172
+ /** Starts a tmux client attached to the Session under a pty; tmux redraws the full screen. */
173
+ spawnClient(id, size) {
174
+ const client = pty.spawn("tmux", [...this.baseArgs(), "attach-session", "-t", `=${PREFIX}${id}`], {
175
+ name: "xterm-256color",
176
+ cols: size.cols,
177
+ rows: size.rows,
178
+ env: this.env(),
179
+ encoding: null,
180
+ });
181
+ return {
182
+ onData: (listener) => {
183
+ client.onData((data) => listener(Buffer.from(data)));
184
+ },
185
+ onExit: (listener) => {
186
+ client.onExit(() => listener());
187
+ },
188
+ write: (data) => client.write(data),
189
+ resize: (cols, rows) => client.resize(cols, rows),
190
+ kill: (signal) => client.kill(signal),
191
+ };
192
+ }
193
+ }
194
+ /**
195
+ * Waits on the Bell channel with a `tmux wait-for` client, again and again. tmux keeps a
196
+ * signal sent while nobody is waiting for the next wait, so none is lost between two waits.
197
+ * With no tmux server to wait on, it idles until told one has started.
198
+ */
199
+ class BellWatcher {
200
+ args;
201
+ env;
202
+ onChange;
203
+ onStop;
204
+ waiting;
205
+ retry;
206
+ /** No tmux server was running at the last wait: nothing is waiting, until one starts. */
207
+ idle = false;
208
+ /** Bumped whenever a tmux server may have started, so a wait that found none retries. */
209
+ serverGeneration = 0;
210
+ stopping;
211
+ constructor(args, env, handlers) {
212
+ this.args = args;
213
+ this.env = env;
214
+ this.onChange = handlers.onChange;
215
+ this.onStop = handlers.onStop;
216
+ }
217
+ serverStarted() {
218
+ this.serverGeneration++;
219
+ if (this.idle || this.retry)
220
+ this.start();
221
+ }
222
+ start() {
223
+ clearTimeout(this.retry);
224
+ this.retry = undefined;
225
+ this.idle = false;
226
+ if (this.stopping || this.waiting)
227
+ return;
228
+ const generation = this.serverGeneration;
229
+ const child = spawn("tmux", this.args, {
230
+ env: this.env,
231
+ stdio: ["ignore", "ignore", "pipe"],
232
+ });
233
+ let stderr = "";
234
+ child.stderr.on("data", (data) => {
235
+ stderr += data.toString();
236
+ });
237
+ // A failure to spawn is reported by its own event, then as an exit like any other.
238
+ child.on("error", () => undefined);
239
+ const exited = new Promise((resolve) => {
240
+ child.on("close", (code) => {
241
+ this.waiting = undefined;
242
+ resolve();
243
+ this.waitEnded(code === 0, stderr, generation);
244
+ });
245
+ });
246
+ this.waiting = { exited, kill: () => child.kill() };
247
+ }
248
+ waitEnded(signalled, stderr, generation) {
249
+ if (this.stopping)
250
+ return;
251
+ if (signalled) {
252
+ this.start();
253
+ this.onChange();
254
+ return;
255
+ }
256
+ // A tmux server started while this wait was looking for one.
257
+ if (generation !== this.serverGeneration) {
258
+ this.start();
259
+ return;
260
+ }
261
+ if (isNoServerMessage(stderr)) {
262
+ this.idle = true;
263
+ }
264
+ else {
265
+ // tmux failed the wait some other way, such as its server being killed under it.
266
+ this.retry = setTimeout(() => this.start(), BELL_WATCH_RETRY_MS);
267
+ this.retry.unref();
268
+ }
269
+ }
270
+ stop() {
271
+ this.stopping ??= (async () => {
272
+ clearTimeout(this.retry);
273
+ this.onStop();
274
+ const waiting = this.waiting;
275
+ waiting?.kill();
276
+ await waiting?.exited;
277
+ })();
278
+ return this.stopping;
279
+ }
280
+ }
281
+ function stderrOf(error) {
282
+ return String(error.stderr ?? "");
283
+ }
284
+ function isNoServer(error) {
285
+ return isNoServerMessage(stderrOf(error));
286
+ }
287
+ function isNoServerMessage(stderr) {
288
+ return stderr.includes("no server running") || stderr.includes("error connecting to");
289
+ }
290
+ function isNoSuchSession(error) {
291
+ return (isNoServer(error) ||
292
+ stderrOf(error).includes("can't find") ||
293
+ stderrOf(error).includes("no such session"));
294
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * The terminal WebSocket's wire protocol, the one definition the server, the browser and
3
+ * the test client all use. One socket per open Pane:
4
+ * `GET /api/sessions/:id/terminal?cols=&rows=` opens it at the client's size.
5
+ *
6
+ * Server to client: binary frames of terminal output.
7
+ * Client to server: JSON text frames, one `ClientMessage` each.
8
+ * The server closes with `CLOSE_SESSION_ENDED` when reconnecting is pointless.
9
+ *
10
+ * Imported by the browser too, so this file has no imports and no Node APIs.
11
+ */
12
+ /**
13
+ * The terminal's Session was deleted, or its shell exited: reconnecting is pointless.
14
+ * What the owner sees about why comes from the state feed, not from this code.
15
+ */
16
+ export const CLOSE_SESSION_ENDED = 4410;
17
+ /** The server could not attach the terminal. The client may try again. */
18
+ export const CLOSE_INTERNAL_ERROR = 1011;
19
+ const TERMINAL_PATH = /^\/api\/sessions\/([^/]+)\/terminal$/;
20
+ /** The path and query that open a Session's terminal at `size`. */
21
+ export function terminalPath(sessionId, size) {
22
+ const query = new URLSearchParams({ cols: String(size.cols), rows: String(size.rows) });
23
+ return `/api/sessions/${sessionId}/terminal?${query}`;
24
+ }
25
+ /**
26
+ * The Session and size a request URL (path and query) opens a terminal on, or undefined
27
+ * when it is not a terminal URL. A size that is missing or not a number comes back as NaN,
28
+ * for the server to replace.
29
+ */
30
+ export function parseTerminalPath(url) {
31
+ const { pathname, searchParams } = new URL(url, "http://localhost");
32
+ const sessionId = TERMINAL_PATH.exec(pathname)?.[1];
33
+ if (sessionId === undefined)
34
+ return undefined;
35
+ return {
36
+ sessionId,
37
+ size: {
38
+ cols: Number(searchParams.get("cols")),
39
+ rows: Number(searchParams.get("rows")),
40
+ },
41
+ };
42
+ }
43
+ export function encodeClientMessage(message) {
44
+ return JSON.stringify(message);
45
+ }
46
+ /**
47
+ * The message a client's text frame holds, or undefined when it is not one. Sizes are
48
+ * passed on unchecked: the server ignores one that is not valid.
49
+ */
50
+ export function decodeClientMessage(text) {
51
+ let message;
52
+ try {
53
+ message = JSON.parse(text);
54
+ }
55
+ catch {
56
+ return undefined;
57
+ }
58
+ if (typeof message !== "object" || message === null)
59
+ return undefined;
60
+ if (message.type === "input" && typeof message.data === "string") {
61
+ return { type: "input", data: message.data, automatic: message.automatic === true };
62
+ }
63
+ if (message.type === "resize") {
64
+ return { type: "resize", cols: message.cols, rows: message.rows };
65
+ }
66
+ return undefined;
67
+ }
@@ -0,0 +1,2 @@
1
+ /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-amber-500:oklch(76.9% .188 70.08);--color-emerald-500:oklch(69.6% .17 162.48);--color-black:#000;--spacing:.25rem;--container-lg:32rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--radius-xs:.125rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--border);outline-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){*{outline-color:color-mix(in oklab, var(--ring) 50%, transparent)}}html,body,#root{height:100%}body{background-color:var(--background);color:var(--foreground);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;overflow:hidden}}@layer components;@layer utilities{.invisible{visibility:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:0}.inset-y-0{inset-block:0}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing) * 2)}.top-4{top:calc(var(--spacing) * 4)}.right-2{right:calc(var(--spacing) * 2)}.right-4{right:calc(var(--spacing) * 4)}.left-0{left:0}.left-1\/2{left:50%}.z-10{z-index:10}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.ml-4{margin-left:calc(var(--spacing) * 4)}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-flex{display:inline-flex}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-full{height:100%}.max-h-60{max-height:calc(var(--spacing) * 60)}.min-h-0{min-height:0}.w-64{width:calc(var(--spacing) * 64)}.w-72{width:calc(var(--spacing) * 72)}.w-full{width:100%}.max-w-\[85vw\]{max-width:85vw}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.min-w-0{min-width:0}.min-w-36{min-width:calc(var(--spacing) * 36)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-x-full{--tw-translate-x:-100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.touch-none{touch-action:none}.resize{resize:both}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-start{justify-content:flex-start}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xs{border-radius:var(--radius-xs)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-input{border-color:var(--input)}.border-muted-foreground{border-color:var(--muted-foreground)}.border-primary{border-color:var(--primary)}.border-transparent{border-color:#0000}.bg-accent{background-color:var(--accent)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-background{background-color:var(--background)}.bg-black{background-color:var(--color-black)}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab, red, red)){.bg-black\/60{background-color:color-mix(in oklab, var(--color-black) 60%, transparent)}}.bg-border{background-color:var(--border)}.bg-card{background-color:var(--card)}.bg-destructive,.bg-destructive\/10{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.bg-destructive\/10{background-color:color-mix(in oklab, var(--destructive) 10%, transparent)}}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-popover{background-color:var(--popover)}.bg-primary{background-color:var(--primary)}.bg-secondary{background-color:var(--secondary)}.bg-transparent{background-color:#0000}.fill-current{fill:currentColor}.p-1{padding:var(--spacing)}.p-2{padding:calc(var(--spacing) * 2)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.pr-1{padding-right:var(--spacing)}.text-left{text-align:left}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.whitespace-nowrap{white-space:nowrap}.text-amber-500{color:var(--color-amber-500)}.text-background{color:var(--background)}.text-black{color:var(--color-black)}.text-destructive{color:var(--destructive)}.text-muted-foreground{color:var(--muted-foreground)}.text-popover-foreground{color:var(--popover-foreground)}.text-primary-foreground{color:var(--primary-foreground)}.text-secondary-foreground{color:var(--secondary-foreground)}.opacity-70{opacity:.7}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline-hidden{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.outline-hidden{outline-offset:2px;outline:2px solid #0000}}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[transform\,visibility\]{transition-property:transform,visibility;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.placeholder\:text-muted-foreground::placeholder{color:var(--muted-foreground)}@media (hover:hover){.hover\:bg-accent:hover{background-color:var(--accent)}.hover\:bg-destructive\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab, var(--destructive) 90%, transparent)}}.hover\:bg-primary:hover,.hover\:bg-primary\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab, var(--primary) 90%, transparent)}}.hover\:bg-secondary\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab, var(--secondary) 80%, transparent)}}.hover\:text-accent-foreground:hover{color:var(--accent-foreground)}.hover\:text-foreground:hover{color:var(--foreground)}.hover\:opacity-100:hover{opacity:1}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-ring:focus{--tw-ring-color:var(--ring)}.focus\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.focus\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.focus-visible\:bg-primary:focus-visible{background-color:var(--primary)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:opacity-50:disabled{opacity:.5}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[highlighted\]\:bg-accent[data-highlighted]{background-color:var(--accent)}.data-\[highlighted\]\:text-accent-foreground[data-highlighted]{color:var(--accent-foreground)}.data-\[highlighted\]\:text-destructive[data-highlighted]{color:var(--destructive)}@media (width>=40rem){.sm\:max-w-lg{max-width:var(--container-lg)}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}}.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;-webkit-text-decoration:overline double underline;-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;-webkit-text-decoration:overline wavy underline;-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;-webkit-text-decoration:overline dotted underline;-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;-webkit-text-decoration:overline dashed underline;-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset}:root{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20.5% 0 0);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20.5% 0 0);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(26.9% 0 0);--muted-foreground:oklch(70.8% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(70.4% .191 22.216);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0);--radius:.625rem}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}