@robota-sdk/agent-cli 3.0.0-beta.22 → 3.0.0-beta.24
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/dist/node/bin.cjs +69 -17
- package/dist/node/bin.js +1 -1
- package/dist/node/{chunk-RE4JCNEA.js → chunk-AKNLV5UA.js} +69 -17
- package/dist/node/index.cjs +69 -17
- package/dist/node/index.js +1 -1
- package/package.json +3 -3
package/dist/node/bin.cjs
CHANGED
|
@@ -60,6 +60,7 @@ function parseCliArgs() {
|
|
|
60
60
|
c: { type: "boolean", short: "c", default: false },
|
|
61
61
|
r: { type: "string", short: "r" },
|
|
62
62
|
model: { type: "string" },
|
|
63
|
+
language: { type: "string" },
|
|
63
64
|
"permission-mode": { type: "string" },
|
|
64
65
|
"max-turns": { type: "string" },
|
|
65
66
|
version: { type: "boolean", default: false },
|
|
@@ -72,6 +73,7 @@ function parseCliArgs() {
|
|
|
72
73
|
continueMode: values["c"] ?? false,
|
|
73
74
|
resumeId: values["r"],
|
|
74
75
|
model: values["model"],
|
|
76
|
+
language: values["language"],
|
|
75
77
|
permissionMode: parsePermissionMode(values["permission-mode"]),
|
|
76
78
|
maxTurns: parseMaxTurns(values["max-turns"]),
|
|
77
79
|
version: values["version"] ?? false,
|
|
@@ -290,6 +292,7 @@ var HELP_TEXT = [
|
|
|
290
292
|
" /clear \u2014 Clear conversation",
|
|
291
293
|
" /compact [instr] \u2014 Compact context (optional focus instructions)",
|
|
292
294
|
" /mode [m] \u2014 Show/change permission mode",
|
|
295
|
+
" /language [lang] \u2014 Set response language (ko, en, ja, zh)",
|
|
293
296
|
" /cost \u2014 Show session info",
|
|
294
297
|
" /reset \u2014 Delete settings and exit",
|
|
295
298
|
" /exit \u2014 Exit CLI"
|
|
@@ -362,6 +365,18 @@ function handleContext(session, addMessage) {
|
|
|
362
365
|
});
|
|
363
366
|
return { handled: true };
|
|
364
367
|
}
|
|
368
|
+
function handleLanguage(lang, addMessage) {
|
|
369
|
+
if (!lang) {
|
|
370
|
+
addMessage({ role: "system", content: "Usage: /language <code> (e.g., ko, en, ja, zh)" });
|
|
371
|
+
return { handled: true };
|
|
372
|
+
}
|
|
373
|
+
const settingsPath = getUserSettingsPath();
|
|
374
|
+
const settings = readSettings(settingsPath);
|
|
375
|
+
settings.language = lang;
|
|
376
|
+
writeSettings(settingsPath, settings);
|
|
377
|
+
addMessage({ role: "system", content: `Language set to "${lang}". Restarting...` });
|
|
378
|
+
return { handled: true, exitRequested: true };
|
|
379
|
+
}
|
|
365
380
|
function handleReset(addMessage) {
|
|
366
381
|
const settingsPath = getUserSettingsPath();
|
|
367
382
|
if (deleteSettings(settingsPath)) {
|
|
@@ -383,6 +398,8 @@ async function executeSlashCommand(cmd, args, session, addMessage, clearMessages
|
|
|
383
398
|
return handleMode(args.split(/\s+/)[0] || void 0, session, addMessage);
|
|
384
399
|
case "model":
|
|
385
400
|
return handleModel(args.split(/\s+/)[0] || void 0, addMessage);
|
|
401
|
+
case "language":
|
|
402
|
+
return handleLanguage(args.split(/\s+/)[0] || void 0, addMessage);
|
|
386
403
|
case "cost":
|
|
387
404
|
return handleCost(session, addMessage);
|
|
388
405
|
case "permissions":
|
|
@@ -600,6 +617,17 @@ function createBuiltinCommands() {
|
|
|
600
617
|
source: "builtin",
|
|
601
618
|
subcommands: buildModelSubcommands()
|
|
602
619
|
},
|
|
620
|
+
{
|
|
621
|
+
name: "language",
|
|
622
|
+
description: "Set response language",
|
|
623
|
+
source: "builtin",
|
|
624
|
+
subcommands: [
|
|
625
|
+
{ name: "ko", description: "Korean", source: "builtin" },
|
|
626
|
+
{ name: "en", description: "English", source: "builtin" },
|
|
627
|
+
{ name: "ja", description: "Japanese", source: "builtin" },
|
|
628
|
+
{ name: "zh", description: "Chinese", source: "builtin" }
|
|
629
|
+
]
|
|
630
|
+
},
|
|
603
631
|
{ name: "compact", description: "Compress context window", source: "builtin" },
|
|
604
632
|
{ name: "cost", description: "Show session info", source: "builtin" },
|
|
605
633
|
{ name: "context", description: "Context window info", source: "builtin" },
|
|
@@ -1274,7 +1302,15 @@ function App(props) {
|
|
|
1274
1302
|
const registry = useCommandRegistry(props.cwd ?? process.cwd());
|
|
1275
1303
|
const pendingModelChangeRef = (0, import_react11.useRef)(null);
|
|
1276
1304
|
const [pendingModelId, setPendingModelId] = (0, import_react11.useState)(null);
|
|
1277
|
-
const handleSlashCommand = useSlashCommands(
|
|
1305
|
+
const handleSlashCommand = useSlashCommands(
|
|
1306
|
+
session,
|
|
1307
|
+
addMessage,
|
|
1308
|
+
setMessages,
|
|
1309
|
+
exit,
|
|
1310
|
+
registry,
|
|
1311
|
+
pendingModelChangeRef,
|
|
1312
|
+
setPendingModelId
|
|
1313
|
+
);
|
|
1278
1314
|
const handleSubmit = useSubmitHandler(
|
|
1279
1315
|
session,
|
|
1280
1316
|
addMessage,
|
|
@@ -1321,10 +1357,16 @@ function App(props) {
|
|
|
1321
1357
|
try {
|
|
1322
1358
|
const settingsPath = getUserSettingsPath();
|
|
1323
1359
|
updateModelInSettings(settingsPath, pendingModelId);
|
|
1324
|
-
addMessage({
|
|
1360
|
+
addMessage({
|
|
1361
|
+
role: "system",
|
|
1362
|
+
content: `Model changed to ${(0, import_agent_core3.getModelName)(pendingModelId)}. Restarting...`
|
|
1363
|
+
});
|
|
1325
1364
|
setTimeout(() => exit(), EXIT_DELAY_MS2);
|
|
1326
1365
|
} catch (err) {
|
|
1327
|
-
addMessage({
|
|
1366
|
+
addMessage({
|
|
1367
|
+
role: "system",
|
|
1368
|
+
content: `Failed: ${err instanceof Error ? err.message : String(err)}`
|
|
1369
|
+
});
|
|
1328
1370
|
}
|
|
1329
1371
|
} else {
|
|
1330
1372
|
addMessage({ role: "system", content: "Model change cancelled." });
|
|
@@ -1415,19 +1457,9 @@ function readVersion() {
|
|
|
1415
1457
|
return "0.0.0";
|
|
1416
1458
|
}
|
|
1417
1459
|
}
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
const localPath = (0, import_node_path3.join)(cwd, ".robota", "settings.local.json");
|
|
1422
|
-
if (hasValidSettingsFile(userPath) || hasValidSettingsFile(projectPath) || hasValidSettingsFile(localPath)) {
|
|
1423
|
-
return;
|
|
1424
|
-
}
|
|
1425
|
-
process.stdout.write("\n");
|
|
1426
|
-
process.stdout.write(" Welcome to Robota CLI!\n");
|
|
1427
|
-
process.stdout.write(" No configuration found. Let's set up your API key.\n");
|
|
1428
|
-
process.stdout.write("\n");
|
|
1429
|
-
const apiKey = await new Promise((resolve) => {
|
|
1430
|
-
process.stdout.write(" Anthropic API key: ");
|
|
1460
|
+
function promptInput(label, masked = false) {
|
|
1461
|
+
return new Promise((resolve) => {
|
|
1462
|
+
process.stdout.write(label);
|
|
1431
1463
|
let input = "";
|
|
1432
1464
|
const stdin = process.stdin;
|
|
1433
1465
|
const wasRaw = stdin.isRaw;
|
|
@@ -1453,16 +1485,30 @@ async function ensureConfig(cwd) {
|
|
|
1453
1485
|
process.exit(0);
|
|
1454
1486
|
} else if (ch.charCodeAt(0) >= 32) {
|
|
1455
1487
|
input += ch;
|
|
1456
|
-
process.stdout.write("*");
|
|
1488
|
+
process.stdout.write(masked ? "*" : ch);
|
|
1457
1489
|
}
|
|
1458
1490
|
}
|
|
1459
1491
|
};
|
|
1460
1492
|
stdin.on("data", onData);
|
|
1461
1493
|
});
|
|
1494
|
+
}
|
|
1495
|
+
async function ensureConfig(cwd) {
|
|
1496
|
+
const userPath = getUserSettingsPath();
|
|
1497
|
+
const projectPath = (0, import_node_path3.join)(cwd, ".robota", "settings.json");
|
|
1498
|
+
const localPath = (0, import_node_path3.join)(cwd, ".robota", "settings.local.json");
|
|
1499
|
+
if (hasValidSettingsFile(userPath) || hasValidSettingsFile(projectPath) || hasValidSettingsFile(localPath)) {
|
|
1500
|
+
return;
|
|
1501
|
+
}
|
|
1502
|
+
process.stdout.write("\n");
|
|
1503
|
+
process.stdout.write(" Welcome to Robota CLI!\n");
|
|
1504
|
+
process.stdout.write(" No configuration found. Let's set up.\n");
|
|
1505
|
+
process.stdout.write("\n");
|
|
1506
|
+
const apiKey = await promptInput(" Anthropic API key: ", true);
|
|
1462
1507
|
if (!apiKey) {
|
|
1463
1508
|
process.stderr.write("\n No API key provided. Exiting.\n");
|
|
1464
1509
|
process.exit(1);
|
|
1465
1510
|
}
|
|
1511
|
+
const language = await promptInput(" Response language (ko/en/ja/zh, default: en): ");
|
|
1466
1512
|
const settingsDir = (0, import_node_path3.dirname)(userPath);
|
|
1467
1513
|
(0, import_node_fs3.mkdirSync)(settingsDir, { recursive: true });
|
|
1468
1514
|
const settings = {
|
|
@@ -1472,6 +1518,9 @@ async function ensureConfig(cwd) {
|
|
|
1472
1518
|
apiKey
|
|
1473
1519
|
}
|
|
1474
1520
|
};
|
|
1521
|
+
if (language) {
|
|
1522
|
+
settings.language = language;
|
|
1523
|
+
}
|
|
1475
1524
|
(0, import_node_fs3.writeFileSync)(userPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
|
|
1476
1525
|
process.stdout.write(`
|
|
1477
1526
|
Config saved to ${userPath}
|
|
@@ -1508,6 +1557,9 @@ async function startCli() {
|
|
|
1508
1557
|
if (args.model !== void 0) {
|
|
1509
1558
|
config.provider.model = args.model;
|
|
1510
1559
|
}
|
|
1560
|
+
if (args.language !== void 0) {
|
|
1561
|
+
config.language = args.language;
|
|
1562
|
+
}
|
|
1511
1563
|
const sessionStore = new import_agent_sdk2.SessionStore();
|
|
1512
1564
|
if (args.printMode) {
|
|
1513
1565
|
const prompt = args.positional.join(" ").trim();
|
package/dist/node/bin.js
CHANGED
|
@@ -43,6 +43,7 @@ function parseCliArgs() {
|
|
|
43
43
|
c: { type: "boolean", short: "c", default: false },
|
|
44
44
|
r: { type: "string", short: "r" },
|
|
45
45
|
model: { type: "string" },
|
|
46
|
+
language: { type: "string" },
|
|
46
47
|
"permission-mode": { type: "string" },
|
|
47
48
|
"max-turns": { type: "string" },
|
|
48
49
|
version: { type: "boolean", default: false },
|
|
@@ -55,6 +56,7 @@ function parseCliArgs() {
|
|
|
55
56
|
continueMode: values["c"] ?? false,
|
|
56
57
|
resumeId: values["r"],
|
|
57
58
|
model: values["model"],
|
|
59
|
+
language: values["language"],
|
|
58
60
|
permissionMode: parsePermissionMode(values["permission-mode"]),
|
|
59
61
|
maxTurns: parseMaxTurns(values["max-turns"]),
|
|
60
62
|
version: values["version"] ?? false,
|
|
@@ -273,6 +275,7 @@ var HELP_TEXT = [
|
|
|
273
275
|
" /clear \u2014 Clear conversation",
|
|
274
276
|
" /compact [instr] \u2014 Compact context (optional focus instructions)",
|
|
275
277
|
" /mode [m] \u2014 Show/change permission mode",
|
|
278
|
+
" /language [lang] \u2014 Set response language (ko, en, ja, zh)",
|
|
276
279
|
" /cost \u2014 Show session info",
|
|
277
280
|
" /reset \u2014 Delete settings and exit",
|
|
278
281
|
" /exit \u2014 Exit CLI"
|
|
@@ -345,6 +348,18 @@ function handleContext(session, addMessage) {
|
|
|
345
348
|
});
|
|
346
349
|
return { handled: true };
|
|
347
350
|
}
|
|
351
|
+
function handleLanguage(lang, addMessage) {
|
|
352
|
+
if (!lang) {
|
|
353
|
+
addMessage({ role: "system", content: "Usage: /language <code> (e.g., ko, en, ja, zh)" });
|
|
354
|
+
return { handled: true };
|
|
355
|
+
}
|
|
356
|
+
const settingsPath = getUserSettingsPath();
|
|
357
|
+
const settings = readSettings(settingsPath);
|
|
358
|
+
settings.language = lang;
|
|
359
|
+
writeSettings(settingsPath, settings);
|
|
360
|
+
addMessage({ role: "system", content: `Language set to "${lang}". Restarting...` });
|
|
361
|
+
return { handled: true, exitRequested: true };
|
|
362
|
+
}
|
|
348
363
|
function handleReset(addMessage) {
|
|
349
364
|
const settingsPath = getUserSettingsPath();
|
|
350
365
|
if (deleteSettings(settingsPath)) {
|
|
@@ -366,6 +381,8 @@ async function executeSlashCommand(cmd, args, session, addMessage, clearMessages
|
|
|
366
381
|
return handleMode(args.split(/\s+/)[0] || void 0, session, addMessage);
|
|
367
382
|
case "model":
|
|
368
383
|
return handleModel(args.split(/\s+/)[0] || void 0, addMessage);
|
|
384
|
+
case "language":
|
|
385
|
+
return handleLanguage(args.split(/\s+/)[0] || void 0, addMessage);
|
|
369
386
|
case "cost":
|
|
370
387
|
return handleCost(session, addMessage);
|
|
371
388
|
case "permissions":
|
|
@@ -583,6 +600,17 @@ function createBuiltinCommands() {
|
|
|
583
600
|
source: "builtin",
|
|
584
601
|
subcommands: buildModelSubcommands()
|
|
585
602
|
},
|
|
603
|
+
{
|
|
604
|
+
name: "language",
|
|
605
|
+
description: "Set response language",
|
|
606
|
+
source: "builtin",
|
|
607
|
+
subcommands: [
|
|
608
|
+
{ name: "ko", description: "Korean", source: "builtin" },
|
|
609
|
+
{ name: "en", description: "English", source: "builtin" },
|
|
610
|
+
{ name: "ja", description: "Japanese", source: "builtin" },
|
|
611
|
+
{ name: "zh", description: "Chinese", source: "builtin" }
|
|
612
|
+
]
|
|
613
|
+
},
|
|
586
614
|
{ name: "compact", description: "Compress context window", source: "builtin" },
|
|
587
615
|
{ name: "cost", description: "Show session info", source: "builtin" },
|
|
588
616
|
{ name: "context", description: "Context window info", source: "builtin" },
|
|
@@ -1257,7 +1285,15 @@ function App(props) {
|
|
|
1257
1285
|
const registry = useCommandRegistry(props.cwd ?? process.cwd());
|
|
1258
1286
|
const pendingModelChangeRef = useRef5(null);
|
|
1259
1287
|
const [pendingModelId, setPendingModelId] = useState7(null);
|
|
1260
|
-
const handleSlashCommand = useSlashCommands(
|
|
1288
|
+
const handleSlashCommand = useSlashCommands(
|
|
1289
|
+
session,
|
|
1290
|
+
addMessage,
|
|
1291
|
+
setMessages,
|
|
1292
|
+
exit,
|
|
1293
|
+
registry,
|
|
1294
|
+
pendingModelChangeRef,
|
|
1295
|
+
setPendingModelId
|
|
1296
|
+
);
|
|
1261
1297
|
const handleSubmit = useSubmitHandler(
|
|
1262
1298
|
session,
|
|
1263
1299
|
addMessage,
|
|
@@ -1304,10 +1340,16 @@ function App(props) {
|
|
|
1304
1340
|
try {
|
|
1305
1341
|
const settingsPath = getUserSettingsPath();
|
|
1306
1342
|
updateModelInSettings(settingsPath, pendingModelId);
|
|
1307
|
-
addMessage({
|
|
1343
|
+
addMessage({
|
|
1344
|
+
role: "system",
|
|
1345
|
+
content: `Model changed to ${getModelName(pendingModelId)}. Restarting...`
|
|
1346
|
+
});
|
|
1308
1347
|
setTimeout(() => exit(), EXIT_DELAY_MS2);
|
|
1309
1348
|
} catch (err) {
|
|
1310
|
-
addMessage({
|
|
1349
|
+
addMessage({
|
|
1350
|
+
role: "system",
|
|
1351
|
+
content: `Failed: ${err instanceof Error ? err.message : String(err)}`
|
|
1352
|
+
});
|
|
1311
1353
|
}
|
|
1312
1354
|
} else {
|
|
1313
1355
|
addMessage({ role: "system", content: "Model change cancelled." });
|
|
@@ -1397,19 +1439,9 @@ function readVersion() {
|
|
|
1397
1439
|
return "0.0.0";
|
|
1398
1440
|
}
|
|
1399
1441
|
}
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
const localPath = join3(cwd, ".robota", "settings.local.json");
|
|
1404
|
-
if (hasValidSettingsFile(userPath) || hasValidSettingsFile(projectPath) || hasValidSettingsFile(localPath)) {
|
|
1405
|
-
return;
|
|
1406
|
-
}
|
|
1407
|
-
process.stdout.write("\n");
|
|
1408
|
-
process.stdout.write(" Welcome to Robota CLI!\n");
|
|
1409
|
-
process.stdout.write(" No configuration found. Let's set up your API key.\n");
|
|
1410
|
-
process.stdout.write("\n");
|
|
1411
|
-
const apiKey = await new Promise((resolve) => {
|
|
1412
|
-
process.stdout.write(" Anthropic API key: ");
|
|
1442
|
+
function promptInput(label, masked = false) {
|
|
1443
|
+
return new Promise((resolve) => {
|
|
1444
|
+
process.stdout.write(label);
|
|
1413
1445
|
let input = "";
|
|
1414
1446
|
const stdin = process.stdin;
|
|
1415
1447
|
const wasRaw = stdin.isRaw;
|
|
@@ -1435,16 +1467,30 @@ async function ensureConfig(cwd) {
|
|
|
1435
1467
|
process.exit(0);
|
|
1436
1468
|
} else if (ch.charCodeAt(0) >= 32) {
|
|
1437
1469
|
input += ch;
|
|
1438
|
-
process.stdout.write("*");
|
|
1470
|
+
process.stdout.write(masked ? "*" : ch);
|
|
1439
1471
|
}
|
|
1440
1472
|
}
|
|
1441
1473
|
};
|
|
1442
1474
|
stdin.on("data", onData);
|
|
1443
1475
|
});
|
|
1476
|
+
}
|
|
1477
|
+
async function ensureConfig(cwd) {
|
|
1478
|
+
const userPath = getUserSettingsPath();
|
|
1479
|
+
const projectPath = join3(cwd, ".robota", "settings.json");
|
|
1480
|
+
const localPath = join3(cwd, ".robota", "settings.local.json");
|
|
1481
|
+
if (hasValidSettingsFile(userPath) || hasValidSettingsFile(projectPath) || hasValidSettingsFile(localPath)) {
|
|
1482
|
+
return;
|
|
1483
|
+
}
|
|
1484
|
+
process.stdout.write("\n");
|
|
1485
|
+
process.stdout.write(" Welcome to Robota CLI!\n");
|
|
1486
|
+
process.stdout.write(" No configuration found. Let's set up.\n");
|
|
1487
|
+
process.stdout.write("\n");
|
|
1488
|
+
const apiKey = await promptInput(" Anthropic API key: ", true);
|
|
1444
1489
|
if (!apiKey) {
|
|
1445
1490
|
process.stderr.write("\n No API key provided. Exiting.\n");
|
|
1446
1491
|
process.exit(1);
|
|
1447
1492
|
}
|
|
1493
|
+
const language = await promptInput(" Response language (ko/en/ja/zh, default: en): ");
|
|
1448
1494
|
const settingsDir = dirname2(userPath);
|
|
1449
1495
|
mkdirSync2(settingsDir, { recursive: true });
|
|
1450
1496
|
const settings = {
|
|
@@ -1454,6 +1500,9 @@ async function ensureConfig(cwd) {
|
|
|
1454
1500
|
apiKey
|
|
1455
1501
|
}
|
|
1456
1502
|
};
|
|
1503
|
+
if (language) {
|
|
1504
|
+
settings.language = language;
|
|
1505
|
+
}
|
|
1457
1506
|
writeFileSync2(userPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
|
|
1458
1507
|
process.stdout.write(`
|
|
1459
1508
|
Config saved to ${userPath}
|
|
@@ -1490,6 +1539,9 @@ async function startCli() {
|
|
|
1490
1539
|
if (args.model !== void 0) {
|
|
1491
1540
|
config.provider.model = args.model;
|
|
1492
1541
|
}
|
|
1542
|
+
if (args.language !== void 0) {
|
|
1543
|
+
config.language = args.language;
|
|
1544
|
+
}
|
|
1493
1545
|
const sessionStore = new SessionStore();
|
|
1494
1546
|
if (args.printMode) {
|
|
1495
1547
|
const prompt = args.positional.join(" ").trim();
|
package/dist/node/index.cjs
CHANGED
|
@@ -76,6 +76,7 @@ function parseCliArgs() {
|
|
|
76
76
|
c: { type: "boolean", short: "c", default: false },
|
|
77
77
|
r: { type: "string", short: "r" },
|
|
78
78
|
model: { type: "string" },
|
|
79
|
+
language: { type: "string" },
|
|
79
80
|
"permission-mode": { type: "string" },
|
|
80
81
|
"max-turns": { type: "string" },
|
|
81
82
|
version: { type: "boolean", default: false },
|
|
@@ -88,6 +89,7 @@ function parseCliArgs() {
|
|
|
88
89
|
continueMode: values["c"] ?? false,
|
|
89
90
|
resumeId: values["r"],
|
|
90
91
|
model: values["model"],
|
|
92
|
+
language: values["language"],
|
|
91
93
|
permissionMode: parsePermissionMode(values["permission-mode"]),
|
|
92
94
|
maxTurns: parseMaxTurns(values["max-turns"]),
|
|
93
95
|
version: values["version"] ?? false,
|
|
@@ -306,6 +308,7 @@ var HELP_TEXT = [
|
|
|
306
308
|
" /clear \u2014 Clear conversation",
|
|
307
309
|
" /compact [instr] \u2014 Compact context (optional focus instructions)",
|
|
308
310
|
" /mode [m] \u2014 Show/change permission mode",
|
|
311
|
+
" /language [lang] \u2014 Set response language (ko, en, ja, zh)",
|
|
309
312
|
" /cost \u2014 Show session info",
|
|
310
313
|
" /reset \u2014 Delete settings and exit",
|
|
311
314
|
" /exit \u2014 Exit CLI"
|
|
@@ -378,6 +381,18 @@ function handleContext(session, addMessage) {
|
|
|
378
381
|
});
|
|
379
382
|
return { handled: true };
|
|
380
383
|
}
|
|
384
|
+
function handleLanguage(lang, addMessage) {
|
|
385
|
+
if (!lang) {
|
|
386
|
+
addMessage({ role: "system", content: "Usage: /language <code> (e.g., ko, en, ja, zh)" });
|
|
387
|
+
return { handled: true };
|
|
388
|
+
}
|
|
389
|
+
const settingsPath = getUserSettingsPath();
|
|
390
|
+
const settings = readSettings(settingsPath);
|
|
391
|
+
settings.language = lang;
|
|
392
|
+
writeSettings(settingsPath, settings);
|
|
393
|
+
addMessage({ role: "system", content: `Language set to "${lang}". Restarting...` });
|
|
394
|
+
return { handled: true, exitRequested: true };
|
|
395
|
+
}
|
|
381
396
|
function handleReset(addMessage) {
|
|
382
397
|
const settingsPath = getUserSettingsPath();
|
|
383
398
|
if (deleteSettings(settingsPath)) {
|
|
@@ -399,6 +414,8 @@ async function executeSlashCommand(cmd, args, session, addMessage, clearMessages
|
|
|
399
414
|
return handleMode(args.split(/\s+/)[0] || void 0, session, addMessage);
|
|
400
415
|
case "model":
|
|
401
416
|
return handleModel(args.split(/\s+/)[0] || void 0, addMessage);
|
|
417
|
+
case "language":
|
|
418
|
+
return handleLanguage(args.split(/\s+/)[0] || void 0, addMessage);
|
|
402
419
|
case "cost":
|
|
403
420
|
return handleCost(session, addMessage);
|
|
404
421
|
case "permissions":
|
|
@@ -616,6 +633,17 @@ function createBuiltinCommands() {
|
|
|
616
633
|
source: "builtin",
|
|
617
634
|
subcommands: buildModelSubcommands()
|
|
618
635
|
},
|
|
636
|
+
{
|
|
637
|
+
name: "language",
|
|
638
|
+
description: "Set response language",
|
|
639
|
+
source: "builtin",
|
|
640
|
+
subcommands: [
|
|
641
|
+
{ name: "ko", description: "Korean", source: "builtin" },
|
|
642
|
+
{ name: "en", description: "English", source: "builtin" },
|
|
643
|
+
{ name: "ja", description: "Japanese", source: "builtin" },
|
|
644
|
+
{ name: "zh", description: "Chinese", source: "builtin" }
|
|
645
|
+
]
|
|
646
|
+
},
|
|
619
647
|
{ name: "compact", description: "Compress context window", source: "builtin" },
|
|
620
648
|
{ name: "cost", description: "Show session info", source: "builtin" },
|
|
621
649
|
{ name: "context", description: "Context window info", source: "builtin" },
|
|
@@ -1290,7 +1318,15 @@ function App(props) {
|
|
|
1290
1318
|
const registry = useCommandRegistry(props.cwd ?? process.cwd());
|
|
1291
1319
|
const pendingModelChangeRef = (0, import_react11.useRef)(null);
|
|
1292
1320
|
const [pendingModelId, setPendingModelId] = (0, import_react11.useState)(null);
|
|
1293
|
-
const handleSlashCommand = useSlashCommands(
|
|
1321
|
+
const handleSlashCommand = useSlashCommands(
|
|
1322
|
+
session,
|
|
1323
|
+
addMessage,
|
|
1324
|
+
setMessages,
|
|
1325
|
+
exit,
|
|
1326
|
+
registry,
|
|
1327
|
+
pendingModelChangeRef,
|
|
1328
|
+
setPendingModelId
|
|
1329
|
+
);
|
|
1294
1330
|
const handleSubmit = useSubmitHandler(
|
|
1295
1331
|
session,
|
|
1296
1332
|
addMessage,
|
|
@@ -1337,10 +1373,16 @@ function App(props) {
|
|
|
1337
1373
|
try {
|
|
1338
1374
|
const settingsPath = getUserSettingsPath();
|
|
1339
1375
|
updateModelInSettings(settingsPath, pendingModelId);
|
|
1340
|
-
addMessage({
|
|
1376
|
+
addMessage({
|
|
1377
|
+
role: "system",
|
|
1378
|
+
content: `Model changed to ${(0, import_agent_core3.getModelName)(pendingModelId)}. Restarting...`
|
|
1379
|
+
});
|
|
1341
1380
|
setTimeout(() => exit(), EXIT_DELAY_MS2);
|
|
1342
1381
|
} catch (err) {
|
|
1343
|
-
addMessage({
|
|
1382
|
+
addMessage({
|
|
1383
|
+
role: "system",
|
|
1384
|
+
content: `Failed: ${err instanceof Error ? err.message : String(err)}`
|
|
1385
|
+
});
|
|
1344
1386
|
}
|
|
1345
1387
|
} else {
|
|
1346
1388
|
addMessage({ role: "system", content: "Model change cancelled." });
|
|
@@ -1431,19 +1473,9 @@ function readVersion() {
|
|
|
1431
1473
|
return "0.0.0";
|
|
1432
1474
|
}
|
|
1433
1475
|
}
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
const localPath = (0, import_node_path3.join)(cwd, ".robota", "settings.local.json");
|
|
1438
|
-
if (hasValidSettingsFile(userPath) || hasValidSettingsFile(projectPath) || hasValidSettingsFile(localPath)) {
|
|
1439
|
-
return;
|
|
1440
|
-
}
|
|
1441
|
-
process.stdout.write("\n");
|
|
1442
|
-
process.stdout.write(" Welcome to Robota CLI!\n");
|
|
1443
|
-
process.stdout.write(" No configuration found. Let's set up your API key.\n");
|
|
1444
|
-
process.stdout.write("\n");
|
|
1445
|
-
const apiKey = await new Promise((resolve) => {
|
|
1446
|
-
process.stdout.write(" Anthropic API key: ");
|
|
1476
|
+
function promptInput(label, masked = false) {
|
|
1477
|
+
return new Promise((resolve) => {
|
|
1478
|
+
process.stdout.write(label);
|
|
1447
1479
|
let input = "";
|
|
1448
1480
|
const stdin = process.stdin;
|
|
1449
1481
|
const wasRaw = stdin.isRaw;
|
|
@@ -1469,16 +1501,30 @@ async function ensureConfig(cwd) {
|
|
|
1469
1501
|
process.exit(0);
|
|
1470
1502
|
} else if (ch.charCodeAt(0) >= 32) {
|
|
1471
1503
|
input += ch;
|
|
1472
|
-
process.stdout.write("*");
|
|
1504
|
+
process.stdout.write(masked ? "*" : ch);
|
|
1473
1505
|
}
|
|
1474
1506
|
}
|
|
1475
1507
|
};
|
|
1476
1508
|
stdin.on("data", onData);
|
|
1477
1509
|
});
|
|
1510
|
+
}
|
|
1511
|
+
async function ensureConfig(cwd) {
|
|
1512
|
+
const userPath = getUserSettingsPath();
|
|
1513
|
+
const projectPath = (0, import_node_path3.join)(cwd, ".robota", "settings.json");
|
|
1514
|
+
const localPath = (0, import_node_path3.join)(cwd, ".robota", "settings.local.json");
|
|
1515
|
+
if (hasValidSettingsFile(userPath) || hasValidSettingsFile(projectPath) || hasValidSettingsFile(localPath)) {
|
|
1516
|
+
return;
|
|
1517
|
+
}
|
|
1518
|
+
process.stdout.write("\n");
|
|
1519
|
+
process.stdout.write(" Welcome to Robota CLI!\n");
|
|
1520
|
+
process.stdout.write(" No configuration found. Let's set up.\n");
|
|
1521
|
+
process.stdout.write("\n");
|
|
1522
|
+
const apiKey = await promptInput(" Anthropic API key: ", true);
|
|
1478
1523
|
if (!apiKey) {
|
|
1479
1524
|
process.stderr.write("\n No API key provided. Exiting.\n");
|
|
1480
1525
|
process.exit(1);
|
|
1481
1526
|
}
|
|
1527
|
+
const language = await promptInput(" Response language (ko/en/ja/zh, default: en): ");
|
|
1482
1528
|
const settingsDir = (0, import_node_path3.dirname)(userPath);
|
|
1483
1529
|
(0, import_node_fs3.mkdirSync)(settingsDir, { recursive: true });
|
|
1484
1530
|
const settings = {
|
|
@@ -1488,6 +1534,9 @@ async function ensureConfig(cwd) {
|
|
|
1488
1534
|
apiKey
|
|
1489
1535
|
}
|
|
1490
1536
|
};
|
|
1537
|
+
if (language) {
|
|
1538
|
+
settings.language = language;
|
|
1539
|
+
}
|
|
1491
1540
|
(0, import_node_fs3.writeFileSync)(userPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
|
|
1492
1541
|
process.stdout.write(`
|
|
1493
1542
|
Config saved to ${userPath}
|
|
@@ -1524,6 +1573,9 @@ async function startCli() {
|
|
|
1524
1573
|
if (args.model !== void 0) {
|
|
1525
1574
|
config.provider.model = args.model;
|
|
1526
1575
|
}
|
|
1576
|
+
if (args.language !== void 0) {
|
|
1577
|
+
config.language = args.language;
|
|
1578
|
+
}
|
|
1527
1579
|
const sessionStore = new import_agent_sdk2.SessionStore();
|
|
1528
1580
|
if (args.printMode) {
|
|
1529
1581
|
const prompt = args.positional.join(" ").trim();
|
package/dist/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robota-sdk/agent-cli",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.24",
|
|
4
4
|
"description": "AI coding assistant CLI built on Robota SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"marked-terminal": "^7.3.0",
|
|
36
36
|
"react": "19.2.4",
|
|
37
37
|
"string-width": "^8.2.0",
|
|
38
|
-
"@robota-sdk/agent-core": "3.0.0-beta.
|
|
39
|
-
"@robota-sdk/agent-sdk": "3.0.0-beta.
|
|
38
|
+
"@robota-sdk/agent-core": "3.0.0-beta.24",
|
|
39
|
+
"@robota-sdk/agent-sdk": "3.0.0-beta.24"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/marked": "^6.0.0",
|