Fixes #5 The Workshop page was stuck on INITIALIZING forever because: - main.js was never loaded (script tag was commented out) - No WebSocket connection logic existed - No status indicator or error handling Changes: - Add connection status HUD to world/index.html showing connection state (CONNECTING/ONLINE/OFFLINE) and agent count - Implement WebSocket connection to tower-hermes with 5s timeout - Auto-retry up to 3 times with 3s delay between attempts - Show "OFFLINE — backend unreachable" with manual retry button when all auto-retries are exhausted - Enable main.js module script Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
106 lines
2.9 KiB
HTML
106 lines
2.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>The Workshop — The Wizard's Tower</title>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
body { background: #0a0a0f; color: #e0d8c8; font-family: Georgia, serif; }
|
|
#scene {
|
|
width: 100vw;
|
|
height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
.placeholder {
|
|
text-align: center;
|
|
color: #6a6050;
|
|
}
|
|
.placeholder h1 { font-size: 1.2rem; font-weight: normal; margin-bottom: 1rem; }
|
|
.placeholder p { font-size: 0.85rem; margin-bottom: 0.5rem; }
|
|
.placeholder a { color: #8a7f6a; }
|
|
|
|
/* Connection status HUD */
|
|
#status-hud {
|
|
position: fixed;
|
|
top: 12px;
|
|
right: 12px;
|
|
background: rgba(10, 10, 15, 0.85);
|
|
border: 1px solid #2a2520;
|
|
border-radius: 6px;
|
|
padding: 8px 14px;
|
|
font-family: 'Courier New', monospace;
|
|
font-size: 0.75rem;
|
|
color: #6a6050;
|
|
z-index: 100;
|
|
min-width: 180px;
|
|
}
|
|
#status-hud .status-line {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
margin-bottom: 4px;
|
|
}
|
|
#status-hud .status-line:last-child { margin-bottom: 0; }
|
|
#status-hud .dot {
|
|
width: 8px;
|
|
height: 8px;
|
|
border-radius: 50%;
|
|
flex-shrink: 0;
|
|
}
|
|
#status-hud .dot.connecting { background: #b8860b; animation: pulse 1.2s ease-in-out infinite; }
|
|
#status-hud .dot.online { background: #4a9; }
|
|
#status-hud .dot.offline { background: #a44; }
|
|
@keyframes pulse {
|
|
0%, 100% { opacity: 1; }
|
|
50% { opacity: 0.3; }
|
|
}
|
|
#retry-btn {
|
|
display: none;
|
|
margin-top: 6px;
|
|
padding: 3px 10px;
|
|
background: #2a2520;
|
|
border: 1px solid #4a4030;
|
|
border-radius: 3px;
|
|
color: #8a7f6a;
|
|
font-family: 'Courier New', monospace;
|
|
font-size: 0.7rem;
|
|
cursor: pointer;
|
|
}
|
|
#retry-btn:hover { background: #3a3530; color: #c0b8a8; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="scene">
|
|
<div class="placeholder">
|
|
<h1>The Workshop</h1>
|
|
<p>Timmy's world is being built.</p>
|
|
<p><a href="/">← Back to the Tower</a></p>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="status-hud">
|
|
<div class="status-line">
|
|
<span class="dot connecting" id="status-dot"></span>
|
|
<span id="status-text">INITIALIZING</span>
|
|
</div>
|
|
<div class="status-line">AGENTS: <span id="agent-count">0</span></div>
|
|
<button id="retry-btn">Retry connection</button>
|
|
</div>
|
|
|
|
<!-- Reject unknown sub-paths: only /world/ is valid -->
|
|
<script>
|
|
(function() {
|
|
var path = window.location.pathname.replace(/\/+$/, '') || '/';
|
|
if (path !== '/world') {
|
|
window.location.replace('/404.html');
|
|
}
|
|
})();
|
|
</script>
|
|
<!-- Three.js scene will mount to #scene -->
|
|
<script type="module" src="main.js"></script>
|
|
</body>
|
|
</html>
|