@pheem49/mint 1.3.0 → 1.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.
Files changed (38) hide show
  1. package/.codex +0 -0
  2. package/README.md +174 -126
  3. package/main.js +21 -1
  4. package/mint-cli-logic.js +21 -1
  5. package/mint-cli.js +287 -45
  6. package/package.json +13 -2
  7. package/src/AI_Brain/Gemini_API.js +331 -64
  8. package/src/AI_Brain/agent_orchestrator.js +73 -0
  9. package/src/AI_Brain/autonomous_brain.js +2 -0
  10. package/src/AI_Brain/memory_store.js +318 -0
  11. package/src/AI_Brain/proactive_engine.js +2 -8
  12. package/src/Automation_Layer/file_operations.js +123 -4
  13. package/src/Automation_Layer/open_app.js +72 -43
  14. package/src/Automation_Layer/open_website.js +3 -3
  15. package/src/CLI/chat_router.js +57 -9
  16. package/src/CLI/chat_ui.js +117 -11
  17. package/src/CLI/code_agent.js +249 -36
  18. package/src/CLI/onboarding.js +53 -6
  19. package/src/CLI/workspace_manager.js +90 -0
  20. package/src/Plugins/docker.js +12 -10
  21. package/src/Plugins/spotify.js +168 -40
  22. package/src/Plugins/system_monitor.js +72 -0
  23. package/src/System/config_manager.js +35 -2
  24. package/src/System/custom_workflows.js +9 -2
  25. package/src/System/notifications.js +23 -0
  26. package/src/UI/settings.html +143 -65
  27. package/src/UI/settings.js +155 -41
  28. package/tests/agent_orchestrator.test.js +41 -0
  29. package/tests/chat_router.test.js +42 -0
  30. package/tests/code_agent.test.js +69 -0
  31. package/tests/config_manager.test.js +141 -0
  32. package/tests/docker.test.js +46 -0
  33. package/tests/file_operations.test.js +57 -0
  34. package/tests/memory_store.test.js +185 -0
  35. package/tests/provider_routing.test.js +67 -0
  36. package/tests/spotify.test.js +201 -0
  37. package/tests/system_monitor.test.js +37 -0
  38. package/tests/workspace_manager.test.js +56 -0
package/.codex ADDED
File without changes
package/README.md CHANGED
@@ -1,196 +1,244 @@
1
1
  # Mint
2
2
 
3
3
  <p align="center">
4
- <img src="assets/icon.png" alt="Luna Mint Icon" width="160">
4
+ <img src="assets/icon.png" alt="Mint Icon" width="160">
5
5
  </p>
6
6
 
7
7
  <p align="center">
8
- <strong>An advanced AI Assistant built for the modern workflow now on Desktop & Terminal.</strong>
8
+ <strong>Desktop assistant + CLI coding agent built with Electron, Node.js, and modern LLM providers.</strong>
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
12
  <img src="https://img.shields.io/badge/License-AGPL--3.0-blue?style=for-the-badge" alt="License">
13
13
  <img src="https://img.shields.io/badge/Node.js-LTS-green?style=for-the-badge&logo=node.js" alt="Node.js">
14
- <img src="https://img.shields.io/badge/Electron-Latest-47848F?style=for-the-badge&logo=electron" alt="Electron">
15
- <img src="https://img.shields.io/badge/Powered%20By-Gemini-orange?style=for-the-badge&logo=google-gemini" alt="Gemini">
14
+ <img src="https://img.shields.io/badge/Electron-40.x-47848F?style=for-the-badge&logo=electron" alt="Electron">
15
+ <img src="https://img.shields.io/badge/CLI-Agentic-orange?style=for-the-badge" alt="CLI Agentic">
16
16
  </p>
17
17
 
18
- ---
18
+ Mint is an AI assistant that runs in two main surfaces:
19
19
 
