@pheem49/mint 1.5.2 → 1.5.4

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.
Files changed (40) hide show
  1. package/GUIDE_TH.md +23 -11
  2. package/README.md +148 -66
  3. package/assets/Agent_Mint.png +0 -0
  4. package/assets/Settings.png +0 -0
  5. package/install.ps1 +64 -0
  6. package/install.sh +54 -0
  7. package/main.js +12 -0
  8. package/package.json +5 -3
  9. package/preload.js +4 -0
  10. package/scripts/install_linux_desktop_entry.js +48 -0
  11. package/src/AI_Brain/Gemini_API.js +231 -498
  12. package/src/AI_Brain/autonomous_brain.js +46 -19
  13. package/src/AI_Brain/headless_agent.js +21 -2
  14. package/src/AI_Brain/provider_adapter.js +358 -0
  15. package/src/Automation_Layer/file_operations.js +17 -5
  16. package/src/CLI/approval_handler.js +5 -0
  17. package/src/CLI/chat_router.js +7 -0
  18. package/src/CLI/chat_ui.js +397 -76
  19. package/src/CLI/cli_colors.js +86 -3
  20. package/src/CLI/cli_formatters.js +6 -1
  21. package/src/CLI/code_agent.js +706 -273
  22. package/src/CLI/interactive_chat.js +311 -149
  23. package/src/CLI/slash_command_handler.js +2 -2
  24. package/src/CLI/updater.js +21 -1
  25. package/src/System/config_manager.js +5 -1
  26. package/src/System/ipc_handlers.js +95 -1
  27. package/src/System/picture_store.js +109 -0
  28. package/src/System/smart_context.js +227 -0
  29. package/src/System/task_manager.js +127 -0
  30. package/src/System/tool_registry.js +13 -0
  31. package/src/System/window_manager.js +16 -8
  32. package/src/UI/live2d_manager.js +42 -8
  33. package/src/UI/preload-spotlight.js +1 -0
  34. package/src/UI/renderer.js +837 -63
  35. package/src/UI/settings.css +160 -96
  36. package/src/UI/settings.html +9 -0
  37. package/src/UI/settings.js +35 -2
  38. package/src/UI/spotlight.js +13 -9
  39. package/src/UI/styles.css +1592 -165
  40. package/privacy.txt +0 -1
