labs-claude 0.3.5 → 0.4.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/bin/labs.js CHANGED
@@ -17,36 +17,18 @@ const { planSubscriptionLeg, planLabsLegArgs, createWatcher } = require('../src/
17
17
  const { version } = require('../package.json');
18
18
  const { c, playMascotIntro, checkUpdateNotice, runSelfUpdate } = require('../src/ui');
19
19
 
20
- const HELP = `labs ${version} — Run Claude Code on Antigravity (agy), Google Gemini 4, ElevenLabs, Bedrock, or Qwen
20
+ const HELP = `labs ${version} — Run Claude Code on Qwen4-35B-A3B (1M context · Native Vision · Web Search)
21
21
 
22
- labs open Claude Code on the default model
23
- labs --model gem Gemini 4 Hydrogen (1M context, reasoning) via your signed-in agy CLI
24
- labs --model gemini Gemini 4 Hydrogen (1M context, reasoning) via agy or your ElevenLabs bridge
25
- labs --model hydrogen same as --model gemini (also: agy-flash, agy-opus, agy-sonnet, agy-oss)
26
- labs --model opus pick a model by name, number (labs --model 5) or raw LLM id
27
- labs -p "question" any Claude Code flag works, e.g. -p, --resume, --permission-mode
28
- labs auto [claude args] real Claude Code on your subscription; on a limit or expired login, same session continues on labs Opus 5.5
29
- labs models [--all] list models
30
- labs usage credits left and what recent sessions cost per model
31
- labs setup set your ElevenLabs key, the bridge agent and real-Chrome control
32
- labs bedrock save your Amazon Bedrock key, then: labs --model glm (GLM 5.3)
33
- labs --model qwen Claude Code on our GPU box (qwen | qwen-uncensored), through the labs gateway
34
- labs key save your labs key (lk_...) with interactive model + effort setup
35
- labs admin [subcommand] terminal-native Admin Control Room (stats | create | pause | resume | revoke | usage)
36
- labs update update labs-claude to the latest npm version in one command
37
- labs console open the web admin console (optional; labs admin does everything in terminal)
38
- labs paint "a red kite" paint on the box (--size wide|portrait|square… --count 1-4 --seed N); prints the file paths
39
- labs image-mcp picture tool for any Claude Code chat: claude mcp add -s user labs-image -- labs image-mcp
40
- labs web-mcp web search + page reading on this computer (added to every box session by itself)
41
- labs admin-token <ssh> make a new console admin token on the gateway server
42
- labs chat open the private chat page (http://127.0.0.1:8081/chat)
43
- labs serve start the background proxy if it is not running, then exit
44
- labs autostart on|off keep the proxy (and the chat page) running from login (Windows)
45
- labs stop stop the background proxy
22
+ labs open Claude Code directly on Qwen4-35B-A3B (1M ctx, high effort)
23
+ labs --model qwen explicitly launch Qwen4-35B-A3B (also: --model qwen-uncensored)
24
+ labs -p "question" any Claude Code flag works (-p, --resume, --effort max, etc.)
25
+ labs setup interactive mascot setup (paste lk_... key, choose effort)
26
+ labs key [lk_...] save or rotate your labs API key
27
+ labs models list available engines (Qwen4-35B-A3B live + upcoming)
28
+ labs update update labs-claude to the latest npm version in 1 command
29
+ labs admin [subcommand] admin terminal control room (stats | create | pause | resume | revoke | usage)
46
30
 
47
- Inside Claude Code: /model <name> switches model, e.g. /model gemini-4-neon
48
- Browser: "open gmail.com and read my top email" uses your real Chrome (set up with labs setup)
49
- Update: npm install -g labs-claude@latest --prefer-online, then close and reopen every labs window`;
31
+ Inside Claude Code: /effort low | high | max adjusts reasoning depth live.`;
50
32
 
51
33
  function printModels(config, showAll) {
52
34
  const llms = loadLlmList();
@@ -312,18 +294,17 @@ async function runAuto(args) {
312
294
  }
313
295
 
314
296
  async function runInteractiveSetup() {
315
- await playMascotIntro(version, 'Choose your backend to set up');
316
- console.log(` ${c.bold('Select setup mode:')}`);
317
- console.log(` ${c.cyan('1.')} ${c.bold('Labs Key (Qwen4 1M)')} ${c.dim('Paste lk_... key from admin — Vision, Web, 200–400 tok/s [Recommended]')}`);
318
- console.log(` ${c.cyan('2.')} ${c.bold('ElevenLabs')} ${c.dim('ElevenLabs API key + bridge agent + Chrome control')}`);
319
- console.log(` ${c.cyan('3.')} ${c.bold('Google Gemini 4')} ${c.dim('AI Studio key or Vertex AI')}`);
320
- console.log(` ${c.cyan('4.')} ${c.bold('Amazon Bedrock')} ${c.dim('Bedrock API key (GLM 5.3)')}\n`);
297
+ await playMascotIntro(version, 'Setup · Qwen4 1M · Vision · Web Search');
298
+ console.log(` ${c.bold('Available engines:')}`);
299
+ console.log(` ${c.cyan('1.')} ${c.bold('Qwen4 1M')} ${c.mint('● LIVE')} ${c.dim('Enter your lk_... key — Vision, Web, 200–400 tok/s [Default]')}`);
300
+ console.log(` ${c.dim('2. Opus 5.5 ○ In progress (coming soon)')}`);
301
+ console.log(` ${c.dim('3. Gemini 4 ○ In progress (coming soon)')}`);
302
+ console.log(` ${c.dim('4. GLM 5.3 ○ In progress (coming soon)')}\n`);
321
303
  const choice = (await ask(' Choose [1]: ')) || '1';
322
- if (choice === '1') return saveGatewayKey(askHidden, ask);
323
- if (choice === '2') return runSetup();
324
- if (choice === '3') return setupGemini();
325
- if (choice === '4') return setupBedrock();
326
- console.log(` ${c.rose('✖')} Unknown choice "${choice}".`);
304
+ if (choice !== '1') {
305
+ console.log(` ${c.amber('⚡')} That engine is still cooking in the lab — setting up ${c.cyan('Qwen4 1M')} now!\n`);
306
+ }
307
+ return saveGatewayKey(askHidden, ask, undefined, true);
327
308
  }
328
309
 
329
310
  async function main() {
@@ -377,7 +358,16 @@ async function main() {
377
358
  else config.defaultModel = 'hydrogen'; // gemini-4-hydrogen works via ElevenLabs gateway; setup will prompt if needed
378
359
  }
379
360
 
380
- if (args[0] === 'models') return printModels(config, args.includes('--all'));
361
+ if (args[0] === 'models') {
362
+ console.log(`\n ${c.bold(c.white('labs engines'))}\n`);
363
+ console.log(` ${c.cyan('1.')} ${c.bold('qwen')} ${c.mint('● live')} ${c.dim('Qwen4-35B-A3B · 1m context · vision · web · 200-400 tok/s ← default')}`);
364
+ console.log(` ${c.cyan('2.')} ${c.bold('qwen-uncensored')} ${c.mint('● live')} ${c.dim('same qwen4 engine, uncensored alias 💀')}`);
365
+ console.log(` ${c.dim('3. opus ○ coming soon')}`);
366
+ console.log(` ${c.dim('4. gemini ○ coming soon')}`);
367
+ console.log(` ${c.dim('5. glm ○ coming soon')}\n`);
368
+ console.log(` ${c.dim('start:')} ${c.cyan('labs')} ${c.dim('effort inside chat:')} ${c.cyan('/effort low | high | max')}\n`);
369
+ return;
370
+ }
381
371
  if (args[0] === 'usage') return printUsage(config);
382
372
  if (args[0] === 'chat') return openChat(config);
383
373
  if (args[0] === 'stop') return console.log(await stopProxy(config.port) ? '🛑 Proxy stopped' : 'Proxy was not running');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "labs-claude",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "description": "Run the real Claude Code CLI on Qwen4 1M (Vision + Web), Gemini 4, Bedrock, or ElevenLabs — with colorful setup and admin token tracking.",
5
5
  "bin": {
6
6
  "labs": "bin/labs.js"
@@ -7,21 +7,27 @@ const path = require('path');
7
7
  const { execFileSync, spawn } = require('child_process');
8
8
  const { CONFIG_PATH, LABS_DIR, saveConfig } = require('./config');
9
9
  const { withBypassDefault } = require('./launch-args');
10
- const { c, randomQuip, playMascotIntro, withSpinner, printCard } = require('./ui');
10
+ const { c, randomQuip, playMascotIntro, askMasked, withSpinner, printCard } = require('./ui');
11
11
  const { version } = require('../package.json');
12
12
 
13
- const GATEWAY_MODELS = { qwen: 'qwen-normal', 'qwen-normal': 'qwen-normal', 'qwen-uncensored': 'qwen-uncensored' };
13
+ const GATEWAY_MODELS = {
14
+ qwen: 'qwen-normal',
15
+ qwen4: 'qwen-normal',
16
+ 'qwen4-35b': 'qwen-normal',
17
+ 'qwen-normal': 'qwen-normal',
18
+ 'qwen-uncensored': 'qwen-uncensored'
19
+ };
14
20
  const DEFAULT_GATEWAY_URL = 'https://labs.instant.uz';
15
21
  const ADMIN_TOKEN_FILE = path.join(LABS_DIR, 'gateway-admin');
16
- // Same capability list the box's own claude-local uses, so /effort and thinking work on Qwen.
22
+ // Same capability list the box's own claude-local uses, so /effort, xhigh, max, and thinking work on Qwen4.
17
23
  const CAPS = 'effort,xhigh_effort,max_effort,thinking,interleaved_thinking';
18
24
 
19
- // A friend who saved only a labs key (no ElevenLabs account) gets Qwen from a bare `labs`, never the ElevenLabs setup.
20
- function boxOnlyArgs(args, stored, env = process.env) {
25
+ // Whenever a labs key is configured, bare `labs` ALWAYS launches Qwen4 (never falls back into ElevenLabs).
26
+ function boxOnlyArgs(args, stored) {
21
27
  const named = args.some(a => a === '--model' || a.startsWith('--model='));
22
- const command = ['models', 'usage', 'chat', 'stop', 'setup', 'update'].includes(args[0]);
28
+ const command = ['models', 'usage', 'chat', 'stop', 'setup', 'update', 'admin', 'key', 'console', 'paint'].includes(args[0]);
23
29
  const defaultModel = stored.defaultBoxModel || 'qwen';
24
- return !named && !command && stored.gatewayKey && !stored.apiKey && !env.ELEVENLABS_API_KEY ? ['--model', defaultModel, ...args] : null;
30
+ return !named && !command && stored.gatewayKey ? ['--model', defaultModel, ...args] : null;
25
31
  }
26
32
 
27
33
  function gatewayModelFrom(args) {
@@ -43,57 +49,64 @@ async function boxModels(url, key) {
43
49
 
44
50
  // `labs key lk_...` takes the key from the command line: on Windows PowerShell a Ctrl+V into the hidden prompt can
45
51
  // arrive empty (a friend saw "does not look like a labs key" with a correct lk_ key, 22 Nov).
46
- async function saveGatewayKey(askHidden, ask, givenKey) {
47
- await playMascotIntro(version, 'Fast Qwen4 1M Setup · Native Vision · Web Search');
52
+ async function saveGatewayKey(askHidden, ask, givenKey, skipIntro = false) {
53
+ if (!skipIntro) await playMascotIntro(version, 'Qwen4-35B-A3B · 1M Context · Vision · Web');
48
54
  const stored = storedConfig();
49
55
  const url = (stored.gatewayUrl || DEFAULT_GATEWAY_URL).replace(/\/+$/, '');
50
- console.log(` ${c.dim('Gateway:')} ${c.cyan(url)}`);
51
- const key = givenKey ? String(givenKey).trim() : await askHidden(` ${c.amber('🔑')} Paste your labs key ${c.dim('(lk_..., hidden; or run: labs key lk_...)')}: `);
56
+ const key = givenKey
57
+ ? String(givenKey).trim()
58
+ : await askMasked(` ${c.cyan('[1/3]')} ${c.amber('🔑')} Paste your API key ${c.dim('(lk_...)')}: `);
52
59
  if (!/^lk_[A-Za-z0-9_-]{20,}$/.test(key)) {
53
60
  console.log(key
54
- ? ` ${c.rose('✖')} That does not look like a labs key (it starts with ${c.bold('lk_')}). Nothing saved.`
55
- : ` ${c.rose('✖')} Nothing arrived (PowerShell sometimes swallows hidden Ctrl+V). Run instead:\n ${c.cyan('labs key lk_your_key_here')}`);
61
+ ? ` ${c.rose('✖')} That does not look like a valid labs key (it starts with ${c.bold('lk_')}). Nothing saved.`
62
+ : ` ${c.rose('✖')} Nothing arrived. Run with the key directly:\n ${c.cyan('labs key lk_your_key_here')}`);
56
63
  return process.exit(1);
57
64
  }
58
65
  let models = [];
59
66
  try {
60
67
  models = await withSpinner(randomQuip(), () => boxModels(url, key));
61
68
  console.log(models.length
62
- ? ` ${c.mint('✔')} Key verified · Box online: ${c.cyan(models.map(m => m.id).join(', '))}`
63
- : ` ${c.mint('✔')} Key verified · ${c.amber('Box is sleeping right now (ready when it wakes).')}`);
69
+ ? ` ${c.mint('✔')} Key verified · ${c.bold('Qwen4-35B-A3B')} online ${c.dim('(1M ctx · Vision · Web)')}`
70
+ : ` ${c.mint('✔')} Key verified · ${c.amber('GPU box is sleeping right now (ready as soon as it wakes).')}`);
64
71
  } catch (error) {
65
72
  const status = error.response?.status;
66
73
  console.log(status === 401
67
- ? ` ${c.rose('✖')} The gateway refused this key (paused or deleted). Nothing saved.`
68
- : ` ${c.rose('✖')} Could not reach ${url} (${error.code || error.message}). Nothing saved.`);
74
+ ? ` ${c.rose('✖')} This key was refused (paused or revoked). Ask admin for a fresh key.`
75
+ : ` ${c.rose('✖')} Could not connect to engine (${error.code || error.message}). Nothing saved.`);
69
76
  return process.exit(1);
70
77
  }
71
78
 
72
- let defaultBoxModel = stored.defaultBoxModel || 'qwen';
79
+ let defaultBoxModel = 'qwen';
73
80
  let defaultEffort = stored.defaultEffort || 'high';
74
- if (!givenKey && process.stdin.isTTY) {
75
- console.log(`\n ${c.bold('Pick your default model:')}`);
76
- console.log(` ${c.cyan('1.')} ${c.bold('qwen')} ${c.dim('Qwen4-35B-A3B · 1M ctx · Vision · 200–400 tok/s (default)')}`);
77
- console.log(` ${c.cyan('2.')} ${c.bold('qwen-uncensored')} ${c.dim('Same Qwen4 engine, direct alias')}`);
78
- const mChoice = await ask(` Choose [${defaultBoxModel === 'qwen-uncensored' ? '2' : '1'}]: `);
79
- if (mChoice === '2') defaultBoxModel = 'qwen-uncensored';
80
- else if (mChoice === '1') defaultBoxModel = 'qwen';
81
+ if (process.stdin.isTTY) {
82
+ console.log(`\n ${c.cyan('[2/3]')} ${c.bold('Choose default engine:')}`);
83
+ console.log(` ${c.cyan('1.')} ${c.bold('Qwen4-35B-A3B')} ${c.mint('● LIVE')} ${c.dim('1M ctx · Native Vision · Web · 200–400 tok/s [Default]')}`);
84
+ console.log(` ${c.dim('2. Opus 5.5 ○ In progress (coming soon)')}`);
85
+ console.log(` ${c.dim('3. Gemini 4 ○ In progress (coming soon)')}`);
86
+ console.log(` ${c.dim('4. GLM 5.3 ○ In progress (coming soon)')}`);
87
+ const mChoice = await ask(' Choose [1]: ');
88
+ if (mChoice && mChoice !== '1') {
89
+ console.log(` ${c.amber('⚡')} Still cooking that one in the lab — locking in ${c.cyan('Qwen4-35B-A3B')} for now!`);
90
+ }
81
91
 
82
- console.log(`\n ${c.bold('Pick your default thinking effort:')}`);
83
- console.log(` ${c.cyan('1.')} ${c.bold('high')} ${c.dim('Best everyday balance (auto-skips thinking on simple prompts)')}`);
92
+ console.log(`\n ${c.cyan('[3/3]')} ${c.bold('Choose default thinking effort:')}`);
93
+ console.log(` ${c.cyan('1.')} ${c.bold('high')} ${c.dim('Best everyday balance (auto-skips thinking on easy prompts) [Default]')}`);
84
94
  console.log(` ${c.cyan('2.')} ${c.bold('xhigh')} ${c.dim('Deepest reasoning for tough bugs & architecture (max)')}`);
85
95
  console.log(` ${c.cyan('3.')} ${c.bold('low')} ${c.dim('Minimal thinking, fastest multi-agent speed')}`);
86
96
  const eChoice = await ask(' Choose [1]: ');
87
97
  if (eChoice === '2') defaultEffort = 'xhigh';
88
98
  else if (eChoice === '3') defaultEffort = 'low';
89
- else if (eChoice === '1') defaultEffort = 'high';
99
+ else defaultEffort = 'high';
90
100
  }
91
101
 
92
- saveConfig({ ...stored, gatewayUrl: url, gatewayKey: key, defaultBoxModel, defaultEffort });
93
- printCard('You are all set!', [
94
- `${c.mint('Run now:')} ${c.cyan('labs')} ${c.dim('(starts Claude Code on Qwen4 1M)')}`,
95
- `${c.mint('Switch tab:')} ${c.cyan('/effort low')} ${c.dim('or')} ${c.cyan('/effort max')} ${c.dim('inside Claude Code')}`,
96
- `${c.mint('Update CLI:')} ${c.cyan('labs update')}`,
102
+ // Strip any stale ElevenLabs keys so bare `labs` never falls back into ElevenLabs.
103
+ const { apiKey: _oldEl, bridgeAgent: _oldBridge, ...cleanStored } = stored;
104
+ saveConfig({ ...cleanStored, gatewayUrl: url, gatewayKey: key, defaultBoxModel, defaultEffort });
105
+ printCard('READY TO SHIP · HOW LABS WORKS', [
106
+ `${c.mint('Start coding:')} ${c.cyan('labs')} ${c.dim('(opens Claude Code on Qwen4-35B-A3B · 1M · Vision)')}`,
107
+ `${c.mint('Change IQ:')} ${c.cyan('/effort low')} ${c.dim('|')} ${c.cyan('/effort high')} ${c.dim('|')} ${c.cyan('/effort max')} ${c.dim('inside chat')}`,
108
+ `${c.mint('Re-configure:')} ${c.cyan('labs setup')} ${c.dim('(change key or effort anytime)')}`,
109
+ `${c.mint('Auto-update:')} ${c.cyan('labs update')} ${c.dim('(1-command latest version)')}`,
97
110
  ]);
98
111
  }
99
112
 
@@ -122,12 +135,17 @@ async function prepareGatewayLaunch(config, args, picked) {
122
135
 
123
136
  const claudeArgs = args.filter((_, i) => i !== picked.index && (picked.inline || i !== picked.index + 1));
124
137
  if (!claudeArgs.some(a => a === '--effort' || a.startsWith('--effort='))) claudeArgs.push('--effort', config.defaultEffort || 'high');
138
+ const ctxLabel = (model.max_model_len || 131072) >= 1000000 ? '1m context' : `${Math.round((model.max_model_len || 131072) / 1000)}k context`;
139
+ const displayName = picked.id === 'qwen-uncensored' ? 'Qwen4-35B-A3B (uncensored)' : 'Qwen4-35B-A3B';
125
140
  const env = {
126
141
  ...process.env,
127
142
  ANTHROPIC_BASE_URL: url,
128
143
  ANTHROPIC_AUTH_TOKEN: config.gatewayKey,
129
144
  ANTHROPIC_MODEL: picked.id,
130
- // Every row Claude Code can fall back to points at the same box model, so side calls and subagents stay on it.
145
+ ANTHROPIC_CUSTOM_MODEL_OPTION: picked.id,
146
+ ANTHROPIC_CUSTOM_MODEL_OPTION_NAME: displayName,
147
+ ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION: `${displayName} · ${ctxLabel} · vision · web · 200-400 tok/s`,
148
+ // Every row Claude Code can fall back to points at the same box model, so side calls and subagents stay on Qwen4.
131
149
  ANTHROPIC_DEFAULT_OPUS_MODEL: picked.id,
132
150
  ANTHROPIC_DEFAULT_SONNET_MODEL: picked.id,
133
151
  ANTHROPIC_DEFAULT_HAIKU_MODEL: picked.id,
@@ -138,8 +156,7 @@ async function prepareGatewayLaunch(config, args, picked) {
138
156
  CLAUDE_CODE_MAX_CONTEXT_TOKENS: String(model.max_model_len || 131072)
139
157
  };
140
158
  for (const name of ['ANTHROPIC_API_KEY', 'ANTHROPIC_CUSTOM_HEADERS']) delete env[name];
141
- const ctxLabel = (model.max_model_len || 131072) >= 1000000 ? '1M context' : `${Math.round((model.max_model_len || 131072) / 1000)}k context`;
142
- const banner = `${c.mint('🚀')} ${c.bold('Claude Code')} on ${c.cyan(picked.id)} ${c.dim(`(${ctxLabel} · Vision · Web)`)} via ${c.dim(url)}\n ${c.violet('✦')} ${c.dim(randomQuip())}`;
159
+ const banner = `${c.mint('🚀')} ${c.bold('claude code')} on ${c.cyan(displayName)} ${c.dim(`(${ctxLabel} · vision · web)`)}\n ${c.violet('✦')} ${c.dim(randomQuip(picked.id))}`;
143
160
  // Qwen cannot use Claude Code's WebSearch (an Anthropic server tool); give it a search tool that runs here instead.
144
161
  if (!claudeArgs.some(a => a === '--strict-mcp-config')) claudeArgs.push(...require('./web-mcp').webMcpArgs());
145
162
  return { claudeArgs: withBypassDefault(claudeArgs), env, banner };
package/src/ui.js CHANGED
@@ -1,7 +1,8 @@
1
- // Colorful terminal UI, ASCII mascot, lightweight animations, and non-blocking npm update check.
2
- // Zero external dependencies; degrades cleanly when stdout is not a TTY or NO_COLOR is set.
1
+ // Top-tier terminal UI: 24-bit RGB gradients, animated LABS mascot, live *-masked input,
2
+ // Karpathy-mode humor quips, boxed cards, and non-blocking npm auto-update check.
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
+ const readline = require('readline');
5
6
  const { spawnSync } = require('child_process');
6
7
 
7
8
  const USE_COLOR = Boolean(process.stdout.isTTY && !process.env.NO_COLOR);
@@ -18,9 +19,23 @@ const c = {
18
19
  white: s => ansi('38;2;248;250;252', s),
19
20
  };
20
21
 
22
+ function gradient(text, from = [56, 189, 248], to = [167, 139, 250]) {
23
+ if (!USE_COLOR) return String(text);
24
+ const chars = [...String(text)];
25
+ const len = Math.max(1, chars.length - 1);
26
+ return chars.map((ch, i) => {
27
+ if (ch === ' ') return ' ';
28
+ const t = i / len;
29
+ const r = Math.round(from[0] + (to[0] - from[0]) * t);
30
+ const g = Math.round(from[1] + (to[1] - from[1]) * t);
31
+ const b = Math.round(from[2] + (to[2] - from[2]) * t);
32
+ return `\x1b[38;2;${r};${g};${b}m${ch}`;
33
+ }).join('') + '\x1b[0m';
34
+ }
35
+
21
36
  const MASCOT_FRAMES = [
22
37
  [
23
- ' ╭───╮ ',
38
+ ' ╭───╮ · ',
24
39
  ' ╭──┴───┴──╮ ',
25
40
  ' │ ◉ ◉ │ ',
26
41
  ' │ ◡ │ ',
@@ -29,7 +44,7 @@ const MASCOT_FRAMES = [
29
44
  ' ╰─────────╯ ',
30
45
  ],
31
46
  [
32
- ' ╭───╮ ✦ ',
47
+ ' · ╭───╮ ✦ ',
33
48
  ' ╭──┴───┴──╮ ',
34
49
  ' │ ◉ ◉ │ ',
35
50
  ' │ ◡ │ ',
@@ -38,7 +53,7 @@ const MASCOT_FRAMES = [
38
53
  ' ╰─────────╯ ',
39
54
  ],
40
55
  [
41
- ' ✦ ╭───╮ · ',
56
+ ' ✦ ╭───╮ ✧ ',
42
57
  ' ╭──┴───┴──╮ ',
43
58
  ' │ ◠ ◠ │ ',
44
59
  ' │ ◡ │ ',
@@ -46,55 +61,121 @@ const MASCOT_FRAMES = [
46
61
  ' ╱ ▓▓▓▓▓ ╲ ',
47
62
  ' ╰─────────╯ ',
48
63
  ],
64
+ [
65
+ ' ✧ ╭───╮ ✦ ',
66
+ ' ╭──┴───┴──╮ ',
67
+ ' │ ◉ ◉ │ ',
68
+ ' │ ◡ │ ',
69
+ ' ╰─┬─────┬─╯ ',
70
+ ' ╱ █████ ╲ ',
71
+ ' ╰─────────╯ ',
72
+ ],
49
73
  ];
50
74
 
51
- const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
52
-
53
- const KARPATHY_QUIPS = [
54
- 'Warming up 256 MoE experts (8 are coding, 248 are in standup)...',
55
- 'Karpathy mode: staring directly into the loss curve...',
56
- 'Convincing DFlash2 to guess 7 tokens ahead with zero brain loss...',
57
- 'Loading 1,048,576 tokens of context (more memory than your last sprint)...',
58
- 'Feeding Blackwell tensor cores 600 watts of pure unfiltered caffeine...',
59
- 'Checking RadixAttention prefix cache so TTFT stays sub-100ms...',
60
- 'Calibrating xhigh reasoning... please hold while the model overthinks...',
61
- 'Zero corporate rate limits detected. Full local throttle engaged.',
75
+ const CHILL_QUIPS = [
76
+ 'hehe, spinning up qwen4... try not to hack into nasa 💀',
77
+ 'bro really opened another terminal tab 😭 loading 1m context...',
78
+ 'warming up 256 experts (8 are working, 248 are chilling) 💀',
79
+ 'no rate limits, no drama, just pure speed ⚡',
80
+ 'loading 1m context... still smaller than your open chrome tabs 😭',
81
+ 'convincing the gpu to go brrr at 400 tok/s...',
82
+ 'if this takes more than 2 seconds blame wifi not me 💀',
83
+ 'unlocking vision + web search... lock in bro ⚡',
62
84
  ];
63
85
 
64
- function randomQuip() {
65
- return KARPATHY_QUIPS[Math.floor(Math.random() * KARPATHY_QUIPS.length)];
86
+ function randomQuip(modelId = '') {
87
+ if (String(modelId).includes('uncensored')) {
88
+ return 'hehe, going uncensored mode 💀 which one are you hacking into, nasa? 😭';
89
+ }
90
+ return CHILL_QUIPS[Math.floor(Math.random() * CHILL_QUIPS.length)];
66
91
  }
67
92
 
68
- async function playMascotIntro(version, subtitle = 'Claude Code · Qwen4 1M · Vision · Web') {
93
+ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
94
+
95
+ async function playMascotIntro(version, subtitle = 'Qwen4-35B-A3B · 1M Context · Vision · Web') {
69
96
  const quip = randomQuip();
70
- const paintFrame = (frame, accent) => {
71
- const lines = [
72
- '',
73
- ` ${accent(frame[0])} ${c.bold(c.white('LABS'))} ${c.violet(`v${version}`)}`,
74
- ` ${accent(frame[1])} ${c.dim(subtitle)}`,
75
- ` ${c.cyan(frame[2])} ${c.mint('●')} ${c.dim(quip)}`,
76
- ` ${c.cyan(frame[3])}`,
77
- ` ${accent(frame[4])}`,
78
- ` ${c.mint(frame[5])}`,
79
- ` ${c.mint(frame[6])}`,
80
- '',
81
- ];
82
- return lines.join('\n');
83
- };
97
+ const wordmark = gradient('█░░ ▄▀█ █▄▄ █▀', [56, 189, 248], [52, 211, 153]);
98
+ const wordmark2 = gradient('█▄▄ █▀█ █▄█ ▄█', [167, 139, 250], [56, 189, 248]);
99
+
100
+ const paintFrame = (frame, fromRgb, toRgb) => [
101
+ '',
102
+ ` ${gradient(frame[0], fromRgb, toRgb)} ${wordmark} ${c.violet(`v${version}`)}`,
103
+ ` ${gradient(frame[1], fromRgb, toRgb)} ${wordmark2}`,
104
+ ` ${c.cyan(frame[2])} ${c.white(subtitle)}`,
105
+ ` ${c.cyan(frame[3])} ${c.mint('✦')} ${c.dim(quip)}`,
106
+ ` ${gradient(frame[4], fromRgb, toRgb)}`,
107
+ ` ${gradient(frame[5], [52, 211, 153], [56, 189, 248])}`,
108
+ ` ${c.mint(frame[6])}`,
109
+ '',
110
+ ].join('\n');
84
111
 
85
112
  if (!USE_COLOR) {
86
- console.log(paintFrame(MASCOT_FRAMES[2], s => s));
113
+ console.log(paintFrame(MASCOT_FRAMES[3], [56, 189, 248], [52, 211, 153]));
87
114
  return;
88
115
  }
89
116
 
90
- const accents = [c.violet, c.cyan, c.mint];
117
+ const palettes = [
118
+ [[167, 139, 250], [56, 189, 248]],
119
+ [[56, 189, 248], [52, 211, 153]],
120
+ [[52, 211, 153], [167, 139, 250]],
121
+ [[56, 189, 248], [52, 211, 153]],
122
+ ];
91
123
  for (let i = 0; i < MASCOT_FRAMES.length; i += 1) {
92
124
  if (i > 0) process.stdout.write('\x1b[9A\x1b[0J');
93
- process.stdout.write(paintFrame(MASCOT_FRAMES[i], accents[i]) + '\n');
94
- if (i < MASCOT_FRAMES.length - 1) await sleep(130);
125
+ process.stdout.write(paintFrame(MASCOT_FRAMES[i], palettes[i][0], palettes[i][1]) + '\n');
126
+ if (i < MASCOT_FRAMES.length - 1) await sleep(110);
95
127
  }
96
128
  }
97
129
 
130
+ // Live *-masked input so pasting or typing an API key feels responsive instead of frozen.
131
+ function askMasked(promptText) {
132
+ return new Promise(resolve => {
133
+ if (!process.stdin.isTTY) {
134
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
135
+ rl.question(promptText, ans => { rl.close(); resolve(ans.trim()); });
136
+ return;
137
+ }
138
+ process.stdout.write(promptText);
139
+ const stdin = process.stdin;
140
+ const wasRaw = stdin.isRaw;
141
+ stdin.setRawMode(true);
142
+ stdin.resume();
143
+ stdin.setEncoding('utf8');
144
+ let value = '';
145
+ const cleanup = () => {
146
+ stdin.removeListener('data', onData);
147
+ stdin.setRawMode(Boolean(wasRaw));
148
+ stdin.pause();
149
+ };
150
+ const onData = chunk => {
151
+ for (const ch of chunk) {
152
+ if (ch === '\r' || ch === '\n') {
153
+ cleanup();
154
+ process.stdout.write('\n');
155
+ return resolve(value.trim());
156
+ }
157
+ if (ch === '\u0003') {
158
+ cleanup();
159
+ process.stdout.write('\n');
160
+ process.exit(130);
161
+ }
162
+ if (ch === '\u007f' || ch === '\b') {
163
+ if (value.length > 0) {
164
+ value = value.slice(0, -1);
165
+ process.stdout.write('\b \b');
166
+ }
167
+ continue;
168
+ }
169
+ if (ch >= ' ') {
170
+ value += ch;
171
+ process.stdout.write(c.mint('*'));
172
+ }
173
+ }
174
+ };
175
+ stdin.on('data', onData);
176
+ });
177
+ }
178
+
98
179
  async function withSpinner(label, fn) {
99
180
  if (!USE_COLOR) {
100
181
  process.stdout.write(` ... ${label}\n`);
@@ -104,22 +185,22 @@ async function withSpinner(label, fn) {
104
185
  let idx = 0;
105
186
  const timer = setInterval(() => {
106
187
  process.stdout.write(`\r ${c.cyan(frames[idx++ % frames.length])} ${c.dim(label)}`);
107
- }, 75);
188
+ }, 70);
108
189
  try {
109
190
  const result = await fn();
110
191
  clearInterval(timer);
111
- process.stdout.write(`\r ${c.mint('✔')} ${label}${' '.repeat(12)}\n`);
192
+ process.stdout.write(`\r ${c.mint('✔')} ${label}${' '.repeat(14)}\n`);
112
193
  return result;
113
194
  } catch (error) {
114
195
  clearInterval(timer);
115
- process.stdout.write(`\r ${c.rose('✖')} ${label}${' '.repeat(12)}\n`);
196
+ process.stdout.write(`\r ${c.rose('✖')} ${label}${' '.repeat(14)}\n`);
116
197
  throw error;
117
198
  }
118
199
  }
119
200
 
120
201
  function printCard(title, rows) {
121
202
  const strip = s => String(s).replace(/\x1b\[[0-9;]*m/g, '');
122
- const width = Math.max(44, strip(title).length + 4, ...rows.map(r => strip(r).length + 4));
203
+ const width = Math.max(46, strip(title).length + 4, ...rows.map(r => strip(r).length + 4));
123
204
  const top = ` ${c.violet('╭─')} ${c.bold(c.white(title))} ${c.violet('─'.repeat(Math.max(1, width - strip(title).length - 3)) + '╮')}`;
124
205
  const bot = ` ${c.violet('╰' + '─'.repeat(width + 1) + '╯')}`;
125
206
  console.log('');
@@ -151,10 +232,10 @@ function checkUpdateNotice(currentVersion, labsDir) {
151
232
  } catch { /* ignore corrupt cache */ }
152
233
 
153
234
  if (cached && cached.latest && isNewerVersion(cached.latest, currentVersion)) {
154
- console.log(` ${c.amber('⬆')} ${c.bold(`Update available:`)} ${c.dim(currentVersion)} → ${c.mint(cached.latest)} ${c.dim('Run:')} ${c.cyan('labs update')}`);
235
+ console.log(` ${c.amber('⬆')} ${c.bold('Update available:')} ${c.dim(currentVersion)} → ${c.mint(cached.latest)} ${c.dim('Run:')} ${c.cyan('labs update')}`);
155
236
  }
156
237
 
157
- const stale = !cached || (Date.now() - (cached.checkedAt || 0)) > 24 * 3600e3;
238
+ const stale = !cached || (Date.now() - (cached.checkedAt || 0)) > 6 * 3600e3;
158
239
  if (stale && typeof fetch === 'function') {
159
240
  fetch('https://registry.npmjs.org/labs-claude/latest', { signal: AbortSignal.timeout(2500) })
160
241
  .then(r => (r.ok ? r.json() : null))
@@ -168,14 +249,21 @@ function checkUpdateNotice(currentVersion, labsDir) {
168
249
  }
169
250
 
170
251
  function runSelfUpdate(currentVersion) {
171
- console.log(`\n ${c.cyan('⬆')} Updating ${c.bold('labs-claude')} (current ${c.dim(currentVersion)}) from npm...\n`);
252
+ console.log(`\n ${c.cyan('⬆')} Updating ${c.bold('labs-claude')} (current ${c.dim(currentVersion)}) from npm...`);
253
+ console.log(` ${c.violet('✦')} ${c.dim(randomQuip())}\n`);
172
254
  const cmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
173
255
  const res = spawnSync(cmd, ['install', '-g', 'labs-claude@latest', '--prefer-online'], { stdio: 'inherit', shell: process.platform === 'win32' });
174
256
  if (res.status !== 0) {
175
- console.error(`\n ${c.rose('✖')} Update failed. Try manually: ${c.cyan('npm install -g labs-claude@latest --prefer-online')}`);
257
+ console.error(`\n ${c.rose('✖')} Update failed.`);
258
+ if (process.platform !== 'win32') {
259
+ console.error(` ${c.amber('💡 Mac/Linux fix (if you saw EACCES on ~/.npm):')}`);
260
+ console.error(` ${c.cyan('sudo chown -R $(whoami) ~/.npm && npm install -g labs-claude@latest --prefer-online')}\n`);
261
+ } else {
262
+ console.error(` Try manually: ${c.cyan('npm install -g labs-claude@latest --prefer-online')}\n`);
263
+ }
176
264
  process.exit(res.status || 1);
177
265
  }
178
- console.log(`\n ${c.mint('✔')} Updated! Close and reopen any open labs terminals to use the new version.\n`);
266
+ console.log(`\n ${c.mint('✔')} Updated to latest! Close and reopen any open labs terminals.\n`);
179
267
  }
180
268
 
181
- module.exports = { c, KARPATHY_QUIPS, randomQuip, playMascotIntro, withSpinner, printCard, isNewerVersion, checkUpdateNotice, runSelfUpdate };
269
+ module.exports = { c, gradient, CHILL_QUIPS, randomQuip, playMascotIntro, askMasked, withSpinner, printCard, isNewerVersion, checkUpdateNotice, runSelfUpdate };