Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

experiment(cyclops-cs): compare Melloware React Log Viewer (#7198)

r33drichardsb04bdfe12045
diff --git a/libs/fleet/e2e/pools.spec.ts b/libs/fleet/e2e/pools.spec.ts
index fe543adab5..7178d4da24 100644
--- a/libs/fleet/e2e/pools.spec.ts
+++ b/libs/fleet/e2e/pools.spec.ts
@@ -505,6 +505,14 @@ test.describe("Pool detail instances", () => {
await expect(page.getByLabel("Guest console logs")).toContainText(
"guest console ready",
)
+ await expect(
+ page.getByRole("button", { name: "Scroll logs to top" }),
+ ).toBeEnabled()
+ await expect(
+ page.getByRole("button", { name: "Scroll logs to bottom" }),
+ ).toBeEnabled()
+ await page.getByRole("button", { name: "Scroll logs to bottom" }).click()
+ await page.getByRole("button", { name: "Scroll logs to top" }).click()
await page.getByRole("button", { name: "Copy logs" }).click()
await expect(page.getByRole("button", { name: "Copied" })).toBeVisible()
await expect
diff --git a/libs/fleet/package.json b/libs/fleet/package.json
index d0b4d54620..dc6f0b2db5 100644
--- a/libs/fleet/package.json
+++ b/libs/fleet/package.json
@@ -25,6 +25,7 @@
"@cloudscape-design/collection-hooks": "^1.0.93",
"@cloudscape-design/components": "^3.0.825",
"@cloudscape-design/global-styles": "^1.0.36",
+ "@melloware/react-logviewer": "6.5.5",
"@novnc/novnc": "^1.7.0",
"@ubjs/core": "0.31.0-3",
"ansi-to-html": "^0.7.2",
diff --git a/libs/fleet/pnpm-lock.yaml b/libs/fleet/pnpm-lock.yaml
index 4475bfe560..4b6d65d098 100644
--- a/libs/fleet/pnpm-lock.yaml
+++ b/libs/fleet/pnpm-lock.yaml
@@ -28,6 +28,9 @@ importers:
'@cua/design':
specifier: file:../packages/cua-design
version: file:../packages/cua-design
+ '@melloware/react-logviewer':
+ specifier: 6.5.5
'@modelcontextprotocol/sdk':
specifier: 1.29.0
version: 1.29.0([email protected])
@@ -646,6 +649,12 @@ packages:
'@material/[email protected]':
resolution: {integrity: sha512-ztmtTd6xwnuh2/xu+Vb01btgV8SQWYCaK56CkRK8gEkWe5TuDyBcYJ0wgkMRn+2VcE9KUmhvkz+N9GHrqw/C0g==}
+ '@melloware/[email protected]':
+ resolution: {integrity: sha512-chYodsDPIJ6pLkoQ904EOKUX65kEfFCd2n6SpMTDWmM+Bai5HTj5+FDIGD+hfKRNQMpZJpN5SPpxXMLrDuTEag==}
+ peerDependencies:
+ react: '>=17.0.0'
+ react-dom: '>=17.0.0'
+
'@mixmark-io/[email protected]':
resolution: {integrity: sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw==}
@@ -1197,6 +1206,9 @@ packages:
resolution: {integrity: sha512-kdJoFVv2xmayw6cY09H7AbMJMt8Jn5jdlEdXsP7AGBdF2DIptVlKlOLKXP41yPip4/a3yQPv9gVcJYI8YY04dw==}
engines: {node: '>=16.9.0'}
+ resolution: {integrity: sha512-hseNiqaskxSnujuGp8aRMLJfcjaFiTSS0I2GQhqru82N/sx6CGyUf6pvU5X1iycvw2EqmvILkFIb5OzYFXY+9A==}
+
resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==}
engines: {node: '>= 0.8'}
@@ -1208,6 +1220,9 @@ packages:
resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==}
+ resolution: {integrity: sha512-t7xcm2siw+hlUM68I+UEOK+z84RzmN59as9DZ7P1l0994DKUWV7UXBMQZVxaoMSRQ+PBZbHCOoBt7a2wxOMt+A==}
+
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
@@ -1321,6 +1336,9 @@ packages:
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
+ resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==}
+
resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==}
@@ -1499,6 +1517,9 @@ packages:
peerDependencies:
react: '>=16.8'
+ resolution: {integrity: sha512-J7y/IxZkwhOgCexu6GtkNH2FIa9f/z6ykvK1YXS8VLIdvcP8Vyx3LAUFsfIFvq3aQbmin2d+clFR1J50LnR2yA==}
+
resolution: {integrity: sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==}
peerDependencies:
@@ -1691,6 +1712,26 @@ packages:
resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==}
engines: {node: '>= 0.8'}
+ resolution: {integrity: sha512-6f79msqg3jzNFdqJiS0FSzhRN1EHlDhR7EvW7emp6z5qQ22VdsReiDHflkpMEMhoAyUuYr69nwT0aagiM7NrUg==}
+ peerDependencies:
+ react: '>=16.14.0'
+ react-dom: '>=16.14.0'
+ solid-js: '>=1.0'
+ svelte: '>=5.0'
+ vue: '>=3.2'
+ peerDependenciesMeta:
+ react:
+ optional: true
+ react-dom:
+ optional: true
+ solid-js:
+ optional: true
+ svelte:
+ optional: true
+ vue:
+ optional: true
+
resolution: {integrity: sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==}
engines: {node: ^18.0.0 || >=20.0.0}
@@ -2206,6 +2247,20 @@ snapshots:
'@material/[email protected]': {}
+ dependencies:
+ hotkeys-js: 4.0.4
+ immutable: 5.1.5
+ mitt: 3.0.1
+ react: 18.3.1
+ react-dom: 18.3.1([email protected])
+ react-string-replace: 2.0.1
+ transitivePeerDependencies:
+ - solid-js
+ - svelte
+ - vue
+
'@mixmark-io/[email protected]': {}
'@modelcontextprotocol/[email protected]([email protected])':
@@ -2778,6 +2833,8 @@ snapshots:
+
dependencies:
depd: 2.0.0
@@ -2792,6 +2849,8 @@ snapshots:
+
@@ -2897,6 +2956,8 @@ snapshots:
optional: true
+
optional: true
@@ -3076,6 +3137,8 @@ snapshots:
'@remix-run/router': 1.23.2
react: 18.3.1
+
dependencies:
'@babel/runtime': 7.29.2
@@ -3325,6 +3388,11 @@ snapshots:
+ optionalDependencies:
+ react: 18.3.1
+ react-dom: 18.3.1([email protected])
+
dependencies:
esbuild: 0.21.5
diff --git a/libs/fleet/src/pages/InstanceDetail.tsx b/libs/fleet/src/pages/InstanceDetail.tsx
index 8ccae08fd8..ae5d32a207 100644
--- a/libs/fleet/src/pages/InstanceDetail.tsx
+++ b/libs/fleet/src/pages/InstanceDetail.tsx
@@ -5,6 +5,7 @@ import Header from "@cloudscape-design/components/header"
import SpaceBetween from "@cloudscape-design/components/space-between"
import StatusIndicator from "@cloudscape-design/components/status-indicator"
import Toggle from "@cloudscape-design/components/toggle"
+import { LazyLog } from "@melloware/react-logviewer"
import { CuaButton } from "../components/CuaButton"
import { useFlash } from "../components/FlashContext"
import { PageEmpty, PageError } from "../components/PageState"
@@ -54,6 +55,7 @@ export function InstanceDetail() {
const [lastRefreshed, setLastRefreshed] = useState<Date | null>(null)
const logRequestRef = useRef(0)
const copyResetRef = useRef<number | null>(null)
+ const logViewerRef = useRef<LazyLog | null>(null)
const loadInstance = useCallback(async () => {
setLoading(true)
@@ -132,6 +134,15 @@ export function InstanceDetail() {
}
}
+ const scrollLogsToTop = () => {
+ logViewerRef.current?.handleScrollToLine(1)
+ }
+
+ const scrollLogsToBottom = () => {
+ const lineCount = logs ? logs.split(/\r?\n/).length : 1
+ logViewerRef.current?.handleScrollToLine(lineCount)
+ }
+
if (loading && !instance) {
return (
<PageShell eyebrow="Fleet / Pool / Instance" title={instanceName || "Instance"}>
@@ -194,6 +205,20 @@ export function InstanceDetail() {
>
Auto-refresh
</Toggle>
+ <CuaButton
+ tone="icon"
+ ariaLabel="Scroll logs to top"
+ iconName="angle-up"
+ disabled={!logs}
+ onClick={scrollLogsToTop}
+ />
+ <CuaButton
+ tone="icon"
+ ariaLabel="Scroll logs to bottom"
+ iconName="angle-down"
+ disabled={!logs}
+ onClick={scrollLogsToBottom}
+ />
<CuaButton
iconName="copy"
disabled={!logs}
@@ -231,9 +256,20 @@ export function InstanceDetail() {
<PageEmpty title="Loading guest console logs…" />
) : (
<section aria-label="Guest console logs">
- <pre className="cua-instance-log-view">
- {logs || "No guest console output."}
- </pre>
+ <div className="cua-instance-log-view">
+ <LazyLog
+ ref={logViewerRef}
+ className="cua-instance-log-lines"
+ searchBarClassName="cua-instance-log-search"
+ text={logs || "No guest console output."}
+ enableLineNumbers
+ enableSearch
+ selectableLines
+ wrapLines
+ height="auto"
+ rowHeight={20}
+ />
+ </div>
</section>
)}
</Container>
diff --git a/libs/fleet/src/shell.css b/libs/fleet/src/shell.css
index 52abd96266..2126105c07 100644
--- a/libs/fleet/src/shell.css
+++ b/libs/fleet/src/shell.css
@@ -138,23 +138,60 @@ body,
.cua-instance-log-view {
box-sizing: border-box;
- min-height: 360px;
- max-height: 65vh;
- margin: 0;
- padding: 18px 20px;
- overflow: auto;
+ height: clamp(360px, 60vh, 720px);
+ overflow: hidden;
border: 1px solid var(--cua-color-border-subtle, rgba(255, 255, 255, 0.12));
border-radius: var(--cua-radius-control);
background:
linear-gradient(180deg, rgba(159, 215, 255, 0.035), transparent 72px),
#0a0d10;
+}
+
+#cua-dashboard-root .cua-instance-log-lines {
+ box-sizing: border-box;
+ padding: 12px 0;
+ background: transparent;
color: #d9e4ec;
font-family: var(--cua-dashboard-font-mono, monospace);
font-size: 12px;
- line-height: 1.65;
tab-size: 2;
- white-space: pre-wrap;
- overflow-wrap: anywhere;
+}
+
+#cua-dashboard-root .cua-instance-log-lines .log-line {
+ padding: 0 16px;
+}
+
+#cua-dashboard-root .cua-instance-log-lines .log-line:hover {
+ background: rgba(159, 215, 255, 0.055);
+}
+
+#cua-dashboard-root .cua-instance-log-search {
+ box-sizing: border-box;
+ min-height: 44px;
+ padding: 8px 12px;
+ border-bottom: 1px solid var(--cua-color-border-subtle, rgba(255, 255, 255, 0.12));
+ background: rgba(255, 255, 255, 0.025);
+ color: #d9e4ec;
+ font-family: var(--cua-dashboard-font-mono, monospace);
+}
+
+#cua-dashboard-root .cua-instance-log-search input {
+ min-width: min(280px, 45vw);
+ border: 1px solid rgba(255, 255, 255, 0.16);
+ border-radius: 6px;
+ background: #11161b;
+ color: #f6f8fb;
+ font-family: inherit;
+}
+
+#cua-dashboard-root .cua-instance-log-search input:focus {
+ border-color: #9fd7ff;
+ outline: 2px solid rgba(159, 215, 255, 0.22);
+ outline-offset: 1px;
+}
+
+#cua-dashboard-root .cua-instance-log-search button {
+ color: #d9e4ec;
}
#cua-dashboard-root .cua-dashboard-button button {