@meechi-ai/core 1.0.0

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 (116) hide show
  1. package/LICENSE +624 -0
  2. package/README.md +59 -0
  3. package/dist/components/CalendarView.d.ts +3 -0
  4. package/dist/components/CalendarView.js +72 -0
  5. package/dist/components/ChatInterface.d.ts +6 -0
  6. package/dist/components/ChatInterface.js +105 -0
  7. package/dist/components/FileExplorer.d.ts +9 -0
  8. package/dist/components/FileExplorer.js +757 -0
  9. package/dist/components/Icon.d.ts +9 -0
  10. package/dist/components/Icon.js +44 -0
  11. package/dist/components/SourceEditor.d.ts +13 -0
  12. package/dist/components/SourceEditor.js +50 -0
  13. package/dist/components/ThemeProvider.d.ts +5 -0
  14. package/dist/components/ThemeProvider.js +105 -0
  15. package/dist/components/ThemeSwitcher.d.ts +1 -0
  16. package/dist/components/ThemeSwitcher.js +16 -0
  17. package/dist/components/voice/VoiceInputArea.d.ts +14 -0
  18. package/dist/components/voice/VoiceInputArea.js +190 -0
  19. package/dist/components/voice/VoiceOverlay.d.ts +7 -0
  20. package/dist/components/voice/VoiceOverlay.js +71 -0
  21. package/dist/hooks/useMeechi.d.ts +16 -0
  22. package/dist/hooks/useMeechi.js +461 -0
  23. package/dist/hooks/useSync.d.ts +8 -0
  24. package/dist/hooks/useSync.js +87 -0
  25. package/dist/index.d.ts +14 -0
  26. package/dist/index.js +22 -0
  27. package/dist/lib/ai/embeddings.d.ts +15 -0
  28. package/dist/lib/ai/embeddings.js +128 -0
  29. package/dist/lib/ai/gpu-lock.d.ts +19 -0
  30. package/dist/lib/ai/gpu-lock.js +43 -0
  31. package/dist/lib/ai/llm.worker.d.ts +1 -0
  32. package/dist/lib/ai/llm.worker.js +7 -0
  33. package/dist/lib/ai/local-llm.d.ts +30 -0
  34. package/dist/lib/ai/local-llm.js +211 -0
  35. package/dist/lib/ai/manager.d.ts +20 -0
  36. package/dist/lib/ai/manager.js +51 -0
  37. package/dist/lib/ai/parsing.d.ts +12 -0
  38. package/dist/lib/ai/parsing.js +56 -0
  39. package/dist/lib/ai/prompts.d.ts +2 -0
  40. package/dist/lib/ai/prompts.js +2 -0
  41. package/dist/lib/ai/providers/gemini.d.ts +6 -0
  42. package/dist/lib/ai/providers/gemini.js +88 -0
  43. package/dist/lib/ai/providers/groq.d.ts +6 -0
  44. package/dist/lib/ai/providers/groq.js +42 -0
  45. package/dist/lib/ai/registry.d.ts +29 -0
  46. package/dist/lib/ai/registry.js +52 -0
  47. package/dist/lib/ai/tools.d.ts +2 -0
  48. package/dist/lib/ai/tools.js +106 -0
  49. package/dist/lib/ai/types.d.ts +22 -0
  50. package/dist/lib/ai/types.js +1 -0
  51. package/dist/lib/ai/worker.d.ts +1 -0
  52. package/dist/lib/ai/worker.js +60 -0
  53. package/dist/lib/audio/input.d.ts +13 -0
  54. package/dist/lib/audio/input.js +121 -0
  55. package/dist/lib/audio/stt.d.ts +13 -0
  56. package/dist/lib/audio/stt.js +119 -0
  57. package/dist/lib/audio/tts.d.ts +12 -0
  58. package/dist/lib/audio/tts.js +128 -0
  59. package/dist/lib/audio/vad.d.ts +18 -0
  60. package/dist/lib/audio/vad.js +117 -0
  61. package/dist/lib/colors.d.ts +16 -0
  62. package/dist/lib/colors.js +67 -0
  63. package/dist/lib/extensions.d.ts +35 -0
  64. package/dist/lib/extensions.js +24 -0
  65. package/dist/lib/hooks/use-voice-loop.d.ts +13 -0
  66. package/dist/lib/hooks/use-voice-loop.js +313 -0
  67. package/dist/lib/mcp/McpClient.d.ts +19 -0
  68. package/dist/lib/mcp/McpClient.js +42 -0
  69. package/dist/lib/mcp/McpRegistry.d.ts +47 -0
  70. package/dist/lib/mcp/McpRegistry.js +117 -0
  71. package/dist/lib/mcp/native/GroqVoiceNative.d.ts +21 -0
  72. package/dist/lib/mcp/native/GroqVoiceNative.js +29 -0
  73. package/dist/lib/mcp/native/LocalSyncNative.d.ts +19 -0
  74. package/dist/lib/mcp/native/LocalSyncNative.js +26 -0
  75. package/dist/lib/mcp/native/LocalVoiceNative.d.ts +19 -0
  76. package/dist/lib/mcp/native/LocalVoiceNative.js +27 -0
  77. package/dist/lib/mcp/native/MeechiNativeCore.d.ts +25 -0
  78. package/dist/lib/mcp/native/MeechiNativeCore.js +209 -0
  79. package/dist/lib/mcp/native/index.d.ts +10 -0
  80. package/dist/lib/mcp/native/index.js +10 -0
  81. package/dist/lib/mcp/types.d.ts +35 -0
  82. package/dist/lib/mcp/types.js +1 -0
  83. package/dist/lib/pdf.d.ts +10 -0
  84. package/dist/lib/pdf.js +142 -0
  85. package/dist/lib/settings.d.ts +48 -0
  86. package/dist/lib/settings.js +87 -0
  87. package/dist/lib/storage/db.d.ts +57 -0
  88. package/dist/lib/storage/db.js +45 -0
  89. package/dist/lib/storage/local.d.ts +28 -0
  90. package/dist/lib/storage/local.js +534 -0
  91. package/dist/lib/storage/migrate.d.ts +3 -0
  92. package/dist/lib/storage/migrate.js +122 -0
  93. package/dist/lib/storage/types.d.ts +66 -0
  94. package/dist/lib/storage/types.js +1 -0
  95. package/dist/lib/sync/client-drive.d.ts +9 -0
  96. package/dist/lib/sync/client-drive.js +69 -0
  97. package/dist/lib/sync/engine.d.ts +18 -0
  98. package/dist/lib/sync/engine.js +517 -0
  99. package/dist/lib/sync/google-drive.d.ts +52 -0
  100. package/dist/lib/sync/google-drive.js +183 -0
  101. package/dist/lib/sync/merge.d.ts +1 -0
  102. package/dist/lib/sync/merge.js +68 -0
  103. package/dist/lib/yjs/YjsProvider.d.ts +11 -0
  104. package/dist/lib/yjs/YjsProvider.js +33 -0
  105. package/dist/lib/yjs/graph.d.ts +11 -0
  106. package/dist/lib/yjs/graph.js +7 -0
  107. package/dist/lib/yjs/hooks.d.ts +7 -0
  108. package/dist/lib/yjs/hooks.js +37 -0
  109. package/dist/lib/yjs/store.d.ts +4 -0
  110. package/dist/lib/yjs/store.js +19 -0
  111. package/dist/lib/yjs/syncGraph.d.ts +1 -0
  112. package/dist/lib/yjs/syncGraph.js +38 -0
  113. package/dist/providers/theme-provider.d.ts +3 -0
  114. package/dist/providers/theme-provider.js +18 -0
  115. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  116. package/package.json +69 -0
