@nine-lab/nine-mu 0.1.185 β 0.1.187
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 +21 -60
- 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 +23 -70
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 _mcpClient, _onAction, _onStatus, _onMessage, _owner, _routeUrl, _NineChatManager_instances, connect_fn,
|
|
12
|
+
var _mcpClient, _onAction, _onStatus, _onMessage, _owner, _routeUrl, _chatHistory, _NineChatManager_instances, connect_fn, updateStatus_fn, callTool_fn, getRoutes_fn, _getSourcePath, _service, _routes, _diffPopup, _packageName, _routesPath, _connectorUrl, _manager, _$nineChatMessage, _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, _message, _data, _unique, _init, _message2, _init2, _progressData, _progressElements, _animationIntervals, _ProgressMessage_instances, updateCurrentActiveProgress_fn, renderProgress_fn, updateProgressItemVisuals_fn, startAnimation_fn, updateProgressItem_fn, _renderer, _init3;
|
|
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() {
|
|
@@ -13503,6 +13503,7 @@ class WebSocketClientTransport {
|
|
|
13503
13503
|
}
|
|
13504
13504
|
}
|
|
13505
13505
|
class NineChatManager {
|
|
13506
|
+
// π‘ μ΄μ λνλ€μ μ μ₯ν λ©λͺ¨λ¦¬ μ°½κ³
|
|
13506
13507
|
constructor(owner, callbacks = {}) {
|
|
13507
13508
|
__privateAdd(this, _NineChatManager_instances);
|
|
13508
13509
|
__privateAdd(this, _mcpClient);
|
|
@@ -13513,16 +13514,17 @@ class NineChatManager {
|
|
|
13513
13514
|
__privateAdd(this, _owner);
|
|
13514
13515
|
__privateAdd(this, _routeUrl);
|
|
13515
13516
|
__privateAdd(this, _chatHistory, []);
|
|
13516
|
-
__publicField(this, "handleChatSubmit", async (
|
|
13517
|
-
__privateGet(this, _chatHistory).push({ role: "user", text:
|
|
13517
|
+
__publicField(this, "handleChatSubmit", async (userInput) => {
|
|
13518
|
+
__privateGet(this, _chatHistory).push({ role: "user", text: userInput });
|
|
13518
13519
|
const formattedHistory = __privateGet(this, _chatHistory).map((chat) => {
|
|
13519
13520
|
return chat.role === "user" ? `User: ${chat.text}` : `AI: ${chat.text}`;
|
|
13520
13521
|
}).join("\n");
|
|
13522
|
+
const currentPath = window.location.pathname;
|
|
13521
13523
|
return await __privateMethod(this, _NineChatManager_instances, callTool_fn).call(this, "system-brain", {
|
|
13522
|
-
user_input:
|
|
13524
|
+
user_input: userInput,
|
|
13523
13525
|
chat_history: formattedHistory,
|
|
13524
13526
|
routes: await __privateMethod(this, _NineChatManager_instances, getRoutes_fn).call(this),
|
|
13525
|
-
current_path:
|
|
13527
|
+
current_path: currentPath
|
|
13526
13528
|
});
|
|
13527
13529
|
});
|
|
13528
13530
|
__privateSet(this, _owner, owner);
|
|
@@ -13532,34 +13534,6 @@ class NineChatManager {
|
|
|
13532
13534
|
__privateSet(this, _onMessage, callbacks.onMessage);
|
|
13533
13535
|
__privateMethod(this, _NineChatManager_instances, connect_fn).call(this);
|
|
13534
13536
|
}
|
|
13535
|
-
/** λ©μΈ μ€ν ν¨μ */
|
|
13536
|
-
async ask(userInput) {
|
|
13537
|
-
if (!__privateGet(this, _mcpClient)) {
|
|
13538
|
-
await this.connect();
|
|
13539
|
-
}
|
|
13540
|
-
try {
|
|
13541
|
-
__privateMethod(this, _NineChatManager_instances, pushMessage_fn).call(this, "user", userInput);
|
|
13542
|
-
const routes = await __privateMethod(this, _NineChatManager_instances, fetchRoutes_fn).call(this);
|
|
13543
|
-
const response = await __privateGet(this, _mcpClient).callTool({
|
|
13544
|
-
name: "system-brain",
|
|
13545
|
-
arguments: {
|
|
13546
|
-
user_input: userInput,
|
|
13547
|
-
routes,
|
|
13548
|
-
current_path: window.location.pathname
|
|
13549
|
-
// μ€μκ° κ²½λ‘ μ£Όμ
|
|
13550
|
-
}
|
|
13551
|
-
});
|
|
13552
|
-
const result = JSON.parse(response.content[0].text);
|
|
13553
|
-
console.log("AI Response:", result);
|
|
13554
|
-
__privateMethod(this, _NineChatManager_instances, pushMessage_fn).call(this, "assistant", result.message, result);
|
|
13555
|
-
if (__privateGet(this, _onAction)) __privateGet(this, _onAction).call(this, result);
|
|
13556
|
-
__privateMethod(this, _NineChatManager_instances, updateStatus_fn).call(this, "μ€λΉ μλ£");
|
|
13557
|
-
} catch (err) {
|
|
13558
|
-
trace.error("β Ask Error:", err);
|
|
13559
|
-
__privateMethod(this, _NineChatManager_instances, pushMessage_fn).call(this, "assistant", "λΆμ μ€ μ€λ₯κ° λ°μνμ΅λλ€.");
|
|
13560
|
-
__privateMethod(this, _NineChatManager_instances, updateStatus_fn).call(this, "μλ¬ λ°μ");
|
|
13561
|
-
}
|
|
13562
|
-
}
|
|
13563
13537
|
/** λ°μ΄ν° μμ§ (ν΄λΌμ΄μΈνΈ ν΄λ¦ νλ°©μ©) */
|
|
13564
13538
|
async collect(type2) {
|
|
13565
13539
|
var _a2;
|
|
@@ -13573,7 +13547,6 @@ class NineChatManager {
|
|
|
13573
13547
|
return "";
|
|
13574
13548
|
}
|
|
13575
13549
|
}
|
|
13576
|
-
// π‘ μ΄μ λνλ€μ μ μ₯ν λ©λͺ¨λ¦¬ μ°½κ³
|
|
13577
13550
|
addChatHistory(message) {
|
|
13578
13551
|
__privateGet(this, _chatHistory).push({ role: "ai", text: message });
|
|
13579
13552
|
}
|
|
@@ -13584,6 +13557,7 @@ _onStatus = new WeakMap();
|
|
|
13584
13557
|
_onMessage = new WeakMap();
|
|
13585
13558
|
_owner = new WeakMap();
|
|
13586
13559
|
_routeUrl = new WeakMap();
|
|
13560
|
+
_chatHistory = new WeakMap();
|
|
13587
13561
|
_NineChatManager_instances = new WeakSet();
|
|
13588
13562
|
connect_fn = async function() {
|
|
13589
13563
|
if (__privateGet(this, _mcpClient)) return;
|
|
@@ -13600,22 +13574,13 @@ connect_fn = async function() {
|
|
|
13600
13574
|
trace.error("β MCP μ°κ²° μ€ν¨", err);
|
|
13601
13575
|
__privateMethod(this, _NineChatManager_instances, updateStatus_fn).call(this, "β Connection Failed");
|
|
13602
13576
|
});
|
|
13603
|
-
|
|
13604
|
-
|
|
13605
|
-
|
|
13606
|
-
|
|
13607
|
-
|
|
13608
|
-
|
|
13609
|
-
|
|
13610
|
-
if (__privateGet(this, _onMessage)) {
|
|
13611
|
-
__privateGet(this, _onMessage).call(this, {
|
|
13612
|
-
role,
|
|
13613
|
-
content: content2,
|
|
13614
|
-
intent: result == null ? void 0 : result.intent,
|
|
13615
|
-
required_args: (_a2 = result == null ? void 0 : result.action) == null ? void 0 : _a2.required_args,
|
|
13616
|
-
action: result == null ? void 0 : result.action
|
|
13617
|
-
});
|
|
13618
|
-
}
|
|
13577
|
+
__privateGet(this, _mcpClient).onNotification((notification) => {
|
|
13578
|
+
console.log(notification);
|
|
13579
|
+
if (notification.method === "notifications/logging/message") {
|
|
13580
|
+
const data = JSON.parse(notification.params.message);
|
|
13581
|
+
if (data.type === "BRAIN_DECISION") ;
|
|
13582
|
+
}
|
|
13583
|
+
});
|
|
13619
13584
|
};
|
|
13620
13585
|
updateStatus_fn = function(msg) {
|
|
13621
13586
|
if (__privateGet(this, _onStatus)) __privateGet(this, _onStatus).call(this, msg);
|
|
@@ -13626,12 +13591,8 @@ callTool_fn = async function(toolName, args = {}) {
|
|
|
13626
13591
|
};
|
|
13627
13592
|
getRoutes_fn = async function(toolName, args = {}) {
|
|
13628
13593
|
const res = await fetch(__privateGet(this, _routeUrl));
|
|
13629
|
-
|
|
13630
|
-
throw new Error(`HTTP error! status: ${res.status}`);
|
|
13631
|
-
}
|
|
13632
|
-
return await res.json();
|
|
13594
|
+
return res.ok ? await res.json() : [];
|
|
13633
13595
|
};
|
|
13634
|
-
_chatHistory = new WeakMap();
|
|
13635
13596
|
class NineMuService {
|
|
13636
13597
|
constructor(connectorUrl) {
|
|
13637
13598
|
__privateAdd(this, _getSourcePath, (menuUrl) => {
|
|
@@ -13840,7 +13801,7 @@ render_fn = function() {
|
|
|
13840
13801
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
13841
13802
|
this.shadowRoot.innerHTML = `
|
|
13842
13803
|
<style>
|
|
13843
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
13804
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.186"}/dist/css/nine-mu.css";
|
|
13844
13805
|
${customImport}
|
|
13845
13806
|
</style>
|
|
13846
13807
|
<div class="wrapper">
|
|
@@ -40059,7 +40020,7 @@ class NineDiff extends HTMLElement {
|
|
|
40059
40020
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
40060
40021
|
this.shadowRoot.innerHTML = `
|
|
40061
40022
|
<style>
|
|
40062
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
40023
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.186"}/dist/css/nine-mu.css";
|
|
40063
40024
|
${customImport}
|
|
40064
40025
|
</style>
|
|
40065
40026
|
|
|
@@ -40169,7 +40130,7 @@ render_fn2 = function() {
|
|
|
40169
40130
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
40170
40131
|
this.shadowRoot.innerHTML = `
|
|
40171
40132
|
<style>
|
|
40172
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
40133
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.186"}/dist/css/nine-mu.css";
|
|
40173
40134
|
${customImport}
|
|
40174
40135
|
</style>
|
|
40175
40136
|
|
|
@@ -40496,7 +40457,7 @@ class ChatMessageBody extends HTMLElement {
|
|
|
40496
40457
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
40497
40458
|
this.shadowRoot.innerHTML = `
|
|
40498
40459
|
<style>
|
|
40499
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
40460
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.186"}/dist/css/nine-mu.css";
|
|
40500
40461
|
${customImport}
|
|
40501
40462
|
</style>
|
|
40502
40463
|
|
|
@@ -40590,7 +40551,7 @@ if (!customElements.get("nine-chat-progress")) {
|
|
|
40590
40551
|
customElements.define("nine-chat-progress", ProgressMessage);
|
|
40591
40552
|
}
|
|
40592
40553
|
const NineMu = {
|
|
40593
|
-
version: "0.1.
|
|
40554
|
+
version: "0.1.186",
|
|
40594
40555
|
init: (config2) => {
|
|
40595
40556
|
trace$1.log("π οΈ Nine-Mu Engine initialized", config2);
|
|
40596
40557
|
}
|