@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,267 +3,267 @@
3
3
  * @module utils/api
4
4
  * @version 1.0.0
5
5
  */
6
-
7
- /* eslint-env browser */
8
-
9
- /**
10
- * API client for MAMA viewer
11
- */
12
6
  export class API {
13
- /**
14
- * Base URL for API requests (empty for same origin)
15
- */
16
- static baseUrl = '';
17
-
18
- /**
19
- * Perform GET request
20
- * @param {string} endpoint - API endpoint
21
- * @param {Object} params - Query parameters
22
- * @returns {Promise<Object>} Response data
23
- */
24
- static async get(endpoint, params = null) {
25
- const url = new URL(endpoint, window.location.origin);
26
- if (params) {
27
- Object.entries(params).forEach(([key, value]) => {
28
- if (value !== null && value !== undefined) {
29
- url.searchParams.set(key, value);
7
+ /**
8
+ * Base URL for API requests (empty for same origin)
9
+ */
10
+ static baseUrl = '';
11
+ /**
12
+ * Parse JSON response safely with explicit error context.
13
+ */
14
+ static async parseJsonResponse(response, context = '요청') {
15
+ const contentType = response.headers.get('content-type') || '';
16
+ const text = await response.text();
17
+ if (!contentType.includes('application/json')) {
18
+ const snippet = text.slice(0, 80).replace(/\n/g, ' ');
19
+ throw new Error(`${context}에서 JSON 응답이 아닙니다. content-type: ${contentType || '없음'}, body: ${snippet}`);
20
+ }
21
+ try {
22
+ if (!text) {
23
+ throw new Error(`${context} 응답 본문이 비어 있습니다. status=${response.status}, url=${response.url}`);
24
+ }
25
+ return JSON.parse(text);
26
+ }
27
+ catch (error) {
28
+ const snippet = text.slice(0, 120).replace(/\n/g, ' ');
29
+ const cause = error instanceof Error ? error.message : String(error);
30
+ throw new Error(`${context} 응답 JSON 파싱 실패: ${cause} (샘플: ${snippet})`);
31
+ }
32
+ }
33
+ /**
34
+ * Perform GET request
35
+ */
36
+ static async get(endpoint, params = null) {
37
+ const url = new URL(endpoint, window.location.origin);
38
+ if (params) {
39
+ Object.entries(params).forEach(([key, value]) => {
40
+ if (value !== null && value !== undefined) {
41
+ url.searchParams.set(key, String(value));
42
+ }
43
+ });
44
+ }
45
+ const response = await fetch(url);
46
+ if (!response.ok) {
47
+ let errorMessage = `HTTP ${response.status}`;
48
+ try {
49
+ const errorData = await this.parseJsonResponse(response, `GET ${endpoint}`);
50
+ errorMessage = errorData.message || errorData.error || errorMessage;
51
+ }
52
+ catch (parseError) {
53
+ errorMessage = parseError instanceof Error ? parseError.message : String(parseError);
54
+ }
55
+ throw new Error(errorMessage);
56
+ }
57
+ return this.parseJsonResponse(response, `GET ${endpoint}`);
58
+ }
59
+ /**
60
+ * Perform POST request
61
+ * @param {string} endpoint - API endpoint
62
+ * @param {Object} body - Request body
63
+ * @returns {Promise<Object>} Response data
64
+ */
65
+ static async post(endpoint, body) {
66
+ const response = await fetch(endpoint, {
67
+ method: 'POST',
68
+ headers: { 'Content-Type': 'application/json' },
69
+ body: JSON.stringify(body),
70
+ });
71
+ if (!response.ok) {
72
+ let errorMessage = `HTTP ${response.status}`;
73
+ try {
74
+ const errorData = await this.parseJsonResponse(response, `POST ${endpoint}`);
75
+ errorMessage = errorData.message || errorData.error || errorMessage;
76
+ }
77
+ catch (parseError) {
78
+ errorMessage = parseError instanceof Error ? parseError.message : String(parseError);
79
+ }
80
+ throw new Error(errorMessage);
81
+ }
82
+ return this.parseJsonResponse(response, `POST ${endpoint}`);
83
+ }
84
+ /**
85
+ * Perform PUT request
86
+ */
87
+ static async put(endpoint, body) {
88
+ const response = await fetch(endpoint, {
89
+ method: 'PUT',
90
+ headers: { 'Content-Type': 'application/json' },
91
+ body: JSON.stringify(body),
92
+ });
93
+ if (!response.ok) {
94
+ let errorMessage = `HTTP ${response.status}`;
95
+ try {
96
+ const errorData = await this.parseJsonResponse(response, `PUT ${endpoint}`);
97
+ errorMessage = errorData.message || errorData.error || errorMessage;
98
+ }
99
+ catch (parseError) {
100
+ errorMessage = parseError instanceof Error ? parseError.message : String(parseError);
101
+ }
102
+ throw new Error(errorMessage);
103
+ }
104
+ return this.parseJsonResponse(response, `PUT ${endpoint}`);
105
+ }
106
+ /**
107
+ * Perform DELETE request
108
+ */
109
+ static async del(endpoint) {
110
+ const response = await fetch(endpoint, { method: 'DELETE' });
111
+ if (!response.ok) {
112
+ let errorMessage = `HTTP ${response.status}`;
113
+ try {
114
+ const errorData = await this.parseJsonResponse(response, `DELETE ${endpoint}`);
115
+ errorMessage = errorData.message || errorData.error || errorMessage;
116
+ }
117
+ catch (parseError) {
118
+ errorMessage = parseError instanceof Error ? parseError.message : String(parseError);
119
+ }
120
+ throw new Error(errorMessage);
30
121
  }
31
- });
122
+ return this.parseJsonResponse(response, `DELETE ${endpoint}`);
123
+ }
124
+ // =============================================
125
+ // Graph API
126
+ // =============================================
127
+ /**
128
+ * Get graph data
129
+ * @param {Object} params - Query parameters
130
+ * @returns {Promise<Object>} Graph data
131
+ */
132
+ static async getGraph(params = {}) {
133
+ // cluster: false by default to avoid slow embedding calculations
134
+ return this.get('/graph', { cluster: 'false', ...params });
135
+ }
136
+ /**
137
+ * Get similar decisions for a node
138
+ * @param {string} nodeId - Node ID
139
+ * @returns {Promise<Object>} Similar decisions
140
+ */
141
+ static async getSimilarDecisions(nodeId) {
142
+ return this.get('/graph/similar', { id: nodeId });
143
+ }
144
+ /**
145
+ * Update decision outcome
146
+ * @param {string} id - Decision ID
147
+ * @param {string} outcome - Outcome value
148
+ * @param {string} reason - Optional reason
149
+ * @returns {Promise<Object>} Update result
150
+ */
151
+ static async updateOutcome(id, outcome, reason = null) {
152
+ return this.post('/graph/update', { id, outcome, reason });
153
+ }
154
+ // =============================================
155
+ // Checkpoint API
156
+ // =============================================
157
+ /**
158
+ * Get all checkpoints
159
+ * @returns {Promise<Object>} Checkpoints data
160
+ */
161
+ static async getCheckpoints() {
162
+ return this.get('/checkpoints');
163
+ }
164
+ // =============================================
165
+ // MAMA Memory API
166
+ // =============================================
167
+ /**
168
+ * Search MAMA decisions
169
+ * @param {string} query - Search query
170
+ * @param {number} limit - Maximum results
171
+ * @returns {Promise<Object>} Search results
172
+ */
173
+ static async searchMemory(query, limit = 10) {
174
+ return this.get('/api/mama/search', { q: query, limit });
175
+ }
176
+ /**
177
+ * Save a new decision to MAMA
178
+ * @param {Object} data - Decision data
179
+ * @param {string} data.topic - Decision topic
180
+ * @param {string} data.decision - Decision text
181
+ * @param {string} data.reasoning - Reasoning text
182
+ * @param {number} data.confidence - Confidence (0-1)
183
+ * @returns {Promise<Object>} Save result
184
+ */
185
+ static async saveDecision(data) {
186
+ return this.post('/api/mama/save', data);
187
+ }
188
+ // =============================================
189
+ // Session API
190
+ // =============================================
191
+ /**
192
+ * Create a new chat session
193
+ * @param {string} projectDir - Project directory
194
+ * @returns {Promise<Object>} Session data
195
+ */
196
+ static async createSession(projectDir = '.') {
197
+ return this.post('/api/sessions', {
198
+ projectDir,
199
+ });
200
+ }
201
+ /**
202
+ * Get the last active session
203
+ * @returns {Promise<Object>} Last active session
204
+ */
205
+ static async getLastActiveSession() {
206
+ return this.get('/api/sessions/last-active');
207
+ }
208
+ /**
209
+ * Get all active sessions
210
+ * @returns {Promise<Object>} Sessions list
211
+ */
212
+ static async getSessions() {
213
+ return this.get('/api/sessions');
214
+ }
215
+ // =============================================
216
+ // Cron API
217
+ // =============================================
218
+ static async getCronJobs() {
219
+ return this.get('/api/cron');
220
+ }
221
+ static async updateCronJob(id, data) {
222
+ return this.put(`/api/cron/${encodeURIComponent(id)}`, data);
223
+ }
224
+ static async runCronJob(id) {
225
+ return this.post(`/api/cron/${encodeURIComponent(id)}/run`, {});
226
+ }
227
+ static async getCronLogs(id, limit = 5) {
228
+ return this.get(`/api/cron/${encodeURIComponent(id)}/logs`, { limit });
229
+ }
230
+ // =============================================
231
+ // Token API
232
+ // =============================================
233
+ static async getTokenSummary() {
234
+ return this.get('/api/tokens/summary');
235
+ }
236
+ static async getTokensByAgent() {
237
+ return this.get('/api/tokens/by-agent');
238
+ }
239
+ static async getTokensDaily(days = 30) {
240
+ return this.get('/api/tokens/daily', { days });
241
+ }
242
+ // =============================================
243
+ // Skills API
244
+ // =============================================
245
+ static async getSkills() {
246
+ return this.get('/api/skills');
247
+ }
248
+ static async getSkillCatalog(source = 'all') {
249
+ return this.get('/api/skills/catalog', { source });
250
+ }
251
+ static async searchSkills(query, source = 'all') {
252
+ return this.get('/api/skills/search', { q: query, source });
32
253
  }
33
-
34
- const response = await fetch(url);
35
- if (!response.ok) {
36
- const error = await response.json().catch(() => ({}));
37
- throw new Error(error.message || `HTTP ${response.status}`);
254
+ static async installSkill(source, name) {
255
+ return this.post('/api/skills/install', { source, name });
38
256
  }
39
-
40
- return response.json();
41
- }
42
-
43
- /**
44
- * Perform POST request
45
- * @param {string} endpoint - API endpoint
46
- * @param {Object} body - Request body
47
- * @returns {Promise<Object>} Response data
48
- */
49
- static async post(endpoint, body) {
50
- const response = await fetch(endpoint, {
51
- method: 'POST',
52
- headers: { 'Content-Type': 'application/json' },
53
- body: JSON.stringify(body),
54
- });
55
-
56
- if (!response.ok) {
57
- const error = await response.json().catch(() => ({}));
58
- throw new Error(error.message || `HTTP ${response.status}`);
257
+ static async uninstallSkill(name, source = 'mama') {
258
+ return this.del(`/api/skills/${encodeURIComponent(name)}?source=${encodeURIComponent(source)}`);
59
259
  }
60
-
61
- return response.json();
62
- }
63
-
64
- /**
65
- * Perform PUT request
66
- */
67
- static async put(endpoint, body) {
68
- const response = await fetch(endpoint, {
69
- method: 'PUT',
70
- headers: { 'Content-Type': 'application/json' },
71
- body: JSON.stringify(body),
72
- });
73
- if (!response.ok) {
74
- const error = await response.json().catch(() => ({}));
75
- throw new Error(error.message || `HTTP ${response.status}`);
260
+ static async toggleSkill(name, enabled, source = 'mama') {
261
+ return this.put(`/api/skills/${encodeURIComponent(name)}`, { enabled, source });
76
262
  }
77
- return response.json();
78
- }
79
-
80
- /**
81
- * Perform DELETE request
82
- */
83
- static async del(endpoint) {
84
- const response = await fetch(endpoint, { method: 'DELETE' });
85
- if (!response.ok) {
86
- const error = await response.json().catch(() => ({}));
87
- throw new Error(error.message || `HTTP ${response.status}`);
263
+ static async getSkillContent(name, source = 'mama') {
264
+ return this.get(`/api/skills/${encodeURIComponent(name)}/readme`, { source });
88
265
  }
89
- return response.json();
90
- }
91
-
92
- // =============================================
93
- // Graph API
94
- // =============================================
95
-
96
- /**
97
- * Get graph data
98
- * @param {Object} params - Query parameters
99
- * @returns {Promise<Object>} Graph data
100
- */
101
- static async getGraph(params = {}) {
102
- // cluster: false by default to avoid slow embedding calculations
103
- return this.get('/graph', { cluster: 'false', ...params });
104
- }
105
-
106
- /**
107
- * Get similar decisions for a node
108
- * @param {string} nodeId - Node ID
109
- * @returns {Promise<Object>} Similar decisions
110
- */
111
- static async getSimilarDecisions(nodeId) {
112
- return this.get('/graph/similar', { id: nodeId });
113
- }
114
-
115
- /**
116
- * Update decision outcome
117
- * @param {string} id - Decision ID
118
- * @param {string} outcome - Outcome value
119
- * @param {string} reason - Optional reason
120
- * @returns {Promise<Object>} Update result
121
- */
122
- static async updateOutcome(id, outcome, reason = null) {
123
- return this.post('/graph/update', { id, outcome, reason });
124
- }
125
-
126
- // =============================================
127
- // Checkpoint API
128
- // =============================================
129
-
130
- /**
131
- * Get all checkpoints
132
- * @returns {Promise<Object>} Checkpoints data
133
- */
134
- static async getCheckpoints() {
135
- return this.get('/checkpoints');
136
- }
137
-
138
- // =============================================
139
- // MAMA Memory API
140
- // =============================================
141
-
142
- /**
143
- * Search MAMA decisions
144
- * @param {string} query - Search query
145
- * @param {number} limit - Maximum results
146
- * @returns {Promise<Object>} Search results
147
- */
148
- static async searchMemory(query, limit = 10) {
149
- return this.get('/api/mama/search', { q: query, limit });
150
- }
151
-
152
- /**
153
- * Save a new decision to MAMA
154
- * @param {Object} data - Decision data
155
- * @param {string} data.topic - Decision topic
156
- * @param {string} data.decision - Decision text
157
- * @param {string} data.reasoning - Reasoning text
158
- * @param {number} data.confidence - Confidence (0-1)
159
- * @returns {Promise<Object>} Save result
160
- */
161
- static async saveDecision(data) {
162
- return this.post('/api/mama/save', data);
163
- }
164
-
165
- // =============================================
166
- // Session API
167
- // =============================================
168
-
169
- /**
170
- * Create a new chat session
171
- * @param {string} projectDir - Project directory
172
- * @returns {Promise<Object>} Session data
173
- */
174
- static async createSession(projectDir = '.') {
175
- return this.post('/api/sessions', { projectDir });
176
- }
177
-
178
- /**
179
- * Get the last active session
180
- * @returns {Promise<Object|null>} Last active session or null
181
- */
182
- static async getLastActiveSession() {
183
- try {
184
- return await this.get('/api/sessions/last-active');
185
- } catch {
186
- return null;
266
+ static async installSkillFromUrl(url) {
267
+ return this.post('/api/skills/install-url', { url });
187
268
  }
188
- }
189
-
190
- /**
191
- * Get all active sessions
192
- * @returns {Promise<Object>} Sessions list
193
- */
194
- static async getSessions() {
195
- return this.get('/api/sessions');
196
- }
197
-
198
- // =============================================
199
- // Cron API
200
- // =============================================
201
-
202
- static async getCronJobs() {
203
- return this.get('/api/cron');
204
- }
205
-
206
- static async updateCronJob(id, data) {
207
- return this.put(`/api/cron/${id}`, data);
208
- }
209
-
210
- static async runCronJob(id) {
211
- return this.post(`/api/cron/${id}/run`, {});
212
- }
213
-
214
- static async getCronLogs(id, limit = 5) {
215
- return this.get(`/api/cron/${id}/logs`, { limit });
216
- }
217
-
218
- // =============================================
219
- // Token API
220
- // =============================================
221
-
222
- static async getTokenSummary() {
223
- return this.get('/api/tokens/summary');
224
- }
225
-
226
- static async getTokensByAgent() {
227
- return this.get('/api/tokens/by-agent');
228
- }
229
-
230
- static async getTokensDaily(days = 30) {
231
- return this.get('/api/tokens/daily', { days });
232
- }
233
-
234
- // =============================================
235
- // Skills API
236
- // =============================================
237
-
238
- static async getSkills() {
239
- return this.get('/api/skills');
240
- }
241
-
242
- static async getSkillCatalog(source = 'all') {
243
- return this.get('/api/skills/catalog', { source });
244
- }
245
-
246
- static async searchSkills(query, source = 'all') {
247
- return this.get('/api/skills/search', { q: query, source });
248
- }
249
-
250
- static async installSkill(source, name) {
251
- return this.post('/api/skills/install', { source, name });
252
- }
253
-
254
- static async uninstallSkill(name, source = 'mama') {
255
- return this.del(`/api/skills/${encodeURIComponent(name)}?source=${source}`);
256
- }
257
-
258
- static async toggleSkill(name, enabled, source = 'mama') {
259
- return this.put(`/api/skills/${encodeURIComponent(name)}`, { enabled, source });
260
- }
261
-
262
- static async getSkillContent(name, source = 'mama') {
263
- return this.get(`/api/skills/${encodeURIComponent(name)}/readme`, { source });
264
- }
265
-
266
- static async installSkillFromUrl(url) {
267
- return this.post('/api/skills/install-url', { url });
268
- }
269
269
  }
@@ -1,34 +1,28 @@
1
1
  /* eslint-env browser */
2
-
3
2
  /**
4
3
  * Lightweight DebugLogger for viewer modules.
5
4
  * Mirrors mama-core DebugLogger behavior (no console.log usage).
6
5
  */
7
6
  export class DebugLogger {
8
- constructor(context = 'Viewer') {
9
- this.context = context;
10
- }
11
-
12
- _format(level, args) {
13
- const ts = new Date().toISOString();
14
- return [`[${ts}] [${this.context}] [${level}]`, ...args];
15
- }
16
-
17
- debug(...args) {
18
- console.debug(...this._format('DEBUG', args));
19
- }
20
-
21
- info(...args) {
22
- console.info(...this._format('INFO', args));
23
- }
24
-
25
- warn(...args) {
26
- console.warn(...this._format('WARN', args));
27
- }
28
-
29
- error(...args) {
30
- console.error(...this._format('ERROR', args));
31
- }
7
+ context;
8
+ constructor(context = 'Viewer') {
9
+ this.context = String(context);
10
+ }
11
+ _format(level, args) {
12
+ const ts = new Date().toISOString();
13
+ return [`[${ts}] [${this.context}] [${level}]`, ...args];
14
+ }
15
+ debug(...args) {
16
+ console.debug(...this._format('DEBUG', args));
17
+ }
18
+ info(...args) {
19
+ console.info(...this._format('INFO', args));
20
+ }
21
+ warn(...args) {
22
+ console.warn(...this._format('WARN', args));
23
+ }
24
+ error(...args) {
25
+ console.error(...this._format('ERROR', args));
26
+ }
32
27
  }
33
-
34
28
  export default DebugLogger;