20
- **Mint** is a powerful AI Assistant built with **Electron**, **Node.js**, and **Google Gemini**. It bridges the gap between your Desktop and Terminal, featuring real-time screen vision, web automation, local knowledge search, and a professional CLI for developers who love the command line.
20
+ - A desktop Electron app for chat, screen-aware help, and system actions
21
+ - A terminal-first CLI with a workspace-aware coding agent
21
22
 
22
- ## 🌟 Highlights
23
+ The project is built around practical local workflows: inspect code, edit files, run safe commands with approval, use project context, and fall back across multiple AI providers when needed.
23
24
 
24
- - **Dual-Mode AI**: Switch between a beautiful **Desktop GUI** and a professional **CLI**.
25
- - **Code Agent Mode**: Use `mint code "<task>"` to inspect, edit, and verify a project directly from the current terminal workspace.
26
- - **Chat-First Workflow**: Regular Mint chat can now auto-route coding requests into workspace Code Mode, so the main chat acts as the control surface.
27
- - **Visible Mode State**: The CLI status bar now shows whether Mint is currently in `Chat` or `Code` mode.
28
- - **Interactive Slash Commands**: Manage models and settings in the terminal with `/model`, `/config`, `/clear`, etc.
29
- - **Smart TUI Experience**: Professional message framing, character-wrapped Thai text support, and mouse scroll wheel navigation.
30
- - **System Information Action**: Retrieve OS, Kernel, and Architecture details via natural language.
31
- - **Dynamic UI Aesthetics**: Animated **Aura Glow** for the AI widget and **Glassmorphism** design.
32
- - **Minimize-to-Tray**: Keep Mint running in the background via the System Tray.
33
- - **Vision-Ready (Desktop)**: Capture, analyze, and translate any part of your screen in real-time.
34
- - **Automation First**: Control your system and browser via natural language from both App and Terminal.
35
- - **Background Agent**: Install Mint as a `systemd` user service for proactive monitoring.
25
+ ## What Mint Can Do
36
26
 
37
- ---
27
+ - Chat in Desktop or CLI mode
28
+ - Route coding requests into Code Mode automatically from the CLI chat UI
29
+ - Inspect a workspace before editing
30
+ - Search code, read file ranges, and patch files
31
+ - Run non-destructive shell commands with user approval
32
+ - Keep lightweight per-workspace session memory
33
+ - Perform a second-pass reviewer step in Code Mode
34
+ - Execute structured actions such as opening apps, URLs, folders, and system tasks
35
+ - Support multiple providers: Gemini, Anthropic, OpenAI, local OpenAI-compatible endpoints, Ollama, and Hugging Face
38
36
 
39
- ## 📸 Screenshots
37
+ ## Current Agent Capabilities
38
+
39
+ Mint CLI is an agentic coding workflow, not just a chat wrapper.
40
+
41
+ In Code Mode it can:
42
+
43
+ - Decide on the next step from the current observation
44
+ - Use tools in a loop: `list_files`, `read_file`, `search_code`, `run_shell`, `apply_patch`, `write_file`
45
+ - Observe tool output and continue iterating
46
+ - Stop with a summary and verification result
47
+ - Ask for approval before shell commands and file changes
48
+
49
+ That makes Mint a practical CLI coding agent, while still keeping the user in control of risky actions.
50
+
51
+ ## Screenshots
40
52
 
41
53
  <p align="center">
42
- <img src="assets/Agent_Mint.png" alt="Agent Mint UI" width="48%">
43
- <img src="assets/Settings.png" alt="Settings Window" width="48%">
54
+ <img src="assets/Agent_Mint.png" alt="Mint Desktop UI" width="48%">
55
+ <img src="assets/Settings.png" alt="Mint Settings" width="48%">
44
56
  </p>
57
+
45
58
  <p align="center">
46
- <em>Desktop Interface and personalized Settings window</em>
59
+ <img src="assets/CLI_Screen.png" alt="Mint CLI" width="100%">
47
60
  </p>
48
61
 
