@xagent/x-cli 1.2.1 → 1.2.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/dist/index.js CHANGED
@@ -20,11 +20,11 @@ import { glob } from 'glob';
20
20
  import crypto2 from 'crypto';
21
21
  import { encoding_for_model, get_encoding } from 'tiktoken';
22
22
  import * as readline from 'readline';
23
- import React5, { useState, useRef, useEffect, useMemo, useCallback } from 'react';
23
+ import React4, { useState, useRef, useEffect, useMemo, useCallback } from 'react';
24
24
  import { render, Box, Text, useApp, useInput } from 'ink';
25
25
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
26
+ import chalk2 from 'chalk';
26
27
  import { program, Command } from 'commander';
27
- import chalk from 'chalk';
28
28
  import * as dotenv from 'dotenv';
29
29
 
30
30
  var __create = Object.create;
@@ -19701,6 +19701,10 @@ ${output?.plan?.summary || "Task completed"}`,
19701
19701
  instructions += "- Keep responses CONCISE and to the point. Avoid lengthy explanations.\n";
19702
19702
  instructions += "- Prioritize brevity over detail unless specifically requested.\n";
19703
19703
  instructions += "- Use minimal formatting and avoid verbose tool descriptions.\n";
19704
+ instructions += "- NEVER use separators like ### or --- between tool results and your response.\n";
19705
+ instructions += "- Provide analysis immediately after tools without visual dividers.\n";
19706
+ instructions += "- You may use **bold** and _italic_ for emphasis when helpful.\n";
19707
+ instructions += "- Match Claude Code style: tool outputs followed by clean, well-formatted analysis.\n";
19704
19708
  break;
19705
19709
  case "normal":
19706
19710
  instructions += "- Provide balanced responses with appropriate detail.\n";
@@ -19726,6 +19730,11 @@ ${output?.plan?.summary || "Task completed"}`,
19726
19730
  instructions += "- Provide detailed context for all operations.\n";
19727
19731
  break;
19728
19732
  }
19733
+ instructions += "\n";
19734
+ instructions += "\n\u{1F4A1} VISUAL FORMATTING:\n";
19735
+ instructions += "- Use emojis for status: \u2705 success, \u274C error, \u26A0\uFE0F warning, \u{1F4A1} tips\n";
19736
+ instructions += "- Add checkmarks for completed features or working items\n";
19737
+ instructions += "- Use appropriate emojis to make responses more scannable\n";
19729
19738
  return instructions;
19730
19739
  }
19731
19740
  // Plan Mode integration methods
