@pheem49/mint 1.4.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.
- package/.codex +0 -0
- package/README.md +171 -127
- package/main.js +21 -1
- package/mint-cli-logic.js +21 -1
- package/mint-cli.js +89 -22
- package/package.json +1 -1
- package/src/AI_Brain/Gemini_API.js +38 -24
- package/src/AI_Brain/proactive_engine.js +2 -8
- package/src/Automation_Layer/file_operations.js +123 -4
- package/src/Automation_Layer/open_app.js +72 -43
- package/src/Automation_Layer/open_website.js +3 -3
- package/src/CLI/chat_router.js +51 -18
- package/src/CLI/chat_ui.js +34 -10
- package/src/CLI/code_agent.js +113 -13
- package/src/CLI/workspace_manager.js +15 -6
- package/src/Plugins/docker.js +12 -10
- package/src/System/custom_workflows.js +9 -2
- package/tests/chat_router.test.js +42 -0
- package/tests/code_agent.test.js +69 -0
- package/tests/docker.test.js +46 -0
- package/tests/file_operations.test.js +57 -0
- package/tests/provider_routing.test.js +67 -0
- package/tests/workspace_manager.test.js +15 -0
package/.codex
ADDED
|
File without changes
|
package/README.md
CHANGED
|
@@ -1,200 +1,244 @@
|
|
|
1
1
|
# Mint
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<img src="assets/icon.png" alt="
|
|
4
|
+
<img src="assets/icon.png" alt="Mint Icon" width="160">
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
<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-
|
|
15
|
-
<img src="https://img.shields.io/badge/
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
- **Advanced Multi-Agent Hub**:
|
|
28
|
-
- **Smart Routing**: Intelligently routes coding/general tasks to the most capable configured provider (e.g., Claude, OpenAI, Gemini).
|
|
29
|
-
- **Agent Collaboration**: Enable Multi-Agent Review so that a primary AI writes the code while a secondary AI automatically reviews it in the same loop.
|
|
30
|
-
- **Resilient Fallback**: Automatically fallbacks to alternative AI providers (Gemini, Anthropic, OpenAI, Hugging Face, LM Studio, Ollama) if your active provider fails.
|
|
31
|
-
- **Visible Mode State**: The CLI status bar now shows whether Mint is currently in `Chat` or `Code` mode.
|
|
32
|
-
- **Interactive Slash Commands**: Manage models and settings in the terminal with `/model`, `/config`, `/clear`, etc.
|
|
33
|
-
- **Smart TUI Experience**: Professional message framing, character-wrapped Thai text support, and mouse scroll wheel navigation.
|
|
34
|
-
- **System Information Action**: Retrieve OS, Kernel, and Architecture details via natural language.
|
|
35
|
-
- **Dynamic UI Aesthetics**: Animated **Aura Glow** for the AI widget and **Glassmorphism** design.
|
|
36
|
-
- **Minimize-to-Tray**: Keep Mint running in the background via the System Tray.
|
|
37
|
-
- **Vision-Ready (Desktop)**: Capture, analyze, and translate any part of your screen in real-time.
|
|
38
|
-
- **Automation First**: Control your system and browser via natural language from both App and Terminal.
|
|
39
|
-
- **Background Agent**: Install Mint as a `systemd` user service for proactive monitoring.
|
|
25
|
+
## What Mint Can Do
|
|
40
26
|
|
|
41
|
-
|
|
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
|
|
36
|
+
|
|
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.
|
|
42
50
|
|
|
43
51
|
## Screenshots
|
|
44
52
|
|
|
45
53
|
<p align="center">
|
|
46
|
-
<img src="assets/Agent_Mint.png" alt="
|
|
47
|
-
<img src="assets/Settings.png" alt="Settings
|
|
54
|
+
<img src="assets/Agent_Mint.png" alt="Mint Desktop UI" width="48%">
|
|
55
|
+
<img src="assets/Settings.png" alt="Mint Settings" width="48%">
|
|
48
56
|
</p>
|
|
57
|
+
|
|
49
58
|
<p align="center">
|
|
50
|
-
<
|
|
59
|
+
<img src="assets/CLI_Screen.png" alt="Mint CLI" width="100%">
|
|
51
60
|
</p>
|
|
52
61
|
|
|
53
|
-
|
|
62
|
+
## Installation
|
|
54
63
|
|
|
55
|
-
|
|
64
|
+
### Global install
|
|
56
65
|
|
|
57
|
-
|
|
66
|
+
```bash
|
|
67
|
+
npm install -g @pheem49/mint@latest
|
|
68
|
+
```
|
|
58
69
|
|
|
59
|
-
|
|
60
|
-
<img src="assets/CLI_Screen.png" alt="Mint CLI Preview" width="100%">
|
|
61
|
-
</p>
|
|
70
|
+
### Local development
|
|
62
71
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
- **`mint task "task"`** : Delegate a multi-step task to an already running background agent.
|
|
69
|
-
- **`mint onboard`** : Setup API Key, Model, and initialize global configuration in `~/.mint/`.
|
|
70
|
-
- **`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
|
+
```
|
|
71
77
|
|
|
72
|
-
|
|
78
|
+
## Quick Start
|
|
73
79
|
|
|
74
|
-
###
|
|
75
|
-
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
|
|
76
81
|
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
```bash
|
|
83
|
+
npm start
|
|
84
|
+
```
|
|
79
85
|
|
|
80
|
-
|
|
81
|
-
- Inspect the current workspace before editing
|
|
82
|
-
- Search code across the repo
|
|
83
|
-
- Read targeted file ranges
|
|
84
|
-
- Run non-destructive shell commands in the project with interactive approval
|
|
85
|
-
- Apply patch-based file edits with approval before changes are written
|
|
86
|
-
- Reuse lightweight session memory and git/test context per project
|
|
86
|
+
### Run the CLI
|
|
87
87
|
|
|
88
|
-
**Usage Example:**
|
|
89
88
|
```bash
|
|
90
|
-
mint
|
|
89
|
+
mint
|
|
91
90
|
```
|
|
92
91
|
|
|
93
|
-
|
|
92
|
+
### First-time setup
|
|
93
|
+
|
|
94
94
|
```bash
|
|
95
|
-
mint
|
|
96
|
-
> สำรวจโปรเจคนี้ให้หน่อย
|
|
95
|
+
mint onboard
|
|
97
96
|
```
|
|
98
97
|
|
|
99
|
-
|
|
98
|
+
## CLI Commands
|
|
100
99
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
- **File System**: Create, Write, Delete, and Manage folders using `~/` path expansion.
|
|
104
|
-
- **Knowledge Search**: Query local files and documentation (RAG).
|
|
105
|
-
- **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.
|
|
106
102
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
mint
|
|
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.
|
|
111
108
|
|
|
112
|
-
|
|
113
|
-
|
|
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
|
|
114
124
|
```
|
|
115
125
|
|
|
116
|
-
|
|
126
|
+
Then ask naturally:
|
|
127
|
+
|
|
128
|
+
```text
|
|
129
|
+
สำรวจโปรเจคนี้ให้หน่อย
|
|
130
|
+
แก้บัคใน CLI ตัวนี้และรันเทสต์
|
|
131
|
+
open github
|
|
132
|
+
```
|
|
117
133
|
|
|
118
|
-
###
|
|
119
|
-
While in terminal chat, type **`/`** to access advanced tools with the new visual autocomplete system.
|
|
120
|
-
> [!TIP]
|
|
121
|
-
> Use **Up/Down arrow keys** to navigate the suggestion list and press **Enter** to select!
|
|
134
|
+
### One-shot coding task
|
|
122
135
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
- `/clear` / `/reset` : Clean terminal or reset AI context.
|
|
136
|
+
```bash
|
|
137
|
+
mint code "fix the failing tests and verify the result"
|
|
138
|
+
```
|
|
127
139
|
|
|
128
|
-
|
|
140
|
+
### Background task
|
|
129
141
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
- **Network Status**: Alerts you when connection status changes.
|
|
134
|
-
- **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
|
+
```
|
|
135
145
|
|
|
146
|
+
## Code Mode Workflow
|
|
136
147
|
|
|
137
|
-
|
|
148
|
+
Mint Code Mode is designed around an inspect -> act -> verify loop.
|
|
138
149
|
|
|
139
|
-
|
|
150
|
+
What it does well right now:
|
|
140
151
|
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
-
|
|
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
|
|
146
157
|
|
|
147
|
-
|
|
158
|
+
What it deliberately does not do:
|
|
148
159
|
|
|
149
|
-
|
|
160
|
+
- Run destructive commands like `rm -rf` or `git reset --hard`
|
|
161
|
+
- Edit files outside the current workspace
|
|
162
|
+
- Execute shell edits without approval
|
|
150
163
|
|
|
151
|
-
|
|
152
|
-
- **History Scrubbing**: Integrated tools to ensure API keys are never leaked to Git history.
|
|
153
|
-
- **Local First**: Built-in **Ollama** and **LM Studio (OpenAI Compatible)** support for 100% private, offline AI processing.
|
|
164
|
+
## Desktop Features
|
|
154
165
|
|
|
155
|
-
|
|
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
|
|
156
173
|
|
|
157
|
-
##
|
|
174
|
+
## AI Providers
|
|
158
175
|
|
|
159
|
-
|
|
160
|
-
- [Node.js](https://nodejs.org/) (LTS)
|
|
161
|
-
- [npm](https://www.npmjs.com/)
|
|
162
|
-
- A **Google Gemini API Key** (Get one at [Google AI Studio](https://aistudio.google.com/))
|
|
176
|
+
Mint supports multiple providers and local backends.
|
|
163
177
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
178
|
+
- `gemini`
|
|
179
|
+
- `anthropic`
|
|
180
|
+
- `openai`
|
|
181
|
+
- `local_openai`
|
|
182
|
+
- `ollama`
|
|
183
|
+
- `huggingface`
|
|
169
184
|
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
git clone https://github.com/Pheem49/Mint.git
|
|
173
|
-
cd Mint
|
|
174
|
-
npm install
|
|
175
|
-
sudo npm link
|
|
176
|
-
```
|
|
185
|
+
For CLI Code Mode, Mint currently behaves best with:
|
|
177
186
|
|
|
178
|
-
|
|
187
|
+
- `gemini`
|
|
188
|
+
- `anthropic`
|
|
189
|
+
- `openai`
|
|
190
|
+
- `local_openai`
|
|
179
191
|
|
|
180
192
|
## Project Structure
|
|
181
193
|
|
|
182
194
|
```text
|
|
183
195
|
Mint/
|
|
184
196
|
├── src/
|
|
185
|
-
│ ├── AI_Brain/
|
|
186
|
-
│ ├──
|
|
187
|
-
│ ├── CLI/
|
|
188
|
-
│ ├── Plugins/
|
|
189
|
-
│ ├── System/
|
|
190
|
-
│ └── UI/
|
|
191
|
-
├──
|
|
192
|
-
├──
|
|
193
|
-
|
|
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
|
|
194
228
|
```
|
|
195
229
|
|
|
196
|
-
|
|
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.
|
|
197
240
|
|
|
198
241
|
## License
|
|
199
242
|
|
|
200
|
-
|
|
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':
|
package/mint-cli.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
require('dotenv').config({ quiet: true });
|
|
3
|
+
// Suppress experimental SQLite warning
|
|
4
|
+
const originalEmit = process.emit;
|
|
5
|
+
process.emit = function (name, data, ...args) {
|
|
6
|
+
if (name === 'warning' && typeof data === 'object' && data.name === 'ExperimentalWarning' && data.message.includes('SQLite')) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
return originalEmit.apply(process, [name, data, ...args]);
|
|
10
|
+
};
|
|
3
11
|
const { Command } = require('commander');
|
|
4
|
-
const { handleChat, handleGeminiChatStream, resetChat, refreshApiKeyFromConfig } = require('./src/AI_Brain/Gemini_API');
|
|
12
|
+
const { handleChat, handleGeminiChatStream, resetChat, refreshApiKeyFromConfig, getChatTranscript } = require('./src/AI_Brain/Gemini_API');
|
|
5
13
|
const agentOrchestrator = require('./src/AI_Brain/agent_orchestrator');
|
|
6
14
|
const workspaceManager = require('./src/CLI/workspace_manager');
|
|
7
15
|
const systemMonitor = require('./src/Plugins/system_monitor');
|
|
@@ -145,7 +153,7 @@ async function startInteractiveChat(initialMessage = null) {
|
|
|
145
153
|
if (success) {
|
|
146
154
|
const agent = agentOrchestrator.getCurrentAgent();
|
|
147
155
|
appendMessage('system', `Switched to Agent: ${agent.icon} ${agent.name}`);
|
|
148
|
-
updateStatusModel(
|
|
156
|
+
updateStatusModel(agent.name); // Pass name to status bar
|
|
149
157
|
resetChat(); // Reset to apply new system prompt
|
|
150
158
|
} else {
|
|
151
159
|
appendMessage('error', `Agent "${args[1]}" not found. Try /agent list`);
|
|
@@ -217,16 +225,32 @@ async function startInteractiveChat(initialMessage = null) {
|
|
|
217
225
|
}
|
|
218
226
|
appendMessage('user', text);
|
|
219
227
|
|
|
220
|
-
const
|
|
228
|
+
const transcript = await getChatTranscript();
|
|
229
|
+
const routeDecision = await detectCodeIntent(text, process.cwd(), transcript);
|
|
221
230
|
if (routeDecision.route === 'code') {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
231
|
+
const approved = await requestApproval({
|
|
232
|
+
type: 'code_mode',
|
|
233
|
+
label: 'Mint wants to switch this request into Code Mode.',
|
|
234
|
+
preview: [
|
|
235
|
+
`Request: ${text}`,
|
|
236
|
+
`Reason: ${routeDecision.reason}`,
|
|
237
|
+
'',
|
|
238
|
+
'Code Mode is better for larger coding tasks that may inspect the workspace, run checks, or edit files.'
|
|
239
|
+
].join('\n')
|
|
228
240
|
});
|
|
229
|
-
|
|
241
|
+
if (!approved) {
|
|
242
|
+
appendMessage('system', `Router stayed in Chat Mode. ${routeDecision.reason}`);
|
|
243
|
+
} else {
|
|
244
|
+
appendMessage('system', `Router: entering Code Mode. ${routeDecision.reason}`);
|
|
245
|
+
await runChatRoutedTask(text, {
|
|
246
|
+
appendMessage,
|
|
247
|
+
setThinking,
|
|
248
|
+
requestApproval,
|
|
249
|
+
setMode,
|
|
250
|
+
history: transcript
|
|
251
|
+
});
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
230
254
|
}
|
|
231
255
|
|
|
232
256
|
setMode('Chat');
|
|
@@ -243,7 +267,7 @@ async function startInteractiveChat(initialMessage = null) {
|
|
|
243
267
|
const config = require('./src/System/config_manager').readConfig();
|
|
244
268
|
const provider = config.aiProvider || 'gemini';
|
|
245
269
|
const currentAgent = agentOrchestrator.getCurrentAgent();
|
|
246
|
-
updateStatusModel(
|
|
270
|
+
updateStatusModel(currentAgent.name);
|
|
247
271
|
if (provider === 'gemini') {
|
|
248
272
|
// ── Streaming path (Gemini only) ──────────────────────────────────
|
|
249
273
|
// Gemini returns JSON so we buffer all chunks and progressively
|
|
@@ -346,16 +370,52 @@ async function startInteractiveChat(initialMessage = null) {
|
|
|
346
370
|
// Handle initial message if passed via CLI arg
|
|
347
371
|
if (initialMessage) {
|
|
348
372
|
appendMessage('user', initialMessage);
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
373
|
+
const transcript = await getChatTranscript();
|
|
374
|
+
const routeDecision = await detectCodeIntent(initialMessage, process.cwd(), transcript);
|
|
375
|
+
if (routeDecision.route === 'code') {
|
|
376
|
+
const approved = await requestApproval({
|
|
377
|
+
type: 'code_mode',
|
|
378
|
+
label: 'Mint wants to switch this request into Code Mode.',
|
|
379
|
+
preview: [
|
|
380
|
+
`Request: ${initialMessage}`,
|
|
381
|
+
`Reason: ${routeDecision.reason}`,
|
|
382
|
+
'',
|
|
383
|
+
'Code Mode is better for larger coding tasks that may inspect the workspace, run checks, or edit files.'
|
|
384
|
+
].join('\n')
|
|
385
|
+
});
|
|
386
|
+
if (approved) {
|
|
387
|
+
appendMessage('system', `Router: entering Code Mode. ${routeDecision.reason}`);
|
|
388
|
+
await runChatRoutedTask(initialMessage, {
|
|
389
|
+
appendMessage,
|
|
390
|
+
setThinking,
|
|
391
|
+
requestApproval,
|
|
392
|
+
setMode,
|
|
393
|
+
history: transcript
|
|
394
|
+
});
|
|
395
|
+
} else {
|
|
396
|
+
appendMessage('system', `Router stayed in Chat Mode. ${routeDecision.reason}`);
|
|
397
|
+
setMode('Chat');
|
|
398
|
+
let seconds = 0;
|
|
399
|
+
setThinking(true, seconds);
|
|
400
|
+
const timer = setInterval(() => { seconds++; setThinking(true, seconds); }, 1000);
|
|
401
|
+
try {
|
|
402
|
+
const response = await handleChat(initialMessage);
|
|
403
|
+
clearInterval(timer);
|
|
404
|
+
setThinking(false);
|
|
405
|
+
appendMessage('assistant', response.response, response.timestamp);
|
|
406
|
+
lastResponseText = response.response;
|
|
407
|
+
const { executeAction } = require('./mint-cli-logic');
|
|
408
|
+
if (response.action && response.action.type !== 'none') {
|
|
409
|
+
const result = await executeAction(response.action);
|
|
410
|
+
if (result) appendMessage('system', `Action: ${result}`);
|
|
411
|
+
}
|
|
412
|
+
} catch (err) {
|
|
413
|
+
clearInterval(timer);
|
|
414
|
+
setThinking(false);
|
|
415
|
+
appendMessage('error', err.message);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
} else {
|
|
359
419
|
setMode('Chat');
|
|
360
420
|
let seconds = 0;
|
|
361
421
|
setThinking(true, seconds);
|
|
@@ -365,6 +425,12 @@ async function startInteractiveChat(initialMessage = null) {
|
|
|
365
425
|
clearInterval(timer);
|
|
366
426
|
setThinking(false);
|
|
367
427
|
appendMessage('assistant', response.response, response.timestamp);
|
|
428
|
+
lastResponseText = response.response;
|
|
429
|
+
const { executeAction } = require('./mint-cli-logic');
|
|
430
|
+
if (response.action && response.action.type !== 'none') {
|
|
431
|
+
const result = await executeAction(response.action);
|
|
432
|
+
if (result) appendMessage('system', `Action: ${result}`);
|
|
433
|
+
}
|
|
368
434
|
} catch (err) {
|
|
369
435
|
clearInterval(timer);
|
|
370
436
|
setThinking(false);
|
|
@@ -455,7 +521,8 @@ async function handleSlashCommandUI(input, appendMessage, updateStatusModel, cop
|
|
|
455
521
|
appendMessage,
|
|
456
522
|
setThinking,
|
|
457
523
|
requestApproval,
|
|
458
|
-
setMode
|
|
524
|
+
setMode,
|
|
525
|
+
history: await getChatTranscript()
|
|
459
526
|
});
|
|
460
527
|
break;
|
|
461
528
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pheem49/mint",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "A powerful Electron-based AI desktop assistant powered by Google Gemini, featuring screen vision, web automation, and proactive suggestions.",
|
|
5
5
|
"main": "main.js",
|
|
6
6
|
"scripts": {
|