@nine-lab/nine-mu 0.1.142 → 0.1.144

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