@nine-lab/nine-mu 0.1.143 → 0.1.145
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 +31 -37
- 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/NineChat.js +2 -52
- package/src/components/NineChatManager.js +24 -27
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
|
|
12
|
+
var _mcpClient, _onAction, _onStatus, _onMessage, _owner, _NineChatManager_instances, connect_fn, fetchRoutes_fn, pushMessage_fn, updateStatus_fn, _getSourcePath, _service, _routes, _diffPopup, _packageName, _routesPath, _connectorUrl, _mcpClient2, _manager, _NineChat_instances, initInteractions_fn, initActions_fn, 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() {
|
|
@@ -12751,8 +12751,8 @@ class AjvJsonSchemaValidator {
|
|
|
12751
12751
|
}
|
|
12752
12752
|
}
|
|
12753
12753
|
class ExperimentalClientTasks {
|
|
12754
|
-
constructor(
|
|
12755
|
-
this._client =
|
|
12754
|
+
constructor(_client) {
|
|
12755
|
+
this._client = _client;
|
|
12756
12756
|
}
|
|
12757
12757
|
/**
|
|
12758
12758
|
* Calls a tool and returns an AsyncGenerator that yields response messages.
|
|
@@ -13505,12 +13505,24 @@ class WebSocketClientTransport {
|
|
|
13505
13505
|
class NineChatManager {
|
|
13506
13506
|
constructor(owner, callbacks = {}) {
|
|
13507
13507
|
__privateAdd(this, _NineChatManager_instances);
|
|
13508
|
-
__privateAdd(this,
|
|
13508
|
+
__privateAdd(this, _mcpClient);
|
|
13509
13509
|
__privateAdd(this, _onAction);
|
|
13510
13510
|
__privateAdd(this, _onStatus);
|
|
13511
13511
|
__privateAdd(this, _onMessage);
|
|
13512
13512
|
// UI에 메시지를 뿌려줄 콜백 추가
|
|
13513
13513
|
__privateAdd(this, _owner);
|
|
13514
|
+
__publicField(this, "handleChatSubmit", async (el) => {
|
|
13515
|
+
trace$1.log(__privateGet(this, _mcpClient));
|
|
13516
|
+
const response = await __privateGet(this, _mcpClient).callTool({
|
|
13517
|
+
name: "ask_nine_engine",
|
|
13518
|
+
arguments: {
|
|
13519
|
+
prompt: el.value.trim(),
|
|
13520
|
+
routes: []
|
|
13521
|
+
// 현재 화면의 메뉴 정보
|
|
13522
|
+
}
|
|
13523
|
+
});
|
|
13524
|
+
console.log(response);
|
|
13525
|
+
});
|
|
13514
13526
|
__privateSet(this, _owner, owner);
|
|
13515
13527
|
__privateSet(this, _onAction, callbacks.onAction);
|
|
13516
13528
|
__privateSet(this, _onStatus, callbacks.onStatus);
|
|
@@ -13519,13 +13531,13 @@ class NineChatManager {
|
|
|
13519
13531
|
}
|
|
13520
13532
|
/** 메인 실행 함수 */
|
|
13521
13533
|
async ask(userInput) {
|
|
13522
|
-
if (!__privateGet(this,
|
|
13534
|
+
if (!__privateGet(this, _mcpClient)) {
|
|
13523
13535
|
await this.connect();
|
|
13524
13536
|
}
|
|
13525
13537
|
try {
|
|
13526
13538
|
__privateMethod(this, _NineChatManager_instances, pushMessage_fn).call(this, "user", userInput);
|
|
13527
13539
|
const routes = await __privateMethod(this, _NineChatManager_instances, fetchRoutes_fn).call(this);
|
|
13528
|
-
const response = await __privateGet(this,
|
|
13540
|
+
const response = await __privateGet(this, _mcpClient).callTool({
|
|
13529
13541
|
name: "system-brain",
|
|
13530
13542
|
arguments: {
|
|
13531
13543
|
user_input: userInput,
|
|
@@ -13559,28 +13571,27 @@ class NineChatManager {
|
|
|
13559
13571
|
}
|
|
13560
13572
|
}
|
|
13561
13573
|
}
|
|
13562
|
-
|
|
13574
|
+
_mcpClient = new WeakMap();
|
|
13563
13575
|
_onAction = new WeakMap();
|
|
13564
13576
|
_onStatus = new WeakMap();
|
|
13565
13577
|
_onMessage = new WeakMap();
|
|
13566
13578
|
_owner = new WeakMap();
|
|
13567
13579
|
_NineChatManager_instances = new WeakSet();
|
|
13568
13580
|
connect_fn = async function() {
|
|
13569
|
-
if (__privateGet(this,
|
|
13581
|
+
if (__privateGet(this, _mcpClient)) return;
|
|
13570
13582
|
const connectorUrl = __privateGet(this, _owner).getAttribute("connector-url");
|
|
13571
13583
|
const transport = new WebSocketClientTransport(new URL(connectorUrl));
|
|
13572
|
-
__privateSet(this,
|
|
13584
|
+
__privateSet(this, _mcpClient, new Client({
|
|
13573
13585
|
name: "nine-mu-client",
|
|
13574
13586
|
version: "1.0.0"
|
|
13575
13587
|
}, { capabilities: { tools: {} } }));
|
|
13576
|
-
trace$1.log(
|
|
13577
|
-
__privateGet(this,
|
|
13588
|
+
trace$1.log(__privateGet(this, _mcpClient));
|
|
13589
|
+
__privateGet(this, _mcpClient).connect(transport).then(() => {
|
|
13578
13590
|
__privateMethod(this, _NineChatManager_instances, updateStatus_fn).call(this, "✅ MCP Connected");
|
|
13579
13591
|
}).catch((err) => {
|
|
13580
13592
|
trace$1.error("❌ MCP 연결 실패", err);
|
|
13581
13593
|
__privateMethod(this, _NineChatManager_instances, updateStatus_fn).call(this, "❌ Connection Failed");
|
|
13582
13594
|
});
|
|
13583
|
-
return;
|
|
13584
13595
|
};
|
|
13585
13596
|
fetchRoutes_fn = async function() {
|
|
13586
13597
|
const r = await fetch("/admin/prompts/data/routes.json");
|
|
@@ -13700,23 +13711,8 @@ class NineChat extends HTMLElement {
|
|
|
13700
13711
|
__privateAdd(this, _packageName);
|
|
13701
13712
|
__privateAdd(this, _routesPath);
|
|
13702
13713
|
__privateAdd(this, _connectorUrl);
|
|
13703
|
-
__privateAdd(this,
|
|
13714
|
+
__privateAdd(this, _mcpClient2);
|
|
13704
13715
|
__privateAdd(this, _manager);
|
|
13705
|
-
__privateAdd(this, _initMcp, async () => {
|
|
13706
|
-
if (__privateGet(this, _mcpClient)) return;
|
|
13707
|
-
try {
|
|
13708
|
-
const transport = new WebSocketClientTransport(new URL(__privateGet(this, _connectorUrl)));
|
|
13709
|
-
__privateSet(this, _mcpClient, new Client({
|
|
13710
|
-
name: "nine-mcp-client",
|
|
13711
|
-
version: "1.0.0"
|
|
13712
|
-
}, { capabilities: { tools: {} } }));
|
|
13713
|
-
trace.log("Connecting to MCP via WebSocket...");
|
|
13714
|
-
await __privateGet(this, _mcpClient).connect(transport);
|
|
13715
|
-
trace.log("✅ Nine MCP Connected (WebSocket)");
|
|
13716
|
-
} catch (err) {
|
|
13717
|
-
trace.error("❌ MCP 초기화 에러:", err);
|
|
13718
|
-
}
|
|
13719
|
-
});
|
|
13720
13716
|
__privateAdd(this, _makeMenuHandler, async (e) => {
|
|
13721
13717
|
const prompt = await nine.prompt("메뉴생성시 필요한 AI 프롬프트를 입력하세요.").rgb();
|
|
13722
13718
|
if (prompt === null || prompt === void 0) return;
|
|
@@ -13758,7 +13754,6 @@ class NineChat extends HTMLElement {
|
|
|
13758
13754
|
__privateMethod(this, _NineChat_instances, render_fn).call(this);
|
|
13759
13755
|
__privateMethod(this, _NineChat_instances, initInteractions_fn).call(this);
|
|
13760
13756
|
__privateMethod(this, _NineChat_instances, initActions_fn).call(this);
|
|
13761
|
-
__privateGet(this, _initMcp).call(this);
|
|
13762
13757
|
const res = await api.post("/nine-mu/config/get", {});
|
|
13763
13758
|
__privateSet(this, _routesPath, (res == null ? void 0 : res.userDir) + "/" + __privateGet(this, _packageName) + "/public/prompts/data/routes.json");
|
|
13764
13759
|
__privateSet(this, _routes, await __privateGet(this, _service).fetchRoutes(this.getAttribute("route-url")));
|
|
@@ -13771,7 +13766,7 @@ _diffPopup = new WeakMap();
|
|
|
13771
13766
|
_packageName = new WeakMap();
|
|
13772
13767
|
_routesPath = new WeakMap();
|
|
13773
13768
|
_connectorUrl = new WeakMap();
|
|
13774
|
-
|
|
13769
|
+
_mcpClient2 = new WeakMap();
|
|
13775
13770
|
_manager = new WeakMap();
|
|
13776
13771
|
_NineChat_instances = new WeakSet();
|
|
13777
13772
|
// --- [그룹 1: Interaction] 화면 토글 및 메뉴 클릭 ---
|
|
@@ -13796,13 +13791,13 @@ initInteractions_fn = function() {
|
|
|
13796
13791
|
// --- [그룹 2: Action] 엔터키 입력 시 서비스 호출 ---
|
|
13797
13792
|
initActions_fn = function() {
|
|
13798
13793
|
const $textarea = this.shadowRoot.querySelector("#q");
|
|
13799
|
-
this.shadowRoot.querySelector("#status-tag");
|
|
13800
13794
|
$textarea.addEventListener("keypress", async (e) => {
|
|
13801
13795
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
13802
13796
|
e.preventDefault();
|
|
13803
13797
|
const userInput = e.target.value.trim();
|
|
13804
13798
|
if (!userInput) return;
|
|
13805
|
-
|
|
13799
|
+
await __privateGet(this, _manager).handleChatSubmit($textarea);
|
|
13800
|
+
const response = await __privateGet(this, _mcpClient2).callTool({
|
|
13806
13801
|
name: "ask_nine_engine",
|
|
13807
13802
|
arguments: {
|
|
13808
13803
|
prompt: userInput,
|
|
@@ -13816,13 +13811,12 @@ initActions_fn = function() {
|
|
|
13816
13811
|
}
|
|
13817
13812
|
});
|
|
13818
13813
|
};
|
|
13819
|
-
_initMcp = new WeakMap();
|
|
13820
13814
|
render_fn = function() {
|
|
13821
13815
|
const placeholder = this.getAttribute("placeholder") || "나에게 무엇이든 물어봐...";
|
|
13822
13816
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
13823
13817
|
this.shadowRoot.innerHTML = `
|
|
13824
13818
|
<style>
|
|
13825
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
13819
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.144"}/dist/css/nine-mu.css";
|
|
13826
13820
|
${customImport}
|
|
13827
13821
|
</style>
|
|
13828
13822
|
<div class="wrapper">
|
|
@@ -40040,7 +40034,7 @@ class NineDiff extends HTMLElement {
|
|
|
40040
40034
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
40041
40035
|
this.shadowRoot.innerHTML = `
|
|
40042
40036
|
<style>
|
|
40043
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
40037
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.144"}/dist/css/nine-mu.css";
|
|
40044
40038
|
${customImport}
|
|
40045
40039
|
</style>
|
|
40046
40040
|
|
|
@@ -40150,7 +40144,7 @@ render_fn2 = function() {
|
|
|
40150
40144
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
40151
40145
|
this.shadowRoot.innerHTML = `
|
|
40152
40146
|
<style>
|
|
40153
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
40147
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.144"}/dist/css/nine-mu.css";
|
|
40154
40148
|
${customImport}
|
|
40155
40149
|
</style>
|
|
40156
40150
|
|
|
@@ -40189,7 +40183,7 @@ handleCancel_fn = function() {
|
|
|
40189
40183
|
};
|
|
40190
40184
|
customElements.define("nine-diff-popup", NineDiffPopup);
|
|
40191
40185
|
const NineMu = {
|
|
40192
|
-
version: "0.1.
|
|
40186
|
+
version: "0.1.144",
|
|
40193
40187
|
init: (config2) => {
|
|
40194
40188
|
trace$1.log("🛠️ Nine-Mu Engine initialized", config2);
|
|
40195
40189
|
}
|