@jungjaehoon/mama-os 0.8.3 → 0.9.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.
- package/CHANGELOG.md +10 -0
- package/dist/agent/agent-loop.d.ts +1 -8
- package/dist/agent/agent-loop.d.ts.map +1 -1
- package/dist/agent/agent-loop.js +44 -159
- package/dist/agent/agent-loop.js.map +1 -1
- package/dist/agent/claude-cli-wrapper.d.ts +6 -0
- package/dist/agent/claude-cli-wrapper.d.ts.map +1 -1
- package/dist/agent/claude-cli-wrapper.js +6 -0
- package/dist/agent/claude-cli-wrapper.js.map +1 -1
- package/dist/agent/codex-mcp-process.d.ts +85 -0
- package/dist/agent/codex-mcp-process.d.ts.map +1 -0
- package/dist/agent/codex-mcp-process.js +357 -0
- package/dist/agent/codex-mcp-process.js.map +1 -0
- package/dist/agent/session-pool.d.ts +17 -2
- package/dist/agent/session-pool.d.ts.map +1 -1
- package/dist/agent/session-pool.js +51 -26
- package/dist/agent/session-pool.js.map +1 -1
- package/dist/agent/types.d.ts +9 -24
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/api/graph-api.d.ts.map +1 -1
- package/dist/api/graph-api.js +133 -45
- package/dist/api/graph-api.js.map +1 -1
- package/dist/cli/commands/init.d.ts +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +14 -25
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +3 -10
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +143 -54
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +2 -7
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/config/config-manager.d.ts.map +1 -1
- package/dist/cli/config/config-manager.js +9 -17
- package/dist/cli/config/config-manager.js.map +1 -1
- package/dist/cli/config/types.d.ts +19 -25
- package/dist/cli/config/types.d.ts.map +1 -1
- package/dist/cli/config/types.js.map +1 -1
- package/dist/cli/index.js +2 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/gateways/context-injector.d.ts.map +1 -1
- package/dist/gateways/context-injector.js +6 -3
- package/dist/gateways/context-injector.js.map +1 -1
- package/dist/gateways/discord.d.ts +4 -0
- package/dist/gateways/discord.d.ts.map +1 -1
- package/dist/gateways/discord.js +39 -16
- package/dist/gateways/discord.js.map +1 -1
- package/dist/gateways/message-router.d.ts +6 -1
- package/dist/gateways/message-router.d.ts.map +1 -1
- package/dist/gateways/message-router.js +92 -7
- package/dist/gateways/message-router.js.map +1 -1
- package/dist/multi-agent/agent-process-manager.d.ts.map +1 -1
- package/dist/multi-agent/agent-process-manager.js +36 -9
- package/dist/multi-agent/agent-process-manager.js.map +1 -1
- package/dist/multi-agent/runtime-process.d.ts +4 -4
- package/dist/multi-agent/runtime-process.d.ts.map +1 -1
- package/dist/multi-agent/runtime-process.js +9 -20
- package/dist/multi-agent/runtime-process.js.map +1 -1
- package/dist/multi-agent/types.d.ts +13 -8
- package/dist/multi-agent/types.d.ts.map +1 -1
- package/dist/multi-agent/types.js.map +1 -1
- package/dist/setup/setup-prompt.d.ts +1 -1
- package/dist/setup/setup-prompt.d.ts.map +1 -1
- package/dist/setup/setup-prompt.js +19 -0
- package/dist/setup/setup-prompt.js.map +1 -1
- package/dist/setup/setup-server.d.ts.map +1 -1
- package/dist/setup/setup-server.js +39 -16
- package/dist/setup/setup-server.js.map +1 -1
- package/dist/skills/skill-registry.d.ts.map +1 -1
- package/dist/skills/skill-registry.js +5 -2
- package/dist/skills/skill-registry.js.map +1 -1
- package/package.json +5 -3
- package/public/setup.html +12 -1
- package/public/viewer/js/modules/chat.js +1760 -1976
- package/public/viewer/js/modules/dashboard.js +613 -695
- package/public/viewer/js/modules/graph.js +857 -970
- package/public/viewer/js/modules/memory.js +357 -312
- package/public/viewer/js/modules/settings.js +1009 -1026
- package/public/viewer/js/modules/skills.js +336 -355
- package/public/viewer/js/utils/api.js +255 -255
- package/public/viewer/js/utils/debug-logger.js +20 -26
- package/public/viewer/js/utils/dom.js +73 -60
- package/public/viewer/js/utils/format.js +182 -228
- package/public/viewer/js/utils/markdown.js +40 -0
- package/public/viewer/src/modules/chat.ts +2258 -0
- package/public/viewer/src/modules/dashboard.ts +1052 -0
- package/public/viewer/src/modules/graph.ts +1080 -0
- package/public/viewer/src/modules/memory.ts +453 -0
- package/public/viewer/src/modules/settings.ts +1398 -0
- package/public/viewer/src/modules/skills.ts +457 -0
- package/public/viewer/src/types/global.d.ts +168 -0
- package/public/viewer/src/utils/api.ts +650 -0
- package/public/viewer/src/utils/debug-logger.ts +36 -0
- package/public/viewer/src/utils/dom.ts +138 -0
- package/public/viewer/src/utils/format.ts +331 -0
- package/public/viewer/src/utils/markdown.ts +46 -0
- package/public/viewer/tsconfig.viewer.json +18 -0
- package/public/viewer/viewer.html +214 -311
- package/dist/agent/codex-cli-wrapper.d.ts +0 -85
- package/dist/agent/codex-cli-wrapper.d.ts.map +0 -1
- package/dist/agent/codex-cli-wrapper.js +0 -295
- package/dist/agent/codex-cli-wrapper.js.map +0 -1
|
@@ -3,35 +3,51 @@
|
|
|
3
3
|
* @module utils/dom
|
|
4
4
|
* @version 1.0.0
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
6
|
/* eslint-env browser */
|
|
8
|
-
|
|
9
7
|
/**
|
|
10
8
|
* Escape HTML to prevent XSS
|
|
11
9
|
* @param {string} text - Text to escape
|
|
12
10
|
* @returns {string} Escaped HTML
|
|
13
11
|
*/
|
|
14
12
|
export function escapeHtml(text) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
if (!text) {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
const div = document.createElement('div');
|
|
17
|
+
div.textContent = text;
|
|
18
|
+
return div.innerHTML;
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
/**
|
|
24
21
|
* Escape HTML for use in attribute values (also escapes quotes)
|
|
25
22
|
* @param {string} text - Text to escape
|
|
26
23
|
* @returns {string} Escaped text safe for HTML attributes
|
|
27
24
|
*/
|
|
28
25
|
export function escapeAttr(text) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
if (!text) {
|
|
27
|
+
return '';
|
|
28
|
+
}
|
|
29
|
+
return escapeHtml(text).replace(/"/g, '"').replace(/'/g, ''');
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get DOM element by id with typed generic casting
|
|
33
|
+
* @param {string} id - Element id
|
|
34
|
+
* @returns {T | null} Matched element or null
|
|
35
|
+
*/
|
|
36
|
+
export function getElementByIdOrNull(id) {
|
|
37
|
+
const element = document.getElementById(id);
|
|
38
|
+
return element ? element : null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Normalize error values to a safe message string
|
|
42
|
+
* @param error - Unknown thrown value
|
|
43
|
+
* @returns {string} Error message
|
|
44
|
+
*/
|
|
45
|
+
export function getErrorMessage(error) {
|
|
46
|
+
if (error instanceof Error) {
|
|
47
|
+
return error.message;
|
|
48
|
+
}
|
|
49
|
+
return String(error);
|
|
33
50
|
}
|
|
34
|
-
|
|
35
51
|
/**
|
|
36
52
|
* Debounce function calls
|
|
37
53
|
* @param {Function} func - Function to debounce
|
|
@@ -39,71 +55,68 @@ export function escapeAttr(text) {
|
|
|
39
55
|
* @returns {Function} Debounced function
|
|
40
56
|
*/
|
|
41
57
|
export function debounce(func, wait) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
58
|
+
let timeout;
|
|
59
|
+
return function executedFunction(...args) {
|
|
60
|
+
const later = () => {
|
|
61
|
+
timeout = undefined;
|
|
62
|
+
func(...args);
|
|
63
|
+
};
|
|
64
|
+
if (timeout) {
|
|
65
|
+
clearTimeout(timeout);
|
|
66
|
+
}
|
|
67
|
+
timeout = setTimeout(later, wait);
|
|
47
68
|
};
|
|
48
|
-
clearTimeout(timeout);
|
|
49
|
-
timeout = setTimeout(later, wait);
|
|
50
|
-
};
|
|
51
69
|
}
|
|
52
|
-
|
|
53
70
|
/**
|
|
54
71
|
* Show toast notification
|
|
55
72
|
* @param {string} message - Message to display
|
|
56
73
|
* @param {number} duration - Duration in milliseconds
|
|
57
74
|
*/
|
|
58
75
|
export function showToast(message, duration = 3000) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
toast.classList.remove('visible');
|
|
78
|
-
setTimeout(() => toast.remove(), 300);
|
|
79
|
-
}, duration);
|
|
76
|
+
// Remove existing toast
|
|
77
|
+
const existingToast = document.querySelector('.toast-notification');
|
|
78
|
+
if (existingToast) {
|
|
79
|
+
existingToast.remove();
|
|
80
|
+
}
|
|
81
|
+
const toast = document.createElement('div');
|
|
82
|
+
toast.className = 'toast-notification';
|
|
83
|
+
toast.textContent = message;
|
|
84
|
+
document.body.appendChild(toast);
|
|
85
|
+
// Trigger animation
|
|
86
|
+
requestAnimationFrame(() => {
|
|
87
|
+
toast.classList.add('visible');
|
|
88
|
+
});
|
|
89
|
+
// Auto-remove
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
toast.classList.remove('visible');
|
|
92
|
+
setTimeout(() => toast.remove(), 300);
|
|
93
|
+
}, duration);
|
|
80
94
|
}
|
|
81
|
-
|
|
82
95
|
/**
|
|
83
96
|
* Scroll element to bottom
|
|
84
97
|
* @param {HTMLElement} container - Container to scroll
|
|
85
98
|
*/
|
|
86
99
|
export function scrollToBottom(container) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
// Use setTimeout to ensure DOM has updated before scrolling
|
|
101
|
+
const doScroll = () => {
|
|
102
|
+
container.scrollTop = container.scrollHeight;
|
|
103
|
+
if (container.scrollTo) {
|
|
104
|
+
container.scrollTo({ top: container.scrollHeight, behavior: 'auto' });
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
setTimeout(doScroll, 50);
|
|
108
|
+
requestAnimationFrame(doScroll);
|
|
96
109
|
}
|
|
97
|
-
|
|
98
110
|
/**
|
|
99
111
|
* Auto-resize textarea to fit content
|
|
100
112
|
* @param {HTMLTextAreaElement} textarea - Textarea element
|
|
101
113
|
* @param {number} maxRows - Maximum number of rows (default: 5)
|
|
102
114
|
*/
|
|
103
115
|
export function autoResizeTextarea(textarea, maxRows = 5) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
116
|
+
textarea.style.height = 'auto';
|
|
117
|
+
const computedLineHeight = Number.parseFloat(getComputedStyle(textarea).lineHeight);
|
|
118
|
+
const lineHeight = Number.isFinite(computedLineHeight) && computedLineHeight > 0 ? computedLineHeight : 20;
|
|
119
|
+
const maxHeight = lineHeight * maxRows;
|
|
120
|
+
const newHeight = Math.min(textarea.scrollHeight, maxHeight);
|
|
121
|
+
textarea.style.height = newHeight + 'px';
|
|
109
122
|
}
|