@pheem49/mint 1.5.0 → 1.5.2

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 (101) hide show
  1. package/README.md +35 -1
  2. package/main.js +28 -14
  3. package/mint-cli-logic.js +3 -119
  4. package/mint-cli.js +201 -500
  5. package/models/Shiroko_Model/Shiroko/Shiroko_Core/72d86db84cfa9730b894c241fd24c0db.png +0 -0
  6. package/models/Shiroko_Model/Shiroko/Shiroko_Core/items_pinned_to_model.json +14 -0
  7. package/models/Shiroko_Model/Shiroko/Shiroko_Core//345/221/206/347/214/253.exp3.json +40 -0
  8. 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 +15 -0
  9. package/models/Shiroko_Model/Shiroko/Shiroko_Core//345/233/264/350/243/231.exp3.json +10 -0
  10. package/models/Shiroko_Model/Shiroko/Shiroko_Core//346/213/215/347/205/247.exp3.json +50 -0
  11. package/models/Shiroko_Model/Shiroko/Shiroko_Core//346/213/277/347/254/224.exp3.json +10 -0
  12. package/models/Shiroko_Model/Shiroko/Shiroko_Core//347/202/271/344/270/200/344/270/213.exp3.json +15 -0
  13. package/models/Shiroko_Model/Shiroko/Shiroko_Core//347/214/253/345/222/252/346/273/244/351/225/234.exp3.json +10 -0
  14. package/models/Shiroko_Model/Shiroko/Shiroko_Core//347/234/274/351/225/234.exp3.json +10 -0
  15. package/models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.4096/texture_00.png +0 -0
  16. package/models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.4096/texture_01.png +0 -0
  17. package/models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.4096/texture_02.png +0 -0
  18. package/models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.4096/texture_03.png +0 -0
  19. package/models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.cdi3.json +1498 -0
  20. package/models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.moc3 +0 -0
  21. package/models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.model3.json +47 -0
  22. package/models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.physics3.json +6658 -0
  23. package/models/Shiroko_Model/Shiroko/Shiroko_Core//351/235/242/351/245/2740.vtube.json +1299 -0
  24. 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 +23 -0
  25. package/package.json +40 -17
  26. package/src/AI_Brain/Gemini_API.js +147 -46
  27. package/src/AI_Brain/autonomous_brain.js +2 -1
  28. package/src/AI_Brain/memory_store.js +299 -3
  29. package/src/AI_Brain/proactive_engine.js +12 -2
  30. package/src/Automation_Layer/browser_automation.js +26 -24
  31. package/src/CLI/approval_handler.js +42 -0
  32. package/src/CLI/chat_router.js +18 -6
  33. package/src/CLI/chat_ui.js +583 -52
  34. package/src/CLI/cli_colors.js +32 -0
  35. package/src/CLI/cli_formatters.js +89 -0
  36. package/src/CLI/code_agent.js +369 -71
  37. package/src/CLI/image_input.js +90 -0
  38. package/src/CLI/intent_detectors.js +181 -0
  39. package/src/CLI/interactive_chat.js +479 -0
  40. package/src/CLI/list_features.js +3 -0
  41. package/src/CLI/onboarding.js +72 -15
  42. package/src/CLI/repo_summarizer.js +282 -0
  43. package/src/CLI/semantic_code_search.js +312 -0
  44. package/src/CLI/skill_manager.js +41 -0
  45. package/src/CLI/slash_command_handler.js +418 -0
  46. package/src/CLI/symbol_indexer.js +231 -0
  47. package/src/CLI/updater.js +6 -4
  48. package/src/Channels/discord_bridge.js +11 -13
  49. package/src/Channels/line_bridge.js +10 -10
  50. package/src/Channels/slack_bridge.js +7 -12
  51. package/src/Channels/telegram_bridge.js +6 -14
  52. package/src/Channels/whatsapp_bridge.js +11 -9
  53. package/src/System/action_executor.js +59 -10
  54. package/src/System/chat_history_manager.js +20 -12
  55. package/src/System/config_manager.js +31 -1
  56. package/src/System/granular_automation.js +122 -53
  57. package/src/System/optional_require.js +23 -0
  58. package/src/System/proactive_loop.js +19 -3
  59. package/src/System/safety_manager.js +108 -0
  60. package/src/System/sandbox_runner.js +182 -0
  61. package/src/System/system_automation.js +127 -81
  62. package/src/System/system_info.js +70 -0
  63. package/src/System/tool_registry.js +280 -0
  64. package/src/System/window_manager.js +4 -2
  65. package/src/UI/live2d_manager.js +566 -0
  66. package/src/UI/renderer.js +339 -21
  67. package/src/UI/settings.css +655 -420
  68. package/src/UI/settings.html +478 -432
  69. package/src/UI/settings.js +10 -8
  70. package/src/UI/styles.css +516 -31
  71. package/.codex +0 -0
  72. package/docs/assets/Agent_Mint.png +0 -0
  73. package/docs/assets/CLI_Screen.png +0 -0
  74. package/docs/assets/Settings.png +0 -0
  75. package/docs/assets/icon.png +0 -0
  76. package/docs/guide.html +0 -632
  77. package/docs/index.html +0 -133
  78. package/docs/style.css +0 -579
  79. package/index.html +0 -16
  80. package/src/UI/index.html +0 -126
  81. package/tech_news.txt +0 -3
  82. package/test_knowledge.txt +0 -3
  83. package/tests/action_executor_safety.test.js +0 -67
  84. package/tests/agent_orchestrator.test.js +0 -41
  85. package/tests/chat_router.test.js +0 -42
  86. package/tests/code_agent.test.js +0 -69
  87. package/tests/config_manager.test.js +0 -141
  88. package/tests/docker.test.js +0 -46
  89. package/tests/file_operations.test.js +0 -57
  90. package/tests/gmail.test.js +0 -135
  91. package/tests/gmail_auth.test.js +0 -129
  92. package/tests/google_calendar.test.js +0 -113
  93. package/tests/google_tts_urls.test.js +0 -24
  94. package/tests/memory_store.test.js +0 -185
  95. package/tests/notion.test.js +0 -121
  96. package/tests/provider_routing.test.js +0 -83
  97. package/tests/safety_manager.test.js +0 -40
  98. package/tests/spotify.test.js +0 -201
  99. package/tests/system_monitor.test.js +0 -37
  100. package/tests/updater.test.js +0 -32
  101. package/tests/workspace_manager.test.js +0 -56
