@pheem49/mint 1.2.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 (69) hide show
  1. package/BUILD_AND_RELEASE.md +75 -0
  2. package/LICENSE +654 -0
  3. package/README.md +165 -0
  4. package/assets/Agent_Mint.png +0 -0
  5. package/assets/CLI_Screen.png +0 -0
  6. package/assets/Settings.png +0 -0
  7. package/assets/icon.png +0 -0
  8. package/benchmark_ai.js +71 -0
  9. package/main.js +968 -0
  10. package/mint-cli-logic.js +71 -0
  11. package/mint-cli.js +239 -0
  12. package/package.json +60 -0
  13. package/preload-picker.js +11 -0
  14. package/preload-settings.js +11 -0
  15. package/preload.js +37 -0
  16. package/privacy.txt +1 -0
  17. package/src/AI_Brain/Gemini_API.js +419 -0
  18. package/src/AI_Brain/autonomous_brain.js +139 -0
  19. package/src/AI_Brain/behavior_memory.js +114 -0
  20. package/src/AI_Brain/headless_agent.js +120 -0
  21. package/src/AI_Brain/knowledge_base.js +222 -0
  22. package/src/AI_Brain/proactive_engine.js +168 -0
  23. package/src/Automation_Layer/browser_automation.js +147 -0
  24. package/src/Automation_Layer/file_operations.js +80 -0
  25. package/src/Automation_Layer/open_app.js +56 -0
  26. package/src/Automation_Layer/open_website.js +38 -0
  27. package/src/CLI/chat_ui.js +468 -0
  28. package/src/CLI/list_features.js +56 -0
  29. package/src/CLI/onboarding.js +60 -0
  30. package/src/Command_Parser/parser.js +34 -0
  31. package/src/Plugins/dev_tools.js +41 -0
  32. package/src/Plugins/discord.js +20 -0
  33. package/src/Plugins/docker.js +45 -0
  34. package/src/Plugins/google_calendar.js +26 -0
  35. package/src/Plugins/obsidian.js +54 -0
  36. package/src/Plugins/plugin_manager.js +81 -0
  37. package/src/Plugins/spotify.js +45 -0
  38. package/src/Plugins/system_metrics.js +31 -0
  39. package/src/System/chat_history_manager.js +57 -0
  40. package/src/System/config_manager.js +73 -0
  41. package/src/System/custom_workflows.js +127 -0
  42. package/src/System/daemon_manager.js +67 -0
  43. package/src/System/system_automation.js +88 -0
  44. package/src/System/system_events.js +79 -0
  45. package/src/System/system_info.js +55 -0
  46. package/src/System/task_manager.js +85 -0
  47. package/src/UI/floating.css +80 -0
  48. package/src/UI/floating.html +17 -0
  49. package/src/UI/floating.js +67 -0
  50. package/src/UI/index.html +126 -0
  51. package/src/UI/preload-floating.js +7 -0
  52. package/src/UI/preload-spotlight.js +10 -0
  53. package/src/UI/preload-widget.js +5 -0
  54. package/src/UI/proactive-glow.html +42 -0
  55. package/src/UI/renderer.js +978 -0
  56. package/src/UI/screenPicker.html +214 -0
  57. package/src/UI/screenPicker.js +262 -0
  58. package/src/UI/settings.css +705 -0
  59. package/src/UI/settings.html +396 -0
  60. package/src/UI/settings.js +514 -0
  61. package/src/UI/spotlight.css +119 -0
  62. package/src/UI/spotlight.html +23 -0
  63. package/src/UI/spotlight.js +181 -0
  64. package/src/UI/styles.css +627 -0
  65. package/src/UI/widget.css +218 -0
  66. package/src/UI/widget.html +29 -0
  67. package/src/UI/widget.js +10 -0
  68. package/tech_news.txt +3 -0
  69. package/test_knowledge.txt +3 -0