@@ -27083,7 +27092,7 @@ var init_package = __esm({
27083
27092
  package_default = {
27084
27093
  type: "module",
27085
27094
  name: "@xagent/one-shot",
27086
- version: "1.2.1",
27095
+ version: "1.2.2",
27087
27096
  description: "An open-source AI agent that brings advanced AI capabilities directly into your terminal with automatic documentation updates.",
27088
27097
  main: "dist/index.js",
27089
27098
  module: "dist/index.js",
@@ -28815,12 +28824,12 @@ Auto-compact automatically enables compact mode when conversations exceed thresh
28815
28824
  content: `\u{1F50A} **Current Verbosity Level: ${verbosityLevel.toUpperCase()}**
28816
28825
 
28817
28826
  **Available levels:**
28818
- - \`quiet\` - Minimal output, suppress prefixes and extra formatting
28827
+ - \`quiet\` - \u{1F3AF} **Claude Code mode**: Ultra-brief tool output (\`\u23BF Read X lines (ctrl+r to expand)\`)
28819
28828
  - \`normal\` - Current default behavior with full details
28820
28829
  - \`verbose\` - Additional details and debug information
28821
28830
 
28822
28831
  **Usage:** \`/verbosity <level>\`
28823
- **Example:** \`/verbosity quiet\``,
28832
+ **Example:** \`/verbosity quiet\` (for Claude Code parity)`,
28824
28833
  timestamp: /* @__PURE__ */ new Date()
28825
28834
  };
28826
28835
  setChatHistory((prev) => [...prev, levelEntry]);
@@ -28835,7 +28844,7 @@ Auto-compact automatically enables compact mode when conversations exceed thresh
28835
28844
  type: "assistant",
28836
28845
  content: `\u2705 **Verbosity level set to: ${newLevel.toUpperCase()}**
28837
28846
 
28838
- Tool outputs will now show ${newLevel === "quiet" ? "minimal output" : newLevel === "normal" ? "full details" : "extra details and debug information"}.`,
28847
+ ${newLevel === "quiet" ? "\u{1F3AF} **Claude Code mode activated!** Tool outputs will now show ultra-brief format: `\u23BF Read X lines (ctrl+r to expand)`" : newLevel === "normal" ? "Tool outputs will now show full details." : "Tool outputs will now show extra details and debug information."}`,
28839
28848
  timestamp: /* @__PURE__ */ new Date()
28840
28849
  };
28841
28850
  setChatHistory((prev) => [...prev, confirmEntry]);
@@ -30472,18 +30481,179 @@ var init_user_message_entry = __esm({
30472
30481
  };
30473
30482
  }
30474
30483
  });
30484
+ function MarkdownRenderer({ content }) {
30485
+ try {
30486
+ return /* @__PURE__ */ jsx(InlineMarkdown, { content });
30487
+ } catch (error) {
30488
+ console.error("Markdown rendering error:", error);
30489
+ return /* @__PURE__ */ jsx(Text, { wrap: "wrap", dimColor: false, children: content });
30490
+ }
30491
+ }
30492
+ function InlineMarkdown({ content }) {
30493
+ const lines = content.split("\n");
30494
+ return /* @__PURE__ */ jsx(Text, { wrap: "wrap", dimColor: false, children: lines.map((line, lineIndex) => /* @__PURE__ */ jsxs(React4.Fragment, { children: [
30495
+ lineIndex > 0 && "\n",
30496
+ parseInlineMarkdown(line).map((part, partIndex) => {
30497
+ if (part.type === "header") {
30498
+ return /* @__PURE__ */ jsx(Text, { bold: true, color: "white", children: part.text }, `${lineIndex}-${partIndex}`);
30499
+ }
30500
+ if (part.type === "bold") {
30501
+ return /* @__PURE__ */ jsx(Text, { bold: true, color: "white", children: part.text }, `${lineIndex}-${partIndex}`);
30502
+ }
30503
+ if (part.type === "italic") {
30504
+ return /* @__PURE__ */ jsx(Text, { italic: true, color: "gray", children: part.text }, `${lineIndex}-${partIndex}`);
30505
+ }
30506
+ if (part.type === "code") {
30507
+ return /* @__PURE__ */ jsx(Text, { color: "cyan", children: part.text }, `${lineIndex}-${partIndex}`);
30508
+ }
30509
+ if (part.type === "emoji") {
30510
+ const emoji = part.text;
30511
+ if (emoji === "\u2705" || emoji === "\u2713") {
30512
+ return /* @__PURE__ */ jsx(Text, { color: "green", children: emoji }, `${lineIndex}-${partIndex}`);
30513
+ }
30514
+ if (emoji === "\u274C" || emoji === "\u2717") {
30515
+ return /* @__PURE__ */ jsx(Text, { color: "red", children: emoji }, `${lineIndex}-${partIndex}`);
30516
+ }
30517
+ if (emoji === "\u26A0\uFE0F" || emoji === "\u26A0") {
30518
+ return /* @__PURE__ */ jsx(Text, { color: "yellow", children: emoji }, `${lineIndex}-${partIndex}`);
30519
+ }
30520
+ if (emoji === "\u{1F4A1}" || emoji === "\u2139\uFE0F" || emoji === "\u{1F50D}") {
30521
+ return /* @__PURE__ */ jsx(Text, { color: "blue", children: emoji }, `${lineIndex}-${partIndex}`);
30522
+ }
30523
+ return /* @__PURE__ */ jsx(Text, { color: "white", children: emoji }, `${lineIndex}-${partIndex}`);
30524
+ }
30525
+ if (part.type === "metadata") {
30526
+ return /* @__PURE__ */ jsx(Text, { color: "gray", dimColor: true, children: part.text }, `${lineIndex}-${partIndex}`);
30527
+ }
30528
+ return /* @__PURE__ */ jsx(Text, { color: "white", children: part.text }, `${lineIndex}-${partIndex}`);
30529
+ })
30530
+ ] }, lineIndex)) });
30531
+ }
30532
+ function parseInlineMarkdown(content) {
30533
+ if (content.match(/^#+\s*$/)) {
30534
+ return [];
30535
+ }
30536
+ const headerMatch = content.match(/^(#+)\s+(.*)$/);
30537
+ if (headerMatch) {
30538
+ const [, hashes, headerText] = headerMatch;
30539
+ return [{ type: "header", text: headerText.trim(), level: hashes.length }];
30540
+ }
30541
+ const parts = [];
30542
+ let current = "";
30543
+ let i = 0;
30544
+ while (i < content.length) {
30545
+ if (content[i] === "`" && i < content.length - 1) {
30546
+ if (current) {
30547
+ parts.push({ type: "text", text: current });
30548
+ current = "";
30549
+ }
30550
+ const closeIndex = content.indexOf("`", i + 1);
30551
+ if (closeIndex !== -1 && closeIndex > i + 1) {
30552
+ const codeText = content.substring(i + 1, closeIndex);
30553
+ parts.push({ type: "code", text: codeText });
30554
+ i = closeIndex + 1;
30555
+ continue;
30556
+ }
30557
+ }
30558
+ if (content.substr(i, 2) === "**") {
30559
+ if (current) {
30560
+ parts.push({ type: "text", text: current });
30561
+ current = "";
30562
+ }
30563
+ const closeIndex = content.indexOf("**", i + 2);
30564
+ if (closeIndex !== -1) {
30565
+ const boldText = content.substring(i + 2, closeIndex);
30566
+ parts.push({ type: "bold", text: boldText });
30567
+ i = closeIndex + 2;
30568
+ continue;
30569
+ }
30570
+ }
30571
+ if (content[i] === "_" && content[i + 1] !== "_") {
30572
+ if (current) {
30573
+ parts.push({ type: "text", text: current });
30574
+ current = "";
30575
+ }
30576
+ const closeIndex = content.indexOf("_", i + 1);
30577
+ if (closeIndex !== -1) {
30578
+ const italicText = content.substring(i + 1, closeIndex);
30579
+ parts.push({ type: "italic", text: italicText });
30580
+ i = closeIndex + 1;
30581
+ continue;
30582
+ }
30583
+ }
30584
+ const char = content[i];
30585
+ if (/[\u{1F600}-\u{1F64F}]|[\u{1F300}-\u{1F5FF}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]/u.test(char)) {
30586
+ if (current) {
30587
+ parts.push({ type: "text", text: current });
30588
+ current = "";
30589
+ }
30590
+ parts.push({ type: "emoji", text: char });
30591
+ i++;
30592
+ continue;
30593
+ }
30594
+ current += content[i];
30595
+ i++;
30596
+ }
30597
+ if (current) {
30598
+ const codePattern = /(view_file|str_replace_editor|create_file|search|semantic_search|ast_parser|package\.json|README\.md|GROK\.md|install\.sh|docs-getter\.sh|dist\/|src\/|scripts\/|apps\/|node_modules|\.git|\.js|\.ts|\.json|\.sh|\.md|bun\s+install|npm\s+install)/g;
30599
+ const metadataPattern = /(\([^)]*(?:v\d+\.\d+|\d+k?[+]?\s*(?:files?|lines?|items?)|\d+\.\d+[xX]|dependencies?|scripts?|guides?|overview|project\s+docs?|source\s+code|detailed\s+setup|changelog|debugging|session\s+files?|build\s+artifacts)[^)]*\))/g;
30600
+ let lastIndex = 0;
30601
+ let match;
30602
+ let processedText = current;
30603
+ const tempParts = [];
30604
+ lastIndex = 0;
30605
+ while ((match = codePattern.exec(processedText)) !== null) {
30606
+ if (match.index > lastIndex) {
30607
+ tempParts.push({ type: "text", text: processedText.substring(lastIndex, match.index) });
30608
+ }
30609
+ tempParts.push({ type: "code", text: match[0] });
30610
+ lastIndex = match.index + match[0].length;
30611
+ }
30612
+ if (lastIndex < processedText.length) {
30613
+ tempParts.push({ type: "text", text: processedText.substring(lastIndex) });
30614
+ }
30615
+ const finalParts = [];
30616
+ for (const part of tempParts) {
30617
+ if (part.type === "text") {
30618
+ lastIndex = 0;
30619
+ metadataPattern.lastIndex = 0;
30620
+ while ((match = metadataPattern.exec(part.text)) !== null) {
30621
+ if (match.index > lastIndex) {
30622
+ finalParts.push({ type: "text", text: part.text.substring(lastIndex, match.index) });
30623
+ }
30624
+ finalParts.push({ type: "metadata", text: match[0] });
30625
+ lastIndex = match.index + match[0].length;
30626
+ }
30627
+ if (lastIndex < part.text.length) {
30628
+ finalParts.push({ type: "text", text: part.text.substring(lastIndex) });
30629
+ }
30630
+ if (finalParts.length === 0 || finalParts[finalParts.length - 1].text !== part.text) {
30631
+ if (finalParts.length === 0) {
30632
+ finalParts.push(part);
30633
+ }
30634
+ }
30635
+ } else {
30636
+ finalParts.push(part);
30637
+ }
30638
+ }
30639
+ if (finalParts.length === 0) {
30640
+ parts.push({ type: "text", text: current });
30641
+ } else {
30642
+ parts.push(...finalParts);
30643
+ }
30644
+ }
30645
+ return parts;
30646
+ }
30647
+ var init_markdown_renderer = __esm({
30648
+ "src/ui/utils/markdown-renderer.tsx"() {
30649
+ }
30650
+ });
30475
30651
  function AssistantMessageEntry({ entry, verbosityLevel: _verbosityLevel }) {
30476
30652
  const { content: processedContent, isTruncated } = handleLongContent(entry.content);
30477
30653
  return /* @__PURE__ */ jsx(Box, { flexDirection: "column", marginTop: 1, children: /* @__PURE__ */ jsxs(Box, { flexDirection: "row", alignItems: "flex-start", children: [
30478
30654
  /* @__PURE__ */ jsx(Text, { color: inkColors.text, children: "\u23FA " }),
30479
30655
  /* @__PURE__ */ jsxs(Box, { flexDirection: "column", width: "100%", children: [
30480
- entry.toolCalls ? (
30481
- // If there are tool calls, just show plain text
30482
- /* @__PURE__ */ jsx(Text, { color: inkColors.text, wrap: "wrap", dimColor: false, children: processedContent.trim() })
30483
- ) : (
30484
- // Use bright white text like Claude Code - explicit hex color to override any defaults
30485
- /* @__PURE__ */ jsx(Text, { color: inkColors.text, wrap: "wrap", dimColor: false, children: processedContent.trim() })
30486
- ),
30656
+ /* @__PURE__ */ jsx(MarkdownRenderer, { content: processedContent.trim() }),
30487
30657
  entry.isStreaming && /* @__PURE__ */ jsx(Text, { color: "cyan", children: "\u2588" }),
30488
30658
  isTruncated && /* @__PURE__ */ jsx(Text, { color: "yellow", italic: true, children: "[Response truncated for performance - full content in session log]" })
30489
30659
  ] })
@@ -30492,6 +30662,7 @@ function AssistantMessageEntry({ entry, verbosityLevel: _verbosityLevel }) {
30492
30662
  var handleLongContent;
30493
30663
  var init_assistant_message_entry = __esm({
30494
30664
  "src/ui/components/chat-entries/assistant-message-entry.tsx"() {
30665
+ init_markdown_renderer();
30495
30666
  init_colors();
30496
30667
  handleLongContent = (content, maxLength = 5e3) => {
30497
30668
  if (content.length <= maxLength) {
@@ -30743,6 +30914,221 @@ var init_file_content_renderer = __esm({
30743
30914
  "src/ui/components/content-renderers/file-content-renderer.tsx"() {
30744
30915
  }
30745
30916
  });
30917
+
30918
+ // src/services/tool-brevity-service.ts
30919
+ var ToolBrevityService;
30920
+ var init_tool_brevity_service = __esm({
30921
+ "src/services/tool-brevity-service.ts"() {
30922
+ ToolBrevityService = class {
30923
+ /**
30924
+ * Format tool result based on brevity mode
30925
+ */
30926
+ static formatToolResult(toolName, result, mode = "normal") {
30927
+ const normalizedToolName = this.normalizeToolName(toolName);
30928
+ const metadata = this.extractMetadata(normalizedToolName, result);
30929
+ const summary = this.generateSummary(normalizedToolName, result, metadata);
30930
+ return {
30931
+ toolName: normalizedToolName,
30932
+ summary,
30933
+ expansionHint: result.length > 0 ? "(ctrl+r to expand)" : "",
30934
+ hasContent: result.length > 0,
30935
+ originalContent: result,
30936
+ metadata
30937
+ };
30938
+ }
30939
+ /**
30940
+ * Normalize tool names to handle MCP and special cases
30941
+ */
30942
+ static normalizeToolName(toolName) {
30943
+ if (toolName.startsWith("mcp__")) {
30944
+ const parts = toolName.split("__");
30945
+ if (parts.length >= 3) {
30946
+ return parts[2];
30947
+ }
30948
+ }
30949
+ const toolMappings = {
30950
+ "str_replace_editor": "Edit",
30951
+ "bash": "Bash",
30952
+ "file_editor": "Edit",
30953
+ "grep": "Grep",
30954
+ "file_search": "Search",
30955
+ "list_files": "List",
30956
+ "read_file": "Read",
30957
+ "write_file": "Write"
30958
+ };
30959
+ return toolMappings[toolName] || this.capitalizeFirst(toolName);
30960
+ }
30961
+ /**
30962
+ * Extract metadata from tool result content
30963
+ */
30964
+ static extractMetadata(toolName, content) {
30965
+ const metadata = {};
30966
+ switch (toolName.toLowerCase()) {
30967
+ case "read":
30968
+ case "edit":
30969
+ case "write":
30970
+ metadata.lineCount = this.countLines(content);
30971
+ break;
30972
+ case "grep":
30973
+ case "search":
30974
+ const { matchCount, fileCount } = this.parseGrepResults(content);
30975
+ metadata.matchCount = matchCount;
30976
+ metadata.fileCount = fileCount;
30977
+ break;
30978
+ case "list":
30979
+ metadata.fileCount = this.countFileItems(content);
30980
+ break;
30981
+ case "bash":
30982
+ metadata.status = this.determineBashStatus(content);
30983
+ break;
30984
+ default:
30985
+ metadata.lineCount = this.countLines(content);
30986
+ }
30987
+ return metadata;
30988
+ }
30989
+ /**
30990
+ * Generate tool-specific summary text
30991
+ */
30992
+ static generateSummary(toolName, content, metadata) {
30993
+ const tool = toolName.toLowerCase();
30994
+ if (!content || content.trim().length === 0) {
30995
+ return `${this.capitalizeFirst(tool)} (no output)`;
30996
+ }
30997
+ switch (tool) {
30998
+ case "read":
30999
+ return `Read ${metadata.lineCount || 0} lines`;
31000
+ case "edit":
31001
+ return `Updated ${this.getFileName(content)} with ${metadata.lineCount || 0} lines`;
31002
+ case "write":
31003
+ return `Created file (${metadata.lineCount || 0} lines)`;
31004
+ case "grep":
31005
+ case "search":
31006
+ if (metadata.matchCount === 0) {
31007
+ return "No matches found";
31008
+ }
31009
+ return `${metadata.matchCount} matches across ${metadata.fileCount || 1} files`;
31010
+ case "list":
31011
+ return `Found ${metadata.fileCount || 0} items`;
31012
+ case "bash":
31013
+ if (metadata.status === "error") {
31014
+ return "Command failed";
31015
+ }
31016
+ return "Command completed successfully";
31017
+ case "glob":
31018
+ return `Found ${this.countFileItems(content)} files`;
31019
+ case "webfetch":
31020
+ return `Fetched content (${metadata.lineCount || 0} lines)`;
31021
+ case "websearch":
31022
+ return `Search completed (${this.countSearchResults(content)} results)`;
31023
+ default:
31024
+ const lines = metadata.lineCount || 0;
31025
+ return lines > 0 ? `${this.capitalizeFirst(tool)} (${lines} lines)` : this.capitalizeFirst(tool);
31026
+ }
31027
+ }
31028
+ /**
31029
+ * Count lines in content
31030
+ */
31031
+ static countLines(content) {
31032
+ if (!content) return 0;
31033
+ return content.split("\n").length;
31034
+ }
31035
+ /**
31036
+ * Parse grep/search results for match and file counts
31037
+ */
31038
+ static parseGrepResults(content) {
31039
+ if (!content) return { matchCount: 0, fileCount: 0 };
31040
+ const lines = content.split("\n").filter((line) => line.trim().length > 0);
31041
+ const files = /* @__PURE__ */ new Set();
31042
+ let matches = 0;
31043
+ for (const line of lines) {
31044
+ const fileMatch = line.match(/^([^:]+):/);
31045
+ if (fileMatch) {
31046
+ files.add(fileMatch[1]);
31047
+ matches++;
31048
+ } else if (line.includes(":")) {
31049
+ matches++;
31050
+ }
31051
+ }
31052
+ return {
31053
+ matchCount: matches || lines.length,
31054
+ fileCount: files.size || (matches > 0 ? 1 : 0)
31055
+ };
31056
+ }
31057
+ /**
31058
+ * Count file items in directory listing
31059
+ */
31060
+ static countFileItems(content) {
31061
+ if (!content) return 0;
31062
+ const lines = content.split("\n").filter((line) => line.trim().length > 0).filter((line) => !line.startsWith("total ")).filter((line) => !line.match(/^d.*\s+\.\s*$/)).filter((line) => !line.match(/^d.*\s+\.\.\s*$/));
31063
+ return lines.length;
31064
+ }
31065
+ /**
31066
+ * Determine bash command success/failure status
31067
+ */
31068
+ static determineBashStatus(content) {
31069
+ if (!content) return "success";
31070
+ const errorIndicators = [
31071
+ "error:",
31072
+ "Error:",
31073
+ "ERROR:",
31074
+ "failed",
31075
+ "Failed",
31076
+ "FAILED",
31077
+ "permission denied",
31078
+ "command not found",
31079
+ "no such file",
31080
+ "cannot"
31081
+ ];
31082
+ const contentLower = content.toLowerCase();
31083
+ return errorIndicators.some((indicator) => contentLower.includes(indicator.toLowerCase())) ? "error" : "success";
31084
+ }
31085
+ /**
31086
+ * Extract filename from edit/write operation content
31087
+ */
31088
+ static getFileName(content) {
31089
+ const fileMatch = content.match(/(?:updated|edited|created)\s+([^\s]+)/i);
31090
+ if (fileMatch) return fileMatch[1];
31091
+ const pathMatch = content.match(/([^/]+)$/);
31092
+ return pathMatch ? pathMatch[1] : "file";
31093
+ }
31094
+ /**
31095
+ * Count search results in web search content
31096
+ */
31097
+ static countSearchResults(content) {
31098
+ const resultMatches = content.match(/result\s+\d+/gi);
31099
+ return resultMatches ? resultMatches.length : 1;
31100
+ }
31101
+ /**
31102
+ * Capitalize first letter of string
31103
+ */
31104
+ static capitalizeFirst(str) {
31105
+ return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
31106
+ }
31107
+ /**
31108
+ * Check if content should use compact display
31109
+ */
31110
+ static shouldUseCompactDisplay(mode, contentLength) {
31111
+ if (mode === "brief") return true;
31112
+ if (mode === "verbose") return false;
31113
+ const lineCount = contentLength > 0 ? contentLength.toString().split("\n").length : 0;
31114
+ return lineCount > 5;
31115
+ }
31116
+ /**
31117
+ * Format expansion hint with content preview
31118
+ */
31119
+ static formatExpansionHint(hasContent, metadata) {
31120
+ if (!hasContent) return "";
31121
+ if (metadata.lineCount && metadata.lineCount > 10) {
31122
+ return `(${metadata.lineCount} lines, ctrl+r to expand)`;
31123
+ }
31124
+ if (metadata.matchCount && metadata.matchCount > 5) {
31125
+ return `(${metadata.matchCount} matches, ctrl+r to expand)`;
31126
+ }
31127
+ return "(ctrl+r to expand)";
31128
+ }
31129
+ };
31130
+ }
31131
+ });
30746
31132
  function ToolCallEntry({ entry, verbosityLevel, explainLevel }) {
30747
31133
  const [isExpanded, setIsExpanded] = useState(false);
30748
31134
  const getExplanation = (toolName2, filePath2, _isExecuting) => {
@@ -30852,8 +31238,15 @@ function ToolCallEntry({ entry, verbosityLevel, explainLevel }) {
30852
31238
  const shouldShowFileContent = (entry.toolCall?.function?.name === "view_file" || entry.toolCall?.function?.name === "create_file") && entry.toolResult?.success && !shouldShowDiff;
30853
31239
  const shouldShowToolContent = verbosityLevel !== "quiet";
30854
31240
  const shouldShowFullContent = verbosityLevel === "normal" || verbosityLevel === "verbose";
31241
+ const brevityMode = verbosityLevel === "quiet" ? "brief" : verbosityLevel === "verbose" ? "verbose" : "normal";
31242
+ const brevitySummary = ToolBrevityService.formatToolResult(
31243
+ toolName,
31244
+ entry.content || "",
31245
+ brevityMode
31246
+ );
30855
31247
  const explanation = getExplanation(toolName, filePath);
30856
31248
  const { preview, hasMore, totalLines } = truncateToClaudeStyle(entry.content || "");
31249
+ const useClaudeCodeFormat = verbosityLevel === "quiet" && brevitySummary.hasContent;
30857
31250
  return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
30858
31251
  /* @__PURE__ */ jsxs(Box, { children: [
30859
31252
  /* @__PURE__ */ jsx(Text, { color: "magenta", children: "\u23FA" }),
@@ -30862,11 +31255,19 @@ function ToolCallEntry({ entry, verbosityLevel, explainLevel }) {
30862
31255
  filePath ? `${actionName}(${filePath})` : actionName
30863
31256
  ] })
30864
31257
  ] }),
30865
- explanation && /* @__PURE__ */ jsx(Box, { marginLeft: 2, children: /* @__PURE__ */ jsxs(Text, { color: "blue", italic: true, children: [
31258
+ explanation && !useClaudeCodeFormat && /* @__PURE__ */ jsx(Box, { marginLeft: 2, children: /* @__PURE__ */ jsxs(Text, { color: "blue", italic: true, children: [
30866
31259
  "\u{1F4A1} ",
30867
31260
  explanation
30868
31261
  ] }) }),
30869
- shouldShowToolContent && /* @__PURE__ */ jsx(Box, { marginLeft: 2, flexDirection: "column", children: isExecuting ? /* @__PURE__ */ jsx(Text, { color: "cyan", children: "\u23BF Executing..." }) : shouldShowFileContent && shouldShowFullContent ? /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: !isExpanded ? /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
31262
+ useClaudeCodeFormat ? (
31263
+ // Claude Code style: ultra-brief format
31264
+ /* @__PURE__ */ jsx(Box, { marginLeft: 2, children: /* @__PURE__ */ jsxs(Text, { color: "gray", children: [
31265
+ "\u23BF ",
31266
+ brevitySummary.summary,
31267
+ " ",
31268
+ brevitySummary.expansionHint
31269
+ ] }) })
31270
+ ) : shouldShowToolContent && /* @__PURE__ */ jsx(Box, { marginLeft: 2, flexDirection: "column", children: isExecuting ? /* @__PURE__ */ jsx(Text, { color: "cyan", children: "\u23BF Executing..." }) : shouldShowFileContent && shouldShowFullContent ? /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: !isExpanded ? /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
30870
31271
  /* @__PURE__ */ jsxs(Text, { color: "gray", children: [
30871
31272
  "\u23BF ",
30872
31273
  preview
@@ -30902,7 +31303,7 @@ function ToolCallEntry({ entry, verbosityLevel, explainLevel }) {
30902
31303
  "\u23BF ",
30903
31304
  formatToolContent(entry.content, toolName)
30904
31305
  ] }) }),
30905
- shouldShowDiff && !isExecuting && shouldShowFullContent && /* @__PURE__ */ jsx(Box, { marginLeft: 4, flexDirection: "column", children: /* @__PURE__ */ jsx(
31306
+ shouldShowDiff && !isExecuting && shouldShowFullContent && !useClaudeCodeFormat && /* @__PURE__ */ jsx(Box, { marginLeft: 4, flexDirection: "column", children: /* @__PURE__ */ jsx(
30906
31307
  DiffRenderer,
30907
31308
  {
30908
31309
  diffContent: entry.content,
@@ -30917,6 +31318,7 @@ var init_tool_call_entry = __esm({
30917
31318
  "src/ui/components/chat-entries/tool-call-entry.tsx"() {
30918
31319
  init_diff_renderer();
30919
31320
  init_file_content_renderer();
31321
+ init_tool_brevity_service();
30920
31322
  truncateContent2 = (content, maxLength = 100) => {
30921
31323
  if (process.env.COMPACT !== "1") return content;
30922
31324
  return content.length > maxLength ? content.substring(0, maxLength) + "..." : content;
@@ -30967,7 +31369,7 @@ var MemoizedChatEntry;
30967
31369
  var init_chat_history = __esm({
30968
31370
  "src/ui/components/chat-history.tsx"() {
30969
31371
  init_chat_entry_router();
30970
- MemoizedChatEntry = React5.memo(
31372
+ MemoizedChatEntry = React4.memo(
30971
31373
  ({ entry, verbosityLevel, explainLevel }) => {
30972
31374
  return /* @__PURE__ */ jsx(ChatEntryRouter, { entry, verbosityLevel, explainLevel });
30973
31375
  }
@@ -32181,6 +32583,28 @@ var init_chat_interface = __esm({
32181
32583
  }
32182
32584
  });
32183
32585
 
32586
+ // src/utils/console-markdown.ts
32587
+ var console_markdown_exports = {};
32588
+ __export(console_markdown_exports, {
32589
+ renderMarkdownToConsole: () => renderMarkdownToConsole
32590
+ });
32591
+ function renderMarkdownToConsole(content) {
32592
+ let result = content;
32593
+ result = result.replace(/^#+\s+(.*)$/gm, (_, text) => chalk2.bold.white(text));
32594
+ result = result.replace(/\*\*(.*?)\*\*/g, (_, text) => chalk2.bold.white(text));
32595
+ result = result.replace(/_(.*?)_/g, (_, text) => chalk2.italic.gray(text));
32596
+ result = result.replace(/`([^`]+)`/g, (_, text) => chalk2.cyan(text));
32597
+ result = result.replace(/(✅|✓)/g, (match) => chalk2.green(match));
32598
+ result = result.replace(/(❌|✗)/g, (match) => chalk2.red(match));
32599
+ result = result.replace(/(⚠️|⚠)/g, (match) => chalk2.yellow(match));
32600
+ result = result.replace(/(ℹ️|💡|🔍)/g, (match) => chalk2.blue(match));
32601
+ return result;
32602
+ }
32603
+ var init_console_markdown = __esm({
32604
+ "src/utils/console-markdown.ts"() {
32605
+ }
32606
+ });
32607
+
32184
32608
  // src/commands/mcp.ts
32185
32609
  var mcp_exports = {};
32186
32610
  __export(mcp_exports, {
@@ -32194,27 +32618,27 @@ function createMCPCommand() {
32194
32618
  if (PREDEFINED_SERVERS[name]) {
32195
32619
  const config3 = PREDEFINED_SERVERS[name];
32196
32620
  addMCPServer(config3);
32197
- console.log(chalk.green(`\u2713 Added predefined MCP server: ${name}`));
32621
+ console.log(chalk2.green(`\u2713 Added predefined MCP server: ${name}`));
32198
32622
  const manager2 = getMCPManager();
32199
32623
  await manager2.addServer(config3);
32200
- console.log(chalk.green(`\u2713 Connected to MCP server: ${name}`));
32624
+ console.log(chalk2.green(`\u2713 Connected to MCP server: ${name}`));
32201
32625
  const tools2 = manager2.getTools().filter((t) => t.serverName === name);
32202
- console.log(chalk.blue(` Available tools: ${tools2.length}`));
32626
+ console.log(chalk2.blue(` Available tools: ${tools2.length}`));
32203
32627
  return;
32204
32628
  }
32205
32629
  const transportType = options.transport.toLowerCase();
32206
32630
  if (transportType === "stdio") {
32207
32631
  if (!options.command) {
32208
- console.error(chalk.red("Error: --command is required for stdio transport"));
32632
+ console.error(chalk2.red("Error: --command is required for stdio transport"));
32209
32633
  process.exit(1);
32210
32634
  }
32211
32635
  } else if (transportType === "http" || transportType === "sse" || transportType === "streamable_http") {
32212
32636
  if (!options.url) {
32213
- console.error(chalk.red(`Error: --url is required for ${transportType} transport`));
32637
+ console.error(chalk2.red(`Error: --url is required for ${transportType} transport`));
32214
32638
  process.exit(1);
32215
32639
  }
32216
32640
  } else {
32217
- console.error(chalk.red("Error: Transport type must be stdio, http, sse, or streamable_http"));
32641
+ console.error(chalk2.red("Error: Transport type must be stdio, http, sse, or streamable_http"));
32218
32642
  process.exit(1);
32219
32643
  }
32220
32644
  const env = {};
@@ -32243,14 +32667,14 @@ function createMCPCommand() {
32243
32667
  }
32244
32668
  };
32245
32669
  addMCPServer(config2);
32246
- console.log(chalk.green(`\u2713 Added MCP server: ${name}`));
32670
+ console.log(chalk2.green(`\u2713 Added MCP server: ${name}`));
32247
32671
  const manager = getMCPManager();
32248
32672
  await manager.addServer(config2);
32249
- console.log(chalk.green(`\u2713 Connected to MCP server: ${name}`));
32673
+ console.log(chalk2.green(`\u2713 Connected to MCP server: ${name}`));
32250
32674
  const tools = manager.getTools().filter((t) => t.serverName === name);
32251
- console.log(chalk.blue(` Available tools: ${tools.length}`));
32675
+ console.log(chalk2.blue(` Available tools: ${tools.length}`));
32252
32676
  } catch (error) {
32253
- console.error(chalk.red(`Error adding MCP server: ${error.message}`));
32677
+ console.error(chalk2.red(`Error adding MCP server: ${error.message}`));
32254
32678
  process.exit(1);
32255
32679
  }
32256
32680
  });
@@ -32260,7 +32684,7 @@ function createMCPCommand() {
32260
32684
  try {
32261
32685
  config2 = JSON.parse(jsonConfig);
32262
32686
  } catch {
32263
- console.error(chalk.red("Error: Invalid JSON configuration"));
32687
+ console.error(chalk2.red("Error: Invalid JSON configuration"));
32264
32688
  process.exit(1);
32265
32689
  }
32266
32690
  const serverConfig = {
@@ -32283,14 +32707,14 @@ function createMCPCommand() {
32283
32707
  }
32284
32708
  }
32285
32709
  addMCPServer(serverConfig);
32286
- console.log(chalk.green(`\u2713 Added MCP server: ${name}`));
32710
+ console.log(chalk2.green(`\u2713 Added MCP server: ${name}`));
32287
32711
  const manager = getMCPManager();
32288
32712
  await manager.addServer(serverConfig);
32289
- console.log(chalk.green(`\u2713 Connected to MCP server: ${name}`));
32713
+ console.log(chalk2.green(`\u2713 Connected to MCP server: ${name}`));
32290
32714
  const tools = manager.getTools().filter((t) => t.serverName === name);
32291
- console.log(chalk.blue(` Available tools: ${tools.length}`));
32715
+ console.log(chalk2.blue(` Available tools: ${tools.length}`));
32292
32716
  } catch (error) {
32293
- console.error(chalk.red(`Error adding MCP server: ${error.message}`));
32717
+ console.error(chalk2.red(`Error adding MCP server: ${error.message}`));
32294
32718
  process.exit(1);
32295
32719
  }
32296
32720
  });
@@ -32299,9 +32723,9 @@ function createMCPCommand() {
32299
32723
  const manager = getMCPManager();
32300
32724
  await manager.removeServer(name);
32301
32725
  removeMCPServer(name);
32302
- console.log(chalk.green(`\u2713 Removed MCP server: ${name}`));
32726
+ console.log(chalk2.green(`\u2713 Removed MCP server: ${name}`));
32303
32727
  } catch (error) {
32304
- console.error(chalk.red(`Error removing MCP server: ${error.message}`));
32728
+ console.error(chalk2.red(`Error removing MCP server: ${error.message}`));
32305
32729
  process.exit(1);
32306
32730
  }
32307
32731
  });
@@ -32309,15 +32733,15 @@ function createMCPCommand() {
32309
32733
  const config2 = loadMCPConfig();
32310
32734
  const manager = getMCPManager();
32311
32735
  if (config2.servers.length === 0) {
32312
- console.log(chalk.yellow("No MCP servers configured"));
32736
+ console.log(chalk2.yellow("No MCP servers configured"));
32313
32737
  return;
32314
32738
  }
32315
- console.log(chalk.bold("Configured MCP servers:"));
32739
+ console.log(chalk2.bold("Configured MCP servers:"));
32316
32740
  console.log();
32317
32741
  for (const server of config2.servers) {
32318
32742
  const isConnected = manager.getServers().includes(server.name);
32319
- const status = isConnected ? chalk.green("\u2713 Connected") : chalk.red("\u2717 Disconnected");
32320
- console.log(`${chalk.bold(server.name)}: ${status}`);
32743
+ const status = isConnected ? chalk2.green("\u2713 Connected") : chalk2.red("\u2717 Disconnected");
32744
+ console.log(`${chalk2.bold(server.name)}: ${status}`);
32321
32745
  if (server.transport) {
32322
32746
  console.log(` Transport: ${server.transport.type}`);
32323
32747
  if (server.transport.type === "stdio") {
@@ -32350,15 +32774,15 @@ function createMCPCommand() {
32350
32774
  const config2 = loadMCPConfig();
32351
32775
  const serverConfig = config2.servers.find((s) => s.name === name);
32352
32776
  if (!serverConfig) {
32353
- console.error(chalk.red(`Server ${name} not found`));
32777
+ console.error(chalk2.red(`Server ${name} not found`));
32354
32778
  process.exit(1);
32355
32779
  }
32356
- console.log(chalk.blue(`Testing connection to ${name}...`));
32780
+ console.log(chalk2.blue(`Testing connection to ${name}...`));
32357
32781
  const manager = getMCPManager();
32358
32782
  await manager.addServer(serverConfig);
32359
32783
  const tools = manager.getTools().filter((t) => t.serverName === name);
32360
- console.log(chalk.green(`\u2713 Successfully connected to ${name}`));
32361
- console.log(chalk.blue(` Available tools: ${tools.length}`));
32784
+ console.log(chalk2.green(`\u2713 Successfully connected to ${name}`));
32785
+ console.log(chalk2.blue(` Available tools: ${tools.length}`));
32362
32786
  if (tools.length > 0) {
32363
32787
  console.log(" Tools:");
32364
32788
  tools.forEach((tool) => {
@@ -32367,7 +32791,7 @@ function createMCPCommand() {
32367
32791
  });
32368
32792
  }
32369
32793
  } catch (error) {
32370
- console.error(chalk.red(`\u2717 Failed to connect to ${name}: ${error.message}`));
32794
+ console.error(chalk2.red(`\u2717 Failed to connect to ${name}: ${error.message}`));
32371
32795
  process.exit(1);
32372
32796
  }
32373
32797
  });
@@ -32391,9 +32815,9 @@ function createSetNameCommand() {
32391
32815
  try {
32392
32816
  const settingsManager = getSettingsManager();
32393
32817
  settingsManager.updateUserSetting("assistantName", name);
32394
- console.log(chalk.green(`\u2705 Assistant name set to: ${name}`));
32818
+ console.log(chalk2.green(`\u2705 Assistant name set to: ${name}`));
32395
32819
  } catch (error) {
32396
- console.error(chalk.red(`\u274C Failed to set assistant name: ${error.message}`));
32820
+ console.error(chalk2.red(`\u274C Failed to set assistant name: ${error.message}`));
32397
32821
  process.exit(1);
32398
32822
  }
32399
32823
  });
@@ -32418,10 +32842,10 @@ function createToggleConfirmationsCommand() {
32418
32842
  const currentValue = settingsManager.getUserSetting("requireConfirmation") ?? true;
32419
32843
  const newValue = !currentValue;
32420
32844
  settingsManager.updateUserSetting("requireConfirmation", newValue);
32421
- console.log(chalk.green(`\u2705 Confirmation requirement ${newValue ? "enabled" : "disabled"}`));
32845
+ console.log(chalk2.green(`\u2705 Confirmation requirement ${newValue ? "enabled" : "disabled"}`));
32422
32846
  console.log(`File operations and bash commands will ${newValue ? "now" : "no longer"} require confirmation.`);
32423
32847
  } catch (error) {
32424
- console.error(chalk.red(`\u274C Failed to toggle confirmations: ${error.message}`));
32848
+ console.error(chalk2.red(`\u274C Failed to toggle confirmations: ${error.message}`));
32425
32849
  process.exit(1);
32426
32850
  }
32427
32851
  });
@@ -32439,7 +32863,7 @@ var require_package = __commonJS({
32439
32863
  module.exports = {
32440
32864
  type: "module",
32441
32865
  name: "@xagent/one-shot",
32442
- version: "1.2.1",
32866
+ version: "1.2.2",
32443
32867
  description: "An open-source AI agent that brings advanced AI capabilities directly into your terminal with automatic documentation updates.",
32444
32868
  main: "dist/index.js",
32445
32869
  module: "dist/index.js",
@@ -32624,6 +33048,7 @@ try {
32624
33048
  const { printWelcomeBanner: printWelcomeBanner2 } = await Promise.resolve().then(() => (init_use_console_setup(), use_console_setup_exports));
32625
33049
  const { getSettingsManager: getSettingsManager2 } = await Promise.resolve().then(() => (init_settings_manager(), settings_manager_exports));
32626
33050
  const { ConfirmationService: ConfirmationService2 } = await Promise.resolve().then(() => (init_confirmation_service(), confirmation_service_exports));
33051
+ const { renderMarkdownToConsole: renderMarkdownToConsole2 } = await Promise.resolve().then(() => (init_console_markdown(), console_markdown_exports));
32627
33052
  const { createMCPCommand: createMCPCommand2 } = await Promise.resolve().then(() => (init_mcp(), mcp_exports));
32628
33053
  const { createSetNameCommand: createSetNameCommand2 } = await Promise.resolve().then(() => (init_set_name(), set_name_exports));
32629
33054
  const { createToggleConfirmationsCommand: createToggleConfirmationsCommand2 } = await Promise.resolve().then(() => (init_toggle_confirmations(), toggle_confirmations_exports));
@@ -32699,7 +33124,7 @@ try {
32699
33124
  const chatEntries = await agent.processUserMessage(options.prompt);
32700
33125
  for (const entry of chatEntries) {
32701
33126
  if (entry.type === "assistant" && entry.content) {
32702
- console.log(entry.content);
33127
+ console.log(renderMarkdownToConsole2(entry.content));
32703
33128
  }
32704
33129
  }
32705
33130
  } catch (error) {
@@ -32718,7 +33143,7 @@ try {
32718
33143
  printWelcomeBanner2(options.quiet);
32719
33144
  }
32720
33145
  const initialMessage = Array.isArray(message) ? message.join(" ") : message || "";
32721
- const app = render(React5.createElement(ChatInterface2, {
33146
+ const app = render(React4.createElement(ChatInterface2, {
32722
33147
  agent,
32723
33148
  initialMessage,
32724
33149
  quiet: options.quiet