@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.
Files changed (106) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/agent/agent-loop.d.ts +1 -8
  3. package/dist/agent/agent-loop.d.ts.map +1 -1
  4. package/dist/agent/agent-loop.js +44 -159
  5. package/dist/agent/agent-loop.js.map +1 -1
  6. package/dist/agent/claude-cli-wrapper.d.ts +6 -0
  7. package/dist/agent/claude-cli-wrapper.d.ts.map +1 -1
  8. package/dist/agent/claude-cli-wrapper.js +6 -0
  9. package/dist/agent/claude-cli-wrapper.js.map +1 -1
  10. package/dist/agent/codex-mcp-process.d.ts +85 -0
  11. package/dist/agent/codex-mcp-process.d.ts.map +1 -0
  12. package/dist/agent/codex-mcp-process.js +357 -0
  13. package/dist/agent/codex-mcp-process.js.map +1 -0
  14. package/dist/agent/session-pool.d.ts +17 -2
  15. package/dist/agent/session-pool.d.ts.map +1 -1
  16. package/dist/agent/session-pool.js +51 -26
  17. package/dist/agent/session-pool.js.map +1 -1
  18. package/dist/agent/types.d.ts +9 -24
  19. package/dist/agent/types.d.ts.map +1 -1
  20. package/dist/agent/types.js.map +1 -1
  21. package/dist/api/graph-api.d.ts.map +1 -1
  22. package/dist/api/graph-api.js +133 -45
  23. package/dist/api/graph-api.js.map +1 -1
  24. package/dist/cli/commands/init.d.ts +1 -1
  25. package/dist/cli/commands/init.d.ts.map +1 -1
  26. package/dist/cli/commands/init.js +14 -25
  27. package/dist/cli/commands/init.js.map +1 -1
  28. package/dist/cli/commands/run.d.ts.map +1 -1
  29. package/dist/cli/commands/run.js +3 -10
  30. package/dist/cli/commands/run.js.map +1 -1
  31. package/dist/cli/commands/start.d.ts.map +1 -1
  32. package/dist/cli/commands/start.js +143 -54
  33. package/dist/cli/commands/start.js.map +1 -1
  34. package/dist/cli/commands/status.d.ts.map +1 -1
  35. package/dist/cli/commands/status.js +2 -7
  36. package/dist/cli/commands/status.js.map +1 -1
  37. package/dist/cli/config/config-manager.d.ts.map +1 -1
  38. package/dist/cli/config/config-manager.js +9 -17
  39. package/dist/cli/config/config-manager.js.map +1 -1
  40. package/dist/cli/config/types.d.ts +19 -25
  41. package/dist/cli/config/types.d.ts.map +1 -1
  42. package/dist/cli/config/types.js.map +1 -1
  43. package/dist/cli/index.js +2 -2
  44. package/dist/cli/index.js.map +1 -1
  45. package/dist/gateways/context-injector.d.ts.map +1 -1
  46. package/dist/gateways/context-injector.js +6 -3
  47. package/dist/gateways/context-injector.js.map +1 -1
  48. package/dist/gateways/discord.d.ts +4 -0
  49. package/dist/gateways/discord.d.ts.map +1 -1
  50. package/dist/gateways/discord.js +39 -16
  51. package/dist/gateways/discord.js.map +1 -1
  52. package/dist/gateways/message-router.d.ts +6 -1
  53. package/dist/gateways/message-router.d.ts.map +1 -1
  54. package/dist/gateways/message-router.js +92 -7
  55. package/dist/gateways/message-router.js.map +1 -1
  56. package/dist/multi-agent/agent-process-manager.d.ts.map +1 -1
  57. package/dist/multi-agent/agent-process-manager.js +36 -9
  58. package/dist/multi-agent/agent-process-manager.js.map +1 -1
  59. package/dist/multi-agent/runtime-process.d.ts +4 -4
  60. package/dist/multi-agent/runtime-process.d.ts.map +1 -1
  61. package/dist/multi-agent/runtime-process.js +9 -20
  62. package/dist/multi-agent/runtime-process.js.map +1 -1
  63. package/dist/multi-agent/types.d.ts +13 -8
  64. package/dist/multi-agent/types.d.ts.map +1 -1
  65. package/dist/multi-agent/types.js.map +1 -1
  66. package/dist/setup/setup-prompt.d.ts +1 -1
  67. package/dist/setup/setup-prompt.d.ts.map +1 -1
  68. package/dist/setup/setup-prompt.js +19 -0
  69. package/dist/setup/setup-prompt.js.map +1 -1
  70. package/dist/setup/setup-server.d.ts.map +1 -1
  71. package/dist/setup/setup-server.js +39 -16
  72. package/dist/setup/setup-server.js.map +1 -1
  73. package/dist/skills/skill-registry.d.ts.map +1 -1
  74. package/dist/skills/skill-registry.js +5 -2
  75. package/dist/skills/skill-registry.js.map +1 -1
  76. package/package.json +5 -3
  77. package/public/setup.html +12 -1
  78. package/public/viewer/js/modules/chat.js +1760 -1976
  79. package/public/viewer/js/modules/dashboard.js +613 -695
  80. package/public/viewer/js/modules/graph.js +857 -970
  81. package/public/viewer/js/modules/memory.js +357 -312
  82. package/public/viewer/js/modules/settings.js +1009 -1026
  83. package/public/viewer/js/modules/skills.js +336 -355
  84. package/public/viewer/js/utils/api.js +255 -255
  85. package/public/viewer/js/utils/debug-logger.js +20 -26
  86. package/public/viewer/js/utils/dom.js +73 -60
  87. package/public/viewer/js/utils/format.js +182 -228
  88. package/public/viewer/js/utils/markdown.js +40 -0
  89. package/public/viewer/src/modules/chat.ts +2258 -0
  90. package/public/viewer/src/modules/dashboard.ts +1052 -0
  91. package/public/viewer/src/modules/graph.ts +1080 -0
  92. package/public/viewer/src/modules/memory.ts +453 -0
  93. package/public/viewer/src/modules/settings.ts +1398 -0
  94. package/public/viewer/src/modules/skills.ts +457 -0
  95. package/public/viewer/src/types/global.d.ts +168 -0
  96. package/public/viewer/src/utils/api.ts +650 -0
  97. package/public/viewer/src/utils/debug-logger.ts +36 -0
  98. package/public/viewer/src/utils/dom.ts +138 -0
  99. package/public/viewer/src/utils/format.ts +331 -0
  100. package/public/viewer/src/utils/markdown.ts +46 -0
  101. package/public/viewer/tsconfig.viewer.json +18 -0
  102. package/public/viewer/viewer.html +214 -311
  103. package/dist/agent/codex-cli-wrapper.d.ts +0 -85
  104. package/dist/agent/codex-cli-wrapper.d.ts.map +0 -1
  105. package/dist/agent/codex-cli-wrapper.js +0 -295
  106. 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
