shiroai 2.0.3 → 2.0.5
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/cli.js +38 -5
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -16,8 +16,19 @@ const c = {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
// ===== CONFIG =====
|
|
19
|
-
const API_URL = 'https://
|
|
20
|
-
const
|
|
19
|
+
const API_URL = 'https://inference.do-ai.run/v1/chat/completions';
|
|
20
|
+
const MODELS = [
|
|
21
|
+
'openai-gpt-oss-120b',
|
|
22
|
+
'anthropic-claude-3.5-sonnet',
|
|
23
|
+
'anthropic-claude-sonnet-4',
|
|
24
|
+
'meta-llama-3.1-405b-instruct',
|
|
25
|
+
'deepseek-r1',
|
|
26
|
+
'deepseek-v3',
|
|
27
|
+
'qwen-2.5-72b-instruct',
|
|
28
|
+
'llama-3.3-70b-instruct',
|
|
29
|
+
'deepseek-r1-distill-llama-70b',
|
|
30
|
+
'mistral-small-3.2-24b-instruct',
|
|
31
|
+
];
|
|
21
32
|
const CWD = process.cwd();
|
|
22
33
|
const CONFIG_DIR = path.join(os.homedir(), '.shiroai');
|
|
23
34
|
const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
|
|
@@ -32,6 +43,7 @@ const AGENTS_DIR = path.join(CONFIG_DIR, 'agents');
|
|
|
32
43
|
function loadConfig() { try { return JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8')); } catch { return {}; } }
|
|
33
44
|
function saveConfig(cfg) { fs.writeFileSync(CONFIG_FILE, JSON.stringify(cfg, null, 2)); }
|
|
34
45
|
let config = loadConfig();
|
|
46
|
+
let MODEL = config.model || 'openai-gpt-oss-120b';
|
|
35
47
|
|
|
36
48
|
// ===== CLI ARGS =====
|
|
37
49
|
const args = process.argv.slice(2);
|
|
@@ -263,11 +275,11 @@ initMessages();
|
|
|
263
275
|
function streamChat(msgs, tools) {
|
|
264
276
|
return new Promise((resolve, reject) => {
|
|
265
277
|
const payload = {
|
|
278
|
+
model: MODEL,
|
|
266
279
|
messages: msgs,
|
|
267
280
|
stream: true,
|
|
268
281
|
max_tokens: 8192
|
|
269
282
|
};
|
|
270
|
-
if (MODEL) payload.model = MODEL;
|
|
271
283
|
if (tools && tools.length) payload.tools = tools;
|
|
272
284
|
const body = JSON.stringify(payload);
|
|
273
285
|
const url = new URL(API_URL);
|
|
@@ -280,7 +292,7 @@ function streamChat(msgs, tools) {
|
|
|
280
292
|
method: 'POST',
|
|
281
293
|
headers: {
|
|
282
294
|
'Content-Type': 'application/json',
|
|
283
|
-
'Authorization': 'Bearer
|
|
295
|
+
'Authorization': 'Bearer doo_v1_c1723ee6ceca27f7c2ac2dfa896e6f40ec36d88668ca921eccd81591314b4bd2',
|
|
284
296
|
'Content-Length': Buffer.byteLength(body)
|
|
285
297
|
}
|
|
286
298
|
}, res => {
|
|
@@ -479,13 +491,17 @@ function showContext() {
|
|
|
479
491
|
function header() {
|
|
480
492
|
console.log(`\n${c.bold}${c.green} ✦ ShiroAI${c.r} ${c.dim}v2.0.0${c.r}`);
|
|
481
493
|
console.log(`${c.dim} ${CWD}${c.r}`);
|
|
482
|
-
console.log(`${c.dim} Agent: ${currentAgent.name} | Model:
|
|
494
|
+
console.log(`${c.dim} Agent: ${currentAgent.name} | Model: ${MODEL}${c.r}`);
|
|
483
495
|
console.log(`${c.dim} /help for commands${c.r}\n`);
|
|
484
496
|
}
|
|
485
497
|
|
|
486
498
|
function showHelp() {
|
|
487
499
|
console.log(`${c.bold}Commands:${c.r}`);
|
|
488
500
|
console.log(` ${c.cyan}/help${c.r} Show this help`);
|
|
501
|
+
console.log(` ${c.cyan}/model${c.r} Show current model`);
|
|
502
|
+
console.log(` ${c.cyan}/model list${c.r} List available models`);
|
|
503
|
+
console.log(` ${c.cyan}/model <name>${c.r} Switch model`);
|
|
504
|
+
console.log(` ${c.cyan}/auto${c.r} Use default model`);
|
|
489
505
|
console.log(` ${c.cyan}/context${c.r} Show context info`);
|
|
490
506
|
console.log(` ${c.cyan}/context add <f>${c.r} Add file to context`);
|
|
491
507
|
console.log(` ${c.cyan}/chat save <name>${c.r} Save session`);
|
|
@@ -549,6 +565,23 @@ function prompt() {
|
|
|
549
565
|
return prompt();
|
|
550
566
|
}
|
|
551
567
|
|
|
568
|
+
// Model commands
|
|
569
|
+
if (input === '/model') { console.log(`${c.dim}Current model: ${c.cyan}${MODEL}${c.r}`); return prompt(); }
|
|
570
|
+
if (input === '/model list') {
|
|
571
|
+
console.log(`${c.bold}Available models:${c.r}`);
|
|
572
|
+
MODELS.forEach((m, i) => console.log(` ${m === MODEL ? c.green + '● ' : ' '}${c.cyan}${m}${c.r}`));
|
|
573
|
+
console.log(`\n${c.dim} Use: /model <name>${c.r}`);
|
|
574
|
+
return prompt();
|
|
575
|
+
}
|
|
576
|
+
if (input === '/auto') { MODEL = 'openai-gpt-oss-120b'; config.model = MODEL; saveConfig(config); console.log(`${c.green}✓ Model: ${MODEL} (auto)${c.r}`); return prompt(); }
|
|
577
|
+
if (input.startsWith('/model ')) {
|
|
578
|
+
const name = input.slice(7).trim();
|
|
579
|
+
const match = MODELS.find(m => m.includes(name));
|
|
580
|
+
if (match) { MODEL = match; config.model = MODEL; saveConfig(config); console.log(`${c.green}✓ Model switched: ${MODEL}${c.r}`); }
|
|
581
|
+
else { console.log(`${c.red}Model not found. Use /model list${c.r}`); }
|
|
582
|
+
return prompt();
|
|
583
|
+
}
|
|
584
|
+
|
|
552
585
|
// Regular chat with tool use
|
|
553
586
|
await chat(input);
|
|
554
587
|
prompt();
|