@opentiny/next-sdk 0.4.0 → 0.4.2
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 +78 -81
- package/agent/type.ts +6 -9
- package/agent/utils/getAISDKTools.ts +0 -1
- package/agent/utils/getBuiltinMcpTools.ts +7 -7
- package/core.ts +0 -3
- package/dist/SimulatorMask-BHVXyogh-CARX3Rff.js +361 -0
- package/dist/agent/type.d.ts +4 -12
- package/dist/agent/utils/getBuiltinMcpTools.d.ts +3 -3
- package/dist/core.d.ts +0 -1
- package/dist/core.js +16 -17
- package/dist/index-R_HIbfUX.js +6604 -0
- package/dist/index.d.ts +11 -3
- package/dist/index.js +76 -4969
- package/dist/{initialize-builtin-WebMCP-HgObT902.js → initialize-builtin-WebMCP-JaoKwVlm.js} +1156 -1037
- package/dist/page-tools/a11y/build.d.ts +10 -0
- package/dist/page-tools/a11y/config.d.ts +96 -0
- package/dist/page-tools/a11y/constants.d.ts +11 -0
- package/dist/page-tools/a11y/search.d.ts +17 -0
- package/dist/page-tools/a11y/types.d.ts +95 -0
- package/dist/page-tools/a11y/utils.d.ts +55 -0
- package/dist/page-tools/a11y/vnode.d.ts +40 -0
- package/dist/page-tools/a11y-tree.d.ts +9 -99
- package/dist/page-tools/configs/console-cloud.d.ts +6 -0
- package/dist/page-tools/constants.d.ts +10 -0
- package/dist/page-tools/context.d.ts +40 -0
- package/dist/page-tools/handlers/browserState.d.ts +8 -0
- package/dist/page-tools/handlers/click.d.ts +8 -0
- package/dist/page-tools/handlers/executeJavascript.d.ts +8 -0
- package/dist/page-tools/handlers/fill.d.ts +8 -0
- package/dist/page-tools/handlers/scroll.d.ts +8 -0
- package/dist/page-tools/handlers/searchTree.d.ts +9 -0
- package/dist/page-tools/handlers/select.d.ts +8 -0
- package/dist/page-tools/page-agent-highlight/index.d.ts +21 -0
- package/dist/page-tools/page-agent-mask/SimulatorMask.d.ts +16 -0
- package/dist/page-tools/page-agent-mask/checkDarkMode.d.ts +5 -0
- package/dist/page-tools/page-agent-tool-event.d.ts +26 -0
- package/dist/page-tools/page-agent-tool.d.ts +3 -8
- package/dist/page-tools/schema.d.ts +44 -0
- package/dist/page-tools/tool-config.d.ts +50 -0
- package/dist/page-tools/utils/dom.d.ts +6 -0
- package/dist/page-tools/utils/scroll.d.ts +15 -0
- package/dist/runtime.d.ts +7 -0
- package/dist/runtime.js +732 -0
- package/dist/utils/builtinProxy.d.ts +1 -1
- package/dist/vitest.config.d.ts +2 -0
- package/index.ts +35 -5
- package/package.json +23 -29
- package/page-tools/a11y/build.ts +74 -0
- package/page-tools/a11y/config.ts +465 -0
- package/page-tools/a11y/constants.ts +131 -0
- package/page-tools/a11y/search.ts +127 -0
- package/page-tools/a11y/types.ts +105 -0
- package/page-tools/a11y/utils.ts +239 -0
- package/page-tools/a11y/vnode.ts +439 -0
- package/page-tools/a11y-tree.ts +9 -527
- package/page-tools/bridge.ts +23 -3
- package/page-tools/configs/console-cloud.ts +172 -0
- package/page-tools/constants.ts +12 -0
- package/page-tools/context.ts +50 -0
- package/page-tools/handlers/browserState.ts +12 -0
- package/page-tools/handlers/click.ts +30 -0
- package/page-tools/handlers/executeJavascript.ts +22 -0
- package/page-tools/handlers/fill.ts +65 -0
- package/page-tools/handlers/scroll.ts +66 -0
- package/page-tools/handlers/searchTree.ts +27 -0
- package/page-tools/handlers/select.ts +39 -0
- package/page-tools/page-agent-highlight/index.ts +245 -0
- package/page-tools/page-agent-mask/SimulatorMask.module.css +14 -0
- package/page-tools/page-agent-mask/SimulatorMask.ts +299 -0
- package/page-tools/page-agent-mask/checkDarkMode.ts +181 -0
- package/page-tools/page-agent-mask/cursor-border.svg +3 -0
- package/page-tools/page-agent-mask/cursor-fill.svg +5 -0
- package/page-tools/page-agent-mask/cursor.module.css +70 -0
- package/page-tools/page-agent-mask/hauwei.svg +25 -0
- package/page-tools/page-agent-prompt.md +34 -18
- package/page-tools/page-agent-tool-event.ts +113 -0
- package/page-tools/page-agent-tool.ts +146 -162
- package/page-tools/schema.ts +52 -0
- package/page-tools/tool-config.ts +100 -0
- package/page-tools/utils/dom.ts +158 -0
- package/page-tools/utils/scroll.ts +58 -0
- package/runtime.ts +44 -0
- package/test/page-tools/a11y/build.test.ts +638 -0
- package/test/page-tools/a11y/config.test.ts +370 -0
- package/test/page-tools/configs/console-cloud.test.ts +168 -0
- package/test/page-tools/page-agent-highlight.test.ts +110 -0
- package/test/page-tools/page-agent-tool-dispatch.test.ts +208 -0
- package/test/page-tools/page-agent-tool.test.ts +102 -0
- package/test/page-tools/tool-config.test.ts +112 -0
- package/test/page-tools/utils/dom.test.ts +122 -0
- package/utils/builtinProxy.ts +45 -13
- package/vite.config.runtime.ts +22 -0
- package/vite.config.ts +52 -8
- package/vitest.config.ts +10 -0
- package/McpSdk.ts +0 -14
- package/WebAgent.ts +0 -5
- package/WebMcp.ts +0 -26
- package/Zod.ts +0 -1
- package/dist/McpSdk.d.ts +0 -14
- package/dist/SimulatorMask-BHVXyogh-BFEGpD5S.js +0 -1048
- package/dist/SimulatorMask-BHVXyogh-CCYbrb84.js +0 -801
- package/dist/WebAgent.d.ts +0 -5
- package/dist/WebMcp.d.ts +0 -23
- package/dist/Zod.d.ts +0 -1
- package/dist/index.es.dev.js +0 -59017
- package/dist/index.es.js +0 -46795
- package/dist/index.umd.dev.js +0 -60355
- package/dist/index.umd.js +0 -1248
- package/dist/mcpsdk@1.25.3.dev.js +0 -22780
- package/dist/mcpsdk@1.25.3.es.dev.js +0 -22778
- package/dist/mcpsdk@1.25.3.es.js +0 -16960
- package/dist/mcpsdk@1.25.3.js +0 -48
- package/dist/transport/ExtensionClientTransport.d.ts +0 -24
- package/dist/transport/ExtensionContentServerTransport.d.ts +0 -39
- package/dist/transport/ExtensionPageServerTransport.d.ts +0 -36
- package/dist/transport/messages.d.ts +0 -9
- package/dist/vite.config.mcpSdk.d.ts +0 -2
- package/dist/vite.config.webAgent.d.ts +0 -2
- package/dist/vite.config.webMcp.d.ts +0 -2
- package/dist/vite.config.webMcpFull.d.ts +0 -2
- package/dist/vite.config.zod.d.ts +0 -2
- package/dist/webagent.dev.js +0 -49360
- package/dist/webagent.es.dev.js +0 -49071
- package/dist/webagent.es.js +0 -39219
- package/dist/webagent.js +0 -642
- package/dist/webmcp-full.dev.js +0 -31336
- package/dist/webmcp-full.es.dev.js +0 -30283
- package/dist/webmcp-full.es.js +0 -22889
- package/dist/webmcp-full.js +0 -645
- package/dist/webmcp.dev.js +0 -9572
- package/dist/webmcp.es.dev.js +0 -8518
- package/dist/webmcp.es.js +0 -6727
- package/dist/webmcp.js +0 -602
- package/dist/zod@3.25.76.dev.js +0 -4037
- package/dist/zod@3.25.76.es.dev.js +0 -4033
- package/dist/zod@3.25.76.es.js +0 -2945
- package/dist/zod@3.25.76.js +0 -1
- package/transport/ExtensionClientTransport.ts +0 -100
- package/transport/ExtensionContentServerTransport.ts +0 -162
- package/transport/ExtensionPageServerTransport.ts +0 -149
- package/transport/messages.ts +0 -63
- package/vite-build-tsc.ts +0 -63
- package/vite-env.d.ts +0 -10
- package/vite.config.mcpSdk.ts +0 -28
- package/vite.config.webAgent.ts +0 -19
- package/vite.config.webMcp.ts +0 -40
- package/vite.config.webMcpFull.ts +0 -19
- package/vite.config.zod.ts +0 -23
- /package/dist/{vite-build-tsc.d.ts → vite.config.runtime.d.ts} +0 -0
package/dist/agent/type.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ import { MCPClientConfig } from '@ai-sdk/mcp';
|
|
|
3
3
|
|
|
4
4
|
export type MCPTransport = MCPClientConfig['transport'];
|
|
5
5
|
/**
|
|
6
|
-
* 浏览器内置 WebMCP 测试 API 接口 (如
|
|
6
|
+
* 浏览器内置 WebMCP 测试 API 接口 (如 document.modelContext)
|
|
7
7
|
*/
|
|
8
8
|
export interface BuiltinMcpClient {
|
|
9
9
|
listTools?: () => Promise<any[]>;
|
|
10
10
|
getTools?: () => Promise<any[]>;
|
|
11
|
-
executeTool: (
|
|
11
|
+
executeTool: (tool: any, input: string) => Promise<any>;
|
|
12
12
|
registerTool?: (config: {
|
|
13
13
|
name: string;
|
|
14
14
|
execute: (input: any) => Promise<any> | any;
|
|
@@ -56,14 +56,6 @@ export type McpServerConfig = {
|
|
|
56
56
|
headers?: Record<string, string>;
|
|
57
57
|
name?: string;
|
|
58
58
|
description?: string;
|
|
59
|
-
} | {
|
|
60
|
-
type: 'extension';
|
|
61
|
-
url: string;
|
|
62
|
-
sessionId: string;
|
|
63
|
-
useAISdkClient?: boolean;
|
|
64
|
-
headers?: Record<string, string>;
|
|
65
|
-
name?: string;
|
|
66
|
-
description?: string;
|
|
67
59
|
} | {
|
|
68
60
|
type: 'local';
|
|
69
61
|
transport: MCPTransport;
|
|
@@ -73,11 +65,11 @@ export type McpServerConfig = {
|
|
|
73
65
|
} | {
|
|
74
66
|
/**
|
|
75
67
|
* 浏览器内置 WebMCP 类型。
|
|
76
|
-
* 将 `
|
|
68
|
+
* 将 `document.modelContext` 作为 MCP 工具数据源,
|
|
77
69
|
* 通过 `getBuiltinMcpTools` 适配为 ai-sdk 可调用的 ToolSet。
|
|
78
70
|
*/
|
|
79
71
|
type: 'builtin';
|
|
80
|
-
/** 传入 `
|
|
72
|
+
/** 传入 `document.modelContext` 对象 */
|
|
81
73
|
client: BuiltinMcpClient;
|
|
82
74
|
name?: string;
|
|
83
75
|
description?: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ToolSet } from 'ai';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* 将浏览器内置 WebMCP 的 `
|
|
4
|
+
* 将浏览器内置 WebMCP 的 `document.modelContext` 适配为 ai-sdk 的 ToolSet。
|
|
5
5
|
*
|
|
6
6
|
* 类似 getAISDKTools,但数据源是浏览器原生 API 而非 MCP client。
|
|
7
|
-
* 工具执行时通过 `executeTool(
|
|
7
|
+
* 工具执行时通过 `executeTool(toolObj, JSON.stringify(args))` 代理给浏览器。
|
|
8
8
|
*
|
|
9
|
-
* @param client - `
|
|
9
|
+
* @param client - `document.modelContext` 对象
|
|
10
10
|
* @returns ai-sdk 格式的 ToolSet,可直接传入 streamText/generateText 的 tools 参数
|
|
11
11
|
*/
|
|
12
12
|
export declare const getBuiltinMcpTools: (client: object | undefined | null) => Promise<ToolSet>;
|
package/dist/core.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ export type * from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
|
18
18
|
export type * from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
19
19
|
export * from './WebMcpServer';
|
|
20
20
|
export * from './WebMcpClient';
|
|
21
|
-
export * from './transport/ExtensionClientTransport';
|
|
22
21
|
export { AgentModelProvider } from './agent/AgentModelProvider';
|
|
23
22
|
export { getAISDKTools } from './agent/utils/getAISDKTools';
|
|
24
23
|
export type * from './agent/type';
|
package/dist/core.js
CHANGED
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
import { default as a } from "ajv";
|
|
2
2
|
import { z as t } from "zod";
|
|
3
|
-
import { AuthClientProvider as
|
|
3
|
+
import { AuthClientProvider as n } from "@opentiny/next";
|
|
4
4
|
import { ResourceTemplate as l } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
-
import { UriTemplate as
|
|
5
|
+
import { UriTemplate as m } from "@modelcontextprotocol/sdk/shared/uriTemplate.js";
|
|
6
6
|
import { completable as C } from "@modelcontextprotocol/sdk/server/completable.js";
|
|
7
7
|
import { getDisplayName as M } from "@modelcontextprotocol/sdk/shared/metadataUtils.js";
|
|
8
8
|
import { InMemoryTransport as S } from "@modelcontextprotocol/sdk/inMemory.js";
|
|
9
|
-
import { A as
|
|
9
|
+
import { A as x, e as b, W as h, j as v, a as P, c as d, f as A, h as u, g as W, i as j, n as y, d as z, m as D, b as E, k as H, l as I } from "./initialize-builtin-WebMCP-JaoKwVlm.js";
|
|
10
10
|
export {
|
|
11
|
-
|
|
11
|
+
x as AgentModelProvider,
|
|
12
12
|
a as Ajv,
|
|
13
|
-
|
|
14
|
-
b as ExtensionClientTransport,
|
|
13
|
+
n as AuthClientProvider,
|
|
15
14
|
S as InMemoryTransport,
|
|
16
15
|
l as ResourceTemplate,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
m as UriTemplate,
|
|
17
|
+
b as WebMcpClient,
|
|
18
|
+
h as WebMcpServer,
|
|
20
19
|
C as completable,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
v as createMessageChannelClientTransport,
|
|
21
|
+
P as createMessageChannelPairTransport,
|
|
22
|
+
d as createMessageChannelServerTransport,
|
|
23
|
+
A as createSSEClientTransport,
|
|
24
|
+
u as createStreamableHTTPClientTransport,
|
|
26
25
|
W as getAISDKTools,
|
|
27
26
|
M as getDisplayName,
|
|
28
27
|
j as initializeBuiltinWebMCP,
|
|
29
28
|
y as isMcpClient,
|
|
30
29
|
z as isMcpServer,
|
|
31
30
|
D as isMessageChannelClientTransport,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
E as isMessageChannelServerTransport,
|
|
32
|
+
H as isSSEClientTransport,
|
|
33
|
+
I as isStreamableHTTPClientTransport,
|
|
35
34
|
t as z
|
|
36
35
|
};
|