Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat: refactor harness login success page into a stylized HTML component

0xken152a048eb280c8
diff --git a/cli/src/cli.ts b/cli/src/cli.ts
index 142116c3a..5d9c4f941 100644
--- a/cli/src/cli.ts
+++ b/cli/src/cli.ts
@@ -36,6 +36,7 @@ import { installAmpPlugin, installCodexHooks, installCommandCodeHooks, installCu
import { PID_FILE, daemonPort, isAlive, readPid } from './lib/daemonState.js'
import { flashCommand } from './lib/flash.js'
import { readOrMintComputerId } from './lib/computerIdentity.js'
+import { renderLoginSuccessHtml } from './lib/loginPage.js'
import { AuthSessionError, AuthSessionManager, clearAuthSession, readAuthSession, writeAuthSession, type AuthSession } from './lib/authSession.js'
import { ENGINE_CLI_COMMANDS, ENGINES } from './lib/engineBin.js'
import { buildEngineLaunchArgv } from './lib/engineLaunch.js'
@@ -393,7 +394,7 @@ async function loginCommand(foreground: boolean, force: boolean, json: boolean):
res.writeHead(error || !code || !state ? 400 : 200, { 'content-type': 'text/html; charset=utf-8' })
res.end(error || !code || !state
? '<h1>Harness login failed</h1><p>You can close this window.</p>'
- : '<h1>Harness login complete</h1><p>You can close this window and return to the terminal.</p>')
+ : renderLoginSuccessHtml())
clearTimeout(timeout)
if (error) reject(new Error(`SSO login failed: ${error}`))
else if (code && state) resolve({ code, state })
diff --git a/cli/src/lib/loginPage.ts b/cli/src/lib/loginPage.ts
new file mode 100644
index 000000000..b0c4362b8
--- /dev/null
+++ b/cli/src/lib/loginPage.ts
@@ -0,0 +1,61 @@
+/** The page shown in the browser when `harness login`'s loopback SSO callback succeeds. */
+export function renderLoginSuccessHtml(): string {
+ return `<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<title>Harness</title>
+<style>
+ body {
+ margin: 0;
+ height: 100vh;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: #181818;
+ font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
+ color: #f5f5f5;
+ }
+ .card {
+ width: 340px;
+ padding: 32px 28px;
+ background: #1e1e1e;
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ border-radius: 8px;
+ text-align: center;
+ }
+ .check {
+ width: 40px;
+ height: 40px;
+ margin: 0 auto 16px;
+ border-radius: 50%;
+ background: #3fb950;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+ h1 {
+ margin: 0 0 8px;
+ font-size: 16px;
+ font-weight: 600;
+ }
+ p {
+ margin: 0;
+ font-size: 13px;
+ color: #a8a8a2;
+ }
+</style>
+</head>
+<body>
+ <div class="card">
+ <div class="check">
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none">
+ <path d="M4 10.5L8 14.5L16 6" stroke="#181818" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+ </svg>
+ </div>
+ <h1>Harness login complete</h1>
+ <p>You can close this window and return to the terminal.</p>
+ </div>
+</body>
+</html>`
+}