@nine-lab/nine-mu 0.1.138 → 0.1.140

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.138",
3
+ "version": "0.1.140",
4
4
  "description": "AI-Driven Full-Stack Code Fabrication Engine",
5
5
  "type": "module",
6
6
  "main": "./dist/nine-mu.umd.js",
@@ -23,7 +23,7 @@
23
23
  "devDependencies": {
24
24
  "@nine-lab/nine-ai": "*",
25
25
  "@nine-lab/nine-nomenu": "*",
26
- "@nine-lab/nine-util": "^0.9.123",
26
+ "@nine-lab/nine-util": "^0.9.126",
27
27
  "@nine-lab/nine-ux": "*",
28
28
  "terser": "^5.31.0",
29
29
  "vite": "^6.0.0"
@@ -4,7 +4,6 @@ import { trace, api, nine } from "@nine-lab/nine-util";
4
4
 
5
5
  export class NineChatManager {
6
6
  #client;
7
- #connectorUrl;
8
7
  #onAction;
9
8
  #onStatus;
10
9
  #onMessage; // UI에 메시지를 뿌려줄 콜백 추가
@@ -12,7 +11,6 @@ export class NineChatManager {
12
11
 
13
12
  constructor(owner, callbacks = {}) {
14
13
  this.#owner = owner;
15
- this.#connectorUrl = this.#owner.getAttribute('connector-url');
16
14
 
17
15
  // 콜백 함수들 연결
18
16
  this.#onAction = callbacks.onAction;
@@ -25,8 +23,30 @@ export class NineChatManager {
25
23
 
26
24
  async #connect() {
27
25
  if (this.#client) return;
26
+
27
+ const connectorUrl = this.#owner.getAttribute('connector-url');
28
+
29
+ const transport = new WebSocketClientTransport(new URL(connectorUrl));
30
+ this.#client = new Client({
31
+ name: "nine-mu-client", version: "1.0.0"
32
+ }, { capabilities: { tools: {} } });
33
+
34
+ // 전역 nine 객체의 safe를 활용 (try-catch 제거)
35
+ const [_, err] = await nine.safe(this.#client.connect(transport));
36
+
37
+ if (err) {
38
+ nine.trace.error("❌ MCP 연결 실패", err);
39
+ return this.#updateStatus("❌ Connection Failed");
40
+ }
41
+
42
+ this.#updateStatus("✅ MCP Connected");
43
+
44
+ return;
45
+
28
46
  try {
29
- const transport = new WebSocketClientTransport(new URL(this.#connectorUrl));
47
+ const connectorUrl = this.#owner.getAttribute('connector-url');
48
+
49
+ const transport = new WebSocketClientTransport(new URL(connectorUrl));
30
50
  this.#client = new Client({
31
51
  name: "nine-mu-client", version: "1.0.0"
32
52
  }, { capabilities: { tools: {} } });