- if (!text) {
16
- return '';
17
- }
18
- const div = document.createElement('div');
19
- div.textContent = text;
20
- return div.innerHTML;
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
- if (!text) {
30
- return '';
31
- }
32
- return escapeHtml(text).replace(/"/g, '"').replace(/'/g, ''');
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
- let timeout;
43
- return function executedFunction(...args) {
44
- const later = () => {
45
- clearTimeout(timeout);
46
- func(...args);
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
- // Remove existing toast
60
- const existingToast = document.querySelector('.toast-notification');
61
- if (existingToast) {
62
- existingToast.remove();
63
- }
64
-
65
- const toast = document.createElement('div');
66
- toast.className = 'toast-notification';
67
- toast.textContent = message;
68
- document.body.appendChild(toast);
69
-
70
- // Trigger animation
71
- requestAnimationFrame(() => {
72
- toast.classList.add('visible');
73
- });
74
-
75
- // Auto-remove
76
- setTimeout(() => {
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
- // Use setTimeout to ensure DOM has updated before scrolling
88
- const doScroll = () => {
89
- container.scrollTop = container.scrollHeight;
90
- if (container.scrollTo) {
91
- container.scrollTo({ top: container.scrollHeight, behavior: 'auto' });
92
- }
93
- };
94
- setTimeout(doScroll, 50);
95
- requestAnimationFrame(doScroll);
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
- textarea.style.height = 'auto';
105
- const lineHeight = parseInt(getComputedStyle(textarea).lineHeight);
106
- const maxHeight = lineHeight * maxRows;
107
- const newHeight = Math.min(textarea.scrollHeight, maxHeight);
108
- textarea.style.height = newHeight + 'px';
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
  }