@nine-lab/nine-mu 0.1.343 โ†’ 0.1.344

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nine-lab/nine-mu",
3
- "version": "0.1.343",
3
+ "version": "0.1.344",
4
4
  "description": "AI-Driven Full-Stack Code Fabrication Engine",
5
5
  "type": "module",
6
6
  "main": "./dist/nine-mu.umd.js",
@@ -37,6 +37,9 @@ export class ExceptionHook extends HTMLElement {
37
37
  window.onerror = this.#oldOnError;
38
38
  trace.log("๐Ÿ” [nine-exception-hook] window.onerror ๋ณต๊ตฌ ์™„๋ฃŒ");
39
39
  }
40
+
41
+ // ํ™”๋ฉด ๋ฆฌ์…‹ ์‹œ ๋ฐ•ํ˜€์žˆ๋˜ ๋ฐ”๊นฅ์ชฝ ์—๋Ÿฌ ์ปจํ…Œ์ด๋„ˆ ์ œ๊ฑฐ
42
+ this.#removeExternalOverlay();
40
43
  }
41
44
 
42
45
  #setupGlobalSniffer() {
@@ -68,31 +71,16 @@ export class ExceptionHook extends HTMLElement {
68
71
  #renderer = () => {
69
72
  const customImport = nine.cssPath ? `@import "${nine.cssPath}/nine-mu.css";` : "";
70
73
 
71
- // ๐ŸŽฏ [์ˆ˜์ • 1] ๊ธ€๋กœ๋ฒŒ ๋กœ๋”ฉ ์˜ค๋ฒ„๋ ˆ์ด๋ฅผ ํ™”๋ฉด ์ „์ฒด์—์„œ ์ฐ์–ด๋ˆ„๋ฅด๊ธฐ ์œ„ํ•œ ํ˜ธ์ŠคํŠธ ๋ฐ ๋ ˆ์ด์–ด ์Šคํƒ€์ผ ๋‚ด์žฅ
72
74
  this.shadowRoot.innerHTML = `
73
75
  <style>
74
76
  @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${__APP_VERSION__}/dist/css/nine-mu.css";
75
77
  ${customImport}
76
-
77
78
  :host {
78
79
  display: block;
79
80
  width: 100%;
80
81
  height: 100%;
81
82
  }
82
- /* ์–ด๋–ค ๋กœ๋”ฉ ๋ ˆ์ด์–ด๊ฐ€ ๋Œ๊ณ  ์žˆ์–ด๋„ ๋ทฐํฌํŠธ ๊ธฐ์ค€ ๋ฌด์กฐ๊ฑด ๋งจ ์•ž(์ตœ์ƒ๋‹จ)์œผ๋กœ ๋นผ๋ฒ„๋ฆฌ๋Š” ์ ˆ๋Œ€ ๋ฐฉ์–ด ํด๋ž˜์Šค */
83
- .nine-hook-full-overlay {
84
- position: fixed !important;
85
- top: 0 !important;
86
- left: 0 !important;
87
- width: 100vw !important;
88
- height: 100vh !important;
89
- box-sizing: border-box !important;
90
- background-color: #FFF5F5 !important;
91
- z-index: 99999999 !important;
92
- overflow: auto !important;
93
- }
94
83
  </style>
95
-
96
84
  <div class="nine-hook-core" style="width: 100%; height: 100%;">
97
85
  <slot></slot>
98
86
  </div>
@@ -112,19 +100,13 @@ export class ExceptionHook extends HTMLElement {
112
100
  #handleRuntimeError = (event) => {
113
101
  trace.log("๐Ÿšจ [nine-exception-hook] window.addEventListener('error') ๋ฆฌ์Šค๋„ˆ ํฌ์ฐฉ!!", event);
114
102
 
115
- if (this.#hasError) {
116
- trace.log("โš ๏ธ [nine-exception-hook] ์ด๋ฏธ ์—๋Ÿฌ ํ™”๋ฉด์ด ํ™œ์„ฑํ™”๋˜์–ด ์žˆ์–ด ์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ ํŒจ์Šค");
117
- return;
118
- }
103
+ if (this.#hasError) return;
119
104
 
120
105
  const errorMessage = event.error?.message || event.message || String(event);
121
106
  const errorStack = event.error?.stack || "No stack trace available";
122
107
 
123
108
  if (errorMessage && errorMessage !== "Script error.") {
124
- trace.log("๐ŸŽฏ [nine-exception-hook] ์ •์ƒ์ ์ธ ์—๋Ÿฌ ๋ฉ”์‹œ์ง€ ํ™•์ธ -> ์—๋Ÿฌ ๋ณด๋“œ ์ถœ๋ ฅ ์‹œ๋„", { errorMessage });
125
109
  this.#renderError(errorMessage, errorStack);
126
- } else {
127
- trace.log("โš ๏ธ [nine-exception-hook] 'Script error.' ์ด๊ฑฐ๋‚˜ ๋นˆ ๋ฉ”์‹œ์ง€๋ผ ๋ฌด์‹œ๋จ");
128
110
  }
129
111
  }
130
112
 
@@ -137,36 +119,34 @@ export class ExceptionHook extends HTMLElement {
137
119
  const errorMessage = reason?.message || String(reason || "Unhandled Promise Rejection");
138
120
  const errorStack = reason?.stack || "No stack trace available";
139
121
 
140
- trace.log("๐ŸŽฏ [nine-exception-hook] Promise ๊ฑฐ๋ถ€ ํ™•์ธ -> ์—๋Ÿฌ ๋ณด๋“œ ์ถœ๋ ฅ ์‹œ๋„");
141
122
  this.#renderError(errorMessage, errorStack);
142
123
  }
143
124
 
144
125
  #handleLocationChange = () => {
145
126
  setTimeout(() => {
146
- trace.log("๐Ÿ“ [nine-exception-hook] ์ฃผ์†Œ ์ด๋™ ๊ฐ์ง€ ์ฒดํฌ", {
147
- hasError: this.#hasError,
148
- lastPath: this.#lastPath,
149
- currentPath: window.location.pathname
150
- });
151
-
152
127
  if (this.#hasError && this.#lastPath !== window.location.pathname) {
153
- trace.log("โœจ [nine-exception-hook] Shadow DOM ๋‚ด๋ถ€ ์˜ˆ์™ธ ์ฒญ์†Œ ๋ฐ ์ •์ƒ ๋ณต๊ตฌ");
128
+ trace.log("โœจ [nine-exception-hook] Shadow DOM ๋ฐ ๊ธ€๋กœ๋ฒŒ ์˜ค๋ฒ„๋ ˆ์ด ๋‚ด๋ถ€ ์˜ˆ์™ธ ์ฒญ์†Œ ๋ฐ ์ •์ƒ ๋ณต๊ตฌ");
154
129
  this.#lastPath = window.location.pathname;
155
130
  this.#hasError = false;
156
131
 
157
- const exceptionBoard = this.shadowRoot.querySelector('.nine-exception-board');
158
- if (exceptionBoard) exceptionBoard.innerHTML = '';
132
+ this.#removeExternalOverlay();
159
133
 
160
134
  const coreContainer = this.shadowRoot.querySelector('.nine-hook-core');
161
135
  if (coreContainer) coreContainer.style.display = '';
162
136
  }
163
- }, 50); // ๋ผ์šฐํŒ… ์™„๋ฃŒ ๋Œ€๊ธฐ ์‹œ๊ฐ„์„ ์œ„ํ•ด ๋ฏธ์„ธ ์ƒํ–ฅ (50ms)
137
+ }, 50);
138
+ }
139
+
140
+ #removeExternalOverlay() {
141
+ const target = document.getElementById('nine-global-exception-container');
142
+ if (target) target.remove();
164
143
  }
165
144
 
166
145
  #sendToAiAction = async (errorMessage, errorStack) => {
167
- trace.log("๐Ÿš€ [nine-exception-hook] AI ์ˆ˜์ • ์š”์ฒญ ๋ฒ„ํŠผ ํด๋ฆญ๋จ");
168
- const btn = this.shadowRoot.querySelector('.nine-ai-btn');
169
- const footer = this.shadowRoot.querySelector('.nine-error-footer');
146
+ // ๊ธ€๋กœ๋ฒŒ ์—˜๋ฆฌ๋จผํŠธ ๋‚ด์—์„œ ํƒ์ƒ‰ํ•˜๋„๋ก ๋ณ€๊ฒฝ
147
+ const root = document.getElementById('nine-global-exception-container') || this.shadowRoot;
148
+ const btn = root.querySelector('.nine-ai-btn');
149
+ const footer = root.querySelector('.nine-error-footer');
170
150
  if (!btn) return;
171
151
 
172
152
  btn.disabled = true;
@@ -175,7 +155,6 @@ export class ExceptionHook extends HTMLElement {
175
155
 
176
156
  try {
177
157
  if (window.triggerAutoRecovery) {
178
- trace.log("๐Ÿ“ก [nine-exception-hook] window.triggerAutoRecovery ํ˜ธ์ถœ ์‹คํ–‰");
179
158
  await window.triggerAutoRecovery({
180
159
  message: errorMessage,
181
160
  stack: errorStack || "No stack trace available",
@@ -200,42 +179,52 @@ export class ExceptionHook extends HTMLElement {
200
179
  this.#hasError = true;
201
180
 
202
181
  setTimeout(() => {
203
- trace.log("๐ŸŽจ [nine-exception-hook] ๋ฆฌ์•กํŠธ ์‚ฌ์ดํด ์ข…๋ฃŒ ํ›„ ์—๋Ÿฌ UI ์ตœ์ข… ๋ Œ๋”๋ง");
182
+ trace.log("๐ŸŽจ [nine-exception-hook] ๋ฆฌ์•กํŠธ ์‚ฌ์ดํด ์ข…๋ฃŒ ํ›„ ์ตœ์ƒ๋‹จ ๊ธ€๋กœ๋ฒŒ ์—๋Ÿฌ ๋ ˆ์ด์–ด ์ƒ์„ฑ");
204
183
 
205
184
  const coreContainer = this.shadowRoot.querySelector('.nine-hook-core');
206
- if (coreContainer) {
207
- coreContainer.style.display = 'none';
208
- trace.log("๐ŸŽจ [nine-exception-hook] <slot> ๋ณธ๋ฌธ ์˜์—ญ ์ปจํ…Œ์ด๋„ˆ ์ˆจ๊น€");
209
- }
210
-
211
- const exceptionBoard = this.shadowRoot.querySelector('.nine-exception-board');
212
- if (!exceptionBoard) {
213
- trace.error("โŒ [nine-exception-hook] .nine-exception-board ์—˜๋ฆฌ๋จผํŠธ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.");
214
- return;
215
- }
185
+ if (coreContainer) coreContainer.style.display = 'none';
186
+
187
+ // ๐ŸŽฏ [ํ•ต์‹ฌ ๋ณ€๊ฒฝ] Shadow DOM ๋‚ด๋ถ€๊ฐ€ ์•„๋‹ˆ๋ผ document.body์— ์ง์ ‘ fixed ์ปจํ…Œ์ด๋„ˆ๋ฅผ ๊ฝ‚์•„๋ฒ„๋ ค
188
+ // global-loading-overlay๋ฅผ ์™„๋ฒฝํžˆ ๋ฎ์–ด๋ฒ„๋ฆฝ๋‹ˆ๋‹ค.
189
+ this.#removeExternalOverlay();
190
+
191
+ const externalContainer = document.createElement('div');
192
+ externalContainer.id = 'nine-global-exception-container';
193
+
194
+ // ์ธ๋ผ์ธ ์Šคํƒ€์ผ๋กœ ์™ธ๋ถ€ ์š”์†Œ๋ฅผ ์™„์ „ํžˆ ์ฐจ๋‹จํ•˜๊ณ  ๋งจ ์•ž์œผ๋กœ ๋ฐฐ์น˜
195
+ Object.assign(externalContainer.style, {
196
+ position: 'fixed',
197
+ top: '0',
198
+ left: '0',
199
+ width: '100vw',
200
+ height: '100vh',
201
+ backgroundColor: '#FFF5F5',
202
+ zIndex: '2147483647', // ๋ธŒ๋ผ์šฐ์ € ํ‘œํ˜„ ์ตœ๋Œ€ z-index ๊ฐ’ ๋ถ€์—ฌ
203
+ overflow: 'auto',
204
+ boxSizing: 'border-box',
205
+ display: 'block'
206
+ });
216
207
 
217
- // ๐ŸŽฏ [์ˆ˜์ • 2] ์—๋Ÿฌ HTML ์ปจํ…Œ์ด๋„ˆ ๊ตฌ์กฐ๋ฅผ ํ™”๋ฉด ์ „์ฒด ๋ทฐํฌํŠธ๋ฅผ ์žฅ์•…ํ•˜๋Š” ๊ณ ์ • ๋ ˆ์ด์•„์›ƒ ๊ตฌ์กฐ๋กœ ๋žฉํ•‘
218
208
  const errorHTML = `
219
- <div class="nine-hook-full-overlay">
220
- <div class="nine-error-container" style="padding: 40px; max-width: 1200px; margin: 40px auto; font-family: sans-serif; background: white; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.08); text-align: left;">
221
- <h3 class="nine-error-title" style="color: #C53030; margin-top: 0; font-size: 22px; font-weight: 700; border-bottom: 2px solid #FED2D2; padding-bottom: 12px;">โš ๏ธ ์‹œ์Šคํ…œ ์˜ˆ์™ธ ๊ฐ์ง€ (${this.tagName.toLowerCase()})</h3>
222
- <p class="nine-error-label" style="font-weight: bold; margin: 20px 0 8px 0; color: #4A5568; font-size: 15px;">[์—๋Ÿฌ ์›์ธ ๋กœ๊ทธ]:</p>
223
- <pre class="nine-error-log" style="background: #1A202C; color: #EDF2F7; padding: 20px; border-radius: 6px; overflow-x: auto; white-space: pre-wrap; font-family: monospace; font-size: 14px; line-height: 1.6; margin-bottom: 25px;">${errorMessage}\n\n[Stack Trace]\n${errorStack}</pre>
224
-
225
- <div class="nine-action-area" style="display: flex; align-items: center; gap: 20px; border-top: 1px solid #E2E8F0; padding-top: 20px;">
226
- <button class="nine-ai-btn" style="background: #3182CE; color: white; border: none; padding: 14px 28px; border-radius: 6px; font-weight: bold; cursor: pointer; font-size: 16px; transition: background 0.2s;">๐Ÿค– AI์—๊ฒŒ ์†Œ์Šค์ฝ”๋“œ ์ˆ˜์ • ์š”์ฒญ</button>
227
- <div class="nine-error-footer" style="font-size: 14px; color: #718096; line-height: 1.4;">
228
- ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด AI๊ฐ€ ๋กœ๊ทธ ๋ฐ ์ปดํฌ๋„ŒํŠธ ๋งต์„ ์—ญ์ถ”์ ํ•˜์—ฌ ์ˆ˜์ •์„ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.
229
- </div>
209
+ <div class="nine-error-container" style="padding: 40px; max-width: 1200px; margin: 40px auto; font-family: sans-serif; background: white; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.08); text-align: left;">
210
+ <h3 class="nine-error-title" style="color: #C53030; margin-top: 0; font-size: 22px; font-weight: 700; border-bottom: 2px solid #FED2D2; padding-bottom: 12px; font-family: sans-serif;">โš ๏ธ ์‹œ์Šคํ…œ ์˜ˆ์™ธ ๊ฐ์ง€ (nine-exception-hook)</h3>
211
+ <p class="nine-error-label" style="font-weight: bold; margin: 20px 0 8px 0; color: #4A5568; font-size: 15px; font-family: sans-serif;">[์—๋Ÿฌ ์›์ธ ๋กœ๊ทธ]:</p>
212
+ <pre class="nine-error-log" style="background: #1A202C; color: #EDF2F7; padding: 20px; border-radius: 6px; overflow-x: auto; white-space: pre-wrap; font-family: monospace; font-size: 14px; line-height: 1.6; margin-bottom: 25px;">${errorMessage}\n\n[Stack Trace]\n${errorStack}</pre>
213
+
214
+ <div class="nine-action-area" style="display: flex; align-items: center; gap: 20px; border-top: 1px solid #E2E8F0; padding-top: 20px;">
215
+ <button class="nine-ai-btn" style="background: #3182CE; color: white; border: none; padding: 14px 28px; border-radius: 6px; font-weight: bold; cursor: pointer; font-size: 16px;">๐Ÿค– AI์—๊ฒŒ ์†Œ์Šค์ฝ”๋“œ ์ˆ˜์ • ์š”์ฒญ</button>
216
+ <div class="nine-error-footer" style="font-size: 14px; color: #718096; line-height: 1.4; font-family: sans-serif;">
217
+ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด AI๊ฐ€ ๋กœ๊ทธ ๋ฐ ์ปดํฌ๋„ŒํŠธ ๋งต์„ ์—ญ์ถ”์ ํ•˜์—ฌ ์ˆ˜์ •์„ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.
230
218
  </div>
231
219
  </div>
232
220
  </div>
233
221
  `;
234
222
 
235
- exceptionBoard.innerHTML = errorHTML;
236
- trace.log("๐ŸŽจ [nine-exception-hook] Shadow DOM์— ์—๋Ÿฌ UI ์ตœ์ข… ์‚ฝ์ž… ์„ฑ๊ณต");
223
+ externalContainer.innerHTML = errorHTML;
224
+ document.body.appendChild(externalContainer);
225
+ trace.log("๐ŸŽจ [nine-exception-hook] ๋ธŒ๋ผ์šฐ์ € Body ์ตœ์ƒ๋‹จ ๋ ˆ์ด์–ด ๋ฐฐ์ • ์„ฑ๊ณต");
237
226
 
238
- const aiBtn = this.shadowRoot.querySelector('.nine-ai-btn');
227
+ const aiBtn = externalContainer.querySelector('.nine-ai-btn');
239
228
  if (aiBtn) {
240
229
  aiBtn.addEventListener('click', () => this.#sendToAiAction(errorMessage, errorStack));
241
230
  trace.log("๐ŸŽจ [nine-exception-hook] AI ์š”์ฒญ ๋ฒ„ํŠผ ์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ ์ตœ์ข… ๋ฐ”์ธ๋”ฉ ์„ฑ๊ณต");