labs-claude 0.12.1 → 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/package.json +1 -1
- package/src/gateway-client.js +36 -15
- package/src/modpack.js +5 -0
package/package.json
CHANGED
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
|
|