@nine-lab/nine-mu 0.1.332 → 0.1.334

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.
@@ -940,4 +940,82 @@
940
940
  /* JS로 내용이 채워지므로 별도의 CSS 애니메이션은 필요 없음 */
941
941
  }
942
942
  }
943
+ }
944
+
945
+ :host(nine-exception-hook) {
946
+ display: block;
947
+ width: 100%;
948
+ height: 100%;
949
+
950
+ .nine-error-container {
951
+ padding: 30px;
952
+ margin: 20px;
953
+ background-color: #FFF5F5;
954
+ border: 1px solid #FEB2B2;
955
+ border-radius: 8px;
956
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
957
+ }
958
+
959
+ .nine-error-title {
960
+ color: #C53030;
961
+ margin-top: 0;
962
+ font-size: 18px;
963
+ font-weight: bold;
964
+ }
965
+
966
+ .nine-error-label {
967
+ margin: 10px 0 5px 0;
968
+ font-weight: bold;
969
+ color: #4A5568;
970
+ }
971
+
972
+ .nine-error-log {
973
+ background-color: #1A202C;
974
+ color: #EDF2F7;
975
+ padding: 15px;
976
+ border-radius: 6px;
977
+ overflow-x: auto;
978
+ white-space: pre-wrap;
979
+ font-family: 'Courier New', Courier, monospace;
980
+ font-size: 14px;
981
+ }
982
+
983
+ /* 💡 버튼 커스텀 디자인 세트 */
984
+ .nine-ai-btn {
985
+ background-color: #3182CE;
986
+ color: white;
987
+ padding: 10px 20px;
988
+ font-size: 14px;
989
+ font-weight: bold;
990
+ border: none;
991
+ border-radius: 6px;
992
+ cursor: pointer;
993
+ transition: background-color 0.2s ease;
994
+ white-space: nowrap;
995
+ }
996
+
997
+ .nine-ai-btn:hover {
998
+ background-color: #2B6CB0;
999
+ }
1000
+
1001
+ .nine-ai-btn:disabled {
1002
+ background-color: #A0AEC0;
1003
+ cursor: not-allowed;
1004
+ }
1005
+
1006
+ .nine-ai-btn.loading {
1007
+ background-color: #4A5568;
1008
+ animation: pulse 1.5s infinite ease-in-out;
1009
+ }
1010
+
1011
+ .nine-error-footer {
1012
+ font-size: 14px;
1013
+ color: #718096;
1014
+ }
1015
+
1016
+ @keyframes pulse {
1017
+ 0% { opacity: 0.6; }
1018
+ 50% { opacity: 1; }
1019
+ 100% { opacity: 0.6; }
1020
+ }
943
1021
  }
