openxgen 0.3.2 → 0.4.1
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/index.js +247 -193
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -95,7 +95,7 @@ function addProvider(provider) {
|
|
|
95
95
|
const store = getProvidersStore();
|
|
96
96
|
store.providers = store.providers.filter((p) => p.id !== provider.id);
|
|
97
97
|
store.providers.push(provider);
|
|
98
|
-
|
|
98
|
+
store.defaultId = provider.id;
|
|
99
99
|
writeJson(PROVIDERS_FILE, store, true);
|
|
100
100
|
}
|
|
101
101
|
function removeProvider(id) {
|
|
@@ -1547,14 +1547,34 @@ var init_client2 = __esm({
|
|
|
1547
1547
|
}
|
|
1548
1548
|
});
|
|
1549
1549
|
|
|
1550
|
-
// src/
|
|
1551
|
-
var home_exports = {};
|
|
1552
|
-
__export(home_exports, {
|
|
1553
|
-
homeMenu: () => homeMenu
|
|
1554
|
-
});
|
|
1550
|
+
// src/utils/ui.ts
|
|
1555
1551
|
import chalk11 from "chalk";
|
|
1556
1552
|
import { createInterface as createInterface5 } from "readline";
|
|
1557
|
-
function
|
|
1553
|
+
function box(lines, color = "cyan") {
|
|
1554
|
+
const c = chalk11[color];
|
|
1555
|
+
const inner = W - 4;
|
|
1556
|
+
const top = c(" \u256D" + "\u2500".repeat(inner) + "\u256E");
|
|
1557
|
+
const bot = c(" \u2570" + "\u2500".repeat(inner) + "\u256F");
|
|
1558
|
+
const body = lines.map((line) => {
|
|
1559
|
+
const clean = line.replace(/\x1b\[[0-9;]*m/g, "");
|
|
1560
|
+
const pad = Math.max(0, inner - clean.length);
|
|
1561
|
+
return c(" \u2502 ") + line + " ".repeat(pad) + c(" \u2502");
|
|
1562
|
+
});
|
|
1563
|
+
return [top, ...body, bot].join("\n");
|
|
1564
|
+
}
|
|
1565
|
+
function divider(label) {
|
|
1566
|
+
if (label) {
|
|
1567
|
+
const rest = W - label.length - 6;
|
|
1568
|
+
return chalk11.gray(` \u2500\u2500 ${label} ${"\u2500".repeat(Math.max(0, rest))}`);
|
|
1569
|
+
}
|
|
1570
|
+
return chalk11.gray(" " + "\u2500".repeat(W - 2));
|
|
1571
|
+
}
|
|
1572
|
+
function statusDot(active, label, detail) {
|
|
1573
|
+
const dot = active ? chalk11.green("\u25CF") : chalk11.gray("\u25CB");
|
|
1574
|
+
const d = detail ? chalk11.gray(` ${detail}`) : "";
|
|
1575
|
+
return ` ${dot} ${label}${d}`;
|
|
1576
|
+
}
|
|
1577
|
+
function ask(question) {
|
|
1558
1578
|
return new Promise((resolve) => {
|
|
1559
1579
|
const rl = createInterface5({ input: process.stdin, output: process.stdout });
|
|
1560
1580
|
rl.question(question, (answer) => {
|
|
@@ -1563,161 +1583,166 @@ function prompt3(question) {
|
|
|
1563
1583
|
});
|
|
1564
1584
|
});
|
|
1565
1585
|
}
|
|
1586
|
+
function welcome() {
|
|
1587
|
+
const logo = chalk11.cyan(`
|
|
1588
|
+
\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588 \u2588\u2588
|
|
1589
|
+
\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588
|
|
1590
|
+
\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588
|
|
1591
|
+
\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588
|
|
1592
|
+
\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588`) + chalk11.white.bold(`
|
|
1593
|
+
\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588 \u2588\u2588
|
|
1594
|
+
\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588
|
|
1595
|
+
\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588
|
|
1596
|
+
\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588
|
|
1597
|
+
\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588`);
|
|
1598
|
+
return logo;
|
|
1599
|
+
}
|
|
1600
|
+
var W;
|
|
1601
|
+
var init_ui = __esm({
|
|
1602
|
+
"src/utils/ui.ts"() {
|
|
1603
|
+
"use strict";
|
|
1604
|
+
W = Math.min(process.stdout.columns || 60, 70);
|
|
1605
|
+
}
|
|
1606
|
+
});
|
|
1607
|
+
|
|
1608
|
+
// src/commands/home.ts
|
|
1609
|
+
var home_exports = {};
|
|
1610
|
+
__export(home_exports, {
|
|
1611
|
+
homeMenu: () => homeMenu
|
|
1612
|
+
});
|
|
1613
|
+
import chalk12 from "chalk";
|
|
1566
1614
|
function showStatus() {
|
|
1567
1615
|
const provider = getDefaultProvider();
|
|
1568
1616
|
const server = getServer();
|
|
1569
1617
|
const auth = getAuth();
|
|
1570
|
-
console.log(
|
|
1571
|
-
console.log(
|
|
1618
|
+
console.log(divider("\uC0C1\uD0DC"));
|
|
1619
|
+
console.log();
|
|
1572
1620
|
if (provider) {
|
|
1573
|
-
console.log(
|
|
1621
|
+
console.log(statusDot(true, chalk12.bold("AI \uC5D0\uC774\uC804\uD2B8"), `${provider.name} \xB7 ${provider.model}`));
|
|
1574
1622
|
} else {
|
|
1575
|
-
console.log(
|
|
1623
|
+
console.log(statusDot(false, "AI \uC5D0\uC774\uC804\uD2B8", "\uBBF8\uC124\uC815"));
|
|
1576
1624
|
}
|
|
1577
1625
|
if (server && auth) {
|
|
1578
|
-
console.log(
|
|
1626
|
+
console.log(statusDot(true, chalk12.bold("XGEN \uC11C\uBC84"), `${auth.username} \xB7 ${server.replace("https://", "")}`));
|
|
1579
1627
|
} else if (server) {
|
|
1580
|
-
console.log(
|
|
1628
|
+
console.log(statusDot(false, "XGEN \uC11C\uBC84", `${server.replace("https://", "")} \xB7 \uB85C\uADF8\uC778 \uD544\uC694`));
|
|
1581
1629
|
} else {
|
|
1582
|
-
console.log(
|
|
1630
|
+
console.log(statusDot(false, "XGEN \uC11C\uBC84", "\uBBF8\uC5F0\uACB0"));
|
|
1583
1631
|
}
|
|
1584
|
-
console.log(
|
|
1632
|
+
console.log();
|
|
1585
1633
|
}
|
|
1586
1634
|
async function homeMenu() {
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
const auth = getAuth();
|
|
1590
|
-
console.log(chalk11.cyan(`
|
|
1591
|
-
\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588 \u2588\u2588
|
|
1592
|
-
\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588
|
|
1593
|
-
\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588
|
|
1594
|
-
\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588
|
|
1595
|
-
\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588`));
|
|
1596
|
-
console.log(chalk11.white.bold(`
|
|
1597
|
-
\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588 \u2588\u2588
|
|
1598
|
-
\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588
|
|
1599
|
-
\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588
|
|
1600
|
-
\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588
|
|
1601
|
-
\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588`));
|
|
1602
|
-
console.log(chalk11.gray(` v0.3.0
|
|
1603
|
-
`));
|
|
1635
|
+
console.log(welcome());
|
|
1636
|
+
console.log(chalk12.gray(" v0.3.2\n"));
|
|
1604
1637
|
showStatus();
|
|
1605
1638
|
while (true) {
|
|
1639
|
+
const provider = getDefaultProvider();
|
|
1640
|
+
const server = getServer();
|
|
1641
|
+
const auth = getAuth();
|
|
1642
|
+
const hasServer = !!(server && auth);
|
|
1606
1643
|
const items = [];
|
|
1607
1644
|
items.push({
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
available: true,
|
|
1645
|
+
label: provider ? `${chalk12.bold("AI \uC5D0\uC774\uC804\uD2B8")} ${chalk12.gray(`(${provider.model})`)}` : chalk12.bold("AI \uC5D0\uC774\uC804\uD2B8 \uC2DC\uC791\uD558\uAE30"),
|
|
1646
|
+
hint: provider ? "\uB300\uD654 \uC2DC\uC791" : "\uD504\uB85C\uBC14\uC774\uB354 \uC124\uC815 \u2192 \uBC14\uB85C \uC2DC\uC791",
|
|
1611
1647
|
action: async () => {
|
|
1612
1648
|
await agentRepl();
|
|
1649
|
+
console.log();
|
|
1650
|
+
showStatus();
|
|
1651
|
+
return false;
|
|
1613
1652
|
}
|
|
1614
1653
|
});
|
|
1615
|
-
if (
|
|
1654
|
+
if (hasServer) {
|
|
1616
1655
|
items.push({
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
available: true,
|
|
1656
|
+
label: chalk12.bold("\uC6CC\uD06C\uD50C\uB85C\uC6B0 \uCC44\uD305"),
|
|
1657
|
+
hint: `${auth.username}@${server.replace("https://", "")}`,
|
|
1620
1658
|
action: async () => {
|
|
1621
1659
|
await chat();
|
|
1660
|
+
console.log();
|
|
1661
|
+
showStatus();
|
|
1662
|
+
return false;
|
|
1622
1663
|
}
|
|
1623
1664
|
});
|
|
1624
1665
|
items.push({
|
|
1625
|
-
key: "3",
|
|
1626
1666
|
label: "\uC6CC\uD06C\uD50C\uB85C\uC6B0 \uBAA9\uB85D",
|
|
1627
|
-
|
|
1667
|
+
hint: "\uC870\uD68C",
|
|
1628
1668
|
action: async () => {
|
|
1629
1669
|
const { workflowList: workflowList2 } = await Promise.resolve().then(() => (init_list(), list_exports));
|
|
1630
1670
|
await workflowList2({ detail: false });
|
|
1631
|
-
return;
|
|
1632
|
-
}
|
|
1633
|
-
});
|
|
1634
|
-
} else {
|
|
1635
|
-
items.push({
|
|
1636
|
-
key: "2",
|
|
1637
|
-
label: "XGEN \uC11C\uBC84 \uC5F0\uACB0 + \uB85C\uADF8\uC778",
|
|
1638
|
-
available: true,
|
|
1639
|
-
action: async () => {
|
|
1640
|
-
await serverSetup();
|
|
1671
|
+
return false;
|
|
1641
1672
|
}
|
|
1642
1673
|
});
|
|
1643
1674
|
}
|
|
1644
1675
|
items.push({
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
available: true,
|
|
1648
|
-
action: async () => {
|
|
1649
|
-
await providerMenu();
|
|
1650
|
-
}
|
|
1651
|
-
});
|
|
1652
|
-
items.push({
|
|
1653
|
-
key: String(items.length + 1),
|
|
1654
|
-
label: "\uC124\uC815 \uBCF4\uAE30",
|
|
1655
|
-
available: true,
|
|
1676
|
+
label: hasServer ? "XGEN \uC11C\uBC84 \uC7AC\uC124\uC815" : chalk12.bold("XGEN \uC11C\uBC84 \uC5F0\uACB0"),
|
|
1677
|
+
hint: hasServer ? "\uC11C\uBC84 \uBCC0\uACBD / \uC7AC\uB85C\uADF8\uC778" : "\uC11C\uBC84 URL + \uB85C\uADF8\uC778",
|
|
1656
1678
|
action: async () => {
|
|
1679
|
+
await serverSetup();
|
|
1657
1680
|
showStatus();
|
|
1658
|
-
|
|
1659
|
-
const config = cfg.getConfig();
|
|
1660
|
-
console.log(chalk11.gray(" \uC124\uC815 \uD30C\uC77C: ~/.xgen/\n"));
|
|
1661
|
-
console.log(chalk11.gray(` \uC11C\uBC84: ${config.server ?? "(\uC5C6\uC74C)"}`));
|
|
1662
|
-
console.log(chalk11.gray(` \uD14C\uB9C8: ${config.theme}`));
|
|
1663
|
-
console.log(chalk11.gray(` \uC2A4\uD2B8\uB9BC \uB85C\uADF8: ${config.streamLogs}
|
|
1664
|
-
`));
|
|
1681
|
+
return false;
|
|
1665
1682
|
}
|
|
1666
1683
|
});
|
|
1667
1684
|
items.push({
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
available: true,
|
|
1685
|
+
label: "\uD504\uB85C\uBC14\uC774\uB354 \uAD00\uB9AC",
|
|
1686
|
+
hint: `${getProviders().length}\uAC1C \uB4F1\uB85D\uB428`,
|
|
1671
1687
|
action: async () => {
|
|
1672
|
-
|
|
1688
|
+
await providerMenu();
|
|
1689
|
+
showStatus();
|
|
1690
|
+
return false;
|
|
1673
1691
|
}
|
|
1674
1692
|
});
|
|
1675
|
-
console.log(
|
|
1676
|
-
for (
|
|
1677
|
-
|
|
1693
|
+
console.log(divider("\uBA54\uB274"));
|
|
1694
|
+
for (let i = 0; i < items.length; i++) {
|
|
1695
|
+
const num = chalk12.cyan.bold(` ${String(i + 1).padStart(2)}.`);
|
|
1696
|
+
console.log(` ${num} ${items[i].label}`);
|
|
1697
|
+
console.log(` ${chalk12.gray(items[i].hint)}`);
|
|
1678
1698
|
}
|
|
1699
|
+
console.log(` ${chalk12.gray(" q. \uC885\uB8CC")}`);
|
|
1679
1700
|
console.log();
|
|
1680
|
-
const choice = await
|
|
1681
|
-
if (choice === "q" || choice === "exit") {
|
|
1682
|
-
|
|
1701
|
+
const choice = await ask(chalk12.cyan(" \u276F "));
|
|
1702
|
+
if (choice === "q" || choice === "exit" || choice === "") {
|
|
1703
|
+
if (choice === "") continue;
|
|
1704
|
+
console.log(chalk12.gray("\n \u{1F44B} \uB2E4\uC74C\uC5D0 \uB610.\n"));
|
|
1683
1705
|
break;
|
|
1684
1706
|
}
|
|
1685
|
-
const
|
|
1686
|
-
if (
|
|
1687
|
-
console.log(
|
|
1707
|
+
const idx = parseInt(choice) - 1;
|
|
1708
|
+
if (isNaN(idx) || idx < 0 || idx >= items.length) {
|
|
1709
|
+
console.log(chalk12.red(` \uC798\uBABB\uB41C \uC785\uB825\uC785\uB2C8\uB2E4.
|
|
1710
|
+
`));
|
|
1688
1711
|
continue;
|
|
1689
1712
|
}
|
|
1690
1713
|
try {
|
|
1691
|
-
await
|
|
1714
|
+
const shouldExit = await items[idx].action();
|
|
1715
|
+
if (shouldExit) break;
|
|
1692
1716
|
} catch (err) {
|
|
1693
|
-
console.log(
|
|
1717
|
+
console.log(chalk12.red(`
|
|
1694
1718
|
\uC624\uB958: ${err.message}
|
|
1695
1719
|
`));
|
|
1696
1720
|
}
|
|
1697
|
-
console.log();
|
|
1698
|
-
showStatus();
|
|
1699
1721
|
}
|
|
1700
1722
|
}
|
|
1701
1723
|
async function serverSetup() {
|
|
1702
|
-
console.log(
|
|
1724
|
+
console.log();
|
|
1725
|
+
console.log(box(["XGEN \uC11C\uBC84 \uC5F0\uACB0"], "cyan"));
|
|
1726
|
+
console.log();
|
|
1703
1727
|
const currentServer = getServer();
|
|
1704
|
-
const urlInput = await
|
|
1705
|
-
|
|
1728
|
+
const urlInput = await ask(
|
|
1729
|
+
chalk12.white(` \uC11C\uBC84 URL${currentServer ? chalk12.gray(` [${currentServer}]`) : ""}: `)
|
|
1706
1730
|
);
|
|
1707
1731
|
const url = urlInput || currentServer;
|
|
1708
1732
|
if (!url) {
|
|
1709
|
-
console.log(
|
|
1733
|
+
console.log(chalk12.red(" URL\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.\n"));
|
|
1710
1734
|
return;
|
|
1711
1735
|
}
|
|
1712
1736
|
const { setServer: setServer2 } = await Promise.resolve().then(() => (init_store(), store_exports));
|
|
1713
1737
|
setServer2(url);
|
|
1714
|
-
console.log(
|
|
1738
|
+
console.log(chalk12.green(` \u2713 \uC11C\uBC84: ${url}
|
|
1715
1739
|
`));
|
|
1716
|
-
console.log(
|
|
1717
|
-
|
|
1718
|
-
const
|
|
1740
|
+
console.log(chalk12.bold(" \uB85C\uADF8\uC778"));
|
|
1741
|
+
console.log();
|
|
1742
|
+
const email = await ask(chalk12.white(" \uC774\uBA54\uC77C: "));
|
|
1743
|
+
const password = await ask(chalk12.white(" \uBE44\uBC00\uBC88\uD638: "));
|
|
1719
1744
|
if (!email || !password) {
|
|
1720
|
-
console.log(
|
|
1745
|
+
console.log(chalk12.red(" \uC774\uBA54\uC77C\uACFC \uBE44\uBC00\uBC88\uD638\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.\n"));
|
|
1721
1746
|
return;
|
|
1722
1747
|
}
|
|
1723
1748
|
try {
|
|
@@ -1733,67 +1758,73 @@ async function serverSetup() {
|
|
|
1733
1758
|
isAdmin: false,
|
|
1734
1759
|
expiresAt: null
|
|
1735
1760
|
});
|
|
1736
|
-
console.log(
|
|
1761
|
+
console.log(chalk12.green(`
|
|
1762
|
+
\u2713 \uB85C\uADF8\uC778 \uC131\uACF5! ${chalk12.bold(result.username ?? email)}
|
|
1737
1763
|
`));
|
|
1738
1764
|
} else {
|
|
1739
|
-
console.log(
|
|
1765
|
+
console.log(chalk12.red(`
|
|
1766
|
+
\u2717 ${result.message}
|
|
1740
1767
|
`));
|
|
1741
1768
|
}
|
|
1742
1769
|
} catch (err) {
|
|
1743
|
-
console.log(
|
|
1770
|
+
console.log(chalk12.red(`
|
|
1771
|
+
\u2717 ${err.message}
|
|
1744
1772
|
`));
|
|
1745
1773
|
}
|
|
1746
1774
|
}
|
|
1747
1775
|
async function providerMenu() {
|
|
1748
|
-
const
|
|
1749
|
-
const
|
|
1750
|
-
|
|
1751
|
-
console.log(
|
|
1776
|
+
const providers = getProviders();
|
|
1777
|
+
const defaultP = getDefaultProvider();
|
|
1778
|
+
console.log();
|
|
1779
|
+
console.log(box(["\uD504\uB85C\uBC14\uC774\uB354 \uAD00\uB9AC"], "cyan"));
|
|
1780
|
+
console.log();
|
|
1752
1781
|
if (providers.length > 0) {
|
|
1753
1782
|
for (const p of providers) {
|
|
1754
|
-
const mark = p.id === defaultP?.id ?
|
|
1755
|
-
console.log(` ${mark}${p.name} ${
|
|
1783
|
+
const mark = p.id === defaultP?.id ? chalk12.green("\u25CF ") : chalk12.gray(" ");
|
|
1784
|
+
console.log(` ${mark}${chalk12.bold(p.name)} ${chalk12.gray(`${p.type} \xB7 ${p.model}`)}`);
|
|
1756
1785
|
}
|
|
1757
1786
|
console.log();
|
|
1758
|
-
}
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
if (providers.length > 0)
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1787
|
+
} else {
|
|
1788
|
+
console.log(chalk12.gray(" \uB4F1\uB85D\uB41C \uD504\uB85C\uBC14\uC774\uB354\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.\n"));
|
|
1789
|
+
}
|
|
1790
|
+
const items = ["\uC0C8\uB85C \uCD94\uAC00"];
|
|
1791
|
+
if (providers.length > 1) items.push("\uAE30\uBCF8 \uBCC0\uACBD");
|
|
1792
|
+
if (providers.length > 0) items.push("\uC0AD\uC81C");
|
|
1793
|
+
items.push("\uB3CC\uC544\uAC00\uAE30");
|
|
1794
|
+
items.forEach((item, i) => {
|
|
1795
|
+
console.log(` ${chalk12.cyan(`${i + 1}.`)} ${item}`);
|
|
1796
|
+
});
|
|
1767
1797
|
console.log();
|
|
1768
|
-
const choice = await
|
|
1769
|
-
|
|
1798
|
+
const choice = await ask(chalk12.cyan(" \u276F "));
|
|
1799
|
+
const ci = parseInt(choice);
|
|
1800
|
+
if (ci === 1) {
|
|
1770
1801
|
await guidedProviderSetup();
|
|
1771
|
-
} else if (
|
|
1802
|
+
} else if (items[ci - 1] === "\uAE30\uBCF8 \uBCC0\uACBD") {
|
|
1772
1803
|
console.log();
|
|
1773
1804
|
providers.forEach((p, i) => {
|
|
1774
|
-
console.log(` ${
|
|
1805
|
+
console.log(` ${chalk12.cyan(`${i + 1}.`)} ${p.name} (${p.model})`);
|
|
1775
1806
|
});
|
|
1776
1807
|
console.log();
|
|
1777
|
-
const pc = await
|
|
1808
|
+
const pc = await ask(chalk12.cyan(" \u276F "));
|
|
1778
1809
|
const pi = parseInt(pc) - 1;
|
|
1779
1810
|
if (pi >= 0 && pi < providers.length) {
|
|
1780
|
-
const { setDefaultProvider:
|
|
1781
|
-
|
|
1782
|
-
console.log(
|
|
1811
|
+
const { setDefaultProvider: setDefaultProvider2 } = await Promise.resolve().then(() => (init_store(), store_exports));
|
|
1812
|
+
setDefaultProvider2(providers[pi].id);
|
|
1813
|
+
console.log(chalk12.green(` \u2713 \uAE30\uBCF8: ${providers[pi].name}
|
|
1783
1814
|
`));
|
|
1784
1815
|
}
|
|
1785
|
-
} else if (
|
|
1816
|
+
} else if (items[ci - 1] === "\uC0AD\uC81C") {
|
|
1786
1817
|
console.log();
|
|
1787
1818
|
providers.forEach((p, i) => {
|
|
1788
|
-
console.log(` ${
|
|
1819
|
+
console.log(` ${chalk12.cyan(`${i + 1}.`)} ${p.name} (${p.model})`);
|
|
1789
1820
|
});
|
|
1790
1821
|
console.log();
|
|
1791
|
-
const dc = await
|
|
1822
|
+
const dc = await ask(chalk12.white(" \uC0AD\uC81C\uD560 \uBC88\uD638: "));
|
|
1792
1823
|
const di = parseInt(dc) - 1;
|
|
1793
1824
|
if (di >= 0 && di < providers.length) {
|
|
1794
|
-
const { removeProvider:
|
|
1795
|
-
|
|
1796
|
-
console.log(
|
|
1825
|
+
const { removeProvider: removeProvider2 } = await Promise.resolve().then(() => (init_store(), store_exports));
|
|
1826
|
+
removeProvider2(providers[di].id);
|
|
1827
|
+
console.log(chalk12.green(` \u2713 \uC0AD\uC81C: ${providers[di].name}
|
|
1797
1828
|
`));
|
|
1798
1829
|
}
|
|
1799
1830
|
}
|
|
@@ -1802,6 +1833,7 @@ var init_home = __esm({
|
|
|
1802
1833
|
"src/commands/home.ts"() {
|
|
1803
1834
|
"use strict";
|
|
1804
1835
|
init_store();
|
|
1836
|
+
init_ui();
|
|
1805
1837
|
init_agent();
|
|
1806
1838
|
init_chat();
|
|
1807
1839
|
init_provider();
|
|
@@ -1809,7 +1841,7 @@ var init_home = __esm({
|
|
|
1809
1841
|
});
|
|
1810
1842
|
|
|
1811
1843
|
// src/commands/agent.ts
|
|
1812
|
-
import
|
|
1844
|
+
import chalk13 from "chalk";
|
|
1813
1845
|
import { createInterface as createInterface6 } from "readline";
|
|
1814
1846
|
async function agentRepl() {
|
|
1815
1847
|
let provider = getDefaultProvider();
|
|
@@ -1837,48 +1869,64 @@ async function agentRepl() {
|
|
|
1837
1869
|
}
|
|
1838
1870
|
}
|
|
1839
1871
|
const messages = [{ role: "system", content: SYSTEM_PROMPT }];
|
|
1840
|
-
console.log(
|
|
1841
|
-
console.log(
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1872
|
+
console.log();
|
|
1873
|
+
console.log(box([
|
|
1874
|
+
`${chalk13.bold("OPEN XGEN Agent")}`,
|
|
1875
|
+
``,
|
|
1876
|
+
`${chalk13.gray("\uD504\uB85C\uBC14\uC774\uB354")} ${provider.name} ${chalk13.gray("\xB7")} ${provider.model}`,
|
|
1877
|
+
`${chalk13.gray("\uB3C4\uAD6C")} ${getToolNames().length}\uAC1C \uB0B4\uC7A5${mcpManager && mcpManager.serverCount > 0 ? ` + ${mcpManager.getAllTools().length}\uAC1C MCP` : ""}`,
|
|
1878
|
+
``,
|
|
1879
|
+
`${chalk13.gray("\uBB34\uC5C7\uC774\uB4E0 \uBB3C\uC5B4\uBCF4\uC138\uC694. \uD30C\uC77C \uC77D\uAE30/\uC4F0\uAE30, \uCF54\uB4DC \uC2E4\uD589, \uAC80\uC0C9 \uAC00\uB2A5.")}`,
|
|
1880
|
+
`${chalk13.gray("/help \uB3C4\uC6C0\uB9D0 \xB7 /home \uD648 \xB7 /exit \uC885\uB8CC")}`
|
|
1881
|
+
]));
|
|
1848
1882
|
console.log();
|
|
1849
1883
|
const rl = createInterface6({ input: process.stdin, output: process.stdout });
|
|
1850
|
-
const
|
|
1884
|
+
const askUser = () => new Promise((resolve) => rl.question(chalk13.cyan.bold(" \u276F "), (a) => resolve(a.trim())));
|
|
1851
1885
|
process.on("SIGINT", () => {
|
|
1852
|
-
console.log(
|
|
1886
|
+
console.log(chalk13.gray("\n\uC885\uB8CC\uD569\uB2C8\uB2E4."));
|
|
1853
1887
|
mcpManager?.stopAll();
|
|
1854
1888
|
rl.close();
|
|
1855
1889
|
process.exit(0);
|
|
1856
1890
|
});
|
|
1857
1891
|
while (true) {
|
|
1858
|
-
const input = await
|
|
1892
|
+
const input = await askUser();
|
|
1859
1893
|
if (!input) continue;
|
|
1860
1894
|
if (input === "exit" || input === "/exit") {
|
|
1861
|
-
console.log(
|
|
1895
|
+
console.log(chalk13.gray("\uC885\uB8CC\uD569\uB2C8\uB2E4."));
|
|
1862
1896
|
mcpManager?.stopAll();
|
|
1863
1897
|
rl.close();
|
|
1864
1898
|
break;
|
|
1865
1899
|
}
|
|
1900
|
+
if (input === "/help") {
|
|
1901
|
+
console.log();
|
|
1902
|
+
console.log(chalk13.bold(" \uC2AC\uB798\uC2DC \uCEE4\uB9E8\uB4DC"));
|
|
1903
|
+
console.log(chalk13.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
1904
|
+
console.log(` ${chalk13.cyan("/tools")} \uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uB3C4\uAD6C \uBAA9\uB85D`);
|
|
1905
|
+
console.log(` ${chalk13.cyan("/provider")} \uD604\uC7AC \uD504\uB85C\uBC14\uC774\uB354 \uC815\uBCF4`);
|
|
1906
|
+
console.log(` ${chalk13.cyan("/model")} \uB4F1\uB85D\uB41C \uD504\uB85C\uBC14\uC774\uB354 \uBAA9\uB85D`);
|
|
1907
|
+
console.log(` ${chalk13.cyan("/mcp")} MCP \uC11C\uBC84 \uC0C1\uD0DC`);
|
|
1908
|
+
console.log(` ${chalk13.cyan("/clear")} \uB300\uD654 \uCD08\uAE30\uD654`);
|
|
1909
|
+
console.log(` ${chalk13.cyan("/home")} \uD648 \uBA54\uB274\uB85C \uB3CC\uC544\uAC00\uAE30`);
|
|
1910
|
+
console.log(` ${chalk13.cyan("/exit")} \uC885\uB8CC`);
|
|
1911
|
+
console.log();
|
|
1912
|
+
continue;
|
|
1913
|
+
}
|
|
1866
1914
|
if (input === "/clear") {
|
|
1867
1915
|
messages.length = 1;
|
|
1868
|
-
console.log(
|
|
1916
|
+
console.log(chalk13.gray(" \uB300\uD654 \uCD08\uAE30\uD654\uB428.\n"));
|
|
1869
1917
|
continue;
|
|
1870
1918
|
}
|
|
1871
1919
|
if (input === "/tools") {
|
|
1872
|
-
console.log(
|
|
1920
|
+
console.log(chalk13.bold("\n\uB0B4\uC7A5 \uB3C4\uAD6C:"), getToolNames().join(", "));
|
|
1873
1921
|
if (mcpManager && mcpManager.serverCount > 0) {
|
|
1874
|
-
console.log(
|
|
1922
|
+
console.log(chalk13.bold("MCP \uB3C4\uAD6C:"), mcpManager.getAllTools().map((t) => t.function.name).join(", "));
|
|
1875
1923
|
}
|
|
1876
1924
|
console.log();
|
|
1877
1925
|
continue;
|
|
1878
1926
|
}
|
|
1879
1927
|
if (input === "/provider") {
|
|
1880
|
-
console.log(
|
|
1881
|
-
console.log(
|
|
1928
|
+
console.log(chalk13.gray(`\uD604\uC7AC: ${provider.name} (${provider.model})`));
|
|
1929
|
+
console.log(chalk13.gray(`\uBCC0\uACBD: xgen provider add / xgen provider use <id>
|
|
1882
1930
|
`));
|
|
1883
1931
|
continue;
|
|
1884
1932
|
}
|
|
@@ -1886,17 +1934,17 @@ async function agentRepl() {
|
|
|
1886
1934
|
const { getProviders: gp } = await Promise.resolve().then(() => (init_store(), store_exports));
|
|
1887
1935
|
const all = gp();
|
|
1888
1936
|
if (all.length > 0) {
|
|
1889
|
-
console.log(
|
|
1937
|
+
console.log(chalk13.bold("\n \uB4F1\uB85D\uB41C \uD504\uB85C\uBC14\uC774\uB354:\n"));
|
|
1890
1938
|
all.forEach((p, i) => {
|
|
1891
|
-
const mark = p.id === provider.id ?
|
|
1939
|
+
const mark = p.id === provider.id ? chalk13.green("\u25CF ") : " ";
|
|
1892
1940
|
console.log(` ${mark}${i + 1}) ${p.name} (${p.model})`);
|
|
1893
1941
|
});
|
|
1894
|
-
console.log(
|
|
1942
|
+
console.log(chalk13.gray("\n \uBCC0\uACBD\uD558\uB824\uBA74 exit \uD6C4 xgen provider use <id>\n"));
|
|
1895
1943
|
}
|
|
1896
1944
|
continue;
|
|
1897
1945
|
}
|
|
1898
1946
|
if (input === "/home" || input === "/menu") {
|
|
1899
|
-
console.log(
|
|
1947
|
+
console.log(chalk13.gray("\uC5D0\uC774\uC804\uD2B8\uB97C \uC885\uB8CC\uD558\uACE0 \uD648\uC73C\uB85C \uB3CC\uC544\uAC11\uB2C8\uB2E4."));
|
|
1900
1948
|
mcpManager?.stopAll();
|
|
1901
1949
|
rl.close();
|
|
1902
1950
|
const { homeMenu: homeMenu2 } = await Promise.resolve().then(() => (init_home(), home_exports));
|
|
@@ -1905,10 +1953,10 @@ async function agentRepl() {
|
|
|
1905
1953
|
}
|
|
1906
1954
|
if (input === "/mcp") {
|
|
1907
1955
|
if (mcpManager && mcpManager.serverCount > 0) {
|
|
1908
|
-
console.log(
|
|
1909
|
-
console.log(
|
|
1956
|
+
console.log(chalk13.bold("\nMCP \uC11C\uBC84:"), mcpManager.getServerNames().join(", "));
|
|
1957
|
+
console.log(chalk13.gray("\uB3C4\uAD6C:"), mcpManager.getAllTools().map((t) => t.function.name).join(", "));
|
|
1910
1958
|
} else {
|
|
1911
|
-
console.log(
|
|
1959
|
+
console.log(chalk13.gray("MCP \uC11C\uBC84 \uC5C6\uC74C. .mcp.json\uC744 \uD504\uB85C\uC81D\uD2B8 \uB8E8\uD2B8\uC5D0 \uCD94\uAC00\uD558\uC138\uC694."));
|
|
1912
1960
|
}
|
|
1913
1961
|
console.log();
|
|
1914
1962
|
continue;
|
|
@@ -1917,7 +1965,7 @@ async function agentRepl() {
|
|
|
1917
1965
|
try {
|
|
1918
1966
|
await runAgentLoop(client2, provider.model, messages, allTools);
|
|
1919
1967
|
} catch (err) {
|
|
1920
|
-
console.log(
|
|
1968
|
+
console.log(chalk13.red(`
|
|
1921
1969
|
\uC624\uB958: ${err.message}
|
|
1922
1970
|
`));
|
|
1923
1971
|
}
|
|
@@ -1926,7 +1974,12 @@ async function agentRepl() {
|
|
|
1926
1974
|
async function runAgentLoop(client2, model, messages, tools2) {
|
|
1927
1975
|
const MAX_ITERATIONS = 20;
|
|
1928
1976
|
for (let i = 0; i < MAX_ITERATIONS; i++) {
|
|
1977
|
+
let first = true;
|
|
1929
1978
|
const result = await streamChat(client2, model, messages, tools2, (delta) => {
|
|
1979
|
+
if (first) {
|
|
1980
|
+
process.stdout.write(chalk13.green("\n AI \u203A") + " ");
|
|
1981
|
+
first = false;
|
|
1982
|
+
}
|
|
1930
1983
|
process.stdout.write(delta);
|
|
1931
1984
|
});
|
|
1932
1985
|
if (result.content) {
|
|
@@ -1954,7 +2007,7 @@ async function runAgentLoop(client2, model, messages, tools2) {
|
|
|
1954
2007
|
} catch {
|
|
1955
2008
|
args = {};
|
|
1956
2009
|
}
|
|
1957
|
-
console.log(
|
|
2010
|
+
console.log(chalk13.gray(` \u2699 `) + chalk13.white.bold(tc.name) + chalk13.gray(` ${summarizeArgs(args)}`));
|
|
1958
2011
|
let toolResult;
|
|
1959
2012
|
if (mcpManager?.isMcpTool(tc.name)) {
|
|
1960
2013
|
toolResult = await mcpManager.callTool(tc.name, args);
|
|
@@ -1969,7 +2022,7 @@ async function runAgentLoop(client2, model, messages, tools2) {
|
|
|
1969
2022
|
});
|
|
1970
2023
|
}
|
|
1971
2024
|
}
|
|
1972
|
-
console.log(
|
|
2025
|
+
console.log(chalk13.yellow("\n\uCD5C\uB300 \uBC18\uBCF5 \uD69F\uC218\uC5D0 \uB3C4\uB2EC\uD588\uC2B5\uB2C8\uB2E4.\n"));
|
|
1973
2026
|
}
|
|
1974
2027
|
function summarizeArgs(args) {
|
|
1975
2028
|
const parts = [];
|
|
@@ -1993,6 +2046,7 @@ var init_agent = __esm({
|
|
|
1993
2046
|
init_tools();
|
|
1994
2047
|
init_client2();
|
|
1995
2048
|
init_provider();
|
|
2049
|
+
init_ui();
|
|
1996
2050
|
SYSTEM_PROMPT = `You are OPEN XGEN Agent, an AI coding assistant running in the user's terminal.
|
|
1997
2051
|
You have access to tools for reading/writing files, executing commands, searching code, and running sandboxed code.
|
|
1998
2052
|
You can also use MCP (Model Context Protocol) tools if available.
|
|
@@ -2006,7 +2060,7 @@ For sandbox_run, you can install npm/pip packages and run isolated code.`;
|
|
|
2006
2060
|
|
|
2007
2061
|
// src/index.ts
|
|
2008
2062
|
import { Command } from "commander";
|
|
2009
|
-
import
|
|
2063
|
+
import chalk16 from "chalk";
|
|
2010
2064
|
|
|
2011
2065
|
// src/commands/config.ts
|
|
2012
2066
|
init_store();
|
|
@@ -2435,7 +2489,7 @@ init_agent();
|
|
|
2435
2489
|
|
|
2436
2490
|
// src/commands/doc.ts
|
|
2437
2491
|
init_store();
|
|
2438
|
-
import
|
|
2492
|
+
import chalk14 from "chalk";
|
|
2439
2493
|
|
|
2440
2494
|
// src/api/document.ts
|
|
2441
2495
|
init_client();
|
|
@@ -2479,7 +2533,7 @@ function registerDocCommand(program2) {
|
|
|
2479
2533
|
try {
|
|
2480
2534
|
const docs = await listDocuments(opts.collection);
|
|
2481
2535
|
if (!docs.length) {
|
|
2482
|
-
console.log(
|
|
2536
|
+
console.log(chalk14.yellow("\n\uBB38\uC11C\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.\n"));
|
|
2483
2537
|
return;
|
|
2484
2538
|
}
|
|
2485
2539
|
printHeader(`\uBB38\uC11C \uBAA9\uB85D (${docs.length}\uAC1C)`);
|
|
@@ -2503,10 +2557,10 @@ function registerDocCommand(program2) {
|
|
|
2503
2557
|
doc.command("upload <file>").description("\uBB38\uC11C \uC5C5\uB85C\uB4DC").option("-c, --collection <id>", "\uCEEC\uB809\uC158 ID").option("-n, --name <name>", "\uD30C\uC77C\uBA85").action(async (file, opts) => {
|
|
2504
2558
|
requireAuth();
|
|
2505
2559
|
try {
|
|
2506
|
-
console.log(
|
|
2560
|
+
console.log(chalk14.gray(`\uC5C5\uB85C\uB4DC \uC911: ${file}`));
|
|
2507
2561
|
const result = await uploadDocument(file, opts.collection, opts.name);
|
|
2508
|
-
console.log(
|
|
2509
|
-
console.log(
|
|
2562
|
+
console.log(chalk14.green("\u2713 \uC5C5\uB85C\uB4DC \uC644\uB8CC"));
|
|
2563
|
+
console.log(chalk14.gray(JSON.stringify(result, null, 2)));
|
|
2510
2564
|
} catch (err) {
|
|
2511
2565
|
printError(`\uC5C5\uB85C\uB4DC \uC2E4\uD328: ${err.message}`);
|
|
2512
2566
|
}
|
|
@@ -2516,7 +2570,7 @@ function registerDocCommand(program2) {
|
|
|
2516
2570
|
try {
|
|
2517
2571
|
const d = await getDocumentInfo(id);
|
|
2518
2572
|
printHeader("\uBB38\uC11C \uC815\uBCF4");
|
|
2519
|
-
console.log(
|
|
2573
|
+
console.log(chalk14.gray(JSON.stringify(d, null, 2)));
|
|
2520
2574
|
} catch (err) {
|
|
2521
2575
|
printError(`\uC870\uD68C \uC2E4\uD328: ${err.message}`);
|
|
2522
2576
|
}
|
|
@@ -2525,7 +2579,7 @@ function registerDocCommand(program2) {
|
|
|
2525
2579
|
|
|
2526
2580
|
// src/commands/ontology.ts
|
|
2527
2581
|
init_store();
|
|
2528
|
-
import
|
|
2582
|
+
import chalk15 from "chalk";
|
|
2529
2583
|
import { createInterface as createInterface7 } from "readline";
|
|
2530
2584
|
|
|
2531
2585
|
// src/api/ontology.ts
|
|
@@ -2563,19 +2617,19 @@ function registerOntologyCommand(program2) {
|
|
|
2563
2617
|
ont.command("query <question>").alias("q").description("GraphRAG \uC6D0\uC0F7 \uC9C8\uC758").option("-g, --graph <id>", "\uADF8\uB798\uD504 ID").option("--no-scs", "SCS \uCEE8\uD14D\uC2A4\uD2B8 \uBE44\uD65C\uC131\uD654").action(async (question, opts) => {
|
|
2564
2618
|
requireAuth();
|
|
2565
2619
|
try {
|
|
2566
|
-
console.log(
|
|
2620
|
+
console.log(chalk15.gray("\n\uC9C8\uC758 \uC911...\n"));
|
|
2567
2621
|
const result = await queryGraphRAG(question, opts.graph, { scs: opts.scs });
|
|
2568
2622
|
if (result.answer) {
|
|
2569
|
-
console.log(
|
|
2623
|
+
console.log(chalk15.bold("\uB2F5\uBCC0:"));
|
|
2570
2624
|
console.log(result.answer);
|
|
2571
2625
|
}
|
|
2572
2626
|
if (result.sources?.length) {
|
|
2573
|
-
console.log(
|
|
2574
|
-
result.sources.forEach((s) => console.log(
|
|
2627
|
+
console.log(chalk15.bold("\n\uCD9C\uCC98:"));
|
|
2628
|
+
result.sources.forEach((s) => console.log(chalk15.gray(` - ${s}`)));
|
|
2575
2629
|
}
|
|
2576
2630
|
if (result.triples_used?.length) {
|
|
2577
|
-
console.log(
|
|
2578
|
-
result.triples_used.forEach((t) => console.log(
|
|
2631
|
+
console.log(chalk15.bold("\n\uC0AC\uC6A9\uB41C \uD2B8\uB9AC\uD50C:"));
|
|
2632
|
+
result.triples_used.forEach((t) => console.log(chalk15.dim(` ${t}`)));
|
|
2579
2633
|
}
|
|
2580
2634
|
console.log();
|
|
2581
2635
|
} catch (err) {
|
|
@@ -2586,11 +2640,11 @@ function registerOntologyCommand(program2) {
|
|
|
2586
2640
|
requireAuth();
|
|
2587
2641
|
const sessionId = randomUUID3();
|
|
2588
2642
|
printHeader("Ontology Chat");
|
|
2589
|
-
console.log(
|
|
2643
|
+
console.log(chalk15.gray("\uBA40\uD2F0\uD134 GraphRAG \uB300\uD654. exit\uB85C \uC885\uB8CC.\n"));
|
|
2590
2644
|
const rl = createInterface7({ input: process.stdin, output: process.stdout });
|
|
2591
|
-
const
|
|
2645
|
+
const ask2 = () => new Promise((resolve) => rl.question(chalk15.green("\u276F "), (a) => resolve(a.trim())));
|
|
2592
2646
|
while (true) {
|
|
2593
|
-
const input = await
|
|
2647
|
+
const input = await ask2();
|
|
2594
2648
|
if (!input) continue;
|
|
2595
2649
|
if (input === "exit") {
|
|
2596
2650
|
rl.close();
|
|
@@ -2602,7 +2656,7 @@ function registerOntologyCommand(program2) {
|
|
|
2602
2656
|
${result.answer}
|
|
2603
2657
|
`);
|
|
2604
2658
|
} catch (err) {
|
|
2605
|
-
console.log(
|
|
2659
|
+
console.log(chalk15.red(`\uC624\uB958: ${err.message}
|
|
2606
2660
|
`));
|
|
2607
2661
|
}
|
|
2608
2662
|
}
|
|
@@ -2612,7 +2666,7 @@ ${result.answer}
|
|
|
2612
2666
|
try {
|
|
2613
2667
|
const stats = await getGraphStats(graphId);
|
|
2614
2668
|
printHeader("\uADF8\uB798\uD504 \uD1B5\uACC4");
|
|
2615
|
-
console.log(
|
|
2669
|
+
console.log(chalk15.gray(JSON.stringify(stats, null, 2)));
|
|
2616
2670
|
console.log();
|
|
2617
2671
|
} catch (err) {
|
|
2618
2672
|
printError(`\uD1B5\uACC4 \uC870\uD68C \uC2E4\uD328: ${err.message}`);
|
|
@@ -2623,42 +2677,42 @@ ${result.answer}
|
|
|
2623
2677
|
// src/index.ts
|
|
2624
2678
|
init_home();
|
|
2625
2679
|
var VERSION = "0.3.0";
|
|
2626
|
-
var LOGO =
|
|
2680
|
+
var LOGO = chalk16.cyan(`
|
|
2627
2681
|
\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588 \u2588\u2588
|
|
2628
2682
|
\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588
|
|
2629
2683
|
\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588
|
|
2630
2684
|
\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588
|
|
2631
2685
|
\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588
|
|
2632
|
-
`) +
|
|
2686
|
+
`) + chalk16.white.bold(`
|
|
2633
2687
|
\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588 \u2588\u2588
|
|
2634
2688
|
\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588
|
|
2635
2689
|
\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588
|
|
2636
2690
|
\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588
|
|
2637
2691
|
\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588
|
|
2638
|
-
`) +
|
|
2692
|
+
`) + chalk16.gray(` v${VERSION}
|
|
2639
2693
|
`);
|
|
2640
2694
|
var BANNER = LOGO;
|
|
2641
2695
|
var program = new Command();
|
|
2642
2696
|
program.name("xgen").description("OPEN XGEN \u2014 AI Coding Agent + XGEN Platform CLI").version(VERSION).addHelpText("before", BANNER).addHelpText(
|
|
2643
2697
|
"after",
|
|
2644
2698
|
`
|
|
2645
|
-
${
|
|
2646
|
-
${
|
|
2647
|
-
${
|
|
2648
|
-
${
|
|
2649
|
-
${
|
|
2699
|
+
${chalk16.bold("\uC2DC\uC791\uD558\uAE30:")}
|
|
2700
|
+
${chalk16.cyan("xgen provider add")} AI \uD504\uB85C\uBC14\uC774\uB354 \uC124\uC815
|
|
2701
|
+
${chalk16.cyan("xgen agent")} AI \uCF54\uB529 \uC5D0\uC774\uC804\uD2B8
|
|
2702
|
+
${chalk16.cyan("xgen config set-server")} <url> XGEN \uC11C\uBC84 \uC5F0\uACB0
|
|
2703
|
+
${chalk16.cyan("xgen login")} \uC11C\uBC84 \uB85C\uADF8\uC778
|
|
2650
2704
|
|
|
2651
|
-
${
|
|
2652
|
-
${
|
|
2653
|
-
${
|
|
2654
|
-
${
|
|
2705
|
+
${chalk16.bold("AI \uC5D0\uC774\uC804\uD2B8:")}
|
|
2706
|
+
${chalk16.cyan("xgen agent")} \uCF54\uB529 \uC5D0\uC774\uC804\uD2B8 (\uD30C\uC77C, \uD130\uBBF8\uB110, \uAC80\uC0C9)
|
|
2707
|
+
${chalk16.cyan("xgen provider ls")} \uD504\uB85C\uBC14\uC774\uB354 \uBAA9\uB85D
|
|
2708
|
+
${chalk16.cyan("xgen provider add")} \uD504\uB85C\uBC14\uC774\uB354 \uCD94\uAC00
|
|
2655
2709
|
|
|
2656
|
-
${
|
|
2657
|
-
${
|
|
2658
|
-
${
|
|
2659
|
-
${
|
|
2660
|
-
${
|
|
2661
|
-
${
|
|
2710
|
+
${chalk16.bold("XGEN \uD50C\uB7AB\uD3FC:")}
|
|
2711
|
+
${chalk16.cyan("xgen chat")} \uC6CC\uD06C\uD50C\uB85C\uC6B0 \uB300\uD654
|
|
2712
|
+
${chalk16.cyan("xgen wf ls")} \uC6CC\uD06C\uD50C\uB85C\uC6B0 \uBAA9\uB85D
|
|
2713
|
+
${chalk16.cyan("xgen wf run")} <id> "\uC9C8\uBB38" \uC6CC\uD06C\uD50C\uB85C\uC6B0 \uC2E4\uD589
|
|
2714
|
+
${chalk16.cyan("xgen doc ls")} \uBB38\uC11C \uBAA9\uB85D
|
|
2715
|
+
${chalk16.cyan("xgen ont query")} "\uC9C8\uBB38" \uC628\uD1A8\uB85C\uC9C0 \uC9C8\uC758
|
|
2662
2716
|
`
|
|
2663
2717
|
);
|
|
2664
2718
|
registerConfigCommand(program);
|
|
@@ -2671,7 +2725,7 @@ registerDocCommand(program);
|
|
|
2671
2725
|
registerOntologyCommand(program);
|
|
2672
2726
|
if (process.argv.length <= 2) {
|
|
2673
2727
|
homeMenu().catch((err) => {
|
|
2674
|
-
console.error(
|
|
2728
|
+
console.error(chalk16.red(`\uC624\uB958: ${err.message}`));
|
|
2675
2729
|
process.exit(1);
|
|
2676
2730
|
});
|
|
2677
2731
|
} else {
|