@@ -15,18 +15,101 @@ const colors = {
15
15
 
16
16
  let isExiting = false;
17
17
 
18
+ function formatCount(value) {
19
+ const number = Number(value) || 0;
20
+ return number.toLocaleString('en-US');
21
+ }
22
+
23
+ function formatDurationMs(value) {
24
+ const ms = Math.max(0, Number(value) || 0);
25
+ const seconds = ms / 1000;
26
+ if (seconds < 10) return `${seconds.toFixed(1)}s`;
27
+ if (seconds < 60) return `${Math.round(seconds)}s`;
28
+ const minutes = Math.floor(seconds / 60);
29
+ const remaining = Math.round(seconds % 60);
30
+ return `${minutes}m ${remaining}s`;
31
+ }
32
+
33
+ function fitText(value, width) {
34
+ const text = String(value || '');
35
+ if (text.length <= width) return text;
36
+ if (width <= 3) return text.slice(0, width);
37
+ return `${text.slice(0, width - 3)}...`;
38
+ }
39
+
40
+ function line(label, value, width) {
41
+ const text = fitText(` ${label.padEnd(28)}${String(value || '')}`, width - 2);
42
+ return `│${text.padEnd(width - 2)}│`;
43
+ }
44
+
45
+ function divider(width) {
46
+ return `│ ${'─'.repeat(Math.max(0, width - 4))}│`;
47
+ }
48
+
49
+ function formatExitSummary(summary = {}) {
50
+ const width = Math.max(76, Math.min(135, process.stdout.columns || 100));
51
+ const top = `╭${'─'.repeat(width - 2)}╮`;
52
+ const bottom = `╰${'─'.repeat(width - 2)}╯`;
53
+ const empty = `│${''.padEnd(width - 2)}│`;
54
+ const message = summary.message || 'Agent powering down. Goodbye!';
55
+ const toolCalls = summary.toolCalls || {};
56
+ const modelUsage = Array.isArray(summary.modelUsage) ? summary.modelUsage : [];
57
+ const primaryModel = modelUsage[0]
58
+ ? `${modelUsage[0].provider || 'provider'}:${modelUsage[0].model || 'model'}`
59
+ : '';
60
+ const totals = modelUsage.reduce((acc, item) => {
61
+ acc.input += Number(item.inputTokens) || 0;
62
+ acc.cache += Number(item.cacheReads) || 0;
63
+ acc.output += Number(item.outputTokens) || 0;
64
+ acc.reasoning += Number(item.reasoningTokens) || 0;
65
+ acc.total += Number(item.totalTokens) || 0;
66
+ return acc;
67
+ }, { input: 0, cache: 0, output: 0, reasoning: 0, total: 0 });
68
+ if (!totals.total) totals.total = totals.input + totals.output;
69
+
70
+ const lines = [
71
+ top,
72
+ line(message, '', width),
73
+ empty,
74
+ line('Performance', '', width),
75
+ line('Wall Time:', formatDurationMs(summary.wallMs), width),
76
+ line('Agent Active:', formatDurationMs(summary.agentActiveMs), width)
77
+ ];
78
+
79
+ if (Number(toolCalls.total) > 0) {
80
+ lines.push(
81
+ line('Tool Calls:', `${formatCount(toolCalls.total)} ( ✓ ${formatCount(toolCalls.success)} x ${formatCount(toolCalls.failed)} )`, width),
82
+ line('Success Rate:', `${Number(toolCalls.successRate || 0).toFixed(1)}%`, width)
83
+ );
84
+ }
85
+
86
+ lines.push(
87
+ empty,
88
+ line('Model:', primaryModel || 'No model calls recorded.', width),
89
+ divider(width),
90
+ line('Token usage:', `total=${formatCount(totals.total)} input=${formatCount(totals.input)} (+ ${formatCount(totals.cache)} cached) output=${formatCount(totals.output)}${totals.reasoning ? ` (reasoning ${formatCount(totals.reasoning)})` : ''}`, width)
91
+ );
92
+
93
+ lines.push(bottom);
94
+ return lines.join('\n');
95
+ }
96
+
18
97
  /**
19
98
  * Restore terminal state, print goodbye, and exit.
20
99
  * @param {number} [code=0]
21
100
  */
22
- function exitWithGoodbye(code = 0) {
101
+ function exitWithGoodbye(code = 0, summary = null) {
23
102
  if (isExiting) return;
24
103
  isExiting = true;
25
104
 
26
105
  process.stdout.write('\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l');
27
106
  process.stdout.write('\x1b[?25h');
28
- console.log(`\n${colors.pink}Goodbye! See you again soon!${colors.reset}\n`);
107
+ if (summary) {
108
+ console.log(`\n${colors.pink}${formatExitSummary(summary)}${colors.reset}\n`);
109
+ } else {
110
+ console.log(`\n${colors.pink}Goodbye! See you again soon!${colors.reset}\n`);
111
+ }
29
112
  process.exit(code);
30
113
  }
31
114
 
32
- module.exports = { colors, exitWithGoodbye };
115
+ module.exports = { colors, exitWithGoodbye, _helpers: { formatExitSummary, formatDurationMs } };
@@ -10,7 +10,11 @@ const { colors } = require('./cli_colors');
10
10
  function formatProgress(info) {
11
11
  if (typeof info === 'string') return `${colors.gray}[Mint Code] ${info}${colors.reset}`;
12
12
 
13
- const { action, target, message } = info;
13
+ const { action, target, message, thought } = info;
14
+
15
+ if (thought && process.env.MINT_HIDE_AGENT_NOTES !== '1') {
16
+ return `\n${colors.gray}${colors.bright}•${colors.reset} ${colors.gray}${thought}${colors.reset}`;
17
+ }
14
18
 
15
19
  if (action === 'ask_user') {
16
20
  return `\n${colors.mint}✓${colors.reset} ${colors.bright}Ask User${colors.reset}\n${colors.gray} ${target || message || ''}${colors.reset}`;
@@ -28,6 +32,7 @@ function formatProgress(info) {
28
32
  case 'find_path': label = 'Explored'; break;
29
33
  case 'read_file': label = 'ReadFile'; break;
30
34
  case 'search_code': label = 'SearchText'; break;
35
+ case 'plan': label = 'Plan'; break;
31
36
  case 'apply_patch':
32
37
  case 'write_file': label = 'Edited'; break;
33
38
  case 'run_shell': label = 'Ran command'; break;