49
- ---
62
+ ## Installation
50
63
 
51
- ## ⌨️ CLI Usage (Power Users)
64
+ ### Global install
52
65
 
53
- Mint CLI is built for speed and efficiency. Use the **`mint`** command from anywhere.
66
+ ```bash
67
+ npm install -g @pheem49/mint@latest
68
+ ```
54
69
 
55
- <p align="center">
56
- <img src="assets/CLI_Screen.png" alt="Mint CLI Preview" width="100%">
57
- </p>
70
+ ### Local development
58
71
 
59
- ### 🚀 Professional Commands
60
- - **`mint`** : Start interactive chat mode (Default).
61
- - **`mint code "task"`** : Run Mint as a workspace-aware coding agent in the current project folder.
62
- - **`mint agent`** : Run Mint as a headless background agent (Monitoring mode).
63
- - **`mint agent "task"`** : **[NEW]** Start agent and execute an autonomous task immediately.
64
- - **`mint task "task"`** : Delegate a multi-step task to an already running background agent.
65
- - **`mint onboard`** : Setup API Key, Model, and initialize global configuration in `~/.mint/`.
66
- - **`mint list`** : See full list of automation actions and plugins.
72
+ ```bash
73
+ git clone https://github.com/Pheem49/Mint.git
74
+ cd Mint
75
+ npm install
76
+ ```
67
77
 
68
- ---
78
+ ## Quick Start
69
79
 
70
- ### 🤖 Autonomous Agent (Task Delegate)
71
- Mint isn't just a chatbot—it's an autonomous worker. Assign complex tasks that require multiple steps of reasoning.
80
+ ### Run the desktop app
72
81
 
73
- ### 👨‍💻 Code Agent Mode
74
- Mint now includes a dedicated coding workflow as the first step toward a Claude-Code-like experience in the terminal.
82
+ ```bash
83
+ npm start
84
+ ```
75
85
 
76
- **What it can do now:**
77
- - Inspect the current workspace before editing
78
- - Search code across the repo
79
- - Read targeted file ranges
80
- - Run non-destructive shell commands in the project with interactive approval
81
- - Apply patch-based file edits with approval before changes are written
82
- - Reuse lightweight session memory and git/test context per project
86
+ ### Run the CLI
83
87
 
84
- **Usage Example:**
85
88
  ```bash
86
- mint code "fix the failing CLI command and verify it"
89
+ mint
87
90
  ```
88
91
 
89
- **Chat-first Example:**
92
+ ### First-time setup
93
+
90
94
  ```bash
91
- mint
92
- > สำรวจโปรเจคนี้ให้หน่อย
95
+ mint onboard
93
96
  ```
94
97
 
95
- Mint will classify the request, switch the status bar to `Code`, and return to `Chat` mode after the coding flow finishes.
98
+ ## CLI Commands
96
99
 
97
- **Supported Autonomous Tools:**
98
- - 🌐 **Web Automation**: Full Puppeteer-based browsing, info extraction, and research.
99
- - 📁 **File System**: Create, Write, Delete, and Manage folders using `~/` path expansion.
100
- - 🔍 **Knowledge Search**: Query local files and documentation (RAG).
101
- - 🛡️ **Safety Mode (Bash)**: Mint proposes commands via notifications; you choose whether to run them.
100
+ - `mint` or `mint chat`
101
+ Start the interactive chat UI.
102
102
 
