Files
openwork/ee/apps/den-controller/public/index.html
Omar McAdam 2b91b4d777 refactor: repo folder structure (#1038)
* refactor(repo): move OpenWork apps into apps and ee layout

Rebase the monorepo layout migration onto the latest dev changes so the moved app, desktop, share, and cloud surfaces keep working from their new paths. Carry the latest deeplink, token persistence, build, Vercel, and docs updates forward to avoid stale references and broken deploy tooling.

* chore(repo): drop generated desktop artifacts

Ignore the moved Tauri target and sidecar paths so local cargo checks do not pollute the branch. Remove the accidentally committed outputs from the repo while keeping the layout migration intact.

* fix(release): drop built server cli artifact

Stop tracking the locally built apps/server/cli binary so generated server outputs do not leak into commits. Also update the release workflow to check the published scoped package name for @openwork/server before deciding whether npm publish is needed.

* fix(workspace): add stable CLI bin wrappers

Point the server and router package bins at committed wrapper scripts so workspace installs can create shims before dist outputs exist. Keep the wrappers compatible with built binaries and source checkouts to avoid Vercel install warnings without changing runtime behavior.
2026-03-19 11:41:38 -07:00

249 lines
6.9 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Den Control Plane</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 24px;
background: #f8fafc;
color: #0f172a;
}
h1 {
margin-top: 0;
}
.grid {
display: grid;
gap: 12px;
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.card {
background: #fff;
border: 1px solid #cbd5e1;
border-radius: 8px;
padding: 16px;
}
label {
display: block;
margin-top: 8px;
font-size: 13px;
font-weight: 600;
}
input,
select {
width: 100%;
box-sizing: border-box;
margin-top: 4px;
border: 1px solid #cbd5e1;
border-radius: 6px;
padding: 8px;
}
button {
margin-top: 10px;
border: 0;
border-radius: 6px;
padding: 8px 10px;
background: #1d4ed8;
color: #fff;
cursor: pointer;
}
pre {
white-space: pre-wrap;
word-break: break-word;
background: #0f172a;
color: #f8fafc;
border-radius: 6px;
padding: 10px;
min-height: 90px;
}
.muted {
color: #475569;
font-size: 13px;
}
</style>
</head>
<body>
<h1>Den Control Plane Demo</h1>
<p class="muted">Sign up, verify auth, and launch a cloud worker end-to-end.</p>
<div class="grid">
<section class="card">
<h2>1) Sign up</h2>
<label>
Name
<input id="signup-name" value="Den Demo" />
</label>
<label>
Email
<input id="signup-email" placeholder="demo@example.com" />
</label>
<label>
Password
<input id="signup-password" type="password" value="TestPass123!" />
</label>
<button id="signup-button" type="button">Create account</button>
</section>
<section class="card">
<h2>2) Verify auth/session</h2>
<button id="me-button" type="button">GET /v1/me (cookie session)</button>
<button id="me-bearer-button" type="button">GET /v1/me (Bearer token)</button>
<p class="muted">Bearer token comes from sign-up/sign-in response.</p>
</section>
<section class="card">
<h2>3) Launch worker</h2>
<label>
Name
<input id="worker-name" value="web-flow-worker" />
</label>
<label>
Destination
<select id="worker-destination">
<option value="cloud" selected>cloud</option>
<option value="local">local</option>
</select>
</label>
<label>
Workspace path (required for local)
<input id="worker-workspace-path" value="/tmp/workspace" />
</label>
<button id="worker-button" type="button">POST /v1/workers</button>
</section>
</div>
<section class="card" style="margin-top: 12px">
<h2>Output</h2>
<pre id="output">ready</pre>
</section>
<script>
const output = document.getElementById("output")
let bearerToken = ""
const print = (value) => {
output.textContent = typeof value === "string" ? value : JSON.stringify(value, null, 2)
}
const redact = (value) => {
const clone = typeof value === "string" ? value : JSON.parse(JSON.stringify(value))
if (typeof clone === "string") {
return clone
}
if (clone?.body?.token) {
clone.body.token = "REDACTED_SESSION_TOKEN"
}
if (clone?.body?.session?.token) {
clone.body.session.token = "REDACTED_SESSION_TOKEN"
}
if (clone?.body?.session?.id) {
clone.body.session.id = "REDACTED_SESSION_ID"
}
if (clone?.body?.session?.ipAddress) {
clone.body.session.ipAddress = "REDACTED_IP"
}
if (clone?.body?.tokens?.host) {
clone.body.tokens.host = "REDACTED_HOST_TOKEN"
}
if (clone?.body?.tokens?.client) {
clone.body.tokens.client = "REDACTED_CLIENT_TOKEN"
}
return clone
}
const request = async (path, options = {}) => {
const response = await fetch(path, {
credentials: "include",
headers: {
"Content-Type": "application/json",
...(options.headers || {}),
},
...options,
})
let body = null
const text = await response.text()
if (text) {
try {
body = JSON.parse(text)
} catch {
body = text
}
}
return { status: response.status, body }
}
document.getElementById("signup-button").addEventListener("click", async () => {
const emailInput = document.getElementById("signup-email")
if (!emailInput.value) {
emailInput.value = `den-web-${Date.now()}@example.com`
}
const result = await request("/api/auth/sign-up/email", {
method: "POST",
body: JSON.stringify({
name: document.getElementById("signup-name").value,
email: emailInput.value,
password: document.getElementById("signup-password").value,
}),
})
bearerToken = result.body?.token || ""
print(redact({ step: "signup", ...result, bearerTokenPresent: Boolean(bearerToken) }))
})
document.getElementById("me-button").addEventListener("click", async () => {
const result = await request("/v1/me", { method: "GET", headers: {} })
print(redact({ step: "me-cookie", ...result }))
})
document.getElementById("me-bearer-button").addEventListener("click", async () => {
if (!bearerToken) {
print({ error: "missing_bearer_token", hint: "Sign up first to capture token." })
return
}
const result = await request("/v1/me", {
method: "GET",
headers: {
Authorization: `Bearer ${bearerToken}`,
},
})
print(redact({ step: "me-bearer", ...result }))
})
document.getElementById("worker-button").addEventListener("click", async () => {
const destination = document.getElementById("worker-destination").value
const payload = {
name: document.getElementById("worker-name").value,
destination,
workspacePath: document.getElementById("worker-workspace-path").value || undefined,
imageVersion: "den-worker-v1",
}
if (destination !== "local") {
delete payload.workspacePath
}
const result = await request("/v1/workers", {
method: "POST",
body: JSON.stringify(payload),
})
print(redact({ step: "create-worker", payload, ...result }))
})
</script>
</body>
</html>