package/dist/nine-mu.js CHANGED
@@ -9,7 +9,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _owner, _collectedFiles, _NotificationHandler_instances, handleLoggingMessage_fn, _collectModifySource, _openDiffPopup, _openRouteDiffPopup, _generateSource, _generateMenu, _mcpClient, _onAction, _onStatus, _onMessage, _owner2, _routeUrl, _chatHistory, _notiHandler, _NineChatManager_instances, connect_fn, updateStatus_fn, callTool_fn, _getSourcePath, _service, _packageName, _routesPath, _connectorUrl, _manager, _config, _$nineChatMessage, _NineChat_instances, initInteractions_fn, initActions_fn, render_fn, _sourceGenHandler, _asisEditorView, _tobeEditorView, _asisEditorEl, _tobeEditorEl, _isDirty, _initialAsisSrc, _initialTobeSrc, _languageCompartment, _isScrollSyncActive, _initCodeMirror, _checkDirtyState, _setupScrollSync, _applyDiffDecorations, _dialog, _tabContainer, _fileList, _host, _NineDiffPopup_instances, renderScaffolding_fn, handleConfirmAll_fn, handleCancel_fn, _dialog2, _diffView, _asisBackup, _host2, _NineMenuDiffPopup_instances, render_fn2, handleConfirm_fn, handleCancel_fn2, _message, _data, _unique, _init, _message2, _init2, _progressData, _progressElements, _animationIntervals, _ProgressMessage_instances, updateCurrentActiveProgress_fn, renderProgress_fn, updateProgressItemVisuals_fn, startAnimation_fn, updateProgressItem_fn, _renderer, _init3;
12
+ var _owner, _collectedFiles, _NotificationHandler_instances, handleLoggingMessage_fn, _collectModifySource, _openDiffPopup, _openRouteDiffPopup, _generateSource, _generateMenu, _mcpClient, _onAction, _onStatus, _onMessage, _owner2, _routeUrl, _chatHistory, _notiHandler, _NineChatManager_instances, connect_fn, updateStatus_fn, callTool_fn, _getSourcePath, _service, _packageName, _routesPath, _connectorUrl, _manager, _config, _$nineChatMessage, _NineChat_instances, initInteractions_fn, initActions_fn, render_fn, _sourceGenHandler, _asisEditorView, _tobeEditorView, _asisEditorEl, _tobeEditorEl, _isDirty, _initialAsisSrc, _initialTobeSrc, _languageCompartment, _isScrollSyncActive, _initCodeMirror, _checkDirtyState, _setupScrollSync, _applyDiffDecorations, _dialog, _tabContainer, _fileList, _host, _NineDiffPopup_instances, renderScaffolding_fn, handleConfirmAll_fn, handleCancel_fn, _dialog2, _diffView, _asisBackup, _host2, _NineMenuDiffPopup_instances, render_fn2, handleConfirm_fn, handleCancel_fn2, _message, _data, _unique, _init, _message2, _init2, _progressData, _progressElements, _animationIntervals, _ProgressMessage_instances, updateCurrentActiveProgress_fn, renderProgress_fn, updateProgressItemVisuals_fn, startAnimation_fn, updateProgressItem_fn, _renderer, _init3, _renderer2, _ExceptionHook_instances, injectShadowStylesheet_fn, handleRuntimeError_fn, handlePromiseError_fn, handleLocationChange_fn, sendToAiAction_fn, renderError_fn;
13
13
  import { trace as trace$1, api, nine as nine$1 } from "@nine-lab/nine-util";
