@opentiny/next-sdk 0.1.7 → 0.1.8
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/agent/AgentModelProvider.ts +9 -11
- package/dist/agent/AgentModelProvider.d.ts +3 -9
- package/dist/agent/AgentModelProvider.js +6 -9
- package/dist/index.es.dev.js +14 -14
- package/dist/index.es.js +2630 -2629
- package/dist/index.umd.dev.js +14 -14
- package/dist/index.umd.js +24 -24
- package/dist/mcpsdk@1.17.0.es.js +6297 -6312
- package/dist/mcpsdk@1.17.0.js +16 -16
- package/dist/remoter/createRemoter.d.ts +2 -0
- package/dist/remoter/createRemoter.js +7 -5
- package/dist/webagent.dev.js +14 -14
- package/dist/webagent.es.dev.js +14 -14
- package/dist/webagent.es.js +1596 -1595
- package/dist/webagent.js +22 -22
- package/dist/webmcp-full.dev.js +958 -922
- package/dist/webmcp-full.es.dev.js +958 -922
- package/package.json +1 -1
- package/remoter/createRemoter.ts +12 -6
package/dist/index.umd.dev.js
CHANGED
|
@@ -24889,6 +24889,8 @@
|
|
|
24889
24889
|
img.src = await this.toDataURL();
|
|
24890
24890
|
}
|
|
24891
24891
|
}
|
|
24892
|
+
const DEFAULT_REMOTE_URL = "https://agent.opentiny.design/tiny-robot";
|
|
24893
|
+
const DEFAULT_QR_CODE_URL = "https://ai.opentiny.design/next-remoter";
|
|
24892
24894
|
const getDefaultMenuItems = (options) => {
|
|
24893
24895
|
return [
|
|
24894
24896
|
{
|
|
@@ -24937,8 +24939,8 @@
|
|
|
24937
24939
|
{
|
|
24938
24940
|
action: "remote-url",
|
|
24939
24941
|
show: true,
|
|
24940
|
-
text: `${options.
|
|
24941
|
-
tip: options.
|
|
24942
|
+
text: `${options.remoteUrl}`,
|
|
24943
|
+
tip: options.remoteUrl,
|
|
24942
24944
|
showCopyIcon: true,
|
|
24943
24945
|
icon: `<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
24944
24946
|
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
|
|
@@ -24954,8 +24956,9 @@
|
|
|
24954
24956
|
throw new Error("sessionId is required");
|
|
24955
24957
|
}
|
|
24956
24958
|
this.options = {
|
|
24957
|
-
|
|
24958
|
-
|
|
24959
|
+
...options,
|
|
24960
|
+
qrCodeUrl: options.qrCodeUrl || DEFAULT_QR_CODE_URL,
|
|
24961
|
+
remoteUrl: options.remoteUrl || DEFAULT_REMOTE_URL
|
|
24959
24962
|
};
|
|
24960
24963
|
this.menuItems = this.mergeMenuItems(options.menuItems);
|
|
24961
24964
|
this.init();
|
|
@@ -24999,7 +25002,7 @@
|
|
|
24999
25002
|
this.floatingBlock.className = "tiny-remoter-floating-block";
|
|
25000
25003
|
this.floatingBlock.innerHTML = `
|
|
25001
25004
|
<div class="tiny-remoter-floating-block__icon">
|
|
25002
|
-
<img style="display: block; width: 56px;" src="
|
|
25005
|
+
<img style="display: block; width: 56px;" src="${DEFAULT_QR_CODE_URL}/svgs/logo-next-no-bg-left.svg" alt="icon" />
|
|
25003
25006
|
</div>
|
|
25004
25007
|
`;
|
|
25005
25008
|
document.body.appendChild(this.floatingBlock);
|
|
@@ -25099,7 +25102,7 @@
|
|
|
25099
25102
|
this.copyToClipboard(this.options.sessionId.slice(-6));
|
|
25100
25103
|
}
|
|
25101
25104
|
copyRemoteURL() {
|
|
25102
|
-
this.copyToClipboard((this.options.
|
|
25105
|
+
this.copyToClipboard((this.options.remoteUrl || DEFAULT_REMOTE_URL) + this.sessionPrefix + this.options.sessionId);
|
|
25103
25106
|
}
|
|
25104
25107
|
// 实现复制到剪贴板功能
|
|
25105
25108
|
async copyToClipboard(text2) {
|
|
@@ -43204,7 +43207,6 @@ ${user}:`]
|
|
|
43204
43207
|
this.mcpClients = [];
|
|
43205
43208
|
this.mcpTools = [];
|
|
43206
43209
|
this.ignoreToolnames = [];
|
|
43207
|
-
this.autoUpdateTools = true;
|
|
43208
43210
|
this.messages = [];
|
|
43209
43211
|
this.mcpServers = mcpServers || [];
|
|
43210
43212
|
if (llm) {
|
|
@@ -43272,7 +43274,7 @@ ${user}:`]
|
|
|
43272
43274
|
await Promise.all(
|
|
43273
43275
|
this.mcpClients.map(async (client) => {
|
|
43274
43276
|
try {
|
|
43275
|
-
await client.close();
|
|
43277
|
+
await (client == null ? void 0 : client.close());
|
|
43276
43278
|
} catch (error2) {
|
|
43277
43279
|
if (this.onError) {
|
|
43278
43280
|
this.onError((error2 == null ? void 0 : error2.message) || `Failed to close client`, error2);
|
|
@@ -43322,7 +43324,7 @@ ${user}:`]
|
|
|
43322
43324
|
}
|
|
43323
43325
|
}
|
|
43324
43326
|
/** 创建临时允许调用的tools集合 */
|
|
43325
|
-
|
|
43327
|
+
_tempMergeTools(extraTool = {}) {
|
|
43326
43328
|
const toolsResult = this.mcpTools.reduce((acc, curr) => ({ ...acc, ...curr }), {});
|
|
43327
43329
|
Object.assign(toolsResult, extraTool);
|
|
43328
43330
|
this.ignoreToolnames.forEach((name16) => {
|
|
@@ -43335,16 +43337,14 @@ ${user}:`]
|
|
|
43335
43337
|
if (!this.llm) {
|
|
43336
43338
|
throw new Error("LLM is not initialized");
|
|
43337
43339
|
}
|
|
43338
|
-
|
|
43339
|
-
|
|
43340
|
-
(_a16 = this.onUpdatedTools) == null ? void 0 : _a16.call(this);
|
|
43341
|
-
}
|
|
43340
|
+
await this.initClientsAndTools();
|
|
43341
|
+
(_a16 = this.onUpdatedTools) == null ? void 0 : _a16.call(this);
|
|
43342
43342
|
const chatOptions = {
|
|
43343
43343
|
// @ts-ignore ProviderV2 是所有llm的父类, 在每一个具体的llm 类都有一个选择model的函数用法
|
|
43344
43344
|
model: this.llm(model),
|
|
43345
43345
|
stopWhen: stepCountIs(maxSteps),
|
|
43346
43346
|
...options,
|
|
43347
|
-
tools: this.
|
|
43347
|
+
tools: this._tempMergeTools(options.tools)
|
|
43348
43348
|
};
|
|
43349
43349
|
if (options.message && !options.messages) {
|
|
43350
43350
|
this.messages.push({ role: "user", content: options.message });
|