@nine-lab/nine-mu 0.1.134 → 0.1.136

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.
@@ -172,7 +172,7 @@
172
172
  }
173
173
 
174
174
  .foot {
175
- margin-bottom: 32px;
175
+ margin-bottom: 4px;
176
176
  width: 100%;
177
177
  height: 200px;
178
178
  --background: #f0f0f0;
@@ -198,6 +198,8 @@
198
198
  border-radius: 8px;
199
199
  resize: none;
200
200
  padding: 8px;
201
+ background: white;
202
+ color: #333;
201
203
  }
202
204
  textarea:hover {
203
205
  border: 1px solid #999;
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, _packageName, _routesPath, _connectorUrl, _mcpClient, _NineChat_instances, initInteractions_fn, initActions_fn, _initMcp, 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;
12
+ var _client, _connectorUrl, _onAction, _onStatus, _onMessage, _owner, _NineChatManager_instances, fetchRoutes_fn, pushMessage_fn, updateStatus_fn, _getSourcePath, _service, _routes, _diffPopup, _packageName, _routesPath, _connectorUrl2, _mcpClient, _manager, _NineChat_instances, initInteractions_fn, initActions_fn, _initMcp, 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;
13
13
  import { trace as trace$1, api, nine } from "@nine-lab/nine-util";
14
14
  class Trace extends trace$1.constructor {
15
15
  constructor() {
@@ -18,94 +18,6 @@ class Trace extends trace$1.constructor {
18
18
  }
19
19
  }
20
20
  const trace = new Trace();
21
- class NineMuService {
22
- constructor(connectorUrl) {
23
- __privateAdd(this, _getSourcePath, (menuUrl) => {
24
- return null;
25
- });
26
- this.connectorUrl = connectorUrl;
27
- }
28
- /**
29
- * AI 소스 생성 실행
30
- * @param {string} command - 사용자 입력 명령
31
- * @param {Array} targets - 체크된 생성 대상 (MyBatis, Service 등)
32
- * @param {Array} currentRoutes - 현재 프로젝트 경로 정보
33
- */
34
- async generate(command2, targets, currentRoutes) {
35
- try {
36
- trace.log(`공정 시작: "${command2}" [대상: ${targets.join(", ")}]`);
37
- const response = await fetch(`${this.connectorUrl}/api/mu/generate`, {
38
- method: "POST",
39
- headers: { "Content-Type": "application/json" },
40
- body: JSON.stringify({
41
- command: command2,
42
- targets,
43
- projectType: "spring-react",
44
- currentRoutes
45
- })
46
- });
47
- const result = await response.json();
48
- if (!result.success) {
49
- throw new Error(result.error || "소스 생성 중 서버 오류가 발생했습니다.");
50
- }
51
- return result;
52
- } catch (error) {
53
- trace.error("NineMu Service Error:", error);
54
- throw error;
55
- }
56
- }
57
- async generateAll(command2) {
58
- }
59
- async generateAll_BAK(command2, targets, currentRoutes) {
60
- try {
61
- trace.log(`공정 시작: "${command2}" [대상: ${targets.join(", ")}]`);
62
- const srcPath = __privateGet(this, _getSourcePath).call(this, "/admin/payment/order-list");
63
- const srcPath1 = {
64
- mybatis: "",
65
- servicePullPath: "",
66
- controllerPullPath: "",
67
- javascriptFrom: "",
68
- javascriptTo: ""
69
- };
70
- trace.log(srcPath);
71
- const src = await api.post("/nine-ai/source/read", srcPath);
72
- trace.log(src);
73
- const response = await fetch(`${this.connectorUrl}/api/mu/generateAll`, {
74
- method: "POST",
75
- headers: { "Content-Type": "application/json" },
76
- body: JSON.stringify({
77
- //command,
78
- //targets,
79
- projectType: "spring-react"
80
- //currentRoutes
81
- })
82
- });
83
- trace.log(response);
84
- const result = await response.json();
85
- if (!result.success) {
86
- throw new Error(result.error || "소스 생성 중 서버 오류가 발생했습니다.");
87
- }
88
- return result;
89
- } catch (error) {
90
- trace.error("NineMu Service Error:", error);
91
- throw error;
92
- }
93
- }
94
- /**
95
- * 초기 경로 정보 로드
96
- */
97
- async fetchRoutes(routeUrl) {
98
- if (!routeUrl) return [];
99
- try {
100
- const res = await fetch(routeUrl);
101
- return await res.json();
102
- } catch (err) {
103
- trace.error("Route load fail", err);
104
- return [];
105
- }
106
- }
107
- }
108
- _getSourcePath = new WeakMap();
109
21
  function $constructor(name2, initializer2, params) {
110
22
  function init(inst, def) {
111
23
  var _a2;
@@ -12839,8 +12751,8 @@ class AjvJsonSchemaValidator {
12839
12751
  }
12840
12752
  }
12841
12753
  class ExperimentalClientTasks {
12842
- constructor(_client) {
12843
- this._client = _client;
12754
+ constructor(_client2) {
12755
+ this._client = _client2;
12844
12756
  }
12845
12757
  /**
12846
12758
  * Calls a tool and returns an AsyncGenerator that yields response messages.
@@ -13590,6 +13502,195 @@ class WebSocketClientTransport {
13590
13502
  });
13591
13503
  }
13592
13504
  }
13505
+ class NineChatManager {
13506
+ constructor(owner, callbacks = {}) {
13507
+ __privateAdd(this, _NineChatManager_instances);
13508
+ __privateAdd(this, _client);
13509
+ __privateAdd(this, _connectorUrl);
13510
+ __privateAdd(this, _onAction);
13511
+ __privateAdd(this, _onStatus);
13512
+ __privateAdd(this, _onMessage);
13513
+ // UI에 메시지를 뿌려줄 콜백 추가
13514
+ __privateAdd(this, _owner);
13515
+ __privateSet(this, _owner, owner);
13516
+ __privateSet(this, _connectorUrl, __privateGet(this, _owner).getAttribute("connector-url"));
13517
+ __privateSet(this, _onAction, callbacks.onAction);
13518
+ __privateSet(this, _onStatus, callbacks.onStatus);
13519
+ __privateSet(this, _onMessage, callbacks.onMessage);
13520
+ this.connect();
13521
+ }
13522
+ async connect() {
13523
+ if (__privateGet(this, _client)) return;
13524
+ try {
13525
+ const transport = new WebSocketClientTransport(new URL(__privateGet(this, _connectorUrl)));
13526
+ __privateSet(this, _client, new Client({
13527
+ name: "nine-mu-client",
13528
+ version: "1.0.0"
13529
+ }, { capabilities: { tools: {} } }));
13530
+ await __privateGet(this, _client).connect(transport);
13531
+ __privateMethod(this, _NineChatManager_instances, updateStatus_fn).call(this, "✅ MCP Connected");
13532
+ } catch (err) {
13533
+ trace$1.error("❌ Orchestrator Connection Failed", err);
13534
+ __privateMethod(this, _NineChatManager_instances, updateStatus_fn).call(this, "❌ Connection Failed");
13535
+ }
13536
+ }
13537
+ /** 메인 실행 함수 */
13538
+ async ask(userInput) {
13539
+ if (!__privateGet(this, _client)) {
13540
+ await this.connect();
13541
+ }
13542
+ try {
13543
+ __privateMethod(this, _NineChatManager_instances, pushMessage_fn).call(this, "user", userInput);
13544
+ const routes = await __privateMethod(this, _NineChatManager_instances, fetchRoutes_fn).call(this);
13545
+ const response = await __privateGet(this, _client).callTool({
13546
+ name: "system-brain",
13547
+ arguments: {
13548
+ user_input: userInput,
13549
+ routes,
13550
+ current_path: window.location.pathname
13551
+ // 실시간 경로 주입
13552
+ }
13553
+ });
13554
+ const result = JSON.parse(response.content[0].text);
13555
+ console.log("AI Response:", result);
13556
+ __privateMethod(this, _NineChatManager_instances, pushMessage_fn).call(this, "assistant", result.message, result);
13557
+ if (__privateGet(this, _onAction)) __privateGet(this, _onAction).call(this, result);
13558
+ __privateMethod(this, _NineChatManager_instances, updateStatus_fn).call(this, "준비 완료");
13559
+ } catch (err) {
13560
+ trace$1.error("❌ Ask Error:", err);
13561
+ __privateMethod(this, _NineChatManager_instances, pushMessage_fn).call(this, "assistant", "분석 중 오류가 발생했습니다.");
13562
+ __privateMethod(this, _NineChatManager_instances, updateStatus_fn).call(this, "에러 발생");
13563
+ }
13564
+ }
13565
+ /** 데이터 수집 (클라이언트 클릭 한방용) */
13566
+ async collect(type2) {
13567
+ var _a2;
13568
+ __privateMethod(this, _NineChatManager_instances, updateStatus_fn).call(this, `${type2} 데이터 수집 중...`);
13569
+ switch (type2) {
13570
+ case "SOURCE":
13571
+ return ((_a2 = window == null ? void 0 : window.nineEditor) == null ? void 0 : _a2.getValue()) || "/* 소스를 찾을 수 없습니다 */";
13572
+ case "DDL":
13573
+ return "/* DDL 정보가 수집되었습니다 */";
13574
+ default:
13575
+ return "";
13576
+ }
13577
+ }
13578
+ }
13579
+ _client = new WeakMap();
13580
+ _connectorUrl = new WeakMap();
13581
+ _onAction = new WeakMap();
13582
+ _onStatus = new WeakMap();
13583
+ _onMessage = new WeakMap();
13584
+ _owner = new WeakMap();
13585
+ _NineChatManager_instances = new WeakSet();
13586
+ fetchRoutes_fn = async function() {
13587
+ const r = await fetch("/admin/prompts/data/routes.json");
13588
+ return r.ok ? await r.json() : [];
13589
+ };
13590
+ pushMessage_fn = function(role, content2, result = null) {
13591
+ var _a2;
13592
+ if (__privateGet(this, _onMessage)) {
13593
+ __privateGet(this, _onMessage).call(this, {
13594
+ role,
13595
+ content: content2,
13596
+ intent: result == null ? void 0 : result.intent,
13597
+ required_args: (_a2 = result == null ? void 0 : result.action) == null ? void 0 : _a2.required_args,
13598
+ action: result == null ? void 0 : result.action
13599
+ });
13600
+ }
13601
+ };
13602
+ updateStatus_fn = function(msg) {
13603
+ if (__privateGet(this, _onStatus)) __privateGet(this, _onStatus).call(this, msg);
13604
+ trace$1.log(`[Status]: ${msg}`);
13605
+ };
13606
+ class NineMuService {
13607
+ constructor(connectorUrl) {
13608
+ __privateAdd(this, _getSourcePath, (menuUrl) => {
13609
+ return null;
13610
+ });
13611
+ this.connectorUrl = connectorUrl;
13612
+ }
13613
+ /**
13614
+ * AI 소스 생성 실행
13615
+ * @param {string} command - 사용자 입력 명령
13616
+ * @param {Array} targets - 체크된 생성 대상 (MyBatis, Service 등)
13617
+ * @param {Array} currentRoutes - 현재 프로젝트 경로 정보
13618
+ */
13619
+ async generate(command2, targets, currentRoutes) {
13620
+ try {
13621
+ trace.log(`공정 시작: "${command2}" [대상: ${targets.join(", ")}]`);
13622
+ const response = await fetch(`${this.connectorUrl}/api/mu/generate`, {
13623
+ method: "POST",
13624
+ headers: { "Content-Type": "application/json" },
13625
+ body: JSON.stringify({
13626
+ command: command2,
13627
+ targets,
13628
+ projectType: "spring-react",
13629
+ currentRoutes
13630
+ })
13631
+ });
13632
+ const result = await response.json();
13633
+ if (!result.success) {
13634
+ throw new Error(result.error || "소스 생성 중 서버 오류가 발생했습니다.");
13635
+ }
13636
+ return result;
13637
+ } catch (error) {
13638
+ trace.error("NineMu Service Error:", error);
13639
+ throw error;
13640
+ }
13641
+ }
13642
+ async generateAll(command2) {
13643
+ }
13644
+ async generateAll_BAK(command2, targets, currentRoutes) {
13645
+ try {
13646
+ trace.log(`공정 시작: "${command2}" [대상: ${targets.join(", ")}]`);
13647
+ const srcPath = __privateGet(this, _getSourcePath).call(this, "/admin/payment/order-list");
13648
+ const srcPath1 = {
13649
+ mybatis: "",
13650
+ servicePullPath: "",
13651
+ controllerPullPath: "",
13652
+ javascriptFrom: "",
13653
+ javascriptTo: ""
13654
+ };
13655
+ trace.log(srcPath);
13656
+ const src = await api.post("/nine-ai/source/read", srcPath);
13657
+ trace.log(src);
13658
+ const response = await fetch(`${this.connectorUrl}/api/mu/generateAll`, {
13659
+ method: "POST",
13660
+ headers: { "Content-Type": "application/json" },
13661
+ body: JSON.stringify({
13662
+ //command,
13663
+ //targets,
13664
+ projectType: "spring-react"
13665
+ //currentRoutes
13666
+ })
13667
+ });
13668
+ trace.log(response);
13669
+ const result = await response.json();
13670
+ if (!result.success) {
13671
+ throw new Error(result.error || "소스 생성 중 서버 오류가 발생했습니다.");
13672
+ }
13673
+ return result;
13674
+ } catch (error) {
13675
+ trace.error("NineMu Service Error:", error);
13676
+ throw error;
13677
+ }
13678
+ }
13679
+ /**
13680
+ * 초기 경로 정보 로드
13681
+ */
13682
+ async fetchRoutes(routeUrl) {
13683
+ if (!routeUrl) return [];
13684
+ try {
13685
+ const res = await fetch(routeUrl);
13686
+ return await res.json();
13687
+ } catch (err) {
13688
+ trace.error("Route load fail", err);
13689
+ return [];
13690
+ }
13691
+ }
13692
+ }
13693
+ _getSourcePath = new WeakMap();
13593
13694
  class NineChat extends HTMLElement {
13594
13695
  constructor() {
13595
13696
  super();
@@ -13599,12 +13700,13 @@ class NineChat extends HTMLElement {
13599
13700
  __privateAdd(this, _diffPopup);
13600
13701
  __privateAdd(this, _packageName);
13601
13702
  __privateAdd(this, _routesPath);
13602
- __privateAdd(this, _connectorUrl);
13703
+ __privateAdd(this, _connectorUrl2);
13603
13704
  __privateAdd(this, _mcpClient);
13705
+ __privateAdd(this, _manager);
13604
13706
  __privateAdd(this, _initMcp, async () => {
13605
13707
  if (__privateGet(this, _mcpClient)) return;
13606
13708
  try {
13607
- const transport = new WebSocketClientTransport(new URL(__privateGet(this, _connectorUrl)));
13709
+ const transport = new WebSocketClientTransport(new URL(__privateGet(this, _connectorUrl2)));
13608
13710
  __privateSet(this, _mcpClient, new Client({
13609
13711
  name: "nine-mcp-client",
13610
13712
  version: "1.0.0"
@@ -13624,7 +13726,7 @@ class NineChat extends HTMLElement {
13624
13726
  if (!res || !(res == null ? void 0 : res.contents)) return;
13625
13727
  const jsonRoutes = (res == null ? void 0 : res.contents) ? JSON.parse(res == null ? void 0 : res.contents) : {};
13626
13728
  trace.log(jsonRoutes);
13627
- const res2 = await api.post(`${__privateGet(this, _connectorUrl)}/api/source/missing`, {
13729
+ const res2 = await api.post(`${__privateGet(this, _connectorUrl2)}/api/source/missing`, {
13628
13730
  routes: jsonRoutes,
13629
13731
  prompt
13630
13732
  });
@@ -13652,8 +13754,8 @@ class NineChat extends HTMLElement {
13652
13754
  }
13653
13755
  async connectedCallback() {
13654
13756
  __privateSet(this, _packageName, this.getAttribute("package-name"));
13655
- __privateSet(this, _connectorUrl, this.getAttribute("connector-url") || "http://localhost:3002");
13656
- __privateSet(this, _service, new NineMuService(__privateGet(this, _connectorUrl)));
13757
+ __privateSet(this, _connectorUrl2, this.getAttribute("connector-url") || "http://localhost:3002");
13758
+ __privateSet(this, _service, new NineMuService(__privateGet(this, _connectorUrl2)));
13657
13759
  __privateMethod(this, _NineChat_instances, render_fn).call(this);
13658
13760
  __privateMethod(this, _NineChat_instances, initInteractions_fn).call(this);
13659
13761
  __privateMethod(this, _NineChat_instances, initActions_fn).call(this);
@@ -13661,6 +13763,7 @@ class NineChat extends HTMLElement {
13661
13763
  const res = await api.post("/nine-mu/config/get", {});
13662
13764
  __privateSet(this, _routesPath, (res == null ? void 0 : res.userDir) + "/" + __privateGet(this, _packageName) + "/public/prompts/data/routes.json");
13663
13765
  __privateSet(this, _routes, await __privateGet(this, _service).fetchRoutes(this.getAttribute("route-url")));
13766
+ __privateSet(this, _manager, new NineChatManager(this));
13664
13767
  }
13665
13768
  }
13666
13769
  _service = new WeakMap();
@@ -13668,8 +13771,9 @@ _routes = new WeakMap();
13668
13771
  _diffPopup = new WeakMap();
13669
13772
  _packageName = new WeakMap();
13670
13773
  _routesPath = new WeakMap();
13671
- _connectorUrl = new WeakMap();
13774
+ _connectorUrl2 = new WeakMap();
13672
13775
  _mcpClient = new WeakMap();
13776
+ _manager = new WeakMap();
13673
13777
  _NineChat_instances = new WeakSet();
13674
13778
  // --- [그룹 1: Interaction] 화면 토글 및 메뉴 클릭 ---
13675
13779
  initInteractions_fn = function() {
@@ -13719,7 +13823,7 @@ render_fn = function() {
13719
13823
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
13720
13824
  this.shadowRoot.innerHTML = `
13721
13825
  <style>
13722
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.133"}/dist/css/nine-mu.css";
13826
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.135"}/dist/css/nine-mu.css";
13723
13827
  ${customImport}
13724
13828
  </style>
13725
13829
  <div class="wrapper">
@@ -39937,7 +40041,7 @@ class NineDiff extends HTMLElement {
39937
40041
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
39938
40042
  this.shadowRoot.innerHTML = `
39939
40043
  <style>
39940
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.133"}/dist/css/nine-mu.css";
40044
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.135"}/dist/css/nine-mu.css";
39941
40045
  ${customImport}
39942
40046
  </style>
39943
40047
 
@@ -40047,7 +40151,7 @@ render_fn2 = function() {
40047
40151
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
40048
40152
  this.shadowRoot.innerHTML = `
40049
40153
  <style>
40050
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.133"}/dist/css/nine-mu.css";
40154
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.135"}/dist/css/nine-mu.css";
40051
40155
  ${customImport}
40052
40156
  </style>
40053
40157
 
@@ -40086,7 +40190,7 @@ handleCancel_fn = function() {
40086
40190
  };
40087
40191
  customElements.define("nine-diff-popup", NineDiffPopup);
40088
40192
  const NineMu = {
40089
- version: "0.1.133",
40193
+ version: "0.1.135",
40090
40194
  init: (config2) => {
40091
40195
  trace$1.log("🛠️ Nine-Mu Engine initialized", config2);
40092
40196
  }