103
- **Usage Examples:**
104
- ```bash
105
- # Research and write a report
106
- mint agent 'Search for the latest iPhone reviews and write a SUMMARY.md to my desktop.'
103
+ - `mint code "<task>"`
104
+ Run the workspace-aware coding agent in the current directory.
105
+
106
+ - `mint task "<task>"`
107
+ Queue a background task for the headless agent.
107
108
 
108
- # Background Task
109
- mint task 'Process these 5 files and move them to ~/Documents/Archive'
109
+ - `mint agent`
110
+ Run the background headless agent.
111
+
112
+ - `mint list`
113
+ Show major features and commands.
114
+
115
+ - `mint onboard`
116
+ Configure API keys and local settings.
117
+
118
+ ## CLI Examples
119
+
120
+ ### Interactive chat
121
+
122
+ ```bash
123
+ mint
110
124
  ```
111
125
 
112
- ---
126
+ Then ask naturally:
127
+
128
+ ```text
129
+ สำรวจโปรเจคนี้ให้หน่อย
130
+ แก้บัคใน CLI ตัวนี้และรันเทสต์
131
+ open github
132
+ ```
113
133
 
114
- ### Slash Commands (Interactive Chat)
115
- While in terminal chat, type **`/`** to access advanced tools with the new visual autocomplete system.
116
- > [!TIP]
117
- > Use **Up/Down arrow keys** to navigate the suggestion list and press **Enter** to select!
134
+ ### One-shot coding task
118
135
 
119
- - `/help` : View all commands and descriptions.
120
- - `/models` : List and switch between Gemini/Ollama models.
121
- - `/config` : Check your active API keys and preferences.
122
- - `/clear` / `/reset` : Clean terminal or reset AI context.
136
+ ```bash
137
+ mint code "fix the failing tests and verify the result"
138
+ ```
123
139
 
124
- ---
140
+ ### Background task
125
141
 
126
- ### 🕒 Proactive Monitoring
127
- When running in `agent` mode, Mint monitors your system in the background:
128
- - 🔋 **Battery Alerts**: Notifies you when power is low or charging status changes.
129
- - 🌐 **Network Status**: Alerts you when connection status changes.
130
- - 📊 **Resource Usage**: Proactive tips if system load is too high (System Metrics).
142
+ ```bash
143
+ mint task "inspect the repo and summarize the top 3 risks"
144
+ ```
131
145
 
146
+ ## Code Mode Workflow
132
147
 
133
- ---
148
+ Mint Code Mode is designed around an inspect -> act -> verify loop.
134
149
 
135
- ## 🎨 Desktop GUI Features
150
+ What it does well right now:
136
151
 
137
- - **Floating Widget**: A persistent AI character on your desktop.
138
- - **Animated Aura**: The widget breathes and glows when Mint is thinking or proactive.
139
- - **Minimize to Tray**: Click the dash icon (-) to hide the window to your system tray. Mint stays active!
140
- - **Widget Toggle**: Enable or disable the desktop widget anytime from **Settings > General**.
141
- - **Screen Overlay Glow**: Visual feedback when Mint is capturing your screen for analysis.
152
+ - Understand the current workspace path
153
+ - Read git status and diff summary
154
+ - Suggest verification commands from `package.json`
155
+ - Apply focused patches instead of blind rewrites
156
+ - Keep a workspace session summary for future tasks
142
157
 
143
- ---
158
+ What it deliberately does not do:
144
159
 
145
- ## 🛡️ Security & Privacy
160
+ - Run destructive commands like `rm -rf` or `git reset --hard`
161
+ - Edit files outside the current workspace
162
+ - Execute shell edits without approval
146
163
 
147
- - **Push Protection**: Automated `.gitignore` patterns for `mint-config.json` and `.env` files.
148
- - **History Scrubbing**: Integrated tools to ensure API keys are never leaked to Git history.
149
- - **Local First**: Built-in **Ollama** support for 100% private, offline AI processing.
164
+ ## Desktop Features
150
165
 
151
- ---
166
+ - Chat window with custom UI
167
+ - Settings window for provider and behavior configuration
168
+ - System tray support
169
+ - Proactive suggestion loop
170
+ - Silent screen capture for analysis
171
+ - Screen translation support
172
+ - Floating widget / overlay UI elements
152
173
 
153
- ## 🛠️ Getting Started
174
+ ## AI Providers
154
175
 
155
- ### Prerequisites
156
- - [Node.js](https://nodejs.org/) (LTS)
157
- - [npm](https://www.npmjs.com/)
158
- - A **Google Gemini API Key** (Get one at [Google AI Studio](https://aistudio.google.com/))
176
+ Mint supports multiple providers and local backends.
159
177
 
160
- ### Installation
161
- 1. **Install via NPM (Recommended)**
162
- ```bash
163
- npm install -g @pheem49/mint@latest
164
- ```
178
+ - `gemini`
179
+ - `anthropic`
180
+ - `openai`
181
+ - `local_openai`
182
+ - `ollama`
183
+ - `huggingface`
165
184
 
166
- 2. **Manual Installation (For Developers)**
167
- ```bash
168
- git clone https://github.com/Pheem49/Mint.git
169
- cd Mint
170
- npm install
171
- sudo npm link
172
- ```
185
+ For CLI Code Mode, Mint currently behaves best with:
173
186
 
174
- ---
187
+ - `gemini`
188
+ - `anthropic`
189
+ - `openai`
190
+ - `local_openai`
175
191
 
176
- ## 📂 Project Structure
192
+ ## Project Structure
177
193
 
178
194
  ```text
