@opentiny/next-sdk 0.1.15 → 0.2.0
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 +493 -2
- package/agent/type.ts +8 -2
- package/agent/utils/generateReActPrompt.ts +55 -0
- package/agent/utils/parseReActAction.ts +34 -0
- package/dist/agent/AgentModelProvider.d.ts +35 -1
- package/dist/agent/type.d.ts +8 -2
- package/dist/agent/utils/generateReActPrompt.d.ts +9 -0
- package/dist/agent/utils/parseReActAction.d.ts +14 -0
- package/dist/index.es.dev.js +29527 -22287
- package/dist/index.es.js +28124 -22534
- package/dist/index.js +2411 -320
- package/dist/index.umd.dev.js +29958 -22718
- package/dist/index.umd.js +113 -71
- package/dist/{mcpsdk@1.23.0.dev.js → mcpsdk@1.23.1.dev.js} +6580 -6455
- package/dist/{mcpsdk@1.23.0.es.dev.js → mcpsdk@1.23.1.es.dev.js} +6578 -6453
- package/dist/mcpsdk@1.23.1.es.js +15530 -0
- package/dist/mcpsdk@1.23.1.js +43 -0
- package/dist/transport/ExtensionPageServerTransport.d.ts +1 -2
- package/dist/webagent.dev.js +23337 -16088
- package/dist/webagent.es.dev.js +22235 -14986
- package/dist/webagent.es.js +23995 -18395
- package/dist/webagent.js +96 -54
- package/dist/webmcp-full.dev.js +14988 -10082
- package/dist/webmcp-full.es.dev.js +14965 -10059
- package/dist/webmcp-full.es.js +13484 -9668
- package/dist/webmcp-full.js +26 -26
- package/dist/webmcp.dev.js +666 -640
- package/dist/webmcp.es.dev.js +664 -638
- package/dist/webmcp.es.js +651 -619
- package/dist/webmcp.js +1 -1
- package/dist/zod@3.25.76.dev.js +30 -32
- package/dist/zod@3.25.76.es.dev.js +28 -30
- package/dist/zod@3.25.76.es.js +143 -145
- package/dist/zod@3.25.76.js +1 -1
- package/package.json +9 -8
- package/transport/ExtensionPageServerTransport.ts +2 -4
- package/dist/mcpsdk@1.23.0.es.js +0 -15584
- package/dist/mcpsdk@1.23.0.js +0 -43
package/dist/index.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
import { z as
|
|
3
|
-
import { MessageChannelServerTransport as
|
|
4
|
-
import { AuthClientProvider as
|
|
5
|
-
import { McpServer as
|
|
6
|
-
import { ResourceTemplate as
|
|
7
|
-
import { UriTemplate as
|
|
8
|
-
import { completable as
|
|
9
|
-
import { getDisplayName as
|
|
10
|
-
import { InMemoryTransport as
|
|
11
|
-
import { InMemoryTransport as
|
|
12
|
-
import { SetLevelRequestSchema as
|
|
13
|
-
import { Client as
|
|
14
|
-
import { SSEClientTransport as
|
|
15
|
-
import { StreamableHTTPClientTransport as
|
|
16
|
-
import { WebSocketClientTransport as
|
|
17
|
-
import
|
|
18
|
-
import { dynamicTool as
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
1
|
+
import { default as O0 } from "ajv";
|
|
2
|
+
import { z as q0 } from "zod";
|
|
3
|
+
import { MessageChannelServerTransport as i2, createTransportPair as Y2, MessageChannelClientTransport as n2, sseOptions as K2, streamOptions as Q2, createSseProxy as X2, createSocketProxy as ee, createStreamProxy as te, MessageChannelTransport as re } from "@opentiny/next";
|
|
4
|
+
import { AuthClientProvider as H0 } from "@opentiny/next";
|
|
5
|
+
import { McpServer as E2 } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
|
+
import { ResourceTemplate as z0 } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
7
|
+
import { UriTemplate as D0 } from "@modelcontextprotocol/sdk/shared/uriTemplate.js";
|
|
8
|
+
import { completable as B0 } from "@modelcontextprotocol/sdk/server/completable.js";
|
|
9
|
+
import { getDisplayName as J0 } from "@modelcontextprotocol/sdk/shared/metadataUtils.js";
|
|
10
|
+
import { InMemoryTransport as se } from "@modelcontextprotocol/sdk/inMemory.js";
|
|
11
|
+
import { InMemoryTransport as G0 } from "@modelcontextprotocol/sdk/inMemory.js";
|
|
12
|
+
import { SetLevelRequestSchema as m2, SubscribeRequestSchema as oe, UnsubscribeRequestSchema as ie, ListResourcesRequestSchema as ne, RootsListChangedNotificationSchema as ae, CallToolResultSchema as ce, ElicitRequestSchema as le, CreateMessageRequestSchema as he, ListRootsRequestSchema as de, ToolListChangedNotificationSchema as pe, PromptListChangedNotificationSchema as ue, ResourceListChangedNotificationSchema as me, ResourceUpdatedNotificationSchema as ge, LoggingMessageNotificationSchema as fe, JSONRPCMessageSchema as a2 } from "@modelcontextprotocol/sdk/types.js";
|
|
13
|
+
import { Client as P2 } from "@modelcontextprotocol/sdk/client/index.js";
|
|
14
|
+
import { SSEClientTransport as c2 } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
15
|
+
import { StreamableHTTPClientTransport as G } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
16
|
+
import { WebSocketClientTransport as Ce } from "@modelcontextprotocol/sdk/client/websocket.js";
|
|
17
|
+
import g2 from "qrcode";
|
|
18
|
+
import { dynamicTool as we, jsonSchema as ye, generateText as f2, streamText as X, stepCountIs as ve } from "ai";
|
|
19
|
+
import { InvalidArgumentError as _e, AISDKError as Z } from "@ai-sdk/provider";
|
|
20
|
+
import { z as o } from "zod/v4";
|
|
21
|
+
import "zod/v3";
|
|
22
|
+
import { createOpenAI as be } from "@ai-sdk/openai";
|
|
23
|
+
import { createDeepSeek as xe } from "@ai-sdk/deepseek";
|
|
24
|
+
class w0 {
|
|
22
25
|
constructor(e, t) {
|
|
23
|
-
const
|
|
26
|
+
const s = {
|
|
24
27
|
name: "web-mcp-server",
|
|
25
28
|
version: "1.0.0"
|
|
26
|
-
},
|
|
29
|
+
}, i = {
|
|
27
30
|
prompts: { listChanged: !0 },
|
|
28
31
|
resources: { subscribe: !0, listChanged: !0 },
|
|
29
32
|
tools: { listChanged: !0 },
|
|
30
33
|
completions: {},
|
|
31
34
|
logging: {}
|
|
32
35
|
};
|
|
33
|
-
this.server = new
|
|
34
|
-
|
|
35
|
-
(o = this.oninitialized) == null || o.call(this);
|
|
36
|
+
this.server = new E2(e || s, t || { capabilities: i }), this.server.server.oninitialized = () => {
|
|
37
|
+
this.oninitialized?.();
|
|
36
38
|
}, this.server.server.onclose = () => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
(n = this.onerror) == null || n.call(this, o);
|
|
42
|
-
}, this.server.server.setRequestHandler(v, async () => ({}));
|
|
39
|
+
this.onclose?.();
|
|
40
|
+
}, this.server.server.onerror = (n) => {
|
|
41
|
+
this.onerror?.(n);
|
|
42
|
+
}, this.server.server.setRequestHandler(m2, async () => ({}));
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* Connects the server to a transport via the specified option.
|
|
46
46
|
*/
|
|
47
47
|
async connect(e) {
|
|
48
|
-
return typeof e.start == "function" ? (this.transport = e, this.transport.onclose = void 0, this.transport.onerror = void 0, this.transport.onmessage = void 0) : (this.transport = new
|
|
48
|
+
return typeof e.start == "function" ? (this.transport = e, this.transport.onclose = void 0, this.transport.onerror = void 0, this.transport.onmessage = void 0) : (this.transport = new i2(e), await this.transport.listen()), await this.server.connect(this.transport), this.transport;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Closes the connection.
|
|
@@ -56,17 +56,17 @@ class z2 {
|
|
|
56
56
|
/**
|
|
57
57
|
* Registers a tool with a config object and callback.
|
|
58
58
|
*/
|
|
59
|
-
registerTool(e, t,
|
|
60
|
-
return this.server.registerTool(e, t,
|
|
59
|
+
registerTool(e, t, s) {
|
|
60
|
+
return this.server.registerTool(e, t, s);
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Registers a prompt with a config object and callback.
|
|
64
64
|
*/
|
|
65
|
-
registerPrompt(e, t,
|
|
66
|
-
return this.server.registerPrompt(e, t,
|
|
65
|
+
registerPrompt(e, t, s) {
|
|
66
|
+
return this.server.registerPrompt(e, t, s);
|
|
67
67
|
}
|
|
68
|
-
registerResource(e, t,
|
|
69
|
-
return typeof t == "string" ? this.server.registerResource(e, t,
|
|
68
|
+
registerResource(e, t, s, i) {
|
|
69
|
+
return typeof t == "string" ? this.server.registerResource(e, t, s, i) : this.server.registerResource(e, t, s, i);
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* Checks if the server is connected to a transport.
|
|
@@ -146,8 +146,8 @@ class z2 {
|
|
|
146
146
|
*
|
|
147
147
|
* Do not use this method to emit notifications! Use notification() instead.
|
|
148
148
|
*/
|
|
149
|
-
request(e, t,
|
|
150
|
-
return this.server.server.request(e, t,
|
|
149
|
+
request(e, t, s) {
|
|
150
|
+
return this.server.server.request(e, t, s);
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
153
153
|
* Emits a notification, which is a one-way message that does not expect a response.
|
|
@@ -187,31 +187,31 @@ class z2 {
|
|
|
187
187
|
* Registers a handler for the subscribe request.
|
|
188
188
|
*/
|
|
189
189
|
onSubscribe(e) {
|
|
190
|
-
this.server.server.setRequestHandler(
|
|
190
|
+
this.server.server.setRequestHandler(oe, e);
|
|
191
191
|
}
|
|
192
192
|
/**
|
|
193
193
|
* Registers a handler for the unsubscribe request.
|
|
194
194
|
*/
|
|
195
195
|
onUnsubscribe(e) {
|
|
196
|
-
this.server.server.setRequestHandler(
|
|
196
|
+
this.server.server.setRequestHandler(ie, e);
|
|
197
197
|
}
|
|
198
198
|
/**
|
|
199
199
|
* Registers a handler for the set log level request.
|
|
200
200
|
*/
|
|
201
201
|
onSetLogLevel(e) {
|
|
202
|
-
this.server.server.setRequestHandler(
|
|
202
|
+
this.server.server.setRequestHandler(m2, e);
|
|
203
203
|
}
|
|
204
204
|
/**
|
|
205
205
|
* Registers a handler for the list tools request.
|
|
206
206
|
*/
|
|
207
207
|
onListResources(e) {
|
|
208
|
-
this.server.server.setRequestHandler(
|
|
208
|
+
this.server.server.setRequestHandler(ne, e);
|
|
209
209
|
}
|
|
210
210
|
/**
|
|
211
211
|
* Registers a handler for the roots list changed notification.
|
|
212
212
|
*/
|
|
213
213
|
onRootsListChanged(e) {
|
|
214
|
-
this.server.server.setNotificationHandler(
|
|
214
|
+
this.server.server.setNotificationHandler(ae, e);
|
|
215
215
|
}
|
|
216
216
|
/**
|
|
217
217
|
* Close the transport for window.addEventListener('pagehide')
|
|
@@ -220,23 +220,21 @@ class z2 {
|
|
|
220
220
|
e.persisted || this.transport && typeof this.transport.close == "function" && await this.transport.close();
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
const
|
|
224
|
-
class
|
|
223
|
+
const y0 = (r, e) => new i2(r, e), v0 = () => Y2(), _0 = (r) => r instanceof i2, b0 = (r) => r instanceof E2;
|
|
224
|
+
class Le {
|
|
225
225
|
constructor(e, t) {
|
|
226
|
-
const
|
|
226
|
+
const s = {
|
|
227
227
|
name: "web-mcp-client",
|
|
228
228
|
version: "1.0.0"
|
|
229
|
-
},
|
|
229
|
+
}, i = {
|
|
230
230
|
roots: { listChanged: !0 },
|
|
231
231
|
sampling: {},
|
|
232
232
|
elicitation: {}
|
|
233
233
|
};
|
|
234
|
-
this.client = new
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
var n;
|
|
239
|
-
(n = this.onerror) == null || n.call(this, o);
|
|
234
|
+
this.client = new P2(e || s, t || { capabilities: i }), this.client.onclose = () => {
|
|
235
|
+
this.onclose?.();
|
|
236
|
+
}, this.client.onerror = (n) => {
|
|
237
|
+
this.onerror?.(n);
|
|
240
238
|
};
|
|
241
239
|
}
|
|
242
240
|
/**
|
|
@@ -245,28 +243,28 @@ class c2 {
|
|
|
245
243
|
async connect(e) {
|
|
246
244
|
if (typeof e.start == "function")
|
|
247
245
|
return this.transport = e, this.transport.onclose = void 0, this.transport.onerror = void 0, this.transport.onmessage = void 0, await this.client.connect(this.transport), { transport: this.transport, sessionId: this.transport.sessionId };
|
|
248
|
-
const { url: t, token:
|
|
249
|
-
if (
|
|
250
|
-
const
|
|
251
|
-
let
|
|
246
|
+
const { url: t, token: s, sessionId: i, type: n, agent: a, onError: l } = e;
|
|
247
|
+
if (a === !0) {
|
|
248
|
+
const d = { client: this.client, url: t, token: s, sessionId: i };
|
|
249
|
+
let g;
|
|
252
250
|
return await (async () => {
|
|
253
|
-
const { transport:
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
},
|
|
257
|
-
})(),
|
|
251
|
+
const { transport: C, sessionId: f } = n === "sse" ? await X2(d) : n === "socket" ? await ee(d) : await te(d);
|
|
252
|
+
C.onerror = async (u) => {
|
|
253
|
+
l?.(u);
|
|
254
|
+
}, g = { transport: C, sessionId: f };
|
|
255
|
+
})(), g;
|
|
258
256
|
}
|
|
259
|
-
const
|
|
260
|
-
let
|
|
261
|
-
if (
|
|
262
|
-
const
|
|
263
|
-
|
|
257
|
+
const h = new URL(t);
|
|
258
|
+
let c;
|
|
259
|
+
if (n === "channel" && (c = new n2(t), await this.client.connect(c)), n === "sse") {
|
|
260
|
+
const d = K2(s, i);
|
|
261
|
+
c = new c2(h, d), await this.client.connect(c);
|
|
264
262
|
}
|
|
265
|
-
if (
|
|
266
|
-
const
|
|
267
|
-
|
|
263
|
+
if (n === "socket" && (c = new Ce(new URL(`${t}?sessionId=${i}&token=${s}`)), c.sessionId = i, await this.client.connect(c)), typeof c > "u") {
|
|
264
|
+
const d = Q2(s, i);
|
|
265
|
+
c = new G(h, d), await this.client.connect(c);
|
|
268
266
|
}
|
|
269
|
-
return this.transport =
|
|
267
|
+
return this.transport = c, { transport: this.transport, sessionId: this.transport.sessionId };
|
|
270
268
|
}
|
|
271
269
|
/**
|
|
272
270
|
* Closes the connection.
|
|
@@ -356,7 +354,7 @@ class c2 {
|
|
|
356
354
|
* Calls a tool on the server with the given parameters.
|
|
357
355
|
*/
|
|
358
356
|
async callTool(e, t) {
|
|
359
|
-
return await this.client.callTool(e,
|
|
357
|
+
return await this.client.callTool(e, ce, t);
|
|
360
358
|
}
|
|
361
359
|
/**
|
|
362
360
|
* Lists all tools available on the server.
|
|
@@ -375,8 +373,8 @@ class c2 {
|
|
|
375
373
|
*
|
|
376
374
|
* Do not use this method to emit notifications! Use notification() instead.
|
|
377
375
|
*/
|
|
378
|
-
request(e, t,
|
|
379
|
-
return this.client.request(e, t,
|
|
376
|
+
request(e, t, s) {
|
|
377
|
+
return this.client.request(e, t, s);
|
|
380
378
|
}
|
|
381
379
|
/**
|
|
382
380
|
* Emits a notification, which is a one-way message that does not expect a response.
|
|
@@ -416,92 +414,91 @@ class c2 {
|
|
|
416
414
|
* Registers a handler for the elicitation request.
|
|
417
415
|
*/
|
|
418
416
|
onElicit(e) {
|
|
419
|
-
this.client.setRequestHandler(
|
|
417
|
+
this.client.setRequestHandler(le, e);
|
|
420
418
|
}
|
|
421
419
|
/**
|
|
422
420
|
* Registers a handler for the create LLM message request.
|
|
423
421
|
*/
|
|
424
422
|
onCreateMessage(e) {
|
|
425
|
-
this.client.setRequestHandler(
|
|
423
|
+
this.client.setRequestHandler(he, e);
|
|
426
424
|
}
|
|
427
425
|
/**
|
|
428
426
|
* Registers a handler for the list roots request.
|
|
429
427
|
*/
|
|
430
428
|
onListRoots(e) {
|
|
431
|
-
this.client.setRequestHandler(
|
|
429
|
+
this.client.setRequestHandler(de, e);
|
|
432
430
|
}
|
|
433
431
|
/**
|
|
434
432
|
* Registers a handler for the tool list changed notification.
|
|
435
433
|
*/
|
|
436
434
|
onToolListChanged(e) {
|
|
437
|
-
this.client.setNotificationHandler(
|
|
435
|
+
this.client.setNotificationHandler(pe, e);
|
|
438
436
|
}
|
|
439
437
|
/**
|
|
440
438
|
* Registers a handler for the prompt list changed notification.
|
|
441
439
|
*/
|
|
442
440
|
onPromptListChanged(e) {
|
|
443
|
-
this.client.setNotificationHandler(
|
|
441
|
+
this.client.setNotificationHandler(ue, e);
|
|
444
442
|
}
|
|
445
443
|
/**
|
|
446
444
|
* Registers a handler for the resource list changed notification.
|
|
447
445
|
*/
|
|
448
446
|
onResourceListChanged(e) {
|
|
449
|
-
this.client.setNotificationHandler(
|
|
447
|
+
this.client.setNotificationHandler(me, e);
|
|
450
448
|
}
|
|
451
449
|
/**
|
|
452
450
|
* Registers a handler for the resource updated notification.
|
|
453
451
|
*/
|
|
454
452
|
onResourceUpdated(e) {
|
|
455
|
-
this.client.setNotificationHandler(
|
|
453
|
+
this.client.setNotificationHandler(ge, e);
|
|
456
454
|
}
|
|
457
455
|
/**
|
|
458
456
|
* Registers a handler for the logging message notification.
|
|
459
457
|
*/
|
|
460
458
|
onLoggingMessage(e) {
|
|
461
|
-
this.client.setNotificationHandler(
|
|
459
|
+
this.client.setNotificationHandler(fe, e);
|
|
462
460
|
}
|
|
463
461
|
/**
|
|
464
462
|
* Close the transport for window.addEventListener('pagehide')
|
|
465
463
|
*/
|
|
466
464
|
async onPagehide(e) {
|
|
467
|
-
e.persisted || (
|
|
465
|
+
e.persisted || (Se(this.transport) ? await this.transport.terminateSession() : this.transport && typeof this.transport.close == "function" && await this.transport.close());
|
|
468
466
|
}
|
|
469
467
|
}
|
|
470
|
-
const
|
|
468
|
+
const x0 = (r, e) => new c2(r, e), L0 = (r, e) => new G(r, e), S0 = (r, e) => new n2(r, e), R0 = (r) => r instanceof c2, Se = (r) => r instanceof G, T0 = (r) => r instanceof n2, M0 = (r) => r instanceof P2, A = (r, e, t) => {
|
|
471
469
|
window.postMessage({ type: r, direction: t, data: e }, "*");
|
|
472
|
-
},
|
|
473
|
-
const
|
|
474
|
-
|
|
470
|
+
}, C2 = (r, e, t) => {
|
|
471
|
+
const s = async function(i) {
|
|
472
|
+
i.source === window && i.data.type === r && i.data.direction === t && await e(i.data.data);
|
|
475
473
|
};
|
|
476
|
-
return window.addEventListener("message",
|
|
477
|
-
},
|
|
474
|
+
return window.addEventListener("message", s), () => window.removeEventListener("message", s);
|
|
475
|
+
}, r2 = (r, e, t) => {
|
|
478
476
|
if (t.endsWith("content"))
|
|
479
|
-
chrome.tabs.query({}, (
|
|
480
|
-
|
|
481
|
-
chrome.tabs.sendMessage(
|
|
477
|
+
chrome.tabs.query({}, (s) => {
|
|
478
|
+
s.forEach((i) => {
|
|
479
|
+
chrome.tabs.sendMessage(i.id, { type: r, data: e, direction: t, tabId: i.id });
|
|
482
480
|
});
|
|
483
481
|
});
|
|
484
482
|
else
|
|
485
483
|
return chrome.runtime.sendMessage({ direction: t, type: r, data: e });
|
|
486
|
-
},
|
|
487
|
-
const
|
|
488
|
-
if (
|
|
489
|
-
const { data:
|
|
490
|
-
e(
|
|
484
|
+
}, s2 = (r, e, t, s) => {
|
|
485
|
+
const i = (n, a, l) => {
|
|
486
|
+
if (n.type === r && n.direction === t && (!s || s && n.tabId === s)) {
|
|
487
|
+
const { data: h } = n;
|
|
488
|
+
e(h, a, l), l(a);
|
|
491
489
|
}
|
|
492
490
|
};
|
|
493
|
-
return chrome.runtime.onMessage.addListener(
|
|
491
|
+
return chrome.runtime.onMessage.addListener(i), () => chrome.runtime.onMessage.removeListener(i);
|
|
494
492
|
};
|
|
495
|
-
class
|
|
493
|
+
class Re {
|
|
496
494
|
constructor(e) {
|
|
497
|
-
this._isStarted = !1, this._isClosed = !1, this.targetSessionId = e, this._messageListener =
|
|
495
|
+
this._isStarted = !1, this._isClosed = !1, this.targetSessionId = e, this._messageListener = s2(
|
|
498
496
|
"mcp-server-to-client",
|
|
499
497
|
(t) => {
|
|
500
|
-
var i;
|
|
501
498
|
try {
|
|
502
499
|
if (t.sessionId !== this.targetSessionId) return;
|
|
503
|
-
const s =
|
|
504
|
-
|
|
500
|
+
const s = a2.parse(t.mcpMessage);
|
|
501
|
+
this.onmessage?.(s);
|
|
505
502
|
} catch (s) {
|
|
506
503
|
console.log("【Client Transport】处理server消息错误:", s);
|
|
507
504
|
}
|
|
@@ -512,8 +509,8 @@ class h2 {
|
|
|
512
509
|
// 是否已关闭
|
|
513
510
|
_throwError(e, t) {
|
|
514
511
|
if (e()) {
|
|
515
|
-
const
|
|
516
|
-
throw console.log(t,
|
|
512
|
+
const s = new Error(t);
|
|
513
|
+
throw console.log(t, s), this.onerror && this.onerror(s), s;
|
|
517
514
|
}
|
|
518
515
|
}
|
|
519
516
|
/** 启动 transport,开始监听消息 */
|
|
@@ -523,12 +520,12 @@ class h2 {
|
|
|
523
520
|
/** 发送消息到 MCP Server */
|
|
524
521
|
async send(e, t) {
|
|
525
522
|
this._throwError(() => !this._isStarted, "【Client Transport】 未启动,无法发送消息"), this._throwError(() => this._isClosed, "【Client Transport】 已关闭,无法发送消息");
|
|
526
|
-
const
|
|
527
|
-
this._throwError(() => !
|
|
528
|
-
const
|
|
529
|
-
|
|
523
|
+
const s = chrome.sessionRegistry.get(this.targetSessionId);
|
|
524
|
+
this._throwError(() => !s, `【Client Transport】sessionRegistry中未找到${this.targetSessionId}`);
|
|
525
|
+
const i = s.tabIds[s.tabIds.length - 1];
|
|
526
|
+
r2(
|
|
530
527
|
"mcp-client-to-server",
|
|
531
|
-
{ sessionId: this.targetSessionId, tabId:
|
|
528
|
+
{ sessionId: this.targetSessionId, tabId: i, mcpMessage: e },
|
|
532
529
|
"side->content"
|
|
533
530
|
);
|
|
534
531
|
}
|
|
@@ -542,30 +539,29 @@ class h2 {
|
|
|
542
539
|
}
|
|
543
540
|
}
|
|
544
541
|
}
|
|
545
|
-
const
|
|
542
|
+
const k2 = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r) => {
|
|
546
543
|
const e = Math.random() * 16 | 0;
|
|
547
544
|
return (r === "x" ? e : e & 3 | 8).toString(16);
|
|
548
545
|
});
|
|
549
|
-
class
|
|
550
|
-
constructor(e = null
|
|
551
|
-
this._isStarted = !1, this._isClosed = !1, this._lastRegistration = null, this.sessionId = e ||
|
|
546
|
+
class E0 {
|
|
547
|
+
constructor(e = null) {
|
|
548
|
+
this._isStarted = !1, this._isClosed = !1, this._lastRegistration = null, this.sessionId = e || k2(), this._messageListener1 = C2(
|
|
552
549
|
"sidepanel-ready-to-page",
|
|
553
550
|
() => {
|
|
554
|
-
this._lastRegistration && this._isStarted && this.notifyRegistration(this._lastRegistration).catch((
|
|
555
|
-
console.error("【Page Svr Transport】 notifyRegistration失败:",
|
|
551
|
+
this._lastRegistration && this._isStarted && this.notifyRegistration(this._lastRegistration).catch((t) => {
|
|
552
|
+
console.error("【Page Svr Transport】 notifyRegistration失败:", t);
|
|
556
553
|
});
|
|
557
554
|
},
|
|
558
555
|
"content->page"
|
|
559
|
-
), this._messageListener2 =
|
|
556
|
+
), this._messageListener2 = C2(
|
|
560
557
|
"mcp-client-to-server-to-page",
|
|
561
|
-
(
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
(n = this.onmessage) == null || n.call(this, s), ((a = i.mcpMessage.params) == null ? void 0 : a.name) && d(
|
|
558
|
+
(t) => {
|
|
559
|
+
if (t.sessionId !== this.sessionId) return;
|
|
560
|
+
console.log("【Page Svr Transport】 即将处理 mcpMessage", t.mcpMessage);
|
|
561
|
+
const s = a2.parse(t.mcpMessage);
|
|
562
|
+
this.onmessage?.(s), t.mcpMessage.params?.name && A(
|
|
567
563
|
"update-page-app-message",
|
|
568
|
-
{ status: "run", message:
|
|
564
|
+
{ status: "run", message: t.mcpMessage.params?.name },
|
|
569
565
|
"page->content"
|
|
570
566
|
);
|
|
571
567
|
},
|
|
@@ -575,8 +571,8 @@ class Y2 {
|
|
|
575
571
|
// 最后一次注册信息(用于 Sidepanel 刷新后重新注册)
|
|
576
572
|
_throwError(e, t) {
|
|
577
573
|
if (e()) {
|
|
578
|
-
const
|
|
579
|
-
throw console.log(t,
|
|
574
|
+
const s = new Error(t);
|
|
575
|
+
throw console.log(t, s), this.onerror && this.onerror(s), s;
|
|
580
576
|
}
|
|
581
577
|
}
|
|
582
578
|
/** 启动 transport,开始监听消息 */
|
|
@@ -588,15 +584,14 @@ class Y2 {
|
|
|
588
584
|
}
|
|
589
585
|
/** 发送消息到 MCP Client */
|
|
590
586
|
async send(e, t) {
|
|
591
|
-
|
|
592
|
-
this._throwError(() => !this._isStarted, "【Page Svr Transport】 未启动,无法发送消息"), this._throwError(() => this._isClosed, "【Page Svr Transport】 已关闭,无法发送消息"), d(
|
|
587
|
+
this._throwError(() => !this._isStarted, "【Page Svr Transport】 未启动,无法发送消息"), this._throwError(() => this._isClosed, "【Page Svr Transport】 已关闭,无法发送消息"), A(
|
|
593
588
|
"mcp-server-to-client-from-page",
|
|
594
589
|
{
|
|
595
590
|
sessionId: this.sessionId,
|
|
596
591
|
mcpMessage: e
|
|
597
592
|
},
|
|
598
593
|
"page->content"
|
|
599
|
-
), "result" in e &&
|
|
594
|
+
), "result" in e && e.result?.content && A(
|
|
600
595
|
"update-page-app-message",
|
|
601
596
|
{ status: "ready", message: "" },
|
|
602
597
|
"page->content"
|
|
@@ -607,7 +602,7 @@ class Y2 {
|
|
|
607
602
|
async notifyRegistration(e) {
|
|
608
603
|
this._throwError(() => !this._isStarted, "【Page Svr Transport】 未启动,无法注册消息"), this._lastRegistration = e;
|
|
609
604
|
try {
|
|
610
|
-
|
|
605
|
+
A(
|
|
611
606
|
"mcp-server-register-from-page",
|
|
612
607
|
{
|
|
613
608
|
sessionId: this.sessionId,
|
|
@@ -633,13 +628,13 @@ class Y2 {
|
|
|
633
628
|
}
|
|
634
629
|
}
|
|
635
630
|
}
|
|
636
|
-
class
|
|
631
|
+
class P0 {
|
|
637
632
|
constructor(e = null, t) {
|
|
638
|
-
this._isStarted = !1, this._isClosed = !1, this._lastRegistration = null, this.sessionId = e ||
|
|
633
|
+
this._isStarted = !1, this._isClosed = !1, this._lastRegistration = null, this.sessionId = e || k2(), this.tabId = t, s2(
|
|
639
634
|
"sidepanel-ready",
|
|
640
635
|
() => {
|
|
641
|
-
this._lastRegistration && this._isStarted && this.notifyRegistration(this._lastRegistration).catch((
|
|
642
|
-
console.log("【Content Svr Transport】 notifyRegistration 失败",
|
|
636
|
+
this._lastRegistration && this._isStarted && this.notifyRegistration(this._lastRegistration).catch((s) => {
|
|
637
|
+
console.log("【Content Svr Transport】 notifyRegistration 失败", s);
|
|
643
638
|
});
|
|
644
639
|
},
|
|
645
640
|
"side->content",
|
|
@@ -649,30 +644,29 @@ class V2 {
|
|
|
649
644
|
// 最后一次注册信息(用于 Sidepanel 刷新后重新注册)
|
|
650
645
|
_throwError(e, t) {
|
|
651
646
|
if (e()) {
|
|
652
|
-
const
|
|
653
|
-
throw console.log(t,
|
|
647
|
+
const s = new Error(t);
|
|
648
|
+
throw console.log(t, s), this.onerror && this.onerror(s), s;
|
|
654
649
|
}
|
|
655
650
|
}
|
|
656
651
|
/** 启动 transport,开始监听MCP client 消息 */
|
|
657
652
|
async start() {
|
|
658
653
|
if (console.log("【Content Svr Transport】 启动 start", this.sessionId), !this._isStarted) {
|
|
659
654
|
if (this._isClosed) throw new Error("【Content Svr Transport】 已关闭,无法重新启动");
|
|
660
|
-
|
|
655
|
+
s2(
|
|
661
656
|
"mcp-client-to-server",
|
|
662
657
|
(e) => {
|
|
663
|
-
var t, i, s;
|
|
664
658
|
if (!(e.sessionId !== this.sessionId || e.tabId !== this.tabId))
|
|
665
659
|
try {
|
|
666
660
|
console.log("【Content Svr Transport】 即将处理 mcpMessage", e.mcpMessage);
|
|
667
|
-
const
|
|
668
|
-
|
|
661
|
+
const t = a2.parse(e.mcpMessage);
|
|
662
|
+
this.onmessage?.(t), e.mcpMessage.params?.name && A(
|
|
669
663
|
"update-page-app-message",
|
|
670
|
-
{ status: "run", message:
|
|
664
|
+
{ status: "run", message: e.mcpMessage.params?.name },
|
|
671
665
|
"page->content"
|
|
672
666
|
// 此处应该是 content->content, 但为了和pageServerTransport统一。
|
|
673
667
|
);
|
|
674
|
-
} catch (
|
|
675
|
-
console.log("【Content Svr Transport】 处理消息时发生错误:",
|
|
668
|
+
} catch (t) {
|
|
669
|
+
console.log("【Content Svr Transport】 处理消息时发生错误:", t);
|
|
676
670
|
}
|
|
677
671
|
},
|
|
678
672
|
"side->content",
|
|
@@ -682,17 +676,16 @@ class V2 {
|
|
|
682
676
|
}
|
|
683
677
|
/** 发送消息到 MCP Client */
|
|
684
678
|
async send(e, t) {
|
|
685
|
-
var i;
|
|
686
679
|
this._throwError(() => !this._isStarted, "【Content Svr Transport】 未启动,无法发送消息"), this._throwError(() => this._isClosed, "【Content Svr Transport】 已关闭,无法发送消息");
|
|
687
680
|
try {
|
|
688
|
-
console.log("【Content Svr Transport】 发送消息到 MCP Client", e),
|
|
681
|
+
console.log("【Content Svr Transport】 发送消息到 MCP Client", e), r2(
|
|
689
682
|
"mcp-server-to-client",
|
|
690
683
|
{
|
|
691
684
|
sessionId: this.sessionId,
|
|
692
685
|
mcpMessage: e
|
|
693
686
|
},
|
|
694
687
|
"content->side"
|
|
695
|
-
), "result" in e &&
|
|
688
|
+
), "result" in e && e.result?.content && A(
|
|
696
689
|
"update-page-app-message",
|
|
697
690
|
{ status: "ready", message: "" },
|
|
698
691
|
"page->content"
|
|
@@ -704,7 +697,7 @@ class V2 {
|
|
|
704
697
|
}
|
|
705
698
|
/** 通知 Sidepanel 此 Server 已启动并准备接受连接 */
|
|
706
699
|
async notifyRegistration(e) {
|
|
707
|
-
this._isStarted && (this._lastRegistration = e,
|
|
700
|
+
this._isStarted && (this._lastRegistration = e, r2(
|
|
708
701
|
"mcp-server-register",
|
|
709
702
|
{
|
|
710
703
|
sessionId: this.sessionId,
|
|
@@ -726,9 +719,9 @@ class V2 {
|
|
|
726
719
|
}
|
|
727
720
|
}
|
|
728
721
|
}
|
|
729
|
-
class
|
|
730
|
-
constructor(e, { size: t = 200, margin:
|
|
731
|
-
this.value = e, this.size = t, this.margin =
|
|
722
|
+
class Te {
|
|
723
|
+
constructor(e, { size: t = 200, margin: s = 4, color: i = "#000", bgColor: n = "#fff" }) {
|
|
724
|
+
this.value = e, this.size = t, this.margin = s, this.color = i, this.bgColor = n;
|
|
732
725
|
}
|
|
733
726
|
get qrCodeOption() {
|
|
734
727
|
return {
|
|
@@ -744,18 +737,18 @@ class d2 {
|
|
|
744
737
|
}
|
|
745
738
|
/** 生成二维码的 Data URL(base64 图片) */
|
|
746
739
|
async toDataURL() {
|
|
747
|
-
return
|
|
740
|
+
return g2.toDataURL(this.value, this.qrCodeOption);
|
|
748
741
|
}
|
|
749
742
|
/** 渲染二维码到指定的 canvas 元素 */
|
|
750
743
|
async toCanvas(e) {
|
|
751
|
-
return
|
|
744
|
+
return g2.toCanvas(e, this.value, this.qrCodeOption);
|
|
752
745
|
}
|
|
753
746
|
/** 渲染二维码到指定的 img 元素 */
|
|
754
747
|
async toImage(e) {
|
|
755
748
|
e.src = await this.toDataURL();
|
|
756
749
|
}
|
|
757
750
|
}
|
|
758
|
-
const
|
|
751
|
+
const Me = {
|
|
759
752
|
content: "",
|
|
760
753
|
placement: "top",
|
|
761
754
|
trigger: "hover",
|
|
@@ -764,10 +757,10 @@ const p2 = {
|
|
|
764
757
|
container: document.body,
|
|
765
758
|
className: "tiny-remoter-native-tooltip"
|
|
766
759
|
};
|
|
767
|
-
class
|
|
760
|
+
class Ee {
|
|
768
761
|
constructor(e, t = {}) {
|
|
769
762
|
if (this.tip = null, this.showTimer = 0, this.hideTimer = 0, this.clickOutside = null, this.el = typeof e == "string" ? document.querySelector(e) : e, !this.el) throw new Error("Tooltip: invalid element");
|
|
770
|
-
this.opts = { ...
|
|
763
|
+
this.opts = { ...Me, ...t }, this.bindEvents();
|
|
771
764
|
}
|
|
772
765
|
/* 公开 API */
|
|
773
766
|
open() {
|
|
@@ -777,8 +770,7 @@ class C2 {
|
|
|
777
770
|
}
|
|
778
771
|
close() {
|
|
779
772
|
this.clearTimer(), this.hideTimer = window.setTimeout(() => {
|
|
780
|
-
|
|
781
|
-
(e = this.tip) == null || e.remove(), this.detachExtraEvents();
|
|
773
|
+
this.tip?.remove(), this.detachExtraEvents();
|
|
782
774
|
}, this.opts.hideDelay);
|
|
783
775
|
}
|
|
784
776
|
toggle() {
|
|
@@ -805,18 +797,18 @@ class C2 {
|
|
|
805
797
|
reposition() {
|
|
806
798
|
const e = this.placementList(this.opts.placement);
|
|
807
799
|
for (const t of e) {
|
|
808
|
-
const
|
|
809
|
-
if (this.checkViewport(
|
|
810
|
-
this.applyStyle(
|
|
800
|
+
const s = this.calcStyle(t);
|
|
801
|
+
if (this.checkViewport(s)) {
|
|
802
|
+
this.applyStyle(s), this.tip.className = `${this.opts.className} ${this.opts.className}--${t}`;
|
|
811
803
|
return;
|
|
812
804
|
}
|
|
813
805
|
}
|
|
814
806
|
this.applyStyle(this.calcStyle("top"));
|
|
815
807
|
}
|
|
816
808
|
calcStyle(e) {
|
|
817
|
-
const t = this.el.getBoundingClientRect(),
|
|
818
|
-
let
|
|
819
|
-
return
|
|
809
|
+
const t = this.el.getBoundingClientRect(), s = this.tip.getBoundingClientRect(), i = window.pageYOffset || document.documentElement.scrollTop, n = window.pageXOffset || document.documentElement.scrollLeft, a = 6, [l, h = "center"] = e.split("-");
|
|
810
|
+
let c = 0, d = 0;
|
|
811
|
+
return l === "top" ? c = t.top + i - s.height - a : l === "bottom" ? c = t.bottom + i + a : l === "left" ? d = t.left + n - s.width - a : l === "right" && (d = t.right + n + a), (l === "top" || l === "bottom") && (h === "start" ? d = t.left + n : h === "end" ? d = t.right + n - s.width : d = (t.left + t.right) / 2 + n - s.width / 2), (l === "left" || l === "right") && (h === "start" ? c = t.top + i : h === "end" ? c = t.bottom + i - s.height : c = (t.top + t.bottom) / 2 + i - s.height / 2), { top: Math.round(c), left: Math.round(d) };
|
|
820
812
|
}
|
|
821
813
|
applyStyle({ top: e, left: t }) {
|
|
822
814
|
Object.assign(this.tip.style, {
|
|
@@ -826,8 +818,8 @@ class C2 {
|
|
|
826
818
|
});
|
|
827
819
|
}
|
|
828
820
|
checkViewport({ top: e, left: t }) {
|
|
829
|
-
const
|
|
830
|
-
return t >= 5 && e >= 5 && t +
|
|
821
|
+
const i = window.innerWidth, n = window.innerHeight, a = this.tip.getBoundingClientRect();
|
|
822
|
+
return t >= 5 && e >= 5 && t + a.width <= i - 5 && e + a.height <= n - 5;
|
|
831
823
|
}
|
|
832
824
|
placementList(e) {
|
|
833
825
|
const t = {
|
|
@@ -851,15 +843,14 @@ class C2 {
|
|
|
851
843
|
clearTimeout(this.showTimer), clearTimeout(this.hideTimer);
|
|
852
844
|
}
|
|
853
845
|
isShown() {
|
|
854
|
-
|
|
855
|
-
return !!((e = this.tip) != null && e.parentNode);
|
|
846
|
+
return !!this.tip?.parentNode;
|
|
856
847
|
}
|
|
857
848
|
}
|
|
858
|
-
const
|
|
849
|
+
const w2 = "tiny-remoter-native-tooltip-style";
|
|
859
850
|
(() => {
|
|
860
|
-
if (document.getElementById(
|
|
851
|
+
if (document.getElementById(w2)) return;
|
|
861
852
|
const r = document.createElement("style");
|
|
862
|
-
r.id =
|
|
853
|
+
r.id = w2, r.textContent = `
|
|
863
854
|
.tiny-remoter-native-tooltip {
|
|
864
855
|
position: absolute;
|
|
865
856
|
z-index: 9999;
|
|
@@ -908,20 +899,20 @@ const _ = "tiny-remoter-native-tooltip-style";
|
|
|
908
899
|
}
|
|
909
900
|
`, document.head.appendChild(r);
|
|
910
901
|
})();
|
|
911
|
-
const m2 = "data:image/svg+xml,%3csvg%20viewBox='0%200%2040%2039.9692'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='40.000000'%20height='39.969238'%20fill='none'%20customFrame='url(%23clipPath_3)'%3e%3cdefs%3e%3cclipPath%20id='clipPath_3'%3e%3crect%20width='40.000000'%20height='39.969238'%20x='0.000000'%20y='0.000000'%20rx='12.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_4'%3e%3crect%20width='24.000000'%20height='24.000000'%20x='8.000000'%20y='7.984619'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_5'%3e%3crect%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='9.984619'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_6'%3e%3crect%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='9.984619'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_7'%3e%3crect%20width='21.666666'%20height='13.333333'%20x='20.000000'%20y='9.984619'%20rx='6.666667'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_8'%3e%3crect%20width='6.666667'%20height='6.666667'%20x='23.333496'%20y='9.984619'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3c/defs%3e%3crect%20id='2'%20width='40.000000'%20height='39.969238'%20x='0.000000'%20y='0.000000'%20rx='12.000000'%20fill='rgb(239,246,255)'%20/%3e%3cg%20id='物业'%20clip-path='url(%23clipPath_4)'%20customFrame='url(%23clipPath_4)'%3e%3crect%20id='物业'%20width='24.000000'%20height='24.000000'%20x='8.000000'%20y='7.984619'%20/%3e%3cg%20id='物业服务'%3e%3cg%20id='00公共/红点/图标+红点'%20customFrame='url(%23clipPath_5)'%3e%3crect%20id='00公共/红点/图标+红点'%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='9.984619'%20/%3e%3cg%20id='common_chats_line'%20customFrame='url(%23clipPath_6)'%3e%3crect%20id='common_chats_line'%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='9.984619'%20/%3e%3cpath%20id='形状'%20d='M28.3332%2019.9847C28.3332%2015.3823%2024.6022%2011.6514%2019.9998%2011.6514C15.3975%2011.6514%2011.6665%2015.3823%2011.6665%2019.9847C11.6665%2024.5871%2015.3975%2028.318%2019.9998%2028.318C21.0018%2028.318%2021.9624%2028.1412%2022.8522%2027.8171L26.581%2028.1578C26.7205%2028.1706%2026.8611%2028.1598%2026.9971%2028.1259C27.6669%2027.959%2028.0746%2027.2806%2027.9077%2026.6108L27.2716%2024.0578C27.9477%2022.8535%2028.3332%2021.4641%2028.3332%2019.9847ZM19.9998%2013.1514C16.2259%2013.1514%2013.1665%2016.2108%2013.1665%2019.9847C13.1665%2023.7586%2016.2259%2026.818%2019.9998%2026.818C20.8089%2026.818%2021.5967%2026.678%2022.3388%2026.4077C22.505%2026.3471%2022.6803%2026.3166%2022.8565%2026.3171L22.9887%2026.3233L26.3665%2026.6322L25.8161%2024.4205C25.7352%2024.0958%2025.7655%2023.7548%2025.8997%2023.4512L25.9636%2023.3236C26.5311%2022.3126%2026.8332%2021.1723%2026.8332%2019.9847C26.8332%2016.2108%2023.7738%2013.1514%2019.9998%2013.1514ZM23.1152%2021.2468C23.352%2020.9069%2023.2684%2020.4394%2022.9286%2020.2026C22.5887%2019.9659%2022.1212%2020.0494%2021.8845%2020.3893C21.2894%2021.2433%2020.4268%2021.7347%2019.5102%2021.7347C18.9513%2021.7347%2018.4132%2021.554%2017.9375%2021.2122C17.6011%2020.9705%2017.1325%2021.0472%2016.8908%2021.3836C16.6491%2021.7199%2016.7258%2022.1886%2017.0622%2022.4303C17.7879%2022.9518%2018.6305%2023.2347%2019.5102%2023.2347C20.9394%2023.2347%2022.2505%2022.4878%2023.1152%2021.2468Z'%20fill='rgb(65,142,255)'%20fill-rule='evenodd'%20/%3e%3c/g%3e%3cg%20id='00公共/3位数红点'%20opacity='0'%20customFrame='url(%23clipPath_7)'%3e%3crect%20id='00公共/3位数红点'%20width='21.666666'%20height='13.333333'%20x='20.000000'%20y='9.984619'%20rx='6.666667'%20opacity='0'%20fill='rgb(243,111,100)'%20/%3e%3cpath%20id='文本'%20d='M26.0421%2013.4421C26.4259%2013.4421%2026.7677%2013.5255%2027.0675%2013.6923C27.3672%2013.8591%2027.6005%2014.0931%2027.7673%2014.3942C27.9342%2014.694%2028.0176%2015.0351%2028.0176%2015.4176C28.0176%2015.7173%2027.9633%2015.994%2027.8548%2016.2476C27.7463%2016.4999%2027.5673%2016.8315%2027.3177%2017.2425L25.859%2019.6432L25.0167%2019.6432L26.276%2017.5924C26.3534%2017.4704%2026.4307%2017.3564%2026.508%2017.2507C26.3357%2017.3063%2026.1445%2017.3341%2025.9342%2017.3341C25.5721%2017.3341%2025.2493%2017.2479%2024.9658%2017.0757C24.6837%2016.9034%2024.4633%2016.6701%2024.3046%2016.3758C24.1459%2016.0815%2024.0666%2015.7566%2024.0666%2015.4013C24.0666%2015.0351%2024.1513%2014.7021%2024.3209%2014.4023C24.4904%2014.1012%2024.7264%2013.8659%2025.0289%2013.6964C25.3314%2013.5268%2025.6691%2013.4421%2026.0421%2013.4421ZM26.0421%2016.6505C26.4029%2016.6505%2026.6904%2016.5325%2026.9047%2016.2965C27.119%2016.0605%2027.2262%2015.7539%2027.2262%2015.3769C27.2262%2014.9985%2027.119%2014.694%2026.9047%2014.4634C26.6904%2014.2328%2026.4029%2014.1175%2026.0421%2014.1175C25.6867%2014.1175%2025.4019%2014.2342%2025.1876%2014.4674C24.9733%2014.7007%2024.8661%2015.0039%2024.8661%2015.3769C24.8661%2015.7539%2024.9719%2016.0605%2025.1835%2016.2965C25.3951%2016.5325%2025.6813%2016.6505%2026.0421%2016.6505ZM30.7921%2013.4421C31.1759%2013.4421%2031.5177%2013.5255%2031.8175%2013.6923C32.1172%2013.8591%2032.3505%2014.0931%2032.5173%2014.3942C32.6842%2014.694%2032.7676%2015.0351%2032.7676%2015.4176C32.7676%2015.7173%2032.7133%2015.994%2032.6048%2016.2476C32.4963%2016.4999%2032.3173%2016.8315%2032.0677%2017.2425L30.609%2019.6432L29.7667%2019.6432L31.026%2017.5924C31.1034%2017.4704%2031.1807%2017.3564%2031.258%2017.2507C31.0857%2017.3063%2030.8945%2017.3341%2030.6842%2017.3341C30.3221%2017.3341%2029.9993%2017.2479%2029.7158%2017.0757C29.4337%2016.9034%2029.2133%2016.6701%2029.0546%2016.3758C28.8959%2016.0815%2028.8166%2015.7566%2028.8166%2015.4013C28.8166%2015.0351%2028.9013%2014.7021%2029.0709%2014.4023C29.2404%2014.1012%2029.4764%2013.8659%2029.7789%2013.6964C30.0814%2013.5268%2030.4191%2013.4421%2030.7921%2013.4421ZM30.7921%2016.6505C31.1529%2016.6505%2031.4404%2016.5325%2031.6547%2016.2965C31.869%2016.0605%2031.9762%2015.7539%2031.9762%2015.3769C31.9762%2014.9985%2031.869%2014.694%2031.6547%2014.4634C31.4404%2014.2328%2031.1529%2014.1175%2030.7921%2014.1175C30.4367%2014.1175%2030.1519%2014.2342%2029.9376%2014.4674C29.7233%2014.7007%2029.6161%2015.0039%2029.6161%2015.3769C29.6161%2015.7539%2029.7219%2016.0605%2029.9335%2016.2965C30.1451%2016.5325%2030.4313%2016.6505%2030.7921%2016.6505ZM35.2674%2014.6851L35.9001%2014.6851L35.9001%2016.3188L37.5339%2016.3188L37.5339%2016.9516L35.9001%2016.9516L35.9001%2018.5853L35.2674%2018.5853L35.2674%2016.9516L33.6337%2016.9516L33.6337%2016.3188L35.2674%2016.3188L35.2674%2014.6851Z'%20fill='rgb(255,255,255)'%20fill-rule='nonzero'%20/%3e%3c/g%3e%3cg%20id='00公共/单红点'%20opacity='0'%20customFrame='url(%23clipPath_8)'%3e%3crect%20id='00公共/单红点'%20width='6.666667'%20height='6.666667'%20x='23.333496'%20y='9.984619'%20opacity='0'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20/%3e%3ccircle%20id='红点'%20cx='26.6668301'%20cy='13.3179522'%20r='3.33333325'%20fill='rgb(243,111,100)'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e", g2 = "data:image/svg+xml,%3csvg%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='40.000000'%20height='40.000000'%20fill='none'%20customFrame='url(%23clipPath_12)'%3e%3cdefs%3e%3cclipPath%20id='clipPath_12'%3e%3crect%20width='40.000000'%20height='40.000000'%20x='0.000000'%20y='0.000000'%20rx='12.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_13'%3e%3crect%20width='24.000000'%20height='24.000000'%20x='8.000000'%20y='8.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_14'%3e%3crect%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='10.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3c/defs%3e%3crect%20id='4'%20width='40.000000'%20height='40.000000'%20x='0.000000'%20y='0.000000'%20rx='12.000000'%20fill='rgb(234,255,244)'%20/%3e%3cg%20id='我的信息'%20clip-path='url(%23clipPath_13)'%20customFrame='url(%23clipPath_13)'%3e%3crect%20id='我的信息'%20width='24.000000'%20height='24.000000'%20x='8.000000'%20y='8.000000'%20/%3e%3cg%20id='组合%208'%20customFrame='url(%23clipPath_14)'%3e%3crect%20id='组合%208'%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='10.000000'%20/%3e%3cpath%20id='合并'%20d='M28.4994%2012.3142C28.4994%2012.2578%2028.4937%2012.2018%2028.4825%2012.1465C28.4713%2012.0911%2028.4547%2012.0373%2028.4327%2011.9851C28.4107%2011.933%2028.3836%2011.8835%2028.3516%2011.8365C28.3197%2011.7896%2028.2834%2011.7461%2028.2427%2011.7062C28.202%2011.6663%2028.1579%2011.6307%2028.1101%2011.5993C28.0622%2011.568%2028.0117%2011.5415%2027.9585%2011.5199C27.9054%2011.4983%2027.8506%2011.4819%2027.7942%2011.4709C27.7378%2011.4599%2027.6806%2011.4544%2027.6231%2011.4544L24.1832%2011.5199L24.1832%2010L29.0796%2010C29.1472%2010%2029.2143%2010.0065%2029.2806%2010.0194C29.347%2010.0324%2029.4114%2010.0516%2029.4739%2010.077C29.5364%2010.1024%2029.5961%2010.1336%2029.6523%2010.1705C29.7086%2010.2074%2029.7605%2010.2493%2029.8084%2010.2963C29.8562%2010.3433%2029.8991%2010.3944%2029.9367%2010.4496C29.9743%2010.5048%2030.006%2010.5631%2030.0319%2010.6244C30.0578%2010.6858%2030.0773%2010.7491%2030.0905%2010.8142C30.1037%2010.8794%2030.1104%2010.9451%2030.1104%2011.0115L30.1832%2014.4522L28.4992%2014.5L28.4994%2012.3142ZM11.6995%2012.3143C11.6995%2012.2579%2011.7051%2012.2019%2011.7163%2012.1466C11.7275%2012.0912%2011.7441%2012.0374%2011.7661%2011.9852C11.7882%2011.9331%2011.8152%2011.8836%2011.8472%2011.8366C11.8791%2011.7897%2011.9155%2011.7462%2011.9562%2011.7063C11.9968%2011.6664%2012.0409%2011.6308%2012.0888%2011.5994C12.1366%2011.5681%2012.1871%2011.5416%2012.2403%2011.52C12.2934%2011.4984%2012.3482%2011.482%2012.4046%2011.471C12.4611%2011.46%2012.5182%2011.4545%2012.5758%2011.4545L16.0157%2011.52L16.0157%2010.0001L11.1193%2010.0001C11.0516%2010.0001%2010.9846%2010.0066%2010.9182%2010.0196C10.8518%2010.0325%2010.7874%2010.0517%2010.7249%2010.0771C10.6624%2010.1025%2010.6028%2010.1337%2010.5465%2010.1706C10.4902%2010.2075%2010.4383%2010.2494%2010.3904%2010.2964C10.3426%2010.3434%2010.2997%2010.3945%2010.2621%2010.4497C10.2245%2010.5049%2010.1929%2010.5632%2010.167%2010.6245C10.1411%2010.6859%2010.1215%2010.7492%2010.1083%2010.8143C10.0951%2010.8795%2010.0885%2010.9452%2010.0884%2011.0116L10.0157%2014.4523L11.6997%2014.5L11.6995%2012.3143ZM25.3135%2021.8051L25.3135%2022.8167C25.7656%2022.8929%2026.2209%2022.9249%2026.6792%2022.9127C28.3381%2022.9127%2029.1675%2022.326%2029.1675%2021.1527C29.1733%2020.9869%2029.151%2020.825%2029.1006%2020.667C29.0503%2020.509%2028.9747%2020.3641%2028.8742%2020.2322C28.767%2020.1025%2028.6403%2019.9963%2028.4938%2019.9134C28.3474%2019.8306%2028.191%2019.7767%2028.0246%2019.7517L28.0246%2019.7011C28.0971%2019.6839%2028.1676%2019.6606%2028.236%2019.6311C28.3044%2019.6016%2028.3698%2019.5665%2028.4321%2019.5257C28.4944%2019.4848%2028.5526%2019.4389%2028.6069%2019.3879C28.6613%2019.3369%2028.7109%2019.2816%2028.7556%2019.222C28.8003%2019.1624%2028.8394%2019.0994%2028.8732%2019.033C28.9069%2018.9665%2028.9346%2018.8977%2028.9564%2018.8265C28.9782%2018.7552%2028.9937%2018.6826%2029.0028%2018.6086C29.0119%2018.5347%2029.0145%2018.4605%2029.0107%2018.3861C29.0217%2018.2675%2029.0176%2018.1495%2028.9984%2018.0319C28.9791%2017.9144%2028.9454%2017.8012%2028.8971%2017.6923C28.8489%2017.5834%2028.7875%2017.4823%2028.7134%2017.3891C28.6393%2017.2959%2028.5547%2017.2135%2028.4595%2017.1419C28.219%2017.0003%2027.963%2016.8972%2027.6915%2016.8326C27.4199%2016.7679%2027.1449%2016.7446%2026.8664%2016.7626C26.6258%2016.7621%2026.3864%2016.7791%2026.1482%2016.8132C25.9479%2016.8386%2025.7504%2016.8791%2025.5563%2016.9346L25.5563%2017.8854C25.743%2017.8264%2025.9337%2017.7842%2026.128%2017.759C26.3276%2017.73%2026.5282%2017.7148%2026.7298%2017.7134C27.0252%2017.6949%2027.3049%2017.7523%2027.5692%2017.8854C27.6168%2017.9161%2027.6595%2017.9525%2027.6972%2017.9947C27.7348%2018.037%2027.766%2018.0835%2027.791%2018.1343C27.816%2018.1851%2027.8337%2018.2383%2027.8441%2018.294C27.8545%2018.3496%2027.8573%2018.4056%2027.8525%2018.462C27.8566%2018.5278%2027.8514%2018.5927%2027.8367%2018.657C27.822%2018.7212%2027.7986%2018.7821%2027.7663%2018.8395C27.734%2018.897%2027.694%2018.9487%2027.6468%2018.9946C27.5995%2019.0405%2027.5468%2019.0787%2027.4885%2019.1093C27.1544%2019.2631%2026.8037%2019.3306%2026.4364%2019.3117L25.9862%2019.3117L25.9862%2020.1917L26.4466%2020.1917C26.8409%2020.1669%2027.2202%2020.2309%2027.5845%2020.3839C27.6459%2020.4167%2027.7011%2020.4576%2027.7505%2020.5066C27.7999%2020.5556%2027.8412%2020.6107%2027.8745%2020.6718C27.9077%2020.733%2027.9315%2020.7976%2027.9458%2020.8656C27.9602%2020.9337%2027.9644%2021.0024%2027.9587%2021.0717C27.9648%2021.1402%2027.9612%2021.2083%2027.9478%2021.2757C27.9344%2021.3432%2027.912%2021.4074%2027.8801%2021.4683C27.8483%2021.5293%2027.8086%2021.5846%2027.7609%2021.6341C27.7132%2021.6837%2027.6593%2021.7254%2027.5996%2021.7596C27.2884%2021.9045%2026.9613%2021.9685%2026.6184%2021.9518C26.1786%2021.9465%2025.7436%2021.8977%2025.3135%2021.8051ZM21.3382%2018.6238C21.3445%2018.5593%2021.343%2018.495%2021.3335%2018.4308C21.3241%2018.3667%2021.3069%2018.3046%2021.2822%2018.2447C21.2575%2018.1847%2021.226%2018.1287%2021.1876%2018.0765C21.1492%2018.0242%2021.1049%2017.9774%2021.055%2017.936C20.9359%2017.8608%2020.808%2017.806%2020.6714%2017.7714C20.5349%2017.7368%2020.3964%2017.7242%2020.2558%2017.7337C19.8009%2017.7395%2019.356%2017.8087%2018.9208%2017.9411L18.9208%2016.9598C19.4252%2016.8181%2019.9393%2016.7524%2020.4633%2016.7626C20.7322%2016.7484%2020.9964%2016.7773%2021.256%2016.8491C21.5156%2016.9209%2021.7571%2017.032%2021.9806%2017.1824C22.0729%2017.2601%2022.1548%2017.3474%2022.2263%2017.4446C22.2978%2017.5418%2022.3567%2017.646%2022.4034%2017.7573C22.45%2017.8686%2022.483%2017.9838%2022.5021%2018.1029C22.5213%2018.222%2022.5261%2018.3417%2022.5167%2018.462C22.5245%2018.7882%2022.4655%2019.1017%2022.3396%2019.4027C22.1879%2019.7384%2021.984%2020.0384%2021.7277%2020.3029C21.3021%2020.7337%2020.8502%2021.135%2020.3721%2021.5067L19.9928%2021.8051L19.9928%2021.8759L22.6938%2021.8759L22.6938%2022.8419L18.5464%2022.8419L18.5464%2021.7697C19.2882%2021.1796%2019.8579%2020.6975%2020.2558%2020.3232C20.574%2020.0432%2020.8523%2019.728%2021.0905%2019.3774C21.1675%2019.2665%2021.2269%2019.1469%2021.2691%2019.0187C21.3113%2018.8904%2021.3344%2018.7588%2021.3382%2018.6238ZM12.3102%2017.2127L12.3102%2018.1939L13.7769%2017.9107L13.7769%2022.8419L14.9605%2022.8419L14.9605%2016.8486L14.0957%2016.8486L12.3102%2017.2127ZM28.5524%2028.0475C28.5524%2028.104%2028.5467%2028.1599%2028.5353%2028.2152C28.5239%2028.2706%2028.5071%2028.3244%2028.4849%2028.3766C28.4626%2028.4287%2028.4352%2028.4782%2028.4028%2028.5252C28.3705%2028.5721%2028.3337%2028.6156%2028.2925%2028.6555C28.2513%2028.6954%2028.2067%2028.731%2028.1583%2028.7624C28.1098%2028.7937%2028.0587%2028.8202%2028.0049%2028.8418C27.9511%2028.8634%2027.8957%2028.8798%2027.8385%2028.8908C27.7814%2028.9018%2027.7235%2028.9073%2027.6653%2028.9073L24.1832%2028.8418L24.1832%2030.3617L29.1397%2030.3617C29.2082%2030.3617%2029.276%2030.3552%2029.3432%2030.3423C29.4104%2030.3293%2029.4756%2030.3101%2029.5389%2030.2847C29.6022%2030.2593%2029.6625%2030.2281%2029.7195%2030.1912C29.7765%2030.1543%2029.829%2030.1124%2029.8774%2030.0654C29.9259%2030.0184%2029.9693%2029.9673%2030.0074%2029.9121C30.0454%2029.8569%2030.0774%2029.7986%2030.1037%2029.7373C30.1299%2029.6759%2030.1497%2029.6126%2030.163%2029.5475C30.1764%2029.4823%2030.1831%2029.4166%2030.1832%2029.3502L30.1832%2026.0478L28.4785%2026L28.5524%2028.0475ZM11.6308%2028.0099C11.6308%2028.0664%2011.6365%2028.1223%2011.6479%2028.1777C11.6592%2028.233%2011.676%2028.2868%2011.6983%2028.339C11.7206%2028.3911%2011.748%2028.4406%2011.7803%2028.4876C11.8127%2028.5345%2011.8495%2028.578%2011.8906%2028.6179C11.9318%2028.6578%2011.9765%2028.6934%2012.0249%2028.7248C12.0733%2028.7562%2012.1244%2028.7826%2012.1783%2028.8042C12.2321%2028.8259%2012.2875%2028.8422%2012.3446%2028.8532C12.4017%2028.8642%2012.4596%2028.8697%2012.5178%2028.8698L16%2028.8042L16%2030.3241L11.0435%2030.3241C10.975%2030.3241%2010.9071%2030.3176%2010.8399%2030.3047C10.7727%2030.2917%2010.7076%2030.2725%2010.6443%2030.2471C10.581%2030.2217%2010.5206%2030.1906%2010.4637%2030.1537C10.4067%2030.1168%2010.3542%2030.0748%2010.3057%2030.0278C10.2573%2029.9809%2010.2138%2029.9298%2010.1758%2029.8745C10.1377%2029.8193%2010.1057%2029.7611%2010.0795%2029.6997C10.0533%2029.6383%2010.0335%2029.575%2010.0201%2029.5099C10.0068%2029.4448%2010%2029.379%2010%2029.3126L10%2026.0478L11.7047%2026L11.6308%2028.0099Z'%20fill='rgb(14,191,241)'%20fill-rule='evenodd'%20/%3e%3c/g%3e%3c/g%3e%3c/svg%3e", u2 = "data:image/svg+xml,%3csvg%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='40.000000'%20height='40.000000'%20fill='none'%20customFrame='url(%23clipPath_9)'%3e%3cdefs%3e%3cclipPath%20id='clipPath_9'%3e%3crect%20width='40.000000'%20height='40.000000'%20x='0.000000'%20y='0.000000'%20rx='12.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_10'%3e%3crect%20width='24.000000'%20height='24.000000'%20x='8.000000'%20y='8.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_11'%3e%3crect%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='10.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3c/defs%3e%3crect%20id='3'%20width='40.000000'%20height='40.000000'%20x='0.000000'%20y='0.000000'%20rx='12.000000'%20fill='rgb(236,250,254)'%20/%3e%3cg%20id='画板%202310'%20customFrame='url(%23clipPath_10)'%3e%3crect%20id='画板%202310'%20width='24.000000'%20height='24.000000'%20x='8.000000'%20y='8.000000'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20/%3e%3cg%20id='人事服务'%3e%3cg%20id='ic_public_link'%20clip-path='url(%23clipPath_11)'%20customFrame='url(%23clipPath_11)'%3e%3crect%20id='ic_public_link'%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='10.000000'%20/%3e%3cpath%20id='path1'%20d='M9.9999%2019.9917C9.9999%2018.4292%209.99573%2016.8667%209.9999%2015.3042C9.99573%2014.5459%2010.0916%2013.7917%2010.2749%2013.0626C10.6874%2011.5126%2011.6957%2010.5917%2013.2457%2010.2334C14.0207%2010.0667%2014.8166%209.98756%2015.6082%2010.0001C18.6041%2010.0001%2021.5999%2010.0001%2024.5999%2010.0001C25.3541%209.99589%2026.1082%2010.0792%2026.8457%2010.2584C28.4416%2010.6459%2029.3999%2011.6584%2029.7624%2013.2501C29.9291%2014.0001%2030.0041%2014.7667%2029.9957%2015.5376C29.9957%2018.5667%2029.9957%2021.5959%2029.9957%2024.6209C29.9999%2025.3709%2029.9166%2026.1209%2029.7416%2026.8459C29.3499%2028.4459%2028.3332%2029.3959%2026.7457%2029.7626C25.9666%2029.9292%2025.1749%2030.0084%2024.3791%2029.9959C21.3957%2029.9959%2018.4124%2029.9959%2015.4291%2029.9959C14.6666%2030.0042%2013.9082%2029.9167%2013.1666%2029.7417C11.5624%2029.3542%2010.5999%2028.3376%2010.2374%2026.7376C10.0499%2025.9251%209.9999%2025.1126%209.9999%2024.2917C9.9999%2022.8584%209.9999%2021.4251%209.9999%2019.9917Z'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20fill-rule='evenodd'%20/%3e%3ccircle%20id='path2'%20cx='20'%20cy='20'%20r='10'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20/%3e%3cpath%20id='path3'%20d='M25.0333%2021.8666L26.9%2020C28.8083%2018.0916%2028.8083%2015%2026.9%2013.0958C24.9958%2011.1875%2021.9041%2011.1875%2020%2013.0958L18.1291%2014.9625M21.8666%2025.0333L20%2026.9C18.0916%2028.8083%2015%2028.8083%2013.0958%2026.9C11.1875%2024.9958%2011.1875%2021.9041%2013.0958%2020L14.9625%2018.1291'%20fill-rule='nonzero'%20stroke='rgb(14,191,241)'%20stroke-linecap='round'%20stroke-width='1.25'%20/%3e%3cpath%20id='pah4'%20d='M18.125%2021.875L21.875%2018.125'%20stroke='rgb(14,191,241)'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='1.25'%20/%3e%3cpath%20id='path5'%20d='M25.8207%2019.2626L24.0457%2021.0376C23.7998%2021.2834%2023.6748%2021.5292%2023.6748%2021.7751C23.6748%2022.0209%2023.7998%2022.2667%2024.0457%2022.5126C24.1498%2022.6167%2024.2665%2022.6959%2024.3915%2022.7459C24.5123%2022.7917%2024.6415%2022.8167%2024.779%2022.8167C24.9207%2022.8167%2025.0498%2022.7917%2025.1665%2022.7459C25.2957%2022.6959%2025.4123%2022.6167%2025.5165%2022.5126L27.2915%2020.7334C27.8165%2020.2126%2028.2165%2019.6334%2028.4957%2019.0001C28.5082%2018.9667%2028.5248%2018.9334%2028.5373%2018.8959C28.554%2018.8626%2028.5665%2018.8292%2028.579%2018.7917C28.8332%2018.1501%2028.9582%2017.4584%2028.9582%2016.7209C28.9582%2015.9792%2028.8332%2015.2876%2028.579%2014.6459C28.5665%2014.6084%2028.554%2014.5751%2028.5373%2014.5417C28.5248%2014.5042%2028.5082%2014.4709%2028.4957%2014.4376C28.2165%2013.8042%2027.8165%2013.2292%2027.2915%2012.7042C26.7707%2012.1792%2026.1915%2011.7792%2025.5582%2011.5001C25.5248%2011.4876%2025.4915%2011.4709%2025.454%2011.4584C25.4207%2011.4417%2025.3873%2011.4292%2025.354%2011.4167C24.7082%2011.1667%2024.0165%2011.0417%2023.279%2011.0417C22.5373%2011.0417%2021.8457%2011.1667%2021.204%2011.4167C21.1665%2011.4292%2021.1332%2011.4417%2021.0998%2011.4584C21.0623%2011.4709%2021.029%2011.4876%2020.9957%2011.5001C20.3623%2011.7792%2019.7832%2012.1792%2019.2623%2012.7042L17.4832%2014.4792C17.379%2014.5834%2017.2998%2014.7001%2017.2498%2014.8292C17.204%2014.9501%2017.179%2015.0751%2017.179%2015.2167C17.179%2015.3542%2017.204%2015.4834%2017.2498%2015.6042C17.2998%2015.7292%2017.379%2015.8459%2017.4832%2015.9542C17.5915%2016.0584%2017.7082%2016.1376%2017.8332%2016.1876C17.954%2016.2334%2018.0832%2016.2584%2018.2207%2016.2584C18.3623%2016.2584%2018.4915%2016.2334%2018.6082%2016.1876C18.7373%2016.1376%2018.854%2016.0584%2018.9582%2015.9542L20.7332%2014.1751C21.0873%2013.8209%2021.4748%2013.5584%2021.8957%2013.3834C22.3165%2013.2084%2022.779%2013.1251%2023.279%2013.1251C23.7748%2013.1251%2024.2373%2013.2084%2024.6582%2013.3834C25.079%2013.5584%2025.4665%2013.8209%2025.8207%2014.1751C26.1748%2014.5292%2026.4373%2014.9167%2026.6123%2015.3376C26.7873%2015.7584%2026.8748%2016.2167%2026.8748%2016.7209C26.8748%2017.2209%2026.7873%2017.6792%2026.6123%2018.1001C26.4373%2018.5209%2026.1748%2018.9084%2025.8207%2019.2626ZM13.3832%2021.8959C13.5582%2021.4751%2013.8207%2021.0876%2014.1748%2020.7334L15.954%2018.9584C16.0582%2018.8542%2016.1373%2018.7376%2016.1873%2018.6084C16.2332%2018.4876%2016.2582%2018.3626%2016.2582%2018.2209C16.2582%2018.0834%2016.2332%2017.9542%2016.1873%2017.8334C16.1373%2017.7084%2016.0582%2017.5917%2015.954%2017.4834C15.7082%2017.2417%2015.4623%2017.1167%2015.2165%2017.1167C14.9707%2017.1167%2014.7248%2017.2417%2014.479%2017.4834L12.704%2019.2626C12.179%2019.7876%2011.779%2020.3626%2011.4998%2020.9959C11.4873%2021.0292%2011.4707%2021.0626%2011.4582%2021.1001C11.4415%2021.1334%2011.429%2021.1667%2011.4165%2021.2042C11.1665%2021.8459%2011.0415%2022.5376%2011.0415%2023.2792C11.0415%2024.0167%2011.1665%2024.7084%2011.4165%2025.3542C11.429%2025.3876%2011.4415%2025.4209%2011.4582%2025.4584C11.4707%2025.4917%2011.4873%2025.5251%2011.4998%2025.5584C11.779%2026.1917%2012.179%2026.7709%2012.704%2027.2917C13.2248%2027.8167%2013.804%2028.2167%2014.4373%2028.4959C14.4707%2028.5084%2014.504%2028.5251%2014.5415%2028.5376C14.5748%2028.5542%2014.6082%2028.5667%2014.6457%2028.5792C15.2873%2028.8292%2015.979%2028.9584%2016.7207%2028.9584C17.4582%2028.9584%2018.1498%2028.8292%2018.7915%2028.5792C18.829%2028.5667%2018.8623%2028.5542%2018.8957%2028.5376C18.9332%2028.5251%2018.9665%2028.5084%2018.9998%2028.4959C19.6332%2028.2167%2020.2123%2027.8167%2020.7332%2027.2917L22.5123%2025.5167C22.6165%2025.4126%2022.6957%2025.2959%2022.7457%2025.1667C22.7915%2025.0459%2022.8165%2024.9209%2022.8165%2024.7792C22.8165%2024.6417%2022.7915%2024.5126%2022.7457%2024.3917C22.6957%2024.2667%2022.6165%2024.1501%2022.5123%2024.0417C22.2665%2023.8001%2022.0207%2023.6751%2021.7748%2023.6751C21.529%2023.6751%2021.2832%2023.8001%2021.0373%2024.0417L19.2623%2025.8209C18.9082%2026.1751%2018.5207%2026.4376%2018.0998%2026.6126C17.679%2026.7876%2017.2165%2026.8751%2016.7207%2026.8751C16.2207%2026.8751%2015.7582%2026.7876%2015.3373%2026.6126C14.9165%2026.4376%2014.529%2026.1751%2014.1748%2025.8209C13.8207%2025.4667%2013.5582%2025.0792%2013.3832%2024.6584C13.2082%2024.2376%2013.1248%2023.7792%2013.1248%2023.2792C13.1248%2022.7751%2013.2082%2022.3167%2013.3832%2021.8959Z'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20fill-rule='evenodd'%20/%3e%3cpath%20id='path6'%20d='M21.8127%2016.7458C21.746%2016.7874%2021.6877%2016.8374%2021.6293%2016.8916L16.8918%2021.6291C16.8377%2021.6874%2016.7877%2021.7499%2016.746%2021.8124C16.7127%2021.8624%2016.6877%2021.9166%2016.6627%2021.9749C16.6377%2022.0374%2016.6168%2022.1041%2016.6043%2022.1708C16.5918%2022.2333%2016.5835%2022.2999%2016.5835%2022.3666C16.5835%2022.4333%2016.5918%2022.4999%2016.6043%2022.5666C16.6168%2022.6333%2016.6377%2022.6999%2016.6627%2022.7624C16.6877%2022.8166%2016.7127%2022.8708%2016.746%2022.9208C16.7877%2022.9874%2016.8377%2023.0499%2016.8918%2023.1041C16.946%2023.1583%2017.0085%2023.2083%2017.0752%2023.2499C17.1252%2023.2833%2017.1793%2023.3083%2017.2335%2023.3333C17.3002%2023.3583%2017.3627%2023.3791%2017.4293%2023.3916C17.496%2023.4041%2017.5627%2023.4124%2017.6293%2023.4124C17.696%2023.4124%2017.7627%2023.4041%2017.8252%2023.3916C17.8918%2023.3791%2017.9585%2023.3583%2018.021%2023.3333C18.0793%2023.3083%2018.1335%2023.2833%2018.1835%2023.2499C18.246%2023.2083%2018.3085%2023.1583%2018.3668%2023.1041L23.1043%2018.3666C23.1585%2018.3083%2023.2085%2018.2499%2023.2502%2018.1833C23.2835%2018.1333%2023.3085%2018.0791%2023.3335%2018.0208C23.3585%2017.9583%2023.3793%2017.8916%2023.3918%2017.8249C23.4043%2017.7624%2023.4127%2017.6958%2023.4127%2017.6291C23.4127%2017.5624%2023.4043%2017.4958%2023.3918%2017.4291C23.3793%2017.3624%2023.3585%2017.2999%2023.3335%2017.2333C23.3085%2017.1791%2023.2835%2017.1249%2023.2502%2017.0749C23.2085%2017.0083%2023.1585%2016.9458%2023.1043%2016.8916C23.046%2016.8374%2022.9877%2016.7874%2022.921%2016.7458C22.871%2016.7124%2022.8168%2016.6874%2022.7627%2016.6624C22.696%2016.6374%2022.6335%2016.6166%2022.5668%2016.6041C22.5002%2016.5916%2022.4335%2016.5833%2022.3668%2016.5833C22.3002%2016.5833%2022.2335%2016.5916%2022.171%2016.6041C22.1043%2016.6166%2022.0377%2016.6374%2021.9752%2016.6624C21.9168%2016.6874%2021.8627%2016.7124%2021.8127%2016.7458Z'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20fill-rule='evenodd'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e", f2 = "data:image/svg+xml,%3csvg%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='40.000000'%20height='40.000000'%20fill='none'%20customFrame='url(%23clipPath_0)'%3e%3cdefs%3e%3cclipPath%20id='clipPath_0'%3e%3crect%20width='40.000000'%20height='40.000000'%20x='0.000000'%20y='0.000000'%20rx='12.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_1'%3e%3crect%20width='24.000000'%20height='24.000000'%20x='8.000000'%20y='8.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_2'%3e%3crect%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='10.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3c/defs%3e%3crect%20id='1'%20width='40.000000'%20height='40.000000'%20x='0.000000'%20y='0.000000'%20rx='12.000000'%20fill='rgb(236,250,254)'%20/%3e%3cg%20id='车辆'%20clip-path='url(%23clipPath_1)'%20customFrame='url(%23clipPath_1)'%3e%3crect%20id='车辆'%20width='24.000000'%20height='24.000000'%20x='8.000000'%20y='8.000000'%20/%3e%3cg%20id='编组'%3e%3cg%20id='ic_public_qrcode'%20clip-path='url(%23clipPath_2)'%20customFrame='url(%23clipPath_2)'%3e%3crect%20id='ic_public_qrcode'%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='10.000000'%20/%3e%3cg%20id='ic_public_qrcode_1_1'%3e%3cpath%20id='ic_public_qrcode_2_0'%20d='M10.6273%2019.9924C10.6273%2018.5277%2010.6222%2017.0631%2010.6273%2015.5985C10.6243%2014.8898%2010.7114%2014.1836%2010.8865%2013.4968C11.2702%2012.0432%2012.2171%2011.1805%2013.6693%2010.8458C14.3974%2010.6885%2015.1411%2010.6148%2015.886%2010.6261C18.6946%2010.6261%2021.5035%2010.6261%2024.3127%2010.6261C25.0221%2010.6217%2025.7295%2010.7029%2026.4195%2010.8678C27.9156%2011.2339%2028.8134%2012.1816%2029.1554%2013.6725C29.3092%2014.3772%2029.3826%2015.097%2029.3744%2015.8182C29.3744%2018.6571%2029.3744%2021.4963%2029.3744%2024.3357C29.3782%2025.0383%2029.2973%2025.7388%2029.1334%2026.422C28.7673%2027.9189%2027.8153%2028.8123%2026.3243%2029.1543C25.5961%2029.311%2024.8524%2029.3847%2024.1076%2029.374C21.3107%2029.374%2018.514%2029.374%2015.7176%2029.374C15.0027%2029.3798%2014.2897%2029.2999%2013.5939%2029.136C12.0912%2028.7698%2011.189%2027.8178%2010.8477%2026.3195C10.6734%2025.5579%2010.6273%2024.7941%2010.6273%2024.0237C10.6273%2022.6802%2010.6273%2021.3364%2010.6273%2019.9924Z'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20fill-rule='nonzero'%20/%3e%3cpath%20id='ic_public_qrcode_2_0'%20d='M10.6273%2015.5985C10.6243%2014.8898%2010.7114%2014.1836%2010.8865%2013.4968C11.2702%2012.0432%2012.2171%2011.1805%2013.6693%2010.8458C14.3974%2010.6885%2015.1411%2010.6148%2015.886%2010.6261C18.6946%2010.6261%2021.5035%2010.6261%2024.3127%2010.6261C25.0221%2010.6217%2025.7295%2010.7029%2026.4195%2010.8678C27.9156%2011.2339%2028.8134%2012.1816%2029.1554%2013.6725C29.3092%2014.3772%2029.3826%2015.097%2029.3744%2015.8182C29.3744%2018.6571%2029.3744%2021.4963%2029.3744%2024.3357C29.3782%2025.0383%2029.2973%2025.7388%2029.1334%2026.422C28.7673%2027.9189%2027.8153%2028.8123%2026.3243%2029.1543C25.5961%2029.311%2024.8524%2029.3847%2024.1076%2029.374C21.3107%2029.374%2018.514%2029.374%2015.7176%2029.374C15.0027%2029.3798%2014.2897%2029.2999%2013.5939%2029.136C12.0912%2028.7698%2011.189%2027.8178%2010.8477%2026.3195C10.6734%2025.5579%2010.6273%2024.7941%2010.6273%2024.0237C10.6273%2022.6802%2010.6273%2021.3364%2010.6273%2019.9924C10.6273%2018.5277%2010.6222%2017.0631%2010.6273%2015.5985Z'%20fill-rule='nonzero'%20stroke='rgb(255,255,255)'%20stroke-opacity='0'%20stroke-width='1.25'%20/%3e%3cpath%20id='ic_public_qrcode_2_1'%20d='M10.6273%2015.5985C10.6243%2014.8898%2010.7114%2014.1836%2010.8865%2013.4968C11.2702%2012.0432%2012.2171%2011.1805%2013.6693%2010.8458C14.3974%2010.6885%2015.1411%2010.6148%2015.886%2010.6261C18.6946%2010.6261%2021.5035%2010.6261%2024.3127%2010.6261C25.0221%2010.6217%2025.7295%2010.7029%2026.4195%2010.8678C27.9156%2011.2339%2028.8134%2012.1816%2029.1554%2013.6725C29.3092%2014.3772%2029.3826%2015.097%2029.3744%2015.8182C29.3744%2018.6571%2029.3744%2021.4963%2029.3744%2024.3357C29.3782%2025.0383%2029.2973%2025.7388%2029.1334%2026.422C28.7673%2027.9189%2027.8153%2028.8123%2026.3243%2029.1543C25.5961%2029.311%2024.8524%2029.3847%2024.1076%2029.374C21.3107%2029.374%2018.514%2029.374%2015.7176%2029.374C15.0027%2029.3798%2014.2897%2029.2999%2013.5939%2029.136C12.0912%2028.7698%2011.189%2027.8178%2010.8477%2026.3195C10.6734%2025.5579%2010.6273%2024.7941%2010.6273%2024.0237C10.6273%2022.6802%2010.6273%2021.3364%2010.6273%2019.9924C10.6273%2018.5277%2010.6222%2017.0631%2010.6273%2015.5985Z'%20opacity='0.200000003'%20fill-rule='nonzero'%20stroke='rgb(255,255,255)'%20stroke-opacity='0'%20stroke-width='1.25'%20/%3e%3ccircle%20id='ic_public_qrcode_2_2'%20cx='20'%20cy='20'%20r='10'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20/%3e%3cpath%20id='ic_public_qrcode_2_3'%20d='M17.5%2011.25C17.9602%2011.25%2018.3333%2011.6231%2018.3333%2012.0833L18.3333%2017.5C18.3333%2017.9602%2017.9602%2018.3333%2017.5%2018.3333L12.0833%2018.3333C11.6231%2018.3333%2011.25%2017.9602%2011.25%2017.5L11.25%2012.0833C11.25%2011.6231%2011.6231%2011.25%2012.0833%2011.25L17.5%2011.25ZM17.5%2021.6667C17.9602%2021.6667%2018.3333%2022.0398%2018.3333%2022.5L18.3333%2027.9167C18.3333%2028.3769%2017.9602%2028.75%2017.5%2028.75L12.0833%2028.75C11.6231%2028.75%2011.25%2028.3769%2011.25%2027.9167L11.25%2022.5C11.25%2022.0398%2011.6231%2021.6667%2012.0833%2021.6667L17.5%2021.6667ZM27.9167%2011.25C28.3769%2011.25%2028.75%2011.6231%2028.75%2012.0833L28.75%2017.5C28.75%2017.9602%2028.3769%2018.3333%2027.9167%2018.3333L22.5%2018.3333C22.0398%2018.3333%2021.6667%2017.9602%2021.6667%2017.5L21.6667%2012.0833C21.6667%2011.6231%2022.0398%2011.25%2022.5%2011.25L27.9167%2011.25Z'%20fill-rule='evenodd'%20stroke='rgb(14,191,241)'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='1.25'%20/%3e%3cpath%20id='ic_public_qrcode_2_4'%20d='M17.5002%2010.8333C18.1905%2010.8333%2018.7502%2011.3929%2018.7502%2012.0833L18.7502%2017.4999C18.7502%2018.1903%2018.1905%2018.7499%2017.5002%2018.7499L12.0835%2018.7499C11.3931%2018.7499%2010.8335%2018.1903%2010.8335%2017.4999L10.8335%2012.0833C10.8335%2011.3929%2011.3931%2010.8333%2012.0835%2010.8333L17.5002%2010.8333ZM17.5002%2011.6666L12.0835%2011.6666C11.8534%2011.6666%2011.6668%2011.8531%2011.6668%2012.0833L11.6668%2017.4999C11.6668%2017.73%2011.8534%2017.9166%2012.0835%2017.9166L17.5002%2017.9166C17.7303%2017.9166%2017.9168%2017.73%2017.9168%2017.4999L17.9168%2012.0833C17.9168%2011.8531%2017.7303%2011.6666%2017.5002%2011.6666ZM17.5002%2021.2499C18.1905%2021.2499%2018.7502%2021.8096%2018.7502%2022.4999L18.7502%2027.9166C18.7502%2028.6069%2018.1905%2029.1666%2017.5002%2029.1666L12.0835%2029.1666C11.3931%2029.1666%2010.8335%2028.6069%2010.8335%2027.9166L10.8335%2022.4999C10.8335%2021.8096%2011.3931%2021.2499%2012.0835%2021.2499L17.5002%2021.2499ZM17.5002%2022.0833L12.0835%2022.0833C11.8534%2022.0833%2011.6668%2022.2698%2011.6668%2022.4999L11.6668%2027.9166C11.6668%2028.1467%2011.8534%2028.3333%2012.0835%2028.3333L17.5002%2028.3333C17.7303%2028.3333%2017.9168%2028.1467%2017.9168%2027.9166L17.9168%2022.4999C17.9168%2022.2698%2017.7303%2022.0833%2017.5002%2022.0833ZM27.9168%2010.8333C28.6072%2010.8333%2029.1668%2011.3929%2029.1668%2012.0833L29.1668%2017.4999C29.1668%2018.1903%2028.6072%2018.7499%2027.9168%2018.7499L22.5002%2018.7499C21.8098%2018.7499%2021.2502%2018.1903%2021.2502%2017.4999L21.2502%2012.0833C21.2502%2011.3929%2021.8098%2010.8333%2022.5002%2010.8333L27.9168%2010.8333ZM27.9168%2011.6666L22.5002%2011.6666C22.27%2011.6666%2022.0835%2011.8531%2022.0835%2012.0833L22.0835%2017.4999C22.0835%2017.73%2022.27%2017.9166%2022.5002%2017.9166L27.9168%2017.9166C28.1469%2017.9166%2028.3335%2017.73%2028.3335%2017.4999L28.3335%2012.0833C28.3335%2011.8531%2028.1469%2011.6666%2027.9168%2011.6666Z'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20fill-rule='nonzero'%20/%3e%3cpath%20id='ic_public_qrcode_2_4'%20d='M18.7502%2012.0833L18.7502%2017.4999C18.7502%2018.1903%2018.1905%2018.7499%2017.5002%2018.7499L12.0835%2018.7499C11.3931%2018.7499%2010.8335%2018.1903%2010.8335%2017.4999L10.8335%2012.0833C10.8335%2011.3929%2011.3931%2010.8333%2012.0835%2010.8333L17.5002%2010.8333C18.1905%2010.8333%2018.7502%2011.3929%2018.7502%2012.0833ZM12.0835%2011.6666C11.8534%2011.6666%2011.6668%2011.8531%2011.6668%2012.0833L11.6668%2017.4999C11.6668%2017.73%2011.8534%2017.9166%2012.0835%2017.9166L17.5002%2017.9166C17.7303%2017.9166%2017.9168%2017.73%2017.9168%2017.4999L17.9168%2012.0833C17.9168%2011.8531%2017.7303%2011.6666%2017.5002%2011.6666L12.0835%2011.6666ZM18.7502%2022.4999L18.7502%2027.9166C18.7502%2028.6069%2018.1905%2029.1666%2017.5002%2029.1666L12.0835%2029.1666C11.3931%2029.1666%2010.8335%2028.6069%2010.8335%2027.9166L10.8335%2022.4999C10.8335%2021.8096%2011.3931%2021.2499%2012.0835%2021.2499L17.5002%2021.2499C18.1905%2021.2499%2018.7502%2021.8096%2018.7502%2022.4999ZM12.0835%2022.0833C11.8534%2022.0833%2011.6668%2022.2698%2011.6668%2022.4999L11.6668%2027.9166C11.6668%2028.1467%2011.8534%2028.3333%2012.0835%2028.3333L17.5002%2028.3333C17.7303%2028.3333%2017.9168%2028.1467%2017.9168%2027.9166L17.9168%2022.4999C17.9168%2022.2698%2017.7303%2022.0833%2017.5002%2022.0833L12.0835%2022.0833ZM29.1668%2012.0833L29.1668%2017.4999C29.1668%2018.1903%2028.6072%2018.7499%2027.9168%2018.7499L22.5002%2018.7499C21.8098%2018.7499%2021.2502%2018.1903%2021.2502%2017.4999L21.2502%2012.0833C21.2502%2011.3929%2021.8098%2010.8333%2022.5002%2010.8333L27.9168%2010.8333C28.6072%2010.8333%2029.1668%2011.3929%2029.1668%2012.0833ZM22.5002%2011.6666C22.27%2011.6666%2022.0835%2011.8531%2022.0835%2012.0833L22.0835%2017.4999C22.0835%2017.73%2022.27%2017.9166%2022.5002%2017.9166L27.9168%2017.9166C28.1469%2017.9166%2028.3335%2017.73%2028.3335%2017.4999L28.3335%2012.0833C28.3335%2011.8531%2028.1469%2011.6666%2027.9168%2011.6666L22.5002%2011.6666Z'%20fill-rule='nonzero'%20stroke='rgb(255,255,255)'%20stroke-opacity='0'%20stroke-linejoin='round'%20stroke-width='1.25'%20/%3e%3cpath%20id='ic_public_qrcode_2_5'%20d='M27.9165%2021.6667L27.9165%2024.5834L28.7498%2024.5834L28.7498%2021.6667L27.9165%2021.6667ZM24.5832%2021.6667L24.5832%2022.639L24.5828%2022.6388L24.5832%2024.5834L23.6109%2024.5834L23.6107%2022.6388L21.6665%2022.639L21.6665%2021.6667L24.5832%2021.6667ZM21.6665%2025.8334L21.6665%2028.7501L22.4998%2028.7501L22.4998%2025.8334L21.6665%2025.8334ZM27.9165%2027.9167L27.9165%2028.7501L28.7498%2028.7501L28.7498%2027.9167L27.9165%2027.9167ZM25.8332%2025.8334L25.8332%2026.6667L26.6665%2026.6667L26.6665%2025.8334L25.8332%2025.8334Z'%20fill='rgb(14,191,241)'%20fill-rule='nonzero'%20/%3e%3cpath%20id='ic_public_qrcode_2_5'%20d='M27.9165%2024.5834L28.7498%2024.5834L28.7498%2021.6667L27.9165%2021.6667L27.9165%2024.5834ZM24.5832%2022.639L24.5828%2022.6388L24.5832%2024.5834L23.6109%2024.5834L23.6107%2022.6388L21.6665%2022.639L21.6665%2021.6667L24.5832%2021.6667L24.5832%2022.639ZM21.6665%2028.7501L22.4998%2028.7501L22.4998%2025.8334L21.6665%2025.8334L21.6665%2028.7501ZM27.9165%2028.7501L28.7498%2028.7501L28.7498%2027.9167L27.9165%2027.9167L27.9165%2028.7501ZM25.8332%2026.6667L26.6665%2026.6667L26.6665%2025.8334L25.8332%2025.8334L25.8332%2026.6667Z'%20fill-rule='nonzero'%20stroke='rgb(14,191,241)'%20stroke-linejoin='round'%20stroke-width='1.25'%20/%3e%3cpath%20id='ic_public_qrcode_2_6'%20d='M14.375%2014.375L14.375%2015.2083L15.2083%2015.2083L15.2083%2014.375L14.375%2014.375ZM14.375%2024.7917L14.375%2025.625L15.2083%2025.625L15.2083%2024.7917L14.375%2024.7917ZM24.7917%2014.375L24.7917%2015.2083L25.625%2015.2083L25.625%2014.375L24.7917%2014.375Z'%20fill='rgb(14,191,241)'%20fill-rule='nonzero'%20/%3e%3cpath%20id='ic_public_qrcode_2_6'%20d='M14.375%2015.2083L15.2083%2015.2083L15.2083%2014.375L14.375%2014.375L14.375%2015.2083ZM14.375%2025.625L15.2083%2025.625L15.2083%2024.7917L14.375%2024.7917L14.375%2025.625ZM24.7917%2015.2083L25.625%2015.2083L25.625%2014.375L24.7917%2014.375L24.7917%2015.2083Z'%20fill-rule='nonzero'%20stroke='rgb(14,191,241)'%20stroke-linejoin='round'%20stroke-width='1.25'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e", w2 = "data:image/svg+xml,%3csvg%20viewBox='0%200%2012%2012'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='12.000000'%20height='12.000000'%20fill='none'%3e%3cdefs%3e%3cfilter%20id='pixso_custom_mask_type_luminance'%3e%3cfeColorMatrix%20type='matrix'%20values='1%200%200%200%200%200%201%200%200%200%200%200%201%200%200%200%200%200%201%200%20'%20/%3e%3c/filter%3e%3c/defs%3e%3cmask%20id='mask_0'%20width='11.999876'%20height='11.999876'%20x='0.000000'%20y='0.000000'%20maskUnits='userSpaceOnUse'%3e%3cg%20filter='url(%23pixso_custom_mask_type_luminance)'%3e%3cg%20id='mask401_19830'%3e%3cpath%20id='蒙版'%20d='M0%200L11.9999%200L11.9999%2011.9999L0%2011.9999L0%200ZM2.69992%201.34999L8.09977%201.34999C9.5082%201.34999%2010.6498%202.49167%2010.6498%203.89998L10.6498%209.2999C10.6498%2010.7082%209.5082%2011.8499%208.09977%2011.8499L2.69992%2011.8499C1.29149%2011.8499%200.149901%2010.7082%200.149901%209.2999L0.149901%203.89998C0.149901%202.49167%201.29149%201.34999%202.69992%201.34999Z'%20fill='rgb(196,196,196)'%20fill-rule='evenodd'%20/%3e%3c/g%3e%3c/g%3e%3c/mask%3e%3crect%20id='ic_public_copy'%20width='12.000000'%20height='12.000000'%20x='0.000000'%20y='0.000000'%20/%3e%3crect%20id='ic_public_copy-复制/base/ic_public_copy'%20width='11.999876'%20height='11.999876'%20x='0.000000'%20y='0.000000'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20/%3e%3cpath%20id='path1'%20d='M0.000134537%205.99497C0.000134537%205.05748%20-0.00236544%204.11999%200.000134537%203.1825C-0.00236544%202.72751%200.055134%202.27501%200.165133%201.83752C0.41263%200.907526%201.01762%200.355032%201.94761%200.140034C2.41261%200.040035%202.8901%20-0.00746449%203.3651%203.54269e-05C5.16258%203.54269e-05%206.96006%203.54269e-05%208.76004%203.54269e-05C9.21254%20-0.00246455%209.66503%200.0475349%2010.1075%200.155034C11.065%200.387531%2011.64%200.995025%2011.8575%201.95002C11.9575%202.40001%2012.005%202.86001%2011.9975%203.3225C11.9975%205.13998%2011.9975%206.95746%2011.9975%208.77244C12%209.22244%2011.95%209.67243%2011.845%2010.1099C11.61%2011.0674%2011%2011.6374%2010.0475%2011.8574C9.58003%2011.9574%209.10504%2012.0049%208.62754%2011.9974C6.83756%2011.9974%205.04758%2011.9974%203.2576%2011.9974C2.80011%2012.0024%202.34511%2011.9499%201.90011%2011.8449C0.937625%2011.6124%200.360131%2011.0024%200.142633%2010.0424C0.0301342%209.55494%200.000134537%209.06744%200.000134537%208.57495C0.000134537%207.71495%200.000134537%206.85496%200.000134537%205.99497Z'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20fill-rule='evenodd'%20/%3e%3ccircle%20id='path2'%20cx='5.99993801'%20cy='5.99993801'%20r='5.99993801'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20/%3e%3cg%20id='mask'%20mask='url(%23mask_0)'%3e%3cg%20id='组合%208'%3e%3cpath%20id='path'%20d='M11.1%203.89993L11.1%206.8999C11.1%208.55488%209.75502%209.89737%208.10004%209.89737L5.10007%209.89737C3.44258%209.89737%202.1001%208.55488%202.1001%206.8999L2.1001%203.89993C2.1001%202.24245%203.44258%200.897461%205.10007%200.897461L8.10004%200.897461C9.75502%200.897461%2011.1%202.24245%2011.1%203.89993Z'%20fill-rule='nonzero'%20stroke='rgb(25,25,25)'%20stroke-linejoin='round'%20stroke-width='0.749992251'%20/%3e%3c/g%3e%3c/g%3e%3cpath%20id='path4'%20d='M2.10008%202.39746L8.10002%202.39746C8.92751%202.39746%209.6%203.06995%209.6%203.89995L9.6%209.89738C9.6%2010.7274%208.92751%2011.3999%208.10002%2011.3999L2.10008%2011.3999C1.27009%2011.3999%200.600098%2010.7274%200.600098%209.89738L0.600098%203.89995C0.600098%203.06995%201.27009%202.39746%202.10008%202.39746Z'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20fill-rule='evenodd'%20/%3e%3cpath%20id='path4'%20d='M9.6%203.89995L9.6%209.89738C9.6%2010.7274%208.92751%2011.3999%208.10002%2011.3999L2.10008%2011.3999C1.27009%2011.3999%200.600098%2010.7274%200.600098%209.89738L0.600098%203.89995C0.600098%203.06995%201.27009%202.39746%202.10008%202.39746L8.10002%202.39746C8.92751%202.39746%209.6%203.06995%209.6%203.89995Z'%20fill-rule='nonzero'%20stroke='rgb(25,25,25)'%20stroke-linejoin='round'%20stroke-width='0.749992251'%20/%3e%3c/svg%3e", y2 = "https://agent.opentiny.design/tiny-robot", M = "https://ai.opentiny.design/next-remoter", k = (r) => [
|
|
902
|
+
const Pe = "data:image/svg+xml,%3csvg%20viewBox='0%200%2040%2039.9692'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='40.000000'%20height='39.969238'%20fill='none'%20customFrame='url(%23clipPath_3)'%3e%3cdefs%3e%3cclipPath%20id='clipPath_3'%3e%3crect%20width='40.000000'%20height='39.969238'%20x='0.000000'%20y='0.000000'%20rx='12.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_4'%3e%3crect%20width='24.000000'%20height='24.000000'%20x='8.000000'%20y='7.984619'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_5'%3e%3crect%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='9.984619'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_6'%3e%3crect%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='9.984619'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_7'%3e%3crect%20width='21.666666'%20height='13.333333'%20x='20.000000'%20y='9.984619'%20rx='6.666667'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_8'%3e%3crect%20width='6.666667'%20height='6.666667'%20x='23.333496'%20y='9.984619'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3c/defs%3e%3crect%20id='2'%20width='40.000000'%20height='39.969238'%20x='0.000000'%20y='0.000000'%20rx='12.000000'%20fill='rgb(239,246,255)'%20/%3e%3cg%20id='物业'%20clip-path='url(%23clipPath_4)'%20customFrame='url(%23clipPath_4)'%3e%3crect%20id='物业'%20width='24.000000'%20height='24.000000'%20x='8.000000'%20y='7.984619'%20/%3e%3cg%20id='物业服务'%3e%3cg%20id='00公共/红点/图标+红点'%20customFrame='url(%23clipPath_5)'%3e%3crect%20id='00公共/红点/图标+红点'%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='9.984619'%20/%3e%3cg%20id='common_chats_line'%20customFrame='url(%23clipPath_6)'%3e%3crect%20id='common_chats_line'%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='9.984619'%20/%3e%3cpath%20id='形状'%20d='M28.3332%2019.9847C28.3332%2015.3823%2024.6022%2011.6514%2019.9998%2011.6514C15.3975%2011.6514%2011.6665%2015.3823%2011.6665%2019.9847C11.6665%2024.5871%2015.3975%2028.318%2019.9998%2028.318C21.0018%2028.318%2021.9624%2028.1412%2022.8522%2027.8171L26.581%2028.1578C26.7205%2028.1706%2026.8611%2028.1598%2026.9971%2028.1259C27.6669%2027.959%2028.0746%2027.2806%2027.9077%2026.6108L27.2716%2024.0578C27.9477%2022.8535%2028.3332%2021.4641%2028.3332%2019.9847ZM19.9998%2013.1514C16.2259%2013.1514%2013.1665%2016.2108%2013.1665%2019.9847C13.1665%2023.7586%2016.2259%2026.818%2019.9998%2026.818C20.8089%2026.818%2021.5967%2026.678%2022.3388%2026.4077C22.505%2026.3471%2022.6803%2026.3166%2022.8565%2026.3171L22.9887%2026.3233L26.3665%2026.6322L25.8161%2024.4205C25.7352%2024.0958%2025.7655%2023.7548%2025.8997%2023.4512L25.9636%2023.3236C26.5311%2022.3126%2026.8332%2021.1723%2026.8332%2019.9847C26.8332%2016.2108%2023.7738%2013.1514%2019.9998%2013.1514ZM23.1152%2021.2468C23.352%2020.9069%2023.2684%2020.4394%2022.9286%2020.2026C22.5887%2019.9659%2022.1212%2020.0494%2021.8845%2020.3893C21.2894%2021.2433%2020.4268%2021.7347%2019.5102%2021.7347C18.9513%2021.7347%2018.4132%2021.554%2017.9375%2021.2122C17.6011%2020.9705%2017.1325%2021.0472%2016.8908%2021.3836C16.6491%2021.7199%2016.7258%2022.1886%2017.0622%2022.4303C17.7879%2022.9518%2018.6305%2023.2347%2019.5102%2023.2347C20.9394%2023.2347%2022.2505%2022.4878%2023.1152%2021.2468Z'%20fill='rgb(65,142,255)'%20fill-rule='evenodd'%20/%3e%3c/g%3e%3cg%20id='00公共/3位数红点'%20opacity='0'%20customFrame='url(%23clipPath_7)'%3e%3crect%20id='00公共/3位数红点'%20width='21.666666'%20height='13.333333'%20x='20.000000'%20y='9.984619'%20rx='6.666667'%20opacity='0'%20fill='rgb(243,111,100)'%20/%3e%3cpath%20id='文本'%20d='M26.0421%2013.4421C26.4259%2013.4421%2026.7677%2013.5255%2027.0675%2013.6923C27.3672%2013.8591%2027.6005%2014.0931%2027.7673%2014.3942C27.9342%2014.694%2028.0176%2015.0351%2028.0176%2015.4176C28.0176%2015.7173%2027.9633%2015.994%2027.8548%2016.2476C27.7463%2016.4999%2027.5673%2016.8315%2027.3177%2017.2425L25.859%2019.6432L25.0167%2019.6432L26.276%2017.5924C26.3534%2017.4704%2026.4307%2017.3564%2026.508%2017.2507C26.3357%2017.3063%2026.1445%2017.3341%2025.9342%2017.3341C25.5721%2017.3341%2025.2493%2017.2479%2024.9658%2017.0757C24.6837%2016.9034%2024.4633%2016.6701%2024.3046%2016.3758C24.1459%2016.0815%2024.0666%2015.7566%2024.0666%2015.4013C24.0666%2015.0351%2024.1513%2014.7021%2024.3209%2014.4023C24.4904%2014.1012%2024.7264%2013.8659%2025.0289%2013.6964C25.3314%2013.5268%2025.6691%2013.4421%2026.0421%2013.4421ZM26.0421%2016.6505C26.4029%2016.6505%2026.6904%2016.5325%2026.9047%2016.2965C27.119%2016.0605%2027.2262%2015.7539%2027.2262%2015.3769C27.2262%2014.9985%2027.119%2014.694%2026.9047%2014.4634C26.6904%2014.2328%2026.4029%2014.1175%2026.0421%2014.1175C25.6867%2014.1175%2025.4019%2014.2342%2025.1876%2014.4674C24.9733%2014.7007%2024.8661%2015.0039%2024.8661%2015.3769C24.8661%2015.7539%2024.9719%2016.0605%2025.1835%2016.2965C25.3951%2016.5325%2025.6813%2016.6505%2026.0421%2016.6505ZM30.7921%2013.4421C31.1759%2013.4421%2031.5177%2013.5255%2031.8175%2013.6923C32.1172%2013.8591%2032.3505%2014.0931%2032.5173%2014.3942C32.6842%2014.694%2032.7676%2015.0351%2032.7676%2015.4176C32.7676%2015.7173%2032.7133%2015.994%2032.6048%2016.2476C32.4963%2016.4999%2032.3173%2016.8315%2032.0677%2017.2425L30.609%2019.6432L29.7667%2019.6432L31.026%2017.5924C31.1034%2017.4704%2031.1807%2017.3564%2031.258%2017.2507C31.0857%2017.3063%2030.8945%2017.3341%2030.6842%2017.3341C30.3221%2017.3341%2029.9993%2017.2479%2029.7158%2017.0757C29.4337%2016.9034%2029.2133%2016.6701%2029.0546%2016.3758C28.8959%2016.0815%2028.8166%2015.7566%2028.8166%2015.4013C28.8166%2015.0351%2028.9013%2014.7021%2029.0709%2014.4023C29.2404%2014.1012%2029.4764%2013.8659%2029.7789%2013.6964C30.0814%2013.5268%2030.4191%2013.4421%2030.7921%2013.4421ZM30.7921%2016.6505C31.1529%2016.6505%2031.4404%2016.5325%2031.6547%2016.2965C31.869%2016.0605%2031.9762%2015.7539%2031.9762%2015.3769C31.9762%2014.9985%2031.869%2014.694%2031.6547%2014.4634C31.4404%2014.2328%2031.1529%2014.1175%2030.7921%2014.1175C30.4367%2014.1175%2030.1519%2014.2342%2029.9376%2014.4674C29.7233%2014.7007%2029.6161%2015.0039%2029.6161%2015.3769C29.6161%2015.7539%2029.7219%2016.0605%2029.9335%2016.2965C30.1451%2016.5325%2030.4313%2016.6505%2030.7921%2016.6505ZM35.2674%2014.6851L35.9001%2014.6851L35.9001%2016.3188L37.5339%2016.3188L37.5339%2016.9516L35.9001%2016.9516L35.9001%2018.5853L35.2674%2018.5853L35.2674%2016.9516L33.6337%2016.9516L33.6337%2016.3188L35.2674%2016.3188L35.2674%2014.6851Z'%20fill='rgb(255,255,255)'%20fill-rule='nonzero'%20/%3e%3c/g%3e%3cg%20id='00公共/单红点'%20opacity='0'%20customFrame='url(%23clipPath_8)'%3e%3crect%20id='00公共/单红点'%20width='6.666667'%20height='6.666667'%20x='23.333496'%20y='9.984619'%20opacity='0'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20/%3e%3ccircle%20id='红点'%20cx='26.6668301'%20cy='13.3179522'%20r='3.33333325'%20fill='rgb(243,111,100)'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e", ke = "data:image/svg+xml,%3csvg%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='40.000000'%20height='40.000000'%20fill='none'%20customFrame='url(%23clipPath_12)'%3e%3cdefs%3e%3cclipPath%20id='clipPath_12'%3e%3crect%20width='40.000000'%20height='40.000000'%20x='0.000000'%20y='0.000000'%20rx='12.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_13'%3e%3crect%20width='24.000000'%20height='24.000000'%20x='8.000000'%20y='8.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_14'%3e%3crect%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='10.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3c/defs%3e%3crect%20id='4'%20width='40.000000'%20height='40.000000'%20x='0.000000'%20y='0.000000'%20rx='12.000000'%20fill='rgb(234,255,244)'%20/%3e%3cg%20id='我的信息'%20clip-path='url(%23clipPath_13)'%20customFrame='url(%23clipPath_13)'%3e%3crect%20id='我的信息'%20width='24.000000'%20height='24.000000'%20x='8.000000'%20y='8.000000'%20/%3e%3cg%20id='组合%208'%20customFrame='url(%23clipPath_14)'%3e%3crect%20id='组合%208'%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='10.000000'%20/%3e%3cpath%20id='合并'%20d='M28.4994%2012.3142C28.4994%2012.2578%2028.4937%2012.2018%2028.4825%2012.1465C28.4713%2012.0911%2028.4547%2012.0373%2028.4327%2011.9851C28.4107%2011.933%2028.3836%2011.8835%2028.3516%2011.8365C28.3197%2011.7896%2028.2834%2011.7461%2028.2427%2011.7062C28.202%2011.6663%2028.1579%2011.6307%2028.1101%2011.5993C28.0622%2011.568%2028.0117%2011.5415%2027.9585%2011.5199C27.9054%2011.4983%2027.8506%2011.4819%2027.7942%2011.4709C27.7378%2011.4599%2027.6806%2011.4544%2027.6231%2011.4544L24.1832%2011.5199L24.1832%2010L29.0796%2010C29.1472%2010%2029.2143%2010.0065%2029.2806%2010.0194C29.347%2010.0324%2029.4114%2010.0516%2029.4739%2010.077C29.5364%2010.1024%2029.5961%2010.1336%2029.6523%2010.1705C29.7086%2010.2074%2029.7605%2010.2493%2029.8084%2010.2963C29.8562%2010.3433%2029.8991%2010.3944%2029.9367%2010.4496C29.9743%2010.5048%2030.006%2010.5631%2030.0319%2010.6244C30.0578%2010.6858%2030.0773%2010.7491%2030.0905%2010.8142C30.1037%2010.8794%2030.1104%2010.9451%2030.1104%2011.0115L30.1832%2014.4522L28.4992%2014.5L28.4994%2012.3142ZM11.6995%2012.3143C11.6995%2012.2579%2011.7051%2012.2019%2011.7163%2012.1466C11.7275%2012.0912%2011.7441%2012.0374%2011.7661%2011.9852C11.7882%2011.9331%2011.8152%2011.8836%2011.8472%2011.8366C11.8791%2011.7897%2011.9155%2011.7462%2011.9562%2011.7063C11.9968%2011.6664%2012.0409%2011.6308%2012.0888%2011.5994C12.1366%2011.5681%2012.1871%2011.5416%2012.2403%2011.52C12.2934%2011.4984%2012.3482%2011.482%2012.4046%2011.471C12.4611%2011.46%2012.5182%2011.4545%2012.5758%2011.4545L16.0157%2011.52L16.0157%2010.0001L11.1193%2010.0001C11.0516%2010.0001%2010.9846%2010.0066%2010.9182%2010.0196C10.8518%2010.0325%2010.7874%2010.0517%2010.7249%2010.0771C10.6624%2010.1025%2010.6028%2010.1337%2010.5465%2010.1706C10.4902%2010.2075%2010.4383%2010.2494%2010.3904%2010.2964C10.3426%2010.3434%2010.2997%2010.3945%2010.2621%2010.4497C10.2245%2010.5049%2010.1929%2010.5632%2010.167%2010.6245C10.1411%2010.6859%2010.1215%2010.7492%2010.1083%2010.8143C10.0951%2010.8795%2010.0885%2010.9452%2010.0884%2011.0116L10.0157%2014.4523L11.6997%2014.5L11.6995%2012.3143ZM25.3135%2021.8051L25.3135%2022.8167C25.7656%2022.8929%2026.2209%2022.9249%2026.6792%2022.9127C28.3381%2022.9127%2029.1675%2022.326%2029.1675%2021.1527C29.1733%2020.9869%2029.151%2020.825%2029.1006%2020.667C29.0503%2020.509%2028.9747%2020.3641%2028.8742%2020.2322C28.767%2020.1025%2028.6403%2019.9963%2028.4938%2019.9134C28.3474%2019.8306%2028.191%2019.7767%2028.0246%2019.7517L28.0246%2019.7011C28.0971%2019.6839%2028.1676%2019.6606%2028.236%2019.6311C28.3044%2019.6016%2028.3698%2019.5665%2028.4321%2019.5257C28.4944%2019.4848%2028.5526%2019.4389%2028.6069%2019.3879C28.6613%2019.3369%2028.7109%2019.2816%2028.7556%2019.222C28.8003%2019.1624%2028.8394%2019.0994%2028.8732%2019.033C28.9069%2018.9665%2028.9346%2018.8977%2028.9564%2018.8265C28.9782%2018.7552%2028.9937%2018.6826%2029.0028%2018.6086C29.0119%2018.5347%2029.0145%2018.4605%2029.0107%2018.3861C29.0217%2018.2675%2029.0176%2018.1495%2028.9984%2018.0319C28.9791%2017.9144%2028.9454%2017.8012%2028.8971%2017.6923C28.8489%2017.5834%2028.7875%2017.4823%2028.7134%2017.3891C28.6393%2017.2959%2028.5547%2017.2135%2028.4595%2017.1419C28.219%2017.0003%2027.963%2016.8972%2027.6915%2016.8326C27.4199%2016.7679%2027.1449%2016.7446%2026.8664%2016.7626C26.6258%2016.7621%2026.3864%2016.7791%2026.1482%2016.8132C25.9479%2016.8386%2025.7504%2016.8791%2025.5563%2016.9346L25.5563%2017.8854C25.743%2017.8264%2025.9337%2017.7842%2026.128%2017.759C26.3276%2017.73%2026.5282%2017.7148%2026.7298%2017.7134C27.0252%2017.6949%2027.3049%2017.7523%2027.5692%2017.8854C27.6168%2017.9161%2027.6595%2017.9525%2027.6972%2017.9947C27.7348%2018.037%2027.766%2018.0835%2027.791%2018.1343C27.816%2018.1851%2027.8337%2018.2383%2027.8441%2018.294C27.8545%2018.3496%2027.8573%2018.4056%2027.8525%2018.462C27.8566%2018.5278%2027.8514%2018.5927%2027.8367%2018.657C27.822%2018.7212%2027.7986%2018.7821%2027.7663%2018.8395C27.734%2018.897%2027.694%2018.9487%2027.6468%2018.9946C27.5995%2019.0405%2027.5468%2019.0787%2027.4885%2019.1093C27.1544%2019.2631%2026.8037%2019.3306%2026.4364%2019.3117L25.9862%2019.3117L25.9862%2020.1917L26.4466%2020.1917C26.8409%2020.1669%2027.2202%2020.2309%2027.5845%2020.3839C27.6459%2020.4167%2027.7011%2020.4576%2027.7505%2020.5066C27.7999%2020.5556%2027.8412%2020.6107%2027.8745%2020.6718C27.9077%2020.733%2027.9315%2020.7976%2027.9458%2020.8656C27.9602%2020.9337%2027.9644%2021.0024%2027.9587%2021.0717C27.9648%2021.1402%2027.9612%2021.2083%2027.9478%2021.2757C27.9344%2021.3432%2027.912%2021.4074%2027.8801%2021.4683C27.8483%2021.5293%2027.8086%2021.5846%2027.7609%2021.6341C27.7132%2021.6837%2027.6593%2021.7254%2027.5996%2021.7596C27.2884%2021.9045%2026.9613%2021.9685%2026.6184%2021.9518C26.1786%2021.9465%2025.7436%2021.8977%2025.3135%2021.8051ZM21.3382%2018.6238C21.3445%2018.5593%2021.343%2018.495%2021.3335%2018.4308C21.3241%2018.3667%2021.3069%2018.3046%2021.2822%2018.2447C21.2575%2018.1847%2021.226%2018.1287%2021.1876%2018.0765C21.1492%2018.0242%2021.1049%2017.9774%2021.055%2017.936C20.9359%2017.8608%2020.808%2017.806%2020.6714%2017.7714C20.5349%2017.7368%2020.3964%2017.7242%2020.2558%2017.7337C19.8009%2017.7395%2019.356%2017.8087%2018.9208%2017.9411L18.9208%2016.9598C19.4252%2016.8181%2019.9393%2016.7524%2020.4633%2016.7626C20.7322%2016.7484%2020.9964%2016.7773%2021.256%2016.8491C21.5156%2016.9209%2021.7571%2017.032%2021.9806%2017.1824C22.0729%2017.2601%2022.1548%2017.3474%2022.2263%2017.4446C22.2978%2017.5418%2022.3567%2017.646%2022.4034%2017.7573C22.45%2017.8686%2022.483%2017.9838%2022.5021%2018.1029C22.5213%2018.222%2022.5261%2018.3417%2022.5167%2018.462C22.5245%2018.7882%2022.4655%2019.1017%2022.3396%2019.4027C22.1879%2019.7384%2021.984%2020.0384%2021.7277%2020.3029C21.3021%2020.7337%2020.8502%2021.135%2020.3721%2021.5067L19.9928%2021.8051L19.9928%2021.8759L22.6938%2021.8759L22.6938%2022.8419L18.5464%2022.8419L18.5464%2021.7697C19.2882%2021.1796%2019.8579%2020.6975%2020.2558%2020.3232C20.574%2020.0432%2020.8523%2019.728%2021.0905%2019.3774C21.1675%2019.2665%2021.2269%2019.1469%2021.2691%2019.0187C21.3113%2018.8904%2021.3344%2018.7588%2021.3382%2018.6238ZM12.3102%2017.2127L12.3102%2018.1939L13.7769%2017.9107L13.7769%2022.8419L14.9605%2022.8419L14.9605%2016.8486L14.0957%2016.8486L12.3102%2017.2127ZM28.5524%2028.0475C28.5524%2028.104%2028.5467%2028.1599%2028.5353%2028.2152C28.5239%2028.2706%2028.5071%2028.3244%2028.4849%2028.3766C28.4626%2028.4287%2028.4352%2028.4782%2028.4028%2028.5252C28.3705%2028.5721%2028.3337%2028.6156%2028.2925%2028.6555C28.2513%2028.6954%2028.2067%2028.731%2028.1583%2028.7624C28.1098%2028.7937%2028.0587%2028.8202%2028.0049%2028.8418C27.9511%2028.8634%2027.8957%2028.8798%2027.8385%2028.8908C27.7814%2028.9018%2027.7235%2028.9073%2027.6653%2028.9073L24.1832%2028.8418L24.1832%2030.3617L29.1397%2030.3617C29.2082%2030.3617%2029.276%2030.3552%2029.3432%2030.3423C29.4104%2030.3293%2029.4756%2030.3101%2029.5389%2030.2847C29.6022%2030.2593%2029.6625%2030.2281%2029.7195%2030.1912C29.7765%2030.1543%2029.829%2030.1124%2029.8774%2030.0654C29.9259%2030.0184%2029.9693%2029.9673%2030.0074%2029.9121C30.0454%2029.8569%2030.0774%2029.7986%2030.1037%2029.7373C30.1299%2029.6759%2030.1497%2029.6126%2030.163%2029.5475C30.1764%2029.4823%2030.1831%2029.4166%2030.1832%2029.3502L30.1832%2026.0478L28.4785%2026L28.5524%2028.0475ZM11.6308%2028.0099C11.6308%2028.0664%2011.6365%2028.1223%2011.6479%2028.1777C11.6592%2028.233%2011.676%2028.2868%2011.6983%2028.339C11.7206%2028.3911%2011.748%2028.4406%2011.7803%2028.4876C11.8127%2028.5345%2011.8495%2028.578%2011.8906%2028.6179C11.9318%2028.6578%2011.9765%2028.6934%2012.0249%2028.7248C12.0733%2028.7562%2012.1244%2028.7826%2012.1783%2028.8042C12.2321%2028.8259%2012.2875%2028.8422%2012.3446%2028.8532C12.4017%2028.8642%2012.4596%2028.8697%2012.5178%2028.8698L16%2028.8042L16%2030.3241L11.0435%2030.3241C10.975%2030.3241%2010.9071%2030.3176%2010.8399%2030.3047C10.7727%2030.2917%2010.7076%2030.2725%2010.6443%2030.2471C10.581%2030.2217%2010.5206%2030.1906%2010.4637%2030.1537C10.4067%2030.1168%2010.3542%2030.0748%2010.3057%2030.0278C10.2573%2029.9809%2010.2138%2029.9298%2010.1758%2029.8745C10.1377%2029.8193%2010.1057%2029.7611%2010.0795%2029.6997C10.0533%2029.6383%2010.0335%2029.575%2010.0201%2029.5099C10.0068%2029.4448%2010%2029.379%2010%2029.3126L10%2026.0478L11.7047%2026L11.6308%2028.0099Z'%20fill='rgb(14,191,241)'%20fill-rule='evenodd'%20/%3e%3c/g%3e%3c/g%3e%3c/svg%3e", Ie = "data:image/svg+xml,%3csvg%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='40.000000'%20height='40.000000'%20fill='none'%20customFrame='url(%23clipPath_9)'%3e%3cdefs%3e%3cclipPath%20id='clipPath_9'%3e%3crect%20width='40.000000'%20height='40.000000'%20x='0.000000'%20y='0.000000'%20rx='12.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_10'%3e%3crect%20width='24.000000'%20height='24.000000'%20x='8.000000'%20y='8.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_11'%3e%3crect%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='10.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3c/defs%3e%3crect%20id='3'%20width='40.000000'%20height='40.000000'%20x='0.000000'%20y='0.000000'%20rx='12.000000'%20fill='rgb(236,250,254)'%20/%3e%3cg%20id='画板%202310'%20customFrame='url(%23clipPath_10)'%3e%3crect%20id='画板%202310'%20width='24.000000'%20height='24.000000'%20x='8.000000'%20y='8.000000'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20/%3e%3cg%20id='人事服务'%3e%3cg%20id='ic_public_link'%20clip-path='url(%23clipPath_11)'%20customFrame='url(%23clipPath_11)'%3e%3crect%20id='ic_public_link'%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='10.000000'%20/%3e%3cpath%20id='path1'%20d='M9.9999%2019.9917C9.9999%2018.4292%209.99573%2016.8667%209.9999%2015.3042C9.99573%2014.5459%2010.0916%2013.7917%2010.2749%2013.0626C10.6874%2011.5126%2011.6957%2010.5917%2013.2457%2010.2334C14.0207%2010.0667%2014.8166%209.98756%2015.6082%2010.0001C18.6041%2010.0001%2021.5999%2010.0001%2024.5999%2010.0001C25.3541%209.99589%2026.1082%2010.0792%2026.8457%2010.2584C28.4416%2010.6459%2029.3999%2011.6584%2029.7624%2013.2501C29.9291%2014.0001%2030.0041%2014.7667%2029.9957%2015.5376C29.9957%2018.5667%2029.9957%2021.5959%2029.9957%2024.6209C29.9999%2025.3709%2029.9166%2026.1209%2029.7416%2026.8459C29.3499%2028.4459%2028.3332%2029.3959%2026.7457%2029.7626C25.9666%2029.9292%2025.1749%2030.0084%2024.3791%2029.9959C21.3957%2029.9959%2018.4124%2029.9959%2015.4291%2029.9959C14.6666%2030.0042%2013.9082%2029.9167%2013.1666%2029.7417C11.5624%2029.3542%2010.5999%2028.3376%2010.2374%2026.7376C10.0499%2025.9251%209.9999%2025.1126%209.9999%2024.2917C9.9999%2022.8584%209.9999%2021.4251%209.9999%2019.9917Z'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20fill-rule='evenodd'%20/%3e%3ccircle%20id='path2'%20cx='20'%20cy='20'%20r='10'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20/%3e%3cpath%20id='path3'%20d='M25.0333%2021.8666L26.9%2020C28.8083%2018.0916%2028.8083%2015%2026.9%2013.0958C24.9958%2011.1875%2021.9041%2011.1875%2020%2013.0958L18.1291%2014.9625M21.8666%2025.0333L20%2026.9C18.0916%2028.8083%2015%2028.8083%2013.0958%2026.9C11.1875%2024.9958%2011.1875%2021.9041%2013.0958%2020L14.9625%2018.1291'%20fill-rule='nonzero'%20stroke='rgb(14,191,241)'%20stroke-linecap='round'%20stroke-width='1.25'%20/%3e%3cpath%20id='pah4'%20d='M18.125%2021.875L21.875%2018.125'%20stroke='rgb(14,191,241)'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='1.25'%20/%3e%3cpath%20id='path5'%20d='M25.8207%2019.2626L24.0457%2021.0376C23.7998%2021.2834%2023.6748%2021.5292%2023.6748%2021.7751C23.6748%2022.0209%2023.7998%2022.2667%2024.0457%2022.5126C24.1498%2022.6167%2024.2665%2022.6959%2024.3915%2022.7459C24.5123%2022.7917%2024.6415%2022.8167%2024.779%2022.8167C24.9207%2022.8167%2025.0498%2022.7917%2025.1665%2022.7459C25.2957%2022.6959%2025.4123%2022.6167%2025.5165%2022.5126L27.2915%2020.7334C27.8165%2020.2126%2028.2165%2019.6334%2028.4957%2019.0001C28.5082%2018.9667%2028.5248%2018.9334%2028.5373%2018.8959C28.554%2018.8626%2028.5665%2018.8292%2028.579%2018.7917C28.8332%2018.1501%2028.9582%2017.4584%2028.9582%2016.7209C28.9582%2015.9792%2028.8332%2015.2876%2028.579%2014.6459C28.5665%2014.6084%2028.554%2014.5751%2028.5373%2014.5417C28.5248%2014.5042%2028.5082%2014.4709%2028.4957%2014.4376C28.2165%2013.8042%2027.8165%2013.2292%2027.2915%2012.7042C26.7707%2012.1792%2026.1915%2011.7792%2025.5582%2011.5001C25.5248%2011.4876%2025.4915%2011.4709%2025.454%2011.4584C25.4207%2011.4417%2025.3873%2011.4292%2025.354%2011.4167C24.7082%2011.1667%2024.0165%2011.0417%2023.279%2011.0417C22.5373%2011.0417%2021.8457%2011.1667%2021.204%2011.4167C21.1665%2011.4292%2021.1332%2011.4417%2021.0998%2011.4584C21.0623%2011.4709%2021.029%2011.4876%2020.9957%2011.5001C20.3623%2011.7792%2019.7832%2012.1792%2019.2623%2012.7042L17.4832%2014.4792C17.379%2014.5834%2017.2998%2014.7001%2017.2498%2014.8292C17.204%2014.9501%2017.179%2015.0751%2017.179%2015.2167C17.179%2015.3542%2017.204%2015.4834%2017.2498%2015.6042C17.2998%2015.7292%2017.379%2015.8459%2017.4832%2015.9542C17.5915%2016.0584%2017.7082%2016.1376%2017.8332%2016.1876C17.954%2016.2334%2018.0832%2016.2584%2018.2207%2016.2584C18.3623%2016.2584%2018.4915%2016.2334%2018.6082%2016.1876C18.7373%2016.1376%2018.854%2016.0584%2018.9582%2015.9542L20.7332%2014.1751C21.0873%2013.8209%2021.4748%2013.5584%2021.8957%2013.3834C22.3165%2013.2084%2022.779%2013.1251%2023.279%2013.1251C23.7748%2013.1251%2024.2373%2013.2084%2024.6582%2013.3834C25.079%2013.5584%2025.4665%2013.8209%2025.8207%2014.1751C26.1748%2014.5292%2026.4373%2014.9167%2026.6123%2015.3376C26.7873%2015.7584%2026.8748%2016.2167%2026.8748%2016.7209C26.8748%2017.2209%2026.7873%2017.6792%2026.6123%2018.1001C26.4373%2018.5209%2026.1748%2018.9084%2025.8207%2019.2626ZM13.3832%2021.8959C13.5582%2021.4751%2013.8207%2021.0876%2014.1748%2020.7334L15.954%2018.9584C16.0582%2018.8542%2016.1373%2018.7376%2016.1873%2018.6084C16.2332%2018.4876%2016.2582%2018.3626%2016.2582%2018.2209C16.2582%2018.0834%2016.2332%2017.9542%2016.1873%2017.8334C16.1373%2017.7084%2016.0582%2017.5917%2015.954%2017.4834C15.7082%2017.2417%2015.4623%2017.1167%2015.2165%2017.1167C14.9707%2017.1167%2014.7248%2017.2417%2014.479%2017.4834L12.704%2019.2626C12.179%2019.7876%2011.779%2020.3626%2011.4998%2020.9959C11.4873%2021.0292%2011.4707%2021.0626%2011.4582%2021.1001C11.4415%2021.1334%2011.429%2021.1667%2011.4165%2021.2042C11.1665%2021.8459%2011.0415%2022.5376%2011.0415%2023.2792C11.0415%2024.0167%2011.1665%2024.7084%2011.4165%2025.3542C11.429%2025.3876%2011.4415%2025.4209%2011.4582%2025.4584C11.4707%2025.4917%2011.4873%2025.5251%2011.4998%2025.5584C11.779%2026.1917%2012.179%2026.7709%2012.704%2027.2917C13.2248%2027.8167%2013.804%2028.2167%2014.4373%2028.4959C14.4707%2028.5084%2014.504%2028.5251%2014.5415%2028.5376C14.5748%2028.5542%2014.6082%2028.5667%2014.6457%2028.5792C15.2873%2028.8292%2015.979%2028.9584%2016.7207%2028.9584C17.4582%2028.9584%2018.1498%2028.8292%2018.7915%2028.5792C18.829%2028.5667%2018.8623%2028.5542%2018.8957%2028.5376C18.9332%2028.5251%2018.9665%2028.5084%2018.9998%2028.4959C19.6332%2028.2167%2020.2123%2027.8167%2020.7332%2027.2917L22.5123%2025.5167C22.6165%2025.4126%2022.6957%2025.2959%2022.7457%2025.1667C22.7915%2025.0459%2022.8165%2024.9209%2022.8165%2024.7792C22.8165%2024.6417%2022.7915%2024.5126%2022.7457%2024.3917C22.6957%2024.2667%2022.6165%2024.1501%2022.5123%2024.0417C22.2665%2023.8001%2022.0207%2023.6751%2021.7748%2023.6751C21.529%2023.6751%2021.2832%2023.8001%2021.0373%2024.0417L19.2623%2025.8209C18.9082%2026.1751%2018.5207%2026.4376%2018.0998%2026.6126C17.679%2026.7876%2017.2165%2026.8751%2016.7207%2026.8751C16.2207%2026.8751%2015.7582%2026.7876%2015.3373%2026.6126C14.9165%2026.4376%2014.529%2026.1751%2014.1748%2025.8209C13.8207%2025.4667%2013.5582%2025.0792%2013.3832%2024.6584C13.2082%2024.2376%2013.1248%2023.7792%2013.1248%2023.2792C13.1248%2022.7751%2013.2082%2022.3167%2013.3832%2021.8959Z'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20fill-rule='evenodd'%20/%3e%3cpath%20id='path6'%20d='M21.8127%2016.7458C21.746%2016.7874%2021.6877%2016.8374%2021.6293%2016.8916L16.8918%2021.6291C16.8377%2021.6874%2016.7877%2021.7499%2016.746%2021.8124C16.7127%2021.8624%2016.6877%2021.9166%2016.6627%2021.9749C16.6377%2022.0374%2016.6168%2022.1041%2016.6043%2022.1708C16.5918%2022.2333%2016.5835%2022.2999%2016.5835%2022.3666C16.5835%2022.4333%2016.5918%2022.4999%2016.6043%2022.5666C16.6168%2022.6333%2016.6377%2022.6999%2016.6627%2022.7624C16.6877%2022.8166%2016.7127%2022.8708%2016.746%2022.9208C16.7877%2022.9874%2016.8377%2023.0499%2016.8918%2023.1041C16.946%2023.1583%2017.0085%2023.2083%2017.0752%2023.2499C17.1252%2023.2833%2017.1793%2023.3083%2017.2335%2023.3333C17.3002%2023.3583%2017.3627%2023.3791%2017.4293%2023.3916C17.496%2023.4041%2017.5627%2023.4124%2017.6293%2023.4124C17.696%2023.4124%2017.7627%2023.4041%2017.8252%2023.3916C17.8918%2023.3791%2017.9585%2023.3583%2018.021%2023.3333C18.0793%2023.3083%2018.1335%2023.2833%2018.1835%2023.2499C18.246%2023.2083%2018.3085%2023.1583%2018.3668%2023.1041L23.1043%2018.3666C23.1585%2018.3083%2023.2085%2018.2499%2023.2502%2018.1833C23.2835%2018.1333%2023.3085%2018.0791%2023.3335%2018.0208C23.3585%2017.9583%2023.3793%2017.8916%2023.3918%2017.8249C23.4043%2017.7624%2023.4127%2017.6958%2023.4127%2017.6291C23.4127%2017.5624%2023.4043%2017.4958%2023.3918%2017.4291C23.3793%2017.3624%2023.3585%2017.2999%2023.3335%2017.2333C23.3085%2017.1791%2023.2835%2017.1249%2023.2502%2017.0749C23.2085%2017.0083%2023.1585%2016.9458%2023.1043%2016.8916C23.046%2016.8374%2022.9877%2016.7874%2022.921%2016.7458C22.871%2016.7124%2022.8168%2016.6874%2022.7627%2016.6624C22.696%2016.6374%2022.6335%2016.6166%2022.5668%2016.6041C22.5002%2016.5916%2022.4335%2016.5833%2022.3668%2016.5833C22.3002%2016.5833%2022.2335%2016.5916%2022.171%2016.6041C22.1043%2016.6166%2022.0377%2016.6374%2021.9752%2016.6624C21.9168%2016.6874%2021.8627%2016.7124%2021.8127%2016.7458Z'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20fill-rule='evenodd'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e", Ue = "data:image/svg+xml,%3csvg%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='40.000000'%20height='40.000000'%20fill='none'%20customFrame='url(%23clipPath_0)'%3e%3cdefs%3e%3cclipPath%20id='clipPath_0'%3e%3crect%20width='40.000000'%20height='40.000000'%20x='0.000000'%20y='0.000000'%20rx='12.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_1'%3e%3crect%20width='24.000000'%20height='24.000000'%20x='8.000000'%20y='8.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cclipPath%20id='clipPath_2'%3e%3crect%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='10.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3c/defs%3e%3crect%20id='1'%20width='40.000000'%20height='40.000000'%20x='0.000000'%20y='0.000000'%20rx='12.000000'%20fill='rgb(236,250,254)'%20/%3e%3cg%20id='车辆'%20clip-path='url(%23clipPath_1)'%20customFrame='url(%23clipPath_1)'%3e%3crect%20id='车辆'%20width='24.000000'%20height='24.000000'%20x='8.000000'%20y='8.000000'%20/%3e%3cg%20id='编组'%3e%3cg%20id='ic_public_qrcode'%20clip-path='url(%23clipPath_2)'%20customFrame='url(%23clipPath_2)'%3e%3crect%20id='ic_public_qrcode'%20width='20.000000'%20height='20.000000'%20x='10.000000'%20y='10.000000'%20/%3e%3cg%20id='ic_public_qrcode_1_1'%3e%3cpath%20id='ic_public_qrcode_2_0'%20d='M10.6273%2019.9924C10.6273%2018.5277%2010.6222%2017.0631%2010.6273%2015.5985C10.6243%2014.8898%2010.7114%2014.1836%2010.8865%2013.4968C11.2702%2012.0432%2012.2171%2011.1805%2013.6693%2010.8458C14.3974%2010.6885%2015.1411%2010.6148%2015.886%2010.6261C18.6946%2010.6261%2021.5035%2010.6261%2024.3127%2010.6261C25.0221%2010.6217%2025.7295%2010.7029%2026.4195%2010.8678C27.9156%2011.2339%2028.8134%2012.1816%2029.1554%2013.6725C29.3092%2014.3772%2029.3826%2015.097%2029.3744%2015.8182C29.3744%2018.6571%2029.3744%2021.4963%2029.3744%2024.3357C29.3782%2025.0383%2029.2973%2025.7388%2029.1334%2026.422C28.7673%2027.9189%2027.8153%2028.8123%2026.3243%2029.1543C25.5961%2029.311%2024.8524%2029.3847%2024.1076%2029.374C21.3107%2029.374%2018.514%2029.374%2015.7176%2029.374C15.0027%2029.3798%2014.2897%2029.2999%2013.5939%2029.136C12.0912%2028.7698%2011.189%2027.8178%2010.8477%2026.3195C10.6734%2025.5579%2010.6273%2024.7941%2010.6273%2024.0237C10.6273%2022.6802%2010.6273%2021.3364%2010.6273%2019.9924Z'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20fill-rule='nonzero'%20/%3e%3cpath%20id='ic_public_qrcode_2_0'%20d='M10.6273%2015.5985C10.6243%2014.8898%2010.7114%2014.1836%2010.8865%2013.4968C11.2702%2012.0432%2012.2171%2011.1805%2013.6693%2010.8458C14.3974%2010.6885%2015.1411%2010.6148%2015.886%2010.6261C18.6946%2010.6261%2021.5035%2010.6261%2024.3127%2010.6261C25.0221%2010.6217%2025.7295%2010.7029%2026.4195%2010.8678C27.9156%2011.2339%2028.8134%2012.1816%2029.1554%2013.6725C29.3092%2014.3772%2029.3826%2015.097%2029.3744%2015.8182C29.3744%2018.6571%2029.3744%2021.4963%2029.3744%2024.3357C29.3782%2025.0383%2029.2973%2025.7388%2029.1334%2026.422C28.7673%2027.9189%2027.8153%2028.8123%2026.3243%2029.1543C25.5961%2029.311%2024.8524%2029.3847%2024.1076%2029.374C21.3107%2029.374%2018.514%2029.374%2015.7176%2029.374C15.0027%2029.3798%2014.2897%2029.2999%2013.5939%2029.136C12.0912%2028.7698%2011.189%2027.8178%2010.8477%2026.3195C10.6734%2025.5579%2010.6273%2024.7941%2010.6273%2024.0237C10.6273%2022.6802%2010.6273%2021.3364%2010.6273%2019.9924C10.6273%2018.5277%2010.6222%2017.0631%2010.6273%2015.5985Z'%20fill-rule='nonzero'%20stroke='rgb(255,255,255)'%20stroke-opacity='0'%20stroke-width='1.25'%20/%3e%3cpath%20id='ic_public_qrcode_2_1'%20d='M10.6273%2015.5985C10.6243%2014.8898%2010.7114%2014.1836%2010.8865%2013.4968C11.2702%2012.0432%2012.2171%2011.1805%2013.6693%2010.8458C14.3974%2010.6885%2015.1411%2010.6148%2015.886%2010.6261C18.6946%2010.6261%2021.5035%2010.6261%2024.3127%2010.6261C25.0221%2010.6217%2025.7295%2010.7029%2026.4195%2010.8678C27.9156%2011.2339%2028.8134%2012.1816%2029.1554%2013.6725C29.3092%2014.3772%2029.3826%2015.097%2029.3744%2015.8182C29.3744%2018.6571%2029.3744%2021.4963%2029.3744%2024.3357C29.3782%2025.0383%2029.2973%2025.7388%2029.1334%2026.422C28.7673%2027.9189%2027.8153%2028.8123%2026.3243%2029.1543C25.5961%2029.311%2024.8524%2029.3847%2024.1076%2029.374C21.3107%2029.374%2018.514%2029.374%2015.7176%2029.374C15.0027%2029.3798%2014.2897%2029.2999%2013.5939%2029.136C12.0912%2028.7698%2011.189%2027.8178%2010.8477%2026.3195C10.6734%2025.5579%2010.6273%2024.7941%2010.6273%2024.0237C10.6273%2022.6802%2010.6273%2021.3364%2010.6273%2019.9924C10.6273%2018.5277%2010.6222%2017.0631%2010.6273%2015.5985Z'%20opacity='0.200000003'%20fill-rule='nonzero'%20stroke='rgb(255,255,255)'%20stroke-opacity='0'%20stroke-width='1.25'%20/%3e%3ccircle%20id='ic_public_qrcode_2_2'%20cx='20'%20cy='20'%20r='10'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20/%3e%3cpath%20id='ic_public_qrcode_2_3'%20d='M17.5%2011.25C17.9602%2011.25%2018.3333%2011.6231%2018.3333%2012.0833L18.3333%2017.5C18.3333%2017.9602%2017.9602%2018.3333%2017.5%2018.3333L12.0833%2018.3333C11.6231%2018.3333%2011.25%2017.9602%2011.25%2017.5L11.25%2012.0833C11.25%2011.6231%2011.6231%2011.25%2012.0833%2011.25L17.5%2011.25ZM17.5%2021.6667C17.9602%2021.6667%2018.3333%2022.0398%2018.3333%2022.5L18.3333%2027.9167C18.3333%2028.3769%2017.9602%2028.75%2017.5%2028.75L12.0833%2028.75C11.6231%2028.75%2011.25%2028.3769%2011.25%2027.9167L11.25%2022.5C11.25%2022.0398%2011.6231%2021.6667%2012.0833%2021.6667L17.5%2021.6667ZM27.9167%2011.25C28.3769%2011.25%2028.75%2011.6231%2028.75%2012.0833L28.75%2017.5C28.75%2017.9602%2028.3769%2018.3333%2027.9167%2018.3333L22.5%2018.3333C22.0398%2018.3333%2021.6667%2017.9602%2021.6667%2017.5L21.6667%2012.0833C21.6667%2011.6231%2022.0398%2011.25%2022.5%2011.25L27.9167%2011.25Z'%20fill-rule='evenodd'%20stroke='rgb(14,191,241)'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='1.25'%20/%3e%3cpath%20id='ic_public_qrcode_2_4'%20d='M17.5002%2010.8333C18.1905%2010.8333%2018.7502%2011.3929%2018.7502%2012.0833L18.7502%2017.4999C18.7502%2018.1903%2018.1905%2018.7499%2017.5002%2018.7499L12.0835%2018.7499C11.3931%2018.7499%2010.8335%2018.1903%2010.8335%2017.4999L10.8335%2012.0833C10.8335%2011.3929%2011.3931%2010.8333%2012.0835%2010.8333L17.5002%2010.8333ZM17.5002%2011.6666L12.0835%2011.6666C11.8534%2011.6666%2011.6668%2011.8531%2011.6668%2012.0833L11.6668%2017.4999C11.6668%2017.73%2011.8534%2017.9166%2012.0835%2017.9166L17.5002%2017.9166C17.7303%2017.9166%2017.9168%2017.73%2017.9168%2017.4999L17.9168%2012.0833C17.9168%2011.8531%2017.7303%2011.6666%2017.5002%2011.6666ZM17.5002%2021.2499C18.1905%2021.2499%2018.7502%2021.8096%2018.7502%2022.4999L18.7502%2027.9166C18.7502%2028.6069%2018.1905%2029.1666%2017.5002%2029.1666L12.0835%2029.1666C11.3931%2029.1666%2010.8335%2028.6069%2010.8335%2027.9166L10.8335%2022.4999C10.8335%2021.8096%2011.3931%2021.2499%2012.0835%2021.2499L17.5002%2021.2499ZM17.5002%2022.0833L12.0835%2022.0833C11.8534%2022.0833%2011.6668%2022.2698%2011.6668%2022.4999L11.6668%2027.9166C11.6668%2028.1467%2011.8534%2028.3333%2012.0835%2028.3333L17.5002%2028.3333C17.7303%2028.3333%2017.9168%2028.1467%2017.9168%2027.9166L17.9168%2022.4999C17.9168%2022.2698%2017.7303%2022.0833%2017.5002%2022.0833ZM27.9168%2010.8333C28.6072%2010.8333%2029.1668%2011.3929%2029.1668%2012.0833L29.1668%2017.4999C29.1668%2018.1903%2028.6072%2018.7499%2027.9168%2018.7499L22.5002%2018.7499C21.8098%2018.7499%2021.2502%2018.1903%2021.2502%2017.4999L21.2502%2012.0833C21.2502%2011.3929%2021.8098%2010.8333%2022.5002%2010.8333L27.9168%2010.8333ZM27.9168%2011.6666L22.5002%2011.6666C22.27%2011.6666%2022.0835%2011.8531%2022.0835%2012.0833L22.0835%2017.4999C22.0835%2017.73%2022.27%2017.9166%2022.5002%2017.9166L27.9168%2017.9166C28.1469%2017.9166%2028.3335%2017.73%2028.3335%2017.4999L28.3335%2012.0833C28.3335%2011.8531%2028.1469%2011.6666%2027.9168%2011.6666Z'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20fill-rule='nonzero'%20/%3e%3cpath%20id='ic_public_qrcode_2_4'%20d='M18.7502%2012.0833L18.7502%2017.4999C18.7502%2018.1903%2018.1905%2018.7499%2017.5002%2018.7499L12.0835%2018.7499C11.3931%2018.7499%2010.8335%2018.1903%2010.8335%2017.4999L10.8335%2012.0833C10.8335%2011.3929%2011.3931%2010.8333%2012.0835%2010.8333L17.5002%2010.8333C18.1905%2010.8333%2018.7502%2011.3929%2018.7502%2012.0833ZM12.0835%2011.6666C11.8534%2011.6666%2011.6668%2011.8531%2011.6668%2012.0833L11.6668%2017.4999C11.6668%2017.73%2011.8534%2017.9166%2012.0835%2017.9166L17.5002%2017.9166C17.7303%2017.9166%2017.9168%2017.73%2017.9168%2017.4999L17.9168%2012.0833C17.9168%2011.8531%2017.7303%2011.6666%2017.5002%2011.6666L12.0835%2011.6666ZM18.7502%2022.4999L18.7502%2027.9166C18.7502%2028.6069%2018.1905%2029.1666%2017.5002%2029.1666L12.0835%2029.1666C11.3931%2029.1666%2010.8335%2028.6069%2010.8335%2027.9166L10.8335%2022.4999C10.8335%2021.8096%2011.3931%2021.2499%2012.0835%2021.2499L17.5002%2021.2499C18.1905%2021.2499%2018.7502%2021.8096%2018.7502%2022.4999ZM12.0835%2022.0833C11.8534%2022.0833%2011.6668%2022.2698%2011.6668%2022.4999L11.6668%2027.9166C11.6668%2028.1467%2011.8534%2028.3333%2012.0835%2028.3333L17.5002%2028.3333C17.7303%2028.3333%2017.9168%2028.1467%2017.9168%2027.9166L17.9168%2022.4999C17.9168%2022.2698%2017.7303%2022.0833%2017.5002%2022.0833L12.0835%2022.0833ZM29.1668%2012.0833L29.1668%2017.4999C29.1668%2018.1903%2028.6072%2018.7499%2027.9168%2018.7499L22.5002%2018.7499C21.8098%2018.7499%2021.2502%2018.1903%2021.2502%2017.4999L21.2502%2012.0833C21.2502%2011.3929%2021.8098%2010.8333%2022.5002%2010.8333L27.9168%2010.8333C28.6072%2010.8333%2029.1668%2011.3929%2029.1668%2012.0833ZM22.5002%2011.6666C22.27%2011.6666%2022.0835%2011.8531%2022.0835%2012.0833L22.0835%2017.4999C22.0835%2017.73%2022.27%2017.9166%2022.5002%2017.9166L27.9168%2017.9166C28.1469%2017.9166%2028.3335%2017.73%2028.3335%2017.4999L28.3335%2012.0833C28.3335%2011.8531%2028.1469%2011.6666%2027.9168%2011.6666L22.5002%2011.6666Z'%20fill-rule='nonzero'%20stroke='rgb(255,255,255)'%20stroke-opacity='0'%20stroke-linejoin='round'%20stroke-width='1.25'%20/%3e%3cpath%20id='ic_public_qrcode_2_5'%20d='M27.9165%2021.6667L27.9165%2024.5834L28.7498%2024.5834L28.7498%2021.6667L27.9165%2021.6667ZM24.5832%2021.6667L24.5832%2022.639L24.5828%2022.6388L24.5832%2024.5834L23.6109%2024.5834L23.6107%2022.6388L21.6665%2022.639L21.6665%2021.6667L24.5832%2021.6667ZM21.6665%2025.8334L21.6665%2028.7501L22.4998%2028.7501L22.4998%2025.8334L21.6665%2025.8334ZM27.9165%2027.9167L27.9165%2028.7501L28.7498%2028.7501L28.7498%2027.9167L27.9165%2027.9167ZM25.8332%2025.8334L25.8332%2026.6667L26.6665%2026.6667L26.6665%2025.8334L25.8332%2025.8334Z'%20fill='rgb(14,191,241)'%20fill-rule='nonzero'%20/%3e%3cpath%20id='ic_public_qrcode_2_5'%20d='M27.9165%2024.5834L28.7498%2024.5834L28.7498%2021.6667L27.9165%2021.6667L27.9165%2024.5834ZM24.5832%2022.639L24.5828%2022.6388L24.5832%2024.5834L23.6109%2024.5834L23.6107%2022.6388L21.6665%2022.639L21.6665%2021.6667L24.5832%2021.6667L24.5832%2022.639ZM21.6665%2028.7501L22.4998%2028.7501L22.4998%2025.8334L21.6665%2025.8334L21.6665%2028.7501ZM27.9165%2028.7501L28.7498%2028.7501L28.7498%2027.9167L27.9165%2027.9167L27.9165%2028.7501ZM25.8332%2026.6667L26.6665%2026.6667L26.6665%2025.8334L25.8332%2025.8334L25.8332%2026.6667Z'%20fill-rule='nonzero'%20stroke='rgb(14,191,241)'%20stroke-linejoin='round'%20stroke-width='1.25'%20/%3e%3cpath%20id='ic_public_qrcode_2_6'%20d='M14.375%2014.375L14.375%2015.2083L15.2083%2015.2083L15.2083%2014.375L14.375%2014.375ZM14.375%2024.7917L14.375%2025.625L15.2083%2025.625L15.2083%2024.7917L14.375%2024.7917ZM24.7917%2014.375L24.7917%2015.2083L25.625%2015.2083L25.625%2014.375L24.7917%2014.375Z'%20fill='rgb(14,191,241)'%20fill-rule='nonzero'%20/%3e%3cpath%20id='ic_public_qrcode_2_6'%20d='M14.375%2015.2083L15.2083%2015.2083L15.2083%2014.375L14.375%2014.375L14.375%2015.2083ZM14.375%2025.625L15.2083%2025.625L15.2083%2024.7917L14.375%2024.7917L14.375%2025.625ZM24.7917%2015.2083L25.625%2015.2083L25.625%2014.375L24.7917%2014.375L24.7917%2015.2083Z'%20fill-rule='nonzero'%20stroke='rgb(14,191,241)'%20stroke-linejoin='round'%20stroke-width='1.25'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e", Ae = "data:image/svg+xml,%3csvg%20viewBox='0%200%2012%2012'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='12.000000'%20height='12.000000'%20fill='none'%3e%3cdefs%3e%3cfilter%20id='pixso_custom_mask_type_luminance'%3e%3cfeColorMatrix%20type='matrix'%20values='1%200%200%200%200%200%201%200%200%200%200%200%201%200%200%200%200%200%201%200%20'%20/%3e%3c/filter%3e%3c/defs%3e%3cmask%20id='mask_0'%20width='11.999876'%20height='11.999876'%20x='0.000000'%20y='0.000000'%20maskUnits='userSpaceOnUse'%3e%3cg%20filter='url(%23pixso_custom_mask_type_luminance)'%3e%3cg%20id='mask401_19830'%3e%3cpath%20id='蒙版'%20d='M0%200L11.9999%200L11.9999%2011.9999L0%2011.9999L0%200ZM2.69992%201.34999L8.09977%201.34999C9.5082%201.34999%2010.6498%202.49167%2010.6498%203.89998L10.6498%209.2999C10.6498%2010.7082%209.5082%2011.8499%208.09977%2011.8499L2.69992%2011.8499C1.29149%2011.8499%200.149901%2010.7082%200.149901%209.2999L0.149901%203.89998C0.149901%202.49167%201.29149%201.34999%202.69992%201.34999Z'%20fill='rgb(196,196,196)'%20fill-rule='evenodd'%20/%3e%3c/g%3e%3c/g%3e%3c/mask%3e%3crect%20id='ic_public_copy'%20width='12.000000'%20height='12.000000'%20x='0.000000'%20y='0.000000'%20/%3e%3crect%20id='ic_public_copy-复制/base/ic_public_copy'%20width='11.999876'%20height='11.999876'%20x='0.000000'%20y='0.000000'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20/%3e%3cpath%20id='path1'%20d='M0.000134537%205.99497C0.000134537%205.05748%20-0.00236544%204.11999%200.000134537%203.1825C-0.00236544%202.72751%200.055134%202.27501%200.165133%201.83752C0.41263%200.907526%201.01762%200.355032%201.94761%200.140034C2.41261%200.040035%202.8901%20-0.00746449%203.3651%203.54269e-05C5.16258%203.54269e-05%206.96006%203.54269e-05%208.76004%203.54269e-05C9.21254%20-0.00246455%209.66503%200.0475349%2010.1075%200.155034C11.065%200.387531%2011.64%200.995025%2011.8575%201.95002C11.9575%202.40001%2012.005%202.86001%2011.9975%203.3225C11.9975%205.13998%2011.9975%206.95746%2011.9975%208.77244C12%209.22244%2011.95%209.67243%2011.845%2010.1099C11.61%2011.0674%2011%2011.6374%2010.0475%2011.8574C9.58003%2011.9574%209.10504%2012.0049%208.62754%2011.9974C6.83756%2011.9974%205.04758%2011.9974%203.2576%2011.9974C2.80011%2012.0024%202.34511%2011.9499%201.90011%2011.8449C0.937625%2011.6124%200.360131%2011.0024%200.142633%2010.0424C0.0301342%209.55494%200.000134537%209.06744%200.000134537%208.57495C0.000134537%207.71495%200.000134537%206.85496%200.000134537%205.99497Z'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20fill-rule='evenodd'%20/%3e%3ccircle%20id='path2'%20cx='5.99993801'%20cy='5.99993801'%20r='5.99993801'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20/%3e%3cg%20id='mask'%20mask='url(%23mask_0)'%3e%3cg%20id='组合%208'%3e%3cpath%20id='path'%20d='M11.1%203.89993L11.1%206.8999C11.1%208.55488%209.75502%209.89737%208.10004%209.89737L5.10007%209.89737C3.44258%209.89737%202.1001%208.55488%202.1001%206.8999L2.1001%203.89993C2.1001%202.24245%203.44258%200.897461%205.10007%200.897461L8.10004%200.897461C9.75502%200.897461%2011.1%202.24245%2011.1%203.89993Z'%20fill-rule='nonzero'%20stroke='rgb(25,25,25)'%20stroke-linejoin='round'%20stroke-width='0.749992251'%20/%3e%3c/g%3e%3c/g%3e%3cpath%20id='path4'%20d='M2.10008%202.39746L8.10002%202.39746C8.92751%202.39746%209.6%203.06995%209.6%203.89995L9.6%209.89738C9.6%2010.7274%208.92751%2011.3999%208.10002%2011.3999L2.10008%2011.3999C1.27009%2011.3999%200.600098%2010.7274%200.600098%209.89738L0.600098%203.89995C0.600098%203.06995%201.27009%202.39746%202.10008%202.39746Z'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20fill-rule='evenodd'%20/%3e%3cpath%20id='path4'%20d='M9.6%203.89995L9.6%209.89738C9.6%2010.7274%208.92751%2011.3999%208.10002%2011.3999L2.10008%2011.3999C1.27009%2011.3999%200.600098%2010.7274%200.600098%209.89738L0.600098%203.89995C0.600098%203.06995%201.27009%202.39746%202.10008%202.39746L8.10002%202.39746C8.92751%202.39746%209.6%203.06995%209.6%203.89995Z'%20fill-rule='nonzero'%20stroke='rgb(25,25,25)'%20stroke-linejoin='round'%20stroke-width='0.749992251'%20/%3e%3c/svg%3e", Oe = "https://agent.opentiny.design/tiny-robot", y2 = "https://ai.opentiny.design/next-remoter", v2 = (r) => [
|
|
912
903
|
{
|
|
913
904
|
action: "qr-code",
|
|
914
905
|
show: !0,
|
|
915
906
|
text: "扫码登录",
|
|
916
907
|
desc: "使用手机遥控页面",
|
|
917
|
-
icon:
|
|
908
|
+
icon: Ue
|
|
918
909
|
},
|
|
919
910
|
{
|
|
920
911
|
action: "ai-chat",
|
|
921
912
|
show: !0,
|
|
922
913
|
text: "打开对话框",
|
|
923
914
|
desc: "支持在网页端操作AI",
|
|
924
|
-
icon:
|
|
915
|
+
icon: Pe
|
|
925
916
|
},
|
|
926
917
|
{
|
|
927
918
|
action: "remote-url",
|
|
@@ -931,7 +922,7 @@ const m2 = "data:image/svg+xml,%3csvg%20viewBox='0%200%2040%2039.9692'%20xmlns='
|
|
|
931
922
|
active: !0,
|
|
932
923
|
tip: r.remoteUrl,
|
|
933
924
|
showCopyIcon: !0,
|
|
934
|
-
icon:
|
|
925
|
+
icon: Ie
|
|
935
926
|
},
|
|
936
927
|
{
|
|
937
928
|
action: "remote-control",
|
|
@@ -940,28 +931,28 @@ const m2 = "data:image/svg+xml,%3csvg%20viewBox='0%200%2040%2039.9692'%20xmlns='
|
|
|
940
931
|
desc: `${r.sessionId.slice(-6)}`,
|
|
941
932
|
know: !0,
|
|
942
933
|
showCopyIcon: !0,
|
|
943
|
-
icon:
|
|
934
|
+
icon: ke
|
|
944
935
|
}
|
|
945
936
|
];
|
|
946
|
-
class
|
|
937
|
+
class $e {
|
|
947
938
|
constructor(e) {
|
|
948
939
|
if (this.isExpanded = !1, this.getImageUrl = (t) => {
|
|
949
940
|
if (!t) return;
|
|
950
|
-
const
|
|
951
|
-
return
|
|
941
|
+
const s = new Image();
|
|
942
|
+
return s.src = t, s;
|
|
952
943
|
}, this.renderItem = () => {
|
|
953
944
|
this.menuItems.filter((t) => t.show !== !1).map(
|
|
954
945
|
(t) => {
|
|
955
|
-
const
|
|
956
|
-
if (!
|
|
957
|
-
|
|
958
|
-
const
|
|
959
|
-
|
|
946
|
+
const s = document.getElementById(`tiny-remoter-icon-item-${t.action}`);
|
|
947
|
+
if (!s) return;
|
|
948
|
+
s.innerHTML = "";
|
|
949
|
+
const i = this.getImageUrl(t.icon);
|
|
950
|
+
i && s.appendChild(i);
|
|
960
951
|
}
|
|
961
952
|
);
|
|
962
953
|
}, this.readyTips = (t) => {
|
|
963
|
-
const
|
|
964
|
-
|
|
954
|
+
const s = document.getElementById(t);
|
|
955
|
+
s && new Ee(s, {
|
|
965
956
|
content: "复制",
|
|
966
957
|
placement: "top",
|
|
967
958
|
trigger: "hover"
|
|
@@ -970,14 +961,13 @@ class L2 {
|
|
|
970
961
|
throw new Error("sessionId is required");
|
|
971
962
|
this.options = {
|
|
972
963
|
...e,
|
|
973
|
-
qrCodeUrl: e.qrCodeUrl ||
|
|
974
|
-
remoteUrl: e.remoteUrl ||
|
|
964
|
+
qrCodeUrl: e.qrCodeUrl || y2,
|
|
965
|
+
remoteUrl: e.remoteUrl || Oe
|
|
975
966
|
}, this.menuItems = this.mergeMenuItems(e.menuItems), this.init();
|
|
976
967
|
}
|
|
977
968
|
// 计算 sessionPrefix 属性
|
|
978
969
|
get sessionPrefix() {
|
|
979
|
-
|
|
980
|
-
return (e = this.options.qrCodeUrl) != null && e.includes("?") ? "&sessionId=" : "?sessionId=";
|
|
970
|
+
return this.options.qrCodeUrl?.includes("?") ? "&sessionId=" : "?sessionId=";
|
|
981
971
|
}
|
|
982
972
|
/**
|
|
983
973
|
* 合并菜单项配置
|
|
@@ -985,15 +975,15 @@ class L2 {
|
|
|
985
975
|
* @returns 合并后的菜单项配置
|
|
986
976
|
*/
|
|
987
977
|
mergeMenuItems(e) {
|
|
988
|
-
return e ?
|
|
989
|
-
const
|
|
990
|
-
return
|
|
978
|
+
return e ? v2(this.options).map((t) => {
|
|
979
|
+
const s = e.find((i) => i.action === t.action);
|
|
980
|
+
return s ? {
|
|
991
981
|
...t,
|
|
992
|
-
...
|
|
982
|
+
...s,
|
|
993
983
|
// 确保show属性存在,默认为true
|
|
994
|
-
show:
|
|
984
|
+
show: s.show !== void 0 ? s.show : t.show
|
|
995
985
|
} : t;
|
|
996
|
-
}) :
|
|
986
|
+
}) : v2(this.options);
|
|
997
987
|
}
|
|
998
988
|
init() {
|
|
999
989
|
this.createFloatingBlock(), this.createDropdownMenu(), this.bindEvents(), this.addStyles();
|
|
@@ -1002,7 +992,7 @@ class L2 {
|
|
|
1002
992
|
createFloatingBlock() {
|
|
1003
993
|
this.floatingBlock = document.createElement("div"), this.floatingBlock.className = "tiny-remoter-floating-block", this.floatingBlock.innerHTML = `
|
|
1004
994
|
<div class="tiny-remoter-floating-block__icon">
|
|
1005
|
-
<img style="display: block; width: 56px;" src="${
|
|
995
|
+
<img style="display: block; width: 56px;" src="${y2}/svgs/logo-next-no-bg-left.svg" alt="icon" />
|
|
1006
996
|
</div>
|
|
1007
997
|
`, document.body.appendChild(this.floatingBlock);
|
|
1008
998
|
}
|
|
@@ -1021,7 +1011,7 @@ class L2 {
|
|
|
1021
1011
|
<div>
|
|
1022
1012
|
${t.showCopyIcon ? `
|
|
1023
1013
|
<div class="tiny-remoter-copy-icon" id="${t.action}" data-action="${t.action}">
|
|
1024
|
-
<img src="${
|
|
1014
|
+
<img src="${Ae}"/>
|
|
1025
1015
|
</div>
|
|
1026
1016
|
` : ""}
|
|
1027
1017
|
</div>
|
|
@@ -1036,15 +1026,15 @@ class L2 {
|
|
|
1036
1026
|
this.floatingBlock.addEventListener("click", () => {
|
|
1037
1027
|
this.toggleDropdown();
|
|
1038
1028
|
}), this.dropdownMenu.addEventListener("click", (e) => {
|
|
1039
|
-
const t = e.target,
|
|
1040
|
-
if (
|
|
1029
|
+
const t = e.target, s = t.closest(".tiny-remoter-copy-icon");
|
|
1030
|
+
if (s) {
|
|
1041
1031
|
e.stopPropagation();
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1032
|
+
const a = s.dataset.action;
|
|
1033
|
+
a && this.handleAction(a);
|
|
1044
1034
|
return;
|
|
1045
1035
|
}
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1036
|
+
const n = t.closest(".tiny-remoter-dropdown-item")?.dataset.action;
|
|
1037
|
+
n && this.handleAction(n);
|
|
1048
1038
|
}), document.addEventListener("click", (e) => {
|
|
1049
1039
|
const t = e.target;
|
|
1050
1040
|
!this.floatingBlock.contains(t) && !this.dropdownMenu.contains(t) && this.closeDropdown();
|
|
@@ -1092,8 +1082,8 @@ class L2 {
|
|
|
1092
1082
|
else {
|
|
1093
1083
|
const t = document.createElement("textarea");
|
|
1094
1084
|
t.value = e, t.style.position = "fixed", t.style.left = "-999999px", t.style.top = "-999999px", document.body.appendChild(t), t.focus(), t.select();
|
|
1095
|
-
const
|
|
1096
|
-
document.body.removeChild(t),
|
|
1085
|
+
const s = document.execCommand("copy");
|
|
1086
|
+
document.body.removeChild(t), s ? this.showCopyFeedback(!0) : this.showCopyFeedback(!1);
|
|
1097
1087
|
}
|
|
1098
1088
|
} catch (t) {
|
|
1099
1089
|
console.error("复制失败:", t), this.showCopyFeedback(!1);
|
|
@@ -1101,16 +1091,16 @@ class L2 {
|
|
|
1101
1091
|
}
|
|
1102
1092
|
// 显示复制反馈提示
|
|
1103
1093
|
showCopyFeedback(e) {
|
|
1104
|
-
const t = e ? "复制成功!" : "复制失败,请手动复制",
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1094
|
+
const t = e ? "复制成功!" : "复制失败,请手动复制", s = document.createElement("div");
|
|
1095
|
+
s.className = `tiny-remoter-copy-feedback ${e ? "success" : "error"}`, s.textContent = t, document.body.appendChild(s), setTimeout(() => s.classList.add("show"), 10), setTimeout(() => {
|
|
1096
|
+
s.classList.remove("show"), setTimeout(() => {
|
|
1097
|
+
s.parentNode && s.parentNode.removeChild(s);
|
|
1108
1098
|
}, 300);
|
|
1109
1099
|
}, 1500);
|
|
1110
1100
|
}
|
|
1111
1101
|
// 创建二维码弹窗
|
|
1112
1102
|
async showQRCode() {
|
|
1113
|
-
const t = await new
|
|
1103
|
+
const t = await new Te((this.options.qrCodeUrl || "") + this.sessionPrefix + this.options.sessionId, {}).toDataURL(), s = this.createModal(
|
|
1114
1104
|
"扫码前往智能遥控器",
|
|
1115
1105
|
`
|
|
1116
1106
|
<div style="text-align: center; padding: 32px;">
|
|
@@ -1195,16 +1185,15 @@ class L2 {
|
|
|
1195
1185
|
</div>
|
|
1196
1186
|
`
|
|
1197
1187
|
);
|
|
1198
|
-
this.showModal(
|
|
1188
|
+
this.showModal(s);
|
|
1199
1189
|
}
|
|
1200
1190
|
// 创建AI对话弹窗--- 暂时调 “用户函数”
|
|
1201
1191
|
showAIChat() {
|
|
1202
|
-
|
|
1203
|
-
(t = (e = this.options).onShowAIChat) == null || t.call(e);
|
|
1192
|
+
this.options.onShowAIChat?.();
|
|
1204
1193
|
}
|
|
1205
1194
|
createModal(e, t) {
|
|
1206
|
-
const
|
|
1207
|
-
|
|
1195
|
+
const s = document.createElement("div");
|
|
1196
|
+
s.className = "tiny-remoter-floating-modal", s.innerHTML = `
|
|
1208
1197
|
<div class="tiny-remoter-modal-overlay"></div>
|
|
1209
1198
|
<div class="tiny-remoter-modal-content">
|
|
1210
1199
|
<div class="tiny-remoter-modal-header">
|
|
@@ -1216,8 +1205,8 @@ class L2 {
|
|
|
1216
1205
|
</div>
|
|
1217
1206
|
</div>
|
|
1218
1207
|
`;
|
|
1219
|
-
const
|
|
1220
|
-
return
|
|
1208
|
+
const i = s.querySelector(".tiny-remoter-modal-close"), n = s.querySelector(".tiny-remoter-modal-overlay");
|
|
1209
|
+
return i.addEventListener("click", () => this.hideModal(s)), n.addEventListener("click", () => this.hideModal(s)), s;
|
|
1221
1210
|
}
|
|
1222
1211
|
showModal(e) {
|
|
1223
1212
|
document.body.appendChild(e), setTimeout(() => e.classList.add("show"), 10);
|
|
@@ -1571,85 +1560,1979 @@ class L2 {
|
|
|
1571
1560
|
this.floatingBlock.parentNode && this.floatingBlock.parentNode.removeChild(this.floatingBlock), this.dropdownMenu.parentNode && this.dropdownMenu.parentNode.removeChild(this.dropdownMenu);
|
|
1572
1561
|
}
|
|
1573
1562
|
}
|
|
1574
|
-
const
|
|
1563
|
+
const k0 = (r = {}) => new $e(r);
|
|
1564
|
+
class _2 extends Error {
|
|
1565
|
+
constructor(e, t) {
|
|
1566
|
+
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
function e2(r) {
|
|
1570
|
+
}
|
|
1571
|
+
function qe(r) {
|
|
1572
|
+
if (typeof r == "function")
|
|
1573
|
+
throw new TypeError(
|
|
1574
|
+
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
1575
|
+
);
|
|
1576
|
+
const { onEvent: e = e2, onError: t = e2, onRetry: s = e2, onComment: i } = r;
|
|
1577
|
+
let n = "", a = !0, l, h = "", c = "";
|
|
1578
|
+
function d(u) {
|
|
1579
|
+
const m = a ? u.replace(/^\xEF\xBB\xBF/, "") : u, [w, v] = je(`${n}${m}`);
|
|
1580
|
+
for (const _ of w)
|
|
1581
|
+
g(_);
|
|
1582
|
+
n = v, a = !1;
|
|
1583
|
+
}
|
|
1584
|
+
function g(u) {
|
|
1585
|
+
if (u === "") {
|
|
1586
|
+
C();
|
|
1587
|
+
return;
|
|
1588
|
+
}
|
|
1589
|
+
if (u.startsWith(":")) {
|
|
1590
|
+
i && i(u.slice(u.startsWith(": ") ? 2 : 1));
|
|
1591
|
+
return;
|
|
1592
|
+
}
|
|
1593
|
+
const m = u.indexOf(":");
|
|
1594
|
+
if (m !== -1) {
|
|
1595
|
+
const w = u.slice(0, m), v = u[m + 1] === " " ? 2 : 1, _ = u.slice(m + v);
|
|
1596
|
+
p(w, _, u);
|
|
1597
|
+
return;
|
|
1598
|
+
}
|
|
1599
|
+
p(u, "", u);
|
|
1600
|
+
}
|
|
1601
|
+
function p(u, m, w) {
|
|
1602
|
+
switch (u) {
|
|
1603
|
+
case "event":
|
|
1604
|
+
c = m;
|
|
1605
|
+
break;
|
|
1606
|
+
case "data":
|
|
1607
|
+
h = `${h}${m}
|
|
1608
|
+
`;
|
|
1609
|
+
break;
|
|
1610
|
+
case "id":
|
|
1611
|
+
l = m.includes("\0") ? void 0 : m;
|
|
1612
|
+
break;
|
|
1613
|
+
case "retry":
|
|
1614
|
+
/^\d+$/.test(m) ? s(parseInt(m, 10)) : t(
|
|
1615
|
+
new _2(`Invalid \`retry\` value: "${m}"`, {
|
|
1616
|
+
type: "invalid-retry",
|
|
1617
|
+
value: m,
|
|
1618
|
+
line: w
|
|
1619
|
+
})
|
|
1620
|
+
);
|
|
1621
|
+
break;
|
|
1622
|
+
default:
|
|
1623
|
+
t(
|
|
1624
|
+
new _2(
|
|
1625
|
+
`Unknown field "${u.length > 20 ? `${u.slice(0, 20)}…` : u}"`,
|
|
1626
|
+
{ type: "unknown-field", field: u, value: m, line: w }
|
|
1627
|
+
)
|
|
1628
|
+
);
|
|
1629
|
+
break;
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
function C() {
|
|
1633
|
+
h.length > 0 && e({
|
|
1634
|
+
id: l,
|
|
1635
|
+
event: c || void 0,
|
|
1636
|
+
// If the data buffer's last character is a U+000A LINE FEED (LF) character,
|
|
1637
|
+
// then remove the last character from the data buffer.
|
|
1638
|
+
data: h.endsWith(`
|
|
1639
|
+
`) ? h.slice(0, -1) : h
|
|
1640
|
+
}), l = void 0, h = "", c = "";
|
|
1641
|
+
}
|
|
1642
|
+
function f(u = {}) {
|
|
1643
|
+
n && u.consume && g(n), a = !0, l = void 0, h = "", c = "", n = "";
|
|
1644
|
+
}
|
|
1645
|
+
return { feed: d, reset: f };
|
|
1646
|
+
}
|
|
1647
|
+
function je(r) {
|
|
1648
|
+
const e = [];
|
|
1649
|
+
let t = "", s = 0;
|
|
1650
|
+
for (; s < r.length; ) {
|
|
1651
|
+
const i = r.indexOf("\r", s), n = r.indexOf(`
|
|
1652
|
+
`, s);
|
|
1653
|
+
let a = -1;
|
|
1654
|
+
if (i !== -1 && n !== -1 ? a = Math.min(i, n) : i !== -1 ? i === r.length - 1 ? a = -1 : a = i : n !== -1 && (a = n), a === -1) {
|
|
1655
|
+
t = r.slice(s);
|
|
1656
|
+
break;
|
|
1657
|
+
} else {
|
|
1658
|
+
const l = r.slice(s, a);
|
|
1659
|
+
e.push(l), s = a + 1, r[s - 1] === "\r" && r[s] === `
|
|
1660
|
+
` && s++;
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
return [e, t];
|
|
1664
|
+
}
|
|
1665
|
+
class o2 extends TransformStream {
|
|
1666
|
+
constructor({ onError: e, onRetry: t, onComment: s } = {}) {
|
|
1667
|
+
let i;
|
|
1668
|
+
super({
|
|
1669
|
+
start(n) {
|
|
1670
|
+
i = qe({
|
|
1671
|
+
onEvent: (a) => {
|
|
1672
|
+
n.enqueue(a);
|
|
1673
|
+
},
|
|
1674
|
+
onError(a) {
|
|
1675
|
+
e === "terminate" ? n.error(a) : typeof e == "function" && e(a);
|
|
1676
|
+
},
|
|
1677
|
+
onRetry: t,
|
|
1678
|
+
onComment: s
|
|
1679
|
+
});
|
|
1680
|
+
},
|
|
1681
|
+
transform(n) {
|
|
1682
|
+
i.feed(n);
|
|
1683
|
+
}
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
var He = ({
|
|
1688
|
+
prefix: r,
|
|
1689
|
+
size: e = 16,
|
|
1690
|
+
alphabet: t = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
1691
|
+
separator: s = "-"
|
|
1692
|
+
} = {}) => {
|
|
1693
|
+
const i = () => {
|
|
1694
|
+
const n = t.length, a = new Array(e);
|
|
1695
|
+
for (let l = 0; l < e; l++)
|
|
1696
|
+
a[l] = t[Math.random() * n | 0];
|
|
1697
|
+
return a.join("");
|
|
1698
|
+
};
|
|
1699
|
+
if (r == null)
|
|
1700
|
+
return i;
|
|
1701
|
+
if (t.includes(s))
|
|
1702
|
+
throw new _e({
|
|
1703
|
+
argument: "separator",
|
|
1704
|
+
message: `The separator "${s}" must not be part of the alphabet "${t}".`
|
|
1705
|
+
});
|
|
1706
|
+
return () => `${r}${s}${i()}`;
|
|
1707
|
+
};
|
|
1708
|
+
He();
|
|
1709
|
+
function I2(r = globalThis) {
|
|
1710
|
+
var e, t, s;
|
|
1711
|
+
return r.window ? "runtime/browser" : (e = r.navigator) != null && e.userAgent ? `runtime/${r.navigator.userAgent.toLowerCase()}` : (s = (t = r.process) == null ? void 0 : t.versions) != null && s.node ? `runtime/node.js/${r.process.version.substring(0)}` : r.EdgeRuntime ? "runtime/vercel-edge" : "runtime/unknown";
|
|
1712
|
+
}
|
|
1713
|
+
function Ne(r) {
|
|
1714
|
+
if (r == null)
|
|
1715
|
+
return {};
|
|
1716
|
+
const e = {};
|
|
1717
|
+
if (r instanceof Headers)
|
|
1718
|
+
r.forEach((t, s) => {
|
|
1719
|
+
e[s.toLowerCase()] = t;
|
|
1720
|
+
});
|
|
1721
|
+
else {
|
|
1722
|
+
Array.isArray(r) || (r = Object.entries(r));
|
|
1723
|
+
for (const [t, s] of r)
|
|
1724
|
+
s != null && (e[t.toLowerCase()] = s);
|
|
1725
|
+
}
|
|
1726
|
+
return e;
|
|
1727
|
+
}
|
|
1728
|
+
function U2(r, ...e) {
|
|
1729
|
+
const t = new Headers(Ne(r)), s = t.get("user-agent") || "";
|
|
1730
|
+
return t.set(
|
|
1731
|
+
"user-agent",
|
|
1732
|
+
[s, ...e].filter(Boolean).join(" ")
|
|
1733
|
+
), Object.fromEntries(t.entries());
|
|
1734
|
+
}
|
|
1735
|
+
var ze = Symbol.for("vercel.ai.validator");
|
|
1736
|
+
function Ze(r) {
|
|
1737
|
+
return { ...r, type: "dynamic" };
|
|
1738
|
+
}
|
|
1739
|
+
new Set(
|
|
1740
|
+
"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"
|
|
1741
|
+
);
|
|
1742
|
+
var De = Symbol.for("vercel.ai.schema");
|
|
1743
|
+
function Fe(r, {
|
|
1744
|
+
validate: e
|
|
1745
|
+
} = {}) {
|
|
1746
|
+
return {
|
|
1747
|
+
[De]: !0,
|
|
1748
|
+
_type: void 0,
|
|
1749
|
+
// should never be used directly
|
|
1750
|
+
[ze]: !0,
|
|
1751
|
+
get jsonSchema() {
|
|
1752
|
+
return typeof r == "function" && (r = r()), r;
|
|
1753
|
+
},
|
|
1754
|
+
validate: e
|
|
1755
|
+
};
|
|
1756
|
+
}
|
|
1757
|
+
let l2;
|
|
1758
|
+
l2 = globalThis.crypto;
|
|
1759
|
+
async function Be(r) {
|
|
1760
|
+
return (await l2).getRandomValues(new Uint8Array(r));
|
|
1761
|
+
}
|
|
1762
|
+
async function Ve(r) {
|
|
1763
|
+
const e = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~", t = Math.pow(2, 8) - Math.pow(2, 8) % e.length;
|
|
1764
|
+
let s = "";
|
|
1765
|
+
for (; s.length < r; ) {
|
|
1766
|
+
const i = await Be(r - s.length);
|
|
1767
|
+
for (const n of i)
|
|
1768
|
+
n < t && (s += e[n % e.length]);
|
|
1769
|
+
}
|
|
1770
|
+
return s;
|
|
1771
|
+
}
|
|
1772
|
+
async function Je(r) {
|
|
1773
|
+
return await Ve(r);
|
|
1774
|
+
}
|
|
1775
|
+
async function We(r) {
|
|
1776
|
+
const e = await (await l2).subtle.digest("SHA-256", new TextEncoder().encode(r));
|
|
1777
|
+
return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
|
|
1778
|
+
}
|
|
1779
|
+
async function Ge(r) {
|
|
1780
|
+
if (r || (r = 43), r < 43 || r > 128)
|
|
1781
|
+
throw `Expected a length between 43 and 128. Received ${r}.`;
|
|
1782
|
+
const e = await Je(r), t = await We(e);
|
|
1783
|
+
return {
|
|
1784
|
+
code_verifier: e,
|
|
1785
|
+
code_challenge: t
|
|
1786
|
+
};
|
|
1787
|
+
}
|
|
1788
|
+
var Ye = "AI_MCPClientError", A2 = `vercel.ai.error.${Ye}`, Ke = Symbol.for(A2), b2, x2, y = class extends (x2 = Z, b2 = Ke, x2) {
|
|
1789
|
+
constructor({
|
|
1790
|
+
name: r = "MCPClientError",
|
|
1791
|
+
message: e,
|
|
1792
|
+
cause: t,
|
|
1793
|
+
data: s,
|
|
1794
|
+
code: i
|
|
1795
|
+
}) {
|
|
1796
|
+
super({ name: r, message: e, cause: t }), this[b2] = !0, this.data = s, this.code = i;
|
|
1797
|
+
}
|
|
1798
|
+
static isInstance(r) {
|
|
1799
|
+
return Z.hasMarker(r, A2);
|
|
1800
|
+
}
|
|
1801
|
+
}, $ = "2025-06-18", Qe = [
|
|
1802
|
+
$,
|
|
1803
|
+
"2025-03-26",
|
|
1804
|
+
"2024-11-05"
|
|
1805
|
+
], Xe = o.looseObject({
|
|
1806
|
+
name: o.string(),
|
|
1807
|
+
version: o.string()
|
|
1808
|
+
}), Y = o.looseObject({
|
|
1809
|
+
_meta: o.optional(o.object({}).loose())
|
|
1810
|
+
}), M = Y, O2 = o.object({
|
|
1811
|
+
method: o.string(),
|
|
1812
|
+
params: o.optional(Y)
|
|
1813
|
+
}), $2 = o.object({
|
|
1814
|
+
applyDefaults: o.optional(o.boolean())
|
|
1815
|
+
}).loose(), et = o.looseObject({
|
|
1816
|
+
experimental: o.optional(o.object({}).loose()),
|
|
1817
|
+
logging: o.optional(o.object({}).loose()),
|
|
1818
|
+
prompts: o.optional(
|
|
1819
|
+
o.looseObject({
|
|
1820
|
+
listChanged: o.optional(o.boolean())
|
|
1821
|
+
})
|
|
1822
|
+
),
|
|
1823
|
+
resources: o.optional(
|
|
1824
|
+
o.looseObject({
|
|
1825
|
+
subscribe: o.optional(o.boolean()),
|
|
1826
|
+
listChanged: o.optional(o.boolean())
|
|
1827
|
+
})
|
|
1828
|
+
),
|
|
1829
|
+
tools: o.optional(
|
|
1830
|
+
o.looseObject({
|
|
1831
|
+
listChanged: o.optional(o.boolean())
|
|
1832
|
+
})
|
|
1833
|
+
),
|
|
1834
|
+
elicitation: o.optional($2)
|
|
1835
|
+
});
|
|
1836
|
+
o.object({
|
|
1837
|
+
elicitation: o.optional($2)
|
|
1838
|
+
}).loose();
|
|
1839
|
+
var tt = M.extend({
|
|
1840
|
+
protocolVersion: o.string(),
|
|
1841
|
+
capabilities: et,
|
|
1842
|
+
serverInfo: Xe,
|
|
1843
|
+
instructions: o.optional(o.string())
|
|
1844
|
+
}), h2 = M.extend({
|
|
1845
|
+
nextCursor: o.optional(o.string())
|
|
1846
|
+
}), rt = o.object({
|
|
1847
|
+
name: o.string(),
|
|
1848
|
+
description: o.optional(o.string()),
|
|
1849
|
+
inputSchema: o.object({
|
|
1850
|
+
type: o.literal("object"),
|
|
1851
|
+
properties: o.optional(o.object({}).loose())
|
|
1852
|
+
}).loose()
|
|
1853
|
+
}).loose(), st = h2.extend({
|
|
1854
|
+
tools: o.array(rt)
|
|
1855
|
+
}), q2 = o.object({
|
|
1856
|
+
type: o.literal("text"),
|
|
1857
|
+
text: o.string()
|
|
1858
|
+
}).loose(), j2 = o.object({
|
|
1859
|
+
type: o.literal("image"),
|
|
1860
|
+
data: o.base64(),
|
|
1861
|
+
mimeType: o.string()
|
|
1862
|
+
}).loose(), ot = o.object({
|
|
1863
|
+
uri: o.string(),
|
|
1864
|
+
name: o.string(),
|
|
1865
|
+
title: o.optional(o.string()),
|
|
1866
|
+
description: o.optional(o.string()),
|
|
1867
|
+
mimeType: o.optional(o.string()),
|
|
1868
|
+
size: o.optional(o.number())
|
|
1869
|
+
}).loose(), it = h2.extend({
|
|
1870
|
+
resources: o.array(ot)
|
|
1871
|
+
}), H2 = o.object({
|
|
1872
|
+
/**
|
|
1873
|
+
* The URI of this resource.
|
|
1874
|
+
*/
|
|
1875
|
+
uri: o.string(),
|
|
1876
|
+
/**
|
|
1877
|
+
* Optional display name of the resource content.
|
|
1878
|
+
*/
|
|
1879
|
+
name: o.optional(o.string()),
|
|
1880
|
+
/**
|
|
1881
|
+
* Optional human readable title.
|
|
1882
|
+
*/
|
|
1883
|
+
title: o.optional(o.string()),
|
|
1884
|
+
/**
|
|
1885
|
+
* The MIME type of this resource, if known.
|
|
1886
|
+
*/
|
|
1887
|
+
mimeType: o.optional(o.string())
|
|
1888
|
+
}).loose(), N2 = H2.extend({
|
|
1889
|
+
text: o.string()
|
|
1890
|
+
}), z2 = H2.extend({
|
|
1891
|
+
blob: o.base64()
|
|
1892
|
+
}), Z2 = o.object({
|
|
1893
|
+
type: o.literal("resource"),
|
|
1894
|
+
resource: o.union([N2, z2])
|
|
1895
|
+
}).loose(), nt = M.extend({
|
|
1896
|
+
content: o.array(
|
|
1897
|
+
o.union([q2, j2, Z2])
|
|
1898
|
+
),
|
|
1899
|
+
isError: o.boolean().default(!1).optional()
|
|
1900
|
+
}).or(
|
|
1901
|
+
M.extend({
|
|
1902
|
+
toolResult: o.unknown()
|
|
1903
|
+
})
|
|
1904
|
+
), at = o.object({
|
|
1905
|
+
uriTemplate: o.string(),
|
|
1906
|
+
name: o.string(),
|
|
1907
|
+
title: o.optional(o.string()),
|
|
1908
|
+
description: o.optional(o.string()),
|
|
1909
|
+
mimeType: o.optional(o.string())
|
|
1910
|
+
}).loose(), ct = M.extend({
|
|
1911
|
+
resourceTemplates: o.array(at)
|
|
1912
|
+
}), lt = M.extend({
|
|
1913
|
+
contents: o.array(
|
|
1914
|
+
o.union([N2, z2])
|
|
1915
|
+
)
|
|
1916
|
+
}), ht = o.object({
|
|
1917
|
+
name: o.string(),
|
|
1918
|
+
description: o.optional(o.string()),
|
|
1919
|
+
required: o.optional(o.boolean())
|
|
1920
|
+
}).loose(), dt = o.object({
|
|
1921
|
+
name: o.string(),
|
|
1922
|
+
title: o.optional(o.string()),
|
|
1923
|
+
description: o.optional(o.string()),
|
|
1924
|
+
arguments: o.optional(o.array(ht))
|
|
1925
|
+
}).loose(), pt = h2.extend({
|
|
1926
|
+
prompts: o.array(dt)
|
|
1927
|
+
}), ut = o.object({
|
|
1928
|
+
role: o.union([o.literal("user"), o.literal("assistant")]),
|
|
1929
|
+
content: o.union([
|
|
1930
|
+
q2,
|
|
1931
|
+
j2,
|
|
1932
|
+
Z2
|
|
1933
|
+
])
|
|
1934
|
+
}).loose(), mt = M.extend({
|
|
1935
|
+
description: o.optional(o.string()),
|
|
1936
|
+
messages: o.array(ut)
|
|
1937
|
+
}), gt = Y.extend({
|
|
1938
|
+
message: o.string(),
|
|
1939
|
+
requestedSchema: o.unknown()
|
|
1940
|
+
}), L2 = O2.extend({
|
|
1941
|
+
method: o.literal("elicitation/create"),
|
|
1942
|
+
params: gt
|
|
1943
|
+
}), ft = M.extend({
|
|
1944
|
+
action: o.union([
|
|
1945
|
+
o.literal("accept"),
|
|
1946
|
+
o.literal("decline"),
|
|
1947
|
+
o.literal("cancel")
|
|
1948
|
+
]),
|
|
1949
|
+
content: o.optional(o.record(o.string(), o.unknown()))
|
|
1950
|
+
}), K = "2.0", Ct = o.object({
|
|
1951
|
+
jsonrpc: o.literal(K),
|
|
1952
|
+
id: o.union([o.string(), o.number().int()])
|
|
1953
|
+
}).merge(O2).strict(), wt = o.object({
|
|
1954
|
+
jsonrpc: o.literal(K),
|
|
1955
|
+
id: o.union([o.string(), o.number().int()]),
|
|
1956
|
+
result: M
|
|
1957
|
+
}).strict(), yt = o.object({
|
|
1958
|
+
jsonrpc: o.literal(K),
|
|
1959
|
+
id: o.union([o.string(), o.number().int()]),
|
|
1960
|
+
error: o.object({
|
|
1961
|
+
code: o.number().int(),
|
|
1962
|
+
message: o.string(),
|
|
1963
|
+
data: o.optional(o.unknown())
|
|
1964
|
+
})
|
|
1965
|
+
}).strict(), vt = o.object({
|
|
1966
|
+
jsonrpc: o.literal(K)
|
|
1967
|
+
}).merge(
|
|
1968
|
+
o.object({
|
|
1969
|
+
method: o.string(),
|
|
1970
|
+
params: o.optional(Y)
|
|
1971
|
+
})
|
|
1972
|
+
).strict(), q = o.union([
|
|
1973
|
+
Ct,
|
|
1974
|
+
vt,
|
|
1975
|
+
wt,
|
|
1976
|
+
yt
|
|
1977
|
+
]), D2 = typeof __PACKAGE_VERSION__ < "u" ? __PACKAGE_VERSION__ : "0.0.0-test", F2 = o.object({
|
|
1978
|
+
access_token: o.string(),
|
|
1979
|
+
id_token: o.string().optional(),
|
|
1980
|
+
// Optional for OAuth 2.1, but necessary in OpenID Connect
|
|
1981
|
+
token_type: o.string(),
|
|
1982
|
+
expires_in: o.number().optional(),
|
|
1983
|
+
scope: o.string().optional(),
|
|
1984
|
+
refresh_token: o.string().optional()
|
|
1985
|
+
}).strip(), x = o.string().url().superRefine((r, e) => {
|
|
1986
|
+
if (!URL.canParse(r))
|
|
1987
|
+
return e.addIssue({
|
|
1988
|
+
code: o.ZodIssueCode.custom,
|
|
1989
|
+
message: "URL must be parseable",
|
|
1990
|
+
fatal: !0
|
|
1991
|
+
}), o.NEVER;
|
|
1992
|
+
}).refine(
|
|
1993
|
+
(r) => {
|
|
1994
|
+
const e = new URL(r);
|
|
1995
|
+
return e.protocol !== "javascript:" && e.protocol !== "data:" && e.protocol !== "vbscript:";
|
|
1996
|
+
},
|
|
1997
|
+
{ message: "URL cannot use javascript:, data:, or vbscript: scheme" }
|
|
1998
|
+
), _t = o.object({
|
|
1999
|
+
resource: o.string().url(),
|
|
2000
|
+
authorization_servers: o.array(x).optional(),
|
|
2001
|
+
jwks_uri: o.string().url().optional(),
|
|
2002
|
+
scopes_supported: o.array(o.string()).optional(),
|
|
2003
|
+
bearer_methods_supported: o.array(o.string()).optional(),
|
|
2004
|
+
resource_signing_alg_values_supported: o.array(o.string()).optional(),
|
|
2005
|
+
resource_name: o.string().optional(),
|
|
2006
|
+
resource_documentation: o.string().optional(),
|
|
2007
|
+
resource_policy_uri: o.string().url().optional(),
|
|
2008
|
+
resource_tos_uri: o.string().url().optional(),
|
|
2009
|
+
tls_client_certificate_bound_access_tokens: o.boolean().optional(),
|
|
2010
|
+
authorization_details_types_supported: o.array(o.string()).optional(),
|
|
2011
|
+
dpop_signing_alg_values_supported: o.array(o.string()).optional(),
|
|
2012
|
+
dpop_bound_access_tokens_required: o.boolean().optional()
|
|
2013
|
+
}).passthrough(), B2 = o.object({
|
|
2014
|
+
issuer: o.string(),
|
|
2015
|
+
authorization_endpoint: x,
|
|
2016
|
+
token_endpoint: x,
|
|
2017
|
+
registration_endpoint: x.optional(),
|
|
2018
|
+
scopes_supported: o.array(o.string()).optional(),
|
|
2019
|
+
response_types_supported: o.array(o.string()),
|
|
2020
|
+
grant_types_supported: o.array(o.string()).optional(),
|
|
2021
|
+
code_challenge_methods_supported: o.array(o.string()),
|
|
2022
|
+
token_endpoint_auth_methods_supported: o.array(o.string()).optional(),
|
|
2023
|
+
token_endpoint_auth_signing_alg_values_supported: o.array(o.string()).optional()
|
|
2024
|
+
}).passthrough(), bt = o.object({
|
|
2025
|
+
issuer: o.string(),
|
|
2026
|
+
authorization_endpoint: x,
|
|
2027
|
+
token_endpoint: x,
|
|
2028
|
+
userinfo_endpoint: x.optional(),
|
|
2029
|
+
jwks_uri: x,
|
|
2030
|
+
registration_endpoint: x.optional(),
|
|
2031
|
+
scopes_supported: o.array(o.string()).optional(),
|
|
2032
|
+
response_types_supported: o.array(o.string()),
|
|
2033
|
+
grant_types_supported: o.array(o.string()).optional(),
|
|
2034
|
+
subject_types_supported: o.array(o.string()),
|
|
2035
|
+
id_token_signing_alg_values_supported: o.array(o.string()),
|
|
2036
|
+
claims_supported: o.array(o.string()).optional(),
|
|
2037
|
+
token_endpoint_auth_methods_supported: o.array(o.string()).optional()
|
|
2038
|
+
}).passthrough(), xt = bt.merge(
|
|
2039
|
+
B2.pick({
|
|
2040
|
+
code_challenge_methods_supported: !0
|
|
2041
|
+
})
|
|
2042
|
+
), Lt = o.object({
|
|
2043
|
+
client_id: o.string(),
|
|
2044
|
+
client_secret: o.string().optional(),
|
|
2045
|
+
client_id_issued_at: o.number().optional(),
|
|
2046
|
+
client_secret_expires_at: o.number().optional()
|
|
2047
|
+
}).strip(), St = o.object({
|
|
2048
|
+
redirect_uris: o.array(x),
|
|
2049
|
+
token_endpoint_auth_method: o.string().optional(),
|
|
2050
|
+
grant_types: o.array(o.string()).optional(),
|
|
2051
|
+
response_types: o.array(o.string()).optional(),
|
|
2052
|
+
client_name: o.string().optional(),
|
|
2053
|
+
client_uri: x.optional(),
|
|
2054
|
+
logo_uri: x.optional(),
|
|
2055
|
+
scope: o.string().optional(),
|
|
2056
|
+
contacts: o.array(o.string()).optional(),
|
|
2057
|
+
tos_uri: x.optional(),
|
|
2058
|
+
policy_uri: o.string().optional(),
|
|
2059
|
+
jwks_uri: x.optional(),
|
|
2060
|
+
jwks: o.any().optional(),
|
|
2061
|
+
software_id: o.string().optional(),
|
|
2062
|
+
software_version: o.string().optional(),
|
|
2063
|
+
software_statement: o.string().optional()
|
|
2064
|
+
}).strip(), Rt = o.object({
|
|
2065
|
+
error: o.string(),
|
|
2066
|
+
error_description: o.string().optional(),
|
|
2067
|
+
error_uri: o.string().optional()
|
|
2068
|
+
}), Tt = St.merge(
|
|
2069
|
+
Lt
|
|
2070
|
+
), Mt = "AI_MCPClientOAuthError", V2 = `vercel.ai.error.${Mt}`, Et = Symbol.for(V2), S2, R2, j = class extends (R2 = Z, S2 = Et, R2) {
|
|
2071
|
+
constructor({
|
|
2072
|
+
name: r = "MCPClientOAuthError",
|
|
2073
|
+
message: e,
|
|
2074
|
+
cause: t
|
|
2075
|
+
}) {
|
|
2076
|
+
super({ name: r, message: e, cause: t }), this[S2] = !0;
|
|
2077
|
+
}
|
|
2078
|
+
static isInstance(r) {
|
|
2079
|
+
return Z.hasMarker(r, V2);
|
|
2080
|
+
}
|
|
2081
|
+
}, O = class extends j {
|
|
2082
|
+
};
|
|
2083
|
+
O.errorCode = "server_error";
|
|
2084
|
+
var D = class extends j {
|
|
2085
|
+
};
|
|
2086
|
+
D.errorCode = "invalid_client";
|
|
2087
|
+
var F = class extends j {
|
|
2088
|
+
};
|
|
2089
|
+
F.errorCode = "invalid_grant";
|
|
2090
|
+
var B = class extends j {
|
|
2091
|
+
};
|
|
2092
|
+
B.errorCode = "unauthorized_client";
|
|
2093
|
+
var Pt = {
|
|
2094
|
+
[O.errorCode]: O,
|
|
2095
|
+
[D.errorCode]: D,
|
|
2096
|
+
[F.errorCode]: F,
|
|
2097
|
+
[B.errorCode]: B
|
|
2098
|
+
};
|
|
2099
|
+
function kt(r) {
|
|
2100
|
+
const e = typeof r == "string" ? new URL(r) : new URL(r.href);
|
|
2101
|
+
return e.hash = "", e;
|
|
2102
|
+
}
|
|
2103
|
+
function It({
|
|
2104
|
+
requestedResource: r,
|
|
2105
|
+
configuredResource: e
|
|
2106
|
+
}) {
|
|
2107
|
+
const t = typeof r == "string" ? new URL(r) : new URL(r.href), s = typeof e == "string" ? new URL(e) : new URL(e.href);
|
|
2108
|
+
if (t.origin !== s.origin || t.pathname.length < s.pathname.length)
|
|
2109
|
+
return !1;
|
|
2110
|
+
const i = t.pathname.endsWith("/") ? t.pathname : t.pathname + "/", n = s.pathname.endsWith("/") ? s.pathname : s.pathname + "/";
|
|
2111
|
+
return i.startsWith(n);
|
|
2112
|
+
}
|
|
2113
|
+
var V = class extends Error {
|
|
2114
|
+
constructor(r = "Unauthorized") {
|
|
2115
|
+
super(r), this.name = "UnauthorizedError";
|
|
2116
|
+
}
|
|
2117
|
+
};
|
|
2118
|
+
function J(r) {
|
|
2119
|
+
var e;
|
|
2120
|
+
const t = (e = r.headers.get("www-authenticate")) != null ? e : r.headers.get("WWW-Authenticate");
|
|
2121
|
+
if (!t)
|
|
2122
|
+
return;
|
|
2123
|
+
const [s, i] = t.split(" ");
|
|
2124
|
+
if (s.toLowerCase() !== "bearer" || !i)
|
|
2125
|
+
return;
|
|
2126
|
+
const n = /resource_metadata="([^"]*)"/, a = t.match(n);
|
|
2127
|
+
if (a)
|
|
2128
|
+
try {
|
|
2129
|
+
return new URL(a[1]);
|
|
2130
|
+
} catch {
|
|
2131
|
+
return;
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
function Ut(r, e = "", t = {}) {
|
|
2135
|
+
return e.endsWith("/") && (e = e.slice(0, -1)), t.prependPathname ? `${e}/.well-known/${r}` : `/.well-known/${r}${e}`;
|
|
2136
|
+
}
|
|
2137
|
+
async function d2(r, e, t = fetch) {
|
|
2138
|
+
try {
|
|
2139
|
+
return await t(r, { headers: e });
|
|
2140
|
+
} catch (s) {
|
|
2141
|
+
if (s instanceof TypeError)
|
|
2142
|
+
return e ? d2(r, void 0, t) : void 0;
|
|
2143
|
+
throw s;
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
async function T2(r, e, t = fetch) {
|
|
2147
|
+
return await d2(r, {
|
|
2148
|
+
"MCP-Protocol-Version": e
|
|
2149
|
+
}, t);
|
|
2150
|
+
}
|
|
2151
|
+
function At(r, e) {
|
|
2152
|
+
return !r || r.status >= 400 && r.status < 500 && e !== "/";
|
|
2153
|
+
}
|
|
2154
|
+
async function Ot(r, e, t, s) {
|
|
2155
|
+
var i, n;
|
|
2156
|
+
const a = new URL(r), l = (i = s?.protocolVersion) != null ? i : $;
|
|
2157
|
+
let h;
|
|
2158
|
+
if (s?.metadataUrl)
|
|
2159
|
+
h = new URL(s.metadataUrl);
|
|
2160
|
+
else {
|
|
2161
|
+
const d = Ut(e, a.pathname);
|
|
2162
|
+
h = new URL(d, (n = s?.metadataServerUrl) != null ? n : a), h.search = a.search;
|
|
2163
|
+
}
|
|
2164
|
+
let c = await T2(h, l, t);
|
|
2165
|
+
if (!s?.metadataUrl && At(c, a.pathname)) {
|
|
2166
|
+
const d = new URL(`/.well-known/${e}`, a);
|
|
2167
|
+
c = await T2(d, l, t);
|
|
2168
|
+
}
|
|
2169
|
+
return c;
|
|
2170
|
+
}
|
|
2171
|
+
async function $t(r, e, t = fetch) {
|
|
2172
|
+
const s = await Ot(
|
|
2173
|
+
r,
|
|
2174
|
+
"oauth-protected-resource",
|
|
2175
|
+
t,
|
|
2176
|
+
{
|
|
2177
|
+
protocolVersion: e?.protocolVersion,
|
|
2178
|
+
metadataUrl: e?.resourceMetadataUrl
|
|
2179
|
+
}
|
|
2180
|
+
);
|
|
2181
|
+
if (!s || s.status === 404)
|
|
2182
|
+
throw new Error(
|
|
2183
|
+
"Resource server does not implement OAuth 2.0 Protected Resource Metadata."
|
|
2184
|
+
);
|
|
2185
|
+
if (!s.ok)
|
|
2186
|
+
throw new Error(
|
|
2187
|
+
`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`
|
|
2188
|
+
);
|
|
2189
|
+
return _t.parse(await s.json());
|
|
2190
|
+
}
|
|
2191
|
+
function qt(r) {
|
|
2192
|
+
const e = typeof r == "string" ? new URL(r) : r, t = e.pathname !== "/", s = [];
|
|
2193
|
+
if (!t)
|
|
2194
|
+
return s.push({
|
|
2195
|
+
url: new URL("/.well-known/oauth-authorization-server", e.origin),
|
|
2196
|
+
type: "oauth"
|
|
2197
|
+
}), s.push({
|
|
2198
|
+
url: new URL("/.well-known/openid-configuration", e.origin),
|
|
2199
|
+
type: "oidc"
|
|
2200
|
+
}), s;
|
|
2201
|
+
let i = e.pathname;
|
|
2202
|
+
return i.endsWith("/") && (i = i.slice(0, -1)), s.push({
|
|
2203
|
+
url: new URL(
|
|
2204
|
+
`/.well-known/oauth-authorization-server${i}`,
|
|
2205
|
+
e.origin
|
|
2206
|
+
),
|
|
2207
|
+
type: "oauth"
|
|
2208
|
+
}), s.push({
|
|
2209
|
+
url: new URL("/.well-known/oauth-authorization-server", e.origin),
|
|
2210
|
+
type: "oauth"
|
|
2211
|
+
}), s.push({
|
|
2212
|
+
url: new URL(`/.well-known/openid-configuration${i}`, e.origin),
|
|
2213
|
+
type: "oidc"
|
|
2214
|
+
}), s.push({
|
|
2215
|
+
url: new URL(`${i}/.well-known/openid-configuration`, e.origin),
|
|
2216
|
+
type: "oidc"
|
|
2217
|
+
}), s;
|
|
2218
|
+
}
|
|
2219
|
+
async function jt(r, {
|
|
2220
|
+
fetchFn: e = fetch,
|
|
2221
|
+
protocolVersion: t = $
|
|
2222
|
+
} = {}) {
|
|
2223
|
+
var s;
|
|
2224
|
+
const i = { "MCP-Protocol-Version": t }, n = qt(r);
|
|
2225
|
+
for (const { url: a, type: l } of n) {
|
|
2226
|
+
const h = await d2(a, i, e);
|
|
2227
|
+
if (h) {
|
|
2228
|
+
if (!h.ok) {
|
|
2229
|
+
if (h.status >= 400 && h.status < 500)
|
|
2230
|
+
continue;
|
|
2231
|
+
throw new Error(
|
|
2232
|
+
`HTTP ${h.status} trying to load ${l === "oauth" ? "OAuth" : "OpenID provider"} metadata from ${a}`
|
|
2233
|
+
);
|
|
2234
|
+
}
|
|
2235
|
+
if (l === "oauth")
|
|
2236
|
+
return B2.parse(await h.json());
|
|
2237
|
+
{
|
|
2238
|
+
const c = xt.parse(
|
|
2239
|
+
await h.json()
|
|
2240
|
+
);
|
|
2241
|
+
if (!((s = c.code_challenge_methods_supported) != null && s.includes("S256")))
|
|
2242
|
+
throw new Error(
|
|
2243
|
+
`Incompatible OIDC provider at ${a}: does not support S256 code challenge method required by MCP specification`
|
|
2244
|
+
);
|
|
2245
|
+
return c;
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2250
|
+
async function Ht(r, {
|
|
2251
|
+
metadata: e,
|
|
2252
|
+
clientInformation: t,
|
|
2253
|
+
redirectUrl: s,
|
|
2254
|
+
scope: i,
|
|
2255
|
+
state: n,
|
|
2256
|
+
resource: a
|
|
2257
|
+
}) {
|
|
2258
|
+
const l = "code", h = "S256";
|
|
2259
|
+
let c;
|
|
2260
|
+
if (e) {
|
|
2261
|
+
if (c = new URL(e.authorization_endpoint), !e.response_types_supported.includes(l))
|
|
2262
|
+
throw new Error(
|
|
2263
|
+
`Incompatible auth server: does not support response type ${l}`
|
|
2264
|
+
);
|
|
2265
|
+
if (!e.code_challenge_methods_supported || !e.code_challenge_methods_supported.includes(h))
|
|
2266
|
+
throw new Error(
|
|
2267
|
+
`Incompatible auth server: does not support code challenge method ${h}`
|
|
2268
|
+
);
|
|
2269
|
+
} else
|
|
2270
|
+
c = new URL("/authorize", r);
|
|
2271
|
+
const d = await Ge(), g = d.code_verifier, p = d.code_challenge;
|
|
2272
|
+
return c.searchParams.set("response_type", l), c.searchParams.set("client_id", t.client_id), c.searchParams.set("code_challenge", p), c.searchParams.set(
|
|
2273
|
+
"code_challenge_method",
|
|
2274
|
+
h
|
|
2275
|
+
), c.searchParams.set("redirect_uri", String(s)), n && c.searchParams.set("state", n), i && c.searchParams.set("scope", i), i?.includes("offline_access") && c.searchParams.append("prompt", "consent"), a && c.searchParams.set("resource", a.href), { authorizationUrl: c, codeVerifier: g };
|
|
2276
|
+
}
|
|
2277
|
+
function J2(r, e) {
|
|
2278
|
+
const t = r.client_secret !== void 0;
|
|
2279
|
+
return e.length === 0 ? t ? "client_secret_post" : "none" : t && e.includes("client_secret_basic") ? "client_secret_basic" : t && e.includes("client_secret_post") ? "client_secret_post" : e.includes("none") ? "none" : t ? "client_secret_post" : "none";
|
|
2280
|
+
}
|
|
2281
|
+
function W2(r, e, t, s) {
|
|
2282
|
+
const { client_id: i, client_secret: n } = e;
|
|
2283
|
+
switch (r) {
|
|
2284
|
+
case "client_secret_basic":
|
|
2285
|
+
Nt(i, n, t);
|
|
2286
|
+
return;
|
|
2287
|
+
case "client_secret_post":
|
|
2288
|
+
zt(i, n, s);
|
|
2289
|
+
return;
|
|
2290
|
+
case "none":
|
|
2291
|
+
Zt(i, s);
|
|
2292
|
+
return;
|
|
2293
|
+
default:
|
|
2294
|
+
throw new Error(`Unsupported client authentication method: ${r}`);
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
function Nt(r, e, t) {
|
|
2298
|
+
if (!e)
|
|
2299
|
+
throw new Error(
|
|
2300
|
+
"client_secret_basic authentication requires a client_secret"
|
|
2301
|
+
);
|
|
2302
|
+
const s = btoa(`${r}:${e}`);
|
|
2303
|
+
t.set("Authorization", `Basic ${s}`);
|
|
2304
|
+
}
|
|
2305
|
+
function zt(r, e, t) {
|
|
2306
|
+
t.set("client_id", r), e && t.set("client_secret", e);
|
|
2307
|
+
}
|
|
2308
|
+
function Zt(r, e) {
|
|
2309
|
+
e.set("client_id", r);
|
|
2310
|
+
}
|
|
2311
|
+
async function p2(r) {
|
|
2312
|
+
const e = r instanceof Response ? r.status : void 0, t = r instanceof Response ? await r.text() : r;
|
|
2313
|
+
try {
|
|
2314
|
+
const s = Rt.parse(JSON.parse(t)), { error: i, error_description: n, error_uri: a } = s, l = Pt[i] || O;
|
|
2315
|
+
return new l({
|
|
2316
|
+
message: n || "",
|
|
2317
|
+
cause: a
|
|
2318
|
+
});
|
|
2319
|
+
} catch (s) {
|
|
2320
|
+
const i = `${e ? `HTTP ${e}: ` : ""}Invalid OAuth error response: ${s}. Raw body: ${t}`;
|
|
2321
|
+
return new O({ message: i });
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
async function Dt(r, {
|
|
2325
|
+
metadata: e,
|
|
2326
|
+
clientInformation: t,
|
|
2327
|
+
authorizationCode: s,
|
|
2328
|
+
codeVerifier: i,
|
|
2329
|
+
redirectUri: n,
|
|
2330
|
+
resource: a,
|
|
2331
|
+
addClientAuthentication: l,
|
|
2332
|
+
fetchFn: h
|
|
2333
|
+
}) {
|
|
2334
|
+
var c;
|
|
2335
|
+
const d = "authorization_code", g = e?.token_endpoint ? new URL(e.token_endpoint) : new URL("/token", r);
|
|
2336
|
+
if (e?.grant_types_supported && !e.grant_types_supported.includes(d))
|
|
2337
|
+
throw new Error(
|
|
2338
|
+
`Incompatible auth server: does not support grant type ${d}`
|
|
2339
|
+
);
|
|
2340
|
+
const p = new Headers({
|
|
2341
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
2342
|
+
Accept: "application/json"
|
|
2343
|
+
}), C = new URLSearchParams({
|
|
2344
|
+
grant_type: d,
|
|
2345
|
+
code: s,
|
|
2346
|
+
code_verifier: i,
|
|
2347
|
+
redirect_uri: String(n)
|
|
2348
|
+
});
|
|
2349
|
+
if (l)
|
|
2350
|
+
l(p, C, r, e);
|
|
2351
|
+
else {
|
|
2352
|
+
const u = (c = e?.token_endpoint_auth_methods_supported) != null ? c : [], m = J2(
|
|
2353
|
+
t,
|
|
2354
|
+
u
|
|
2355
|
+
);
|
|
2356
|
+
W2(m, t, p, C);
|
|
2357
|
+
}
|
|
2358
|
+
a && C.set("resource", a.href);
|
|
2359
|
+
const f = await (h ?? fetch)(g, {
|
|
2360
|
+
method: "POST",
|
|
2361
|
+
headers: p,
|
|
2362
|
+
body: C
|
|
2363
|
+
});
|
|
2364
|
+
if (!f.ok)
|
|
2365
|
+
throw await p2(f);
|
|
2366
|
+
return F2.parse(await f.json());
|
|
2367
|
+
}
|
|
2368
|
+
async function Ft(r, {
|
|
2369
|
+
metadata: e,
|
|
2370
|
+
clientInformation: t,
|
|
2371
|
+
refreshToken: s,
|
|
2372
|
+
resource: i,
|
|
2373
|
+
addClientAuthentication: n,
|
|
2374
|
+
fetchFn: a
|
|
2375
|
+
}) {
|
|
2376
|
+
var l;
|
|
2377
|
+
const h = "refresh_token";
|
|
2378
|
+
let c;
|
|
2379
|
+
if (e) {
|
|
2380
|
+
if (c = new URL(e.token_endpoint), e.grant_types_supported && !e.grant_types_supported.includes(h))
|
|
2381
|
+
throw new Error(
|
|
2382
|
+
`Incompatible auth server: does not support grant type ${h}`
|
|
2383
|
+
);
|
|
2384
|
+
} else
|
|
2385
|
+
c = new URL("/token", r);
|
|
2386
|
+
const d = new Headers({
|
|
2387
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
2388
|
+
}), g = new URLSearchParams({
|
|
2389
|
+
grant_type: h,
|
|
2390
|
+
refresh_token: s
|
|
2391
|
+
});
|
|
2392
|
+
if (n)
|
|
2393
|
+
n(d, g, r, e);
|
|
2394
|
+
else {
|
|
2395
|
+
const C = (l = e?.token_endpoint_auth_methods_supported) != null ? l : [], f = J2(
|
|
2396
|
+
t,
|
|
2397
|
+
C
|
|
2398
|
+
);
|
|
2399
|
+
W2(f, t, d, g);
|
|
2400
|
+
}
|
|
2401
|
+
i && g.set("resource", i.href);
|
|
2402
|
+
const p = await (a ?? fetch)(c, {
|
|
2403
|
+
method: "POST",
|
|
2404
|
+
headers: d,
|
|
2405
|
+
body: g
|
|
2406
|
+
});
|
|
2407
|
+
if (!p.ok)
|
|
2408
|
+
throw await p2(p);
|
|
2409
|
+
return F2.parse({
|
|
2410
|
+
refresh_token: s,
|
|
2411
|
+
...await p.json()
|
|
2412
|
+
});
|
|
2413
|
+
}
|
|
2414
|
+
async function Bt(r, {
|
|
2415
|
+
metadata: e,
|
|
2416
|
+
clientMetadata: t,
|
|
2417
|
+
fetchFn: s
|
|
2418
|
+
}) {
|
|
2419
|
+
let i;
|
|
2420
|
+
if (e) {
|
|
2421
|
+
if (!e.registration_endpoint)
|
|
2422
|
+
throw new Error(
|
|
2423
|
+
"Incompatible auth server: does not support dynamic client registration"
|
|
2424
|
+
);
|
|
2425
|
+
i = new URL(e.registration_endpoint);
|
|
2426
|
+
} else
|
|
2427
|
+
i = new URL("/register", r);
|
|
2428
|
+
const n = await (s ?? fetch)(i, {
|
|
2429
|
+
method: "POST",
|
|
2430
|
+
headers: {
|
|
2431
|
+
"Content-Type": "application/json"
|
|
2432
|
+
},
|
|
2433
|
+
body: JSON.stringify(t)
|
|
2434
|
+
});
|
|
2435
|
+
if (!n.ok)
|
|
2436
|
+
throw await p2(n);
|
|
2437
|
+
return Tt.parse(await n.json());
|
|
2438
|
+
}
|
|
2439
|
+
async function W(r, e) {
|
|
2440
|
+
var t, s;
|
|
2441
|
+
try {
|
|
2442
|
+
return await t2(r, e);
|
|
2443
|
+
} catch (i) {
|
|
2444
|
+
if (i instanceof D || i instanceof B)
|
|
2445
|
+
return await ((t = r.invalidateCredentials) == null ? void 0 : t.call(r, "all")), await t2(r, e);
|
|
2446
|
+
if (i instanceof F)
|
|
2447
|
+
return await ((s = r.invalidateCredentials) == null ? void 0 : s.call(r, "tokens")), await t2(r, e);
|
|
2448
|
+
throw i;
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
async function Vt(r, e, t) {
|
|
2452
|
+
const s = kt(r);
|
|
2453
|
+
if (e.validateResourceURL)
|
|
2454
|
+
return await e.validateResourceURL(
|
|
2455
|
+
s,
|
|
2456
|
+
t?.resource
|
|
2457
|
+
);
|
|
2458
|
+
if (t) {
|
|
2459
|
+
if (!It({
|
|
2460
|
+
requestedResource: s,
|
|
2461
|
+
configuredResource: t.resource
|
|
2462
|
+
}))
|
|
2463
|
+
throw new Error(
|
|
2464
|
+
`Protected resource ${t.resource} does not match expected ${s} (or origin)`
|
|
2465
|
+
);
|
|
2466
|
+
return new URL(t.resource);
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
async function t2(r, {
|
|
2470
|
+
serverUrl: e,
|
|
2471
|
+
authorizationCode: t,
|
|
2472
|
+
scope: s,
|
|
2473
|
+
resourceMetadataUrl: i,
|
|
2474
|
+
fetchFn: n
|
|
2475
|
+
}) {
|
|
2476
|
+
let a, l;
|
|
2477
|
+
try {
|
|
2478
|
+
a = await $t(
|
|
2479
|
+
e,
|
|
2480
|
+
{ resourceMetadataUrl: i },
|
|
2481
|
+
n
|
|
2482
|
+
), a.authorization_servers && a.authorization_servers.length > 0 && (l = a.authorization_servers[0]);
|
|
2483
|
+
} catch {
|
|
2484
|
+
}
|
|
2485
|
+
l || (l = e);
|
|
2486
|
+
const h = await Vt(
|
|
2487
|
+
e,
|
|
2488
|
+
r,
|
|
2489
|
+
a
|
|
2490
|
+
), c = await jt(
|
|
2491
|
+
l,
|
|
2492
|
+
{
|
|
2493
|
+
fetchFn: n
|
|
2494
|
+
}
|
|
2495
|
+
);
|
|
2496
|
+
let d = await Promise.resolve(r.clientInformation());
|
|
2497
|
+
if (!d) {
|
|
2498
|
+
if (t !== void 0)
|
|
2499
|
+
throw new Error(
|
|
2500
|
+
"Existing OAuth client information is required when exchanging an authorization code"
|
|
2501
|
+
);
|
|
2502
|
+
if (!r.saveClientInformation)
|
|
2503
|
+
throw new Error(
|
|
2504
|
+
"OAuth client information must be saveable for dynamic registration"
|
|
2505
|
+
);
|
|
2506
|
+
const u = await Bt(l, {
|
|
2507
|
+
metadata: c,
|
|
2508
|
+
clientMetadata: r.clientMetadata,
|
|
2509
|
+
fetchFn: n
|
|
2510
|
+
});
|
|
2511
|
+
await r.saveClientInformation(u), d = u;
|
|
2512
|
+
}
|
|
2513
|
+
if (t !== void 0) {
|
|
2514
|
+
const u = await r.codeVerifier(), m = await Dt(l, {
|
|
2515
|
+
metadata: c,
|
|
2516
|
+
clientInformation: d,
|
|
2517
|
+
authorizationCode: t,
|
|
2518
|
+
codeVerifier: u,
|
|
2519
|
+
redirectUri: r.redirectUrl,
|
|
2520
|
+
resource: h,
|
|
2521
|
+
addClientAuthentication: r.addClientAuthentication,
|
|
2522
|
+
fetchFn: n
|
|
2523
|
+
});
|
|
2524
|
+
return await r.saveTokens(m), "AUTHORIZED";
|
|
2525
|
+
}
|
|
2526
|
+
const g = await r.tokens();
|
|
2527
|
+
if (g?.refresh_token)
|
|
2528
|
+
try {
|
|
2529
|
+
const u = await Ft(l, {
|
|
2530
|
+
metadata: c,
|
|
2531
|
+
clientInformation: d,
|
|
2532
|
+
refreshToken: g.refresh_token,
|
|
2533
|
+
resource: h,
|
|
2534
|
+
addClientAuthentication: r.addClientAuthentication,
|
|
2535
|
+
fetchFn: n
|
|
2536
|
+
});
|
|
2537
|
+
return await r.saveTokens(u), "AUTHORIZED";
|
|
2538
|
+
} catch (u) {
|
|
2539
|
+
if (
|
|
2540
|
+
// If this is a ServerError, or an unknown type, log it out and try to continue. Otherwise, escalate so we can fix things and retry.
|
|
2541
|
+
!(!(u instanceof j) || u instanceof O)
|
|
2542
|
+
) throw u;
|
|
2543
|
+
}
|
|
2544
|
+
const p = r.state ? await r.state() : void 0, { authorizationUrl: C, codeVerifier: f } = await Ht(
|
|
2545
|
+
l,
|
|
2546
|
+
{
|
|
2547
|
+
metadata: c,
|
|
2548
|
+
clientInformation: d,
|
|
2549
|
+
state: p,
|
|
2550
|
+
redirectUrl: r.redirectUrl,
|
|
2551
|
+
scope: s || r.clientMetadata.scope,
|
|
2552
|
+
resource: h
|
|
2553
|
+
}
|
|
2554
|
+
);
|
|
2555
|
+
return await r.saveCodeVerifier(f), await r.redirectToAuthorization(C), "REDIRECT";
|
|
2556
|
+
}
|
|
2557
|
+
var Jt = class {
|
|
2558
|
+
constructor({
|
|
2559
|
+
url: r,
|
|
2560
|
+
headers: e,
|
|
2561
|
+
authProvider: t
|
|
2562
|
+
}) {
|
|
2563
|
+
this.connected = !1, this.url = new URL(r), this.headers = e, this.authProvider = t;
|
|
2564
|
+
}
|
|
2565
|
+
async commonHeaders(r) {
|
|
2566
|
+
const e = {
|
|
2567
|
+
...this.headers,
|
|
2568
|
+
...r,
|
|
2569
|
+
"mcp-protocol-version": $
|
|
2570
|
+
};
|
|
2571
|
+
if (this.authProvider) {
|
|
2572
|
+
const t = await this.authProvider.tokens();
|
|
2573
|
+
t?.access_token && (e.Authorization = `Bearer ${t.access_token}`);
|
|
2574
|
+
}
|
|
2575
|
+
return U2(
|
|
2576
|
+
e,
|
|
2577
|
+
`ai-sdk/${D2}`,
|
|
2578
|
+
I2()
|
|
2579
|
+
);
|
|
2580
|
+
}
|
|
2581
|
+
async start() {
|
|
2582
|
+
return new Promise((r, e) => {
|
|
2583
|
+
if (this.connected)
|
|
2584
|
+
return r();
|
|
2585
|
+
this.abortController = new AbortController();
|
|
2586
|
+
const t = async (s = !1) => {
|
|
2587
|
+
var i, n, a, l, h;
|
|
2588
|
+
try {
|
|
2589
|
+
const c = await this.commonHeaders({
|
|
2590
|
+
Accept: "text/event-stream"
|
|
2591
|
+
}), d = await fetch(this.url.href, {
|
|
2592
|
+
headers: c,
|
|
2593
|
+
signal: (i = this.abortController) == null ? void 0 : i.signal
|
|
2594
|
+
});
|
|
2595
|
+
if (d.status === 401 && this.authProvider && !s) {
|
|
2596
|
+
this.resourceMetadataUrl = J(d);
|
|
2597
|
+
try {
|
|
2598
|
+
if (await W(this.authProvider, {
|
|
2599
|
+
serverUrl: this.url,
|
|
2600
|
+
resourceMetadataUrl: this.resourceMetadataUrl
|
|
2601
|
+
}) !== "AUTHORIZED") {
|
|
2602
|
+
const u = new V();
|
|
2603
|
+
return (n = this.onerror) == null || n.call(this, u), e(u);
|
|
2604
|
+
}
|
|
2605
|
+
} catch (f) {
|
|
2606
|
+
return (a = this.onerror) == null || a.call(this, f), e(f);
|
|
2607
|
+
}
|
|
2608
|
+
return t(!0);
|
|
2609
|
+
}
|
|
2610
|
+
if (!d.ok || !d.body) {
|
|
2611
|
+
let f = `MCP SSE Transport Error: ${d.status} ${d.statusText}`;
|
|
2612
|
+
d.status === 405 && (f += ". This server does not support SSE transport. Try using `http` transport instead");
|
|
2613
|
+
const u = new y({
|
|
2614
|
+
message: f
|
|
2615
|
+
});
|
|
2616
|
+
return (l = this.onerror) == null || l.call(this, u), e(u);
|
|
2617
|
+
}
|
|
2618
|
+
const p = d.body.pipeThrough(new TextDecoderStream()).pipeThrough(new o2()).getReader(), C = async () => {
|
|
2619
|
+
var f, u, m;
|
|
2620
|
+
try {
|
|
2621
|
+
for (; ; ) {
|
|
2622
|
+
const { done: w, value: v } = await p.read();
|
|
2623
|
+
if (w) {
|
|
2624
|
+
if (this.connected)
|
|
2625
|
+
throw this.connected = !1, new y({
|
|
2626
|
+
message: "MCP SSE Transport Error: Connection closed unexpectedly"
|
|
2627
|
+
});
|
|
2628
|
+
return;
|
|
2629
|
+
}
|
|
2630
|
+
const { event: _, data: S } = v;
|
|
2631
|
+
if (_ === "endpoint") {
|
|
2632
|
+
if (this.endpoint = new URL(S, this.url), this.endpoint.origin !== this.url.origin)
|
|
2633
|
+
throw new y({
|
|
2634
|
+
message: `MCP SSE Transport Error: Endpoint origin does not match connection origin: ${this.endpoint.origin}`
|
|
2635
|
+
});
|
|
2636
|
+
this.connected = !0, r();
|
|
2637
|
+
} else if (_ === "message")
|
|
2638
|
+
try {
|
|
2639
|
+
const L = q.parse(
|
|
2640
|
+
JSON.parse(S)
|
|
2641
|
+
);
|
|
2642
|
+
(f = this.onmessage) == null || f.call(this, L);
|
|
2643
|
+
} catch (L) {
|
|
2644
|
+
const b = new y({
|
|
2645
|
+
message: "MCP SSE Transport Error: Failed to parse message",
|
|
2646
|
+
cause: L
|
|
2647
|
+
});
|
|
2648
|
+
(u = this.onerror) == null || u.call(this, b);
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2651
|
+
} catch (w) {
|
|
2652
|
+
if (w instanceof Error && w.name === "AbortError")
|
|
2653
|
+
return;
|
|
2654
|
+
(m = this.onerror) == null || m.call(this, w), e(w);
|
|
2655
|
+
}
|
|
2656
|
+
};
|
|
2657
|
+
this.sseConnection = {
|
|
2658
|
+
close: () => p.cancel()
|
|
2659
|
+
}, C();
|
|
2660
|
+
} catch (c) {
|
|
2661
|
+
if (c instanceof Error && c.name === "AbortError")
|
|
2662
|
+
return;
|
|
2663
|
+
(h = this.onerror) == null || h.call(this, c), e(c);
|
|
2664
|
+
}
|
|
2665
|
+
};
|
|
2666
|
+
t();
|
|
2667
|
+
});
|
|
2668
|
+
}
|
|
2669
|
+
async close() {
|
|
2670
|
+
var r, e, t;
|
|
2671
|
+
this.connected = !1, (r = this.sseConnection) == null || r.close(), (e = this.abortController) == null || e.abort(), (t = this.onclose) == null || t.call(this);
|
|
2672
|
+
}
|
|
2673
|
+
async send(r) {
|
|
2674
|
+
if (!this.endpoint || !this.connected)
|
|
2675
|
+
throw new y({
|
|
2676
|
+
message: "MCP SSE Transport Error: Not connected"
|
|
2677
|
+
});
|
|
2678
|
+
const e = this.endpoint, t = async (s = !1) => {
|
|
2679
|
+
var i, n, a, l, h;
|
|
2680
|
+
try {
|
|
2681
|
+
const d = {
|
|
2682
|
+
method: "POST",
|
|
2683
|
+
headers: await this.commonHeaders({
|
|
2684
|
+
"Content-Type": "application/json"
|
|
2685
|
+
}),
|
|
2686
|
+
body: JSON.stringify(r),
|
|
2687
|
+
signal: (i = this.abortController) == null ? void 0 : i.signal
|
|
2688
|
+
}, g = await fetch(e, d);
|
|
2689
|
+
if (g.status === 401 && this.authProvider && !s) {
|
|
2690
|
+
this.resourceMetadataUrl = J(g);
|
|
2691
|
+
try {
|
|
2692
|
+
if (await W(this.authProvider, {
|
|
2693
|
+
serverUrl: this.url,
|
|
2694
|
+
resourceMetadataUrl: this.resourceMetadataUrl
|
|
2695
|
+
}) !== "AUTHORIZED") {
|
|
2696
|
+
const C = new V();
|
|
2697
|
+
(n = this.onerror) == null || n.call(this, C);
|
|
2698
|
+
return;
|
|
2699
|
+
}
|
|
2700
|
+
} catch (p) {
|
|
2701
|
+
(a = this.onerror) == null || a.call(this, p);
|
|
2702
|
+
return;
|
|
2703
|
+
}
|
|
2704
|
+
return t(!0);
|
|
2705
|
+
}
|
|
2706
|
+
if (!g.ok) {
|
|
2707
|
+
const p = await g.text().catch(() => null), C = new y({
|
|
2708
|
+
message: `MCP SSE Transport Error: POSTing to endpoint (HTTP ${g.status}): ${p}`
|
|
2709
|
+
});
|
|
2710
|
+
(l = this.onerror) == null || l.call(this, C);
|
|
2711
|
+
return;
|
|
2712
|
+
}
|
|
2713
|
+
} catch (c) {
|
|
2714
|
+
(h = this.onerror) == null || h.call(this, c);
|
|
2715
|
+
return;
|
|
2716
|
+
}
|
|
2717
|
+
};
|
|
2718
|
+
await t();
|
|
2719
|
+
}
|
|
2720
|
+
}, Wt = class {
|
|
2721
|
+
constructor({
|
|
2722
|
+
url: r,
|
|
2723
|
+
headers: e,
|
|
2724
|
+
authProvider: t
|
|
2725
|
+
}) {
|
|
2726
|
+
this.inboundReconnectAttempts = 0, this.reconnectionOptions = {
|
|
2727
|
+
initialReconnectionDelay: 1e3,
|
|
2728
|
+
maxReconnectionDelay: 3e4,
|
|
2729
|
+
reconnectionDelayGrowFactor: 1.5,
|
|
2730
|
+
maxRetries: 2
|
|
2731
|
+
}, this.url = new URL(r), this.headers = e, this.authProvider = t;
|
|
2732
|
+
}
|
|
2733
|
+
async commonHeaders(r) {
|
|
2734
|
+
const e = {
|
|
2735
|
+
...this.headers,
|
|
2736
|
+
...r,
|
|
2737
|
+
"mcp-protocol-version": $
|
|
2738
|
+
};
|
|
2739
|
+
if (this.sessionId && (e["mcp-session-id"] = this.sessionId), this.authProvider) {
|
|
2740
|
+
const t = await this.authProvider.tokens();
|
|
2741
|
+
t?.access_token && (e.Authorization = `Bearer ${t.access_token}`);
|
|
2742
|
+
}
|
|
2743
|
+
return U2(
|
|
2744
|
+
e,
|
|
2745
|
+
`ai-sdk/${D2}`,
|
|
2746
|
+
I2()
|
|
2747
|
+
);
|
|
2748
|
+
}
|
|
2749
|
+
async start() {
|
|
2750
|
+
if (this.abortController)
|
|
2751
|
+
throw new y({
|
|
2752
|
+
message: "MCP HTTP Transport Error: Transport already started. Note: client.connect() calls start() automatically."
|
|
2753
|
+
});
|
|
2754
|
+
this.abortController = new AbortController(), this.openInboundSse();
|
|
2755
|
+
}
|
|
2756
|
+
async close() {
|
|
2757
|
+
var r, e, t;
|
|
2758
|
+
(r = this.inboundSseConnection) == null || r.close();
|
|
2759
|
+
try {
|
|
2760
|
+
if (this.sessionId && this.abortController && !this.abortController.signal.aborted) {
|
|
2761
|
+
const s = await this.commonHeaders({});
|
|
2762
|
+
await fetch(this.url, {
|
|
2763
|
+
method: "DELETE",
|
|
2764
|
+
headers: s,
|
|
2765
|
+
signal: this.abortController.signal
|
|
2766
|
+
}).catch(() => {
|
|
2767
|
+
});
|
|
2768
|
+
}
|
|
2769
|
+
} catch {
|
|
2770
|
+
}
|
|
2771
|
+
(e = this.abortController) == null || e.abort(), (t = this.onclose) == null || t.call(this);
|
|
2772
|
+
}
|
|
2773
|
+
async send(r) {
|
|
2774
|
+
const e = async (t = !1) => {
|
|
2775
|
+
var s, i, n, a, l, h, c;
|
|
2776
|
+
try {
|
|
2777
|
+
const g = {
|
|
2778
|
+
method: "POST",
|
|
2779
|
+
headers: await this.commonHeaders({
|
|
2780
|
+
"Content-Type": "application/json",
|
|
2781
|
+
Accept: "application/json, text/event-stream"
|
|
2782
|
+
}),
|
|
2783
|
+
body: JSON.stringify(r),
|
|
2784
|
+
signal: (s = this.abortController) == null ? void 0 : s.signal
|
|
2785
|
+
}, p = await fetch(this.url, g), C = p.headers.get("mcp-session-id");
|
|
2786
|
+
if (C && (this.sessionId = C), p.status === 401 && this.authProvider && !t) {
|
|
2787
|
+
this.resourceMetadataUrl = J(p);
|
|
2788
|
+
try {
|
|
2789
|
+
if (await W(this.authProvider, {
|
|
2790
|
+
serverUrl: this.url,
|
|
2791
|
+
resourceMetadataUrl: this.resourceMetadataUrl
|
|
2792
|
+
}) !== "AUTHORIZED")
|
|
2793
|
+
throw new V();
|
|
2794
|
+
} catch (m) {
|
|
2795
|
+
throw (i = this.onerror) == null || i.call(this, m), m;
|
|
2796
|
+
}
|
|
2797
|
+
return e(!0);
|
|
2798
|
+
}
|
|
2799
|
+
if (p.status === 202) {
|
|
2800
|
+
this.inboundSseConnection || this.openInboundSse();
|
|
2801
|
+
return;
|
|
2802
|
+
}
|
|
2803
|
+
if (!p.ok) {
|
|
2804
|
+
const m = await p.text().catch(() => null);
|
|
2805
|
+
let w = `MCP HTTP Transport Error: POSTing to endpoint (HTTP ${p.status}): ${m}`;
|
|
2806
|
+
p.status === 404 && (w += ". This server does not support HTTP transport. Try using `sse` transport instead");
|
|
2807
|
+
const v = new y({
|
|
2808
|
+
message: w
|
|
2809
|
+
});
|
|
2810
|
+
throw (n = this.onerror) == null || n.call(this, v), v;
|
|
2811
|
+
}
|
|
2812
|
+
const f = p.headers.get("content-type") || "";
|
|
2813
|
+
if (f.includes("application/json")) {
|
|
2814
|
+
const m = await p.json(), w = Array.isArray(m) ? m.map((v) => q.parse(v)) : [q.parse(m)];
|
|
2815
|
+
for (const v of w) (a = this.onmessage) == null || a.call(this, v);
|
|
2816
|
+
return;
|
|
2817
|
+
}
|
|
2818
|
+
if (f.includes("text/event-stream")) {
|
|
2819
|
+
if (!p.body) {
|
|
2820
|
+
const _ = new y({
|
|
2821
|
+
message: "MCP HTTP Transport Error: text/event-stream response without body"
|
|
2822
|
+
});
|
|
2823
|
+
throw (l = this.onerror) == null || l.call(this, _), _;
|
|
2824
|
+
}
|
|
2825
|
+
const w = p.body.pipeThrough(new TextDecoderStream()).pipeThrough(new o2()).getReader();
|
|
2826
|
+
(async () => {
|
|
2827
|
+
var _, S, L;
|
|
2828
|
+
try {
|
|
2829
|
+
for (; ; ) {
|
|
2830
|
+
const { done: b, value: E } = await w.read();
|
|
2831
|
+
if (b) return;
|
|
2832
|
+
const { event: U, data: R } = E;
|
|
2833
|
+
if (U === "message")
|
|
2834
|
+
try {
|
|
2835
|
+
const P = q.parse(JSON.parse(R));
|
|
2836
|
+
(_ = this.onmessage) == null || _.call(this, P);
|
|
2837
|
+
} catch (P) {
|
|
2838
|
+
const Q = new y({
|
|
2839
|
+
message: "MCP HTTP Transport Error: Failed to parse message",
|
|
2840
|
+
cause: P
|
|
2841
|
+
});
|
|
2842
|
+
(S = this.onerror) == null || S.call(this, Q);
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
} catch (b) {
|
|
2846
|
+
if (b instanceof Error && b.name === "AbortError")
|
|
2847
|
+
return;
|
|
2848
|
+
(L = this.onerror) == null || L.call(this, b);
|
|
2849
|
+
}
|
|
2850
|
+
})();
|
|
2851
|
+
return;
|
|
2852
|
+
}
|
|
2853
|
+
const u = new y({
|
|
2854
|
+
message: `MCP HTTP Transport Error: Unexpected content type: ${f}`
|
|
2855
|
+
});
|
|
2856
|
+
throw (h = this.onerror) == null || h.call(this, u), u;
|
|
2857
|
+
} catch (d) {
|
|
2858
|
+
throw (c = this.onerror) == null || c.call(this, d), d;
|
|
2859
|
+
}
|
|
2860
|
+
};
|
|
2861
|
+
await e();
|
|
2862
|
+
}
|
|
2863
|
+
getNextReconnectionDelay(r) {
|
|
2864
|
+
const {
|
|
2865
|
+
initialReconnectionDelay: e,
|
|
2866
|
+
reconnectionDelayGrowFactor: t,
|
|
2867
|
+
maxReconnectionDelay: s
|
|
2868
|
+
} = this.reconnectionOptions;
|
|
2869
|
+
return Math.min(
|
|
2870
|
+
e * Math.pow(t, r),
|
|
2871
|
+
s
|
|
2872
|
+
);
|
|
2873
|
+
}
|
|
2874
|
+
scheduleInboundSseReconnection() {
|
|
2875
|
+
var r;
|
|
2876
|
+
const { maxRetries: e } = this.reconnectionOptions;
|
|
2877
|
+
if (e > 0 && this.inboundReconnectAttempts >= e) {
|
|
2878
|
+
(r = this.onerror) == null || r.call(
|
|
2879
|
+
this,
|
|
2880
|
+
new y({
|
|
2881
|
+
message: `MCP HTTP Transport Error: Maximum reconnection attempts (${e}) exceeded.`
|
|
2882
|
+
})
|
|
2883
|
+
);
|
|
2884
|
+
return;
|
|
2885
|
+
}
|
|
2886
|
+
const t = this.getNextReconnectionDelay(this.inboundReconnectAttempts);
|
|
2887
|
+
this.inboundReconnectAttempts += 1, setTimeout(async () => {
|
|
2888
|
+
var s;
|
|
2889
|
+
(s = this.abortController) != null && s.signal.aborted || await this.openInboundSse(!1, this.lastInboundEventId);
|
|
2890
|
+
}, t);
|
|
2891
|
+
}
|
|
2892
|
+
// Open optional inbound SSE stream; best-effort and resumable
|
|
2893
|
+
async openInboundSse(r = !1, e) {
|
|
2894
|
+
var t, s, i, n, a, l;
|
|
2895
|
+
try {
|
|
2896
|
+
const h = await this.commonHeaders({
|
|
2897
|
+
Accept: "text/event-stream"
|
|
2898
|
+
});
|
|
2899
|
+
e && (h["last-event-id"] = e);
|
|
2900
|
+
const c = await fetch(this.url.href, {
|
|
2901
|
+
method: "GET",
|
|
2902
|
+
headers: h,
|
|
2903
|
+
signal: (t = this.abortController) == null ? void 0 : t.signal
|
|
2904
|
+
}), d = c.headers.get("mcp-session-id");
|
|
2905
|
+
if (d && (this.sessionId = d), c.status === 401 && this.authProvider && !r) {
|
|
2906
|
+
this.resourceMetadataUrl = J(c);
|
|
2907
|
+
try {
|
|
2908
|
+
if (await W(this.authProvider, {
|
|
2909
|
+
serverUrl: this.url,
|
|
2910
|
+
resourceMetadataUrl: this.resourceMetadataUrl
|
|
2911
|
+
}) !== "AUTHORIZED") {
|
|
2912
|
+
const u = new V();
|
|
2913
|
+
(s = this.onerror) == null || s.call(this, u);
|
|
2914
|
+
return;
|
|
2915
|
+
}
|
|
2916
|
+
} catch (f) {
|
|
2917
|
+
(i = this.onerror) == null || i.call(this, f);
|
|
2918
|
+
return;
|
|
2919
|
+
}
|
|
2920
|
+
return this.openInboundSse(!0, e);
|
|
2921
|
+
}
|
|
2922
|
+
if (c.status === 405)
|
|
2923
|
+
return;
|
|
2924
|
+
if (!c.ok || !c.body) {
|
|
2925
|
+
const f = new y({
|
|
2926
|
+
message: `MCP HTTP Transport Error: GET SSE failed: ${c.status} ${c.statusText}`
|
|
2927
|
+
});
|
|
2928
|
+
(n = this.onerror) == null || n.call(this, f);
|
|
2929
|
+
return;
|
|
2930
|
+
}
|
|
2931
|
+
const p = c.body.pipeThrough(new TextDecoderStream()).pipeThrough(new o2()).getReader(), C = async () => {
|
|
2932
|
+
var f, u, m, w;
|
|
2933
|
+
try {
|
|
2934
|
+
for (; ; ) {
|
|
2935
|
+
const { done: v, value: _ } = await p.read();
|
|
2936
|
+
if (v) return;
|
|
2937
|
+
const { event: S, data: L, id: b } = _;
|
|
2938
|
+
if (b && (this.lastInboundEventId = b), S === "message")
|
|
2939
|
+
try {
|
|
2940
|
+
const E = q.parse(JSON.parse(L));
|
|
2941
|
+
(f = this.onmessage) == null || f.call(this, E);
|
|
2942
|
+
} catch (E) {
|
|
2943
|
+
const U = new y({
|
|
2944
|
+
message: "MCP HTTP Transport Error: Failed to parse message",
|
|
2945
|
+
cause: E
|
|
2946
|
+
});
|
|
2947
|
+
(u = this.onerror) == null || u.call(this, U);
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
} catch (v) {
|
|
2951
|
+
if (v instanceof Error && v.name === "AbortError")
|
|
2952
|
+
return;
|
|
2953
|
+
(m = this.onerror) == null || m.call(this, v), (w = this.abortController) != null && w.signal.aborted || this.scheduleInboundSseReconnection();
|
|
2954
|
+
}
|
|
2955
|
+
};
|
|
2956
|
+
this.inboundSseConnection = {
|
|
2957
|
+
close: () => p.cancel()
|
|
2958
|
+
}, this.inboundReconnectAttempts = 0, C();
|
|
2959
|
+
} catch (h) {
|
|
2960
|
+
if (h instanceof Error && h.name === "AbortError")
|
|
2961
|
+
return;
|
|
2962
|
+
(a = this.onerror) == null || a.call(this, h), (l = this.abortController) != null && l.signal.aborted || this.scheduleInboundSseReconnection();
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
};
|
|
2966
|
+
function Gt(r) {
|
|
2967
|
+
switch (r.type) {
|
|
2968
|
+
case "sse":
|
|
2969
|
+
return new Jt(r);
|
|
2970
|
+
case "http":
|
|
2971
|
+
return new Wt(r);
|
|
2972
|
+
default:
|
|
2973
|
+
throw new y({
|
|
2974
|
+
message: "Unsupported or invalid transport configuration. If you are using a custom transport, make sure it implements the MCPTransport interface."
|
|
2975
|
+
});
|
|
2976
|
+
}
|
|
2977
|
+
}
|
|
2978
|
+
function Yt(r) {
|
|
2979
|
+
return "start" in r && typeof r.start == "function" && "send" in r && typeof r.send == "function" && "close" in r && typeof r.close == "function";
|
|
2980
|
+
}
|
|
2981
|
+
var Kt = "1.0.0";
|
|
2982
|
+
async function Qt(r) {
|
|
2983
|
+
const e = new Xt(r);
|
|
2984
|
+
return await e.init(), e;
|
|
2985
|
+
}
|
|
2986
|
+
var Xt = class {
|
|
2987
|
+
constructor({
|
|
2988
|
+
transport: r,
|
|
2989
|
+
name: e = "ai-sdk-mcp-client",
|
|
2990
|
+
version: t = Kt,
|
|
2991
|
+
onUncaughtError: s,
|
|
2992
|
+
capabilities: i
|
|
2993
|
+
}) {
|
|
2994
|
+
this.requestMessageId = 0, this.responseHandlers = /* @__PURE__ */ new Map(), this.serverCapabilities = {}, this.isClosed = !0, this.onUncaughtError = s, this.clientCapabilities = i ?? {}, Yt(r) ? this.transport = r : this.transport = Gt(r), this.transport.onclose = () => this.onClose(), this.transport.onerror = (n) => this.onError(n), this.transport.onmessage = (n) => {
|
|
2995
|
+
if ("method" in n) {
|
|
2996
|
+
"id" in n ? this.onRequestMessage(n) : this.onError(
|
|
2997
|
+
new y({
|
|
2998
|
+
message: "Unsupported message type"
|
|
2999
|
+
})
|
|
3000
|
+
);
|
|
3001
|
+
return;
|
|
3002
|
+
}
|
|
3003
|
+
this.onResponse(n);
|
|
3004
|
+
}, this.clientInfo = {
|
|
3005
|
+
name: e,
|
|
3006
|
+
version: t
|
|
3007
|
+
};
|
|
3008
|
+
}
|
|
3009
|
+
async init() {
|
|
3010
|
+
try {
|
|
3011
|
+
await this.transport.start(), this.isClosed = !1;
|
|
3012
|
+
const r = await this.request({
|
|
3013
|
+
request: {
|
|
3014
|
+
method: "initialize",
|
|
3015
|
+
params: {
|
|
3016
|
+
protocolVersion: $,
|
|
3017
|
+
capabilities: this.clientCapabilities,
|
|
3018
|
+
clientInfo: this.clientInfo
|
|
3019
|
+
}
|
|
3020
|
+
},
|
|
3021
|
+
resultSchema: tt
|
|
3022
|
+
});
|
|
3023
|
+
if (r === void 0)
|
|
3024
|
+
throw new y({
|
|
3025
|
+
message: "Server sent invalid initialize result"
|
|
3026
|
+
});
|
|
3027
|
+
if (!Qe.includes(r.protocolVersion))
|
|
3028
|
+
throw new y({
|
|
3029
|
+
message: `Server's protocol version is not supported: ${r.protocolVersion}`
|
|
3030
|
+
});
|
|
3031
|
+
return this.serverCapabilities = r.capabilities, await this.notification({
|
|
3032
|
+
method: "notifications/initialized"
|
|
3033
|
+
}), this;
|
|
3034
|
+
} catch (r) {
|
|
3035
|
+
throw await this.close(), r;
|
|
3036
|
+
}
|
|
3037
|
+
}
|
|
3038
|
+
async close() {
|
|
3039
|
+
var r;
|
|
3040
|
+
this.isClosed || (await ((r = this.transport) == null ? void 0 : r.close()), this.onClose());
|
|
3041
|
+
}
|
|
3042
|
+
assertCapability(r) {
|
|
3043
|
+
switch (r) {
|
|
3044
|
+
case "initialize":
|
|
3045
|
+
break;
|
|
3046
|
+
case "tools/list":
|
|
3047
|
+
case "tools/call":
|
|
3048
|
+
if (!this.serverCapabilities.tools)
|
|
3049
|
+
throw new y({
|
|
3050
|
+
message: "Server does not support tools"
|
|
3051
|
+
});
|
|
3052
|
+
break;
|
|
3053
|
+
case "resources/list":
|
|
3054
|
+
case "resources/read":
|
|
3055
|
+
case "resources/templates/list":
|
|
3056
|
+
if (!this.serverCapabilities.resources)
|
|
3057
|
+
throw new y({
|
|
3058
|
+
message: "Server does not support resources"
|
|
3059
|
+
});
|
|
3060
|
+
break;
|
|
3061
|
+
case "prompts/list":
|
|
3062
|
+
case "prompts/get":
|
|
3063
|
+
if (!this.serverCapabilities.prompts)
|
|
3064
|
+
throw new y({
|
|
3065
|
+
message: "Server does not support prompts"
|
|
3066
|
+
});
|
|
3067
|
+
break;
|
|
3068
|
+
default:
|
|
3069
|
+
throw new y({
|
|
3070
|
+
message: `Unsupported method: ${r}`
|
|
3071
|
+
});
|
|
3072
|
+
}
|
|
3073
|
+
}
|
|
3074
|
+
async request({
|
|
3075
|
+
request: r,
|
|
3076
|
+
resultSchema: e,
|
|
3077
|
+
options: t
|
|
3078
|
+
}) {
|
|
3079
|
+
return new Promise((s, i) => {
|
|
3080
|
+
if (this.isClosed)
|
|
3081
|
+
return i(
|
|
3082
|
+
new y({
|
|
3083
|
+
message: "Attempted to send a request from a closed client"
|
|
3084
|
+
})
|
|
3085
|
+
);
|
|
3086
|
+
this.assertCapability(r.method);
|
|
3087
|
+
const n = t?.signal;
|
|
3088
|
+
n?.throwIfAborted();
|
|
3089
|
+
const a = this.requestMessageId++, l = {
|
|
3090
|
+
...r,
|
|
3091
|
+
jsonrpc: "2.0",
|
|
3092
|
+
id: a
|
|
3093
|
+
}, h = () => {
|
|
3094
|
+
this.responseHandlers.delete(a);
|
|
3095
|
+
};
|
|
3096
|
+
this.responseHandlers.set(a, (c) => {
|
|
3097
|
+
if (n?.aborted)
|
|
3098
|
+
return i(
|
|
3099
|
+
new y({
|
|
3100
|
+
message: "Request was aborted",
|
|
3101
|
+
cause: n.reason
|
|
3102
|
+
})
|
|
3103
|
+
);
|
|
3104
|
+
if (c instanceof Error)
|
|
3105
|
+
return i(c);
|
|
3106
|
+
try {
|
|
3107
|
+
const d = e.parse(c.result);
|
|
3108
|
+
s(d);
|
|
3109
|
+
} catch (d) {
|
|
3110
|
+
const g = new y({
|
|
3111
|
+
message: "Failed to parse server response",
|
|
3112
|
+
cause: d
|
|
3113
|
+
});
|
|
3114
|
+
i(g);
|
|
3115
|
+
}
|
|
3116
|
+
}), this.transport.send(l).catch((c) => {
|
|
3117
|
+
h(), i(c);
|
|
3118
|
+
});
|
|
3119
|
+
});
|
|
3120
|
+
}
|
|
3121
|
+
async listTools({
|
|
3122
|
+
params: r,
|
|
3123
|
+
options: e
|
|
3124
|
+
} = {}) {
|
|
3125
|
+
try {
|
|
3126
|
+
return this.request({
|
|
3127
|
+
request: { method: "tools/list", params: r },
|
|
3128
|
+
resultSchema: st,
|
|
3129
|
+
options: e
|
|
3130
|
+
});
|
|
3131
|
+
} catch (t) {
|
|
3132
|
+
throw t;
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
async callTool({
|
|
3136
|
+
name: r,
|
|
3137
|
+
args: e,
|
|
3138
|
+
options: t
|
|
3139
|
+
}) {
|
|
3140
|
+
try {
|
|
3141
|
+
return this.request({
|
|
3142
|
+
request: { method: "tools/call", params: { name: r, arguments: e } },
|
|
3143
|
+
resultSchema: nt,
|
|
3144
|
+
options: {
|
|
3145
|
+
signal: t?.abortSignal
|
|
3146
|
+
}
|
|
3147
|
+
});
|
|
3148
|
+
} catch (s) {
|
|
3149
|
+
throw s;
|
|
3150
|
+
}
|
|
3151
|
+
}
|
|
3152
|
+
async listResourcesInternal({
|
|
3153
|
+
params: r,
|
|
3154
|
+
options: e
|
|
3155
|
+
} = {}) {
|
|
3156
|
+
try {
|
|
3157
|
+
return this.request({
|
|
3158
|
+
request: { method: "resources/list", params: r },
|
|
3159
|
+
resultSchema: it,
|
|
3160
|
+
options: e
|
|
3161
|
+
});
|
|
3162
|
+
} catch (t) {
|
|
3163
|
+
throw t;
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
async readResourceInternal({
|
|
3167
|
+
uri: r,
|
|
3168
|
+
options: e
|
|
3169
|
+
}) {
|
|
3170
|
+
try {
|
|
3171
|
+
return this.request({
|
|
3172
|
+
request: { method: "resources/read", params: { uri: r } },
|
|
3173
|
+
resultSchema: lt,
|
|
3174
|
+
options: e
|
|
3175
|
+
});
|
|
3176
|
+
} catch (t) {
|
|
3177
|
+
throw t;
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
async listResourceTemplatesInternal({
|
|
3181
|
+
options: r
|
|
3182
|
+
} = {}) {
|
|
3183
|
+
try {
|
|
3184
|
+
return this.request({
|
|
3185
|
+
request: { method: "resources/templates/list" },
|
|
3186
|
+
resultSchema: ct,
|
|
3187
|
+
options: r
|
|
3188
|
+
});
|
|
3189
|
+
} catch (e) {
|
|
3190
|
+
throw e;
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
async listPromptsInternal({
|
|
3194
|
+
params: r,
|
|
3195
|
+
options: e
|
|
3196
|
+
} = {}) {
|
|
3197
|
+
try {
|
|
3198
|
+
return this.request({
|
|
3199
|
+
request: { method: "prompts/list", params: r },
|
|
3200
|
+
resultSchema: pt,
|
|
3201
|
+
options: e
|
|
3202
|
+
});
|
|
3203
|
+
} catch (t) {
|
|
3204
|
+
throw t;
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
async getPromptInternal({
|
|
3208
|
+
name: r,
|
|
3209
|
+
args: e,
|
|
3210
|
+
options: t
|
|
3211
|
+
}) {
|
|
3212
|
+
try {
|
|
3213
|
+
return this.request({
|
|
3214
|
+
request: { method: "prompts/get", params: { name: r, arguments: e } },
|
|
3215
|
+
resultSchema: mt,
|
|
3216
|
+
options: t
|
|
3217
|
+
});
|
|
3218
|
+
} catch (s) {
|
|
3219
|
+
throw s;
|
|
3220
|
+
}
|
|
3221
|
+
}
|
|
3222
|
+
async notification(r) {
|
|
3223
|
+
const e = {
|
|
3224
|
+
...r,
|
|
3225
|
+
jsonrpc: "2.0"
|
|
3226
|
+
};
|
|
3227
|
+
await this.transport.send(e);
|
|
3228
|
+
}
|
|
3229
|
+
/**
|
|
3230
|
+
* Returns a set of AI SDK tools from the MCP server
|
|
3231
|
+
* @returns A record of tool names to their implementations
|
|
3232
|
+
*/
|
|
3233
|
+
async tools({
|
|
3234
|
+
schemas: r = "automatic"
|
|
3235
|
+
} = {}) {
|
|
3236
|
+
var e;
|
|
3237
|
+
const t = {};
|
|
3238
|
+
try {
|
|
3239
|
+
const s = await this.listTools();
|
|
3240
|
+
for (const { name: i, description: n, inputSchema: a } of s.tools) {
|
|
3241
|
+
if (r !== "automatic" && !(i in r))
|
|
3242
|
+
continue;
|
|
3243
|
+
const l = this, h = async (d, g) => {
|
|
3244
|
+
var p;
|
|
3245
|
+
return (p = g?.abortSignal) == null || p.throwIfAborted(), l.callTool({ name: i, args: d, options: g });
|
|
3246
|
+
}, c = r === "automatic" ? Ze({
|
|
3247
|
+
description: n,
|
|
3248
|
+
inputSchema: Fe({
|
|
3249
|
+
...a,
|
|
3250
|
+
properties: (e = a.properties) != null ? e : {},
|
|
3251
|
+
additionalProperties: !1
|
|
3252
|
+
}),
|
|
3253
|
+
execute: h
|
|
3254
|
+
}) : {
|
|
3255
|
+
description: n,
|
|
3256
|
+
inputSchema: r[i].inputSchema,
|
|
3257
|
+
execute: h
|
|
3258
|
+
};
|
|
3259
|
+
t[i] = c;
|
|
3260
|
+
}
|
|
3261
|
+
return t;
|
|
3262
|
+
} catch (s) {
|
|
3263
|
+
throw s;
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
3266
|
+
listResources({
|
|
3267
|
+
params: r,
|
|
3268
|
+
options: e
|
|
3269
|
+
} = {}) {
|
|
3270
|
+
return this.listResourcesInternal({ params: r, options: e });
|
|
3271
|
+
}
|
|
3272
|
+
readResource({
|
|
3273
|
+
uri: r,
|
|
3274
|
+
options: e
|
|
3275
|
+
}) {
|
|
3276
|
+
return this.readResourceInternal({ uri: r, options: e });
|
|
3277
|
+
}
|
|
3278
|
+
listResourceTemplates({
|
|
3279
|
+
options: r
|
|
3280
|
+
} = {}) {
|
|
3281
|
+
return this.listResourceTemplatesInternal({ options: r });
|
|
3282
|
+
}
|
|
3283
|
+
listPrompts({
|
|
3284
|
+
params: r,
|
|
3285
|
+
options: e
|
|
3286
|
+
} = {}) {
|
|
3287
|
+
return this.listPromptsInternal({ params: r, options: e });
|
|
3288
|
+
}
|
|
3289
|
+
getPrompt({
|
|
3290
|
+
name: r,
|
|
3291
|
+
arguments: e,
|
|
3292
|
+
options: t
|
|
3293
|
+
}) {
|
|
3294
|
+
return this.getPromptInternal({ name: r, args: e, options: t });
|
|
3295
|
+
}
|
|
3296
|
+
onElicitationRequest(r, e) {
|
|
3297
|
+
if (r !== L2)
|
|
3298
|
+
throw new y({
|
|
3299
|
+
message: "Unsupported request schema. Only ElicitationRequestSchema is supported."
|
|
3300
|
+
});
|
|
3301
|
+
this.elicitationRequestHandler = e;
|
|
3302
|
+
}
|
|
3303
|
+
async onRequestMessage(r) {
|
|
3304
|
+
try {
|
|
3305
|
+
if (r.method !== "elicitation/create") {
|
|
3306
|
+
await this.transport.send({
|
|
3307
|
+
jsonrpc: "2.0",
|
|
3308
|
+
id: r.id,
|
|
3309
|
+
error: {
|
|
3310
|
+
code: -32601,
|
|
3311
|
+
message: `Unsupported request method: ${r.method}`
|
|
3312
|
+
}
|
|
3313
|
+
});
|
|
3314
|
+
return;
|
|
3315
|
+
}
|
|
3316
|
+
if (!this.elicitationRequestHandler) {
|
|
3317
|
+
await this.transport.send({
|
|
3318
|
+
jsonrpc: "2.0",
|
|
3319
|
+
id: r.id,
|
|
3320
|
+
error: {
|
|
3321
|
+
code: -32601,
|
|
3322
|
+
message: "No elicitation handler registered on client"
|
|
3323
|
+
}
|
|
3324
|
+
});
|
|
3325
|
+
return;
|
|
3326
|
+
}
|
|
3327
|
+
const e = L2.safeParse({
|
|
3328
|
+
method: r.method,
|
|
3329
|
+
params: r.params
|
|
3330
|
+
});
|
|
3331
|
+
if (!e.success) {
|
|
3332
|
+
await this.transport.send({
|
|
3333
|
+
jsonrpc: "2.0",
|
|
3334
|
+
id: r.id,
|
|
3335
|
+
error: {
|
|
3336
|
+
code: -32602,
|
|
3337
|
+
message: `Invalid elicitation request: ${e.error.message}`,
|
|
3338
|
+
data: e.error.issues
|
|
3339
|
+
}
|
|
3340
|
+
});
|
|
3341
|
+
return;
|
|
3342
|
+
}
|
|
3343
|
+
try {
|
|
3344
|
+
const t = await this.elicitationRequestHandler(e.data), s = ft.parse(t);
|
|
3345
|
+
await this.transport.send({
|
|
3346
|
+
jsonrpc: "2.0",
|
|
3347
|
+
id: r.id,
|
|
3348
|
+
result: s
|
|
3349
|
+
});
|
|
3350
|
+
} catch (t) {
|
|
3351
|
+
await this.transport.send({
|
|
3352
|
+
jsonrpc: "2.0",
|
|
3353
|
+
id: r.id,
|
|
3354
|
+
error: {
|
|
3355
|
+
code: -32603,
|
|
3356
|
+
message: t instanceof Error ? t.message : "Failed to handle elicitation request"
|
|
3357
|
+
}
|
|
3358
|
+
}), this.onError(t);
|
|
3359
|
+
}
|
|
3360
|
+
} catch (e) {
|
|
3361
|
+
this.onError(e);
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
onClose() {
|
|
3365
|
+
if (this.isClosed) return;
|
|
3366
|
+
this.isClosed = !0;
|
|
3367
|
+
const r = new y({
|
|
3368
|
+
message: "Connection closed"
|
|
3369
|
+
});
|
|
3370
|
+
for (const e of this.responseHandlers.values())
|
|
3371
|
+
e(r);
|
|
3372
|
+
this.responseHandlers.clear();
|
|
3373
|
+
}
|
|
3374
|
+
onError(r) {
|
|
3375
|
+
this.onUncaughtError && this.onUncaughtError(r);
|
|
3376
|
+
}
|
|
3377
|
+
onResponse(r) {
|
|
3378
|
+
const e = Number(r.id), t = this.responseHandlers.get(e);
|
|
3379
|
+
if (t === void 0)
|
|
3380
|
+
throw new y({
|
|
3381
|
+
message: `Protocol error: Received a response for an unknown message ID: ${JSON.stringify(
|
|
3382
|
+
r
|
|
3383
|
+
)}`
|
|
3384
|
+
});
|
|
3385
|
+
this.responseHandlers.delete(e), t(
|
|
3386
|
+
"result" in r ? r : new y({
|
|
3387
|
+
message: r.error.message,
|
|
3388
|
+
code: r.error.code,
|
|
3389
|
+
data: r.error.data,
|
|
3390
|
+
cause: r.error
|
|
3391
|
+
})
|
|
3392
|
+
);
|
|
3393
|
+
}
|
|
3394
|
+
};
|
|
3395
|
+
const e0 = async (r) => {
|
|
1575
3396
|
const e = {};
|
|
1576
3397
|
try {
|
|
1577
3398
|
const t = await r.listTools();
|
|
1578
|
-
for (const { name:
|
|
1579
|
-
const
|
|
1580
|
-
e[
|
|
1581
|
-
description:
|
|
1582
|
-
inputSchema:
|
|
1583
|
-
...
|
|
1584
|
-
properties:
|
|
3399
|
+
for (const { name: s, description: i, inputSchema: n } of t.tools) {
|
|
3400
|
+
const a = async (l, h) => r.callTool({ name: s, arguments: l }, { signal: h?.abortSignal });
|
|
3401
|
+
e[s] = we({
|
|
3402
|
+
description: i,
|
|
3403
|
+
inputSchema: ye({
|
|
3404
|
+
...n,
|
|
3405
|
+
properties: n.properties ?? {},
|
|
1585
3406
|
additionalProperties: !1
|
|
1586
3407
|
}),
|
|
1587
|
-
execute:
|
|
3408
|
+
execute: a
|
|
1588
3409
|
});
|
|
1589
3410
|
}
|
|
1590
3411
|
return e;
|
|
1591
3412
|
} catch (t) {
|
|
1592
3413
|
throw t;
|
|
1593
3414
|
}
|
|
1594
|
-
}, x2 = {
|
|
1595
|
-
openai: n2,
|
|
1596
|
-
deepseek: a2
|
|
1597
3415
|
};
|
|
1598
|
-
|
|
3416
|
+
function t0(r) {
|
|
3417
|
+
const e = Object.entries(r);
|
|
3418
|
+
if (e.length === 0)
|
|
3419
|
+
return "";
|
|
3420
|
+
let t = `
|
|
3421
|
+
|
|
3422
|
+
# 工具调用
|
|
3423
|
+
|
|
3424
|
+
`;
|
|
3425
|
+
return t += `你可以根据需要调用以下工具:
|
|
3426
|
+
|
|
3427
|
+
`, t += `<tools>
|
|
3428
|
+
`, e.forEach(([s, i]) => {
|
|
3429
|
+
const n = i, a = n.description || "无描述", l = n.parameters || n.inputSchema || {};
|
|
3430
|
+
t += `${JSON.stringify({
|
|
3431
|
+
name: s,
|
|
3432
|
+
description: a,
|
|
3433
|
+
parameters: l
|
|
3434
|
+
}, null, 2)}
|
|
3435
|
+
`;
|
|
3436
|
+
}), t += `</tools>
|
|
3437
|
+
|
|
3438
|
+
`, t += `## 工具调用格式
|
|
3439
|
+
|
|
3440
|
+
`, t += `要调用工具,请使用以下 XML 格式:
|
|
3441
|
+
`, t += `Thought: [你的思考过程]
|
|
3442
|
+
`, t += `<tool_call>{"name": "toolName", "arguments": {"arg1": "value1"}}</tool_call>
|
|
3443
|
+
|
|
3444
|
+
`, t += `工具执行后,你将收到 <tool_response> 格式的结果。你可以继续思考或调用其他工具。
|
|
3445
|
+
|
|
3446
|
+
`, t += `## 使用示例
|
|
3447
|
+
|
|
3448
|
+
`, t += `如果用户要求"获取今天的日期",你可以这样调用工具:
|
|
3449
|
+
`, t += `Thought: 用户想要获取今天的日期,我需要调用日期相关的工具。
|
|
3450
|
+
`, t += `<tool_call>{"name": "get-today", "arguments": {}}</tool_call>
|
|
3451
|
+
|
|
3452
|
+
`, t += `然后等待工具返回结果(Observation),再根据结果给出最终答案。
|
|
3453
|
+
|
|
3454
|
+
`, t += `## 任务完成
|
|
3455
|
+
|
|
3456
|
+
`, t += `当任务完成或无法继续时,直接给出最终答案即可。
|
|
3457
|
+
|
|
3458
|
+
`, t += `**重要提示**:
|
|
3459
|
+
`, t += `- 必须严格按照 XML 格式调用工具
|
|
3460
|
+
`, t += `- arguments 必须是有效的 JSON 格式
|
|
3461
|
+
`, t += `- 如果不需要调用工具,直接给出最终答案即可
|
|
3462
|
+
`, t;
|
|
3463
|
+
}
|
|
3464
|
+
function M2(r, e) {
|
|
3465
|
+
if (!r || typeof r != "string")
|
|
3466
|
+
return null;
|
|
3467
|
+
const t = r.match(/<tool_call>([\s\S]*?)<\/tool_call>/i);
|
|
3468
|
+
if (t)
|
|
3469
|
+
try {
|
|
3470
|
+
const s = t[1].trim(), i = JSON.parse(s), n = i.name || i.action || i.tool, a = i.arguments || i.args || i.input || {};
|
|
3471
|
+
if (n && e[n])
|
|
3472
|
+
return { toolName: n, arguments: a };
|
|
3473
|
+
} catch {
|
|
3474
|
+
}
|
|
3475
|
+
return null;
|
|
3476
|
+
}
|
|
3477
|
+
const r0 = {
|
|
3478
|
+
openai: be,
|
|
3479
|
+
deepseek: xe
|
|
3480
|
+
};
|
|
3481
|
+
class I0 {
|
|
1599
3482
|
constructor({ llmConfig: e, mcpServers: t }) {
|
|
1600
|
-
if (this.mcpServers = {}, this.mcpClients = {}, this.mcpTools = {}, this.ignoreToolnames = [], this.messages = [], !e)
|
|
3483
|
+
if (this.mcpServers = {}, this.mcpClients = {}, this.mcpTools = {}, this.ignoreToolnames = [], this.messages = [], this.useReActMode = !1, !e)
|
|
1601
3484
|
throw new Error("llmConfig is required to initialize AgentModelProvider");
|
|
1602
3485
|
if (this.mcpServers = t || {}, this.mcpClients = {}, this.mcpTools = {}, e.llm)
|
|
1603
3486
|
this.llm = e.llm;
|
|
1604
3487
|
else if (e.providerType) {
|
|
1605
|
-
const
|
|
1606
|
-
let
|
|
1607
|
-
typeof
|
|
3488
|
+
const s = e.providerType;
|
|
3489
|
+
let i;
|
|
3490
|
+
typeof s == "string" ? i = r0[s] : i = s, this.llm = i({
|
|
1608
3491
|
apiKey: e.apiKey,
|
|
1609
3492
|
baseURL: e.baseURL
|
|
1610
3493
|
});
|
|
1611
3494
|
} else
|
|
1612
3495
|
throw new Error("Either llmConfig.llm or llmConfig.providerType must be provided");
|
|
3496
|
+
this.useReActMode = e.useReActMode ?? !1;
|
|
1613
3497
|
}
|
|
1614
3498
|
/** 创建一个 ai-sdk的 mcpClient, 创建失败则返回 null */
|
|
1615
3499
|
async _createOneClient(e) {
|
|
1616
3500
|
try {
|
|
1617
3501
|
let t;
|
|
1618
|
-
if ("type" in e && e.type.toLocaleLowerCase() === "streamablehttp" ? t = new
|
|
1619
|
-
const
|
|
1620
|
-
return
|
|
3502
|
+
if ("type" in e && e.type.toLocaleLowerCase() === "streamablehttp" ? t = new G(new URL(e.url)) : "type" in e && e.type === "extension" ? t = new Re(e.sessionId) : t = e, e.useAISdkClient ?? !1) {
|
|
3503
|
+
const i = await Qt({ transport: t });
|
|
3504
|
+
return i.__transport__ = t, i;
|
|
1621
3505
|
} else {
|
|
1622
|
-
const
|
|
3506
|
+
const i = new Le(
|
|
1623
3507
|
{ name: "mcp-web-client", version: "1.0.0" },
|
|
1624
3508
|
{ capabilities: { roots: { listChanged: !0 }, sampling: {}, elicitation: {} } }
|
|
1625
3509
|
);
|
|
1626
|
-
return await
|
|
3510
|
+
return await i.connect(t), i.__transport__ = t, i;
|
|
1627
3511
|
}
|
|
1628
3512
|
} catch (t) {
|
|
1629
|
-
return this.onError && this.onError(
|
|
3513
|
+
return this.onError && this.onError(t?.message || "Failed to create MCP client", t), console.error("Failed to create MCP client", e, t), null;
|
|
1630
3514
|
}
|
|
1631
3515
|
}
|
|
1632
3516
|
/** 关闭一个 mcpClient */
|
|
1633
3517
|
async _closeOneClient(e) {
|
|
1634
|
-
var t, i, s;
|
|
1635
3518
|
try {
|
|
1636
|
-
const
|
|
1637
|
-
if (
|
|
3519
|
+
const t = e.__transport__;
|
|
3520
|
+
if (t && t instanceof se || t && t instanceof re)
|
|
1638
3521
|
return;
|
|
1639
|
-
await
|
|
3522
|
+
await t?.terminateSession?.(), await t?.close?.(), await e?.close?.();
|
|
1640
3523
|
} catch {
|
|
1641
3524
|
}
|
|
1642
3525
|
}
|
|
1643
3526
|
/** 创建所有 mcpClients */
|
|
1644
3527
|
async _createMpcClients() {
|
|
1645
3528
|
const e = Object.entries(this.mcpServers), t = await Promise.all(
|
|
1646
|
-
e.map(async ([
|
|
1647
|
-
const
|
|
1648
|
-
return { serverName:
|
|
3529
|
+
e.map(async ([s, i]) => {
|
|
3530
|
+
const n = await this._createOneClient(i);
|
|
3531
|
+
return { serverName: s, client: n };
|
|
1649
3532
|
})
|
|
1650
3533
|
);
|
|
1651
|
-
this.mcpClients = {}, t.forEach(({ serverName:
|
|
1652
|
-
this.mcpClients[
|
|
3534
|
+
this.mcpClients = {}, t.forEach(({ serverName: s, client: i }) => {
|
|
3535
|
+
this.mcpClients[s] = i;
|
|
1653
3536
|
});
|
|
1654
3537
|
}
|
|
1655
3538
|
/** 兼容两种 client 类型的 tools 获取方法 */
|
|
@@ -1657,22 +3540,22 @@ class K2 {
|
|
|
1657
3540
|
if (!e)
|
|
1658
3541
|
return null;
|
|
1659
3542
|
try {
|
|
1660
|
-
return typeof e.tools == "function" ? await e.tools() : await
|
|
1661
|
-
} catch (
|
|
1662
|
-
return this.onError && this.onError(
|
|
3543
|
+
return typeof e.tools == "function" ? await e.tools() : await e0(e);
|
|
3544
|
+
} catch (s) {
|
|
3545
|
+
return this.onError && this.onError(s?.message || `Failed to query tools for ${t}`, s), console.error(`Failed to query tools for ${t}`, s), null;
|
|
1663
3546
|
}
|
|
1664
3547
|
}
|
|
1665
3548
|
/** 查询所有 mcpClients 的 tools, 失败则保存为null */
|
|
1666
3549
|
async _createMpcTools() {
|
|
1667
3550
|
const e = Object.entries(this.mcpClients), t = await Promise.all(
|
|
1668
|
-
e.map(async ([
|
|
1669
|
-
const
|
|
1670
|
-
return { serverName:
|
|
3551
|
+
e.map(async ([s, i]) => {
|
|
3552
|
+
const n = await this._getClientTools(i, s);
|
|
3553
|
+
return { serverName: s, tools: n };
|
|
1671
3554
|
})
|
|
1672
3555
|
);
|
|
1673
|
-
this.mcpTools = {}, t.forEach(({ serverName:
|
|
1674
|
-
const
|
|
1675
|
-
this.mcpTools[
|
|
3556
|
+
this.mcpTools = {}, t.forEach(({ serverName: s, tools: i }) => {
|
|
3557
|
+
const n = i && typeof i == "object" ? i : {};
|
|
3558
|
+
this.mcpTools[s] = n;
|
|
1676
3559
|
});
|
|
1677
3560
|
}
|
|
1678
3561
|
/** 关闭所有的 clients */
|
|
@@ -1682,15 +3565,14 @@ class K2 {
|
|
|
1682
3565
|
try {
|
|
1683
3566
|
await this._closeOneClient(e);
|
|
1684
3567
|
} catch (t) {
|
|
1685
|
-
this.onError && this.onError(
|
|
3568
|
+
this.onError && this.onError(t?.message || "Failed to close client", t), console.error("Failed to close client", t);
|
|
1686
3569
|
}
|
|
1687
3570
|
})
|
|
1688
3571
|
);
|
|
1689
3572
|
}
|
|
1690
3573
|
/** 创建所有的 mcpClients,并更新它们的tools */
|
|
1691
3574
|
async initClientsAndTools() {
|
|
1692
|
-
|
|
1693
|
-
await this._createMpcClients(), await this._createMpcTools(), (e = this.onUpdatedTools) == null || e.call(this);
|
|
3575
|
+
await this._createMpcClients(), await this._createMpcTools(), this.onUpdatedTools?.();
|
|
1694
3576
|
}
|
|
1695
3577
|
/** 全量更新所有的 mcpServers */
|
|
1696
3578
|
async updateMcpServers(e) {
|
|
@@ -1698,19 +3580,17 @@ class K2 {
|
|
|
1698
3580
|
}
|
|
1699
3581
|
/** 插入一个新的mcpServer,如果已经存在则返回false */
|
|
1700
3582
|
async insertMcpServer(e, t) {
|
|
1701
|
-
var o, n;
|
|
1702
3583
|
if (this.mcpServers[e])
|
|
1703
3584
|
return !1;
|
|
1704
|
-
const
|
|
1705
|
-
if (!
|
|
1706
|
-
return
|
|
1707
|
-
this.mcpClients[e] =
|
|
1708
|
-
const
|
|
1709
|
-
return this.mcpTools[e] =
|
|
3585
|
+
const s = await this._createOneClient(t);
|
|
3586
|
+
if (!s)
|
|
3587
|
+
return this.onError?.(`Failed to create MCP client: ${e}`), null;
|
|
3588
|
+
this.mcpClients[e] = s;
|
|
3589
|
+
const i = await this._getClientTools(s, e);
|
|
3590
|
+
return this.mcpTools[e] = i && typeof i == "object" ? i : {}, this.mcpServers[e] = t, this.onUpdatedTools?.(), s;
|
|
1710
3591
|
}
|
|
1711
3592
|
/** 通过服务器名称删除mcpServer: mcpServers mcpClients mcpTools ignoreToolnames */
|
|
1712
3593
|
async removeMcpServer(e) {
|
|
1713
|
-
var s;
|
|
1714
3594
|
if (!this.mcpServers[e])
|
|
1715
3595
|
return;
|
|
1716
3596
|
delete this.mcpServers[e];
|
|
@@ -1720,70 +3600,281 @@ class K2 {
|
|
|
1720
3600
|
await this._closeOneClient(t);
|
|
1721
3601
|
} catch {
|
|
1722
3602
|
}
|
|
1723
|
-
const
|
|
1724
|
-
delete this.mcpTools[e],
|
|
1725
|
-
this.ignoreToolnames = this.ignoreToolnames.filter((n) => n !==
|
|
1726
|
-
}),
|
|
3603
|
+
const s = this.mcpTools[e];
|
|
3604
|
+
delete this.mcpTools[e], s && Object.keys(s).forEach((i) => {
|
|
3605
|
+
this.ignoreToolnames = this.ignoreToolnames.filter((n) => n !== i);
|
|
3606
|
+
}), this.onUpdatedTools?.();
|
|
1727
3607
|
}
|
|
1728
3608
|
/** 创建临时允许调用的tools集合 */
|
|
1729
3609
|
_tempMergeTools(e = {}) {
|
|
1730
|
-
const t = Object.values(this.mcpTools).reduce((
|
|
1731
|
-
return Object.assign(t, e), this.ignoreToolnames.forEach((
|
|
1732
|
-
delete t[
|
|
3610
|
+
const t = Object.values(this.mcpTools).reduce((s, i) => ({ ...s, ...i }), {});
|
|
3611
|
+
return Object.assign(t, e), this.ignoreToolnames.forEach((s) => {
|
|
3612
|
+
delete t[s];
|
|
1733
3613
|
}), t;
|
|
1734
3614
|
}
|
|
1735
|
-
|
|
1736
|
-
|
|
3615
|
+
/** 生成 ReAct 模式的系统提示词(包含工具描述) */
|
|
3616
|
+
_generateReActSystemPrompt(e, t, s) {
|
|
3617
|
+
const i = t0(e);
|
|
3618
|
+
return s ? `${s}${i}` : `你是一个智能助手,可以通过调用工具来完成任务。
|
|
3619
|
+
${i}`;
|
|
3620
|
+
}
|
|
3621
|
+
/** 执行 ReAct 模式下的工具调用 */
|
|
3622
|
+
async _executeReActToolCall(e, t, s) {
|
|
3623
|
+
const i = s[e];
|
|
3624
|
+
if (!i)
|
|
3625
|
+
return { success: !1, error: `工具 ${e} 不存在` };
|
|
3626
|
+
try {
|
|
3627
|
+
const n = i, a = n.execute || n.call;
|
|
3628
|
+
return typeof a != "function" ? { success: !1, error: `工具 ${e} 没有可执行的函数` } : { success: !0, result: await a(t, {}) };
|
|
3629
|
+
} catch (n) {
|
|
3630
|
+
return { success: !1, error: n?.message || String(n) || "工具执行失败" };
|
|
3631
|
+
}
|
|
3632
|
+
}
|
|
3633
|
+
/** ReAct 模式的对话实现 */
|
|
3634
|
+
async _chatReAct(e, { model: t, maxSteps: s = 5, ...i }) {
|
|
3635
|
+
if (!this.llm)
|
|
3636
|
+
throw new Error("LLM is not initialized");
|
|
3637
|
+
await this.initClientsAndTools();
|
|
3638
|
+
const n = this._tempMergeTools(i.tools);
|
|
3639
|
+
if (Object.keys(n).length === 0)
|
|
3640
|
+
return this._chat(e, { model: t, maxSteps: s, ...i });
|
|
3641
|
+
let l = [];
|
|
3642
|
+
i.message && !i.messages ? l.push({ role: "user", content: i.message }) : i.messages ? l = [...i.messages] : l = [...this.messages];
|
|
3643
|
+
const h = typeof t == "string" ? t : t?.modelId || "default-model", d = { role: "system", content: this._generateReActSystemPrompt(n, h, i.system) }, g = l[0]?.role === "system" ? l : [d, ...l];
|
|
3644
|
+
return e === X ? this._chatReActStream(g, n, h, s, i) : this._chatReActNonStream(g, n, h, s, i);
|
|
3645
|
+
}
|
|
3646
|
+
/**
|
|
3647
|
+
* 检查消息内容是否包含图片
|
|
3648
|
+
* @param content 消息内容
|
|
3649
|
+
* @returns 是否包含图片
|
|
3650
|
+
*/
|
|
3651
|
+
_messageHasImage(e) {
|
|
3652
|
+
return e && Array.isArray(e) ? e.some((t) => t && t.type === "image") : !1;
|
|
3653
|
+
}
|
|
3654
|
+
/**
|
|
3655
|
+
* 从消息中移除图片,但保留文本内容
|
|
3656
|
+
* @param message 原始消息
|
|
3657
|
+
* @returns 移除图片后的消息(如果只有图片没有文本,返回 null)
|
|
3658
|
+
*/
|
|
3659
|
+
_removeImageFromMessage(e) {
|
|
3660
|
+
if (!e || !e.content)
|
|
3661
|
+
return null;
|
|
3662
|
+
if (!Array.isArray(e.content))
|
|
3663
|
+
return e;
|
|
3664
|
+
const t = e.content.filter((s) => s && s.type !== "image");
|
|
3665
|
+
return t.length === 0 ? null : {
|
|
3666
|
+
...e,
|
|
3667
|
+
content: t
|
|
3668
|
+
};
|
|
3669
|
+
}
|
|
3670
|
+
/**
|
|
3671
|
+
* 构建用于模型调用的消息列表(magentic-ui 风格)
|
|
3672
|
+
* 策略:保留所有文本消息,仅限制图片数量(类似 magentic-ui 的 maybe_remove_old_screenshots)
|
|
3673
|
+
*
|
|
3674
|
+
* @param systemMessage 系统提示词
|
|
3675
|
+
* @param allMessages 所有消息历史(包括初始消息和后续对话)
|
|
3676
|
+
* @param maxImages 最多保留的图片数量(默认3张)
|
|
3677
|
+
* @returns 构建好的消息列表
|
|
3678
|
+
*/
|
|
3679
|
+
_buildMessagesForModel(e, t, s = 3) {
|
|
3680
|
+
const i = [];
|
|
3681
|
+
e && i.push(e);
|
|
3682
|
+
let n = 0;
|
|
3683
|
+
const a = [];
|
|
3684
|
+
for (let l = t.length - 1; l >= 0; l--) {
|
|
3685
|
+
const h = t[l];
|
|
3686
|
+
if (this._messageHasImage(h.content))
|
|
3687
|
+
if (n < s)
|
|
3688
|
+
a.unshift(h), n++;
|
|
3689
|
+
else {
|
|
3690
|
+
const d = this._removeImageFromMessage(h);
|
|
3691
|
+
d && a.unshift(d);
|
|
3692
|
+
}
|
|
3693
|
+
else
|
|
3694
|
+
a.unshift(h);
|
|
3695
|
+
}
|
|
3696
|
+
return i.push(...a), i;
|
|
3697
|
+
}
|
|
3698
|
+
/** ReAct 模式非流式对话 */
|
|
3699
|
+
async _chatReActNonStream(e, t, s, i, n) {
|
|
3700
|
+
let a = [...e];
|
|
3701
|
+
const l = e[0]?.role === "system" ? e[0] : null, h = l ? e.slice(1) : e;
|
|
3702
|
+
let c = 0;
|
|
3703
|
+
const d = n.maxImages ?? 3;
|
|
3704
|
+
for (; c < i; ) {
|
|
3705
|
+
c++;
|
|
3706
|
+
const p = this._buildMessagesForModel(l, h, d), { tools: C, ...f } = n, m = (await f2({
|
|
3707
|
+
// @ts-ignore ProviderV2 是所有llm的父类,在每一个具体的llm类都有一个选择model的函数用法
|
|
3708
|
+
model: this.llm(s),
|
|
3709
|
+
messages: p,
|
|
3710
|
+
...f
|
|
3711
|
+
})).text, w = { role: "assistant", content: m };
|
|
3712
|
+
h.push(w), a.push(w);
|
|
3713
|
+
const v = M2(m, t);
|
|
3714
|
+
if (!v)
|
|
3715
|
+
return this.messages = a, {
|
|
3716
|
+
text: m,
|
|
3717
|
+
response: { messages: a }
|
|
3718
|
+
};
|
|
3719
|
+
const _ = await this._executeReActToolCall(v.toolName, v.arguments, t), b = {
|
|
3720
|
+
role: "user",
|
|
3721
|
+
content: `<tool_response>
|
|
3722
|
+
${_.success ? JSON.stringify(_.result) : `工具执行失败 - ${_.error}`}
|
|
3723
|
+
</tool_response>`
|
|
3724
|
+
};
|
|
3725
|
+
h.push(b), a.push(b);
|
|
3726
|
+
}
|
|
3727
|
+
return this.messages = a, {
|
|
3728
|
+
text: a[a.length - 2]?.content || "",
|
|
3729
|
+
response: { messages: a }
|
|
3730
|
+
};
|
|
3731
|
+
}
|
|
3732
|
+
/** ReAct 模式流式对话 */
|
|
3733
|
+
_chatReActStream(e, t, s, i, n) {
|
|
3734
|
+
const a = this, l = this.llm(s);
|
|
3735
|
+
let h, c;
|
|
3736
|
+
const d = new Promise((p, C) => {
|
|
3737
|
+
h = p, c = C;
|
|
3738
|
+
});
|
|
3739
|
+
return {
|
|
3740
|
+
fullStream: new ReadableStream({
|
|
3741
|
+
async start(p) {
|
|
3742
|
+
let C = [...e];
|
|
3743
|
+
const f = e[0]?.role === "system" ? e[0] : null, u = f ? e.slice(1) : [...e];
|
|
3744
|
+
let m = 0, w = "";
|
|
3745
|
+
const v = n.maxImages ?? 3;
|
|
3746
|
+
try {
|
|
3747
|
+
for (; m < i; ) {
|
|
3748
|
+
m++;
|
|
3749
|
+
const _ = a._buildMessagesForModel(f, u, v), { tools: S, ...L } = n;
|
|
3750
|
+
delete L.system, delete L.onFinish;
|
|
3751
|
+
const b = await X({
|
|
3752
|
+
...L,
|
|
3753
|
+
model: l,
|
|
3754
|
+
messages: _
|
|
3755
|
+
});
|
|
3756
|
+
let E = "";
|
|
3757
|
+
for await (const I of b.fullStream)
|
|
3758
|
+
I.type === "text-delta" ? (E += I.text || "", p.enqueue({
|
|
3759
|
+
type: "text-delta",
|
|
3760
|
+
text: I.text
|
|
3761
|
+
})) : I.type === "text-start" ? p.enqueue({ type: "text-start" }) : I.type === "text-end" || p.enqueue(I);
|
|
3762
|
+
w += E;
|
|
3763
|
+
const U = { role: "assistant", content: w };
|
|
3764
|
+
u.push(U), C.push(U);
|
|
3765
|
+
const R = M2(w, t);
|
|
3766
|
+
if (!R) {
|
|
3767
|
+
p.enqueue({ type: "text-end" }), p.close(), a.messages = C, h({ messages: C });
|
|
3768
|
+
return;
|
|
3769
|
+
}
|
|
3770
|
+
if (R.toolName === "computer" && R.arguments?.action === "terminate") {
|
|
3771
|
+
p.enqueue({ type: "text-end" }), p.close(), a.messages = C, h({ messages: C });
|
|
3772
|
+
return;
|
|
3773
|
+
}
|
|
3774
|
+
const P = `react-${Date.now()}`;
|
|
3775
|
+
p.enqueue({
|
|
3776
|
+
type: "tool-input-start",
|
|
3777
|
+
id: P,
|
|
3778
|
+
toolName: R.toolName
|
|
3779
|
+
});
|
|
3780
|
+
const Q = JSON.stringify(R.arguments, null, 2);
|
|
3781
|
+
p.enqueue({
|
|
3782
|
+
type: "tool-input-delta",
|
|
3783
|
+
id: P,
|
|
3784
|
+
delta: Q
|
|
3785
|
+
});
|
|
3786
|
+
const T = await a._executeReActToolCall(R.toolName, R.arguments, t);
|
|
3787
|
+
let H, k = T.result;
|
|
3788
|
+
if (T.success && T.result && typeof T.result == "object" && T.result.screenshot) {
|
|
3789
|
+
H = T.result.screenshot;
|
|
3790
|
+
const { screenshot: I, ...G2 } = T.result;
|
|
3791
|
+
k = G2;
|
|
3792
|
+
}
|
|
3793
|
+
let N = "";
|
|
3794
|
+
T.success ? k && Array.isArray(k.content) && k.content.length > 0 && k.content[0].text ? N = k.content[0].text : N = JSON.stringify(k) : N = `工具执行失败 - ${T.error}`;
|
|
3795
|
+
let z = `<tool_response>
|
|
3796
|
+
${N}
|
|
3797
|
+
</tool_response>`;
|
|
3798
|
+
H && (z += `
|
|
3799
|
+
请检查截图以确认操作是否成功。如果成功,请继续下一步;如果失败,请重试。`), p.enqueue({
|
|
3800
|
+
type: "tool-result",
|
|
3801
|
+
toolCallId: P,
|
|
3802
|
+
result: z
|
|
3803
|
+
});
|
|
3804
|
+
const u2 = H ? {
|
|
3805
|
+
role: "user",
|
|
3806
|
+
content: [
|
|
3807
|
+
{ type: "text", text: z },
|
|
3808
|
+
{ type: "image", image: H }
|
|
3809
|
+
]
|
|
3810
|
+
} : {
|
|
3811
|
+
role: "user",
|
|
3812
|
+
content: z
|
|
3813
|
+
};
|
|
3814
|
+
u.push(u2), C.push(u2), w = "";
|
|
3815
|
+
}
|
|
3816
|
+
p.enqueue({ type: "text-end" }), p.close(), a.messages = C, h({ messages: C });
|
|
3817
|
+
} catch (_) {
|
|
3818
|
+
p.error(_), c(_);
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
}),
|
|
3822
|
+
response: d
|
|
3823
|
+
};
|
|
3824
|
+
}
|
|
3825
|
+
async _chat(e, { model: t, maxSteps: s = 5, ...i }) {
|
|
3826
|
+
if (this.useReActMode)
|
|
3827
|
+
return this._chatReAct(e, { model: t, maxSteps: s, ...i });
|
|
1737
3828
|
if (!this.llm)
|
|
1738
3829
|
throw new Error("LLM is not initialized");
|
|
1739
3830
|
await this.initClientsAndTools();
|
|
1740
|
-
const
|
|
3831
|
+
const n = {
|
|
1741
3832
|
// @ts-ignore ProviderV2 是所有llm的父类, 在每一个具体的llm 类都有一个选择model的函数用法
|
|
1742
3833
|
model: this.llm(t),
|
|
1743
|
-
stopWhen:
|
|
1744
|
-
...
|
|
1745
|
-
tools: this._tempMergeTools(
|
|
3834
|
+
stopWhen: ve(s),
|
|
3835
|
+
...i,
|
|
3836
|
+
tools: this._tempMergeTools(i.tools)
|
|
1746
3837
|
};
|
|
1747
|
-
|
|
1748
|
-
const
|
|
1749
|
-
return
|
|
1750
|
-
this.messages.push(...
|
|
1751
|
-
}),
|
|
3838
|
+
i.message && !i.messages && (this.messages.push({ role: "user", content: i.message }), n.messages = [...this.messages]);
|
|
3839
|
+
const a = e(n);
|
|
3840
|
+
return a?.response?.then((l) => {
|
|
3841
|
+
this.messages.push(...l.messages);
|
|
3842
|
+
}), a;
|
|
1752
3843
|
}
|
|
1753
3844
|
async chat(e) {
|
|
1754
|
-
return this._chat(
|
|
3845
|
+
return this._chat(f2, e);
|
|
1755
3846
|
}
|
|
1756
3847
|
async chatStream(e) {
|
|
1757
|
-
return this._chat(
|
|
3848
|
+
return this._chat(X, e);
|
|
1758
3849
|
}
|
|
1759
3850
|
}
|
|
1760
3851
|
export {
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
3852
|
+
I0 as AgentModelProvider,
|
|
3853
|
+
O0 as Ajv,
|
|
3854
|
+
H0 as AuthClientProvider,
|
|
3855
|
+
P0 as ContentScriptServerTransport,
|
|
3856
|
+
Re as ExtensionClientTransport,
|
|
3857
|
+
E0 as ExtensionPageServerTransport,
|
|
3858
|
+
G0 as InMemoryTransport,
|
|
3859
|
+
Te as QrCode,
|
|
3860
|
+
z0 as ResourceTemplate,
|
|
3861
|
+
D0 as UriTemplate,
|
|
3862
|
+
Le as WebMcpClient,
|
|
3863
|
+
w0 as WebMcpServer,
|
|
3864
|
+
B0 as completable,
|
|
3865
|
+
S0 as createMessageChannelClientTransport,
|
|
3866
|
+
v0 as createMessageChannelPairTransport,
|
|
3867
|
+
y0 as createMessageChannelServerTransport,
|
|
3868
|
+
k0 as createRemoter,
|
|
3869
|
+
x0 as createSSEClientTransport,
|
|
3870
|
+
L0 as createStreamableHTTPClientTransport,
|
|
3871
|
+
e0 as getAISDKTools,
|
|
3872
|
+
J0 as getDisplayName,
|
|
3873
|
+
M0 as isMcpClient,
|
|
3874
|
+
b0 as isMcpServer,
|
|
3875
|
+
T0 as isMessageChannelClientTransport,
|
|
3876
|
+
_0 as isMessageChannelServerTransport,
|
|
3877
|
+
R0 as isSSEClientTransport,
|
|
3878
|
+
Se as isStreamableHTTPClientTransport,
|
|
3879
|
+
q0 as z
|
|
1789
3880
|
};
|