14
14
  class Trace extends trace$1.constructor {
15
15
  constructor() {
@@ -17534,10 +17534,10 @@ initActions_fn = function() {
17534
17534
  };
17535
17535
  render_fn = function() {
17536
17536
  const placeholder = this.getAttribute("placeholder") || "나에게 무엇이든 물어봐...";
17537
- const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
17537
+ const customImport = nine$1.cssPath ? `@import "${nine$1.cssPath}/nine-mu.css";` : "";
17538
17538
  this.shadowRoot.innerHTML = `
17539
17539
  <style>
17540
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.331"}/dist/css/nine-mu.css";
17540
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.333"}/dist/css/nine-mu.css";
17541
17541
  ${customImport}
17542
17542
  </style>
17543
17543
  <div class="wrapper">
@@ -43784,10 +43784,10 @@ class NineDiff extends HTMLElement {
43784
43784
  return __privateGet(this, _isDirty);
43785
43785
  }
43786
43786
  connectedCallback() {
43787
- const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
43787
+ const customImport = nine.cssPath ? `@import "${nine.cssPath}/nine-mu.css";` : "";
43788
43788
  this.shadowRoot.innerHTML = `
43789
43789
  <style>
43790
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.331"}/dist/css/nine-mu.css";
43790
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.333"}/dist/css/nine-mu.css";
43791
43791
  ${customImport}
43792
43792
  </style>
43793
43793
 
@@ -43927,7 +43927,7 @@ renderScaffolding_fn = function() {
43927
43927
  const customImport = nine$1.cssPath ? `@import "${nine$1.cssPath}/nine-mu.css";` : "";
43928
43928
  this.shadowRoot.innerHTML = `
43929
43929
  <style>
43930
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.331"}/dist/css/nine-mu.css";
43930
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.333"}/dist/css/nine-mu.css";
43931
43931
  ${customImport}
43932
43932
  </style>
43933
43933
 
@@ -44036,7 +44036,7 @@ render_fn2 = function() {
44036
44036
  const customImport = nine$1.cssPath ? `@import "${nine$1.cssPath}/nine-mu.css";` : "";
44037
44037
  this.shadowRoot.innerHTML = `
44038
44038
  <style>
44039
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.331"}/dist/css/nine-mu.css";
44039
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.333"}/dist/css/nine-mu.css";
44040
44040
  ${customImport}
44041
44041
  </style>
44042
44042
 
@@ -44363,10 +44363,10 @@ class ChatMessageBody extends HTMLElement {
44363
44363
  constructor() {
44364
44364
  super();
44365
44365
  __privateAdd(this, _renderer, () => {
44366
- const customImport = nine.cssPath ? `@import "${nine.cssPath}/ninePanel.css";` : "";
44366
+ const customImport = nine.cssPath ? `@import "${nine.cssPath}/nine-mu.css";` : "";
44367
44367
  this.shadowRoot.innerHTML = `
44368
44368
  <style>
44369
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.331"}/dist/css/nine-mu.css";
44369
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.333"}/dist/css/nine-mu.css";
44370
44370
  ${customImport}
44371
44371
  </style>
44372
44372
 
@@ -44464,8 +44464,132 @@ if (!customElements.get("nine-chat-ing")) {
44464
44464
  if (!customElements.get("nine-chat-progress")) {
44465
44465
  customElements.define("nine-chat-progress", ProgressMessage);
44466
44466
  }
44467
+ class ExceptionHook extends HTMLElement {
44468
+ constructor() {
44469
+ super();
44470
+ __privateAdd(this, _ExceptionHook_instances);
44471
+ __privateAdd(this, _renderer2, () => {
44472
+ const customImport = nine.cssPath ? `@import "${nine.cssPath}/nine-mu.css";` : "";
44473
+ this.shadowRoot.innerHTML = `
44474
+ <style>
44475
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.333"}/dist/css/nine-mu.css";
44476
+ ${customImport}
44477
+ </style>
44478
+
44479
+ <div class="nine-hook-core">
44480
+ <slot></slot>
44481
+ </div>
44482
+ `;
44483
+ });
44484
+ this.lastPath = window.location.pathname;
44485
+ this.hasError = false;
44486
+ this.cssPath = "/css/nine-exception-hook.css";
44487
+ this.attachShadow({ mode: "open" });
44488
+ }
44489
+ connectedCallback() {
44490
+ __privateGet(this, _renderer2).call(this);
44491
+ __privateMethod(this, _ExceptionHook_instances, injectShadowStylesheet_fn).call(this);
44492
+ window.addEventListener("error", __privateMethod(this, _ExceptionHook_instances, handleRuntimeError_fn).bind(this), true);
44493
+ window.addEventListener("unhandledrejection", __privateMethod(this, _ExceptionHook_instances, handlePromiseError_fn).bind(this), true);
44494
+ window.addEventListener("popstate", __privateMethod(this, _ExceptionHook_instances, handleLocationChange_fn).bind(this));
44495
+ document.addEventListener("click", __privateMethod(this, _ExceptionHook_instances, handleLocationChange_fn).bind(this), true);
44496
+ }
44497
+ disconnectedCallback() {
44498
+ window.removeEventListener("error", __privateMethod(this, _ExceptionHook_instances, handleRuntimeError_fn));
44499
+ window.removeEventListener("unhandledrejection", __privateMethod(this, _ExceptionHook_instances, handlePromiseError_fn));
44500
+ window.removeEventListener("popstate", __privateMethod(this, _ExceptionHook_instances, handleLocationChange_fn));
44501
+ document.removeEventListener("click", __privateMethod(this, _ExceptionHook_instances, handleLocationChange_fn), true);
44502
+ }
44503
+ }
44504
+ _renderer2 = new WeakMap();
44505
+ _ExceptionHook_instances = new WeakSet();
44506
+ // 💡 2. Shadow Root 내부 전용 스타일 링크 주입 함수
44507
+ injectShadowStylesheet_fn = function() {
44508
+ if (this.shadowRoot.querySelector(`link[href="${this.cssPath}"]`)) return;
44509
+ const link = document.createElement("link");
44510
+ link.rel = "stylesheet";
44511
+ link.href = this.cssPath;
44512
+ this.shadowRoot.appendChild(link);
44513
+ };
44514
+ handleRuntimeError_fn = function(event) {
44515
+ var _a2, _b;
44516
+ if (this.contains(event.target) || event.error) {
44517
+ __privateMethod(this, _ExceptionHook_instances, renderError_fn).call(this, ((_a2 = event.error) == null ? void 0 : _a2.message) || event.message, (_b = event.error) == null ? void 0 : _b.stack);
44518
+ }
44519
+ };
44520
+ handlePromiseError_fn = function(event) {
44521
+ var _a2, _b;
44522
+ __privateMethod(this, _ExceptionHook_instances, renderError_fn).call(this, ((_a2 = event.reason) == null ? void 0 : _a2.message) || String(event.reason), (_b = event.reason) == null ? void 0 : _b.stack);
44523
+ };
44524
+ handleLocationChange_fn = function() {
44525
+ setTimeout(() => {
44526
+ if (this.hasError && this.lastPath !== window.location.pathname) {
44527
+ console.log("✨ [nine-exception-hook] Shadow DOM 내부 예외 청소 및 정상 복구");
44528
+ this.lastPath = window.location.pathname;
44529
+ this.hasError = false;
44530
+ const errorBox = this.shadowRoot.querySelector(".nine-error-container");
44531
+ if (errorBox) errorBox.remove();
44532
+ const coreContainer = this.shadowRoot.querySelector(".nine-hook-core");
44533
+ if (coreContainer) coreContainer.style.display = "";
44534
+ }
44535
+ }, 10);
44536
+ };
44537
+ sendToAiAction_fn = async function(errorMessage, errorStack) {
44538
+ const btn = this.shadowRoot.querySelector(".nine-ai-btn");
44539
+ const footer = this.shadowRoot.querySelector(".nine-error-footer");
44540
+ if (!btn) return;
44541
+ btn.disabled = true;
44542
+ btn.innerText = "⚡ AI 관제탑에 소스 분석 요청 중...";
44543
+ btn.classList.add("loading");
44544
+ try {
44545
+ if (window.triggerAutoRecovery) {
44546
+ await window.triggerAutoRecovery({
44547
+ message: errorMessage,
44548
+ stack: errorStack || "No stack trace available",
44549
+ path: window.location.pathname
44550
+ });
44551
+ footer.innerHTML = `✅ <b>AI 관제탑 접수 완료:</b> 분석을 바탕으로 소스 코드를 교정하고 있습니다. 잠시만 기다려주세요.`;
44552
+ btn.innerText = "🚀 전송 완료";
44553
+ } else {
44554
+ throw new Error("window.triggerAutoRecovery 관제탑 엔진이 로드되지 않았습니다.");
44555
+ }
44556
+ } catch (err) {
44557
+ console.error("❌ AI 전송 실패:", err);
44558
+ btn.disabled = false;
44559
+ btn.innerText = "❌ 재전송 시도";
44560
+ footer.innerHTML = `<span style="color: #E53E3E;">⚠️ 전송 실패: ${err.message}</span>`;
44561
+ }
44562
+ };
44563
+ renderError_fn = function(errorMessage, errorStack) {
44564
+ if (this.hasError) return;
44565
+ this.hasError = true;
44566
+ const coreContainer = this.shadowRoot.querySelector(".nine-hook-core");
44567
+ if (coreContainer) coreContainer.style.display = "none";
44568
+ const errorHTML = `
44569
+ <div class="nine-error-container">
44570
+ <h3 class="nine-error-title">⚠️ 시스템 예외 감지 (${this.tagName.toLowerCase()})</h3>
44571
+ <p class="nine-error-label">[에러 원인 로그]:</p>
44572
+ <pre class="nine-error-log">${errorMessage}</pre>
44573
+
44574
+ <div class="nine-action-area" style="margin-top: 20px; display: flex; align-items: center; gap: 15px;">
44575
+ <button class="nine-ai-btn">🤖 AI에게 소스코드 수정 요청</button>
44576
+ <div class="nine-error-footer">
44577
+ 버튼을 누르면 AI가 로그 및 컴포넌트 맵을 역추적하여 수정을 시작합니다.
44578
+ </div>
44579
+ </div>
44580
+ </div>
44581
+ `;
44582
+ this.shadowRoot.insertAdjacentHTML("beforeend", errorHTML);
44583
+ const aiBtn = this.shadowRoot.querySelector(".nine-ai-btn");
44584
+ if (aiBtn) {
44585
+ aiBtn.addEventListener("click", () => __privateMethod(this, _ExceptionHook_instances, sendToAiAction_fn).call(this, errorMessage, errorStack));
44586
+ }
44587
+ };
44588
+ if (!customElements.get("nine-exception-hook")) {
44589
+ customElements.define("nine-exception-hook", ExceptionHook);
44590
+ }
44467
44591
  const NineMu = {
44468
- version: "0.1.331",
44592
+ version: "0.1.333",
44469
44593
  init: (config2) => {
44470
44594
  trace$1.log("🛠️ Nine-Mu Engine initialized", config2);
44471
44595
  }