@nine-lab/nine-mu 0.1.125 → 0.1.127

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nine-lab/nine-mu",
3
- "version": "0.1.125",
3
+ "version": "0.1.127",
4
4
  "description": "AI-Driven Full-Stack Code Fabrication Engine",
5
5
  "type": "module",
6
6
  "main": "./dist/nine-mu.umd.js",
@@ -70,9 +70,44 @@ export class NineChat extends HTMLElement {
70
70
  $textarea.addEventListener('keypress', async (e) => {
71
71
  if (e.key === 'Enter' && !e.shiftKey) {
72
72
  e.preventDefault();
73
- const command = e.target.value.trim();
74
- if (!command) return;
73
+ const userPrompt = e.target.value.trim();
74
+ if (!userPrompt) return;
75
75
 
76
+
77
+ try {
78
+ // 2. [핵심] MCP Client를 통해 AI에게 메시지 전달
79
+ // AI가 '메뉴 생성'이 필요하다고 판단하면 등록된 도구를 스스로 호출합니다.
80
+ const result = await this.#mcpClient.callTool({
81
+ name: "chat_agent", // 모든 요청을 처리하는 통합 에이전트 도구 (예시)
82
+ arguments: {
83
+ query: userPrompt,
84
+ context: {
85
+ routesPath: this.#routesPath,
86
+ packageName: this.#packageName,
87
+ targets: Array.from(this.shadowRoot.querySelectorAll('input[name="gen_target"]:checked')).map(el => el.value)
88
+ }
89
+ }
90
+ });
91
+
92
+ trace.log(result);
93
+
94
+ // 3. 응답 처리 (분석 결과가 오면 Diff 팝업 오픈)
95
+ const data = JSON.parse(result.content[0].text);
96
+
97
+ if (data.action === "SHOW_DIFF") {
98
+ this.#showDiff(data.asis, data.tobe, "json");
99
+ $status.textContent = "✅ 분석 완료";
100
+ } else {
101
+ // 일반 대화인 경우 채팅창에 표시 (nx-ai-chat 등 활용)
102
+ $status.textContent = "💬 답변 완료";
103
+ }
104
+
105
+ } catch (err) {
106
+ trace.error("AI 응답 실패:", err);
107
+ $status.textContent = "❌ 에러 발생";
108
+ }
109
+
110
+ /**
76
111
  // 1. UI 피드백
77
112
  $status.textContent = "⚙️ 공정 분석 중...";
78
113
  e.target.value = '';
@@ -93,7 +128,7 @@ export class NineChat extends HTMLElement {
93
128
  // 5. 실패 처리
94
129
  $status.textContent = "❌ 실패";
95
130
  nine.alert(err.message).rgb().shake();
96
- }
131
+ } */
97
132
  }
98
133
  });
99
134
  }
@@ -1,4 +1,4 @@
1
- import { trace } from "@nine-lab/nine-util";
1
+ import { trace } from '@nopeer';
2
2
 
3
3
  import {
4
4
  EditorView, lineNumbers, highlightSpecialChars, drawSelection,
@@ -1,4 +1,5 @@
1
- import { trace, api, nine } from '@nine-lab/nine-util';
1
+ import { trace } from '@nopeer';
2
+ import { api, nine } from '@nine-lab/nine-util';
2
3
  import '@nine-lab/nine-util';
3
4
 
4
5
  export class NineDiffPopup extends HTMLElement {
@@ -1,4 +1,5 @@
1
- import { nine, trace, api } from '@nine-lab/nine-util';
1
+ import { trace } from '@nopeer';
2
+ import { nine, api } from '@nine-lab/nine-util';
2
3
 
3
4
  export class NineMuService {
4
5
  constructor(connectorUrl) {
package/vite.config.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { defineConfig } from 'vite';
2
- import { resolve } from 'path';
3
- import path from 'path';
2
+ import path, { resolve } from 'path';
4
3
  import pkg from './package.json';
5
4
 
6
5
  export default defineConfig({