@volter/supercode-terminal 0.2.30
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.
- package/CAPABILITIES.md +57 -0
- package/LICENSE-SUBSTRATE +201 -0
- package/NOTICE-SUBSTRATE +14 -0
- package/README.md +190 -0
- package/client.d.ts +17 -0
- package/client.mjs +32 -0
- package/index.d.ts +195 -0
- package/index.mjs +981 -0
- package/package.json +156 -0
- package/react/stream.d.ts +3 -0
- package/react/stream.mjs +446 -0
- package/react/ui.d.ts +136 -0
- package/react/ui.mjs +892 -0
- package/stream.d.ts +3 -0
- package/stream.mjs +446 -0
- package/styles.css +160 -0
- package/substrate/attach.d.ts +29 -0
- package/substrate/attach.js +147 -0
- package/substrate/client.d.ts +62 -0
- package/substrate/client.js +138 -0
- package/substrate/docker-exec.d.ts +41 -0
- package/substrate/docker-exec.js +101 -0
- package/substrate/internal/exec.d.ts +15 -0
- package/substrate/internal/exec.js +192 -0
- package/substrate/internal/process-tree.d.ts +1 -0
- package/substrate/internal/process-tree.js +41 -0
- package/substrate/local-terminal.d.ts +13 -0
- package/substrate/local-terminal.js +41 -0
- package/substrate/native-host.d.ts +57 -0
- package/substrate/native-host.js +529 -0
- package/substrate/session-lifecycle.d.ts +162 -0
- package/substrate/session-lifecycle.js +1344 -0
- package/substrate/session-roll.d.ts +14 -0
- package/substrate/session-roll.js +407 -0
- package/substrate/tmux-stream.d.ts +32 -0
- package/substrate/tmux-stream.js +212 -0
- package/substrate/tmux.d.ts +144 -0
- package/substrate/tmux.js +899 -0
- package/ui.d.ts +136 -0
- package/ui.mjs +892 -0
package/stream.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TerminalViewer, type TerminalConnector } from './ui.js';
|
|
2
|
+
export type { TerminalConnector, TerminalStreamHandlers } from './ui.js';
|
|
3
|
+
export const TerminalStreamViewer: (props: Parameters<typeof TerminalViewer>[0] & { connect: TerminalConnector }) => ReturnType<typeof TerminalViewer>;
|
package/stream.mjs
ADDED
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
// src/ui.jsx
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from "preact/hooks";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
4
|
+
var DEFAULT_LABELS = Object.freeze({
|
|
5
|
+
back: "Back to terminals",
|
|
6
|
+
control: "Control",
|
|
7
|
+
empty: "No terminal sessions are running.",
|
|
8
|
+
open: "Open",
|
|
9
|
+
refresh: "Refresh",
|
|
10
|
+
// what a session with no observed cwd or command is
|
|
11
|
+
session: "tmux session",
|
|
12
|
+
stop: "Stop",
|
|
13
|
+
subtitle: "Local tmux sessions",
|
|
14
|
+
title: "Terminals",
|
|
15
|
+
view: "View"
|
|
16
|
+
});
|
|
17
|
+
var WORKSPACE_LABELS = Object.freeze({
|
|
18
|
+
...DEFAULT_LABELS,
|
|
19
|
+
attach: "Open session",
|
|
20
|
+
back: "Back to chats",
|
|
21
|
+
closeTab: "Detach terminal",
|
|
22
|
+
newTerminal: "New terminal",
|
|
23
|
+
noTabs: "Open a local session or start a new coding agent.",
|
|
24
|
+
open: "Open locally",
|
|
25
|
+
sessions: "Sessions",
|
|
26
|
+
fitViewport: "Fit terminal to window",
|
|
27
|
+
scaleViewport: "Keep terminal grid scaled",
|
|
28
|
+
stop: "Stop session",
|
|
29
|
+
terminal: "Terminal"
|
|
30
|
+
});
|
|
31
|
+
var TERMINAL_THEME_SLOTS = ["foreground", "cursor", "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "brightBlack", "brightRed", "brightGreen", "brightYellow", "brightBlue", "brightMagenta", "brightCyan", "brightWhite"];
|
|
32
|
+
function terminalTheme(element) {
|
|
33
|
+
const probe = element.ownerDocument.createElement("span");
|
|
34
|
+
probe.hidden = true;
|
|
35
|
+
element.append(probe);
|
|
36
|
+
const theme = { background: "rgba(0, 0, 0, 0)" };
|
|
37
|
+
for (const slot of TERMINAL_THEME_SLOTS) {
|
|
38
|
+
const name = `--sctui-terminal-${slot.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}`;
|
|
39
|
+
probe.style.color = `var(${name}, var(${name}-default))`;
|
|
40
|
+
theme[slot] = getComputedStyle(probe).color;
|
|
41
|
+
}
|
|
42
|
+
probe.remove();
|
|
43
|
+
return theme;
|
|
44
|
+
}
|
|
45
|
+
function TerminalStreamViewer({ active = true, attachment, connect, convertEol = false, onReady, onActivity, onBell, onOpenLink, onRetry, onStatus, onTitle }) {
|
|
46
|
+
const root = useRef(null);
|
|
47
|
+
const runtime = useRef(null);
|
|
48
|
+
const searchInput = useRef(null);
|
|
49
|
+
const pasteDialog = useRef(null);
|
|
50
|
+
const bellTimer = useRef(null);
|
|
51
|
+
const activeRef = useRef(active);
|
|
52
|
+
const callbacks = useRef({});
|
|
53
|
+
const [status, setStatus] = useState("Loading terminal\u2026");
|
|
54
|
+
const [bellVisible, setBellVisible] = useState(false);
|
|
55
|
+
const [findOpen, setFindOpen] = useState(false);
|
|
56
|
+
const [findQuery, setFindQuery] = useState("");
|
|
57
|
+
const [findFound, setFindFound] = useState(null);
|
|
58
|
+
const [helpOpen, setHelpOpen] = useState(false);
|
|
59
|
+
const [historyOpen, setHistoryOpen] = useState(false);
|
|
60
|
+
const [pasteHistory, setPasteHistory] = useState([]);
|
|
61
|
+
const [pendingPaste, setPendingPaste] = useState(null);
|
|
62
|
+
activeRef.current = active;
|
|
63
|
+
callbacks.current = { onActivity, onBell, onOpenLink, onRetry, onStatus, onTitle };
|
|
64
|
+
const publishStatus = (next) => {
|
|
65
|
+
setStatus(next);
|
|
66
|
+
callbacks.current.onStatus?.(next);
|
|
67
|
+
};
|
|
68
|
+
const focusTerminal = () => runtime.current?.terminal.focus();
|
|
69
|
+
const closeFind = () => {
|
|
70
|
+
runtime.current?.search.clearDecorations();
|
|
71
|
+
setFindOpen(false);
|
|
72
|
+
queueMicrotask(focusTerminal);
|
|
73
|
+
};
|
|
74
|
+
const find = (direction = "next", query = findQuery) => {
|
|
75
|
+
if (!query || !runtime.current) return;
|
|
76
|
+
const found = runtime.current.search[direction === "previous" ? "findPrevious" : "findNext"](query, {
|
|
77
|
+
incremental: direction === "next"
|
|
78
|
+
});
|
|
79
|
+
setFindFound(found);
|
|
80
|
+
};
|
|
81
|
+
const openFind = () => {
|
|
82
|
+
setHelpOpen(false);
|
|
83
|
+
setHistoryOpen(false);
|
|
84
|
+
setFindOpen(true);
|
|
85
|
+
queueMicrotask(() => searchInput.current?.focus());
|
|
86
|
+
};
|
|
87
|
+
const sendPaste = (value, remember = true) => {
|
|
88
|
+
runtime.current?.terminal.paste(value);
|
|
89
|
+
if (!remember || value.length > 5e4) return;
|
|
90
|
+
setPasteHistory((current) => [value, ...current.filter((item) => item !== value)].slice(0, 20));
|
|
91
|
+
};
|
|
92
|
+
const proposePaste = (value) => {
|
|
93
|
+
setHistoryOpen(false);
|
|
94
|
+
if (value.length > 1e3 || /[\r\n]/.test(value)) setPendingPaste(value);
|
|
95
|
+
else sendPaste(value);
|
|
96
|
+
};
|
|
97
|
+
const saveContents = () => {
|
|
98
|
+
const terminal = runtime.current?.terminal;
|
|
99
|
+
if (!terminal) return;
|
|
100
|
+
const buffer = terminal.buffer.normal;
|
|
101
|
+
const lines = [];
|
|
102
|
+
for (let index = 0; index < buffer.length; index += 1) {
|
|
103
|
+
lines.push(buffer.getLine(index)?.translateToString(true) ?? "");
|
|
104
|
+
}
|
|
105
|
+
const blob = new Blob([`${lines.join("\n")}
|
|
106
|
+
`], { type: "text/plain;charset=utf-8" });
|
|
107
|
+
const url = URL.createObjectURL(blob);
|
|
108
|
+
const link = document.createElement("a");
|
|
109
|
+
const name = (attachment.sessionId ?? "session").replaceAll(/[^a-z0-9_-]/gi, "-").slice(0, 80);
|
|
110
|
+
link.download = `terminal-${name}.txt`;
|
|
111
|
+
link.href = url;
|
|
112
|
+
link.click();
|
|
113
|
+
queueMicrotask(() => URL.revokeObjectURL(url));
|
|
114
|
+
};
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
if (!root.current) return;
|
|
117
|
+
let disposed = false;
|
|
118
|
+
let disposeRuntime = () => void 0;
|
|
119
|
+
void Promise.all([
|
|
120
|
+
import("@xterm/addon-fit"),
|
|
121
|
+
import("@xterm/addon-search"),
|
|
122
|
+
import("@xterm/addon-web-links"),
|
|
123
|
+
import("@xterm/xterm")
|
|
124
|
+
]).then(([{ FitAddon }, { SearchAddon }, { WebLinksAddon }, { Terminal }]) => {
|
|
125
|
+
if (disposed || !root.current) return;
|
|
126
|
+
const terminal = new Terminal({
|
|
127
|
+
allowTransparency: true,
|
|
128
|
+
convertEol,
|
|
129
|
+
cursorBlink: attachment.mode === "control",
|
|
130
|
+
disableStdin: attachment.mode !== "control",
|
|
131
|
+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
|
|
132
|
+
fontSize: 12,
|
|
133
|
+
scrollback: 5e3,
|
|
134
|
+
theme: terminalTheme(root.current)
|
|
135
|
+
});
|
|
136
|
+
const fit = new FitAddon();
|
|
137
|
+
const search = new SearchAddon();
|
|
138
|
+
terminal.loadAddon(fit);
|
|
139
|
+
terminal.loadAddon(search);
|
|
140
|
+
terminal.loadAddon(new WebLinksAddon((_event, uri) => {
|
|
141
|
+
if (callbacks.current.onOpenLink) callbacks.current.onOpenLink(uri);
|
|
142
|
+
else globalThis.open(uri, "_blank", "noopener,noreferrer");
|
|
143
|
+
}));
|
|
144
|
+
terminal.open(root.current);
|
|
145
|
+
fit.fit();
|
|
146
|
+
runtime.current = { search, terminal };
|
|
147
|
+
const title = terminal.onTitleChange((value) => {
|
|
148
|
+
const normalized = value.replaceAll(/[\u0000-\u001f\u007f]/g, " ").trim().slice(0, 160);
|
|
149
|
+
if (normalized) callbacks.current.onTitle?.(normalized);
|
|
150
|
+
});
|
|
151
|
+
const bell = terminal.onBell(() => {
|
|
152
|
+
clearTimeout(bellTimer.current);
|
|
153
|
+
setBellVisible(true);
|
|
154
|
+
bellTimer.current = setTimeout(() => setBellVisible(false), 350);
|
|
155
|
+
callbacks.current.onBell?.();
|
|
156
|
+
});
|
|
157
|
+
let connected = false;
|
|
158
|
+
const handlers = {
|
|
159
|
+
onOpen() {
|
|
160
|
+
connected = true;
|
|
161
|
+
publishStatus(attachment.mode === "control" ? "Live \xB7 interactive" : "Live \xB7 read-only");
|
|
162
|
+
},
|
|
163
|
+
onOutput(data) {
|
|
164
|
+
if (disposed) return;
|
|
165
|
+
terminal.write(data);
|
|
166
|
+
if (!activeRef.current) callbacks.current.onActivity?.();
|
|
167
|
+
},
|
|
168
|
+
onResize(cols, rows) {
|
|
169
|
+
if (!disposed) terminal.resize(cols, rows);
|
|
170
|
+
},
|
|
171
|
+
onError(message) {
|
|
172
|
+
if (!disposed) {
|
|
173
|
+
publishStatus(message);
|
|
174
|
+
terminal.writeln(`\r
|
|
175
|
+
${message}`);
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
onExit() {
|
|
179
|
+
connected = false;
|
|
180
|
+
if (!disposed) publishStatus("Terminal exited");
|
|
181
|
+
},
|
|
182
|
+
onClose() {
|
|
183
|
+
connected = false;
|
|
184
|
+
if (!disposed) setStatus((current) => {
|
|
185
|
+
const next = current === "Terminal exited" ? current : "Terminal disconnected";
|
|
186
|
+
callbacks.current.onStatus?.(next);
|
|
187
|
+
return next;
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
const size = { cols: terminal.cols, rows: terminal.rows };
|
|
192
|
+
let connection;
|
|
193
|
+
try {
|
|
194
|
+
connection = connect(attachment, handlers, size);
|
|
195
|
+
} catch (error) {
|
|
196
|
+
bell.dispose();
|
|
197
|
+
title.dispose();
|
|
198
|
+
terminal.dispose();
|
|
199
|
+
runtime.current = null;
|
|
200
|
+
throw error;
|
|
201
|
+
}
|
|
202
|
+
let resizeFrame = 0;
|
|
203
|
+
let sentSize = size;
|
|
204
|
+
const refit = () => {
|
|
205
|
+
if (disposed || !connected || attachment.mode !== "control") return;
|
|
206
|
+
fit.fit();
|
|
207
|
+
if (terminal.cols === sentSize.cols && terminal.rows === sentSize.rows) return;
|
|
208
|
+
sentSize = { cols: terminal.cols, rows: terminal.rows };
|
|
209
|
+
connection.resize(terminal.cols, terminal.rows);
|
|
210
|
+
};
|
|
211
|
+
const resizeObserver = attachment.mode === "control" && globalThis.ResizeObserver ? new ResizeObserver(() => {
|
|
212
|
+
cancelAnimationFrame(resizeFrame);
|
|
213
|
+
resizeFrame = requestAnimationFrame(refit);
|
|
214
|
+
}) : null;
|
|
215
|
+
resizeObserver?.observe(root.current);
|
|
216
|
+
const input = attachment.mode === "control" ? terminal.onData((data) => connection.write(data)) : null;
|
|
217
|
+
onReady?.({ focus() {
|
|
218
|
+
refit();
|
|
219
|
+
terminal.focus();
|
|
220
|
+
} });
|
|
221
|
+
const focus = () => {
|
|
222
|
+
if (activeRef.current && attachment.mode === "control") terminal.focus();
|
|
223
|
+
};
|
|
224
|
+
root.current.addEventListener("pointerdown", focus);
|
|
225
|
+
const paste = (event) => {
|
|
226
|
+
if (attachment.mode !== "control") return;
|
|
227
|
+
const value = event.clipboardData?.getData("text/plain");
|
|
228
|
+
if (!value) return;
|
|
229
|
+
event.preventDefault();
|
|
230
|
+
proposePaste(value);
|
|
231
|
+
};
|
|
232
|
+
root.current.addEventListener("paste", paste, true);
|
|
233
|
+
if (active) requestAnimationFrame(focus);
|
|
234
|
+
disposeRuntime = () => {
|
|
235
|
+
root.current?.removeEventListener("pointerdown", focus);
|
|
236
|
+
root.current?.removeEventListener("paste", paste, true);
|
|
237
|
+
input?.dispose();
|
|
238
|
+
resizeObserver?.disconnect();
|
|
239
|
+
cancelAnimationFrame(resizeFrame);
|
|
240
|
+
bell.dispose();
|
|
241
|
+
title.dispose();
|
|
242
|
+
connection.close();
|
|
243
|
+
terminal.dispose();
|
|
244
|
+
runtime.current = null;
|
|
245
|
+
clearTimeout(bellTimer.current);
|
|
246
|
+
};
|
|
247
|
+
}).catch((error) => {
|
|
248
|
+
if (!disposed) publishStatus(error instanceof Error ? error.message : "Could not load the terminal viewer");
|
|
249
|
+
});
|
|
250
|
+
return () => {
|
|
251
|
+
disposed = true;
|
|
252
|
+
disposeRuntime();
|
|
253
|
+
};
|
|
254
|
+
}, [attachment.id, attachment.mode, connect, convertEol]);
|
|
255
|
+
useEffect(() => {
|
|
256
|
+
if (!active || attachment.mode !== "control") return;
|
|
257
|
+
const focus = () => root.current?.querySelector(".xterm-helper-textarea")?.focus({ preventScroll: true });
|
|
258
|
+
focus();
|
|
259
|
+
requestAnimationFrame(focus);
|
|
260
|
+
}, [active, attachment.mode]);
|
|
261
|
+
useEffect(() => {
|
|
262
|
+
if (!pendingPaste) return;
|
|
263
|
+
queueMicrotask(() => pasteDialog.current?.querySelector("button")?.focus({ preventScroll: true }));
|
|
264
|
+
}, [pendingPaste]);
|
|
265
|
+
const retryable = status === "Terminal disconnected" || status === "Terminal connection failed";
|
|
266
|
+
return /* @__PURE__ */ jsxs(
|
|
267
|
+
"div",
|
|
268
|
+
{
|
|
269
|
+
class: "sctui-viewer",
|
|
270
|
+
"data-bell": String(bellVisible),
|
|
271
|
+
onKeyDownCapture: (event) => {
|
|
272
|
+
if (pendingPaste) {
|
|
273
|
+
if (event.key === "Escape") {
|
|
274
|
+
event.preventDefault();
|
|
275
|
+
setPendingPaste(null);
|
|
276
|
+
queueMicrotask(focusTerminal);
|
|
277
|
+
} else if (event.key === "Tab") {
|
|
278
|
+
const buttons = [...pasteDialog.current?.querySelectorAll("button") ?? []];
|
|
279
|
+
const first = buttons.at(0);
|
|
280
|
+
const last = buttons.at(-1);
|
|
281
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
282
|
+
event.preventDefault();
|
|
283
|
+
last?.focus();
|
|
284
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
285
|
+
event.preventDefault();
|
|
286
|
+
first?.focus();
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if (event.key === "Escape" && findOpen) {
|
|
292
|
+
event.preventDefault();
|
|
293
|
+
closeFind();
|
|
294
|
+
} else if (event.key === "Escape" && (helpOpen || historyOpen)) {
|
|
295
|
+
event.preventDefault();
|
|
296
|
+
setHelpOpen(false);
|
|
297
|
+
setHistoryOpen(false);
|
|
298
|
+
queueMicrotask(focusTerminal);
|
|
299
|
+
} else if (event.altKey && event.shiftKey && !event.ctrlKey && !event.metaKey && event.code === "KeyF") {
|
|
300
|
+
event.preventDefault();
|
|
301
|
+
openFind();
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
children: [
|
|
305
|
+
/* @__PURE__ */ jsxs("div", { class: "sctui-viewerbar", children: [
|
|
306
|
+
/* @__PURE__ */ jsxs("div", { class: "sctui-status", "data-live": String(status.startsWith("Live")), role: "status", children: [
|
|
307
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true" }),
|
|
308
|
+
status,
|
|
309
|
+
retryable && onRetry ? /* @__PURE__ */ jsx("button", { type: "button", onClick: onRetry, children: "Reconnect" }) : null
|
|
310
|
+
] }),
|
|
311
|
+
/* @__PURE__ */ jsxs("div", { class: "sctui-tools", "aria-label": "Terminal tools", children: [
|
|
312
|
+
/* @__PURE__ */ jsx("button", { type: "button", "aria-keyshortcuts": "Alt+Shift+F", "aria-label": "Find in terminal", title: `Find (${terminalShortcutLabel("F")})`, onClick: openFind, children: /* @__PURE__ */ jsx(SearchGlyph, {}) }),
|
|
313
|
+
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Paste history", "aria-expanded": historyOpen, disabled: !pasteHistory.length, title: "Paste history (memory only)", onClick: () => {
|
|
314
|
+
setHelpOpen(false);
|
|
315
|
+
setHistoryOpen((open) => !open);
|
|
316
|
+
}, children: /* @__PURE__ */ jsx(HistoryGlyph, {}) }),
|
|
317
|
+
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Save terminal contents", title: "Save terminal contents", onClick: saveContents, children: /* @__PURE__ */ jsx(DownloadGlyph, {}) }),
|
|
318
|
+
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Terminal shortcut help", "aria-expanded": helpOpen, title: "Keyboard shortcuts", onClick: () => {
|
|
319
|
+
setHistoryOpen(false);
|
|
320
|
+
setHelpOpen((open) => !open);
|
|
321
|
+
}, children: /* @__PURE__ */ jsx(HelpGlyph, {}) })
|
|
322
|
+
] })
|
|
323
|
+
] }),
|
|
324
|
+
findOpen ? /* @__PURE__ */ jsxs("form", { class: "sctui-find", onSubmit: (event) => {
|
|
325
|
+
event.preventDefault();
|
|
326
|
+
find(event.shiftKey ? "previous" : "next");
|
|
327
|
+
}, children: [
|
|
328
|
+
/* @__PURE__ */ jsx(SearchGlyph, {}),
|
|
329
|
+
/* @__PURE__ */ jsx("input", { ref: searchInput, value: findQuery, "aria-label": "Find", placeholder: "Find", onInput: (event) => {
|
|
330
|
+
const query = event.currentTarget.value;
|
|
331
|
+
setFindQuery(query);
|
|
332
|
+
if (query) find("next", query);
|
|
333
|
+
else {
|
|
334
|
+
runtime.current?.search.clearDecorations();
|
|
335
|
+
setFindFound(null);
|
|
336
|
+
}
|
|
337
|
+
} }),
|
|
338
|
+
/* @__PURE__ */ jsx("small", { children: findFound === null ? "" : findFound ? "Match" : "No results" }),
|
|
339
|
+
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Previous match", onClick: () => find("previous"), children: /* @__PURE__ */ jsx(UpGlyph, {}) }),
|
|
340
|
+
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Next match", onClick: () => find("next"), children: /* @__PURE__ */ jsx(DownGlyph, {}) }),
|
|
341
|
+
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Close find", onClick: closeFind, children: /* @__PURE__ */ jsx(CloseGlyph, {}) })
|
|
342
|
+
] }) : null,
|
|
343
|
+
historyOpen ? /* @__PURE__ */ jsxs("div", { class: "sctui-popover sctui-paste-history", role: "menu", "aria-label": "Paste history", children: [
|
|
344
|
+
/* @__PURE__ */ jsxs("strong", { children: [
|
|
345
|
+
"Paste history ",
|
|
346
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
347
|
+
/* @__PURE__ */ jsx("small", { children: "memory only" }),
|
|
348
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => {
|
|
349
|
+
setPasteHistory([]);
|
|
350
|
+
setHistoryOpen(false);
|
|
351
|
+
}, children: "Clear" })
|
|
352
|
+
] })
|
|
353
|
+
] }),
|
|
354
|
+
pasteHistory.map((value, index) => /* @__PURE__ */ jsxs("button", { type: "button", role: "menuitem", onClick: () => proposePaste(value), children: [
|
|
355
|
+
/* @__PURE__ */ jsx("span", { children: value.replaceAll(/\s+/g, " ").slice(0, 90) }),
|
|
356
|
+
/* @__PURE__ */ jsxs("small", { children: [
|
|
357
|
+
value.length,
|
|
358
|
+
" chars"
|
|
359
|
+
] })
|
|
360
|
+
] }, `${index}:${value.length}`))
|
|
361
|
+
] }) : null,
|
|
362
|
+
helpOpen ? /* @__PURE__ */ jsxs("div", { class: "sctui-popover sctui-shortcuts", role: "dialog", "aria-label": "Terminal keyboard shortcuts", children: [
|
|
363
|
+
/* @__PURE__ */ jsx("strong", { children: "Terminal shortcuts" }),
|
|
364
|
+
/* @__PURE__ */ jsxs("dl", { children: [
|
|
365
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
366
|
+
/* @__PURE__ */ jsx("dt", { children: "New or attach" }),
|
|
367
|
+
/* @__PURE__ */ jsx("dd", { children: terminalShortcutLabel("T") })
|
|
368
|
+
] }),
|
|
369
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
370
|
+
/* @__PURE__ */ jsx("dt", { children: "Find" }),
|
|
371
|
+
/* @__PURE__ */ jsx("dd", { children: terminalShortcutLabel("F") })
|
|
372
|
+
] }),
|
|
373
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
374
|
+
/* @__PURE__ */ jsx("dt", { children: "Detach tab" }),
|
|
375
|
+
/* @__PURE__ */ jsx("dd", { children: terminalShortcutLabel("D") })
|
|
376
|
+
] }),
|
|
377
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
378
|
+
/* @__PURE__ */ jsx("dt", { children: "Previous / next tab" }),
|
|
379
|
+
/* @__PURE__ */ jsx("dd", { children: terminalShortcutLabel("[ / ]") })
|
|
380
|
+
] }),
|
|
381
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
382
|
+
/* @__PURE__ */ jsx("dt", { children: "Select tab" }),
|
|
383
|
+
/* @__PURE__ */ jsx("dd", { children: terminalShortcutLabel("1\u20139") })
|
|
384
|
+
] })
|
|
385
|
+
] }),
|
|
386
|
+
/* @__PURE__ */ jsx("small", { children: "Command and Control shortcuts stay with the browser and terminal." })
|
|
387
|
+
] }) : null,
|
|
388
|
+
pendingPaste ? /* @__PURE__ */ jsxs("div", { class: "sctui-paste-confirm", ref: pasteDialog, role: "alertdialog", "aria-modal": "true", "aria-label": "Confirm terminal paste", children: [
|
|
389
|
+
/* @__PURE__ */ jsx("strong", { children: "Paste into this terminal?" }),
|
|
390
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
391
|
+
pendingPaste.split(/\r?\n/).length,
|
|
392
|
+
" lines \xB7 ",
|
|
393
|
+
pendingPaste.length.toLocaleString(),
|
|
394
|
+
" characters"
|
|
395
|
+
] }),
|
|
396
|
+
/* @__PURE__ */ jsx("pre", { children: pendingPaste.replaceAll(/\s+/g, " ").slice(0, 180) }),
|
|
397
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
398
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => {
|
|
399
|
+
setPendingPaste(null);
|
|
400
|
+
queueMicrotask(focusTerminal);
|
|
401
|
+
}, children: "Cancel" }),
|
|
402
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => {
|
|
403
|
+
sendPaste(pendingPaste);
|
|
404
|
+
setPendingPaste(null);
|
|
405
|
+
queueMicrotask(focusTerminal);
|
|
406
|
+
}, children: "Paste" })
|
|
407
|
+
] })
|
|
408
|
+
] }) : null,
|
|
409
|
+
/* @__PURE__ */ jsx("div", { class: "sctui-screen", "data-active": String(active), ref: root })
|
|
410
|
+
]
|
|
411
|
+
}
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
function CloseGlyph() {
|
|
415
|
+
return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", children: /* @__PURE__ */ jsx("path", { d: "m4.5 4.5 7 7m0-7-7 7" }) });
|
|
416
|
+
}
|
|
417
|
+
function SearchGlyph() {
|
|
418
|
+
return /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", children: [
|
|
419
|
+
/* @__PURE__ */ jsx("circle", { cx: "7", cy: "7", r: "3.5" }),
|
|
420
|
+
/* @__PURE__ */ jsx("path", { d: "m9.7 9.7 3 3" })
|
|
421
|
+
] });
|
|
422
|
+
}
|
|
423
|
+
function HistoryGlyph() {
|
|
424
|
+
return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", children: /* @__PURE__ */ jsx("path", { d: "M3.2 5.3A5 5 0 1 1 3 10M3.2 5.3V2.7m0 2.6h2.6M8 4.8V8l2 1.3" }) });
|
|
425
|
+
}
|
|
426
|
+
function DownloadGlyph() {
|
|
427
|
+
return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", children: /* @__PURE__ */ jsx("path", { d: "M8 2.5v7m-2.5-2L8 10l2.5-2.5M3 12.5h10" }) });
|
|
428
|
+
}
|
|
429
|
+
function HelpGlyph() {
|
|
430
|
+
return /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", children: [
|
|
431
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "5.5" }),
|
|
432
|
+
/* @__PURE__ */ jsx("path", { d: "M6.7 6.2A1.5 1.5 0 0 1 8.2 5c1 0 1.7.6 1.7 1.5 0 1.4-1.8 1.4-1.8 2.6M8.1 11.4h.01" })
|
|
433
|
+
] });
|
|
434
|
+
}
|
|
435
|
+
function UpGlyph() {
|
|
436
|
+
return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", children: /* @__PURE__ */ jsx("path", { d: "m4 10 4-4 4 4" }) });
|
|
437
|
+
}
|
|
438
|
+
function DownGlyph() {
|
|
439
|
+
return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", children: /* @__PURE__ */ jsx("path", { d: "m4 6 4 4 4-4" }) });
|
|
440
|
+
}
|
|
441
|
+
function terminalShortcutLabel(key) {
|
|
442
|
+
return /Mac|iPhone|iPad|iPod/i.test(globalThis.navigator?.platform ?? "") ? `\u2325\u21E7${key}` : `Alt+Shift+${key}`;
|
|
443
|
+
}
|
|
444
|
+
export {
|
|
445
|
+
TerminalStreamViewer
|
|
446
|
+
};
|
package/styles.css
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/* Generated from src/styles.css by scripts/build-styles.mjs. Edit that file. */
|
|
2
|
+
.sctui-panel {
|
|
3
|
+
--sctui-terminal-background: var(--volter-surface-media, light-dark(#0f1a1f, #070d10));
|
|
4
|
+
--sctui-bg-default: var(--volter-surface-page, light-dark(#f7f6f1, #0f1a1f));
|
|
5
|
+
--sctui-bg-raised-default: var(--volter-surface-raised, light-dark(#fbfaf7, #16252c));
|
|
6
|
+
--sctui-fill-default: var(--volter-surface-subtle, light-dark(#f2f1eb, #1d2d34));
|
|
7
|
+
--sctui-fill-strong-default: var(--volter-surface-inset, light-dark(#e7e6df, #22343c));
|
|
8
|
+
--sctui-fg-default: var(--volter-text-primary, light-dark(#16252c, #f3f2ec));
|
|
9
|
+
--sctui-muted-default: var(--volter-text-muted, light-dark(#5d6970, #a9b0ad));
|
|
10
|
+
--sctui-border-default: var(--volter-border-default, light-dark(#d9dad3, #2c3d45));
|
|
11
|
+
--sctui-border-strong-default: var(--volter-border-strong, light-dark(#c4c5bc, #3d5059));
|
|
12
|
+
--sctui-danger-default: var(--volter-status-danger-base, light-dark(#d24a1f, #f07650));
|
|
13
|
+
color-scheme: var(--scui-color-scheme, light dark);
|
|
14
|
+
position: absolute;
|
|
15
|
+
inset: 0;
|
|
16
|
+
z-index: var(--sctui-z-index, 12);
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
color: var(--sctui-fg, var(--scui-fg, var(--sctui-fg-default)));
|
|
21
|
+
background: var(--sctui-bg, var(--scui-bg, var(--sctui-bg-default)));
|
|
22
|
+
font-family: var(--sctui-font, var(--scui-font, var(--volter-font-ui, "Geist", "Segoe UI", system-ui, sans-serif)));
|
|
23
|
+
}
|
|
24
|
+
.sctui-panel > header { display:grid; flex:none; box-sizing:border-box; grid-template-columns:28px minmax(0,1fr) auto; align-items:center; gap:6px; height:36px; min-height:36px; padding:3px 8px; border-bottom:1px solid var(--sctui-border,var(--scui-border,var(--sctui-border-default))); background:var(--sctui-bg-raised,var(--scui-bg-raised,var(--sctui-bg-raised-default))) }
|
|
25
|
+
.sctui-panel header span { display:flex; min-width:0; align-items:baseline; gap:6px }
|
|
26
|
+
.sctui-panel header strong { font-size:13px; line-height:1.2 }
|
|
27
|
+
.sctui-panel header small { overflow:hidden; color:var(--sctui-muted,var(--scui-muted,var(--sctui-muted-default))); font-size:10px; text-overflow:ellipsis; white-space:nowrap }
|
|
28
|
+
.sctui-panel button { min-height:28px; padding:4px 8px; border:1px solid var(--sctui-border,var(--scui-border,var(--sctui-border-default))); border-radius:7px; color:inherit; background:var(--sctui-fill,var(--scui-fill,var(--sctui-fill-default))); font:inherit; font-size:11px; font-weight:600; line-height:1.2; cursor:pointer }
|
|
29
|
+
.sctui-panel button:hover:not(:disabled) { border-color:var(--sctui-border-strong,var(--scui-border-strong,var(--sctui-border-strong-default))); background:var(--sctui-fill-strong,var(--scui-fill-strong,var(--sctui-fill-strong-default))) }
|
|
30
|
+
.sctui-panel button:disabled { opacity:.5; cursor:default }
|
|
31
|
+
.sctui-panel header > button:first-child { padding:0; border-color:transparent; background:transparent; font-size:16px }
|
|
32
|
+
.sctui-panel[data-attached="true"] header > button:last-child { min-width:28px; padding:0; border-color:transparent; background:transparent; font-size:17px }
|
|
33
|
+
.sctui-create { display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); gap:7px; padding:10px; border-bottom:1px solid var(--sctui-border,var(--scui-border,var(--sctui-border-default))) }
|
|
34
|
+
.sctui-create button { min-height:34px }
|
|
35
|
+
.sctui-list { min-height:0; overflow:auto }
|
|
36
|
+
.sctui-list article { display:grid; grid-template-columns:minmax(0,1fr) repeat(4,auto); align-items:center; gap:5px; padding:9px 10px; border-bottom:1px solid var(--sctui-border,var(--scui-border,var(--sctui-border-default))) }
|
|
37
|
+
.sctui-list article > span { display:flex; min-width:0; flex-direction:column; gap:3px }
|
|
38
|
+
.sctui-list article strong { overflow:hidden; font-size:12px; text-overflow:ellipsis; white-space:nowrap }
|
|
39
|
+
.sctui-path { display:flex; min-width:0; overflow:hidden; color:var(--sctui-muted,var(--scui-muted,var(--sctui-muted-default))); font-size:10px; font-style:normal; white-space:nowrap }
|
|
40
|
+
.sctui-path > span { flex:0 1 auto; overflow:hidden; text-overflow:ellipsis }
|
|
41
|
+
.sctui-path > i { flex:none; font-style:normal }
|
|
42
|
+
.sctui-path > b { flex:none; max-width:58%; overflow:hidden; direction:rtl; font-weight:400; text-align:left; text-overflow:ellipsis; unicode-bidi:plaintext }
|
|
43
|
+
.sctui-list .sctui-danger { color:var(--sctui-danger,var(--scui-danger,var(--sctui-danger-default))); background:transparent }
|
|
44
|
+
.sctui-error,.sctui-empty { margin:10px; padding:9px; border:1px solid var(--sctui-border,var(--scui-border,var(--sctui-border-default))); border-radius:8px; color:var(--sctui-muted,var(--scui-muted,var(--sctui-muted-default))); background:var(--sctui-bg-raised,var(--scui-bg-raised,var(--sctui-bg-raised-default))); font-size:11px; line-height:1.4 }
|
|
45
|
+
.sctui-error { color:var(--sctui-danger,var(--scui-danger,var(--sctui-danger-default))) }
|
|
46
|
+
.sctui-live { display:flex; min-height:0; flex:1; flex-direction:column; padding:5px 7px 7px; gap:4px; background:var(--sctui-terminal-background) }
|
|
47
|
+
.sctui-viewer {
|
|
48
|
+
/* The terminal is a dark media surface in either page scheme, so its inks
|
|
49
|
+
(ANSI palette, foreground, chrome) resolve in the dark scheme. xterm reads
|
|
50
|
+
the resolved colours from these tokens when it mounts (src/ui.jsx). */
|
|
51
|
+
--sctui-terminal-foreground-default:var(--volter-terminal-white, light-dark(#808b8f, #f3f2ec)); --sctui-terminal-cursor-default:var(--volter-terminal-white, light-dark(#808b8f, #f3f2ec));
|
|
52
|
+
--sctui-terminal-black-default:var(--volter-terminal-black, light-dark(#16252c, #2c3d45)); --sctui-terminal-red-default:var(--volter-terminal-red, light-dark(#d24a1f, #f07650));
|
|
53
|
+
--sctui-terminal-green-default:var(--volter-terminal-green, light-dark(#3f7a55, #6fbf8e)); --sctui-terminal-yellow-default:var(--volter-terminal-yellow, light-dark(#c7641a, #ec9a52));
|
|
54
|
+
--sctui-terminal-blue-default:var(--volter-terminal-blue, light-dark(#3b5f8a, #7ea6d8)); --sctui-terminal-magenta-default:var(--volter-terminal-magenta, light-dark(#6a5a92, #aa98d8));
|
|
55
|
+
--sctui-terminal-cyan-default:var(--volter-terminal-cyan, light-dark(#2f7a74, #6cc1b8)); --sctui-terminal-white-default:var(--volter-terminal-white, light-dark(#808b8f, #f3f2ec));
|
|
56
|
+
--sctui-terminal-bright-black-default:var(--volter-terminal-bright-black, light-dark(#5d6970, #a9b0ad)); --sctui-terminal-bright-red-default:var(--volter-terminal-bright-red, light-dark(#ff6a1f, #ff8a5c));
|
|
57
|
+
--sctui-terminal-bright-green-default:var(--volter-terminal-bright-green, light-dark(#6a9a3a, #9bcf62)); --sctui-terminal-bright-yellow-default:var(--volter-terminal-bright-yellow, light-dark(#c98a12, #f3c26b));
|
|
58
|
+
--sctui-terminal-bright-blue-default:var(--volter-terminal-bright-blue, light-dark(#4f78a8, #9ec0ea)); --sctui-terminal-bright-magenta-default:var(--volter-terminal-bright-magenta, light-dark(#8a78c0, #c4b7e6));
|
|
59
|
+
--sctui-terminal-bright-cyan-default:var(--volter-terminal-bright-cyan, light-dark(#3f948d, #8ad6cd)); --sctui-terminal-bright-white-default:var(--volter-terminal-bright-white, light-dark(#b8bab5, #ffffff));
|
|
60
|
+
color-scheme:dark;
|
|
61
|
+
position:relative; display:flex; min-width:0; min-height:0; flex:1; flex-direction:column; background:transparent }
|
|
62
|
+
.sctui-viewer[data-bell="true"] .sctui-screen { box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--volter-status-danger-base, light-dark(#d24a1f, #f07650)) 72%, transparent) }
|
|
63
|
+
.sctui-viewerbar { display:flex; min-width:0; min-height:18px; flex:none; align-items:center }
|
|
64
|
+
.sctui-status { flex:none; color:var(--volter-text-muted, light-dark(#5d6970, #a9b0ad)); font:500 10px/1.2 var(--volter-font-data, "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace) }
|
|
65
|
+
.sctui-screen { min-height:0; flex:1; overflow:auto }
|
|
66
|
+
.sctui-screen .xterm { height:100% }
|
|
67
|
+
.sctui-screen .xterm .xterm-viewport { overflow-y:auto; background:transparent }
|
|
68
|
+
|
|
69
|
+
.sctui-workspace {
|
|
70
|
+
--sctui-terminal-background:var(--volter-surface-media, light-dark(#0f1a1f, #070d10));
|
|
71
|
+
--sctui-bg-default:var(--volter-surface-page, light-dark(#f7f6f1, #0f1a1f)); --sctui-bg-raised-default:var(--volter-surface-raised, light-dark(#fbfaf7, #16252c)); --sctui-fill-default:var(--volter-surface-subtle, light-dark(#f2f1eb, #1d2d34));
|
|
72
|
+
--sctui-fill-strong-default:var(--volter-surface-inset, light-dark(#e7e6df, #22343c)); --sctui-fg-default:var(--volter-text-primary, light-dark(#16252c, #f3f2ec)); --sctui-muted-default:var(--volter-text-muted, light-dark(#5d6970, #a9b0ad));
|
|
73
|
+
--sctui-border-default:var(--volter-border-default, light-dark(#d9dad3, #2c3d45)); --sctui-border-strong-default:var(--volter-border-strong, light-dark(#c4c5bc, #3d5059)); --sctui-danger-default:var(--volter-status-danger-base, light-dark(#d24a1f, #f07650));
|
|
74
|
+
color-scheme:var(--scui-color-scheme, light dark);
|
|
75
|
+
position:absolute; inset:0; z-index:var(--sctui-z-index,12); display:flex; min-width:0; min-height:0;
|
|
76
|
+
flex-direction:column; overflow:hidden; color:var(--sctui-fg,var(--scui-fg,var(--sctui-fg-default)));
|
|
77
|
+
background:var(--sctui-terminal-background); font-family:var(--sctui-font,var(--scui-font,var(--volter-font-ui, "Geist", "Segoe UI", system-ui, sans-serif)));
|
|
78
|
+
}
|
|
79
|
+
.sctui-tabbar { display:flex; z-index:2; min-width:0; height:32px; min-height:32px; align-items:stretch;
|
|
80
|
+
border-bottom:1px solid var(--sctui-border,var(--scui-border,var(--sctui-border-default)));
|
|
81
|
+
color:var(--sctui-fg,var(--scui-fg,var(--sctui-fg-default)));
|
|
82
|
+
background:var(--sctui-bg-raised,var(--scui-bg-raised,var(--sctui-bg-raised-default))) }
|
|
83
|
+
.sctui-tabbar button { box-sizing:border-box; border:0; color:inherit; background:transparent;
|
|
84
|
+
font:600 11px/1 var(--sctui-font,var(--scui-font,var(--volter-font-ui, "Geist", "Segoe UI", system-ui, sans-serif))); cursor:pointer }
|
|
85
|
+
.sctui-tabbar button:hover { background:var(--sctui-fill,var(--scui-fill,var(--sctui-fill-default))) }
|
|
86
|
+
.sctui-back { display:grid; width:32px; flex:none; padding:0; place-items:center }
|
|
87
|
+
.sctui-tabs { display:flex; min-width:0; flex:1; overflow-x:auto; scrollbar-width:none }
|
|
88
|
+
.sctui-tabs::-webkit-scrollbar { display:none }
|
|
89
|
+
.sctui-tab { position:relative; display:flex; min-width:100px; max-width:190px; flex:0 1 160px; border-right:1px solid var(--sctui-border,var(--scui-border,var(--sctui-border-default))) }
|
|
90
|
+
.sctui-tab[data-active="true"] { background:var(--sctui-bg,var(--scui-bg,var(--sctui-bg-default))) }
|
|
91
|
+
.sctui-tab[data-active="true"]::after { position:absolute; right:0; bottom:-1px; left:0; height:1px; content:""; background:var(--sctui-terminal-background) }
|
|
92
|
+
.sctui-tab > button:first-child { display:flex; min-width:0; flex:1; align-items:center; gap:6px; padding:0 4px 0 9px }
|
|
93
|
+
.sctui-tab > button:first-child span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
|
|
94
|
+
.sctui-tab > button:last-child { display:grid; width:25px; flex:none; padding:0; place-items:center; opacity:0 }
|
|
95
|
+
.sctui-tab:hover > button:last-child,.sctui-tab[data-active="true"] > button:last-child,.sctui-tab > button:last-child:focus-visible { opacity:.7 }
|
|
96
|
+
.sctui-tab svg,.sctui-session-menu svg,.sctui-terminal-empty svg,.sctui-back svg { width:14px; height:14px; flex:none; fill:none; stroke:currentColor; stroke-linecap:round; stroke-linejoin:round; stroke-width:1.5 }
|
|
97
|
+
.sctui-tab i { width:6px; height:6px; flex:none; border-radius:50%; background:var(--volter-text-faint, light-dark(#a3aaa9, #6c7a80)) }
|
|
98
|
+
.sctui-tab i[data-live="true"] { background:var(--volter-status-live-base, light-dark(#5f9a2e, #9bcf62)) }
|
|
99
|
+
.sctui-tab i[data-attention="activity"] { background:var(--volter-status-attention-base, light-dark(#c7641a, #ec9a52)); box-shadow:0 0 0 2px color-mix(in srgb, var(--volter-status-attention-base, light-dark(#c7641a, #ec9a52)) 17%, transparent) }
|
|
100
|
+
.sctui-tab i[data-attention="bell"] { background:var(--volter-status-danger-base, light-dark(#d24a1f, #f07650)); box-shadow:0 0 0 2px color-mix(in srgb, var(--volter-status-danger-base, light-dark(#d24a1f, #f07650)) 20%, transparent) }
|
|
101
|
+
.sctui-session-menu { position:relative; flex:none }
|
|
102
|
+
.sctui-session-trigger { display:grid; width:32px; height:31px; place-items:center }
|
|
103
|
+
.sctui-session-menu > div { position:absolute; z-index:5; top:34px; right:0; display:flex; width:280px; max-height:340px;
|
|
104
|
+
flex-direction:column; overflow:auto; padding:6px; border:1px solid var(--sctui-border,var(--scui-border,var(--sctui-border-default)));
|
|
105
|
+
border-radius:9px; background:var(--sctui-bg,var(--scui-bg,var(--sctui-bg-default))); box-shadow:var(--volter-shadow-floating, 0 12px 32px rgba(21, 23, 22, 0.14), 0 2px 8px rgba(21, 23, 22, 0.08)) }
|
|
106
|
+
.sctui-session-menu > div > strong,.sctui-menu-heading { padding:7px 8px 5px; color:var(--sctui-muted,var(--scui-muted,var(--sctui-muted-default))); font-size:10px; text-transform:uppercase; letter-spacing:.04em }
|
|
107
|
+
.sctui-session-menu > div > button { display:flex; min-height:38px; flex:none; align-items:center; gap:8px; padding:6px 8px; border-radius:6px; text-align:left }
|
|
108
|
+
.sctui-session-menu > div > button > span:not(.sctui-action-icon) { display:flex; min-width:0; flex:1; flex-direction:column; gap:2px; overflow:hidden }
|
|
109
|
+
.sctui-session-menu > div > button b { overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
|
|
110
|
+
.sctui-session-menu > div > button small { flex:none; color:var(--sctui-muted,var(--scui-muted,var(--sctui-muted-default))); font-size:9px }
|
|
111
|
+
.sctui-menu-heading { display:flex; align-items:center; justify-content:space-between }
|
|
112
|
+
.sctui-menu-heading button { padding:3px 5px; color:var(--sctui-muted,var(--scui-muted,var(--sctui-muted-default))); font-size:9px }
|
|
113
|
+
.sctui-action-icon { display:grid; width:16px; height:16px; flex:none; place-items:center }
|
|
114
|
+
.sctui-action-icon img,.sctui-action-icon svg { display:block; width:15px; height:15px; object-fit:contain }
|
|
115
|
+
.sctui-toolbar-action { flex:none; padding:0 9px }
|
|
116
|
+
.sctui-toolbar-action.sctui-danger { color:var(--sctui-danger,var(--scui-danger,var(--sctui-danger-default))) }
|
|
117
|
+
.sctui-viewport-action { display:grid; width:32px; flex:none; padding:0; place-items:center }
|
|
118
|
+
.sctui-viewport-action svg { width:14px; height:14px; fill:none; stroke:currentColor; stroke-linecap:round; stroke-linejoin:round; stroke-width:1.35 }
|
|
119
|
+
.sctui-terminals { color-scheme:dark; position:relative; min-width:0; min-height:0; flex:1; background:transparent }
|
|
120
|
+
.sctui-terminal { position:absolute; inset:0; display:none; min-width:0; min-height:0; flex-direction:column; padding:4px 7px 7px; background:transparent }
|
|
121
|
+
.sctui-terminal[data-active="true"] { display:flex }
|
|
122
|
+
.sctui-terminal > .sctui-screen,.sctui-terminal > .sctui-viewer { min-height:0; flex:1; overflow:hidden }
|
|
123
|
+
.sctui-status { display:flex; min-height:16px; flex:none; align-items:center; gap:5px; color:var(--volter-text-muted, light-dark(#5d6970, #a9b0ad)) }
|
|
124
|
+
.sctui-status > span { width:6px; height:6px; flex:none; border-radius:50%; background:var(--volter-text-faint, light-dark(#a3aaa9, #6c7a80)) }
|
|
125
|
+
.sctui-status[data-live="true"] > span { background:var(--volter-status-live-base, light-dark(#5f9a2e, #9bcf62)) }
|
|
126
|
+
.sctui-status button { margin-left:auto; padding:2px 6px; border:0; border-radius:4px; color:var(--volter-text-primary, light-dark(#16252c, #f3f2ec)); background:var(--volter-surface-inset, light-dark(#e7e6df, #22343c)); font:600 9px/1.2 inherit; cursor:pointer }
|
|
127
|
+
.sctui-tools { display:flex; margin-left:auto; flex:none; align-items:center; gap:1px }
|
|
128
|
+
.sctui-tools > button,.sctui-find > button { display:grid; width:20px; height:18px; padding:0; border:0; border-radius:4px; color:var(--volter-text-muted, light-dark(#5d6970, #a9b0ad)); background:transparent; cursor:pointer; place-items:center }
|
|
129
|
+
.sctui-tools > button:hover:not(:disabled),.sctui-find > button:hover { color:var(--volter-text-primary, light-dark(#16252c, #f3f2ec)); background:var(--volter-surface-inset, light-dark(#e7e6df, #22343c)) }
|
|
130
|
+
.sctui-tools > button:disabled { opacity:.3; cursor:default }
|
|
131
|
+
.sctui-tools svg,.sctui-find svg { width:12px; height:12px; fill:none; stroke:currentColor; stroke-linecap:round; stroke-linejoin:round; stroke-width:1.4 }
|
|
132
|
+
.sctui-find { position:absolute; z-index:5; top:21px; right:5px; display:flex; height:28px; align-items:center; gap:2px; padding:2px 3px 2px 7px; border:1px solid var(--volter-border-strong, light-dark(#c4c5bc, #3d5059)); border-radius:6px; color:var(--volter-text-muted, light-dark(#5d6970, #a9b0ad)); background:var(--volter-surface-raised, light-dark(#fbfaf7, #16252c)); box-shadow:var(--volter-shadow-floating, 0 12px 32px rgba(21, 23, 22, 0.14), 0 2px 8px rgba(21, 23, 22, 0.08)) }
|
|
133
|
+
.sctui-find > input { width:180px; padding:3px 4px; border:0; outline:0; color:var(--volter-text-primary, light-dark(#16252c, #f3f2ec)); background:transparent; font:500 11px/1.2 var(--volter-font-data, "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace) }
|
|
134
|
+
.sctui-find > small { min-width:42px; color:var(--volter-text-tertiary, light-dark(#66727a, #8b979b)); font:500 9px/1 var(--volter-font-data, "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace); text-align:right }
|
|
135
|
+
.sctui-popover { position:absolute; z-index:6; top:21px; right:4px; box-sizing:border-box; width:250px; max-height:250px; overflow:auto; padding:7px; border:1px solid var(--volter-border-strong, light-dark(#c4c5bc, #3d5059)); border-radius:7px; color:var(--volter-text-primary, light-dark(#16252c, #f3f2ec)); background:var(--volter-surface-raised, light-dark(#fbfaf7, #16252c)); box-shadow:var(--volter-shadow-floating, 0 12px 32px rgba(21, 23, 22, 0.14), 0 2px 8px rgba(21, 23, 22, 0.08)); font-size:10px }
|
|
136
|
+
.sctui-popover > strong { display:flex; align-items:baseline; justify-content:space-between; padding:2px 3px 6px; font-size:11px }
|
|
137
|
+
.sctui-popover > strong span { display:flex; align-items:center; gap:5px }
|
|
138
|
+
.sctui-popover > strong small,.sctui-popover > small { color:var(--volter-text-tertiary, light-dark(#66727a, #8b979b)); font-size:9px; font-weight:500 }
|
|
139
|
+
.sctui-popover > strong button { padding:1px 3px; border:0; border-radius:3px; color:var(--volter-text-muted, light-dark(#5d6970, #a9b0ad)); background:transparent; font:600 8px/1.2 inherit; cursor:pointer }
|
|
140
|
+
.sctui-popover > strong button:hover { background:var(--volter-surface-inset, light-dark(#e7e6df, #22343c)) }
|
|
141
|
+
.sctui-paste-history > button { display:flex; width:100%; min-height:30px; align-items:center; gap:8px; padding:5px 6px; border:0; border-radius:4px; color:inherit; background:transparent; font:inherit; text-align:left; cursor:pointer }
|
|
142
|
+
.sctui-paste-history > button:hover { background:var(--volter-surface-inset, light-dark(#e7e6df, #22343c)) }
|
|
143
|
+
.sctui-paste-history > button span { min-width:0; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
|
|
144
|
+
.sctui-paste-history > button small { flex:none; color:var(--volter-text-tertiary, light-dark(#66727a, #8b979b)); font-size:8px }
|
|
145
|
+
.sctui-shortcuts dl { display:grid; gap:0; margin:0 0 7px }
|
|
146
|
+
.sctui-shortcuts dl div { display:flex; justify-content:space-between; gap:10px; padding:5px 3px; border-top:1px solid var(--volter-border-default, light-dark(#d9dad3, #2c3d45)) }
|
|
147
|
+
.sctui-shortcuts dt,.sctui-shortcuts dd { margin:0 }
|
|
148
|
+
.sctui-shortcuts dd { color:var(--volter-text-muted, light-dark(#5d6970, #a9b0ad)); font:500 9px/1.2 var(--volter-font-data, "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace) }
|
|
149
|
+
.sctui-paste-confirm { position:absolute; z-index:7; top:50%; left:50%; display:flex; width:min(330px,calc(100% - 30px)); box-sizing:border-box; flex-direction:column; gap:7px; padding:12px; border:1px solid var(--volter-border-strong, light-dark(#c4c5bc, #3d5059)); border-radius:8px; color:var(--volter-text-primary, light-dark(#16252c, #f3f2ec)); background:var(--volter-surface-raised, light-dark(#fbfaf7, #16252c)); box-shadow:var(--volter-shadow-dialog, 0 2px 6px rgba(27, 30, 28, 0.06), 0 12px 32px rgba(27, 30, 28, 0.1)); font-size:11px; transform:translate(-50%,-50%) }
|
|
150
|
+
.sctui-paste-confirm > span { color:var(--volter-text-muted, light-dark(#5d6970, #a9b0ad)); font-size:10px }
|
|
151
|
+
.sctui-paste-confirm pre { overflow:hidden; margin:0; padding:7px; border-radius:5px; color:var(--volter-code-text, light-dark(#16252c, #f3f2ec)); background:var(--volter-surface-sunken, light-dark(#efeee8, #0b141a)); font:10px/1.35 var(--volter-font-data, "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace); text-overflow:ellipsis; white-space:nowrap }
|
|
152
|
+
.sctui-paste-confirm > div { display:flex; justify-content:flex-end; gap:6px }
|
|
153
|
+
.sctui-paste-confirm button { min-width:60px; padding:5px 8px; border:1px solid var(--volter-border-strong, light-dark(#c4c5bc, #3d5059)); border-radius:5px; color:var(--volter-text-primary, light-dark(#16252c, #f3f2ec)); background:var(--volter-surface-subtle, light-dark(#f2f1eb, #1d2d34)); font:600 10px/1.2 inherit; cursor:pointer }
|
|
154
|
+
.sctui-paste-confirm button:last-child { border-color:var(--volter-action-default, light-dark(#16252c, #e4f09c)); color:var(--volter-text-on-strong, light-dark(#ffffff, #16252c)); background:var(--volter-action-default, light-dark(#16252c, #e4f09c)) }
|
|
155
|
+
.sctui-terminal-empty { display:grid; height:100%; box-sizing:border-box; place-content:center; justify-items:center; gap:10px; padding:28px; color:var(--volter-text-muted, light-dark(#5d6970, #a9b0ad)); text-align:center }
|
|
156
|
+
.sctui-terminal-empty > svg { width:28px; height:28px }
|
|
157
|
+
.sctui-terminal-empty strong { max-width:280px; font-size:12px; font-weight:500; line-height:1.4 }
|
|
158
|
+
.sctui-terminal-empty button { padding:7px 12px; border:1px solid var(--volter-border-strong, light-dark(#c4c5bc, #3d5059)); border-radius:6px; color:var(--volter-text-primary, light-dark(#16252c, #f3f2ec)); background:var(--volter-surface-subtle, light-dark(#f2f1eb, #1d2d34)); font:600 11px/1 inherit; cursor:pointer }
|
|
159
|
+
.sctui-workspace > .sctui-error { position:absolute; z-index:4; top:38px; right:8px; max-width:320px; margin:0; background:var(--sctui-bg,var(--scui-bg,var(--sctui-bg-default))) }
|
|
160
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
export declare const detachPrefixByte = 2;
|
|
3
|
+
export declare const detachKeyByte = 100;
|
|
4
|
+
export type DetachFilter = {
|
|
5
|
+
feed: (chunk: Buffer | string) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function createDetachFilter(opts: {
|
|
8
|
+
key?: number;
|
|
9
|
+
onDetach: () => void;
|
|
10
|
+
onInput: (data: string) => void;
|
|
11
|
+
prefix?: number;
|
|
12
|
+
}): DetachFilter;
|
|
13
|
+
export type AttachResult = {
|
|
14
|
+
exitCode?: number;
|
|
15
|
+
reason: "detached" | "exited";
|
|
16
|
+
};
|
|
17
|
+
export type AttachStreams = {
|
|
18
|
+
stdin?: NodeJS.ReadStream;
|
|
19
|
+
stdout?: NodeJS.WritableStream & {
|
|
20
|
+
columns?: number;
|
|
21
|
+
rows?: number;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare function attachTerminal(opts: {
|
|
25
|
+
authToken?: () => string | undefined;
|
|
26
|
+
baseUrl: string;
|
|
27
|
+
streams?: AttachStreams;
|
|
28
|
+
terminalId: string;
|
|
29
|
+
}): Promise<AttachResult>;
|