Files
timmy-tower/the-matrix/index.html

279 lines
11 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Timmy Tower World</title>
<link rel="manifest" href="/tower/manifest.json" />
<meta name="theme-color" content="#00ff41" />
<!-- iOS PWA -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-mobile-web-app-title" content="Timmy Tower World" />
<link rel="apple-touch-icon" href="/tower/icons/icon-192.png" />
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #000; overflow: hidden; font-family: 'Courier New', monospace; }
canvas { display: block; }
/* ── HUD ──────────────────────────────────────────────────────────────── */
#ui-overlay {
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
pointer-events: none; z-index: 10;
}
#hud {
position: fixed; top: 16px; left: 16px;
color: #00ff41; font-size: 12px; line-height: 1.6;
text-shadow: 0 0 8px #00ff41;
pointer-events: none;
}
#hud h1 { font-size: 16px; letter-spacing: 4px; margin-bottom: 8px; color: #00ff88; }
#status-panel {
position: fixed; top: 16px; right: 16px;
color: #00ff41; font-size: 11px; line-height: 1.8;
text-shadow: 0 0 6px #00ff41; max-width: 240px;
}
#chat-panel {
position: fixed; bottom: 56px; left: 16px;
width: 320px; max-height: 160px; overflow-y: auto;
color: #00ff41; font-size: 11px; line-height: 1.6;
text-shadow: 0 0 4px #00ff41;
pointer-events: none;
}
.chat-entry { opacity: 0.85; }
.chat-entry .agent-name { color: #00ff88; font-weight: bold; }
.chat-ts { color: #004d18; font-size: 10px; }
#connection-status {
position: fixed; bottom: 16px; right: 16px;
font-size: 11px; color: #555;
pointer-events: none;
}
#connection-status.connected { color: #00ff41; text-shadow: 0 0 6px #00ff41; }
#chat-clear-btn {
position: fixed; bottom: 16px; right: 110px;
font-family: 'Courier New', monospace;
font-size: 10px; color: #004d18;
background: transparent; border: 1px solid #004d18;
padding: 2px 6px; cursor: pointer;
pointer-events: all; z-index: 20;
transition: color 0.2s, border-color 0.2s;
}
#chat-clear-btn:hover { color: #00ff41; border-color: #00ff41; }
/* WebGL context-loss recovery overlay */
#webgl-recovery-overlay {
display: none;
position: fixed; inset: 0; z-index: 200;
background: rgba(0, 0, 0, 0.88);
justify-content: center; align-items: center;
pointer-events: none;
}
#webgl-recovery-overlay .recovery-text {
color: #00ff41; font-family: 'Courier New', monospace;
font-size: 16px; letter-spacing: 3px;
text-shadow: 0 0 18px #00ff41, 0 0 6px #00ff41;
animation: ctx-blink 1.2s step-end infinite;
}
@keyframes ctx-blink {
0%, 100% { opacity: 1; }
50% { opacity: 0.25; }
}
/* ── Open panel button ────────────────────────────────────────────────── */
#open-panel-btn {
position: fixed; bottom: 16px; left: 16px;
font-family: 'Courier New', monospace; font-size: 12px; font-weight: bold;
color: #000; background: #00ff88; border: none;
padding: 8px 18px; cursor: pointer; z-index: 20; letter-spacing: 2px;
box-shadow: 0 0 16px #00ff88, 0 0 4px #00ff41;
transition: background 0.15s, box-shadow 0.15s;
}
#open-panel-btn:hover {
background: #00ffcc;
box-shadow: 0 0 24px #00ffcc, 0 0 8px #00ff88;
}
/* ── Payment panel ────────────────────────────────────────────────────── */
#payment-panel {
position: fixed; top: 0; right: -420px;
width: 400px; height: 100%;
background: rgba(0, 4, 0, 0.95);
border-left: 1px solid #004d18;
padding: 24px 20px;
overflow-y: auto; z-index: 100;
font-family: 'Courier New', monospace;
transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: -8px 0 32px rgba(0,255,65,0.1);
}
#payment-panel.open { right: 0; }
#payment-panel h2 {
font-size: 14px; letter-spacing: 4px; color: #00ff88;
text-shadow: 0 0 12px #00ff88;
margin-bottom: 20px; border-bottom: 1px solid #004d18; padding-bottom: 10px;
}
#payment-close {
position: absolute; top: 16px; right: 16px;
background: transparent; border: 1px solid #004d18;
color: #004d18; font-family: 'Courier New', monospace;
font-size: 16px; width: 28px; height: 28px;
cursor: pointer; transition: color 0.2s, border-color 0.2s;
}
#payment-close:hover { color: #00ff41; border-color: #00ff41; }
.panel-label {
font-size: 10px; letter-spacing: 2px; color: #007722;
margin-bottom: 6px; margin-top: 16px;
}
#job-input {
width: 100%; background: #000d00; border: 1px solid #004d18;
color: #00ff41; font-family: 'Courier New', monospace; font-size: 12px;
padding: 10px; resize: vertical; min-height: 90px;
outline: none; transition: border-color 0.2s;
}
#job-input:focus { border-color: #00ff88; }
#job-input::placeholder { color: #004d18; }
.panel-btn {
width: 100%; margin-top: 12px;
background: transparent; border: 1px solid #00ff41;
color: #00ff41; font-family: 'Courier New', monospace;
font-size: 12px; letter-spacing: 2px; padding: 10px;
cursor: pointer; transition: all 0.2s;
}
.panel-btn:hover:not(:disabled) {
background: #00ff41; color: #000; box-shadow: 0 0 16px #00ff41;
}
.panel-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.panel-btn.primary {
border-color: #00ff88; color: #00ff88;
}
.panel-btn.primary:hover:not(:disabled) {
background: #00ff88; color: #000; box-shadow: 0 0 20px #00ff88;
}
.panel-btn.danger {
border-color: #ff6600; color: #ff6600;
}
#job-status { font-size: 11px; margin-top: 8px; color: #00ff41; min-height: 16px; }
#job-error { font-size: 11px; margin-top: 4px; min-height: 16px; }
.invoice-box {
background: #000d00; border: 1px solid #004d18;
padding: 10px; margin-top: 8px;
font-size: 10px; color: #007722;
word-break: break-all; max-height: 80px; overflow-y: auto;
}
.copy-row { display: flex; gap: 8px; margin-top: 6px; align-items: stretch; }
.copy-row .invoice-box { flex: 1; margin-top: 0; }
.copy-btn {
background: transparent; border: 1px solid #004d18; color: #004d18;
font-family: 'Courier New', monospace; font-size: 10px; letter-spacing: 1px;
padding: 0 10px; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.copy-btn:hover { border-color: #00ff41; color: #00ff41; }
.amount-tag {
display: inline-block; background: #001a00;
border: 1px solid #007722; color: #00ff88;
font-size: 16px; font-weight: bold; letter-spacing: 2px;
padding: 6px 14px; margin-top: 8px;
text-shadow: 0 0 8px #00ff88;
}
#job-result {
background: #000d00; border: 1px solid #004d18;
color: #00ff41; padding: 12px; font-size: 12px;
line-height: 1.6; margin-top: 8px;
white-space: pre-wrap; max-height: 260px; overflow-y: auto;
}
/* api-ui link */
.panel-link {
display: block; text-align: center; margin-top: 20px;
font-size: 10px; letter-spacing: 1px; color: #004d18;
text-decoration: none; transition: color 0.2s;
}
.panel-link:hover { color: #00ff41; }
</style>
</head>
<body>
<div id="ui-overlay">
<div id="hud">
<h1>TIMMY TOWER WORLD</h1>
<div id="agent-count">AGENTS: 0</div>
<div id="active-jobs">JOBS: 0</div>
<div id="fps">FPS: --</div>
</div>
<div id="status-panel">
<div id="agent-list"></div>
</div>
<div id="chat-panel"></div>
<div id="connection-status">OFFLINE</div>
</div>
<button id="open-panel-btn">⚡ SUBMIT JOB</button>
<button id="chat-clear-btn" title="Clear chat history">CLEAR</button>
<!-- ── Payment panel ──────────────────────────────────────────────────── -->
<div id="payment-panel">
<button id="payment-close"></button>
<h2>⚡ TIMMY TOWER — JOB SUBMISSION</h2>
<!-- Step: input -->
<div data-step="input">
<div class="panel-label">YOUR REQUEST</div>
<textarea id="job-input" maxlength="500"
placeholder="Ask Timmy anything… (max 500 chars)"></textarea>
<button class="panel-btn primary" id="job-submit-btn">CREATE JOB →</button>
<a class="panel-link" href="/api/ui" target="_blank">Open full UI ↗</a>
</div>
<!-- Step: eval invoice -->
<div data-step="eval-invoice" style="display:none">
<div class="panel-label">EVAL FEE</div>
<div class="amount-tag" id="eval-amount">10 sats</div>
<div class="panel-label" style="margin-top:12px">LIGHTNING INVOICE</div>
<div class="copy-row">
<div class="invoice-box" id="eval-payment-request"></div>
<button class="copy-btn" onclick="_timmyCopy('eval-payment-request')">COPY</button>
</div>
<span id="eval-hash" data-hash=""></span>
<button class="panel-btn primary" id="pay-eval-btn">⚡ SIMULATE PAYMENT</button>
</div>
<!-- Step: work invoice -->
<div data-step="work-invoice" style="display:none">
<div class="panel-label">WORK FEE (token-based)</div>
<div class="amount-tag" id="work-amount">-- sats</div>
<div class="panel-label" style="margin-top:12px">LIGHTNING INVOICE</div>
<div class="copy-row">
<div class="invoice-box" id="work-payment-request"></div>
<button class="copy-btn" onclick="_timmyCopy('work-payment-request')">COPY</button>
</div>
<span id="work-hash" data-hash=""></span>
<button class="panel-btn primary" id="pay-work-btn">⚡ SIMULATE PAYMENT</button>
</div>
<!-- Step: result -->
<div data-step="result" style="display:none">
<div class="panel-label" id="result-label">AI RESULT</div>
<pre id="job-result"></pre>
<button class="panel-btn" id="new-job-btn" style="margin-top:16px">← NEW JOB</button>
</div>
<!-- Shared status / error (outside steps so always visible) -->
<div id="job-status" style="font-size:11px;margin-top:12px;min-height:16px;"></div>
<div id="job-error" style="font-size:11px;margin-top:4px;min-height:16px;"></div>
</div>
<div id="webgl-recovery-overlay">
<span class="recovery-text">GPU context lost — recovering...</span>
</div>
<script type="module" src="./js/main.js"></script>
</body>
</html>