labs-claude 0.7.1 → 0.8.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/package.json +1 -1
- package/src/dash.js +13 -8
- package/src/statusline.js +69 -12
- package/src/ui.js +63 -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');
|
|
@@ -159,6 +162,8 @@ async function runSettings(ask, askHidden) {
|
|
|
159
162
|
}
|
|
160
163
|
|
|
161
164
|
async function runDash(ask, askHidden, launchNow) {
|
|
165
|
+
const initCols = process.stdout.columns || 90;
|
|
166
|
+
await play3DIntro(initCols);
|
|
162
167
|
while (true) {
|
|
163
168
|
const cols = process.stdout.columns || 90;
|
|
164
169
|
const cfg = storedConfig();
|
package/src/statusline.js
CHANGED
|
@@ -1,39 +1,96 @@
|
|
|
1
|
-
// Installs
|
|
1
|
+
// Installs an 11/10 LABS Signature Powerbar statusline (`~/.labs/statusline.js`) into `~/.claude/settings.json`.
|
|
2
|
+
// Theme-synced with `labs dash`, shows: LABS badge · Qwen4-35B-A3B · folder/git · live context gauge bar · clock.
|
|
2
3
|
const fs = require('fs');
|
|
3
4
|
const os = require('os');
|
|
4
5
|
const path = require('path');
|
|
5
6
|
const { LABS_DIR } = require('./config');
|
|
6
7
|
|
|
7
8
|
const STATUSLINE_SCRIPT = `#!/usr/bin/env node
|
|
8
|
-
//
|
|
9
|
+
// LABS Signature Powerbar for Claude Code (theme-synced with labs dash)
|
|
9
10
|
const { execSync } = require('child_process');
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const os = require('os');
|
|
10
13
|
const path = require('path');
|
|
11
14
|
|
|
15
|
+
const THEMES = {
|
|
16
|
+
ocean: [[56, 189, 248], [52, 211, 153]],
|
|
17
|
+
sunset: [[251, 191, 36], [251, 113, 133]],
|
|
18
|
+
cyber: [[167, 139, 250], [56, 189, 248]],
|
|
19
|
+
emerald: [[52, 211, 153], [163, 230, 53]],
|
|
20
|
+
mono: [[248, 250, 252], [148, 163, 184]],
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function getTheme() {
|
|
24
|
+
try {
|
|
25
|
+
const p = path.join(os.homedir(), '.labs', 'config.json');
|
|
26
|
+
if (fs.existsSync(p)) {
|
|
27
|
+
const name = JSON.parse(fs.readFileSync(p, 'utf8')).theme;
|
|
28
|
+
if (THEMES[name]) return THEMES[name];
|
|
29
|
+
}
|
|
30
|
+
} catch {}
|
|
31
|
+
return THEMES.ocean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function grad(text, from, to) {
|
|
35
|
+
const chars = [...text];
|
|
36
|
+
const len = Math.max(1, chars.length - 1);
|
|
37
|
+
return chars.map((ch, i) => {
|
|
38
|
+
const t = i / len;
|
|
39
|
+
const r = Math.round(from[0] + (to[0] - from[0]) * t);
|
|
40
|
+
const g = Math.round(from[1] + (to[1] - from[1]) * t);
|
|
41
|
+
const b = Math.round(from[2] + (to[2] - from[2]) * t);
|
|
42
|
+
return \`\\x1b[1;38;2;\${r};\${g};\${b}m\${ch}\`;
|
|
43
|
+
}).join('') + '\\x1b[0m';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const rgb = (r, g, b, s) => \`\\x1b[38;2;\${r};\${g};\${b}m\${s}\\x1b[0m\`;
|
|
47
|
+
const dim = s => \`\\x1b[2m\${s}\\x1b[0m\`;
|
|
48
|
+
|
|
12
49
|
let raw = '';
|
|
13
50
|
process.stdin.setEncoding('utf8');
|
|
14
51
|
process.stdin.on('data', d => { raw += d; });
|
|
15
52
|
process.stdin.on('end', () => {
|
|
16
53
|
let data = {};
|
|
17
54
|
try { data = JSON.parse(raw || '{}'); } catch {}
|
|
18
|
-
const
|
|
55
|
+
const [from, to] = getTheme();
|
|
56
|
+
|
|
57
|
+
const rawModel = data.model?.display_name || data.model?.id || 'qwen-normal';
|
|
58
|
+
const model = /qwen/i.test(rawModel)
|
|
59
|
+
? (rawModel.includes('uncensored') ? 'Qwen4-35B (uncensored)' : 'Qwen4-35B-A3B')
|
|
60
|
+
: rawModel;
|
|
61
|
+
|
|
19
62
|
const cwd = data.workspace?.current_dir || process.cwd();
|
|
20
63
|
const folder = path.basename(cwd);
|
|
21
|
-
|
|
64
|
+
|
|
22
65
|
let branch = '';
|
|
66
|
+
let dirty = false;
|
|
23
67
|
try {
|
|
24
|
-
branch = execSync('git rev-parse --abbrev-ref HEAD', { cwd, stdio: ['ignore', 'pipe', 'ignore'], timeout:
|
|
68
|
+
branch = execSync('git rev-parse --abbrev-ref HEAD', { cwd, stdio: ['ignore', 'pipe', 'ignore'], timeout: 350 }).toString().trim();
|
|
69
|
+
const st = execSync('git status --porcelain', { cwd, stdio: ['ignore', 'pipe', 'ignore'], timeout: 350 }).toString().trim();
|
|
70
|
+
dirty = Boolean(st);
|
|
25
71
|
} catch {}
|
|
26
|
-
|
|
72
|
+
|
|
73
|
+
const pct = data.context_window?.used_percentage;
|
|
74
|
+
const sep = dim(' · ');
|
|
27
75
|
const parts = [
|
|
28
|
-
|
|
29
|
-
|
|
76
|
+
grad('✦ LABS', from, to),
|
|
77
|
+
rgb(from[0], from[1], from[2], model),
|
|
78
|
+
rgb(248, 250, 252, folder) + (branch ? ' ' + rgb(167, 139, 250, branch) + (dirty ? rgb(251, 191, 36, ' ●') : '') : ''),
|
|
30
79
|
];
|
|
31
|
-
|
|
80
|
+
|
|
32
81
|
if (pct != null) {
|
|
33
|
-
const
|
|
34
|
-
|
|
82
|
+
const p = Math.max(0, Math.min(100, Math.round(pct)));
|
|
83
|
+
const filled = Math.max(p > 0 ? 1 : 0, Math.round(p / 12.5));
|
|
84
|
+
const barColor = p > 75 ? [251, 113, 133] : p > 45 ? [251, 191, 36] : [52, 211, 153];
|
|
85
|
+
const bar = rgb(barColor[0], barColor[1], barColor[2], '▓'.repeat(filled)) + dim('░'.repeat(Math.max(0, 8 - filled)));
|
|
86
|
+
parts.push(\`\${bar} \${rgb(barColor[0], barColor[1], barColor[2], p + '%')}\`);
|
|
35
87
|
}
|
|
36
|
-
|
|
88
|
+
|
|
89
|
+
const now = new Date();
|
|
90
|
+
const hhmm = String(now.getHours()).padStart(2, '0') + ':' + String(now.getMinutes()).padStart(2, '0');
|
|
91
|
+
parts.push(dim(hhmm));
|
|
92
|
+
|
|
93
|
+
process.stdout.write(' ' + parts.join(sep) + '\\n');
|
|
37
94
|
});
|
|
38
95
|
`;
|
|
39
96
|
|
package/src/ui.js
CHANGED
|
@@ -416,4 +416,66 @@ function runSelfUpdate(currentVersion) {
|
|
|
416
416
|
console.log(`\n ${c.mint('✔')} Updated to latest! Close and reopen any open labs terminals.\n`);
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
-
|
|
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 };
|