@xagent/x-cli 1.1.50 → 1.1.52
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/README.md +1 -1
- package/dist/index.js +202 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -58,7 +58,9 @@ var init_settings_manager = __esm({
|
|
|
58
58
|
"grok-3-latest",
|
|
59
59
|
"grok-3-fast",
|
|
60
60
|
"grok-3-mini-fast"
|
|
61
|
-
]
|
|
61
|
+
],
|
|
62
|
+
verbosityLevel: "quiet",
|
|
63
|
+
explainLevel: "brief"
|
|
62
64
|
};
|
|
63
65
|
DEFAULT_PROJECT_SETTINGS = {
|
|
64
66
|
model: "grok-code-fast-1"
|
|
@@ -9291,7 +9293,7 @@ EOF`;
|
|
|
9291
9293
|
var package_default = {
|
|
9292
9294
|
type: "module",
|
|
9293
9295
|
name: "@xagent/x-cli",
|
|
9294
|
-
version: "1.1.
|
|
9296
|
+
version: "1.1.52",
|
|
9295
9297
|
description: "An open-source AI agent that brings the power of Grok directly into your terminal.",
|
|
9296
9298
|
main: "dist/index.js",
|
|
9297
9299
|
module: "dist/index.js",
|
|
@@ -14883,7 +14885,22 @@ function useInputHandler({
|
|
|
14883
14885
|
});
|
|
14884
14886
|
const [shiftTabPressCount, setShiftTabPressCount] = useState(0);
|
|
14885
14887
|
const [lastShiftTabTime, setLastShiftTabTime] = useState(0);
|
|
14886
|
-
const [verbosityLevel, setVerbosityLevel] = useState(
|
|
14888
|
+
const [verbosityLevel, setVerbosityLevel] = useState(() => {
|
|
14889
|
+
try {
|
|
14890
|
+
const manager = getSettingsManager();
|
|
14891
|
+
return manager.getUserSetting("verbosityLevel") || "quiet";
|
|
14892
|
+
} catch {
|
|
14893
|
+
return "quiet";
|
|
14894
|
+
}
|
|
14895
|
+
});
|
|
14896
|
+
const [explainLevel, setExplainLevel] = useState(() => {
|
|
14897
|
+
try {
|
|
14898
|
+
const manager = getSettingsManager();
|
|
14899
|
+
return manager.getUserSetting("explainLevel") || "brief";
|
|
14900
|
+
} catch {
|
|
14901
|
+
return "brief";
|
|
14902
|
+
}
|
|
14903
|
+
});
|
|
14887
14904
|
const planMode = usePlanMode({}, agent);
|
|
14888
14905
|
const handleSpecialKey = (key) => {
|
|
14889
14906
|
if (isConfirmationActive) {
|
|
@@ -15130,6 +15147,8 @@ Built-in Commands:
|
|
|
15130
15147
|
/clear - Clear chat history
|
|
15131
15148
|
/help - Show this help
|
|
15132
15149
|
/models - Switch between available models
|
|
15150
|
+
/verbosity - Control output verbosity (quiet/normal/verbose)
|
|
15151
|
+
/explain - Control operation explanations (off/brief/detailed)
|
|
15133
15152
|
/version - Show version information and check for updates
|
|
15134
15153
|
/upgrade - Check for updates and upgrade automatically
|
|
15135
15154
|
/switch - Switch to specific version (/switch <version>)
|
|
@@ -16239,22 +16258,27 @@ Auto-compact automatically enables compact mode when conversations exceed thresh
|
|
|
16239
16258
|
content: `\u{1F50A} **Current Verbosity Level: ${verbosityLevel.toUpperCase()}**
|
|
16240
16259
|
|
|
16241
16260
|
**Available levels:**
|
|
16242
|
-
- \`
|
|
16243
|
-
- \`
|
|
16244
|
-
- \`
|
|
16261
|
+
- \`quiet\` - Minimal output, suppress prefixes and extra formatting
|
|
16262
|
+
- \`normal\` - Current default behavior with full details
|
|
16263
|
+
- \`verbose\` - Additional details and debug information
|
|
16245
16264
|
|
|
16246
16265
|
**Usage:** \`/verbosity <level>\`
|
|
16247
16266
|
**Example:** \`/verbosity quiet\``,
|
|
16248
16267
|
timestamp: /* @__PURE__ */ new Date()
|
|
16249
16268
|
};
|
|
16250
16269
|
setChatHistory((prev) => [...prev, levelEntry]);
|
|
16251
|
-
} else if (["
|
|
16270
|
+
} else if (["quiet", "normal", "verbose"].includes(newLevel)) {
|
|
16252
16271
|
setVerbosityLevel(newLevel);
|
|
16272
|
+
try {
|
|
16273
|
+
const manager = getSettingsManager();
|
|
16274
|
+
manager.updateUserSetting("verbosityLevel", newLevel);
|
|
16275
|
+
} catch (_error) {
|
|
16276
|
+
}
|
|
16253
16277
|
const confirmEntry = {
|
|
16254
16278
|
type: "assistant",
|
|
16255
16279
|
content: `\u2705 **Verbosity level set to: ${newLevel.toUpperCase()}**
|
|
16256
16280
|
|
|
16257
|
-
Tool outputs will now show ${newLevel === "
|
|
16281
|
+
Tool outputs will now show ${newLevel === "quiet" ? "minimal output" : newLevel === "normal" ? "full details" : "extra details and debug information"}.`,
|
|
16258
16282
|
timestamp: /* @__PURE__ */ new Date()
|
|
16259
16283
|
};
|
|
16260
16284
|
setChatHistory((prev) => [...prev, confirmEntry]);
|
|
@@ -16263,7 +16287,7 @@ Tool outputs will now show ${newLevel === "minimal" ? "only tool names" : newLev
|
|
|
16263
16287
|
type: "assistant",
|
|
16264
16288
|
content: `\u274C **Invalid verbosity level: ${newLevel}**
|
|
16265
16289
|
|
|
16266
|
-
**Available levels:**
|
|
16290
|
+
**Available levels:** quiet, normal, verbose
|
|
16267
16291
|
|
|
16268
16292
|
**Usage:** \`/verbosity <level>\``,
|
|
16269
16293
|
timestamp: /* @__PURE__ */ new Date()
|
|
@@ -16273,6 +16297,54 @@ Tool outputs will now show ${newLevel === "minimal" ? "only tool names" : newLev
|
|
|
16273
16297
|
clearInput();
|
|
16274
16298
|
return true;
|
|
16275
16299
|
}
|
|
16300
|
+
if (trimmedInput === "/explain" || trimmedInput.startsWith("/explain ")) {
|
|
16301
|
+
const args = trimmedInput.split(" ").slice(1);
|
|
16302
|
+
const newLevel = args[0];
|
|
16303
|
+
if (!newLevel) {
|
|
16304
|
+
const levelEntry = {
|
|
16305
|
+
type: "assistant",
|
|
16306
|
+
content: `\u{1F4A1} **Current Explain Level: ${explainLevel.toUpperCase()}**
|
|
16307
|
+
|
|
16308
|
+
**Available levels:**
|
|
16309
|
+
- \`off\` - No explanations
|
|
16310
|
+
- \`brief\` - Short reasons for operations
|
|
16311
|
+
- \`detailed\` - Comprehensive explanations with context
|
|
16312
|
+
|
|
16313
|
+
**Usage:** \`/explain <level>\`
|
|
16314
|
+
**Example:** \`/explain brief\``,
|
|
16315
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
16316
|
+
};
|
|
16317
|
+
setChatHistory((prev) => [...prev, levelEntry]);
|
|
16318
|
+
} else if (["off", "brief", "detailed"].includes(newLevel)) {
|
|
16319
|
+
setExplainLevel(newLevel);
|
|
16320
|
+
try {
|
|
16321
|
+
const manager = getSettingsManager();
|
|
16322
|
+
manager.updateUserSetting("explainLevel", newLevel);
|
|
16323
|
+
} catch (_error) {
|
|
16324
|
+
}
|
|
16325
|
+
const confirmEntry = {
|
|
16326
|
+
type: "assistant",
|
|
16327
|
+
content: `\u2705 **Explain level set to: ${newLevel.toUpperCase()}**
|
|
16328
|
+
|
|
16329
|
+
Operations will now ${newLevel === "off" ? "show no explanations" : newLevel === "brief" ? "show brief reasons" : "show detailed explanations with context"}.`,
|
|
16330
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
16331
|
+
};
|
|
16332
|
+
setChatHistory((prev) => [...prev, confirmEntry]);
|
|
16333
|
+
} else {
|
|
16334
|
+
const errorEntry = {
|
|
16335
|
+
type: "assistant",
|
|
16336
|
+
content: `\u274C **Invalid explain level: ${newLevel}**
|
|
16337
|
+
|
|
16338
|
+
**Available levels:** off, brief, detailed
|
|
16339
|
+
|
|
16340
|
+
**Usage:** \`/explain <level>\``,
|
|
16341
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
16342
|
+
};
|
|
16343
|
+
setChatHistory((prev) => [...prev, errorEntry]);
|
|
16344
|
+
}
|
|
16345
|
+
clearInput();
|
|
16346
|
+
return true;
|
|
16347
|
+
}
|
|
16276
16348
|
const directBashCommands = [
|
|
16277
16349
|
"ls",
|
|
16278
16350
|
"pwd",
|
|
@@ -16475,6 +16547,7 @@ Tool outputs will now show ${newLevel === "minimal" ? "only tool names" : newLev
|
|
|
16475
16547
|
agent,
|
|
16476
16548
|
autoEditEnabled,
|
|
16477
16549
|
verbosityLevel,
|
|
16550
|
+
explainLevel,
|
|
16478
16551
|
// Plan mode state and actions
|
|
16479
16552
|
planMode
|
|
16480
16553
|
};
|
|
@@ -16866,7 +16939,35 @@ var handleLongContent = (content, maxLength = 5e3) => {
|
|
|
16866
16939
|
};
|
|
16867
16940
|
};
|
|
16868
16941
|
var MemoizedChatEntry = React3.memo(
|
|
16869
|
-
({ entry, index, verbosityLevel }) => {
|
|
16942
|
+
({ entry, index, verbosityLevel, explainLevel }) => {
|
|
16943
|
+
const getExplanation = (toolName, filePath, _isExecuting) => {
|
|
16944
|
+
if (explainLevel === "off") return null;
|
|
16945
|
+
const explanations = {
|
|
16946
|
+
view_file: {
|
|
16947
|
+
brief: `Reading ${filePath} to examine its contents`,
|
|
16948
|
+
detailed: `Reading the file ${filePath} to examine its current contents, structure, and implementation details for analysis or modification.`
|
|
16949
|
+
},
|
|
16950
|
+
str_replace_editor: {
|
|
16951
|
+
brief: `Updating ${filePath} with changes`,
|
|
16952
|
+
detailed: `Applying targeted modifications to ${filePath} using precise string replacement to update specific code sections while preserving the rest of the file structure.`
|
|
16953
|
+
},
|
|
16954
|
+
create_file: {
|
|
16955
|
+
brief: `Creating new file ${filePath}`,
|
|
16956
|
+
detailed: `Creating a new file at ${filePath} with the specified content, establishing the initial structure and implementation for this component or module.`
|
|
16957
|
+
},
|
|
16958
|
+
bash: {
|
|
16959
|
+
brief: `Executing command: ${filePath}`,
|
|
16960
|
+
detailed: `Running the shell command "${filePath}" to perform system operations, file management, or external tool execution as requested.`
|
|
16961
|
+
},
|
|
16962
|
+
search: {
|
|
16963
|
+
brief: `Searching for: ${filePath}`,
|
|
16964
|
+
detailed: `Performing a comprehensive search across the codebase for "${filePath}" to locate relevant files, functions, or code patterns that match the query.`
|
|
16965
|
+
}
|
|
16966
|
+
};
|
|
16967
|
+
const explanation = explanations[toolName];
|
|
16968
|
+
if (!explanation) return null;
|
|
16969
|
+
return explainLevel === "detailed" ? explanation.detailed : explanation.brief;
|
|
16970
|
+
};
|
|
16870
16971
|
const renderDiff = (diffContent, filename) => {
|
|
16871
16972
|
return /* @__PURE__ */ jsx(
|
|
16872
16973
|
DiffRenderer,
|
|
@@ -16985,8 +17086,9 @@ var MemoizedChatEntry = React3.memo(
|
|
|
16985
17086
|
};
|
|
16986
17087
|
const shouldShowDiff = entry.toolCall?.function?.name === "str_replace_editor" && entry.toolResult?.success && entry.content.includes("Updated") && entry.content.includes("---") && entry.content.includes("+++");
|
|
16987
17088
|
const shouldShowFileContent = (entry.toolCall?.function?.name === "view_file" || entry.toolCall?.function?.name === "create_file") && entry.toolResult?.success && !shouldShowDiff;
|
|
16988
|
-
const shouldShowToolContent = verbosityLevel !== "
|
|
16989
|
-
const shouldShowFullContent = verbosityLevel === "normal";
|
|
17089
|
+
const shouldShowToolContent = verbosityLevel !== "quiet";
|
|
17090
|
+
const shouldShowFullContent = verbosityLevel === "normal" || verbosityLevel === "verbose";
|
|
17091
|
+
const explanation = getExplanation(toolName, filePath);
|
|
16990
17092
|
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
|
|
16991
17093
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
16992
17094
|
/* @__PURE__ */ jsx(Text, { color: "magenta", children: "\u23FA" }),
|
|
@@ -16995,6 +17097,10 @@ var MemoizedChatEntry = React3.memo(
|
|
|
16995
17097
|
filePath ? `${actionName}(${filePath})` : actionName
|
|
16996
17098
|
] })
|
|
16997
17099
|
] }),
|
|
17100
|
+
explanation && /* @__PURE__ */ jsx(Box, { marginLeft: 2, children: /* @__PURE__ */ jsxs(Text, { color: "blue", italic: true, children: [
|
|
17101
|
+
"\u{1F4A1} ",
|
|
17102
|
+
explanation
|
|
17103
|
+
] }) }),
|
|
16998
17104
|
shouldShowToolContent && /* @__PURE__ */ jsx(Box, { marginLeft: 2, flexDirection: "column", children: isExecuting ? /* @__PURE__ */ jsx(Text, { color: "cyan", children: "\u23BF Executing..." }) : shouldShowFileContent && shouldShowFullContent ? /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
16999
17105
|
/* @__PURE__ */ jsx(Text, { color: "gray", children: "\u23BF File contents:" }),
|
|
17000
17106
|
/* @__PURE__ */ jsx(Box, { marginLeft: 2, flexDirection: "column", children: renderFileContent(entry.content) })
|
|
@@ -17004,7 +17110,7 @@ var MemoizedChatEntry = React3.memo(
|
|
|
17004
17110
|
"\u23BF ",
|
|
17005
17111
|
entry.content.split("\n")[0]
|
|
17006
17112
|
] })
|
|
17007
|
-
) :
|
|
17113
|
+
) : !shouldShowFullContent ? /* @__PURE__ */ jsx(Text, { color: "gray", children: "\u23BF Completed" }) : /* @__PURE__ */ jsxs(Text, { color: "gray", children: [
|
|
17008
17114
|
"\u23BF ",
|
|
17009
17115
|
formatToolContent(entry.content, toolName)
|
|
17010
17116
|
] }) }),
|
|
@@ -17019,7 +17125,8 @@ MemoizedChatEntry.displayName = "MemoizedChatEntry";
|
|
|
17019
17125
|
function ChatHistory({
|
|
17020
17126
|
entries,
|
|
17021
17127
|
isConfirmationActive = false,
|
|
17022
|
-
verbosityLevel = "
|
|
17128
|
+
verbosityLevel = "quiet",
|
|
17129
|
+
explainLevel = "brief"
|
|
17023
17130
|
}) {
|
|
17024
17131
|
const filteredEntries = isConfirmationActive ? entries.filter(
|
|
17025
17132
|
(entry) => !(entry.type === "tool_call" && entry.content === "Executing...")
|
|
@@ -17030,7 +17137,8 @@ function ChatHistory({
|
|
|
17030
17137
|
{
|
|
17031
17138
|
entry,
|
|
17032
17139
|
index,
|
|
17033
|
-
verbosityLevel
|
|
17140
|
+
verbosityLevel,
|
|
17141
|
+
explainLevel
|
|
17034
17142
|
},
|
|
17035
17143
|
`${entry.timestamp.getTime()}-${index}`
|
|
17036
17144
|
)) });
|
|
@@ -18166,6 +18274,7 @@ function ChatInterfaceWithAgent({
|
|
|
18166
18274
|
availableModels,
|
|
18167
18275
|
autoEditEnabled,
|
|
18168
18276
|
verbosityLevel,
|
|
18277
|
+
explainLevel,
|
|
18169
18278
|
planMode
|
|
18170
18279
|
} = useInputHandler({
|
|
18171
18280
|
agent,
|
|
@@ -18200,6 +18309,82 @@ function ChatInterfaceWithAgent({
|
|
|
18200
18309
|
});
|
|
18201
18310
|
console.log(" ");
|
|
18202
18311
|
setChatHistory([]);
|
|
18312
|
+
if (fs__default.existsSync(".agent")) {
|
|
18313
|
+
const initialMessages = [];
|
|
18314
|
+
const archPath = path7__default.join(".agent", "system", "architecture.md");
|
|
18315
|
+
if (fs__default.existsSync(archPath)) {
|
|
18316
|
+
try {
|
|
18317
|
+
const archContent = fs__default.readFileSync(archPath, "utf8");
|
|
18318
|
+
initialMessages.push({
|
|
18319
|
+
type: "assistant",
|
|
18320
|
+
content: `\u{1F4CB} **System Architecture (from .agent/system/architecture.md)**
|
|
18321
|
+
|
|
18322
|
+
${archContent}`,
|
|
18323
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
18324
|
+
});
|
|
18325
|
+
} catch (_error) {
|
|
18326
|
+
}
|
|
18327
|
+
}
|
|
18328
|
+
const workflowPath = path7__default.join(".agent", "sop", "git-workflow.md");
|
|
18329
|
+
if (fs__default.existsSync(workflowPath)) {
|
|
18330
|
+
try {
|
|
18331
|
+
const workflowContent = fs__default.readFileSync(workflowPath, "utf8");
|
|
18332
|
+
initialMessages.push({
|
|
18333
|
+
type: "assistant",
|
|
18334
|
+
content: `\u{1F527} **Git Workflow SOP (from .agent/sop/git-workflow.md)**
|
|
18335
|
+
|
|
18336
|
+
${workflowContent}`,
|
|
18337
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
18338
|
+
});
|
|
18339
|
+
} catch (_error) {
|
|
18340
|
+
}
|
|
18341
|
+
}
|
|
18342
|
+
const sopDir = path7__default.join(".agent", "sop");
|
|
18343
|
+
if (fs__default.existsSync(sopDir)) {
|
|
18344
|
+
const sopFiles = ["release-management.md", "automation-protection.md"];
|
|
18345
|
+
for (const file of sopFiles) {
|
|
18346
|
+
const filePath = path7__default.join(sopDir, file);
|
|
18347
|
+
if (fs__default.existsSync(filePath)) {
|
|
18348
|
+
try {
|
|
18349
|
+
const content = fs__default.readFileSync(filePath, "utf8");
|
|
18350
|
+
const title = file.replace(".md", "").replace("-", " ").toUpperCase();
|
|
18351
|
+
initialMessages.push({
|
|
18352
|
+
type: "assistant",
|
|
18353
|
+
content: `\u{1F4D6} **${title} SOP (from .agent/sop/${file})**
|
|
18354
|
+
|
|
18355
|
+
${content}`,
|
|
18356
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
18357
|
+
});
|
|
18358
|
+
} catch (_error) {
|
|
18359
|
+
}
|
|
18360
|
+
}
|
|
18361
|
+
}
|
|
18362
|
+
}
|
|
18363
|
+
const systemDir = path7__default.join(".agent", "system");
|
|
18364
|
+
if (fs__default.existsSync(systemDir)) {
|
|
18365
|
+
const systemFiles = ["critical-state.md", "installation.md", "api-schema.md"];
|
|
18366
|
+
for (const file of systemFiles) {
|
|
18367
|
+
const filePath = path7__default.join(systemDir, file);
|
|
18368
|
+
if (fs__default.existsSync(filePath)) {
|
|
18369
|
+
try {
|
|
18370
|
+
const content = fs__default.readFileSync(filePath, "utf8");
|
|
18371
|
+
const title = file.replace(".md", "").replace("-", " ").toUpperCase();
|
|
18372
|
+
initialMessages.push({
|
|
18373
|
+
type: "assistant",
|
|
18374
|
+
content: `\u{1F3D7}\uFE0F **${title} (from .agent/system/${file})**
|
|
18375
|
+
|
|
18376
|
+
${content}`,
|
|
18377
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
18378
|
+
});
|
|
18379
|
+
} catch (_error) {
|
|
18380
|
+
}
|
|
18381
|
+
}
|
|
18382
|
+
}
|
|
18383
|
+
}
|
|
18384
|
+
if (initialMessages.length > 0) {
|
|
18385
|
+
setChatHistory(initialMessages);
|
|
18386
|
+
}
|
|
18387
|
+
}
|
|
18203
18388
|
}, []);
|
|
18204
18389
|
useEffect(() => {
|
|
18205
18390
|
const newEntries = chatHistory.slice(lastChatHistoryLength.current);
|
|
@@ -18468,7 +18653,8 @@ function ChatInterfaceWithAgent({
|
|
|
18468
18653
|
{
|
|
18469
18654
|
entries: chatHistory,
|
|
18470
18655
|
isConfirmationActive: !!confirmationOptions,
|
|
18471
|
-
verbosityLevel
|
|
18656
|
+
verbosityLevel,
|
|
18657
|
+
explainLevel
|
|
18472
18658
|
}
|
|
18473
18659
|
) }),
|
|
18474
18660
|
/* @__PURE__ */ jsx(
|