@pheem49/mint 1.5.1 → 1.5.3
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/GUIDE_TH.md +7 -7
- package/README.md +140 -66
- package/assets/Agent_Mint.png +0 -0
- package/assets/Settings.png +0 -0
- package/main.js +12 -0
- package/mint-cli.js +148 -921
- package/models/Shiroko_Model/Shiroko/Shiroko_Core//345/221/206/347/214/253.exp3.json +31 -1
- package/models/Shiroko_Model/Shiroko/Shiroko_Core//347/202/271/344/270/200/344/270/213.exp3.json +6 -1
- package/package.json +20 -21
- package/preload.js +2 -0
- package/scripts/install_linux_desktop_entry.js +48 -0
- package/src/AI_Brain/Gemini_API.js +194 -491
- package/src/AI_Brain/autonomous_brain.js +46 -19
- package/src/AI_Brain/headless_agent.js +21 -2
- package/src/AI_Brain/proactive_engine.js +12 -2
- package/src/AI_Brain/provider_adapter.js +358 -0
- package/src/Automation_Layer/browser_automation.js +26 -24
- package/src/CLI/approval_handler.js +47 -0
- package/src/CLI/chat_router.js +7 -0
- package/src/CLI/chat_ui.js +586 -80
- package/src/CLI/cli_colors.js +115 -0
- package/src/CLI/cli_formatters.js +94 -0
- package/src/CLI/code_agent.js +825 -283
- package/src/CLI/intent_detectors.js +181 -0
- package/src/CLI/interactive_chat.js +641 -0
- package/src/CLI/list_features.js +3 -0
- package/src/CLI/repo_summarizer.js +282 -0
- package/src/CLI/semantic_code_search.js +312 -0
- package/src/CLI/skill_manager.js +41 -0
- package/src/CLI/slash_command_handler.js +418 -0
- package/src/CLI/symbol_indexer.js +231 -0
- package/src/CLI/updater.js +21 -1
- package/src/Channels/discord_bridge.js +11 -13
- package/src/Channels/line_bridge.js +10 -10
- package/src/Channels/slack_bridge.js +7 -12
- package/src/Channels/telegram_bridge.js +6 -14
- package/src/Channels/whatsapp_bridge.js +11 -9
- package/src/System/chat_history_manager.js +20 -12
- package/src/System/config_manager.js +4 -1
- package/src/System/ipc_handlers.js +10 -0
- package/src/System/optional_require.js +23 -0
- package/src/System/picture_store.js +109 -0
- package/src/System/task_manager.js +127 -0
- package/src/System/tool_registry.js +13 -0
- package/src/System/window_manager.js +16 -8
- package/src/UI/live2d_manager.js +246 -14
- package/src/UI/renderer.js +620 -45
- package/src/UI/settings.css +738 -439
- package/src/UI/settings.html +487 -432
- package/src/UI/settings.js +44 -10
- package/src/UI/styles.css +1403 -106
- package/privacy.txt +0 -1
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Repository Summary
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns true when the user's plain-language input is asking for a repo summary.
|
|
9
|
+
* @param {string} text
|
|
10
|
+
* @returns {boolean}
|
|
11
|
+
*/
|
|
12
|
+
function isRepoSummaryRequest(text) {
|
|
13
|
+
const input = (text || '').trim().toLowerCase();
|
|
14
|
+
if (!input) return false;
|
|
15
|
+
|
|
16
|
+
const hasRepoTarget = /\b(repo|repository|project|workspace|codebase)\b|รีโป|โปรเจค|โปรเจ็กต์|โปรเจกต์|โปรเจ็ค/.test(input);
|
|
17
|
+
const asksSummary = /\b(summarize|summary|overview)\b|สรุป|ภาพรวม/.test(input);
|
|
18
|
+
const asksQuestion = /\b(have|has|มีไหม|มีมั้ย|มีหรือเปล่า)\b/.test(input);
|
|
19
|
+
|
|
20
|
+
return hasRepoTarget && asksSummary && !asksQuestion;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Parses raw CLI args for the summarize tool.
|
|
25
|
+
* @param {string} rawArgs
|
|
26
|
+
* @returns {{ targetPath: string, json: boolean }}
|
|
27
|
+
*/
|
|
28
|
+
function parseRepoSummaryArgs(rawArgs) {
|
|
29
|
+
const args = (rawArgs || '').split(/\s+/).filter(Boolean);
|
|
30
|
+
const json = args.includes('--json');
|
|
31
|
+
const pathArgs = args.filter(arg => arg !== '--json');
|
|
32
|
+
return {
|
|
33
|
+
targetPath: pathArgs.length > 0 ? pathArgs.join(' ') : process.cwd(),
|
|
34
|
+
json
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
// Symbol Index
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Returns true when the user's input is asking for a symbol index.
|
|
44
|
+
* @param {string} text
|
|
45
|
+
* @returns {boolean}
|
|
46
|
+
*/
|
|
47
|
+
function isSymbolIndexRequest(text) {
|
|
48
|
+
const input = (text || '').trim().toLowerCase();
|
|
49
|
+
if (!input) return false;
|
|
50
|
+
|
|
51
|
+
const hasSymbolTarget = /\b(symbol|symbols|ast|lsp)\b|ซิมโบล|สัญลักษณ์/.test(input);
|
|
52
|
+
const asksIndex = /\b(index|list|show|build|scan|overview)\b|ทำ|สร้าง|แสดง|ลิสต์|สแกน/.test(input);
|
|
53
|
+
const referencesWorkspace = /\b(repo|repository|project|workspace|codebase|source|code)\b|รีโป|โปรเจค|โปรเจ็กต์|โปรเจกต์|โค้ด/.test(input);
|
|
54
|
+
const asksQuestion = /\b(do i|have|has)\b|มีไหม|มีมั้ย|มีหรือเปล่า/.test(input);
|
|
55
|
+
|
|
56
|
+
return hasSymbolTarget && (asksIndex || referencesWorkspace) && !asksQuestion;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Parses raw CLI args for the symbol index tool.
|
|
61
|
+
* @param {string} rawArgs
|
|
62
|
+
* @returns {{ targetPath: string, json: boolean, limit: number }}
|
|
63
|
+
*/
|
|
64
|
+
function parseSymbolIndexArgs(rawArgs) {
|
|
65
|
+
const args = (rawArgs || '').split(/\s+/).filter(Boolean);
|
|
66
|
+
const json = args.includes('--json');
|
|
67
|
+
let limit = 80;
|
|
68
|
+
const pathArgs = [];
|
|
69
|
+
|
|
70
|
+
for (let i = 0; i < args.length; i++) {
|
|
71
|
+
const arg = args[i];
|
|
72
|
+
if (arg === '--json') continue;
|
|
73
|
+
if (arg === '--limit') {
|
|
74
|
+
const next = Number(args[i + 1]);
|
|
75
|
+
if (Number.isFinite(next) && next >= 0) { limit = next; i++; }
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (arg.startsWith('--limit=')) {
|
|
79
|
+
const next = Number(arg.slice('--limit='.length));
|
|
80
|
+
if (Number.isFinite(next) && next >= 0) limit = next;
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
pathArgs.push(arg);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
targetPath: pathArgs.length > 0 ? pathArgs.join(' ') : process.cwd(),
|
|
88
|
+
json,
|
|
89
|
+
limit
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ---------------------------------------------------------------------------
|
|
94
|
+
// Semantic Code Search
|
|
95
|
+
// ---------------------------------------------------------------------------
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Returns true when the user's input is asking for a semantic code search.
|
|
99
|
+
* @param {string} text
|
|
100
|
+
* @returns {boolean}
|
|
101
|
+
*/
|
|
102
|
+
function isSemanticCodeSearchRequest(text) {
|
|
103
|
+
const input = (text || '').trim().toLowerCase();
|
|
104
|
+
if (!input) return false;
|
|
105
|
+
|
|
106
|
+
const hasSemanticSearch = /\bsemantic\b/.test(input) && /\b(search|find|look for)\b/.test(input);
|
|
107
|
+
const referencesCode = /\b(code|repo|repository|project|workspace|codebase|source)\b|โค้ด|รีโป|โปรเจค|โปรเจ็กต์|โปรเจกต์/.test(input);
|
|
108
|
+
const thaiSemanticSearch = /ค้นหา/.test(input) && /ความหมาย|semantic/.test(input) && /โค้ด|โปรเจค|รีโป/.test(input);
|
|
109
|
+
const asksQuestion = /\b(do i|have|has)\b|มีไหม|มีมั้ย|มีหรือเปล่า/.test(input);
|
|
110
|
+
|
|
111
|
+
return (hasSemanticSearch && referencesCode || thaiSemanticSearch) && !asksQuestion;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Parses raw CLI args for the semantic code search tool.
|
|
116
|
+
* @param {string} rawArgs
|
|
117
|
+
* @returns {{ mode: string, query: string, targetPath: string, json: boolean, topK: number }}
|
|
118
|
+
*/
|
|
119
|
+
function parseSemanticCodeArgs(rawArgs) {
|
|
120
|
+
const args = (rawArgs || '').split(/\s+/).filter(Boolean);
|
|
121
|
+
const json = args.includes('--json');
|
|
122
|
+
let topK = 5;
|
|
123
|
+
const pathArgs = [];
|
|
124
|
+
const queryArgs = [];
|
|
125
|
+
let mode = 'search';
|
|
126
|
+
|
|
127
|
+
for (let i = 0; i < args.length; i++) {
|
|
128
|
+
const arg = args[i];
|
|
129
|
+
if (arg === 'index' || arg === 'search') { mode = arg; continue; }
|
|
130
|
+
if (arg === '--json') continue;
|
|
131
|
+
if (arg === '--top-k' || arg === '--limit') {
|
|
132
|
+
const next = Number(args[i + 1]);
|
|
133
|
+
if (Number.isFinite(next) && next > 0) { topK = next; i++; }
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (arg.startsWith('--top-k=') || arg.startsWith('--limit=')) {
|
|
137
|
+
const next = Number(arg.slice(arg.indexOf('=') + 1));
|
|
138
|
+
if (Number.isFinite(next) && next > 0) topK = next;
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (arg === '--path') {
|
|
142
|
+
if (args[i + 1]) { pathArgs.push(args[i + 1]); i++; }
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
queryArgs.push(arg);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return {
|
|
149
|
+
mode,
|
|
150
|
+
query: queryArgs.join(' ').trim(),
|
|
151
|
+
targetPath: pathArgs.length > 0 ? pathArgs.join(' ') : process.cwd(),
|
|
152
|
+
json,
|
|
153
|
+
topK
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Strips intent phrases from text to extract the raw search query.
|
|
159
|
+
* @param {string} text
|
|
160
|
+
* @returns {string}
|
|
161
|
+
*/
|
|
162
|
+
function extractSemanticCodeQuery(text) {
|
|
163
|
+
return String(text || '')
|
|
164
|
+
.replace(/semantic\s+code\s+search/ig, '')
|
|
165
|
+
.replace(/semantic\s+search/ig, '')
|
|
166
|
+
.replace(/search\s+code/ig, '')
|
|
167
|
+
.replace(/ค้นหาโค้ดแบบความหมาย/g, '')
|
|
168
|
+
.replace(/ค้นหาแบบ semantic/g, '')
|
|
169
|
+
.replace(/ใน repo นี้|ในโปรเจคนี้|ในรีโปนี้/g, '')
|
|
170
|
+
.trim();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
module.exports = {
|
|
174
|
+
isRepoSummaryRequest,
|
|
175
|
+
parseRepoSummaryArgs,
|
|
176
|
+
isSymbolIndexRequest,
|
|
177
|
+
parseSymbolIndexArgs,
|
|
178
|
+
isSemanticCodeSearchRequest,
|
|
179
|
+
parseSemanticCodeArgs,
|
|
180
|
+
extractSemanticCodeQuery
|
|
181
|
+
};
|