@nine-lab/nine-mu 0.1.324 → 0.1.326

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, _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, _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, _manager, _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, _manager2, _config, _$nineChatMessage, _NineChat_instances, initInteractions_fn, initActions_fn, render_fn, _makeMenuHandler, _sourceGenHandler, _showDiff, _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;
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,11 +17080,13 @@ class NotificationHandler {
17080
17080
  constructor(owner) {
17081
17081
  __privateAdd(this, _NotificationHandler_instances);
17082
17082
  __privateAdd(this, _owner);
17083
+ __privateAdd(this, _manager);
17083
17084
  __privateAdd(this, _collectedFiles, []);
17084
17085
  /**
17085
17086
  * 레이어별로 순차 도착하는 파일들을 유실 없이 배열 버퍼에 수집
17086
17087
  */
17087
17088
  __privateAdd(this, _collectModifySource, (data) => {
17089
+ if (!data || !data.source) return;
17088
17090
  const filePayload = {
17089
17091
  layer: data.layer || "Unknown",
17090
17092
  full_path: data.full_path || "unknown_file",
@@ -17099,9 +17101,7 @@ class NotificationHandler {
17099
17101
  __privateAdd(this, _openDiffPopup, () => {
17100
17102
  if (__privateGet(this, _collectedFiles).length === 0) return;
17101
17103
  const $oldPopup = __privateGet(this, _owner).shadowRoot.querySelector("nine-diff-popup");
17102
- if ($oldPopup) {
17103
- $oldPopup.remove();
17104
- }
17104
+ if ($oldPopup) $oldPopup.remove();
17105
17105
  const $diffPopup = document.createElement("nine-diff-popup");
17106
17106
  $diffPopup.setAttribute("package-name", __privateGet(this, _owner).getAttribute("package-name") || "");
17107
17107
  const container = __privateGet(this, _owner).shadowRoot.querySelector(".wrapper") || __privateGet(this, _owner).shadowRoot;
@@ -17110,14 +17110,42 @@ class NotificationHandler {
17110
17110
  $diffPopup.popup();
17111
17111
  __privateSet(this, _collectedFiles, []);
17112
17112
  });
17113
+ __privateAdd(this, _openRouteDiffPopup, (asis, tobe, lang) => {
17114
+ const $oldPopup = __privateGet(this, _owner).shadowRoot.querySelector("nine-menu-diff-popup");
17115
+ if ($oldPopup) $oldPopup.remove();
17116
+ const $diffPopup = document.createElement("nine-menu-diff-popup");
17117
+ const container = __privateGet(this, _owner).shadowRoot.querySelector(".wrapper") || this.shadowRoot;
17118
+ container.appendChild($diffPopup);
17119
+ $diffPopup.popup().data(asis, tobe, lang);
17120
+ });
17113
17121
  /**
17114
17122
  * [분리 비즈니스 로직 2] 수신된 소스코드 데이터 유효성 검증 및 추후 파일 저장 연동
17115
17123
  */
17116
17124
  __privateAdd(this, _generateSource, async (data) => {
17117
- trace.log(data);
17118
- return;
17125
+ if (!data.path || !data.source) return;
17126
+ const res = await api.post("/nine-mu/source/generateRealFileSingle", {
17127
+ //package_path: data.path,
17128
+ //file_name: data.file_name,
17129
+ currentPath: data.path,
17130
+ contents: data.source
17131
+ });
17132
+ trace.log(res);
17133
+ });
17134
+ __privateAdd(this, _generateMenu, async (data) => {
17135
+ if (!data) return;
17136
+ const hasCreated = data.some((item) => item.action === "CREATE");
17137
+ const hasUpdated = data.some((item) => item.action === "UPDATE");
17138
+ const hasDeleted = data.some((item) => item.action === "DELETE");
17139
+ if (hasUpdated || hasCreated || hasDeleted) {
17140
+ const asis = await __privateGet(this, _manager).getRoutes();
17141
+ nine.alert("메뉴 정리를 위한 라우터 정보 저장 화면으로 이동합니다.").then((res) => {
17142
+ const tobe = (data || []).filter((item) => item.action !== "DELETE").map(({ isNew, action, ...rest }) => rest);
17143
+ __privateGet(this, _openRouteDiffPopup).call(this, asis, tobe, "json");
17144
+ });
17145
+ }
17119
17146
  });
17120
17147
  __privateSet(this, _owner, owner);
17148
+ __privateSet(this, _manager, new NineChatManager(owner));
17121
17149
  }
17122
17150
  /**
17123
17151
  * MCP로부터 수신된 날것의 노티파이 데이터를 정석대로 라우팅하는 메인 메서드
@@ -17130,6 +17158,7 @@ class NotificationHandler {
17130
17158
  }
17131
17159
  }
17132
17160
  _owner = new WeakMap();
17161
+ _manager = new WeakMap();
17133
17162
  _collectedFiles = new WeakMap();
17134
17163
  _NotificationHandler_instances = new WeakSet();
17135
17164
  /**
@@ -17141,23 +17170,19 @@ handleLoggingMessage_fn = function(params) {
17141
17170
  __privateGet(this, _owner).addMessage("ai", message);
17142
17171
  __privateGet(this, _owner).addMessage("ing", "");
17143
17172
  }
17144
- switch (logger) {
17145
- case "generate-source-brain":
17146
- __privateGet(this, _generateSource).call(this, data);
17147
- break;
17148
- case "modify-source-brain":
17149
- if (data && data.source) {
17150
- __privateGet(this, _collectModifySource).call(this, data);
17151
- }
17152
- break;
17153
- case "modify-source-brain-completed":
17154
- __privateGet(this, _openDiffPopup).call(this);
17155
- break;
17156
- }
17173
+ const runAction = {
17174
+ "generate-menu-completed": () => __privateGet(this, _generateMenu).call(this, data),
17175
+ "generate-source-brain": () => __privateGet(this, _generateSource).call(this, data),
17176
+ "modify-source-brain": () => __privateGet(this, _collectModifySource).call(this, data),
17177
+ "modify-source-brain-completed": () => __privateGet(this, _openDiffPopup).call(this)
17178
+ }[logger];
17179
+ runAction == null ? void 0 : runAction();
17157
17180
  };
17158
17181
  _collectModifySource = new WeakMap();
17159
17182
  _openDiffPopup = new WeakMap();
17183
+ _openRouteDiffPopup = new WeakMap();
17160
17184
  _generateSource = new WeakMap();
17185
+ _generateMenu = new WeakMap();
17161
17186
  class NineChatManager {
17162
17187
  constructor(owner, callbacks = {}) {
17163
17188
  __privateAdd(this, _NineChatManager_instances);
@@ -17416,7 +17441,7 @@ class NineChat extends HTMLElement {
17416
17441
  __privateAdd(this, _packageName);
17417
17442
  __privateAdd(this, _routesPath);
17418
17443
  __privateAdd(this, _connectorUrl);
17419
- __privateAdd(this, _manager);
17444
+ __privateAdd(this, _manager2);
17420
17445
  __privateAdd(this, _config);
17421
17446
  __privateAdd(this, _$nineChatMessage);
17422
17447
  __publicField(this, "addMessage", (who, message) => {
@@ -17439,8 +17464,8 @@ class NineChat extends HTMLElement {
17439
17464
  }
17440
17465
  });
17441
17466
  __privateAdd(this, _sourceGenHandler, async (e) => {
17442
- const routes = await __privateGet(this, _manager).getRoutes();
17443
- const response = await __privateGet(this, _manager).analyzeUnmappedRoutes(routes);
17467
+ const routes = await __privateGet(this, _manager2).getRoutes();
17468
+ const response = await __privateGet(this, _manager2).analyzeUnmappedRoutes(routes);
17444
17469
  trace.log(response);
17445
17470
  });
17446
17471
  __privateAdd(this, _showDiff, (asis, tobe, lang) => {
@@ -17469,14 +17494,14 @@ class NineChat extends HTMLElement {
17469
17494
  __privateSet(this, _config, res);
17470
17495
  __privateGet(this, _config).packageName = __privateGet(this, _packageName);
17471
17496
  __privateSet(this, _routesPath, (res == null ? void 0 : res.userDir) + "/" + __privateGet(this, _packageName) + "/public/prompts/data/routes.json");
17472
- __privateSet(this, _manager, new NineChatManager(this));
17497
+ __privateSet(this, _manager2, new NineChatManager(this));
17473
17498
  }
17474
17499
  }
17475
17500
  _service = new WeakMap();
17476
17501
  _packageName = new WeakMap();
17477
17502
  _routesPath = new WeakMap();
17478
17503
  _connectorUrl = new WeakMap();
17479
- _manager = new WeakMap();
17504
+ _manager2 = new WeakMap();
17480
17505
  _config = new WeakMap();
17481
17506
  _$nineChatMessage = new WeakMap();
17482
17507
  _NineChat_instances = new WeakSet();
@@ -17511,7 +17536,7 @@ initActions_fn = function() {
17511
17536
  target.setAttribute("disabled", "disabled");
17512
17537
  __privateGet(this, _$nineChatMessage).add("me", userInput);
17513
17538
  __privateGet(this, _$nineChatMessage).add("ing", "");
17514
- const [result, err] = await nine$1.safe(__privateGet(this, _manager).handleChatSubmit(target.value));
17539
+ const [result, err] = await nine$1.safe(__privateGet(this, _manager2).handleChatSubmit(target.value));
17515
17540
  setTimeout(() => {
17516
17541
  target.value = "";
17517
17542
  });
@@ -17525,20 +17550,9 @@ initActions_fn = function() {
17525
17550
  try {
17526
17551
  const rawText = (_b = (_a2 = result == null ? void 0 : result.content) == null ? void 0 : _a2[0]) == null ? void 0 : _b.text;
17527
17552
  const parsed = JSON.parse(rawText);
17528
- __privateGet(this, _manager).addChatHistory(parsed.message);
17553
+ __privateGet(this, _manager2).addChatHistory(parsed.message);
17529
17554
  __privateGet(this, _$nineChatMessage).add("ai", parsed.message);
17530
- const asis = await __privateGet(this, _manager).getRoutes();
17531
- if ((parsed == null ? void 0 : parsed.selected_tool) === "generator-menu") {
17532
- const hasCreated = parsed == null ? void 0 : parsed.data.some((item) => item.action === "CREATE");
17533
- const hasUpdated = parsed == null ? void 0 : parsed.data.some((item) => item.action === "UPDATE");
17534
- const hasDeleted = parsed == null ? void 0 : parsed.data.some((item) => item.action === "DELETE");
17535
- if (hasUpdated || hasCreated || hasDeleted) {
17536
- nine$1.alert("메뉴 정리를 위한 라우터 정보 저장 화면으로 이동합니다.").then((res) => {
17537
- const tobe = ((parsed == null ? void 0 : parsed.data) || []).filter((item) => item.action !== "DELETE").map(({ isNew, action, ...rest }) => rest);
17538
- __privateGet(this, _showDiff).call(this, asis, tobe, "json");
17539
- });
17540
- }
17541
- }
17555
+ const asis = await __privateGet(this, _manager2).getRoutes();
17542
17556
  } catch (err2) {
17543
17557
  trace.error(err2);
17544
17558
  const fallbackMessage = ((_d = (_c = result == null ? void 0 : result.content) == null ? void 0 : _c[0]) == null ? void 0 : _d.text) || "응답 데이터를 해석하지 못했습니다.";
@@ -17553,7 +17567,7 @@ render_fn = function() {
17553
17567
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
17554
17568
  this.shadowRoot.innerHTML = `
17555
17569
  <style>
17556
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.323"}/dist/css/nine-mu.css";
17570
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.325"}/dist/css/nine-mu.css";
17557
17571
  ${customImport}
17558
17572
  </style>
17559
17573
  <div class="wrapper">
@@ -43805,7 +43819,7 @@ class NineDiff extends HTMLElement {
43805
43819
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
43806
43820
  this.shadowRoot.innerHTML = `
43807
43821
  <style>
43808
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.323"}/dist/css/nine-mu.css";
43822
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.325"}/dist/css/nine-mu.css";
43809
43823
  ${customImport}
43810
43824
  </style>
43811
43825
 
@@ -43945,7 +43959,7 @@ renderScaffolding_fn = function() {
43945
43959
  const customImport = nine$1.cssPath ? `@import "${nine$1.cssPath}/nine-mu.css";` : "";
43946
43960
  this.shadowRoot.innerHTML = `
43947
43961
  <style>
43948
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.323"}/dist/css/nine-mu.css";
43962
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.325"}/dist/css/nine-mu.css";
43949
43963
  ${customImport}
43950
43964
  </style>
43951
43965
 
@@ -44054,7 +44068,7 @@ render_fn2 = function() {
44054
44068
  const customImport = nine$1.cssPath ? `@import "${nine$1.cssPath}/nine-mu.css";` : "";
44055
44069
  this.shadowRoot.innerHTML = `
44056
44070
  <style>
44057
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.323"}/dist/css/nine-mu.css";
44071
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.325"}/dist/css/nine-mu.css";
44058
44072
  ${customImport}
44059
44073
  </style>
44060
44074
 
@@ -44385,7 +44399,7 @@ class ChatMessageBody extends HTMLElement {
44385
44399
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
44386
44400
  this.shadowRoot.innerHTML = `
44387
44401
  <style>
44388
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.323"}/dist/css/nine-mu.css";
44402
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.325"}/dist/css/nine-mu.css";
44389
44403
  ${customImport}
44390
44404
  </style>
44391
44405
 
@@ -44479,7 +44493,7 @@ if (!customElements.get("nine-chat-progress")) {
44479
44493
  customElements.define("nine-chat-progress", ProgressMessage);
44480
44494
  }
44481
44495
  const NineMu = {
44482
- version: "0.1.323",
44496
+ version: "0.1.325",
44483
44497
  init: (config2) => {
44484
44498
  trace$1.log("🛠️ Nine-Mu Engine initialized", config2);
44485
44499
  }