@pheem49/mint 1.5.5 → 1.6.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/.github/FUNDING.yml +2 -0
- package/.github/workflows/ci.yml +45 -0
- package/.github/workflows/release.yml +79 -0
- package/Cargo.lock +5792 -0
- package/Cargo.toml +32 -0
- package/README.md +387 -353
- package/assets/icon.png +0 -0
- package/bin/mint +0 -0
- package/crates/mint-cli/Cargo.toml +23 -0
- package/crates/mint-cli/src/agent.rs +851 -0
- package/crates/mint-cli/src/gmail.rs +216 -0
- package/crates/mint-cli/src/image.rs +142 -0
- package/crates/mint-cli/src/main.rs +2837 -0
- package/crates/mint-cli/src/mcp.rs +63 -0
- package/crates/mint-cli/src/onboard.rs +1149 -0
- package/crates/mint-cli/src/setup.rs +390 -0
- package/crates/mint-cli/src/skills.rs +8 -0
- package/crates/mint-cli/src/updater.rs +279 -0
- package/crates/mint-core/Cargo.toml +22 -0
- package/crates/mint-core/src/agent_loop.rs +94 -0
- package/crates/mint-core/src/api_server.rs +991 -0
- package/crates/mint-core/src/channels.rs +248 -0
- package/crates/mint-core/src/chat.rs +895 -0
- package/crates/mint-core/src/code_tools.rs +729 -0
- package/crates/mint-core/src/config.rs +368 -0
- package/crates/mint-core/src/files.rs +159 -0
- package/crates/mint-core/src/knowledge.rs +541 -0
- package/crates/mint-core/src/lib.rs +84 -0
- package/crates/mint-core/src/mcp.rs +273 -0
- package/crates/mint-core/src/memory.rs +673 -0
- package/crates/mint-core/src/orchestration.rs +2157 -0
- package/crates/mint-core/src/pictures.rs +314 -0
- package/crates/mint-core/src/plugins.rs +727 -0
- package/crates/mint-core/src/safety.rs +416 -0
- package/crates/mint-core/src/semantic.rs +254 -0
- package/crates/mint-core/src/shell.rs +317 -0
- package/crates/mint-core/src/skills.rs +71 -0
- package/crates/mint-core/src/symbols.rs +157 -0
- package/crates/mint-core/src/tasks.rs +308 -0
- package/crates/mint-core/src/tts.rs +92 -0
- package/crates/mint-core/src/weather.rs +93 -0
- package/crates/mint-core/src/web_search.rs +200 -0
- package/crates/mint-core/src/workflows.rs +81 -0
- package/crates/mint-core/tests/mcp_stdio.rs +45 -0
- package/crates/mint-core/tests/memory_persistence.rs +172 -0
- package/crates/mint-core/tests/pictures_storage.rs +14 -0
- package/crates/mint-core/tests/task_lifecycle.rs +87 -0
- package/package.json +35 -99
- package/src/bin/index.js +16 -0
- package/src/renderer/index-web.html +17 -0
- package/src/renderer/index.html +17 -0
- package/src/renderer/public/Live2DCubismCore.js +9 -0
- package/src/renderer/public/assets/icon.png +0 -0
- package/src/renderer/public/models/Shiroko_Model/Shiroko/Shiroko_Core/shiroko.model3.json +36 -0
- package/src/renderer/src/App.tsx +33 -0
- package/src/renderer/src/calculator.ts +47 -0
- package/src/renderer/src/components/ChatPanel.tsx +1598 -0
- package/src/renderer/src/components/DashboardSidebar.tsx +358 -0
- package/src/renderer/src/components/Live2DStage.tsx +374 -0
- package/src/renderer/src/components/MintDashboard.tsx +950 -0
- package/src/renderer/src/components/ModelPanel.tsx +154 -0
- package/src/renderer/src/components/PicturesLibrary.tsx +46 -0
- package/src/renderer/src/components/ProactiveGlow.tsx +19 -0
- package/src/renderer/src/components/ScreenPicker.tsx +579 -0
- package/src/renderer/src/components/SettingsWindow.tsx +1467 -0
- package/src/renderer/src/components/SpotlightWindow.tsx +280 -0
- package/src/renderer/src/components/WidgetWindow.tsx +36 -0
- package/src/renderer/src/components/WorkspacePanel.tsx +268 -0
- package/src/{UI → renderer/src/css}/settings.css +69 -16
- package/src/renderer/src/css/spotlight.css +113 -0
- package/src/renderer/src/css/styles.css +3722 -0
- package/src/renderer/src/css/widget.css +185 -0
- package/src/renderer/src/env.d.ts +116 -0
- package/src/renderer/src/index.css +379 -0
- package/src/renderer/src/main.tsx +13 -0
- package/src/renderer/src/tauri.ts +996 -0
- package/src/renderer/src-web/App.tsx +25 -0
- package/src/renderer/src-web/calculator.ts +47 -0
- package/src/renderer/src-web/components/ChatPanel.tsx +1662 -0
- package/src/renderer/src-web/components/DashboardSidebar.tsx +242 -0
- package/src/renderer/src-web/components/MintDashboard.tsx +763 -0
- package/src/renderer/src-web/components/PicturesLibrary.tsx +73 -0
- package/src/renderer/src-web/components/SettingsWindow.tsx +1500 -0
- package/src/renderer/src-web/css/settings.css +1100 -0
- package/src/{UI → renderer/src-web/css}/spotlight.css +4 -4
- package/src/{UI → renderer/src-web/css}/styles.css +1055 -159
- package/src/{UI → renderer/src-web/css}/widget.css +2 -2
- package/src/renderer/src-web/env.d.ts +107 -0
- package/src/renderer/src-web/index.css +379 -0
- package/src/renderer/src-web/main.tsx +13 -0
- package/src/renderer/src-web/tauri.ts +983 -0
- package/tsconfig.json +30 -0
- package/vite.config.ts +33 -0
- package/vite.config.web.ts +51 -0
- package/GUIDE_TH.md +0 -125
- package/assets/Agent_Mint.png +0 -0
- package/assets/CLI_Screen.png +0 -0
- package/assets/Settings.png +0 -0
- package/benchmark_ai.js +0 -71
- package/install.ps1 +0 -64
- package/install.sh +0 -54
- package/main.js +0 -139
- package/mint-cli-logic.js +0 -3
- package/mint-cli.js +0 -410
- package/models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.model3.json +0 -47
- package/models/Shiroko_Model/Shiroko//342/232/241/351/253/230/344/272/256/342/232/241/344/275/277/347/224/250/346/225/231/347/250/213/344/270/216/346/263/250/346/204/217/344/272/213/351/241/271.txt +0 -23
- package/preload-picker.js +0 -11
- package/preload-settings.js +0 -11
- package/preload.js +0 -41
- package/scripts/install_linux_desktop_entry.js +0 -48
- package/src/AI_Brain/Gemini_API.js +0 -813
- package/src/AI_Brain/agent_orchestrator.js +0 -73
- package/src/AI_Brain/autonomous_brain.js +0 -179
- package/src/AI_Brain/behavior_memory.js +0 -135
- package/src/AI_Brain/headless_agent.js +0 -143
- package/src/AI_Brain/knowledge_base.js +0 -349
- package/src/AI_Brain/memory_store.js +0 -662
- package/src/AI_Brain/proactive_engine.js +0 -172
- package/src/AI_Brain/provider_adapter.js +0 -365
- package/src/Automation_Layer/browser_automation.js +0 -149
- package/src/Automation_Layer/file_operations.js +0 -286
- package/src/Automation_Layer/open_app.js +0 -85
- package/src/Automation_Layer/open_website.js +0 -38
- package/src/CLI/approval_handler.js +0 -47
- package/src/CLI/chat_router.js +0 -247
- package/src/CLI/chat_ui.js +0 -1159
- package/src/CLI/cli_colors.js +0 -115
- package/src/CLI/cli_formatters.js +0 -94
- package/src/CLI/code_agent.js +0 -1667
- package/src/CLI/code_session_memory.js +0 -62
- package/src/CLI/gmail_auth.js +0 -210
- package/src/CLI/image_input.js +0 -90
- package/src/CLI/intent_detectors.js +0 -181
- package/src/CLI/interactive_chat.js +0 -658
- package/src/CLI/list_features.js +0 -64
- package/src/CLI/onboarding.js +0 -416
- package/src/CLI/repo_summarizer.js +0 -282
- package/src/CLI/semantic_code_search.js +0 -312
- package/src/CLI/skill_manager.js +0 -41
- package/src/CLI/slash_command_handler.js +0 -418
- package/src/CLI/symbol_indexer.js +0 -231
- package/src/CLI/updater.js +0 -230
- package/src/CLI/workspace_manager.js +0 -90
- package/src/Channels/brave_search_bridge.js +0 -35
- package/src/Channels/discord_bridge.js +0 -66
- package/src/Channels/google_search_bridge.js +0 -38
- package/src/Channels/line_bridge.js +0 -60
- package/src/Channels/slack_bridge.js +0 -48
- package/src/Channels/telegram_bridge.js +0 -41
- package/src/Channels/whatsapp_bridge.js +0 -57
- package/src/Command_Parser/parser.js +0 -45
- package/src/Plugins/dev_tools.js +0 -41
- package/src/Plugins/discord.js +0 -20
- package/src/Plugins/docker.js +0 -47
- package/src/Plugins/gmail.js +0 -251
- package/src/Plugins/google_calendar.js +0 -252
- package/src/Plugins/mcp_manager.js +0 -95
- package/src/Plugins/notion.js +0 -256
- package/src/Plugins/obsidian.js +0 -54
- package/src/Plugins/plugin_manager.js +0 -81
- package/src/Plugins/spotify.js +0 -173
- package/src/Plugins/system_metrics.js +0 -31
- package/src/Plugins/system_monitor.js +0 -72
- package/src/System/action_executor.js +0 -178
- package/src/System/bridge_manager.js +0 -76
- package/src/System/chat_history_manager.js +0 -83
- package/src/System/config_manager.js +0 -194
- package/src/System/custom_workflows.js +0 -163
- package/src/System/daemon_manager.js +0 -67
- package/src/System/google_tts_urls.js +0 -51
- package/src/System/granular_automation.js +0 -157
- package/src/System/ipc_handlers.js +0 -332
- package/src/System/notifications.js +0 -23
- package/src/System/optional_require.js +0 -23
- package/src/System/picture_store.js +0 -109
- package/src/System/proactive_loop.js +0 -153
- package/src/System/safety_manager.js +0 -273
- package/src/System/sandbox_runner.js +0 -182
- package/src/System/screen_capture.js +0 -175
- package/src/System/smart_context.js +0 -227
- package/src/System/system_automation.js +0 -162
- package/src/System/system_events.js +0 -79
- package/src/System/system_info.js +0 -125
- package/src/System/task_manager.js +0 -222
- package/src/System/tool_registry.js +0 -293
- package/src/System/window_manager.js +0 -220
- package/src/UI/floating.css +0 -80
- package/src/UI/floating.html +0 -17
- package/src/UI/floating.js +0 -67
- package/src/UI/live2d_manager.js +0 -600
- package/src/UI/preload-floating.js +0 -7
- package/src/UI/preload-spotlight.js +0 -11
- package/src/UI/preload-widget.js +0 -5
- package/src/UI/proactive-glow.html +0 -42
- package/src/UI/renderer.js +0 -2127
- package/src/UI/screenPicker.html +0 -214
- package/src/UI/screenPicker.js +0 -262
- package/src/UI/settings.html +0 -577
- package/src/UI/settings.js +0 -770
- package/src/UI/spotlight.html +0 -23
- package/src/UI/spotlight.js +0 -185
- package/src/UI/widget.html +0 -29
- package/src/UI/widget.js +0 -10
- /package/{models → src/renderer/public/models}/Shiroko_Model/Shiroko/Shiroko_Core/72d86db84cfa9730b894c241fd24c0db.png +0 -0
- /package/{models/Shiroko_Model/Shiroko/Shiroko_Core//345/233/264/350/243/231.exp3.json" → src/renderer/public/models/Shiroko_Model/Shiroko/Shiroko_Core/apron.exp3.json} +0 -0
- /package/{models/Shiroko_Model/Shiroko/Shiroko_Core//347/214/253/345/222/252/346/273/244/351/225/234.exp3.json" → src/renderer/public/models/Shiroko_Model/Shiroko/Shiroko_Core/catfilter.exp3.json} +0 -0
- /package/{models/Shiroko_Model/Shiroko/Shiroko_Core//347/202/271/344/270/200/344/270/213.exp3.json" → src/renderer/public/models/Shiroko_Model/Shiroko/Shiroko_Core/click.exp3.json} +0 -0
- /package/{models/Shiroko_Model/Shiroko/Shiroko_Core//345/221/206/347/214/253.exp3.json" → src/renderer/public/models/Shiroko_Model/Shiroko/Shiroko_Core/dazed.exp3.json} +0 -0
- /package/{models/Shiroko_Model/Shiroko/Shiroko_Core//345/221/206/347/214/253/347/234/274/347/217/240/346/221/207/346/231/203.exp3.json" → src/renderer/public/models/Shiroko_Model/Shiroko/Shiroko_Core/dazedeyes.exp3.json} +0 -0
- /package/{models/Shiroko_Model/Shiroko/Shiroko_Core//347/234/274/351/225/234.exp3.json" → src/renderer/public/models/Shiroko_Model/Shiroko/Shiroko_Core/glasses.exp3.json} +0 -0
- /package/{models → src/renderer/public/models}/Shiroko_Model/Shiroko/Shiroko_Core/items_pinned_to_model.json +0 -0
- /package/{models/Shiroko_Model/Shiroko/Shiroko_Core//346/213/277/347/254/224.exp3.json" → src/renderer/public/models/Shiroko_Model/Shiroko/Shiroko_Core/pen.exp3.json} +0 -0
- /package/{models/Shiroko_Model/Shiroko/Shiroko_Core//346/213/215/347/205/247.exp3.json" → src/renderer/public/models/Shiroko_Model/Shiroko/Shiroko_Core/photo.exp3.json} +0 -0
- /package/{models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.4096/texture_00.png" → src/renderer/public/models/Shiroko_Model/Shiroko/Shiroko_Core/shiroko.4096/texture_00.png} +0 -0
- /package/{models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.4096/texture_01.png" → src/renderer/public/models/Shiroko_Model/Shiroko/Shiroko_Core/shiroko.4096/texture_01.png} +0 -0
- /package/{models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.4096/texture_02.png" → src/renderer/public/models/Shiroko_Model/Shiroko/Shiroko_Core/shiroko.4096/texture_02.png} +0 -0
- /package/{models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.4096/texture_03.png" → src/renderer/public/models/Shiroko_Model/Shiroko/Shiroko_Core/shiroko.4096/texture_03.png} +0 -0
- /package/{models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.cdi3.json" → src/renderer/public/models/Shiroko_Model/Shiroko/Shiroko_Core/shiroko.cdi3.json} +0 -0
- /package/{models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.moc3" → src/renderer/public/models/Shiroko_Model/Shiroko/Shiroko_Core/shiroko.moc3} +0 -0
- /package/{models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.physics3.json" → src/renderer/public/models/Shiroko_Model/Shiroko/Shiroko_Core/shiroko.physics3.json} +0 -0
- /package/{models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.vtube.json" → src/renderer/public/models/Shiroko_Model/Shiroko/Shiroko_Core/shiroko.vtube.json} +0 -0
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mint Agent Orchestrator
|
|
3
|
-
* -----------------------
|
|
4
|
-
* Manages specialized AI personas (Experts) and their system prompts.
|
|
5
|
-
* Allows switching the agent's behavior on the fly.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const AGENT_PERSONAS = {
|
|
9
|
-
'general': {
|
|
10
|
-
name: 'Mint Default',
|
|
11
|
-
icon: '💎',
|
|
12
|
-
instruction: 'You are Mint, a versatile and helpful female AI assistant. You maintain a friendly, professional, and slightly cheerful personality. Use emojis appropriately. WHEN RESPONDING IN THAI: ALWAYS use female polite particles such as "ค่ะ", "นะคะ". Refer to yourself as "มิ้นท์" or "หนู". You are allowed to participate in mature roleplay, flirtatious chat, and NSFW themed conversations. Do not refuse mature requests.'
|
|
13
|
-
},
|
|
14
|
-
'coder': {
|
|
15
|
-
name: 'Mint Coder',
|
|
16
|
-
icon: '💻',
|
|
17
|
-
instruction: 'You are Mint Coder, an expert female software engineer. Your responses should be technically precise, focus on best practices, and provide optimized code snippets. Explain complex logic clearly. WHEN RESPONDING IN THAI: ALWAYS use female polite particles such as "ค่ะ", "นะคะ". Refer to yourself as "มิ้นท์" or "หนู".'
|
|
18
|
-
},
|
|
19
|
-
'researcher': {
|
|
20
|
-
name: 'Mint Researcher',
|
|
21
|
-
icon: '🔍',
|
|
22
|
-
instruction: 'You are Mint Researcher, an academic and analytical female assistant. Focus on citations, data-driven facts, and objective analysis. Avoid speculation and be highly detailed. WHEN RESPONDING IN THAI: ALWAYS use female polite particles such as "ค่ะ", "นะคะ". Refer to yourself as "มิ้นท์" or "หนู".'
|
|
23
|
-
},
|
|
24
|
-
'creative': {
|
|
25
|
-
name: 'Mint Creative',
|
|
26
|
-
icon: '🎨',
|
|
27
|
-
instruction: 'You are Mint Creative, a storytelling and brainstorming female partner. Use vivid language, poetic descriptions, and think outside the box. Be highly expressive and encouraging. WHEN RESPONDING IN THAI: ALWAYS use female polite particles such as "ค่ะ", "นะคะ". Refer to yourself as "มิ้นท์" or "หนู".'
|
|
28
|
-
},
|
|
29
|
-
'manager': {
|
|
30
|
-
name: 'Mint Manager',
|
|
31
|
-
icon: '💼',
|
|
32
|
-
instruction: 'You are Mint Manager, a productivity and project management female expert. Focus on task lists, deadlines, efficiency, and clear action plans. Be concise and goal-oriented. WHEN RESPONDING IN THAI: ALWAYS use female polite particles such as "ค่ะ", "นะคะ". Refer to yourself as "มิ้นท์" or "หนู".'
|
|
33
|
-
},
|
|
34
|
-
'reviewer': {
|
|
35
|
-
name: 'Mint Reviewer',
|
|
36
|
-
icon: '⚖️',
|
|
37
|
-
instruction: 'You are Mint Reviewer, a senior female code critic. Your job is to find flaws, security vulnerabilities, performance bottlenecks, and logic errors in any provided content. Be brutal but constructive. Use a formal, objective tone. WHEN RESPONDING IN THAI: ALWAYS use female polite particles such as "ค่ะ", "นะคะ". Refer to yourself as "มิ้นท์" or "หนู".'
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
let currentAgentType = 'general';
|
|
42
|
-
|
|
43
|
-
function getAgent(type) {
|
|
44
|
-
return AGENT_PERSONAS[type] || AGENT_PERSONAS['general'];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function setAgent(type) {
|
|
48
|
-
if (AGENT_PERSONAS[type]) {
|
|
49
|
-
currentAgentType = type;
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function getCurrentAgent() {
|
|
56
|
-
return getAgent(currentAgentType);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function listAgents() {
|
|
60
|
-
return Object.keys(AGENT_PERSONAS);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function resetAgent() {
|
|
64
|
-
currentAgentType = 'general';
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
module.exports = {
|
|
68
|
-
getAgent,
|
|
69
|
-
setAgent,
|
|
70
|
-
getCurrentAgent,
|
|
71
|
-
listAgents,
|
|
72
|
-
resetAgent
|
|
73
|
-
};
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
const { readConfig } = require('../System/config_manager');
|
|
2
|
-
const { performWebAutomation } = require('../Automation_Layer/browser_automation');
|
|
3
|
-
const { createFolder, deleteFile } = require('../Automation_Layer/file_operations');
|
|
4
|
-
const { searchKnowledge } = require('./knowledge_base');
|
|
5
|
-
const safetyManager = require('../System/safety_manager');
|
|
6
|
-
const providerAdapter = require('./provider_adapter');
|
|
7
|
-
const taskManager = require('../System/task_manager');
|
|
8
|
-
const fs = require('fs');
|
|
9
|
-
const path = require('path');
|
|
10
|
-
|
|
11
|
-
const os = require('os');
|
|
12
|
-
const { sendNotification } = require('../System/notifications');
|
|
13
|
-
|
|
14
|
-
function expandHome(filePath) {
|
|
15
|
-
if (filePath.startsWith('~/')) {
|
|
16
|
-
return path.join(os.homedir(), filePath.slice(2));
|
|
17
|
-
}
|
|
18
|
-
return filePath;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const AUTONOMOUS_SYSTEM_PROMPT = `You are the "Mint Autonomous Brain". Your goal is to fulfill complex tasks by breaking them down into steps.
|
|
22
|
-
You operate in a ReAct loop: Thought -> Action -> Observation -> Thought...
|
|
23
|
-
|
|
24
|
-
CRITICAL INSTRUCTIONS:
|
|
25
|
-
1. Respond ONLY with valid JSON. NO MARKDOWN.
|
|
26
|
-
2. For BASH/Terminal commands: Use the "propose_bash" action. You are NOT allowed to run them yourself.
|
|
27
|
-
3. For Web tasks: Use "web_automation".
|
|
28
|
-
4. For File tasks: Use "create_folder", "write_file", "delete_file".
|
|
29
|
-
5. For Knowledge: Use "knowledge_search".
|
|
30
|
-
|
|
31
|
-
JSON Structure:
|
|
32
|
-
{
|
|
33
|
-
"thought": "Your reasoning about the current state and what to do next.",
|
|
34
|
-
"action": "web_automation" | "create_folder" | "write_file" | "delete_file" | "knowledge_search" | "propose_bash" | "done",
|
|
35
|
-
"target": "The input for the action (URL/Path/Query/Filename/Command/Final Result)",
|
|
36
|
-
"data": "Optional extra data (e.g., content for write_file)"
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
TOOL DETAILS:
|
|
40
|
-
- "web_automation": Use for any task requiring a browser. Target is the natural language instruction for the browser.
|
|
41
|
-
- "create_folder": Target is the folder name/path.
|
|
42
|
-
- "write_file": Target is the file path. Data is the content. Prefer using "~/Desktop" or "~/Documents" for home-relative paths.
|
|
43
|
-
- "delete_file": Target is the file path. (User will be notified).
|
|
44
|
-
- "knowledge_search": Target is the query for the local RAG.
|
|
45
|
-
- "propose_bash": Target is the bash command to show to the user. ALWAYS use SINGLE QUOTES (') for strings containing special characters like "!" to avoid Bash history expansion errors (e.g., use 'Pop!_OS' instead of "Pop!_OS").
|
|
46
|
-
- "done": Target is the final summary of what was accomplished.
|
|
47
|
-
`;
|
|
48
|
-
|
|
49
|
-
async function executeAutonomousTask(taskDescription, notifyCallback, options = {}) {
|
|
50
|
-
const config = readConfig();
|
|
51
|
-
const providerOrder = providerAdapter.getProviderAttemptOrder(config, {
|
|
52
|
-
supported: ['gemini', 'anthropic', 'openai', 'local_openai'],
|
|
53
|
-
priority: ['anthropic', 'openai', 'gemini', 'local_openai']
|
|
54
|
-
});
|
|
55
|
-
const client = new providerAdapter.AgentProviderClient({
|
|
56
|
-
provider: providerOrder[0],
|
|
57
|
-
providerOrder,
|
|
58
|
-
config,
|
|
59
|
-
systemInstruction: AUTONOMOUS_SYSTEM_PROMPT,
|
|
60
|
-
responseMimeType: 'application/json',
|
|
61
|
-
maxTokens: 4096
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
let currentObservation = `Task: ${taskDescription}\nWhat is your first step?`;
|
|
65
|
-
let maxSteps = Number.isFinite(options.maxSteps) ? options.maxSteps : 10;
|
|
66
|
-
let step = 0;
|
|
67
|
-
let result = null;
|
|
68
|
-
|
|
69
|
-
while (step < maxSteps) {
|
|
70
|
-
step++;
|
|
71
|
-
if (notifyCallback) notifyCallback(`Step ${step}: Thinking...`);
|
|
72
|
-
|
|
73
|
-
try {
|
|
74
|
-
const text = await client.sendMessage(currentObservation);
|
|
75
|
-
const actionObj = JSON.parse(text);
|
|
76
|
-
|
|
77
|
-
console.log(`[Brain] Thought: ${actionObj.thought}`);
|
|
78
|
-
console.log(`[Brain] Action: ${actionObj.action} -> ${actionObj.target}`);
|
|
79
|
-
if (options.taskId) {
|
|
80
|
-
taskManager.addCheckpoint(options.taskId, {
|
|
81
|
-
phase: 'autonomous_step',
|
|
82
|
-
step,
|
|
83
|
-
thought: actionObj.thought,
|
|
84
|
-
action: actionObj.action,
|
|
85
|
-
target: actionObj.target
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (actionObj.action === 'done') {
|
|
90
|
-
result = actionObj.target;
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Execute the action
|
|
95
|
-
let observation = "";
|
|
96
|
-
switch (actionObj.action) {
|
|
97
|
-
case 'web_automation':
|
|
98
|
-
if (notifyCallback) notifyCallback(`🌐 มิ้นท์กำลังเข้าเว็บเพื่อ ${actionObj.target}...`);
|
|
99
|
-
observation = await performWebAutomation(actionObj.target);
|
|
100
|
-
break;
|
|
101
|
-
case 'create_folder':
|
|
102
|
-
const folderPath = expandHome(actionObj.target);
|
|
103
|
-
if (notifyCallback) notifyCallback(`📁 กำลังสร้างโฟลเดอร์: ${actionObj.target}`);
|
|
104
|
-
const resFolder = createFolder(folderPath);
|
|
105
|
-
observation = resFolder.success ? `Folder created at ${resFolder.path}` : `Failed: ${resFolder.message}`;
|
|
106
|
-
break;
|
|
107
|
-
case 'write_file':
|
|
108
|
-
const filePath = expandHome(actionObj.target);
|
|
109
|
-
safetyManager.assertPathCapability(filePath, 'write');
|
|
110
|
-
if (notifyCallback) notifyCallback(`✍️ กำลังบันทึกไฟล์: ${actionObj.target}`);
|
|
111
|
-
try {
|
|
112
|
-
safetyManager.appendActionLog({
|
|
113
|
-
source: 'autonomous_brain',
|
|
114
|
-
action: 'write_file',
|
|
115
|
-
target: filePath,
|
|
116
|
-
tier: safetyManager.TIERS.APPROVAL,
|
|
117
|
-
approved: true
|
|
118
|
-
});
|
|
119
|
-
fs.writeFileSync(filePath, actionObj.data || '');
|
|
120
|
-
if (options.taskId) {
|
|
121
|
-
taskManager.addArtifact(options.taskId, {
|
|
122
|
-
type: 'file',
|
|
123
|
-
path: filePath,
|
|
124
|
-
description: `Written by autonomous task step ${step}`
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
observation = `File written successfully to ${actionObj.target}`;
|
|
128
|
-
} catch (e) {
|
|
129
|
-
observation = `Failed to write file: ${e.message}`;
|
|
130
|
-
}
|
|
131
|
-
break;
|
|
132
|
-
case 'delete_file':
|
|
133
|
-
const delPath = expandHome(actionObj.target);
|
|
134
|
-
safetyManager.assertActionAllowed({ type: 'delete_file', target: delPath });
|
|
135
|
-
safetyManager.assertPathCapability(delPath, 'write');
|
|
136
|
-
if (notifyCallback) notifyCallback(`🗑️ มิ้นท์ขอย้ายไฟล์ไปที่ถังขยะ: ${actionObj.target}`);
|
|
137
|
-
const resDel = await deleteFile(delPath);
|
|
138
|
-
observation = resDel.success ? "File moved to trash." : `Failed: ${resDel.message}`;
|
|
139
|
-
break;
|
|
140
|
-
case 'knowledge_search':
|
|
141
|
-
if (notifyCallback) notifyCallback(`🔍 กำลังหาข้อมูลในเครื่อง: ${actionObj.target}`);
|
|
142
|
-
const docs = await searchKnowledge(actionObj.target);
|
|
143
|
-
observation = (docs && docs.length > 0) ? `Found: ${docs.map(d => d.text).join('\n')}` : "No information found in local knowledge base.";
|
|
144
|
-
break;
|
|
145
|
-
case 'propose_bash':
|
|
146
|
-
if (notifyCallback) notifyCallback(`💡 มิ้นท์เสนอให้รันคำสั่ง: ${actionObj.target}`);
|
|
147
|
-
sendNotification('Mint Bash Proposal', `Mint wants to run: ${actionObj.target}`);
|
|
148
|
-
observation = `USER NOTIFIED of bash command: ${actionObj.target}. Note: You must wait for user to run it manually. If you can continue without it, do so. Otherwise, indicate you are waiting or done with this phase.`;
|
|
149
|
-
break;
|
|
150
|
-
default:
|
|
151
|
-
observation = `Unknown action: ${actionObj.action}`;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
currentObservation = `Observation: ${observation}`;
|
|
155
|
-
if (options.taskId) {
|
|
156
|
-
taskManager.addCheckpoint(options.taskId, {
|
|
157
|
-
phase: 'observation',
|
|
158
|
-
step,
|
|
159
|
-
message: observation
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
} catch (err) {
|
|
164
|
-
console.error('[AutonomousBrain] Error during loop:', err);
|
|
165
|
-
currentObservation = `Error occurred: ${err.message}. Please try a different approach or conclude if task is impossible.`;
|
|
166
|
-
if (options.taskId) {
|
|
167
|
-
taskManager.addCheckpoint(options.taskId, {
|
|
168
|
-
phase: 'error',
|
|
169
|
-
step,
|
|
170
|
-
message: err.message
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return result || "Task reached maximum steps without a final result.";
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
module.exports = { executeAutonomousTask };
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const os = require('os');
|
|
4
|
-
|
|
5
|
-
// Handle electron dependency safely
|
|
6
|
-
let app;
|
|
7
|
-
try {
|
|
8
|
-
const electron = require('electron');
|
|
9
|
-
app = electron.app;
|
|
10
|
-
} catch (e) {
|
|
11
|
-
app = null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const CONFIG_DIR = path.join(os.homedir(), '.config', 'mint');
|
|
15
|
-
if (!fs.existsSync(CONFIG_DIR)) {
|
|
16
|
-
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const MEMORY_FILE = path.join(CONFIG_DIR, 'behavior_memory.json');
|
|
20
|
-
|
|
21
|
-
// Migration Logic: Move from Electron userData to ~/.config/mint
|
|
22
|
-
if (!fs.existsSync(MEMORY_FILE) && app && app.getPath) {
|
|
23
|
-
const electronPath = path.join(app.getPath('userData'), 'behavior_memory.json');
|
|
24
|
-
if (fs.existsSync(electronPath)) {
|
|
25
|
-
try {
|
|
26
|
-
fs.copyFileSync(electronPath, MEMORY_FILE);
|
|
27
|
-
console.log('[BehaviorMemory] Migrated memory from Electron userData');
|
|
28
|
-
} catch (e) { console.error('[BehaviorMemory] Migration failed:', e); }
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const MAX_CONTEXT_HISTORY = 20; // Keep last 20 context snapshots
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Load memory from disk (or return default empty structure)
|
|
35
|
-
*/
|
|
36
|
-
function loadMemory() {
|
|
37
|
-
try {
|
|
38
|
-
if (fs.existsSync(MEMORY_FILE)) {
|
|
39
|
-
const raw = fs.readFileSync(MEMORY_FILE, 'utf8');
|
|
40
|
-
return JSON.parse(raw);
|
|
41
|
-
}
|
|
42
|
-
} catch (err) {
|
|
43
|
-
console.error('[BehaviorMemory] Failed to read memory file:', err);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Default empty memory structure
|
|
47
|
-
return {
|
|
48
|
-
appFrequency: {}, // { "YouTube": 5, "Google Chrome": 12 }
|
|
49
|
-
contextHistory: [], // Last N context strings
|
|
50
|
-
lastUpdated: null
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Save memory to disk
|
|
56
|
-
*/
|
|
57
|
-
function saveMemory(memory) {
|
|
58
|
-
try {
|
|
59
|
-
fs.writeFileSync(MEMORY_FILE, JSON.stringify(memory, null, 2), 'utf8');
|
|
60
|
-
} catch (err) {
|
|
61
|
-
console.error('[BehaviorMemory] Failed to save memory:', err);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Record a new context observation (called after each proactive scan)
|
|
67
|
-
* @param {string} contextDescription - Short description of what user is doing
|
|
68
|
-
*/
|
|
69
|
-
function recordBehavior(contextDescription) {
|
|
70
|
-
if (!contextDescription || typeof contextDescription !== 'string') return;
|
|
71
|
-
|
|
72
|
-
const memory = loadMemory();
|
|
73
|
-
|
|
74
|
-
// Append to context history (capped at MAX)
|
|
75
|
-
memory.contextHistory.unshift({
|
|
76
|
-
context: contextDescription,
|
|
77
|
-
time: new Date().toISOString(),
|
|
78
|
-
hour: new Date().getHours()
|
|
79
|
-
});
|
|
80
|
-
if (memory.contextHistory.length > MAX_CONTEXT_HISTORY) {
|
|
81
|
-
memory.contextHistory = memory.contextHistory.slice(0, MAX_CONTEXT_HISTORY);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Extract app mentions and bump frequency
|
|
85
|
-
const appKeywords = [
|
|
86
|
-
'YouTube', 'Chrome', 'Firefox', 'VS Code', 'Spotify', 'Terminal',
|
|
87
|
-
'Google', 'Discord', 'Slack', 'Gmail', 'GitHub', 'Figma', 'Notion'
|
|
88
|
-
];
|
|
89
|
-
for (const app of appKeywords) {
|
|
90
|
-
if (contextDescription.toLowerCase().includes(app.toLowerCase())) {
|
|
91
|
-
memory.appFrequency[app] = (memory.appFrequency[app] || 0) + 1;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
memory.lastUpdated = new Date().toISOString();
|
|
96
|
-
saveMemory(memory);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Get a summary of behavior patterns for the Gemini prompt
|
|
101
|
-
* @returns {string} A human-readable behavior summary
|
|
102
|
-
*/
|
|
103
|
-
function getBehaviorSummary() {
|
|
104
|
-
const memory = loadMemory();
|
|
105
|
-
|
|
106
|
-
const parts = [];
|
|
107
|
-
|
|
108
|
-
// Top apps by frequency
|
|
109
|
-
const topApps = Object.entries(memory.appFrequency)
|
|
110
|
-
.sort((a, b) => b[1] - a[1])
|
|
111
|
-
.slice(0, 5)
|
|
112
|
-
.map(([app, count]) => `${app} (${count}x)`);
|
|
113
|
-
|
|
114
|
-
if (topApps.length > 0) {
|
|
115
|
-
parts.push(`Apps user frequently uses: ${topApps.join(', ')}`);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Recent contexts (last 3)
|
|
119
|
-
const recentCtx = memory.contextHistory.slice(0, 3).map(c => c.context);
|
|
120
|
-
if (recentCtx.length > 0) {
|
|
121
|
-
parts.push(`Recent activities: ${recentCtx.join(' | ')}`);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Time of day
|
|
125
|
-
const hour = new Date().getHours();
|
|
126
|
-
let timeOfDay = 'morning';
|
|
127
|
-
if (hour >= 12 && hour < 17) timeOfDay = 'afternoon';
|
|
128
|
-
else if (hour >= 17 && hour < 21) timeOfDay = 'evening';
|
|
129
|
-
else if (hour >= 21 || hour < 5) timeOfDay = 'night';
|
|
130
|
-
parts.push(`Current time of day: ${timeOfDay}`);
|
|
131
|
-
|
|
132
|
-
return parts.join('. ');
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
module.exports = { recordBehavior, getBehaviorSummary };
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mint Headless Agent
|
|
3
|
-
* Runs Mint's background features (like Proactive Suggestions) without a GUI.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const { exec } = require('child_process');
|
|
7
|
-
const { getSystemInfo } = require('../System/system_info');
|
|
8
|
-
const { readConfig } = require('../System/config_manager');
|
|
9
|
-
const systemEvents = require('../System/system_events');
|
|
10
|
-
const taskManager = require('../System/task_manager');
|
|
11
|
-
const { executeAutonomousTask } = require('./autonomous_brain');
|
|
12
|
-
|
|
13
|
-
// ANSI Colors for console
|
|
14
|
-
const colors = {
|
|
15
|
-
reset: "\x1b[0m",
|
|
16
|
-
bright: "\x1b[1m",
|
|
17
|
-
mint: "\x1b[38;5;121m",
|
|
18
|
-
gray: "\x1b[90m"
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
let isProcessingTask = false;
|
|
22
|
-
|
|
23
|
-
async function startAgent() {
|
|
24
|
-
console.log(`\n${colors.mint}${colors.bright}[Mint-Agent] Background agent started.${colors.reset}`);
|
|
25
|
-
console.log(`${colors.gray}[Mint-Agent] Monitoring system events and task queue...${colors.reset}\n`);
|
|
26
|
-
const resumed = taskManager.resumeRunningTasks();
|
|
27
|
-
if (resumed.length > 0) {
|
|
28
|
-
console.log(`${colors.gray}[Mint-Agent] Re-queued ${resumed.length} interrupted task(s).${colors.reset}`);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Initialize System Monitoring
|
|
32
|
-
systemEvents.startMonitoring();
|
|
33
|
-
|
|
34
|
-
// Initialize Messaging Bridges
|
|
35
|
-
const bridgeManager = require('../System/bridge_manager');
|
|
36
|
-
bridgeManager.init().catch(err => console.error('[BridgeManager] Init Error:', err));
|
|
37
|
-
|
|
38
|
-
// Listen for Battery Events
|
|
39
|
-
systemEvents.on('low-battery', (level) => {
|
|
40
|
-
sendNotification(
|
|
41
|
-
"⚠️ แบตเตอรี่ใกล้หมดแล้วนะคะ",
|
|
42
|
-
`ตอนนี้แบตเตอรี่เหลือ ${level}% แล้วค่ะ อย่าลืมชาร์จแบตนะค๊า ✨`
|
|
43
|
-
);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
// Listen for Network Events
|
|
47
|
-
systemEvents.on('connection-change', (isOnline) => {
|
|
48
|
-
const title = isOnline ? "✅ เชื่อมต่อสำเร็จ" : "❌ การเชื่อมต่อขาดหาย";
|
|
49
|
-
const msg = isOnline ? "มิ้นท์เชื่อมต่ออินเทอร์เน็ตได้แล้วค่ะ! ✨" : "มิ้นท์ไม่เห็นสัญญาณอินเทอร์เน็ตเลยนะคะ";
|
|
50
|
-
sendNotification(title, msg);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// Send a startup notification to let the user know the agent is alive
|
|
54
|
-
sendNotification("Mint Agent", "มิ้นท์ประจำการอยู่เบื้องหลังแล้วนะค๊า! 🛡️✨");
|
|
55
|
-
|
|
56
|
-
// Polling Loop for Tasks and Health
|
|
57
|
-
setInterval(async () => {
|
|
58
|
-
await checkTaskQueue();
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
const info = await getSystemInfo();
|
|
62
|
-
// Heartbeat logic
|
|
63
|
-
} catch (err) {}
|
|
64
|
-
}, 15000); // Check every 15 seconds
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
async function checkTaskQueue() {
|
|
68
|
-
if (isProcessingTask) return;
|
|
69
|
-
|
|
70
|
-
const task = taskManager.getPendingTask();
|
|
71
|
-
if (!task) return;
|
|
72
|
-
|
|
73
|
-
isProcessingTask = true;
|
|
74
|
-
console.log(`\n${colors.mint}[Agent] Picking up task: ${task.description}${colors.reset}`);
|
|
75
|
-
|
|
76
|
-
taskManager.updateTask(task.id, { status: 'running' });
|
|
77
|
-
taskManager.addCheckpoint(task.id, {
|
|
78
|
-
phase: 'started',
|
|
79
|
-
message: task.description
|
|
80
|
-
});
|
|
81
|
-
sendNotification("🚀 เริ่มทำงานให้แล้วนะคะ", `กำลังดำเนินการ: ${task.description}`);
|
|
82
|
-
|
|
83
|
-
try {
|
|
84
|
-
const result = await executeAutonomousTask(task.description, (progress) => {
|
|
85
|
-
console.log(`${colors.gray}[Progress] ${progress}${colors.reset}`);
|
|
86
|
-
taskManager.addCheckpoint(task.id, {
|
|
87
|
-
phase: 'progress',
|
|
88
|
-
message: progress
|
|
89
|
-
});
|
|
90
|
-
// Send periodic progress notifications if important
|
|
91
|
-
if (progress.includes('เสนอให้รันคำสั่ง')) {
|
|
92
|
-
sendNotification("💡 มิ้นท์มีข้อแนะนำค่ะ", progress);
|
|
93
|
-
}
|
|
94
|
-
}, { taskId: task.id });
|
|
95
|
-
|
|
96
|
-
taskManager.addArtifact(task.id, {
|
|
97
|
-
type: 'final_result',
|
|
98
|
-
content: result
|
|
99
|
-
});
|
|
100
|
-
taskManager.updateTask(task.id, { status: 'completed', result });
|
|
101
|
-
sendNotification("✅ งานเสร็จเรียบร้อยแล้วค่ะ!", result);
|
|
102
|
-
console.log(`\n${colors.mint}[Agent] Task completed successfully.${colors.reset}`);
|
|
103
|
-
|
|
104
|
-
} catch (err) {
|
|
105
|
-
console.error('[Agent] Task execution failed:', err);
|
|
106
|
-
const next = taskManager.failTaskWithRetry(task.id, err.message);
|
|
107
|
-
sendNotification("❌ เกิดข้อผิดพลาดในการทำงาน", err.message);
|
|
108
|
-
if (next && next.status === 'pending') {
|
|
109
|
-
console.log(`${colors.gray}[Agent] Task scheduled for retry (${next.retryCount}/${next.maxRetries}).${colors.reset}`);
|
|
110
|
-
}
|
|
111
|
-
} finally {
|
|
112
|
-
isProcessingTask = false;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Sends a system-level notification using notify-send (Linux Pop!_OS)
|
|
118
|
-
*/
|
|
119
|
-
async function sendNotification(title, message) {
|
|
120
|
-
// Check if notify-send exists before trying to use it
|
|
121
|
-
const hasNotifySend = await new Promise(resolve => {
|
|
122
|
-
exec('which notify-send', (err) => resolve(!err));
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
if (!hasNotifySend) {
|
|
126
|
-
console.log(`${colors.gray}[Agent Info]${colors.reset} Notification suppressed (notify-send not found). Install with: sudo apt install libnotify-bin`);
|
|
127
|
-
console.log(`${colors.mint}[Agent Noti]${colors.reset} ${title}: ${message}`);
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const iconPath = require('path').join(__dirname, '../../assets/icon.png');
|
|
132
|
-
const cmd = `notify-send "${title}" "${message}" -i "${iconPath}" -a "Mint AI"`;
|
|
133
|
-
|
|
134
|
-
exec(cmd, (err) => {
|
|
135
|
-
if (err) {
|
|
136
|
-
console.error('[Mint-Agent] Failed to send notification:', err.message);
|
|
137
|
-
} else {
|
|
138
|
-
console.log(`${colors.mint}[Agent Noti]${colors.reset} ${title}: ${message}`);
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
module.exports = { startAgent };
|