labs-claude 0.4.0 → 0.4.2
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/bin/labs.js +1 -1
- package/package.json +1 -1
- package/src/ui.js +114 -18
package/bin/labs.js
CHANGED
package/package.json
CHANGED
package/src/ui.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const readline = require('readline');
|
|
6
|
-
const { spawnSync } = require('child_process');
|
|
6
|
+
const { spawn, spawnSync } = require('child_process');
|
|
7
7
|
|
|
8
8
|
const USE_COLOR = Boolean(process.stdout.isTTY && !process.env.NO_COLOR);
|
|
9
9
|
const ansi = (code, s) => (USE_COLOR ? `\x1b[${code}m${s}\x1b[0m` : String(s));
|
|
@@ -49,7 +49,7 @@ const MASCOT_FRAMES = [
|
|
|
49
49
|
' │ ◉ ◉ │ ',
|
|
50
50
|
' │ ◡ │ ',
|
|
51
51
|
' ╰─┬─────┬─╯ ',
|
|
52
|
-
' ╱
|
|
52
|
+
' ╱ ▒▒░░▒ ╲ ',
|
|
53
53
|
' ╰─────────╯ ',
|
|
54
54
|
],
|
|
55
55
|
[
|
|
@@ -58,7 +58,7 @@ const MASCOT_FRAMES = [
|
|
|
58
58
|
' │ ◠ ◠ │ ',
|
|
59
59
|
' │ ◡ │ ',
|
|
60
60
|
' ╰─┬─────┬─╯ ',
|
|
61
|
-
' ╱
|
|
61
|
+
' ╱ ▓▓▒▒▓ ╲ ',
|
|
62
62
|
' ╰─────────╯ ',
|
|
63
63
|
],
|
|
64
64
|
[
|
|
@@ -67,25 +67,92 @@ const MASCOT_FRAMES = [
|
|
|
67
67
|
' │ ◉ ◉ │ ',
|
|
68
68
|
' │ ◡ │ ',
|
|
69
69
|
' ╰─┬─────┬─╯ ',
|
|
70
|
+
' ╱ ██▓▓█ ╲ ',
|
|
71
|
+
' ╰─────────╯ ',
|
|
72
|
+
],
|
|
73
|
+
[
|
|
74
|
+
' ✦ ╭───╮ ✨ ',
|
|
75
|
+
' ╭──┴───┴──╮ ',
|
|
76
|
+
' │ ✦ ✦ │ ',
|
|
77
|
+
' │ ◡ │ ',
|
|
78
|
+
' ╰─┬─────┬─╯ ',
|
|
79
|
+
' ╱ █████ ╲ ',
|
|
80
|
+
' ╰─────────╯ ',
|
|
81
|
+
],
|
|
82
|
+
[
|
|
83
|
+
' ✨ ╭───╮ ✦ ',
|
|
84
|
+
' ╭──┴───┴──╮ ',
|
|
85
|
+
' │ ◉ ◉ │ ',
|
|
86
|
+
' │ ◡ │ ',
|
|
87
|
+
' ╰─┬─────┬─╯ ',
|
|
70
88
|
' ╱ █████ ╲ ',
|
|
71
89
|
' ╰─────────╯ ',
|
|
72
90
|
],
|
|
73
91
|
];
|
|
74
92
|
|
|
75
93
|
const CHILL_QUIPS = [
|
|
94
|
+
'bro is actually cooking rn 🔥',
|
|
95
|
+
'hold up let him cook 👨🍳🔥',
|
|
76
96
|
'hehe, spinning up qwen4... try not to hack into nasa 💀',
|
|
77
|
-
'bro really opened another terminal tab 😭
|
|
78
|
-
'
|
|
79
|
-
'
|
|
80
|
-
'loading 1m context... still smaller than your
|
|
81
|
-
'
|
|
82
|
-
'
|
|
83
|
-
'
|
|
97
|
+
'bro really opened another terminal tab 😭',
|
|
98
|
+
'gpu fans just entered airplane mode ✈️💀',
|
|
99
|
+
'warming up 256 experts (8 are coding, 248 are chilling) 💀',
|
|
100
|
+
'loading 1m context... still smaller than your chrome tabs 😭',
|
|
101
|
+
'no sleep just shipping 🚀😭',
|
|
102
|
+
'bro woke up and chose 400 tok/s ⚡',
|
|
103
|
+
'convincing the gpu to go brrr rn 🏎️💨',
|
|
104
|
+
'if this takes >2s blame wifi not me 💀',
|
|
105
|
+
'unlocking vision + web search... lock in bro 🔒⚡',
|
|
106
|
+
'chat is this real?? yes bro 1m context is live 😭🔥',
|
|
107
|
+
'main character energy detected ✨🚀',
|
|
108
|
+
'bro really said "i can fix it in 5 mins" (3 hours ago) 💀',
|
|
109
|
+
'pouring 600w of iced coffee into the gpu ☕⚡',
|
|
110
|
+
'zero rate limits, pure vibes only 🌊🔥',
|
|
111
|
+
'prod is shaking rn bro be gentle 😭💀',
|
|
112
|
+
'git push --force energy (please don’t) 👀💀',
|
|
113
|
+
'loading big brain mode... 🧠⚡',
|
|
114
|
+
'your friend is gonna ask how this is so fast 🤫🔥',
|
|
115
|
+
'shipping before the coffee gets cold ☕🚀',
|
|
116
|
+
'vibe coding at 400 tokens/sec, peak cinema 🎬🔥',
|
|
117
|
+
'qwen4 just stretched its knuckles, we ready 💪⚡',
|
|
118
|
+
'deleting bugs before they even spawn 🪲🔫',
|
|
119
|
+
'bro’s terminal looks like a movie hacker screen rn 💀✨',
|
|
120
|
+
'1,048,576 tokens of pure locked-in focus 🎯🔥',
|
|
121
|
+
'trust the process, we shipping tonight 🌙🚀',
|
|
122
|
+
'no cap this gpu is actually flying rn 🦅⚡',
|
|
123
|
+
'who needs sleep when you have 1m context 😭☕',
|
|
124
|
+
'spawning braincells... please wait 🧠✨',
|
|
125
|
+
'bro is about to refactor the whole repo at 2am 💀🔥',
|
|
126
|
+
'vision online, web online, aura +1000 ✨⚡',
|
|
127
|
+
'stack overflow? never heard of her 💅🔥',
|
|
128
|
+
'building the future from a dark terminal 🖤🚀',
|
|
129
|
+
'type shi, we locked in 🔒🔥',
|
|
130
|
+
'let the gpu handle the heavy lifting bro 🏋️⚡',
|
|
131
|
+
'speedrunning this feature like it’s a world record ⏱️🔥',
|
|
132
|
+
'your code is about to look illegally clean 🧼✨',
|
|
133
|
+
'qwen4 woke up with zero chill today 💀🔥',
|
|
134
|
+
'fetching brain power from the cloud ☁️⚡',
|
|
135
|
+
'bro’s about to cook a 5-star pull request 👨🍳⭐',
|
|
136
|
+
'no bugs allowed in this zip code 🚫🪲',
|
|
137
|
+
'terminal aura maxed out ✨💻',
|
|
138
|
+
'fast enough to make your keyboard jealous ⌨️💨',
|
|
139
|
+
'ok ok let’s see what we breaking today 😭🔧',
|
|
140
|
+
'certified cracked engineer moment 💀🔥',
|
|
141
|
+
'running on pure caffeine and tensor cores ☕⚡',
|
|
142
|
+
'don’t blink, it’s already loaded 👀🚀',
|
|
143
|
+
'we are so back 🔥🚀',
|
|
144
|
+
];
|
|
145
|
+
|
|
146
|
+
const UNCENSORED_QUIPS = [
|
|
147
|
+
'hehe, going uncensored mode 💀 which one are you hacking into, nasa? 😭',
|
|
148
|
+
'uncensored mode unlocked 💀 bro what are you building rn 😭🔥',
|
|
149
|
+
'no guardrails, just vibes 💀 don’t get us on the news bro 😭',
|
|
150
|
+
'bro clicked uncensored with zero hesitation 💀⚡',
|
|
84
151
|
];
|
|
85
152
|
|
|
86
153
|
function randomQuip(modelId = '') {
|
|
87
154
|
if (String(modelId).includes('uncensored')) {
|
|
88
|
-
return
|
|
155
|
+
return UNCENSORED_QUIPS[Math.floor(Math.random() * UNCENSORED_QUIPS.length)];
|
|
89
156
|
}
|
|
90
157
|
return CHILL_QUIPS[Math.floor(Math.random() * CHILL_QUIPS.length)];
|
|
91
158
|
}
|
|
@@ -110,20 +177,22 @@ async function playMascotIntro(version, subtitle = 'Qwen4-35B-A3B · 1M Context
|
|
|
110
177
|
].join('\n');
|
|
111
178
|
|
|
112
179
|
if (!USE_COLOR) {
|
|
113
|
-
console.log(paintFrame(MASCOT_FRAMES[
|
|
180
|
+
console.log(paintFrame(MASCOT_FRAMES[5], [56, 189, 248], [52, 211, 153]));
|
|
114
181
|
return;
|
|
115
182
|
}
|
|
116
183
|
|
|
117
184
|
const palettes = [
|
|
118
185
|
[[167, 139, 250], [56, 189, 248]],
|
|
119
186
|
[[56, 189, 248], [52, 211, 153]],
|
|
120
|
-
[[52, 211, 153], [
|
|
187
|
+
[[52, 211, 153], [251, 191, 36]],
|
|
188
|
+
[[251, 191, 36], [167, 139, 250]],
|
|
189
|
+
[[167, 139, 250], [52, 211, 153]],
|
|
121
190
|
[[56, 189, 248], [52, 211, 153]],
|
|
122
191
|
];
|
|
123
192
|
for (let i = 0; i < MASCOT_FRAMES.length; i += 1) {
|
|
124
193
|
if (i > 0) process.stdout.write('\x1b[9A\x1b[0J');
|
|
125
194
|
process.stdout.write(paintFrame(MASCOT_FRAMES[i], palettes[i][0], palettes[i][1]) + '\n');
|
|
126
|
-
if (i < MASCOT_FRAMES.length - 1) await sleep(
|
|
195
|
+
if (i < MASCOT_FRAMES.length - 1) await sleep(95);
|
|
127
196
|
}
|
|
128
197
|
}
|
|
129
198
|
|
|
@@ -223,7 +292,25 @@ function isNewerVersion(latest, current) {
|
|
|
223
292
|
return false;
|
|
224
293
|
}
|
|
225
294
|
|
|
226
|
-
// Non-blocking
|
|
295
|
+
// Non-blocking auto-updater: checks npm in the background and silently installs newer versions
|
|
296
|
+
// in a detached process (once per version) so the next `labs` window is automatically up to date.
|
|
297
|
+
function spawnBackgroundUpdate(latest, cacheFile, cached) {
|
|
298
|
+
if (process.env.LABS_NO_AUTO_UPDATE === '1') return;
|
|
299
|
+
if (cached && cached.autoUpdatedTo === latest) return;
|
|
300
|
+
try {
|
|
301
|
+
fs.mkdirSync(path.dirname(cacheFile), { recursive: true });
|
|
302
|
+
fs.writeFileSync(cacheFile, JSON.stringify({ ...cached, latest, checkedAt: Date.now(), autoUpdatedTo: latest }));
|
|
303
|
+
const cmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
304
|
+
const child = spawn(cmd, ['install', '-g', `labs-claude@${latest}`, '--prefer-online', '--no-audit', '--no-fund'], {
|
|
305
|
+
stdio: 'ignore',
|
|
306
|
+
detached: true,
|
|
307
|
+
shell: process.platform === 'win32',
|
|
308
|
+
windowsHide: true,
|
|
309
|
+
});
|
|
310
|
+
child.unref();
|
|
311
|
+
} catch { /* silent fallback to manual labs update */ }
|
|
312
|
+
}
|
|
313
|
+
|
|
227
314
|
function checkUpdateNotice(currentVersion, labsDir) {
|
|
228
315
|
const cacheFile = path.join(labsDir, 'update-check.json');
|
|
229
316
|
let cached = null;
|
|
@@ -232,17 +319,26 @@ function checkUpdateNotice(currentVersion, labsDir) {
|
|
|
232
319
|
} catch { /* ignore corrupt cache */ }
|
|
233
320
|
|
|
234
321
|
if (cached && cached.latest && isNewerVersion(cached.latest, currentVersion)) {
|
|
235
|
-
|
|
322
|
+
if (cached.autoUpdatedTo !== cached.latest) {
|
|
323
|
+
spawnBackgroundUpdate(cached.latest, cacheFile, cached);
|
|
324
|
+
console.log(` ${c.mint('⬆')} ${c.dim(`auto-updating labs`)} ${c.dim(currentVersion)} → ${c.cyan(cached.latest)} ${c.dim('in background (ready next window) ✨')}`);
|
|
325
|
+
} else {
|
|
326
|
+
console.log(` ${c.amber('⬆')} ${c.bold('update available:')} ${c.dim(currentVersion)} → ${c.mint(cached.latest)} ${c.dim('run:')} ${c.cyan('labs update')}`);
|
|
327
|
+
}
|
|
236
328
|
}
|
|
237
329
|
|
|
238
|
-
const stale = !cached || (Date.now() - (cached.checkedAt || 0)) >
|
|
330
|
+
const stale = !cached || (Date.now() - (cached.checkedAt || 0)) > 2 * 3600e3;
|
|
239
331
|
if (stale && typeof fetch === 'function') {
|
|
240
332
|
fetch('https://registry.npmjs.org/labs-claude/latest', { signal: AbortSignal.timeout(2500) })
|
|
241
333
|
.then(r => (r.ok ? r.json() : null))
|
|
242
334
|
.then(data => {
|
|
243
335
|
if (!data?.version) return;
|
|
244
336
|
fs.mkdirSync(labsDir, { recursive: true });
|
|
245
|
-
|
|
337
|
+
const next = { ...(cached || {}), latest: data.version, checkedAt: Date.now() };
|
|
338
|
+
fs.writeFileSync(cacheFile, JSON.stringify(next));
|
|
339
|
+
if (isNewerVersion(data.version, currentVersion)) {
|
|
340
|
+
spawnBackgroundUpdate(data.version, cacheFile, next);
|
|
341
|
+
}
|
|
246
342
|
})
|
|
247
343
|
.catch(() => {});
|
|
248
344
|
}
|