179
195
  Mint/
180
196
  ├── src/
181
- │ ├── AI_Brain/ # Gemini/Ollama integration & logic
182
- │ ├── Automation/ # Puppeteer and browser scripts
183
- │ ├── CLI/ # CLI Onboarding and Feature list
184
- │ ├── Plugins/ # Spotify, Docker, Obsidian, Git, etc.
185
- │ ├── System/ # Config, Daemon, and Event Monitoring
186
- │ └── UI/ # Electron renderer (Glassmorphism & Aura)
187
- ├── mint-cli.js # CLI Main Entry
188
- ├── main.js # Electron Main process
189
- └── package.json # Binaries and dependencies
197
+ │ ├── AI_Brain/ # Provider integration, prompts, memory, orchestration
198
+ │ ├── Automation_Layer/ # App/file/browser actions
199
+ │ ├── CLI/ # Chat router, code agent, TUI support, onboarding
200
+ │ ├── Plugins/ # Docker, Spotify, calendar, system monitor, MCP
201
+ │ ├── System/ # Config, notifications, daemon, automation, task queue
202
+ │ └── UI/ # Electron renderer files
203
+ ├── tests/ # Jest tests
204
+ ├── mint-cli.js # Main CLI entry
205
+ ├── mint-cli-logic.js # CLI action executor
206
+ ├── main.js # Electron main process
207
+ └── package.json
208
+ ```
209
+
210
+ ## Development
211
+
212
+ ### Run tests
213
+
214
+ ```bash
215
+ npm test -- --runInBand
216
+ ```
217
+
218
+ ### Watch tests
219
+
220
+ ```bash
221
+ npm run test:watch
222
+ ```
223
+
224
+ ### Build Linux packages
225
+
226
+ ```bash
227
+ npm run build:linux
190
228
  ```
191
229
 
192
- ---
230
+ See [BUILD_AND_RELEASE.md](/home/pheem49/vscode/Project/Mint/BUILD_AND_RELEASE.md) for Linux packaging and release notes workflow.
231
+
232
+ ## Security Notes
233
+
234
+ - API keys are stored in local config, not in source files
235
+ - Code Mode asks for approval before shell commands and file edits
236
+ - Workspace path resolution blocks writes outside the active workspace
237
+ - Several shell-based execution paths have been hardened to use argument-based process execution
238
+
239
+ This is still an actively evolving project. Review permissions and local configuration before using Mint against sensitive files or production systems.
193
240
 
194
- ## 🏛️ License
241
+ ## License
195
242
 
196
- Distributed under the **GNU Affero General Public License v3.0**. See `LICENSE` for details.
243
+ Mint is licensed under the GNU Affero General Public License v3.0.
244
+ See [LICENSE](/home/pheem49/vscode/Project/Mint/LICENSE).
package/main.js CHANGED
@@ -6,7 +6,7 @@ const { handleChat, resetChat, getChatTranscript, translateImageContent, refresh
6
6
  const { openApp } = require('./src/Automation_Layer/open_app');
7
7
  const { openWebsite, openSearch } = require('./src/Automation_Layer/open_website');
8
8
  const { performWebAutomation } = require('./src/Automation_Layer/browser_automation');
9
- const { createFolder, openFile, deleteFile } = require('./src/Automation_Layer/file_operations');
9
+ const { createFolder, openFile, deleteFile, findPath } = require('./src/Automation_Layer/file_operations');
10
10
  const { getSystemInfo, getWeather } = require('./src/System/system_info');
11
11
  const { readConfig, writeConfig } = require('./src/System/config_manager');
12
12
  const { parseCommand } = require('./src/Command_Parser/parser');
@@ -868,6 +868,26 @@ async function executeAction(action) {
868
868
  case 'delete_file':
869
869
  await deleteFile(action.target);
870
870
  break;
871
+ case 'find_path': {
872
+ const result = findPath(action.target, {
873
+ type: action.pathType,
874
+ maxResults: 10
875
+ });
876
+ if (!result.success) {
877
+ return result.message;
878
+ }
879
+
880
+ if (action.openAfter === true) {
881
+ if (result.matches.length === 1) {
882
+ const match = result.matches[0];
883
+ const openResult = await openFile(match.path);
884
+ return openResult || `Successfully found and opened ${match.type === 'dir' ? 'folder' : 'file'}: ${match.path} ✅`;
885
+ }
886
+ return `Found multiple matches for "${action.target}". Please be more specific:\n${result.matches.map(m => `- [${m.type}] ${m.path}`).join('\n')}`;
887
+ }
888
+
889
+ return `Found matches for "${action.target}":\n${result.matches.map(m => `- [${m.type}] ${m.path}`).join('\n')}`;
890
+ }
871
891
  case 'clipboard_write':
872
892
  clipboard.writeText(action.target);
873
893
  break;
package/mint-cli-logic.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // Mint CLI Action Logic
2
2
  const { openApp } = require('./src/Automation_Layer/open_app');
3
3
  const { openWebsite, openSearch } = require('./src/Automation_Layer/open_website');
4
- const { createFolder, openFile, deleteFile } = require('./src/Automation_Layer/file_operations');
4
+ const { createFolder, openFile, deleteFile, findPath } = require('./src/Automation_Layer/file_operations');
5
5
  const { indexFile } = require('./src/AI_Brain/knowledge_base');
6
6
  const SystemAutomation = require('./src/System/system_automation');
7
7
  const pluginManager = require('./src/Plugins/plugin_manager');
@@ -32,6 +32,26 @@ async function executeAction(action) {
32
32
  case 'delete_file':
33
33
  await deleteFile(action.target);
34
34
  return `Deleted: ${action.target}`;
35
+ case 'find_path': {
36
+ const result = findPath(action.target, {
37
+ type: action.pathType,
38
+ maxResults: 10
39
+ });
40
+ if (!result.success) {
41
+ return result.message;
42
+ }
43
+
44
+ if (action.openAfter === true) {
45
+ if (result.matches.length === 1) {
46
+ const match = result.matches[0];
47
+ await openFile(match.path);
48
+ return `Found and opened ${match.type === 'dir' ? 'folder' : 'file'}: ${match.path}`;
49
+ }
50
+ return `Found multiple matches for "${action.target}". Please be more specific:\n${result.matches.map(m => `- [${m.type}] ${m.path}`).join('\n')}`;
51
+ }
52
+
53
+ return `Found matches for "${action.target}":\n${result.matches.map(m => `- [${m.type}] ${m.path}`).join('\n')}`;
54
+ }
35
55
  case 'learn_file':
36
56
  return await indexFile(action.target);
37
57
  case 'mcp_tool':