labs-claude 0.12.0 → 0.12.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/admin-cli.js +148 -38
- package/src/gateway-client.js +36 -15
- package/src/modpack.js +5 -0
package/bin/labs.js
CHANGED
package/package.json
CHANGED
package/src/admin-cli.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
// Cracked-engineer terminal-native Admin Control Room (`labs admin`).
|
|
2
2
|
// Zero browser needed: mint friend keys, pause/resume/revoke, and inspect live per-friend token bars in your terminal.
|
|
3
3
|
const axios = require('axios');
|
|
4
|
+
const https = require('https');
|
|
4
5
|
const fs = require('fs');
|
|
5
6
|
const path = require('path');
|
|
6
|
-
const { spawn,
|
|
7
|
+
const { spawn, execFile } = require('child_process');
|
|
8
|
+
const { promisify } = require('util');
|
|
9
|
+
const execFileAsync = promisify(execFile);
|
|
7
10
|
const { LABS_DIR } = require('./config');
|
|
8
11
|
const { storedConfig } = require('./gateway-client');
|
|
9
12
|
const { c, sparkline, randomQuip, playMascotIntro, withSpinner, printCard } = require('./ui');
|
|
@@ -58,10 +61,30 @@ function readAdminToken() {
|
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
function createAdminApi(url, token) {
|
|
61
|
-
const
|
|
64
|
+
const httpsAgent = new https.Agent({ keepAlive: true, maxSockets: 2, family: 4 });
|
|
65
|
+
const client = axios.create({
|
|
66
|
+
baseURL: `${url}/admin/api`,
|
|
67
|
+
headers: { authorization: `Bearer ${token}` },
|
|
68
|
+
timeout: 8000,
|
|
69
|
+
httpsAgent,
|
|
70
|
+
});
|
|
71
|
+
async function callWithRetry(fn, retries = 2) {
|
|
72
|
+
let lastErr;
|
|
73
|
+
for (let i = 0; i <= retries; i += 1) {
|
|
74
|
+
try {
|
|
75
|
+
return (await fn()).data;
|
|
76
|
+
} catch (err) {
|
|
77
|
+
lastErr = err;
|
|
78
|
+
const status = err?.response?.status;
|
|
79
|
+
if (status && status < 500) throw err;
|
|
80
|
+
if (i < retries) await new Promise(r => setTimeout(r, 400 * (i + 1)));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
throw lastErr;
|
|
84
|
+
}
|
|
62
85
|
return {
|
|
63
|
-
get: p =>
|
|
64
|
-
post: (p, body) =>
|
|
86
|
+
get: p => callWithRetry(() => client.get(p)),
|
|
87
|
+
post: (p, body) => callWithRetry(() => client.post(p, body)),
|
|
65
88
|
};
|
|
66
89
|
}
|
|
67
90
|
|
|
@@ -71,7 +94,20 @@ function resolveKeyTarget(keys, target) {
|
|
|
71
94
|
return keys.find(k => String(k.id) === raw || k.name.toLowerCase() === raw.toLowerCase()) || null;
|
|
72
95
|
}
|
|
73
96
|
|
|
74
|
-
function
|
|
97
|
+
function formatBoxStatus(box, ec2State) {
|
|
98
|
+
const st = ec2State ? String(ec2State).toLowerCase() : null;
|
|
99
|
+
if (st === 'stopped') return c.rose('SLEEPING ($0/hr)');
|
|
100
|
+
if (st === 'stopping' || st === 'shutting-down') return c.amber('STOPPING...');
|
|
101
|
+
if (st === 'pending') return c.amber('BOOTING (ec2 pending)');
|
|
102
|
+
if (st === 'running' && !box?.up) return c.amber('BOOTING (loading Qwen4...)');
|
|
103
|
+
if (box?.up) {
|
|
104
|
+
const models = (box.models || []).join(', ');
|
|
105
|
+
return `${c.mint('ONLINE')}${models ? ` ${c.dim(`(${models})`)}` : ''}`;
|
|
106
|
+
}
|
|
107
|
+
return c.rose('SLEEPING');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function renderDashboard(keys, usageRows, box, ec2State = null) {
|
|
75
111
|
const todayStr = new Date(Date.now() + 5 * 3600e3).toISOString().slice(0, 10);
|
|
76
112
|
const todayRows = usageRows.filter(r => r.day === todayStr);
|
|
77
113
|
const todayIn = todayRows.reduce((s, r) => s + r.input, 0);
|
|
@@ -93,9 +129,7 @@ function renderDashboard(keys, usageRows, box) {
|
|
|
93
129
|
last7.push(byDay[d] || 0);
|
|
94
130
|
}
|
|
95
131
|
|
|
96
|
-
const boxPill = box
|
|
97
|
-
? `${c.mint('ONLINE')} ${c.dim(`(${box.models.join(', ')})`)}`
|
|
98
|
-
: `${c.rose('SLEEPING')}`;
|
|
132
|
+
const boxPill = formatBoxStatus(box, ec2State);
|
|
99
133
|
|
|
100
134
|
printCard('LABS ADMIN CONTROL ROOM', [
|
|
101
135
|
`${c.dim('gpu box:')} ${boxPill} ${c.dim('7d trend:')} ${sparkline(last7)}`,
|
|
@@ -178,53 +212,119 @@ function awsBoxArgs(cfg) {
|
|
|
178
212
|
};
|
|
179
213
|
}
|
|
180
214
|
|
|
181
|
-
function runAws(args) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
215
|
+
async function runAws(args, timeout = 15000) {
|
|
216
|
+
try {
|
|
217
|
+
const { stdout } = await execFileAsync('aws', args, { encoding: 'utf8', timeout, windowsHide: true });
|
|
218
|
+
return (stdout || '').trim();
|
|
219
|
+
} catch (err) {
|
|
220
|
+
const msg = (err.stderr || err.stdout || err.message || 'aws command failed').trim();
|
|
221
|
+
throw new Error(msg);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
async function getEc2State(cfg, runAwsFn = runAws) {
|
|
226
|
+
const { instanceId, region } = awsBoxArgs(cfg);
|
|
227
|
+
try {
|
|
228
|
+
const out = await runAwsFn([
|
|
229
|
+
'ec2', 'describe-instances',
|
|
230
|
+
'--region', region,
|
|
231
|
+
'--instance-ids', instanceId,
|
|
232
|
+
'--query', 'Reservations[0].Instances[0].State.Name',
|
|
233
|
+
'--output', 'text',
|
|
234
|
+
], 6000);
|
|
235
|
+
return out && out !== 'None' ? out.trim().toLowerCase() : null;
|
|
236
|
+
} catch {
|
|
237
|
+
return null;
|
|
185
238
|
}
|
|
186
|
-
return (res.stdout || '').trim();
|
|
187
239
|
}
|
|
188
240
|
|
|
189
|
-
|
|
241
|
+
function fmtElapsed(ms) {
|
|
242
|
+
const elapsed = Math.max(0, Math.floor(ms / 1000));
|
|
243
|
+
const mm = String(Math.floor(elapsed / 60)).padStart(2, '0');
|
|
244
|
+
const ss = String(elapsed % 60).padStart(2, '0');
|
|
245
|
+
return `${mm}:${ss}`;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
async function wakeGpuBox(api, cfg, deps = {}) {
|
|
249
|
+
const runAwsFn = deps.runAws || runAws;
|
|
250
|
+
const sleepFn = deps.sleep || (ms => new Promise(r => setTimeout(r, ms)));
|
|
251
|
+
const pollMs = deps.pollMs ?? 5000;
|
|
252
|
+
const maxMs = deps.maxMs ?? (6 * 60 * 1000);
|
|
190
253
|
const { instanceId, region } = awsBoxArgs(cfg);
|
|
254
|
+
|
|
255
|
+
const preState = await getEc2State(cfg, runAwsFn);
|
|
256
|
+
if (preState === 'running') {
|
|
257
|
+
try {
|
|
258
|
+
const box = await api.get('/box');
|
|
259
|
+
if (box?.up) {
|
|
260
|
+
console.log(` ${c.mint('● ONLINE')} ${c.bold(instanceId)} is already up — ${c.cyan((box.models || []).join(', '))}\n`);
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
} catch { /* still booting */ }
|
|
264
|
+
}
|
|
265
|
+
|
|
191
266
|
await withSpinner(`Starting GPU box ${c.cyan(instanceId)} (${region})...`, async () => {
|
|
192
|
-
|
|
267
|
+
await runAwsFn(['ec2', 'start-instances', '--region', region, '--instance-ids', instanceId]);
|
|
193
268
|
});
|
|
194
269
|
console.log(` ${c.mint('✔')} EC2 start sent. Waiting for Qwen4-35B-A3B 1M + DFlash2 auto-boot (~3–4 min)...`);
|
|
195
270
|
const t0 = Date.now();
|
|
196
|
-
const maxMs = 6 * 60 * 1000;
|
|
197
271
|
while (Date.now() - t0 < maxMs) {
|
|
198
|
-
const
|
|
199
|
-
const
|
|
200
|
-
const ss = String(elapsed % 60).padStart(2, '0');
|
|
272
|
+
const elapsedStr = fmtElapsed(Date.now() - t0);
|
|
273
|
+
const ec2State = await getEc2State(cfg, runAwsFn);
|
|
201
274
|
try {
|
|
202
275
|
const box = await api.get('/box');
|
|
203
|
-
if (box?.up) {
|
|
204
|
-
process.stdout.write(`\r ${c.mint('● ONLINE')} in ${c.bold(
|
|
276
|
+
if (box?.up && (!ec2State || ec2State === 'running')) {
|
|
277
|
+
process.stdout.write(`\r ${c.mint('● ONLINE')} in ${c.bold(elapsedStr)} — ${c.cyan((box.models || []).join(', '))}${' '.repeat(24)}\n\n`);
|
|
205
278
|
return true;
|
|
206
279
|
}
|
|
207
280
|
} catch { /* gateway still waiting on tunnel */ }
|
|
208
281
|
if (process.stdout.isTTY) {
|
|
209
|
-
|
|
282
|
+
const phase = ec2State === 'pending'
|
|
283
|
+
? 'EC2 booting (pending)...'
|
|
284
|
+
: 'loading Qwen4 weights & warming CUDA graphs...';
|
|
285
|
+
process.stdout.write(`\r ${c.cyan('⏳')} ${elapsedStr} · ${phase}${' '.repeat(12)}`);
|
|
210
286
|
}
|
|
211
|
-
await
|
|
287
|
+
await sleepFn(pollMs);
|
|
212
288
|
}
|
|
213
289
|
console.log(`\n ${c.amber('!')} Still booting after 6m — check ${c.cyan('labs admin stats')} in a minute.\n`);
|
|
214
290
|
return false;
|
|
215
291
|
}
|
|
216
292
|
|
|
217
|
-
async function sleepGpuBox(cfg, ask) {
|
|
293
|
+
async function sleepGpuBox(api, cfg, ask, deps = {}) {
|
|
294
|
+
const runAwsFn = deps.runAws || runAws;
|
|
295
|
+
const sleepFn = deps.sleep || (ms => new Promise(r => setTimeout(r, ms)));
|
|
296
|
+
const pollMs = deps.pollMs ?? 3000;
|
|
297
|
+
const maxMs = deps.maxMs ?? (3 * 60 * 1000);
|
|
218
298
|
const { instanceId, region } = awsBoxArgs(cfg);
|
|
299
|
+
|
|
300
|
+
const preState = await getEc2State(cfg, runAwsFn);
|
|
301
|
+
if (preState === 'stopped') {
|
|
302
|
+
console.log(` ${c.mint('✔')} ${c.bold(instanceId)} is already ${c.rose('STOPPED')} ($0/hr compute).\n`);
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
305
|
+
|
|
219
306
|
const confirm = (await ask(` ${c.amber('!')} Stop GPU box ${c.bold(instanceId)} (${region}) to stop hourly billing? Type YES: `)).trim();
|
|
220
307
|
if (confirm !== 'YES') {
|
|
221
308
|
console.log(` ${c.dim('Cancelled.')}\n`);
|
|
222
309
|
return false;
|
|
223
310
|
}
|
|
224
|
-
await withSpinner(`
|
|
225
|
-
|
|
311
|
+
await withSpinner(`Sending stop signal to ${c.cyan(instanceId)}...`, async () => {
|
|
312
|
+
await runAwsFn(['ec2', 'stop-instances', '--region', region, '--instance-ids', instanceId]);
|
|
226
313
|
});
|
|
227
|
-
|
|
314
|
+
const t0 = Date.now();
|
|
315
|
+
while (Date.now() - t0 < maxMs) {
|
|
316
|
+
const elapsedStr = fmtElapsed(Date.now() - t0);
|
|
317
|
+
const ec2State = await getEc2State(cfg, runAwsFn);
|
|
318
|
+
if (ec2State === 'stopped') {
|
|
319
|
+
process.stdout.write(`\r ${c.rose('● STOPPED')} in ${c.bold(elapsedStr)} — ${c.bold(instanceId)} is at $0/hr compute. Wake anytime with ${c.cyan('labs admin wake')}.${' '.repeat(10)}\n\n`);
|
|
320
|
+
return true;
|
|
321
|
+
}
|
|
322
|
+
if (process.stdout.isTTY) {
|
|
323
|
+
process.stdout.write(`\r ${c.amber('⏳')} ${elapsedStr} · EC2 state: ${ec2State || 'stopping'} (waiting for full shutdown)...`);
|
|
324
|
+
}
|
|
325
|
+
await sleepFn(pollMs);
|
|
326
|
+
}
|
|
327
|
+
console.log(`\n ${c.amber('!')} Stop signal was accepted, still shutting down after 3m — press ${c.cyan('6')} to refresh.\n`);
|
|
228
328
|
return true;
|
|
229
329
|
}
|
|
230
330
|
|
|
@@ -258,20 +358,25 @@ async function runAdminCli(args, ask) {
|
|
|
258
358
|
}
|
|
259
359
|
if (sub === 'sleep' || sub === 'off' || sub === 'stop') {
|
|
260
360
|
await playMascotIntro(version, 'Admin · GPU Box Sleep');
|
|
261
|
-
await sleepGpuBox(cfg, ask);
|
|
361
|
+
await sleepGpuBox(api, cfg, ask);
|
|
262
362
|
return;
|
|
263
363
|
}
|
|
264
364
|
|
|
265
365
|
await playMascotIntro(version, `Admin Control Room · ${url}`);
|
|
266
366
|
|
|
267
367
|
const loadAll = async (days = 14) => withSpinner(randomQuip(), async () => {
|
|
268
|
-
const [k, u, b] = await Promise.all([
|
|
269
|
-
|
|
368
|
+
const [k, u, b, ec2State] = await Promise.all([
|
|
369
|
+
api.get('/keys'),
|
|
370
|
+
api.get(`/usage?days=${days}`),
|
|
371
|
+
api.get('/box').catch(() => ({ up: false, models: [] })),
|
|
372
|
+
getEc2State(cfg),
|
|
373
|
+
]);
|
|
374
|
+
return { keys: k.keys || [], rows: u.rows || [], box: b || { up: false, models: [] }, ec2State };
|
|
270
375
|
});
|
|
271
376
|
|
|
272
377
|
if (sub === 'stats' || sub === 'ls' || sub === 'list') {
|
|
273
|
-
const { keys, rows, box } = await loadAll(14);
|
|
274
|
-
renderDashboard(keys, rows, box);
|
|
378
|
+
const { keys, rows, box, ec2State } = await loadAll(14);
|
|
379
|
+
renderDashboard(keys, rows, box, ec2State);
|
|
275
380
|
return;
|
|
276
381
|
}
|
|
277
382
|
if (sub === 'usage') {
|
|
@@ -296,13 +401,18 @@ async function runAdminCli(args, ask) {
|
|
|
296
401
|
|
|
297
402
|
if (sub === 'watch' || sub === 'live') {
|
|
298
403
|
const fetchState = async () => {
|
|
299
|
-
const [k, u, b] = await Promise.all([
|
|
300
|
-
|
|
404
|
+
const [k, u, b, ec2State] = await Promise.all([
|
|
405
|
+
api.get('/keys'),
|
|
406
|
+
api.get('/usage?days=14'),
|
|
407
|
+
api.get('/box'),
|
|
408
|
+
getEc2State(cfg),
|
|
409
|
+
]);
|
|
410
|
+
return { keys: k.keys || [], rows: u.rows || [], box: b || { up: false, models: [] }, ec2State };
|
|
301
411
|
};
|
|
302
412
|
const renderLive = async () => {
|
|
303
413
|
const st = await fetchState();
|
|
304
414
|
process.stdout.write('\x1b[2J\x1b[H');
|
|
305
|
-
renderDashboard(st.keys, st.rows, st.box);
|
|
415
|
+
renderDashboard(st.keys, st.rows, st.box, st.ec2State);
|
|
306
416
|
console.log(` ${c.dim('live watch mode (refreshing every 3s) · press Ctrl+C to exit')}\n`);
|
|
307
417
|
};
|
|
308
418
|
await renderLive();
|
|
@@ -314,7 +424,7 @@ async function runAdminCli(args, ask) {
|
|
|
314
424
|
// Interactive menu loop
|
|
315
425
|
let state = await loadAll(14);
|
|
316
426
|
while (true) {
|
|
317
|
-
renderDashboard(state.keys, state.rows, state.box);
|
|
427
|
+
renderDashboard(state.keys, state.rows, state.box, state.ec2State);
|
|
318
428
|
console.log(` ${c.bold('actions:')}`);
|
|
319
429
|
console.log(` ${c.cyan('1.')} mint new friend api key ${c.cyan('4.')} revoke (delete) a key ${c.mint('7.')} wake gpu box (on)`);
|
|
320
430
|
console.log(` ${c.cyan('2.')} pause a key ${c.cyan('5.')} daily token table (14d) ${c.rose('8.')} stop gpu box (off)`);
|
|
@@ -330,7 +440,7 @@ async function runAdminCli(args, ask) {
|
|
|
330
440
|
continue;
|
|
331
441
|
}
|
|
332
442
|
if (choice === '8') {
|
|
333
|
-
await sleepGpuBox(cfg, ask);
|
|
443
|
+
await sleepGpuBox(api, cfg, ask);
|
|
334
444
|
state = await loadAll(14);
|
|
335
445
|
continue;
|
|
336
446
|
}
|
|
@@ -365,4 +475,4 @@ async function runAdminCli(args, ask) {
|
|
|
365
475
|
}
|
|
366
476
|
}
|
|
367
477
|
|
|
368
|
-
module.exports = { compactTokens, barChart, resolveKeyTarget, runAdminCli };
|
|
478
|
+
module.exports = { compactTokens, barChart, resolveKeyTarget, formatBoxStatus, getEc2State, sleepGpuBox, wakeGpuBox, runAdminCli };
|
package/src/gateway-client.js
CHANGED
|
@@ -19,6 +19,7 @@ const GATEWAY_MODELS = {
|
|
|
19
19
|
};
|
|
20
20
|
const DEFAULT_GATEWAY_URL = 'https://labs.instant.uz';
|
|
21
21
|
const ADMIN_TOKEN_FILE = path.join(LABS_DIR, 'gateway-admin');
|
|
22
|
+
const BOX_SETTINGS_FILE = path.join(LABS_DIR, 'box-settings.json');
|
|
22
23
|
// Same capability list the box's own claude-local uses, so /effort, xhigh, max, and thinking work on Qwen4.
|
|
23
24
|
const CAPS = 'effort,xhigh_effort,max_effort,thinking,interleaved_thinking';
|
|
24
25
|
|
|
@@ -199,32 +200,52 @@ async function prepareGatewayLaunch(config, args, picked) {
|
|
|
199
200
|
|
|
200
201
|
const claudeArgs = args.filter((_, i) => i !== picked.index && (picked.inline || i !== picked.index + 1));
|
|
201
202
|
if (!claudeArgs.some(a => a === '--effort' || a.startsWith('--effort='))) claudeArgs.push('--effort', config.defaultEffort || 'high');
|
|
202
|
-
const
|
|
203
|
-
const
|
|
203
|
+
const ctxLabelFor = m => ((m?.max_model_len || 131072) >= 1000000 ? '1m context' : `${Math.round((m?.max_model_len || 131072) / 1000)}k context`);
|
|
204
|
+
const labelFor = id => (id === 'qwen-uncensored' ? 'Qwen4-35B-A3B (uncensored)' : id === 'qwen-normal' ? 'Qwen4-35B-A3B' : id);
|
|
205
|
+
const ctxLabel = ctxLabelFor(model);
|
|
206
|
+
const displayName = labelFor(picked.id);
|
|
207
|
+
|
|
208
|
+
// Replace Claude Code's built-in Opus/Fable/Sonnet/Haiku picker rows with our real live LABS models only.
|
|
209
|
+
const pickerOptions = models.map(m => ({
|
|
210
|
+
model: m.id,
|
|
211
|
+
label: labelFor(m.id),
|
|
212
|
+
description: `${ctxLabelFor(m)} · vision · web · 200-400 tok/s`,
|
|
213
|
+
}));
|
|
214
|
+
fs.mkdirSync(LABS_DIR, { recursive: true });
|
|
215
|
+
fs.writeFileSync(BOX_SETTINGS_FILE, JSON.stringify({
|
|
216
|
+
model: picked.id,
|
|
217
|
+
availableModels: models.map(m => m.id),
|
|
218
|
+
modelPicker: {
|
|
219
|
+
replaceBuiltInOptions: true,
|
|
220
|
+
options: pickerOptions,
|
|
221
|
+
},
|
|
222
|
+
}, null, 2) + '\n', 'utf8');
|
|
223
|
+
if (!claudeArgs.some(a => a === '--settings' || a.startsWith('--settings='))) {
|
|
224
|
+
claudeArgs.push('--settings', BOX_SETTINGS_FILE);
|
|
225
|
+
}
|
|
226
|
+
|
|
204
227
|
const env = {
|
|
205
228
|
...process.env,
|
|
206
229
|
ANTHROPIC_BASE_URL: url,
|
|
207
230
|
ANTHROPIC_AUTH_TOKEN: config.gatewayKey,
|
|
208
|
-
//
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
ANTHROPIC_CUSTOM_MODEL_OPTION_NAME: displayName,
|
|
214
|
-
ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION: `${displayName} · ${ctxLabel} · vision · web · 200-400 tok/s`,
|
|
215
|
-
ANTHROPIC_DEFAULT_OPUS_MODEL: 'claude-opus-4-6',
|
|
216
|
-
ANTHROPIC_DEFAULT_SONNET_MODEL: 'claude-sonnet-4-6',
|
|
217
|
-
ANTHROPIC_DEFAULT_HAIKU_MODEL: 'claude-haiku-4-5',
|
|
231
|
+
// Real LABS model IDs everywhere so header, /model, subagents, and mid-session switches are 100% honest.
|
|
232
|
+
ANTHROPIC_MODEL: picked.id,
|
|
233
|
+
ANTHROPIC_DEFAULT_OPUS_MODEL: picked.id,
|
|
234
|
+
ANTHROPIC_DEFAULT_SONNET_MODEL: picked.id,
|
|
235
|
+
ANTHROPIC_DEFAULT_HAIKU_MODEL: picked.id,
|
|
218
236
|
ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES: CAPS,
|
|
219
237
|
ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES: CAPS,
|
|
220
238
|
ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES: CAPS,
|
|
221
|
-
|
|
222
|
-
CLAUDE_CODE_SUBAGENT_MODEL: 'claude-opus-4-6',
|
|
239
|
+
CLAUDE_CODE_SUBAGENT_MODEL: picked.id,
|
|
223
240
|
CLAUDE_CODE_MAX_CONTEXT_TOKENS: String(model.max_model_len || 131072),
|
|
224
241
|
// Qwen4 is a 1M-context model; without this Claude Code caps output at 128k and errors on long replies.
|
|
225
242
|
CLAUDE_CODE_MAX_OUTPUT_TOKENS: '262144'
|
|
226
243
|
};
|
|
227
244
|
delete env.ANTHROPIC_API_KEY;
|
|
245
|
+
delete env.ANTHROPIC_CUSTOM_HEADERS;
|
|
246
|
+
delete env.ANTHROPIC_CUSTOM_MODEL_OPTION;
|
|
247
|
+
delete env.ANTHROPIC_CUSTOM_MODEL_OPTION_NAME;
|
|
248
|
+
delete env.ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION;
|
|
228
249
|
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))}`;
|
|
229
250
|
// Qwen cannot use Claude Code's WebSearch (an Anthropic server tool); give it a search tool that runs here instead.
|
|
230
251
|
if (!claudeArgs.some(a => a === '--strict-mcp-config')) claudeArgs.push(...require('./web-mcp').webMcpArgs());
|
|
@@ -256,4 +277,4 @@ function openConsole(config) {
|
|
|
256
277
|
console.log(`🖥️ Opening the console at ${config.gatewayUrl || DEFAULT_GATEWAY_URL}/console, already logged in.`);
|
|
257
278
|
}
|
|
258
279
|
|
|
259
|
-
module.exports = { boxOnlyArgs, GATEWAY_MODELS, gatewayModelFrom, prepareGatewayLaunch, saveGatewayKey, makeAdminToken, openConsole, storedConfig };
|
|
280
|
+
module.exports = { boxOnlyArgs, BOX_SETTINGS_FILE, GATEWAY_MODELS, gatewayModelFrom, prepareGatewayLaunch, saveGatewayKey, makeAdminToken, openConsole, storedConfig };
|
package/src/modpack.js
CHANGED
|
@@ -124,6 +124,11 @@ Bug: $ARGUMENTS
|
|
|
124
124
|
2. Read \`~/.labs/learnings.md\` (create if missing).
|
|
125
125
|
3. Add at most 2 short, concrete, verified rules (1 line each) that prevent a real failure we just observed.
|
|
126
126
|
4. Prune any stale, vague, or redundant lines so \`learnings.md\` stays under 30 lines total (zero prompt bloat).
|
|
127
|
+
`,
|
|
128
|
+
'models.md': `Show only the real LABS models available on this session (never list fake Anthropic models):
|
|
129
|
+
1. Read \`~/.labs/box-settings.json\` if it exists and display the currently active model and every live LABS model listed under \`modelPicker.options\` (ID, label, description) in a clean compact list.
|
|
130
|
+
2. Tell the user they can switch live inside chat with \`/model qwen-normal\` or \`/model qwen-uncensored\` (or open the cleaned \`/model\` picker), and adjust thinking depth with \`/effort low | high | xhigh | max\`.
|
|
131
|
+
3. If the user passed a model name in \`$ARGUMENTS\`, tell them the exact \`/model <id>\` command to run right now.
|
|
127
132
|
`,
|
|
128
133
|
};
|
|
129
134
|
|