@nine-lab/nine-mu 0.1.129 → 0.1.131

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.129",
3
+ "version": "0.1.131",
4
4
  "description": "AI-Driven Full-Stack Code Fabrication Engine",
5
5
  "type": "module",
6
6
  "main": "./dist/nine-mu.umd.js",
@@ -70,45 +70,22 @@ 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 userPrompt = e.target.value.trim();
74
- if (!userPrompt) return;
73
+ const userInput = e.target.value.trim();
74
+ if (!userInput) return;
75
75
 
76
76
 
77
- try {
78
- // 2. [핵심] MCP Client를 통해 AI에게 메시지 전달
79
- // AI가 '메뉴 생성'이 필요하다고 판단하면 등록된 도구를 스스로 호출합니다.
80
- const result = await this.#mcpClient.callTool({
81
- name: "chat_agent",
82
- arguments: {
83
- // 🔴 여기를 확인하세요!
84
- // 서버 Zod 스키마가 { userInput: z.string() } 이므로 이름을 맞춰야 합니다.
85
- userInput: userPrompt,
86
-
87
- context: {
88
- routesPath: this.#routesPath,
89
- packageName: this.#packageName,
90
- genTargets: Array.from(this.shadowRoot.querySelectorAll('input[name="gen_target"]:checked')).map(el => el.value)
91
- }
92
- }
93
- });
94
-
95
- trace.log(result);
96
-
97
- // 3. 응답 처리 (분석 결과가 오면 Diff 팝업 오픈)
98
- const data = JSON.parse(result.content[0].text);
99
-
100
- if (data.action === "SHOW_DIFF") {
101
- this.#showDiff(data.asis, data.tobe, "json");
102
- $status.textContent = "✅ 분석 완료";
103
- } else {
104
- // 일반 대화인 경우 채팅창에 표시 (nx-ai-chat 등 활용)
105
- $status.textContent = "💬 답변 완료";
106
- }
77
+ // async onUserInput(userInput) {
78
+ // "어떤 툴을 써라"가 아니라 "이 질문을 해결해라"라고 던짐
79
+ // 그러면 AI가 목록 'analyze_menu_gap'이 적절한지 스스로 판단해서 실행함
80
+ const response = await this.#mcpClient.executeAgent(userInput);
81
+ console.log(response);
82
+ const result = JSON.parse(response.content[0].text);
83
+
84
+ // AI가 툴을 실행하고 가져온 결과(action) 따라 화면만 띄움
85
+ if (result.action === "SHOW_DIFF") this.openDiff(result);
86
+ //}
87
+
107
88
 
108
- } catch (err) {
109
- trace.error("AI 응답 실패:", err);
110
- $status.textContent = "❌ 에러 발생";
111
- }
112
89
 
113
90
  /**
114
91
  // 1. UI 피드백