@opentiny/next-sdk 0.1.8 → 0.1.9
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 +13 -4
- package/dist/agent/AgentModelProvider.d.ts +3 -1
- package/dist/agent/AgentModelProvider.js +35 -21
- package/dist/index.es.dev.js +14 -5
- package/dist/index.es.js +9340 -9313
- package/dist/index.umd.dev.js +14 -5
- package/dist/index.umd.js +33 -33
- package/dist/remoter/createRemoter.js +1 -1
- package/dist/webagent.dev.js +14 -5
- package/dist/webagent.es.dev.js +14 -5
- package/dist/webagent.es.js +1582 -1575
- package/dist/webagent.js +21 -21
- package/dist/webmcp-full.dev.js +922 -958
- package/dist/webmcp-full.es.dev.js +922 -958
- package/package.json +1 -1
- package/remoter/createRemoter.ts +1 -1
|
@@ -226,7 +226,7 @@ class FloatingBlock {
|
|
|
226
226
|
this.copyToClipboard(this.options.sessionId.slice(-6));
|
|
227
227
|
}
|
|
228
228
|
copyRemoteURL() {
|
|
229
|
-
this.copyToClipboard(
|
|
229
|
+
this.copyToClipboard(this.options.remoteUrl + this.sessionPrefix + this.options.sessionId);
|
|
230
230
|
}
|
|
231
231
|
// 实现复制到剪贴板功能
|
|
232
232
|
copyToClipboard(text) {
|
package/dist/webagent.dev.js
CHANGED
|
@@ -24672,7 +24672,9 @@ ${user}:`]
|
|
|
24672
24672
|
} else {
|
|
24673
24673
|
transport = serverConfig;
|
|
24674
24674
|
}
|
|
24675
|
-
|
|
24675
|
+
const client = await createMCPClient({ transport });
|
|
24676
|
+
client["__transport__"] = transport;
|
|
24677
|
+
return client;
|
|
24676
24678
|
} catch (error) {
|
|
24677
24679
|
if (this.onError) {
|
|
24678
24680
|
this.onError((error == null ? void 0 : error.message) || `Failed to create MCP client`, error);
|
|
@@ -24681,6 +24683,13 @@ ${user}:`]
|
|
|
24681
24683
|
return null;
|
|
24682
24684
|
}
|
|
24683
24685
|
}
|
|
24686
|
+
/** 关闭一个client */
|
|
24687
|
+
async _closeOneClient(client) {
|
|
24688
|
+
var _a16, _b8, _c, _d, _e;
|
|
24689
|
+
await ((_b8 = (_a16 = client["__transport__"]) == null ? void 0 : _a16.terminateSession) == null ? void 0 : _b8.call(_a16));
|
|
24690
|
+
await ((_d = (_c = client["__transport__"]) == null ? void 0 : _c.close) == null ? void 0 : _d.call(_c));
|
|
24691
|
+
await ((_e = client == null ? void 0 : client.close) == null ? void 0 : _e.call(client));
|
|
24692
|
+
}
|
|
24684
24693
|
/** 创建 ai-sdk的 mcpClient, 失败则保存为null */
|
|
24685
24694
|
async _createMpcClients() {
|
|
24686
24695
|
this.mcpClients = await Promise.all(
|
|
@@ -24711,7 +24720,7 @@ ${user}:`]
|
|
|
24711
24720
|
await Promise.all(
|
|
24712
24721
|
this.mcpClients.map(async (client) => {
|
|
24713
24722
|
try {
|
|
24714
|
-
await (client
|
|
24723
|
+
await this._closeOneClient(client);
|
|
24715
24724
|
} catch (error) {
|
|
24716
24725
|
if (this.onError) {
|
|
24717
24726
|
this.onError((error == null ? void 0 : error.message) || `Failed to close client`, error);
|
|
@@ -24743,13 +24752,13 @@ ${user}:`]
|
|
|
24743
24752
|
return false;
|
|
24744
24753
|
}
|
|
24745
24754
|
/** 通过引用,删除一个 mcpServers mcpClients mcpTools ignoreToolnames */
|
|
24746
|
-
removeMcpServer(mcpServer) {
|
|
24755
|
+
async removeMcpServer(mcpServer) {
|
|
24747
24756
|
const index = this.mcpServers.findIndex((server) => server === mcpServer);
|
|
24748
24757
|
this.mcpServers.splice(index, 1);
|
|
24749
24758
|
const delClient = this.mcpClients[index];
|
|
24750
24759
|
this.mcpClients.splice(index, 1);
|
|
24751
24760
|
try {
|
|
24752
|
-
|
|
24761
|
+
await this._closeOneClient(delClient);
|
|
24753
24762
|
} catch (error) {
|
|
24754
24763
|
}
|
|
24755
24764
|
const delTool = this.mcpTools[index];
|
|
@@ -26995,7 +27004,7 @@ ${user}:`]
|
|
|
26995
27004
|
this.copyToClipboard(this.options.sessionId.slice(-6));
|
|
26996
27005
|
}
|
|
26997
27006
|
copyRemoteURL() {
|
|
26998
|
-
this.copyToClipboard(
|
|
27007
|
+
this.copyToClipboard(this.options.remoteUrl + this.sessionPrefix + this.options.sessionId);
|
|
26999
27008
|
}
|
|
27000
27009
|
// 实现复制到剪贴板功能
|
|
27001
27010
|
async copyToClipboard(text2) {
|
package/dist/webagent.es.dev.js
CHANGED
|
@@ -24278,7 +24278,9 @@ class AgentModelProvider {
|
|
|
24278
24278
|
} else {
|
|
24279
24279
|
transport = serverConfig;
|
|
24280
24280
|
}
|
|
24281
|
-
|
|
24281
|
+
const client = await createMCPClient({ transport });
|
|
24282
|
+
client["__transport__"] = transport;
|
|
24283
|
+
return client;
|
|
24282
24284
|
} catch (error) {
|
|
24283
24285
|
if (this.onError) {
|
|
24284
24286
|
this.onError((error == null ? void 0 : error.message) || `Failed to create MCP client`, error);
|
|
@@ -24287,6 +24289,13 @@ class AgentModelProvider {
|
|
|
24287
24289
|
return null;
|
|
24288
24290
|
}
|
|
24289
24291
|
}
|
|
24292
|
+
/** 关闭一个client */
|
|
24293
|
+
async _closeOneClient(client) {
|
|
24294
|
+
var _a16, _b8, _c, _d, _e;
|
|
24295
|
+
await ((_b8 = (_a16 = client["__transport__"]) == null ? void 0 : _a16.terminateSession) == null ? void 0 : _b8.call(_a16));
|
|
24296
|
+
await ((_d = (_c = client["__transport__"]) == null ? void 0 : _c.close) == null ? void 0 : _d.call(_c));
|
|
24297
|
+
await ((_e = client == null ? void 0 : client.close) == null ? void 0 : _e.call(client));
|
|
24298
|
+
}
|
|
24290
24299
|
/** 创建 ai-sdk的 mcpClient, 失败则保存为null */
|
|
24291
24300
|
async _createMpcClients() {
|
|
24292
24301
|
this.mcpClients = await Promise.all(
|
|
@@ -24317,7 +24326,7 @@ class AgentModelProvider {
|
|
|
24317
24326
|
await Promise.all(
|
|
24318
24327
|
this.mcpClients.map(async (client) => {
|
|
24319
24328
|
try {
|
|
24320
|
-
await (client
|
|
24329
|
+
await this._closeOneClient(client);
|
|
24321
24330
|
} catch (error) {
|
|
24322
24331
|
if (this.onError) {
|
|
24323
24332
|
this.onError((error == null ? void 0 : error.message) || `Failed to close client`, error);
|
|
@@ -24349,13 +24358,13 @@ class AgentModelProvider {
|
|
|
24349
24358
|
return false;
|
|
24350
24359
|
}
|
|
24351
24360
|
/** 通过引用,删除一个 mcpServers mcpClients mcpTools ignoreToolnames */
|
|
24352
|
-
removeMcpServer(mcpServer) {
|
|
24361
|
+
async removeMcpServer(mcpServer) {
|
|
24353
24362
|
const index = this.mcpServers.findIndex((server) => server === mcpServer);
|
|
24354
24363
|
this.mcpServers.splice(index, 1);
|
|
24355
24364
|
const delClient = this.mcpClients[index];
|
|
24356
24365
|
this.mcpClients.splice(index, 1);
|
|
24357
24366
|
try {
|
|
24358
|
-
|
|
24367
|
+
await this._closeOneClient(delClient);
|
|
24359
24368
|
} catch (error) {
|
|
24360
24369
|
}
|
|
24361
24370
|
const delTool = this.mcpTools[index];
|
|
@@ -26601,7 +26610,7 @@ class FloatingBlock {
|
|
|
26601
26610
|
this.copyToClipboard(this.options.sessionId.slice(-6));
|
|
26602
26611
|
}
|
|
26603
26612
|
copyRemoteURL() {
|
|
26604
|
-
this.copyToClipboard(
|
|
26613
|
+
this.copyToClipboard(this.options.remoteUrl + this.sessionPrefix + this.options.sessionId);
|
|
26605
26614
|
}
|
|
26606
26615
|
// 实现复制到剪贴板功能
|
|
26607
26616
|
async copyToClipboard(text2) {
|