@nine-lab/nine-mu 0.1.83 → 0.1.85

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 _getSourcePath, _service, _routes, _diffPopup, _NineChat_instances, initInteractions_fn, initActions_fn, render_fn, _asisEditorView, _tobeEditorView, _asisEditorEl, _tobeEditorEl, _languageCompartment, _isScrollSyncActive, _initCodeMirror, _setupScrollSync, _applyDiffDecorations, _dialog, _diffView, _asisBackup, _host, _NineDiffPopup_instances, render_fn2, handleConfirm_fn, handleCancel_fn;
12
+ var _getSourcePath, _service, _routes, _diffPopup, _packageName, _routesPath, _NineChat_instances, initInteractions_fn, initActions_fn, render_fn, _makeMenuHandler, _sourceGenHandler, _asisEditorView, _tobeEditorView, _asisEditorEl, _tobeEditorEl, _languageCompartment, _isScrollSyncActive, _initCodeMirror, _setupScrollSync, _applyDiffDecorations, _dialog, _diffView, _asisBackup, _host, _NineDiffPopup_instances, render_fn2, handleConfirm_fn, handleCancel_fn;
13
13
  import { trace, api, nine } from "@nine-lab/nine-util";
14
14
  class NineMuService {
15
15
  constructor(connectorUrl) {
@@ -106,35 +106,53 @@ class NineChat extends HTMLElement {
106
106
  __privateAdd(this, _service, null);
107
107
  __privateAdd(this, _routes, []);
108
108
  __privateAdd(this, _diffPopup);
109
+ __privateAdd(this, _packageName);
110
+ __privateAdd(this, _routesPath);
111
+ __privateAdd(this, _makeMenuHandler, async (e) => {
112
+ const res = await api.post("/nine-mu/source/readFile", { path: __privateGet(this, _routesPath) });
113
+ trace.log(res);
114
+ const jsonRoutes = (res == null ? void 0 : res.contents) ? JSON.parse(res == null ? void 0 : res.contents) : {};
115
+ trace.log(jsonRoutes);
116
+ });
117
+ __privateAdd(this, _sourceGenHandler, async (e) => {
118
+ const command2 = "";
119
+ const targets = "";
120
+ try {
121
+ const result = await __privateGet(this, _service).generateAll(command2, targets, __privateGet(this, _routes));
122
+ $status.textContent = "✅ 완료";
123
+ nine.alert("소스 생성 성공").rgb();
124
+ this.dispatchEvent(new CustomEvent("nine-mu-completed", { detail: result, bubbles: true }));
125
+ } catch (err) {
126
+ $status.textContent = "❌ 실패";
127
+ nine.alert(err.message).rgb().shake();
128
+ }
129
+ });
109
130
  __publicField(this, "showDiff", (asis, tobe, lang) => {
110
131
  __privateGet(this, _diffPopup).popup().data(asis, tobe, lang);
111
132
  });
112
133
  this.attachShadow({ mode: "open" });
113
134
  }
114
135
  async connectedCallback() {
115
- var _a2;
136
+ __privateSet(this, _packageName, this.getAttribute("package-name"));
116
137
  const connectorUrl = this.getAttribute("connector-url") || "http://localhost:3002";
117
138
  __privateSet(this, _service, new NineMuService(connectorUrl));
118
139
  __privateMethod(this, _NineChat_instances, render_fn).call(this);
119
140
  __privateMethod(this, _NineChat_instances, initInteractions_fn).call(this);
120
141
  __privateMethod(this, _NineChat_instances, initActions_fn).call(this);
121
142
  const res = await api.post("/nine-mu/config/get", {});
122
- const routeUrl = (res == null ? void 0 : res.userDir) + "/" + this.getAttribute("package-name") + "/public/prompts/data/routes.json";
123
- trace.log(routeUrl);
124
- const res2 = await api.post("/nine-mu/source/readFile", { path: routeUrl });
125
- trace.log(res2);
126
- const asisSource = (_a2 = res2.contents) == null ? void 0 : _a2.json();
127
- trace.log(asisSource);
143
+ __privateSet(this, _routesPath, (res == null ? void 0 : res.userDir) + "/" + __privateGet(this, _packageName) + "/public/prompts/data/routes.json");
128
144
  __privateSet(this, _routes, await __privateGet(this, _service).fetchRoutes(this.getAttribute("route-url")));
129
145
  }
130
146
  }
131
147
  _service = new WeakMap();
132
148
  _routes = new WeakMap();
133
149
  _diffPopup = new WeakMap();
150
+ _packageName = new WeakMap();
151
+ _routesPath = new WeakMap();
134
152
  _NineChat_instances = new WeakSet();
135
153
  // --- [그룹 1: Interaction] 화면 토글 및 메뉴 클릭 ---
136
154
  initInteractions_fn = function() {
137
- var _a2;
155
+ var _a2, _b;
138
156
  const $settings = this.shadowRoot.querySelector("nine-ai-settings");
139
157
  const $menuIcons = this.shadowRoot.querySelectorAll("menu .menu-icon");
140
158
  const toggleUI = () => this.classList.toggle("collapse");
@@ -148,19 +166,8 @@ initInteractions_fn = function() {
148
166
  $settings.classList.toggle("expand", clicked.classList.contains("menu-setting"));
149
167
  });
150
168
  });
