labs-claude 0.7.0 → 0.8.0
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/package.json +1 -1
- package/src/dash.js +33 -12
- package/src/ui.js +68 -1
package/package.json
CHANGED
package/src/dash.js
CHANGED
|
@@ -7,7 +7,7 @@ const os = require('os');
|
|
|
7
7
|
const path = require('path');
|
|
8
8
|
const { LABS_DIR, saveConfig } = require('./config');
|
|
9
9
|
const { storedConfig, saveGatewayKey } = require('./gateway-client');
|
|
10
|
-
const { c, THEMES, activeTheme, gradient, visibleWidth, sparkline, randomQuip, askMasked, runSelfUpdate } = require('./ui');
|
|
10
|
+
const { c, THEMES, activeTheme, gradient, visibleWidth, sparkline, randomQuip, play3DIntro, askMasked, runSelfUpdate } = require('./ui');
|
|
11
11
|
const { version } = require('../package.json');
|
|
12
12
|
|
|
13
13
|
const DEFAULT_GATEWAY_URL = 'https://labs.instant.uz';
|
|
@@ -74,18 +74,21 @@ function renderCenteredCard(rows, cols, cardWidth = 58) {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
function renderHero(me, theme, cols) {
|
|
77
|
-
const
|
|
78
|
-
|
|
77
|
+
const art = [
|
|
78
|
+
'██╗ █████╗ ██████╗ ███████╗',
|
|
79
|
+
'██║ ██╔══██╗██╔══██╗██╔════╝',
|
|
80
|
+
'██║ ███████║██████╔╝███████╗',
|
|
81
|
+
'███████╗██║ ██║██████╔╝███████║',
|
|
82
|
+
'╚══════╝╚═╝ ╚═╝╚═════╝ ╚══════╝',
|
|
83
|
+
];
|
|
79
84
|
const name = me?.name ? `hey ${me.name}` : 'welcome to labs';
|
|
80
85
|
const boxDot = me ? (me.box_up ? c.mint('● online') : c.rose('● sleeping')) : c.dim('● offline');
|
|
81
86
|
const lines = [
|
|
82
87
|
'',
|
|
88
|
+
...art.map(row => centerLine(gradient(row, theme.from, theme.to), cols)),
|
|
89
|
+
centerLine(c.dim(`v${version} · qwen4-35b-a3b 1m`), cols),
|
|
83
90
|
'',
|
|
84
|
-
centerLine(`${
|
|
85
|
-
centerLine(logo2, cols),
|
|
86
|
-
'',
|
|
87
|
-
centerLine(`${c.bold(c.white(name))} ${c.dim('·')} ${c.cyan('Qwen4-35B-A3B 1M')} ${c.dim('·')} ${boxDot}`, cols),
|
|
88
|
-
centerLine(c.dim(randomQuip()), cols),
|
|
91
|
+
centerLine(`${c.bold(c.white(name))} ${c.dim('·')} ${boxDot} ${c.dim('·')} ${c.dim(randomQuip())}`, cols),
|
|
89
92
|
'',
|
|
90
93
|
];
|
|
91
94
|
return lines.join('\n');
|
|
@@ -122,9 +125,21 @@ async function runSettings(ask, askHidden) {
|
|
|
122
125
|
saveConfig({ ...cfg, defaultEffort: next });
|
|
123
126
|
} else if (pick === '2') {
|
|
124
127
|
const names = Object.keys(THEMES);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
if (process.stdout.isTTY) process.stdout.write('\x1b[2J\x1b[H');
|
|
129
|
+
console.log('\n' + centerLine(c.bold(c.white('pick a theme')), cols) + '\n');
|
|
130
|
+
const previewRows = names.map((n, i) => {
|
|
131
|
+
const th = THEMES[n];
|
|
132
|
+
const swatch = gradient('████████████', th.from, th.to);
|
|
133
|
+
const sample = gradient('LABS', th.from, th.to);
|
|
134
|
+
const active = n === theme.name ? c.mint(' ●') : ' ';
|
|
135
|
+
return `${c.cyan(String(i + 1))} ${c.bold(n.padEnd(8))} ${swatch} ${sample}${active}`;
|
|
136
|
+
});
|
|
137
|
+
previewRows.push('---', `${c.dim('enter number 1-5 to apply')}`);
|
|
138
|
+
console.log(renderCenteredCard(previewRows, cols, 52));
|
|
139
|
+
const t = Number(await ask('\n' + centerLine(c.dim('theme [1-5]: '), cols)));
|
|
140
|
+
if (t >= 1 && t <= names.length) {
|
|
141
|
+
saveConfig({ ...cfg, theme: names[t - 1] });
|
|
142
|
+
}
|
|
128
143
|
} else if (pick === '3') {
|
|
129
144
|
const { EXTENSION_URL, installBrowserServer } = require('./browser-setup');
|
|
130
145
|
console.log('\n' + centerLine(c.dim('extension: ') + c.cyan(EXTENSION_URL), cols));
|
|
@@ -137,12 +152,18 @@ async function runSettings(ask, askHidden) {
|
|
|
137
152
|
} else if (pick === '5') {
|
|
138
153
|
try { require('./statusline').installStatusline(); } catch { /* ignore */ }
|
|
139
154
|
} else if (pick === '6') {
|
|
140
|
-
|
|
155
|
+
console.log('\n' + centerLine(c.dim('paste new lk_ key (or press Enter / Esc to go back)'), cols));
|
|
156
|
+
const newKey = await askMasked(centerLine(c.amber('key: '), cols));
|
|
157
|
+
if (newKey && /^lk_[A-Za-z0-9_-]{20,}$/.test(newKey)) {
|
|
158
|
+
saveConfig({ ...storedConfig(), gatewayKey: newKey });
|
|
159
|
+
}
|
|
141
160
|
}
|
|
142
161
|
}
|
|
143
162
|
}
|
|
144
163
|
|
|
145
164
|
async function runDash(ask, askHidden, launchNow) {
|
|
165
|
+
const initCols = process.stdout.columns || 90;
|
|
166
|
+
await play3DIntro(initCols);
|
|
146
167
|
while (true) {
|
|
147
168
|
const cols = process.stdout.columns || 90;
|
|
148
169
|
const cfg = storedConfig();
|
package/src/ui.js
CHANGED
|
@@ -247,6 +247,11 @@ function askMasked(promptText) {
|
|
|
247
247
|
process.stdout.write('\n');
|
|
248
248
|
return resolve(value.trim());
|
|
249
249
|
}
|
|
250
|
+
if (ch === '\u001b') {
|
|
251
|
+
cleanup();
|
|
252
|
+
process.stdout.write('\n');
|
|
253
|
+
return resolve('');
|
|
254
|
+
}
|
|
250
255
|
if (ch === '\u0003') {
|
|
251
256
|
cleanup();
|
|
252
257
|
process.stdout.write('\n');
|
|
@@ -411,4 +416,66 @@ function runSelfUpdate(currentVersion) {
|
|
|
411
416
|
console.log(`\n ${c.mint('✔')} Updated to latest! Close and reopen any open labs terminals.\n`);
|
|
412
417
|
}
|
|
413
418
|
|
|
414
|
-
|
|
419
|
+
// Real-time 3D rotating neon torus/cube + matrix sparkle intro (0.9s, 24-bit RGB, zero dependencies).
|
|
420
|
+
async function play3DIntro(cols = 90) {
|
|
421
|
+
if (!USE_COLOR) return;
|
|
422
|
+
const th = activeTheme();
|
|
423
|
+
const W = 38;
|
|
424
|
+
const H = 13;
|
|
425
|
+
const padLeft = ' '.repeat(Math.max(2, Math.floor((cols - W) / 2)));
|
|
426
|
+
const shades = ' .:-=+*#%@';
|
|
427
|
+
const rainChars = '01アイウエオカキクケコ✦✧';
|
|
428
|
+
const frames = 16;
|
|
429
|
+
|
|
430
|
+
process.stdout.write('\x1b[?25l'); // hide cursor during animation
|
|
431
|
+
try {
|
|
432
|
+
for (let f = 0; f < frames; f += 1) {
|
|
433
|
+
const A = f * 0.22;
|
|
434
|
+
const B = f * 0.15;
|
|
435
|
+
const cosA = Math.cos(A), sinA = Math.sin(A);
|
|
436
|
+
const cosB = Math.cos(B), sinB = Math.sin(B);
|
|
437
|
+
const zbuf = new Float32Array(W * H);
|
|
438
|
+
const cbuf = new Array(W * H).fill(' ');
|
|
439
|
+
|
|
440
|
+
// Subtle Matrix rain sparks in background
|
|
441
|
+
for (let x = 0; x < W; x += 4) {
|
|
442
|
+
const y = (f * 2 + x * 3) % H;
|
|
443
|
+
cbuf[y * W + x] = rainChars[(f + x) % rainChars.length];
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// 3D Torus projection (classic donut math scaled for compact crisp hero)
|
|
447
|
+
for (let theta = 0; theta < 6.28; theta += 0.14) {
|
|
448
|
+
const ct = Math.cos(theta), st = Math.sin(theta);
|
|
449
|
+
for (let phi = 0; phi < 6.28; phi += 0.06) {
|
|
450
|
+
const cp = Math.cos(phi), sp = Math.sin(phi);
|
|
451
|
+
const h = ct + 2.1;
|
|
452
|
+
const D = 1 / (sp * h * sinA + st * cosA + 5.2);
|
|
453
|
+
const t = sp * h * cosA - st * sinA;
|
|
454
|
+
const x = Math.floor(W / 2 + 15 * D * (cp * h * cosB - t * sinB));
|
|
455
|
+
const y = Math.floor(H / 2 + 7.5 * D * (cp * h * sinB + t * cosB));
|
|
456
|
+
const o = x + W * y;
|
|
457
|
+
const N = Math.floor(8 * ((st * sinA - sp * ct * cosA) * cosB - sp * ct * sinA - st * cosA - cp * ct * sinB));
|
|
458
|
+
if (y >= 0 && y < H && x >= 0 && x < W && D > zbuf[o]) {
|
|
459
|
+
zbuf[o] = D;
|
|
460
|
+
cbuf[o] = shades[Math.max(1, Math.min(shades.length - 1, N))];
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
let out = '\x1b[2J\x1b[H\n\n';
|
|
466
|
+
for (let y = 0; y < H; y += 1) {
|
|
467
|
+
const row = cbuf.slice(y * W, (y + 1) * W).join('');
|
|
468
|
+
out += `${padLeft}${gradient(row, th.from, th.to)}\n`;
|
|
469
|
+
}
|
|
470
|
+
const pct = Math.round(((f + 1) / frames) * 100);
|
|
471
|
+
const bar = gradient('█'.repeat(Math.round(pct / 5)), th.from, th.to) + c.dim('░'.repeat(20 - Math.round(pct / 5)));
|
|
472
|
+
out += `\n${' '.repeat(Math.max(2, Math.floor((cols - 32) / 2)))}${bar} ${c.dim(`${pct}%`)}\n`;
|
|
473
|
+
process.stdout.write(out);
|
|
474
|
+
await sleep(52);
|
|
475
|
+
}
|
|
476
|
+
} finally {
|
|
477
|
+
process.stdout.write('\x1b[?25h'); // restore cursor
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
module.exports = { c, THEMES, activeTheme, gradient, visibleWidth, sparkline, CHILL_QUIPS, randomQuip, playMascotIntro, play3DIntro, askMasked, withSpinner, printCard, isNewerVersion, checkUpdateNotice, runSelfUpdate };
|