@nine-lab/nine-mu 0.1.184 β 0.1.186
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 +14 -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 +13 -71
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;
|
|
@@ -13601,22 +13575,6 @@ connect_fn = async function() {
|
|
|
13601
13575
|
__privateMethod(this, _NineChatManager_instances, updateStatus_fn).call(this, "β Connection Failed");
|
|
13602
13576
|
});
|
|
13603
13577
|
};
|
|
13604
|
-
fetchRoutes_fn = async function() {
|
|
13605
|
-
const r = await fetch("/admin/prompts/data/routes.json");
|
|
13606
|
-
return r.ok ? await r.json() : [];
|
|
13607
|
-
};
|
|
13608
|
-
pushMessage_fn = function(role, content2, result = null) {
|
|
13609
|
-
var _a2;
|
|
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
|
-
}
|
|
13619
|
-
};
|
|
13620
13578
|
updateStatus_fn = function(msg) {
|
|
13621
13579
|
if (__privateGet(this, _onStatus)) __privateGet(this, _onStatus).call(this, msg);
|
|
13622
13580
|
trace.log(`[Status]: ${msg}`);
|
|
@@ -13626,12 +13584,8 @@ callTool_fn = async function(toolName, args = {}) {
|
|
|
13626
13584
|
};
|
|
13627
13585
|
getRoutes_fn = async function(toolName, args = {}) {
|
|
13628
13586
|
const res = await fetch(__privateGet(this, _routeUrl));
|
|
13629
|
-
|
|
13630
|
-
throw new Error(`HTTP error! status: ${res.status}`);
|
|
13631
|
-
}
|
|
13632
|
-
return await res.json();
|
|
13587
|
+
return res.ok ? await res.json() : [];
|
|
13633
13588
|
};
|
|
13634
|
-
_chatHistory = new WeakMap();
|
|
13635
13589
|
class NineMuService {
|
|
13636
13590
|
constructor(connectorUrl) {
|
|
13637
13591
|
__privateAdd(this, _getSourcePath, (menuUrl) => {
|
|
@@ -13840,7 +13794,7 @@ render_fn = function() {
|
|
|
13840
13794
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
13841
13795
|
this.shadowRoot.innerHTML = `
|
|
13842
13796
|
<style>
|
|
13843
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
13797
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.185"}/dist/css/nine-mu.css";
|
|
13844
13798
|
${customImport}
|
|
13845
13799
|
</style>
|
|
13846
13800
|
<div class="wrapper">
|
|
@@ -40059,7 +40013,7 @@ class NineDiff extends HTMLElement {
|
|
|
40059
40013
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
40060
40014
|
this.shadowRoot.innerHTML = `
|
|
40061
40015
|
<style>
|
|
40062
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
40016
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.185"}/dist/css/nine-mu.css";
|
|
40063
40017
|
${customImport}
|
|
40064
40018
|
</style>
|
|
40065
40019
|
|
|
@@ -40169,7 +40123,7 @@ render_fn2 = function() {
|
|
|
40169
40123
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
40170
40124
|
this.shadowRoot.innerHTML = `
|
|
40171
40125
|
<style>
|
|
40172
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
40126
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.185"}/dist/css/nine-mu.css";
|
|
40173
40127
|
${customImport}
|
|
40174
40128
|
</style>
|
|
40175
40129
|
|
|
@@ -40496,7 +40450,7 @@ class ChatMessageBody extends HTMLElement {
|
|
|
40496
40450
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
40497
40451
|
this.shadowRoot.innerHTML = `
|
|
40498
40452
|
<style>
|
|
40499
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
40453
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.185"}/dist/css/nine-mu.css";
|
|
40500
40454
|
${customImport}
|
|
40501
40455
|
</style>
|
|
40502
40456
|
|
|
@@ -40590,7 +40544,7 @@ if (!customElements.get("nine-chat-progress")) {
|
|
|
40590
40544
|
customElements.define("nine-chat-progress", ProgressMessage);
|
|
40591
40545
|
}
|
|
40592
40546
|
const NineMu = {
|
|
40593
|
-
version: "0.1.
|
|
40547
|
+
version: "0.1.185",
|
|
40594
40548
|
init: (config2) => {
|
|
40595
40549
|
trace$1.log("π οΈ Nine-Mu Engine initialized", config2);
|
|
40596
40550
|
}
|