@nine-lab/nine-mu 0.1.342 โ†’ 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.342",
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() {
@@ -72,9 +75,13 @@ export class ExceptionHook extends HTMLElement {
72
75
  <style>
73
76
  @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${__APP_VERSION__}/dist/css/nine-mu.css";
74
77
  ${customImport}
78
+ :host {
79
+ display: block;
80
+ width: 100%;
81
+ height: 100%;
82
+ }
75
83
  </style>
76
-
77
- <div class="nine-hook-core">
84
+ <div class="nine-hook-core" style="width: 100%; height: 100%;">
78
85
  <slot></slot>
79
86
  </div>
80
87
  <div class="nine-exception-board"></div>
@@ -93,19 +100,13 @@ export class ExceptionHook extends HTMLElement {
93
100
  #handleRuntimeError = (event) => {
94
101
  trace.log("๐Ÿšจ [nine-exception-hook] window.addEventListener('error') ๋ฆฌ์Šค๋„ˆ ํฌ์ฐฉ!!", event);
95
102
 
96
- if (this.#hasError) {
97
- trace.log("โš ๏ธ [nine-exception-hook] ์ด๋ฏธ ์—๋Ÿฌ ํ™”๋ฉด์ด ํ™œ์„ฑํ™”๋˜์–ด ์žˆ์–ด ์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ ํŒจ์Šค");
98
- return;
99
- }
103
+ if (this.#hasError) return;
100
104
 
101
105
  const errorMessage = event.error?.message || event.message || String(event);
102
106
  const errorStack = event.error?.stack || "No stack trace available";
103
107
 
104
108
  if (errorMessage && errorMessage !== "Script error.") {
105
- trace.log("๐ŸŽฏ [nine-exception-hook] ์ •์ƒ์ ์ธ ์—๋Ÿฌ ๋ฉ”์‹œ์ง€ ํ™•์ธ -> ์—๋Ÿฌ ๋ณด๋“œ ์ถœ๋ ฅ ์‹œ๋„", { errorMessage });
106
109
  this.#renderError(errorMessage, errorStack);
107
- } else {
108
- trace.log("โš ๏ธ [nine-exception-hook] 'Script error.' ์ด๊ฑฐ๋‚˜ ๋นˆ ๋ฉ”์‹œ์ง€๋ผ ๋ฌด์‹œ๋จ");
109
110
  }
110
111
  }
111
112
 
@@ -118,36 +119,34 @@ export class ExceptionHook extends HTMLElement {
118
119
  const errorMessage = reason?.message || String(reason || "Unhandled Promise Rejection");
119
120
  const errorStack = reason?.stack || "No stack trace available";
120
121
 
121
- trace.log("๐ŸŽฏ [nine-exception-hook] Promise ๊ฑฐ๋ถ€ ํ™•์ธ -> ์—๋Ÿฌ ๋ณด๋“œ ์ถœ๋ ฅ ์‹œ๋„");
122
122
  this.#renderError(errorMessage, errorStack);
123
123
  }
124
124
 
125
125
  #handleLocationChange = () => {
126
126
  setTimeout(() => {
127
- trace.log("๐Ÿ“ [nine-exception-hook] ์ฃผ์†Œ ์ด๋™ ๊ฐ์ง€ ์ฒดํฌ", {
128
- hasError: this.#hasError,
129
- lastPath: this.#lastPath,
130
- currentPath: window.location.pathname
131
- });
132
-
133
127
  if (this.#hasError && this.#lastPath !== window.location.pathname) {
134
- trace.log("โœจ [nine-exception-hook] Shadow DOM ๋‚ด๋ถ€ ์˜ˆ์™ธ ์ฒญ์†Œ ๋ฐ ์ •์ƒ ๋ณต๊ตฌ");
128
+ trace.log("โœจ [nine-exception-hook] Shadow DOM ๋ฐ ๊ธ€๋กœ๋ฒŒ ์˜ค๋ฒ„๋ ˆ์ด ๋‚ด๋ถ€ ์˜ˆ์™ธ ์ฒญ์†Œ ๋ฐ ์ •์ƒ ๋ณต๊ตฌ");
135
129
  this.#lastPath = window.location.pathname;
136
130
  this.#hasError = false;
137
131
 
138
- const exceptionBoard = this.shadowRoot.querySelector('.nine-exception-board');
139
- if (exceptionBoard) exceptionBoard.innerHTML = '';
132
+ this.#removeExternalOverlay();
140
133
 
141
134
  const coreContainer = this.shadowRoot.querySelector('.nine-hook-core');
142
135
  if (coreContainer) coreContainer.style.display = '';
143
136
  }
144
- }, 10);
137
+ }, 50);
138
+ }
139
+
140
+ #removeExternalOverlay() {
141
+ const target = document.getElementById('nine-global-exception-container');
142
+ if (target) target.remove();
145
143
  }
146
144
 
147
145
  #sendToAiAction = async (errorMessage, errorStack) => {
148
- trace.log("๐Ÿš€ [nine-exception-hook] AI ์ˆ˜์ • ์š”์ฒญ ๋ฒ„ํŠผ ํด๋ฆญ๋จ");
149
- const btn = this.shadowRoot.querySelector('.nine-ai-btn');
150
- 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');
151
150
  if (!btn) return;
152
151
 
153
152
  btn.disabled = true;
