@nine-lab/nine-mu 0.1.279 → 0.1.281

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/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, _NotificationHandler_instances, handleLoggingMessage_fn, _modifySource, _generateSource, _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, _makeMenuHandler, _sourceGenHandler, _showDiff, _asisEditorView, _tobeEditorView, _asisEditorEl, _tobeEditorEl, _languageCompartment, _isScrollSyncActive, _initCodeMirror, _setupScrollSync, _applyDiffDecorations, _dialog, _diffView, _asisBackup, _host, _NineDiffPopup_instances, render_fn2, handleConfirm_fn, handleCancel_fn, _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, _generateSource, _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, _makeMenuHandler, _sourceGenHandler, _showDiff, _asisEditorView, _tobeEditorView, _asisEditorEl, _tobeEditorEl, _languageCompartment, _isScrollSyncActive, _initCodeMirror, _setupScrollSync, _applyDiffDecorations, _dialog, _tabContainer, _filesMap, _host, _NineDiffPopup_instances, renderScaffolding_fn, handleConfirmAll_fn, handleCancel_fn, _message, _data, _unique, _init, _message2, _init2, _progressData, _progressElements, _animationIntervals, _ProgressMessage_instances, updateCurrentActiveProgress_fn, renderProgress_fn, updateProgressItemVisuals_fn, startAnimation_fn, updateProgressItem_fn, _renderer, _init3;
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() {
@@ -17080,8 +17080,33 @@ class NotificationHandler {
17080
17080
  constructor(owner) {
17081
17081
  __privateAdd(this, _NotificationHandler_instances);
17082
17082
  __privateAdd(this, _owner);
17083
- __privateAdd(this, _modifySource, async (data) => {
17084
- console.log(data.source);
17083
+ __privateAdd(this, _collectedFiles, []);
17084
+ /**
17085
+ * 레이어별로 순차 도착하는 파일들을 유실 없이 배열 버퍼에 수집
17086
+ */
17087
+ __privateAdd(this, _collectModifySource, (data) => {
17088
+ const filePayload = {
17089
+ layer: data.layer || "Unknown",
17090
+ full_path: data.full_path || "unknown_file",
17091
+ asis_source: data.asis_source || "",
17092
+ source: data.source || ""
17093
+ };
17094
+ __privateGet(this, _collectedFiles).push(filePayload);
17095
+ });
17096
+ /**
17097
+ * 최종 조립이 끝나 시그널이 도달했을 때 딱 한 번 팝업을 열어 일괄 주입
17098
+ */
17099
+ __privateAdd(this, _openDiffPopup, () => {
17100
+ if (__privateGet(this, _collectedFiles).length === 0) return;
17101
+ let $popup = document.querySelector("nine-diff-popup");
17102
+ if (!$popup) {
17103
+ $popup = document.createElement("nine-diff-popup");
17104
+ $popup.setAttribute("package-name", __privateGet(this, _owner).getAttribute("package-name") || "");
17105
+ document.body.appendChild($popup);
17106
+ }
17107
+ $popup.data([...__privateGet(this, _collectedFiles)]);
17108
+ $popup.popup();
17109
+ __privateSet(this, _collectedFiles, []);
17085
17110
  });
17086
17111
  /**
17087
17112
  * [분리 비즈니스 로직 2] 수신된 소스코드 데이터 유효성 검증 및 추후 파일 저장 연동
@@ -17113,6 +17138,7 @@ class NotificationHandler {
17113
17138
  }
17114
17139
  }
17115
17140
  _owner = new WeakMap();
17141
+ _collectedFiles = new WeakMap();
17116
17142
  _NotificationHandler_instances = new WeakSet();
17117
17143
  /**
17118
17144
  * [분리 비즈니스 로직 1] 로깅 및 UI 메시지 출력 제어
@@ -17126,19 +17152,23 @@ handleLoggingMessage_fn = function(params) {
17126
17152
  switch (logger) {
17127
17153
  case "generate-source-brain":
17128
17154
  if (data && data.source) {
17129
- trace.log(`[시그널 감지] 설계 완료`, data);
17130
17155
  __privateGet(this, _generateSource).call(this, data);
17131
17156
  }
17132
17157
  break;
17133
17158
  case "modify-source-brain":
17134
17159
  if (data && data.source) {
17135
- trace.log(`[시그널 감지] 설계 완료`, data);
17136
- __privateGet(this, _modifySource).call(this, data);
17160
+ __privateGet(this, _collectModifySource).call(this, data);
17161
+ }
17162
+ break;
17163
+ case "modify-source-brain-completed":
17164
+ if (data && data.source) {
17165
+ __privateGet(this, _openDiffPopup).call(this);
17137
17166
  }
17138
17167
  break;
17139
17168
  }
17140
17169
  };
17141
- _modifySource = new WeakMap();
17170
+ _collectModifySource = new WeakMap();
17171
+ _openDiffPopup = new WeakMap();
17142
17172
  _generateSource = new WeakMap();
17143
17173
  class NineChatManager {
17144
17174
  constructor(owner, callbacks = {}) {
@@ -17535,7 +17565,7 @@ render_fn = function() {
17535
17565
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
17536
17566
  this.shadowRoot.innerHTML = `
17537
17567
  <style>
17538
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.278"}/dist/css/nine-mu.css";
17568
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.280"}/dist/css/nine-mu.css";
17539
17569
  ${customImport}
17540
17570
  </style>
17541
17571
  <div class="wrapper">
@@ -43752,7 +43782,7 @@ class NineDiff extends HTMLElement {
43752
43782
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
43753
43783
  this.shadowRoot.innerHTML = `
43754
43784
  <style>
43755
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.278"}/dist/css/nine-mu.css";
43785
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.280"}/dist/css/nine-mu.css";
43756
43786
  ${customImport}
43757
43787
  </style>
43758
43788
 
@@ -43804,96 +43834,147 @@ class NineDiffPopup extends HTMLElement {
43804
43834
  super();
43805
43835
  __privateAdd(this, _NineDiffPopup_instances);
43806
43836
  __privateAdd(this, _dialog, null);
43807
- __privateAdd(this, _diffView, null);
43808
- // Container 대신 직접 에디터 뷰를 참조
43809
- __privateAdd(this, _asisBackup, "");
43837
+ __privateAdd(this, _tabContainer, null);
43838
+ __privateAdd(this, _filesMap, /* @__PURE__ */ new Map());
43839
+ // 각 탭(파일)별 원본 및 에디터 뷰 인스턴스, 메타데이터 관리를 위한 맵
43810
43840
  __privateAdd(this, _host);
43811
43841
  this.attachShadow({ mode: "open" });
43812
43842
  }
43813
43843
  connectedCallback() {
43814
43844
  __privateSet(this, _host, this.getRootNode().host);
43815
- __privateMethod(this, _NineDiffPopup_instances, render_fn2).call(this);
43845
+ __privateMethod(this, _NineDiffPopup_instances, renderScaffolding_fn).call(this);
43816
43846
  }
43817
43847
  popup() {
43818
43848
  __privateGet(this, _dialog).showModal();
43819
43849
  return this;
43820
43850
  }
43821
43851
  /**
43822
- * @param {string|object} asis - 소스 텍스트 또는 url:/file: 경로
43823
- * @param {string|object} tobe - 소스 텍스트 또는 url:/file: 경로
43824
- * @param {string} lang - 언어 설정
43852
+ * 💡 [핵심 고도화] 여러 파일 리스트를 받아 동적으로 탭을 생성하고 데이터를 주입하는 함수
43853
+ * @param {Array} fileList - [{ layer: "MyBatis", full_path: "...", asis_source: "...", source: "..." }]
43825
43854
  */
43826
- async data(asis, tobe, lang = "javascript") {
43827
- const loadSource = async (src) => {
43828
- if (typeof src === "string" && (src.startsWith("url:") || src.startsWith("file:"))) {
43829
- const targetUrl = src.replace(/^(url:|file:)/, "");
43830
- try {
43831
- trace.log(`📡 리모트 로드: ${targetUrl}`);
43832
- const res = await fetch(targetUrl);
43833
- if (!res.ok) throw new Error(`Status: ${res.status}`);
43834
- return await res.text();
43835
- } catch (e) {
43836
- trace.error(`로드 실패 [${targetUrl}]:`, e);
43837
- return `// 로드 실패: ${targetUrl}
43838
- ${e.message}`;
43839
- }
43840
- }
43841
- return src;
43855
+ async data(fileList) {
43856
+ if (!Array.isArray(fileList) || fileList.length === 0) return this;
43857
+ __privateGet(this, _tabContainer).innerHTML = "";
43858
+ __privateGet(this, _filesMap).clear();
43859
+ const detectLanguage = (path) => {
43860
+ const lower = (path || "").toLowerCase();
43861
+ if (lower.endsWith(".xml")) return "xml";
43862
+ if (lower.endsWith(".java")) return "java";
43863
+ if (lower.endsWith(".json")) return "json";
43864
+ return "javascript";
43842
43865
  };
43843
- const [finalAsis, finalTobe] = await Promise.all([
43844
- loadSource(asis),
43845
- loadSource(tobe)
43846
- ]);
43847
- __privateSet(this, _asisBackup, finalAsis);
43848
- __privateGet(this, _diffView).addEventListener("ready", () => {
43849
- const asisStr = typeof finalAsis === "object" ? JSON.stringify(finalAsis, null, 2) : finalAsis;
43850
- const tobeStr = typeof finalTobe === "object" ? JSON.stringify(finalTobe, null, 2) : finalTobe;
43851
- __privateGet(this, _diffView).initialize(asisStr, tobeStr, lang);
43852
- }, { once: true });
43866
+ fileList.forEach((file, index) => {
43867
+ const { layer: layer2, full_path, asis_source, source } = file;
43868
+ const lang = detectLanguage(full_path);
43869
+ const caption = `${layer2} (${full_path.split("/").pop()})`;
43870
+ const tabPage = document.createElement("nine-tab-page");
43871
+ tabPage.setAttribute("caption", caption);
43872
+ const diffWrapper = document.createElement("div");
43873
+ diffWrapper.className = "diff-wrapper";
43874
+ const diffView = document.createElement("nine-diff");
43875
+ diffWrapper.appendChild(diffView);
43876
+ tabPage.appendChild(diffWrapper);
43877
+ __privateGet(this, _tabContainer).appendChild(tabPage);
43878
+ const fileKey = `file_tab_${index}`;
43879
+ __privateGet(this, _filesMap).set(fileKey, {
43880
+ layer: layer2,
43881
+ fullPath: full_path,
43882
+ asisSource: asis_source,
43883
+ diffView
43884
+ });
43885
+ diffView.addEventListener("ready", () => {
43886
+ diffView.initialize(asis_source || "", source || "", lang);
43887
+ }, { once: true });
43888
+ });
43853
43889
  return this;
43854
43890
  }
43855
43891
  }
43856
43892
  _dialog = new WeakMap();
43857
- _diffView = new WeakMap();
43858
- _asisBackup = new WeakMap();
43893
+ _tabContainer = new WeakMap();
43894
+ _filesMap = new WeakMap();
43859
43895
  _host = new WeakMap();
43860
43896
  _NineDiffPopup_instances = new WeakSet();
43861
- render_fn2 = function() {
43897
+ /**
43898
+ * 💡 기본 다이얼로그 및 레이아웃 스케폴딩 렌더링
43899
+ */
43900
+ renderScaffolding_fn = function() {
43862
43901
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
43902
+ const appVersion = "0.1.280";
43863
43903
  this.shadowRoot.innerHTML = `
43864
- <style>
43865
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.278"}/dist/css/nine-mu.css";
43904
+ <style>
43905
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${appVersion}/dist/css/nine-mu.css";
43866
43906
  ${customImport}
43907
+
43908
+ .main-layout {
43909
+ display: flex;
43910
+ flex-direction: column;
43911
+ height: 80vh;
43912
+ width: 85vw;
43913
+ min-width: 800px;
43914
+ }
43915
+ .tab-area {
43916
+ flex: 1;
43917
+ overflow: hidden;
43918
+ display: flex;
43919
+ flex-direction: column;
43920
+ }
43921
+ nine-tab {
43922
+ flex: 1;
43923
+ display: flex;
43924
+ flex-direction: column;
43925
+ height: 100%;
43926
+ }
43927
+ .diff-wrapper {
43928
+ height: calc(80vh - 120px); /* 푸터와 탭 헤더 높이를 제외한 에디터 영역 확보 */
43929
+ width: 100%;
43930
+ }
43931
+ .footer {
43932
+ display: flex;
43933
+ justify-content: flex-end;
43934
+ gap: 10px;
43935
+ padding: 15px 0 0 0;
43936
+ border-top: 1px solid #e5e7eb;
43937
+ }
43867
43938
  </style>
43868
43939
 
43869
43940
  <nine-dialog>
43870
43941
  <div class="main-layout">
43871
- <div class="diff-area">
43872
- <nine-diff></nine-diff>
43942
+ <div class="tab-area">
43943
+ <nine-tab theme="theme-3"></nine-tab>
43873
43944
  </div>
43874
43945
  <div class="footer">
43875
43946
  <button class="btn btn-cancel">취소</button>
43876
- <button class="btn btn-confirm">저장</button>
43947
+ <button class="btn btn-confirm">모두 저장</button>
43877
43948
  </div>
43878
43949
  </div>
43879
43950
  </nine-dialog>
43880
43951
  `;
43881
43952
  __privateSet(this, _dialog, this.shadowRoot.querySelector("nine-dialog"));
43882
- __privateSet(this, _diffView, this.shadowRoot.querySelector("nine-diff"));
43883
- this.shadowRoot.querySelector(".btn-confirm").onclick = () => __privateMethod(this, _NineDiffPopup_instances, handleConfirm_fn).call(this);
43953
+ __privateSet(this, _tabContainer, this.shadowRoot.querySelector("nine-tab"));
43954
+ this.shadowRoot.querySelector(".btn-confirm").onclick = () => __privateMethod(this, _NineDiffPopup_instances, handleConfirmAll_fn).call(this);
43884
43955
  this.shadowRoot.querySelector(".btn-cancel").onclick = () => __privateMethod(this, _NineDiffPopup_instances, handleCancel_fn).call(this);
43885
43956
  };
43886
- handleConfirm_fn = function() {
43887
- const content2 = __privateGet(this, _diffView) ? __privateGet(this, _diffView).getContents() : __privateGet(this, _asisBackup);
43888
- const params = {
43889
- packageName: __privateGet(this, _host).getAttribute("package-name"),
43890
- contents: content2
43891
- };
43892
- api.post(`/nine-mu/source/generateJsonFile`, params).then((res) => {
43893
- nine$1.alert("소스를 변경하였습니다.").then((res2) => {
43894
- __privateGet(this, _dialog).close();
43957
+ handleConfirmAll_fn = async function() {
43958
+ var _a2;
43959
+ const payloadList = [];
43960
+ for (const [key, fileObj] of __privateGet(this, _filesMap).entries()) {
43961
+ const { diffView, fullPath, asisSource, layer: layer2 } = fileObj;
43962
+ const currentContent = diffView ? diffView.getContents() : asisSource;
43963
+ payloadList.push({
43964
+ layer: layer2,
43965
+ fullPath,
43966
+ packageName: ((_a2 = __privateGet(this, _host)) == null ? void 0 : _a2.getAttribute("package-name")) || "com.ninelab.ai",
43967
+ contents: currentContent
43895
43968
  });
43896
- });
43969
+ }
43970
+ try {
43971
+ await api.post(`/nine-mu/source/generateJsonFileBatch`, { fileList: payloadList });
43972
+ await nine$1.alert("요청하신 모든 파일의 소스 변경 사항이 성공적으로 반영되었습니다.");
43973
+ __privateGet(this, _dialog).close();
43974
+ } catch (error) {
43975
+ trace.error("일괄 파일 저장 처리 중 실패:", error);
43976
+ nine$1.alert("소스 저장 중 오류가 발생했습니다.");
43977
+ }
43897
43978
  };
43898
43979
  handleCancel_fn = function() {
43899
43980
  __privateGet(this, _dialog).close();
@@ -44188,7 +44269,7 @@ class ChatMessageBody extends HTMLElement {
44188
44269
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
44189
44270
  this.shadowRoot.innerHTML = `
44190
44271
  <style>
44191
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.278"}/dist/css/nine-mu.css";
44272
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.280"}/dist/css/nine-mu.css";
44192
44273
  ${customImport}
44193
44274
  </style>
44194
44275
 
@@ -44282,7 +44363,7 @@ if (!customElements.get("nine-chat-progress")) {
44282
44363
  customElements.define("nine-chat-progress", ProgressMessage);
44283
44364
  }
44284
44365
  const NineMu = {
44285
- version: "0.1.278",
44366
+ version: "0.1.280",
44286
44367
  init: (config2) => {
44287
44368
  trace$1.log("🛠️ Nine-Mu Engine initialized", config2);
44288
44369
  }