151
- (_a2 = this.shadowRoot.querySelector(".source-gen")) == null ? void 0 : _a2.addEventListener("click", async (e) => {
152
- const command2 = "";
153
- const targets = "";
154
- try {
155
- const result = await __privateGet(this, _service).generateAll(command2, targets, __privateGet(this, _routes));
156
- $status.textContent = "✅ 완료";
157
- nine.alert("소스 생성 성공").rgb();
158
- this.dispatchEvent(new CustomEvent("nine-mu-completed", { detail: result, bubbles: true }));
159
- } catch (err) {
160
- $status.textContent = "❌ 실패";
161
- nine.alert(err.message).rgb().shake();
162
- }
163
- });
169
+ (_a2 = this.shadowRoot.querySelector(".make-menu")) == null ? void 0 : _a2.addEventListener("click", __privateGet(this, _makeMenuHandler));
170
+ (_b = this.shadowRoot.querySelector(".source-gen")) == null ? void 0 : _b.addEventListener("click", __privateGet(this, _sourceGenHandler));
164
171
  };
165
172
  // --- [그룹 2: Action] 엔터키 입력 시 서비스 호출 ---
166
173
  initActions_fn = function() {
@@ -191,7 +198,7 @@ render_fn = function() {
191
198
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
192
199
  this.shadowRoot.innerHTML = `
193
200
  <style>
194
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.82"}/dist/css/nine-mu.css";
201
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.84"}/dist/css/nine-mu.css";
195
202
  ${customImport}
196
203
  </style>
197
204
  <div class="wrapper">
@@ -230,6 +237,8 @@ render_fn = function() {
230
237
  `;
231
238
  __privateSet(this, _diffPopup, this.shadowRoot.querySelector("nine-diff-popup"));
232
239
  };
240
+ _makeMenuHandler = new WeakMap();
241
+ _sourceGenHandler = new WeakMap();
233
242
  if (!customElements.get("nine-chat")) {
234
243
  customElements.define("nine-chat", NineChat);
235
244
  }
@@ -26407,7 +26416,7 @@ class NineDiff extends HTMLElement {
26407
26416
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
26408
26417
  this.shadowRoot.innerHTML = `
26409
26418
  <style>
26410
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.82"}/dist/css/nine-mu.css";
26419
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.84"}/dist/css/nine-mu.css";
26411
26420
  ${customImport}
26412
26421
  </style>
26413
26422
 
@@ -26517,7 +26526,7 @@ render_fn2 = function() {
26517
26526
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
26518
26527
  this.shadowRoot.innerHTML = `
26519
26528
  <style>
26520
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.82"}/dist/css/nine-mu.css";
26529
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.84"}/dist/css/nine-mu.css";
26521
26530
  ${customImport}
26522
26531
  </style>
26523
26532
 
@@ -26556,7 +26565,7 @@ handleCancel_fn = function() {
26556
26565
  };
26557
26566
  customElements.define("nine-diff-popup", NineDiffPopup);
26558
26567
  const NineMu = {
26559
- version: "0.1.82",
26568
+ version: "0.1.84",
26560
26569
  init: (config) => {
26561
26570
  trace.log("🛠️ Nine-Mu Engine initialized", config);
26562
26571
  }