@adhdev/daemon-standalone 0.9.82-rc.99 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/public/index.html CHANGED
@@ -7,9 +7,9 @@
7
7
  <meta name="description" content="ADHDev self-hosted dashboard for controlling AI agents" />
8
8
  <link rel="icon" href="/otter-logo.png" />
9
9
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet" />
10
- <script type="module" crossorigin src="/assets/index-DaIkPFUd.js"></script>
11
- <link rel="modulepreload" crossorigin href="/assets/vendor-CgiI0UIA.js">
12
- <link rel="stylesheet" crossorigin href="/assets/index-Bso1b8Lh.css">
10
+ <script type="module" crossorigin src="/assets/index-EYZP2Wbo.js"></script>
11
+ <link rel="modulepreload" crossorigin href="/assets/vendor-DyCWA2YZ.js">
12
+ <link rel="stylesheet" crossorigin href="/assets/index-p-ehiI_L.css">
13
13
  </head>
14
14
  <body>
15
15
  <!-- Apply theme immediately to prevent FOIT (Flash of Incorrect Theme) -->
@@ -0,0 +1,229 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Snake</title>
7
+ <style>
8
+ * { box-sizing: border-box; margin: 0; padding: 0; }
9
+ body {
10
+ background: #0d1117;
11
+ color: #e6edf3;
12
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
13
+ display: flex;
14
+ flex-direction: column;
15
+ align-items: center;
16
+ justify-content: center;
17
+ min-height: 100vh;
18
+ gap: 16px;
19
+ }
20
+ h1 { font-size: 1.4rem; letter-spacing: 0.1em; color: #7ee787; }
21
+ #info { display: flex; gap: 24px; font-size: 0.9rem; color: #8b949e; }
22
+ #info span b { color: #e6edf3; }
23
+ canvas {
24
+ border: 2px solid #30363d;
25
+ border-radius: 6px;
26
+ background: #161b22;
27
+ display: block;
28
+ }
29
+ #msg {
30
+ font-size: 0.85rem;
31
+ color: #8b949e;
32
+ min-height: 1.2em;
33
+ text-align: center;
34
+ }
35
+ #msg.over { color: #f85149; }
36
+ #controls { font-size: 0.75rem; color: #6e7681; text-align: center; }
37
+ </style>
38
+ </head>
39
+ <body>
40
+ <h1>🐍 Snake</h1>
41
+ <div id="info">
42
+ <span>Score: <b id="score">0</b></span>
43
+ <span>High: <b id="high">0</b></span>
44
+ <span>Level: <b id="level">1</b></span>
45
+ </div>
46
+ <canvas id="c" width="400" height="400"></canvas>
47
+ <div id="msg">Press Enter or Space to start</div>
48
+ <div id="controls">Arrow keys / WASD to move &nbsp;·&nbsp; P to pause</div>
49
+
50
+ <script>
51
+ const CELL = 20;
52
+ const COLS = 20;
53
+ const ROWS = 20;
54
+ const canvas = document.getElementById('c');
55
+ const ctx = canvas.getContext('2d');
56
+ const scoreEl = document.getElementById('score');
57
+ const highEl = document.getElementById('high');
58
+ const levelEl = document.getElementById('level');
59
+ const msgEl = document.getElementById('msg');
60
+
61
+ let snake, dir, nextDir, food, score, highScore, state, tick, loop;
62
+ // state: 'idle' | 'running' | 'paused' | 'over'
63
+
64
+ function rand(n) { return Math.floor(Math.random() * n); }
65
+
66
+ function spawnFood() {
67
+ const occupied = new Set(snake.map(([x, y]) => `${x},${y}`));
68
+ let x, y;
69
+ do { x = rand(COLS); y = rand(ROWS); } while (occupied.has(`${x},${y}`));
70
+ return [x, y];
71
+ }
72
+
73
+ function init() {
74
+ snake = [[10, 10], [9, 10], [8, 10]];
75
+ dir = [1, 0];
76
+ nextDir = [1, 0];
77
+ food = spawnFood();
78
+ score = 0;
79
+ tick = 0;
80
+ scoreEl.textContent = '0';
81
+ levelEl.textContent = '1';
82
+ msgEl.textContent = '';
83
+ msgEl.className = '';
84
+ state = 'running';
85
+ if (loop) clearInterval(loop);
86
+ loop = setInterval(step, 150);
87
+ }
88
+
89
+ function level() { return 1 + Math.floor(score / 5); }
90
+ function speed() { return Math.max(80, 150 - (level() - 1) * 10); }
91
+
92
+ function step() {
93
+ if (state !== 'running') return;
94
+ tick++;
95
+ // Adjust speed by resetting interval on level-up
96
+ const newSpeed = speed();
97
+ if (tick % 5 === 0) {
98
+ clearInterval(loop);
99
+ loop = setInterval(step, newSpeed);
100
+ }
101
+
102
+ dir = nextDir;
103
+ const head = [snake[0][0] + dir[0], snake[0][1] + dir[1]];
104
+
105
+ // Wall collision
106
+ if (head[0] < 0 || head[0] >= COLS || head[1] < 0 || head[1] >= ROWS) {
107
+ return gameOver();
108
+ }
109
+ // Self collision
110
+ if (snake.some(([x, y]) => x === head[0] && y === head[1])) {
111
+ return gameOver();
112
+ }
113
+
114
+ snake.unshift(head);
115
+
116
+ if (head[0] === food[0] && head[1] === food[1]) {
117
+ score++;
118
+ scoreEl.textContent = score;
119
+ levelEl.textContent = level();
120
+ if (score > highScore) { highScore = score; highEl.textContent = highScore; }
121
+ food = spawnFood();
122
+ } else {
123
+ snake.pop();
124
+ }
125
+
126
+ draw();
127
+ }
128
+
129
+ function gameOver() {
130
+ state = 'over';
131
+ clearInterval(loop);
132
+ msgEl.textContent = `Game over! Score: ${score} · Press Enter to restart`;
133
+ msgEl.className = 'over';
134
+ draw();
135
+ }
136
+
137
+ function draw() {
138
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
139
+
140
+ // Grid lines (subtle)
141
+ ctx.strokeStyle = '#1c2128';
142
+ ctx.lineWidth = 0.5;
143
+ for (let i = 0; i <= COLS; i++) {
144
+ ctx.beginPath(); ctx.moveTo(i * CELL, 0); ctx.lineTo(i * CELL, canvas.height); ctx.stroke();
145
+ }
146
+ for (let j = 0; j <= ROWS; j++) {
147
+ ctx.beginPath(); ctx.moveTo(0, j * CELL); ctx.lineTo(canvas.width, j * CELL); ctx.stroke();
148
+ }
149
+
150
+ // Food
151
+ ctx.fillStyle = '#f85149';
152
+ ctx.beginPath();
153
+ ctx.arc(food[0] * CELL + CELL / 2, food[1] * CELL + CELL / 2, CELL / 2 - 2, 0, Math.PI * 2);
154
+ ctx.fill();
155
+
156
+ // Snake
157
+ snake.forEach(([x, y], i) => {
158
+ const t = i / Math.max(1, snake.length - 1);
159
+ // Head: bright green; tail: darker
160
+ const g = Math.round(100 + (1 - t) * 131);
161
+ ctx.fillStyle = i === 0 ? '#7ee787' : `rgb(30, ${g}, 50)`;
162
+ ctx.beginPath();
163
+ ctx.roundRect(x * CELL + 1, y * CELL + 1, CELL - 2, CELL - 2, 3);
164
+ ctx.fill();
165
+ });
166
+
167
+ // Eyes on head
168
+ const [hx, hy] = snake[0];
169
+ ctx.fillStyle = '#0d1117';
170
+ const ex = dir[0] === 1 ? 0.65 : dir[0] === -1 ? 0.2 : 0.3;
171
+ const ey = dir[1] === 1 ? 0.65 : dir[1] === -1 ? 0.2 : 0.3;
172
+ const ex2 = dir[1] !== 0 ? 0.6 : ex;
173
+ ctx.beginPath();
174
+ ctx.arc(hx * CELL + ex * CELL, hy * CELL + ey * CELL, 2, 0, Math.PI * 2);
175
+ ctx.arc(hx * CELL + ex2 * CELL, hy * CELL + (dir[1] !== 0 ? ey : 1 - ey) * CELL, 2, 0, Math.PI * 2);
176
+ ctx.fill();
177
+
178
+ // Pause overlay
179
+ if (state === 'paused') {
180
+ ctx.fillStyle = 'rgba(13,17,23,0.6)';
181
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
182
+ ctx.fillStyle = '#e6edf3';
183
+ ctx.font = 'bold 28px monospace';
184
+ ctx.textAlign = 'center';
185
+ ctx.fillText('PAUSED', canvas.width / 2, canvas.height / 2);
186
+ ctx.textAlign = 'left';
187
+ }
188
+ }
189
+
190
+ document.addEventListener('keydown', (e) => {
191
+ const key = e.key;
192
+
193
+ if ((key === 'Enter' || key === ' ') && (state === 'idle' || state === 'over')) {
194
+ e.preventDefault();
195
+ init();
196
+ return;
197
+ }
198
+
199
+ if (key === 'p' || key === 'P') {
200
+ if (state === 'running') { state = 'paused'; msgEl.textContent = 'Paused · P to resume'; draw(); }
201
+ else if (state === 'paused') { state = 'running'; msgEl.textContent = ''; }
202
+ return;
203
+ }
204
+
205
+ if (state !== 'running' && state !== 'paused') return;
206
+
207
+ const moves = {
208
+ ArrowUp: [0, -1], ArrowDown: [0, 1], ArrowLeft: [-1, 0], ArrowRight: [1, 0],
209
+ w: [0, -1], s: [0, 1], a: [-1, 0], d: [1, 0],
210
+ W: [0, -1], S: [0, 1], A: [-1, 0], D: [1, 0],
211
+ };
212
+ const m = moves[key];
213
+ if (m) {
214
+ e.preventDefault();
215
+ // Prevent reversing
216
+ if (m[0] + dir[0] !== 0 || m[1] + dir[1] !== 0) nextDir = m;
217
+ }
218
+ });
219
+
220
+ highScore = 0;
221
+ state = 'idle';
222
+ // Draw empty board
223
+ snake = [[10, 10], [9, 10], [8, 10]];
224
+ dir = [1, 0];
225
+ food = [15, 10];
226
+ draw();
227
+ </script>
228
+ </body>
229
+ </html>