@@ -156,7 +155,6 @@ export class ExceptionHook extends HTMLElement {
156
155
 
157
156
  try {
158
157
  if (window.triggerAutoRecovery) {
159
- trace.log("๐Ÿ“ก [nine-exception-hook] window.triggerAutoRecovery ํ˜ธ์ถœ ์‹คํ–‰");
160
158
  await window.triggerAutoRecovery({
161
159
  message: errorMessage,
162
160
  stack: errorStack || "No stack trace available",
@@ -180,42 +178,53 @@ export class ExceptionHook extends HTMLElement {
180
178
  if (this.#hasError) return;
181
179
  this.#hasError = true;
182
180
 
183
- // ๐ŸŽฏ [ํ•ต์‹ฌ] ๋ฆฌ์•กํŠธ๊ฐ€ ์—๋Ÿฌ ๋ฐœ์ƒ ํ›„ ํ•˜์œ„ DOM์„ Unmount/์กฐ์ž‘ํ•˜๋Š” ๋™๊ธฐ์ ์ธ ํƒ€์ด๋ฐ์„
184
- // ์™„์ „ํžˆ ํ˜๋ ค๋ณด๋‚ธ ๋’ค(setTimeout 0)์— ์•ˆ์ „ํ•˜๊ฒŒ Web Component UI๋ฅผ ๊ฝ‚์•„ ๋„ฃ์Šต๋‹ˆ๋‹ค.
185
181
  setTimeout(() => {
186
- trace.log("๐ŸŽจ [nine-exception-hook] ๋ฆฌ์•กํŠธ ์‚ฌ์ดํด ์ข…๋ฃŒ ํ›„ ์—๋Ÿฌ UI ์ตœ์ข… ๋ Œ๋”๋ง");
182
+ trace.log("๐ŸŽจ [nine-exception-hook] ๋ฆฌ์•กํŠธ ์‚ฌ์ดํด ์ข…๋ฃŒ ํ›„ ์ตœ์ƒ๋‹จ ๊ธ€๋กœ๋ฒŒ ์—๋Ÿฌ ๋ ˆ์ด์–ด ์ƒ์„ฑ");
187
183
 
188
184
  const coreContainer = this.shadowRoot.querySelector('.nine-hook-core');
189
- if (coreContainer) {
190
- coreContainer.style.display = 'none';
191
- trace.log("๐ŸŽจ [nine-exception-hook] <slot> ๋ณธ๋ฌธ ์˜์—ญ ์ปจํ…Œ์ด๋„ˆ ์ˆจ๊น€");
192
- }
193
-
194
- const exceptionBoard = this.shadowRoot.querySelector('.nine-exception-board');
195
- if (!exceptionBoard) {
196
- trace.error("โŒ [nine-exception-hook] .nine-exception-board ์—˜๋ฆฌ๋จผํŠธ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.");
197
- return;
198
- }
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
+ });
199
207
 
200
208
  const errorHTML = `
201
- <div class="nine-error-container">
202
- <h3 class="nine-error-title">โš ๏ธ ์‹œ์Šคํ…œ ์˜ˆ์™ธ ๊ฐ์ง€ (${this.tagName.toLowerCase()})</h3>
203
- <p class="nine-error-label">[์—๋Ÿฌ ์›์ธ ๋กœ๊ทธ]:</p>
204
- <pre class="nine-error-log">${errorMessage}</pre>
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>
205
213
 
206
- <div class="nine-action-area" style="margin-top: 20px; display: flex; align-items: center; gap: 15px;">
207
- <button class="nine-ai-btn">๐Ÿค– AI์—๊ฒŒ ์†Œ์Šค์ฝ”๋“œ ์ˆ˜์ • ์š”์ฒญ</button>
208
- <div class="nine-error-footer">
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;">
209
217
  ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด AI๊ฐ€ ๋กœ๊ทธ ๋ฐ ์ปดํฌ๋„ŒํŠธ ๋งต์„ ์—ญ์ถ”์ ํ•˜์—ฌ ์ˆ˜์ •์„ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.
210
218
  </div>
211
219
  </div>
212
220
  </div>
213
221
  `;
214
222
 
215
- exceptionBoard.innerHTML = errorHTML;
216
- trace.log("๐ŸŽจ [nine-exception-hook] Shadow DOM์— ์—๋Ÿฌ UI ์ตœ์ข… ์‚ฝ์ž… ์„ฑ๊ณต");
223
+ externalContainer.innerHTML = errorHTML;
224
+ document.body.appendChild(externalContainer);
225
+ trace.log("๐ŸŽจ [nine-exception-hook] ๋ธŒ๋ผ์šฐ์ € Body ์ตœ์ƒ๋‹จ ๋ ˆ์ด์–ด ๋ฐฐ์ • ์„ฑ๊ณต");
217
226
 
218
- const aiBtn = this.shadowRoot.querySelector('.nine-ai-btn');
227
+ const aiBtn = externalContainer.querySelector('.nine-ai-btn');
219
228
  if (aiBtn) {
220
229
  aiBtn.addEventListener('click', () => this.#sendToAiAction(errorMessage, errorStack));
221
230
  trace.log("๐ŸŽจ [nine-exception-hook] AI ์š”์ฒญ ๋ฒ„ํŠผ ์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ ์ตœ์ข… ๋ฐ”์ธ๋”ฉ ์„ฑ๊ณต");