@@ -0,0 +1,90 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const { execFileSync } = require('child_process');
4
+
5
+ const IMAGE_MIME_TYPES = {
6
+ '.png': 'image/png',
7
+ '.jpg': 'image/jpeg',
8
+ '.jpeg': 'image/jpeg',
9
+ '.webp': 'image/webp',
10
+ '.gif': 'image/gif'
11
+ };
12
+
13
+ function resolveImagePath(imagePath, cwd = process.cwd()) {
14
+ if (!imagePath || typeof imagePath !== 'string') {
15
+ throw new Error('Image path is required.');
16
+ }
17
+
18
+ return path.resolve(cwd, imagePath);
19
+ }
20
+
21
+ function getImageMimeType(imagePath) {
22
+ const ext = path.extname(imagePath).toLowerCase();
23
+ const mimeType = IMAGE_MIME_TYPES[ext];
24
+ if (!mimeType) {
25
+ throw new Error(`Unsupported image type "${ext || '(none)'}". Supported: ${Object.keys(IMAGE_MIME_TYPES).join(', ')}`);
26
+ }
27
+ return mimeType;
28
+ }
29
+
30
+ function loadImageAsDataUri(imagePath, cwd = process.cwd()) {
31
+ const resolved = resolveImagePath(imagePath, cwd);
32
+ if (!fs.existsSync(resolved)) {
33
+ throw new Error(`Image file not found: ${imagePath}`);
34
+ }
35
+
36
+ const stat = fs.statSync(resolved);
37
+ if (!stat.isFile()) {
38
+ throw new Error(`Image path is not a file: ${imagePath}`);
39
+ }
40
+
41
+ const mimeType = getImageMimeType(resolved);
42
+ const data = fs.readFileSync(resolved).toString('base64');
43
+ return {
44
+ path: resolved,
45
+ mimeType,
46
+ dataUri: `data:${mimeType};base64,${data}`
47
+ };
48
+ }
49
+
50
+ function tryReadClipboardCommand(command, args) {
51
+ try {
52
+ return execFileSync(command, args, {
53
+ encoding: 'buffer',
54
+ maxBuffer: 1024 * 1024 * 20,
55
+ stdio: ['ignore', 'pipe', 'ignore']
56
+ });
57
+ } catch (_) {
58
+ return null;
59
+ }
60
+ }
61
+
62
+ function loadClipboardImageAsDataUri() {
63
+ const attempts = [
64
+ { command: 'wl-paste', args: ['--type', 'image/png', '--no-newline'] },
65
+ { command: 'xclip', args: ['-selection', 'clipboard', '-t', 'image/png', '-o'] }
66
+ ];
67
+
68
+ for (const attempt of attempts) {
69
+ const data = tryReadClipboardCommand(attempt.command, attempt.args);
70
+ if (data && data.length > 0) {
71
+ return {
72
+ path: 'clipboard',
73
+ mimeType: 'image/png',
74
+ dataUri: `data:image/png;base64,${data.toString('base64')}`
75
+ };
76
+ }
77
+ }
78
+
79
+ throw new Error('No clipboard image found. On Linux, install wl-clipboard or xclip, then copy an image and try Ctrl+V again.');
80
+ }
81
+
82
+ module.exports = {
83
+ loadImageAsDataUri,
84
+ loadClipboardImageAsDataUri,
85
+ _helpers: {
86
+ getImageMimeType,
87
+ resolveImagePath,
88
+ tryReadClipboardCommand
89
+ }
90
+ };
@@ -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
+ };