@@ -0,0 +1,3 @@
1
+ export default function CalendarView({ onClose }: {
2
+ onClose: () => void;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,72 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState, useEffect } from 'react';
3
+ import styles from './CalendarView.module.css';
4
+ import { ChevronLeft, ChevronRight } from 'lucide-react';
5
+ export default function CalendarView({ onClose }) {
6
+ const [dates, setDates] = useState([]); // ["2025-12-27", ...]
7
+ const [selectedDate, setSelectedDate] = useState(null);
8
+ const [logContent, setLogContent] = useState("");
9
+ const [loading, setLoading] = useState(false);
10
+ // Grid State
11
+ const [currentMonth, setCurrentMonth] = useState(new Date());
12
+ // Use Dexie/Local Storage directly (Offline First)
13
+ useEffect(() => {
14
+ async function loadDates() {
15
+ // Query Dexie directly or use LocalStorageProvider
16
+ // We look for files in "history/" folder.
17
+ // Importing LocalStorageProvider here or using db directly?
18
+ // Let's use db from '@/lib/storage/db' for speed/reactivity or check how FileExplorer does it.
19
+ // Actually, importing LocalStorageProvider is cleaner.
20
+ const { db } = await import('@/lib/storage/db');
21
+ const files = await db.files.where('path').startsWith('history/').toArray();
22
+ // Extract dates from "history/YYYY-MM-DD.md"
23
+ const dateList = files
24
+ .map(f => { var _a; return (_a = f.path.split('/').pop()) === null || _a === void 0 ? void 0 : _a.replace('.md', ''); })
25
+ .filter(Boolean);
26
+ setDates(dateList);
27
+ }
28
+ loadDates();
29
+ }, [currentMonth]); // Check updates when month changes? Or just once/polling?
30
+ async function loadLog(date) {
31
+ setSelectedDate(date);
32
+ setLoading(true);
33
+ try {
34
+ const { db } = await import('@/lib/storage/db');
35
+ const file = await db.files.get(`history/${date}.md`);
36
+ setLogContent((file === null || file === void 0 ? void 0 : file.content) || "Empty log.");
37
+ }
38
+ catch (e) {
39
+ setLogContent("Error loading log.");
40
+ }
41
+ finally {
42
+ setLoading(false);
43
+ }
44
+ }
45
+ // --- Grid Helpers ---
46
+ function getDaysInMonth(date) {
47
+ const year = date.getFullYear();
48
+ const month = date.getMonth();
49
+ const daysInMonth = new Date(year, month + 1, 0).getDate();
50
+ const firstDay = new Date(year, month, 1).getDay(); // 0 = Sun
51
+ return { daysInMonth, firstDay };
52
+ }
53
+ function changeMonth(delta) {
54
+ setCurrentMonth(prev => new Date(prev.getFullYear(), prev.getMonth() + delta, 1));
55
+ }
56
+ const { daysInMonth, firstDay } = getDaysInMonth(currentMonth);
57
+ const gridCells = [];
58
+ // Pad empty start cells
59
+ for (let i = 0; i < firstDay; i++) {
60
+ gridCells.push(_jsx("div", { className: styles.emptyCell }, `empty-${i}`));
61
+ }
62
+ // Days
63
+ for (let d = 1; d <= daysInMonth; d++) {
64
+ const year = currentMonth.getFullYear();
65
+ const month = currentMonth.getMonth() + 1;
66
+ const dateStr = `${year}-${String(month).padStart(2, '0')}-${String(d).padStart(2, '0')}`;
67
+ const hasLog = dates.includes(dateStr);
68
+ const isSelected = selectedDate === dateStr;
69
+ gridCells.push(_jsxs("button", { className: `${styles.dayCell} ${hasLog ? styles.hasLog : ''} ${isSelected ? styles.selected : ''}`, onClick: () => hasLog ? loadLog(dateStr) : null, disabled: !hasLog, children: [_jsx("span", { className: styles.dayNumber, children: d }), hasLog && _jsx("span", { className: styles.logIndicator })] }, d));
70
+ }
71
+ return (_jsxs("div", { className: styles.container, children: [_jsxs("div", { className: styles.header, children: [_jsx("h2", { children: "Your Journey Map" }), _jsx("button", { onClick: onClose, className: styles.closeBtn, children: "Close" })] }), _jsxs("div", { className: styles.content, children: [_jsxs("div", { className: styles.calendarPanel, children: [_jsxs("div", { className: styles.monthNav, children: [_jsx("button", { onClick: () => changeMonth(-1), style: { background: 'none', border: 'none', cursor: 'pointer' }, children: _jsx(ChevronLeft, {}) }), _jsx("h3", { children: currentMonth.toLocaleString('default', { month: 'long', year: 'numeric' }) }), _jsx("button", { onClick: () => changeMonth(1), style: { background: 'none', border: 'none', cursor: 'pointer' }, children: _jsx(ChevronRight, {}) })] }), _jsxs("div", { className: styles.gridHeader, children: [_jsx("span", { children: "Sun" }), _jsx("span", { children: "Mon" }), _jsx("span", { children: "Tue" }), _jsx("span", { children: "Wed" }), _jsx("span", { children: "Thu" }), _jsx("span", { children: "Fri" }), _jsx("span", { children: "Sat" })] }), _jsx("div", { className: styles.grid, children: gridCells })] }), _jsx("div", { className: styles.logViewer, children: selectedDate ? (_jsxs(_Fragment, { children: [_jsxs("h3", { children: ["Log: ", selectedDate] }), loading ? (_jsx("p", { children: "Loading memory..." })) : (_jsx("div", { className: styles.markdownContent, children: logContent.split('\n').map((line, i) => (_jsx("p", { children: line }, i))) }))] })) : (_jsx("div", { className: styles.placeholder, children: _jsx("p", { children: "Select a highlighted date to view its log." }) })) })] })] }));
72
+ }
@@ -0,0 +1,6 @@
1
+ import { StorageProvider } from '@/lib/storage/types';
2
+ interface ChatInterfaceProps {
3
+ storage: StorageProvider;
4
+ }
5
+ export default function ChatInterface({ storage }: ChatInterfaceProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,105 @@
1
+ 'use client';
2
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
+ import { useState, useRef, useEffect } from "react";
4
+ import ReactMarkdown from 'react-markdown';
5
+ import Icon from './Icon';
6
+ import { useMeechi } from '@/hooks/useMeechi';
7
+ export default function ChatInterface({ storage }) {
8
+ const [chatInput, setChatInput] = useState("");
9
+ const [messages, setMessages] = useState([]);
10
+ const [isChatting, setIsChatting] = useState(false);
11
+ const streamRef = useRef(null);
12
+ const messagesEndRef = useRef(null);
13
+ const textareaRef = useRef(null);
14
+ const meechi = useMeechi();
15
+ // Load Initial History (Simplified for Reference App)
16
+ useEffect(() => {
17
+ // In a real app we would load from storage.
18
+ // For reference app, we start fresh or show Welcome.
19
+ if (messages.length === 0) {
20
+ setMessages([{
21
+ role: 'meechi',
22
+ content: "Welcome to Meechi Core. I am your private AI assistant.",
23
+ timestamp: new Date().toLocaleTimeString()
24
+ }]);
25
+ }
26
+ }, []);
27
+ // Auto-scroll
28
+ useEffect(() => {
29
+ var _a;
30
+ (_a = messagesEndRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
31
+ }, [messages, isChatting]);
32
+ async function handleChat(e) {
33
+ e.preventDefault();
34
+ if (!chatInput.trim())
35
+ return;
36
+ const text = chatInput;
37
+ setChatInput("");
38
+ // 1. Add User Message
39
+ setMessages(prev => [...prev, {
40
+ role: 'user',
41
+ content: text,
42
+ timestamp: new Date().toLocaleTimeString()
43
+ }]);
44
+ setIsChatting(true);
45
+ // 2. Add Placeholder
46
+ setMessages(prev => [...prev, {
47
+ role: 'meechi',
48
+ content: "...",
49
+ timestamp: new Date().toLocaleTimeString()
50
+ }]);
51
+ // 3. Call AI
52
+ const historyForAI = messages.map(m => ({
53
+ role: m.role === 'meechi' ? 'assistant' : 'user',
54
+ content: m.content
55
+ }));
56
+ let currentContent = "";
57
+ await meechi.chat(text, historyForAI, "", // No Context RAG in basic reference app
58
+ (chunk) => {
59
+ currentContent += chunk;
60
+ // Update UI
61
+ setMessages(prev => {
62
+ const newArr = [...prev];
63
+ const lastIdx = newArr.length - 1;
64
+ if (newArr[lastIdx] && newArr[lastIdx].role === 'meechi') {
65
+ newArr[lastIdx] = Object.assign(Object.assign({}, newArr[lastIdx]), { content: currentContent });
66
+ }
67
+ return newArr;
68
+ });
69
+ });
70
+ setIsChatting(false);
71
+ // 4. Save to Storage (Basic Log)
72
+ // We demonstrate that storage works, but simplified format.
73
+ const dateStr = new Date().toISOString().split('T')[0];
74
+ const logEntry = `### ${new Date().toLocaleTimeString()}\n**User**: ${text}\n**Meechi**: ${currentContent}\n\n`;
75
+ await storage.appendFile(`history/${dateStr}.md`, logEntry);
76
+ }
77
+ return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', height: '100%', maxWidth: 800, margin: '0 auto' }, children: [_jsxs("div", { ref: streamRef, style: { flex: 1, overflowY: 'auto', padding: '1rem', display: 'flex', flexDirection: 'column', gap: '1rem' }, children: [messages.map((m, i) => (_jsxs("div", { style: {
78
+ alignSelf: m.role === 'user' ? 'flex-end' : 'flex-start',
79
+ maxWidth: '80%',
80
+ background: m.role === 'user' ? '#e5e7eb' : 'transparent',
81
+ padding: m.role === 'user' ? '0.5rem 1rem' : '0',
82
+ borderRadius: '1rem',
83
+ borderBottomRightRadius: m.role === 'user' ? 0 : '1rem',
84
+ }, children: [_jsxs("div", { style: { fontSize: '0.75rem', opacity: 0.5, marginBottom: 4 }, children: [m.role === 'meechi' ? 'Meechi' : 'You', " \u2022 ", m.timestamp] }), _jsx("div", { style: { lineHeight: 1.5 }, children: _jsx(ReactMarkdown, { children: m.content }) })] }, i))), _jsx("div", { ref: messagesEndRef })] }), _jsxs("div", { style: { padding: '1rem', background: 'var(--background)' }, children: [_jsxs("form", { onSubmit: handleChat, style: { position: 'relative' }, children: [_jsx("textarea", { ref: textareaRef, value: chatInput, onChange: e => setChatInput(e.target.value), onKeyDown: e => {
85
+ if (e.key === 'Enter' && !e.shiftKey) {
86
+ e.preventDefault();
87
+ handleChat(e);
88
+ }
89
+ }, placeholder: "Type a message...", style: {
90
+ width: '100%',
91
+ padding: '1rem',
92
+ borderRadius: '0.5rem',
93
+ border: '1px solid #ccc',
94
+ resize: 'none',
95
+ minHeight: 50
96
+ } }), _jsx("button", { type: "submit", disabled: isChatting || !chatInput.trim(), style: {
97
+ position: 'absolute',
98
+ right: '1.5rem',
99
+ bottom: '1.5rem',
100
+ background: 'transparent',
101
+ border: 'none',
102
+ cursor: 'pointer',
103
+ opacity: isChatting ? 0.3 : 1
104
+ }, children: _jsx(Icon, { name: "Send", size: 20 }) })] }), _jsx("div", { style: { textAlign: 'center', fontSize: '0.75rem', opacity: 0.5, marginTop: '0.5rem' }, children: meechi.localAIStatus || "Ready" })] })] }));
105
+ }
@@ -0,0 +1,9 @@
1
+ import { StorageProvider } from '../lib/storage/types';
2
+ interface FileExplorerProps {
3
+ storage: StorageProvider;
4
+ onClose: () => void;
5
+ syncLogs?: string[];
6
+ onOpenFile?: (path: string) => void;
7
+ }
8
+ export default function FileExplorer(props: FileExplorerProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};