@@ -0,0 +1,181 @@
1
+ const spotlightInput = document.getElementById('spotlight-input');
2
+ const spotlightResultsArr = document.getElementById('spotlight-results');
3
+
4
+ spotlightInput.focus();
5
+
6
+ const COMMANDS = [
7
+ { label: 'Open YouTube', desc: 'เปิดเว็บไซต์ YouTube', icon: '📺', action: { type: 'open_url', target: 'https://youtube.com' } },
8
+ { label: 'Open Facebook', desc: 'เปิดเว็บไซต์ Facebook', icon: '📘', action: { type: 'open_url', target: 'https://facebook.com' } },
9
+ { label: 'Open Instagram', desc: 'เปิดเว็บไซต์ Instagram', icon: '📸', action: { type: 'open_url', target: 'https://instagram.com' } },
10
+ { label: 'Open GitHub', desc: 'เปิดเว็บไซต์ GitHub', icon: '🐙', action: { type: 'open_url', target: 'https://github.com' } },
11
+ { label: 'System Info', desc: 'ดูข้อมูลระบบ', icon: '💻', action: { type: 'chat', query: 'ขอข้อมูลระบบหน่อย' } },
12
+ { label: 'Weather', desc: 'เช็คสภาพอากาศ', icon: '🌤️', action: { type: 'chat', query: 'อากาศที่กรุงเทพเป็นยังไง' } },
13
+ { label: 'Open Spotify', desc: 'เปิดโปรแกรม Spotify', icon: '🎵', action: { type: 'open_app', target: 'spotify' } },
14
+ { label: 'Open VS Code', desc: 'เปิดโปรแกรม VS Code', icon: '💻', action: { type: 'open_app', target: 'code' } },
15
+ ];
16
+
17
+ let selectedIndex = -1;
18
+ let filteredCommands = [];
19
+
20
+ function renderResults(results) {
21
+ filteredCommands = results;
22
+ if (results.length === 0) {
23
+ spotlightResultsArr.style.display = 'none';
24
+ selectedIndex = -1;
25
+ window.spotlightAPI.resize(600, 80);
26
+ return;
27
+ }
28
+
29
+ spotlightResultsArr.style.display = 'block';
30
+ // Calculate new height: 80 (input) + results height (approx 64px per item)
31
+ const newHeight = Math.min(80 + (results.length * 64) + 16, 500);
32
+ window.spotlightAPI.resize(600, newHeight);
33
+
34
+ spotlightResultsArr.innerHTML = results.map((cmd, i) => `
35
+ <div class="result-item ${i === selectedIndex ? 'selected' : ''}" data-index="${i}">
36
+ <div class="result-icon">${cmd.icon}</div>
37
+ <div class="result-content">
38
+ <div class="result-title">${cmd.label}</div>
39
+ <div class="result-desc">${cmd.desc}</div>
40
+ </div>
41
+ </div>
42
+ `).join('');
43
+ }
44
+
45
+ spotlightInput.addEventListener('input', () => {
46
+ const val = spotlightInput.value.toLowerCase().trim();
47
+ if (!val) {
48
+ renderResults([]);
49
+ return;
50
+ }
51
+
52
+ // Simple calculation
53
+ if (/^[0-9+\-*/().\s]+$/.test(val) && /[0-9]/.test(val)) {
54
+ try {
55
+ const result = eval(val);
56
+ renderResults([{
57
+ label: `Result: ${result}`,
58
+ desc: 'Calculation result (Press Enter to copy)',
59
+ icon: '🧮',
60
+ action: { type: 'copy', value: result.toString() }
61
+ }]);
62
+ return;
63
+ } catch {}
64
+ }
65
+
66
+ const matches = COMMANDS.filter(c =>
67
+ c.label.toLowerCase().includes(val) ||
68
+ c.desc.toLowerCase().includes(val)
69
+ );
70
+
71
+ // Add a default "Ask Gemini" option
72
+ matches.push({
73
+ label: `Ask Mint: "${val}"`,
74
+ desc: 'Send query to AI Chat',
75
+ icon: '✨',
76
+ action: { type: 'chat', query: val }
77
+ });
78
+
79
+ renderResults(matches);
80
+ });
81
+
82
+ // Handle mouse clicks on results
83
+ spotlightResultsArr.addEventListener('click', (e) => {
84
+ const item = e.target.closest('.result-item');
85
+ if (item) {
86
+ const index = parseInt(item.getAttribute('data-index'), 10);
87
+ if (index >= 0 && filteredCommands[index]) {
88
+ handleAction(filteredCommands[index].action);
89
+ }
90
+ }
91
+ });
92
+
93
+ spotlightInput.addEventListener('keydown', (e) => {
94
+ if (e.key === 'Escape') {
95
+ window.spotlightAPI.hide();
96
+ }
97
+
98
+ if (e.key === 'ArrowDown') {
99
+ e.preventDefault();
100
+ selectedIndex = Math.min(selectedIndex + 1, filteredCommands.length - 1);
101
+ renderResults(filteredCommands);
102
+ }
103
+
104
+ if (e.key === 'ArrowUp') {
105
+ e.preventDefault();
106
+ selectedIndex = Math.max(selectedIndex - 1, -1);
107
+ renderResults(filteredCommands);
108
+ }
109
+
110
+ if (e.key === 'Enter') {
111
+ if (selectedIndex >= 0 && filteredCommands[selectedIndex]) {
112
+ handleAction(filteredCommands[selectedIndex].action);
113
+ } else {
114
+ const query = spotlightInput.value.trim();
115
+ if (query) {
116
+ window.spotlightAPI.submit(query);
117
+ }
118
+ }
119
+ }
120
+ });
121
+
122
+ function handleAction(action) {
123
+ if (action.type === 'chat') {
124
+ window.spotlightAPI.submit(action.query);
125
+ } else if (action.type === 'open_url') {
126
+ window.spotlightAPI.submit(`เปิดเว็บ ${action.target}`);
127
+ } else if (action.type === 'open_app') {
128
+ window.spotlightAPI.submit(`เปิดโปรแกรม ${action.target}`);
129
+ } else if (action.type === 'copy') {
130
+ // We need a clipboard API in spotlight preload or just send as chat message that triggers copy
131
+ window.spotlightAPI.submit(`copy ${action.value}`);
132
+ }
133
+ }
134
+
135
+ // Auto-focus on show
136
+ window.addEventListener('focus', () => {
137
+ spotlightInput.focus();
138
+ spotlightInput.select();
139
+ });
140
+
141
+ // Sync theme settings
142
+ window.spotlightAPI.onSettingsChanged((config) => {
143
+ if (config.systemTextColor) {
144
+ document.documentElement.style.setProperty('--text-main', config.systemTextColor);
145
+ }
146
+ applyThemeVariables(config);
147
+ });
148
+
149
+ // Load initial settings
150
+ window.spotlightAPI.getSettings().then(config => {
151
+ if (config.systemTextColor) {
152
+ document.documentElement.style.setProperty('--text-main', config.systemTextColor);
153
+ }
154
+ applyThemeVariables(config);
155
+ });
156
+
157
+ function applyThemeVariables(config) {
158
+ document.documentElement.setAttribute('data-theme', config.theme || 'dark');
159
+ if (config.theme === 'custom') {
160
+ if (config.customBgStart && config.customBgEnd) {
161
+ const gradient = `linear-gradient(135deg, ${config.customBgStart} 0%, ${config.customBgEnd} 100%)`;
162
+ document.documentElement.style.setProperty('--bg-gradient', gradient);
163
+ }
164
+ if (config.customPanelBg) {
165
+ const rgb = hexToRgb(config.customPanelBg);
166
+ document.documentElement.style.setProperty('--panel-bg', `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, 0.75)`);
167
+ }
168
+ } else {
169
+ document.documentElement.style.removeProperty('--bg-gradient');
170
+ document.documentElement.style.removeProperty('--panel-bg');
171
+ }
172
+ }
173
+
174
+ function hexToRgb(hex) {
175
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
176
+ return result ? {
177
+ r: parseInt(result[1], 16),
178
+ g: parseInt(result[2], 16),
179
+ b: parseInt(result[3], 16)
180
+ } : { r: 15, g: 23, b: 42 };
181
+ }