@nine-lab/nine-mu 0.1.201 β 0.1.203
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 +3664 -82
- package/dist/nine-mu.js.map +1 -1
- package/dist/nine-mu.umd.js +3 -3
- package/dist/nine-mu.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/NineChatManager.js +25 -48
package/package.json
CHANGED
|
@@ -47,71 +47,48 @@ export class NineChatManager {
|
|
|
47
47
|
.then( async () => {
|
|
48
48
|
this.#updateStatus("β
MCP Connected");
|
|
49
49
|
|
|
50
|
-
this.#mcpClient.onnotification = (notification) => {
|
|
51
|
-
trace.log("π μ€μκ° μλ¦Ό λμ°©:", notification);
|
|
52
|
-
|
|
53
|
-
if (notification?.method === "notifications/logging/message") {
|
|
54
|
-
try {
|
|
55
|
-
const logData = JSON.parse(notification.params.message);
|
|
56
|
-
|
|
57
|
-
if (logData.type === "BRAIN_DECISION") {
|
|
58
|
-
//this.#updateStatus("λΈλ μΈ λΆμ μμ μλ£");
|
|
59
|
-
|
|
60
|
-
// π‘ [νμΈ] μ£Όμμ νμ΄μ UI μ±μ°½μ λ©μμ§λ₯Ό κ½μμ€λλ€!
|
|
61
|
-
//this.#pushMessage('assistant', logData.message);
|
|
62
|
-
}
|
|
63
|
-
} catch (e) {
|
|
64
|
-
trace.warn("μλ¦Ό λ΄λΆ JSON νμ± μ€ν¨:", e);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
50
|
|
|
69
51
|
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (logData.type === "BRAIN_DECISION") {
|
|
79
|
-
//this.#pushMessage('assistant', logData.message);
|
|
80
|
-
}
|
|
81
|
-
} catch (e) {
|
|
82
|
-
trace.warn("μλ¦Ό νμ± μ€ν¨:", e);
|
|
52
|
+
transport._socket.onmessage = (event) => {
|
|
53
|
+
try {
|
|
54
|
+
trace.log(event);
|
|
55
|
+
const data = JSON.parse(event.data);
|
|
56
|
+
// λ°±μλκ° λ³΄λΈ μ°λ¦¬λ§μ λΉλ° νμμ΄ μλ€λ©΄?
|
|
57
|
+
if (data.isCustomLiveMessage) {
|
|
58
|
+
// UIμ μ€μκ° μ€κ° λ©νΈ κ½κΈ° λ!
|
|
59
|
+
//this.#pushMessage('assistant', data.message);
|
|
83
60
|
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
61
|
+
} catch(e) {}
|
|
62
|
+
};
|
|
63
|
+
*/
|
|
64
|
+
// 1οΈβ£ MCP κ·κ²© κΈ°λμ μν νΈλμ
°μ΄ν¬ νμ±ν
|
|
87
65
|
try {
|
|
88
66
|
await this.#mcpClient.request(
|
|
89
67
|
{ method: "logging/setLevel", params: { level: "info" } },
|
|
90
|
-
z.object({})
|
|
68
|
+
z.object({})
|
|
91
69
|
);
|
|
92
|
-
trace.log("π MCP λ‘κΉ
|
|
93
|
-
} catch (
|
|
94
|
-
trace.
|
|
70
|
+
trace.log("π MCP λ‘κΉ
μ±λ νμ±ν");
|
|
71
|
+
} catch (e) {
|
|
72
|
+
trace.warn("λ‘κΉ
μ±λ μ΄κΈ°ν ν¨μ€ (컀μ€ν
μ€νΈλ¦Ό λμ):", e);
|
|
95
73
|
}
|
|
96
74
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
//
|
|
100
|
-
|
|
75
|
+
// 2οΈβ£ [MCP μ κ³΅λ² λ³΅κ·] λλμ΄ μ μ μ€ν€λ§μ νΈλ€λ¬ κ΅¬μ‘°λ‘ λΉλΉνκ² λ±λ‘ν©λλ€!
|
|
76
|
+
this.#mcpClient.setNotificationHandler(
|
|
77
|
+
LoggingMessageNotificationSchema, // π μΈλΆ μν¬νΈν μ μ Zod μ€ν€λ§ κ°μ²΄
|
|
78
|
+
(notification) => {
|
|
101
79
|
try {
|
|
102
|
-
trace.log("π
|
|
103
|
-
const logData = JSON.parse(notification.params.message);
|
|
80
|
+
trace.log("π [MCP μ μ μμ§ μμ μ±κ³΅]:", notification);
|
|
104
81
|
|
|
82
|
+
const logData = JSON.parse(notification.params.message);
|
|
105
83
|
if (logData.type === "BRAIN_DECISION") {
|
|
106
|
-
//
|
|
84
|
+
// μ£Όμμ μμ ν νκ³ νλ©΄μ νλ€λ₯ λΏλ €μ€λλ€!
|
|
107
85
|
//this.#pushMessage('assistant', logData.message);
|
|
108
86
|
}
|
|
109
87
|
} catch (e) {
|
|
110
|
-
trace.warn("μλ¦Ό λ΄λΆ
|
|
88
|
+
trace.warn("μλ¦Ό λ΄λΆ λ°μ΄ν° νμ± μ€ν¨:", e);
|
|
111
89
|
}
|
|
112
90
|
}
|
|
113
|
-
|
|
114
|
-
*/
|
|
91
|
+
);
|
|
115
92
|
})
|
|
116
93
|
.catch((err) => {
|
|
117
94
|
trace.error("β MCP μ°κ²° μ€ν¨", err);
|