@webskill/sdk 0.14.0 → 0.15.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/dist/agent.d.ts +3 -3
- package/dist/agent.js +2442 -3
- package/dist/{dist-Bfga1TmS.js → approval-BnLLCOG0.js} +235 -2932
- package/dist/browser.d.ts +106 -5
- package/dist/browser.js +364 -10
- package/dist/{openUiLibrary-BKXW7Iwx-DjvEnMlJ.js → dist-CTsxblSD.js} +496 -28
- package/dist/{echarts-De78wXqV.js → echarts-BE7oV_Dl.js} +1 -1
- package/dist/{env-8cY40DXB-CGnEVZby.js → env-Bj1MI2Ww.js} +1 -1
- package/dist/errors-BDZNpC13.js +22 -0
- package/dist/{eventTypes-FllCrX-Z-DNDeHWoG.js → eventTypes-Y07N8IAC.js} +14 -2
- package/dist/external-_ZRQe-V9.js +53 -0
- package/dist/governance.d.ts +15 -3
- package/dist/governance.js +86 -4
- package/dist/{index-DQwGvHAI.d.ts → index-CQYo4tcT.d.ts} +85 -6
- package/dist/{index-sd-gVKey.d.ts → index-CU2md8R1.d.ts} +26 -18
- package/dist/{index-CWoKOFBP.d.ts → index-Oc3H89TJ.d.ts} +159 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1001 -5
- package/dist/kind-DxgS8LM-.js +77 -0
- package/dist/linkedDocument-xNXF-z8n.js +94 -0
- package/dist/llm-B7lLH0ZI.js +1767 -0
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +41 -4
- package/dist/memoryArtifactStore-D6dLeY55.js +48 -0
- package/dist/miniChart-owdCdaw-.js +533 -0
- package/dist/node.d.ts +3 -3
- package/dist/node.js +106 -9
- package/dist/openUiLibrary-CY_ADoe0.js +30 -0
- package/dist/openUiSpecLang-DuOCdw9G.js +1849 -0
- package/dist/pathSecurity-B1owvJAF.js +65 -0
- package/dist/processSandboxEntry.js +5 -1
- package/dist/renderResult-D9Q-Vu2x.js +143 -0
- package/dist/{rolldown-runtime-BOF7iYI8.js → rolldown-runtime-BHkdefai.js} +1 -2
- package/dist/sandboxWorkerEntry.js +5 -1
- package/dist/{dist-D5YhlCdY.js → skill-CAJMsLod.js} +44 -372
- package/dist/{skillVersionStore-D-qHk9ZE-C0OFDTQY.d.ts → skillVersionStore-B24Jjjry-C4zomhMZ.d.ts} +14 -2
- package/dist/surface-DVGiCmwq.js +145 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +64 -3
- package/dist/{types-C3V6lAeO-BgeOvc1Y.d.ts → types-C3V6lAeO-BIf7UB2e.d.ts} +17 -1
- package/dist/types-TUydnxaj.js +78 -0
- package/dist/ui-react.d.ts +12 -5
- package/dist/ui-react.js +128548 -4729
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui-vue.js +11 -2
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +1254 -3
- package/dist/urlSafety-CiSuCJvX.js +65 -0
- package/dist/webSkillApi-DOOyz2G5.js +106 -0
- package/dist/{webskillLitCatalog-D_zCqeQF-swXsWoAe.js → webskillLitCatalog-DSqVFQjK.js} +11 -3
- package/package.json +1 -1
- package/dist/catalogComponents-BgAJN0p8-Cr55ouOg.js +0 -124384
- package/dist/client-BCM6Z3yq-qUQNkKrK.js +0 -7787
- package/dist/dist-BnqAkSS6.js +0 -2384
- package/dist/dist-CiaDIqkV.js +0 -3509
- package/dist/dist-DxyxmXPU-DGC-dpXf.js +0 -5621
- package/dist/memoryArtifactStore-52Zn9npI-BxtUkrgV.js +0 -86
- package/dist/stdio-CFMoANJJ-BxrTeXh7.js +0 -31
- package/dist/testing-Cm8MseLF.js +0 -142
- package/dist/types-WovEf4ED-CZSDiiBU.js +0 -6215
package/dist/mcp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { K as JsonSchema, _ as LlmToolSpec, ft as SkillDocument, ut as SkillCatalogEntry } from "./types-C3V6lAeO-
|
|
2
|
-
import {
|
|
1
|
+
import { K as JsonSchema, _ as LlmToolSpec, ft as SkillDocument, ut as SkillCatalogEntry } from "./types-C3V6lAeO-BIf7UB2e.js";
|
|
2
|
+
import { R as ExternalSkillProvider, _n as ToolDisclosure, fr as mergeCatalogEntries, yn as ToolResult, z as ExternalToolSource } from "./index-Oc3H89TJ.js";
|
|
3
3
|
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
4
4
|
import { JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js";
|
|
5
5
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
package/dist/mcp.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as messageOf, t as WebSkillError } from "./errors-BDZNpC13.js";
|
|
2
|
+
import { t as assertRemoteUrlAllowed } from "./urlSafety-CiSuCJvX.js";
|
|
3
|
+
import { n as normalizeToolContent, t as mergeCatalogEntries } from "./external-_ZRQe-V9.js";
|
|
3
4
|
|
|
4
|
-
//#region ../mcp/
|
|
5
|
+
//#region ../mcp/src/transport/jsonRpc.ts
|
|
5
6
|
/**
|
|
6
7
|
* JSON-RPC 2.0 消息校验(守卫)。
|
|
7
8
|
* 规则:jsonrpc === '2.0';请求/通知有 method;响应有 id 且 result/error 恰好其一;
|
|
@@ -29,6 +30,9 @@ function validateJsonRpcMessage(value) {
|
|
|
29
30
|
}
|
|
30
31
|
return true;
|
|
31
32
|
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region ../mcp/src/transport/messageChannelTransport.ts
|
|
32
36
|
const currentOrigin = () => globalThis.location?.origin;
|
|
33
37
|
/**
|
|
34
38
|
* 跑在 MessageChannel/MessagePort 端点间的 MCP Transport。
|
|
@@ -112,6 +116,9 @@ var MessageChannelTransport = class {
|
|
|
112
116
|
this.onmessage?.(event.data);
|
|
113
117
|
}
|
|
114
118
|
};
|
|
119
|
+
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region ../mcp/src/pageHost/pageHostAnchor.ts
|
|
115
122
|
/** 全局属性名。宿主侧写死同一个串,改这里必须同时改宿主 */
|
|
116
123
|
const PAGE_HOST_ANCHOR_KEY = "__webskillPageHost";
|
|
117
124
|
function readAnchor() {
|
|
@@ -142,6 +149,9 @@ function declareDataSourcesToPageHost(sources) {
|
|
|
142
149
|
readAnchor()?.declareDataSources?.(sources);
|
|
143
150
|
} catch {}
|
|
144
151
|
}
|
|
152
|
+
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region ../mcp/src/registry/endpointRegistry.ts
|
|
145
155
|
/** endpoint 名 → client 注册表;单调版本号,事件驱动等待(禁止轮询) */
|
|
146
156
|
var EndpointRegistry = class {
|
|
147
157
|
#clients = /* @__PURE__ */ new Map();
|
|
@@ -205,6 +215,9 @@ var EndpointRegistry = class {
|
|
|
205
215
|
for (const resolve of queue) resolve(client);
|
|
206
216
|
}
|
|
207
217
|
};
|
|
218
|
+
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region ../mcp/src/resolver/mcpToolResolver.ts
|
|
208
221
|
/** MCP 结果单项 text 上限(64KB) */
|
|
209
222
|
const MAX_MCP_RESULT_TEXT_BYTES = 64 * 1024;
|
|
210
223
|
const failure$1 = (code, message) => ({
|
|
@@ -293,6 +306,9 @@ var McpToolResolver = class {
|
|
|
293
306
|
};
|
|
294
307
|
}
|
|
295
308
|
};
|
|
309
|
+
|
|
310
|
+
//#endregion
|
|
311
|
+
//#region ../mcp/src/resolver/nameSanitize.ts
|
|
296
312
|
/**
|
|
297
313
|
* LLM 可见名消毒(OpenAI 工具名只允许 [a-zA-Z0-9_-])。
|
|
298
314
|
* 约定:`endpoint:tool` ↔ `endpoint__tool`,`mcp#tool` ↔ `mcp__tool`;
|
|
@@ -335,6 +351,9 @@ function parseWebMcpToolLlmName(llmName, sourceIds = []) {
|
|
|
335
351
|
}
|
|
336
352
|
return { toolName: rest };
|
|
337
353
|
}
|
|
354
|
+
|
|
355
|
+
//#endregion
|
|
356
|
+
//#region ../mcp/src/skills/temporarySkillProvider.ts
|
|
338
357
|
const textOfContent = (content) => {
|
|
339
358
|
if (typeof content === "string") return content;
|
|
340
359
|
if (typeof content === "object" && content !== null) {
|
|
@@ -421,6 +440,9 @@ var TemporarySkillProvider = class {
|
|
|
421
440
|
}
|
|
422
441
|
}
|
|
423
442
|
};
|
|
443
|
+
|
|
444
|
+
//#endregion
|
|
445
|
+
//#region ../mcp/src/skills/serveSkillAsMcp.ts
|
|
424
446
|
async function loadFromJSONSchema() {
|
|
425
447
|
try {
|
|
426
448
|
return (await import("zod")).fromJSONSchema;
|
|
@@ -464,11 +486,17 @@ async function serveSkillAsMcp(server, skill) {
|
|
|
464
486
|
} : { content };
|
|
465
487
|
});
|
|
466
488
|
}
|
|
489
|
+
|
|
490
|
+
//#endregion
|
|
491
|
+
//#region ../mcp/src/skills/catalogMerge.ts
|
|
467
492
|
/**
|
|
468
493
|
* 本地/临时 Catalog 合并:同名本地优先;mcp:// URI 保留用于强制指定临时技能。
|
|
469
494
|
* 实现单一来源在 runtime(runtime 自身合并也用同一函数)。
|
|
470
495
|
*/
|
|
471
496
|
const catalogMerge = mergeCatalogEntries;
|
|
497
|
+
|
|
498
|
+
//#endregion
|
|
499
|
+
//#region ../mcp/src/webmcp/experimentalWebMcpAdapter.ts
|
|
472
500
|
const failure = (code, message) => ({
|
|
473
501
|
ok: false,
|
|
474
502
|
content: [],
|
|
@@ -538,7 +566,7 @@ var ExperimentalWebMcpAdapter = class {
|
|
|
538
566
|
this.#enabled = options?.enabled ?? false;
|
|
539
567
|
if (options?.sourceId !== void 0) {
|
|
540
568
|
if (!/^[a-zA-Z0-9-]+$/.test(options.sourceId)) throw new WebSkillError("VALIDATION_FAILED", `WebMCP sourceId "${options.sourceId}" may only contain letters, digits and hyphens.`);
|
|
541
|
-
if (options.sourceId.length > 24) throw new WebSkillError("VALIDATION_FAILED", `WebMCP sourceId "${options.sourceId}" is longer than 24 characters; it is prefixed onto every tool name and therefore costs tokens on every request.`);
|
|
569
|
+
if (options.sourceId.length > 24) throw new WebSkillError("VALIDATION_FAILED", `WebMCP sourceId "${options.sourceId}" is longer than ${24} characters; it is prefixed onto every tool name and therefore costs tokens on every request.`);
|
|
542
570
|
this.sourceId = options.sourceId;
|
|
543
571
|
}
|
|
544
572
|
}
|
|
@@ -602,6 +630,9 @@ var ExperimentalWebMcpAdapter = class {
|
|
|
602
630
|
}
|
|
603
631
|
}
|
|
604
632
|
};
|
|
633
|
+
|
|
634
|
+
//#endregion
|
|
635
|
+
//#region ../mcp/src/plugin/mcpRuntimePlugin.ts
|
|
605
636
|
const disabledResult = (llmToolName) => ({
|
|
606
637
|
ok: false,
|
|
607
638
|
content: [],
|
|
@@ -799,6 +830,9 @@ var McpRuntimePlugin = class {
|
|
|
799
830
|
};
|
|
800
831
|
}
|
|
801
832
|
};
|
|
833
|
+
|
|
834
|
+
//#endregion
|
|
835
|
+
//#region ../mcp/src/remote/oauth.ts
|
|
802
836
|
/**
|
|
803
837
|
* 构造授权相关错误。`message` 只含端点名与阶段,`details` 只有 `{ endpoint, stage }`——
|
|
804
838
|
* 不带 `cause`:SDK 的错误 message 可能回显授权 URL 或 token 端点的响应体(AC-22.6)。
|
|
@@ -925,6 +959,9 @@ function createOAuthProvider(endpoint, config) {
|
|
|
925
959
|
}
|
|
926
960
|
};
|
|
927
961
|
}
|
|
962
|
+
|
|
963
|
+
//#endregion
|
|
964
|
+
//#region ../mcp/src/remote/connectRemoteEndpoint.ts
|
|
928
965
|
async function loadMcpSdk() {
|
|
929
966
|
try {
|
|
930
967
|
const [client, sse, streamable, auth, errors] = await Promise.all([
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region ../runtime/src/artifacts/memoryArtifactStore.ts
|
|
2
|
+
/** 内存 ArtifactStore:测试与浏览器降级用;索引随进程生命周期存在 */
|
|
3
|
+
var MemoryArtifactStore = class {
|
|
4
|
+
#byRun = /* @__PURE__ */ new Map();
|
|
5
|
+
#seq = 0;
|
|
6
|
+
async createTextArtifact(input) {
|
|
7
|
+
return this.#record({
|
|
8
|
+
runId: input.runId,
|
|
9
|
+
path: input.path,
|
|
10
|
+
type: "text",
|
|
11
|
+
size: new TextEncoder().encode(input.content).length,
|
|
12
|
+
mimeType: input.mimeType,
|
|
13
|
+
metadata: input.metadata
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
async createBinaryArtifact(input) {
|
|
17
|
+
return this.#record({
|
|
18
|
+
runId: input.runId,
|
|
19
|
+
path: input.path,
|
|
20
|
+
type: "binary",
|
|
21
|
+
size: input.content.length,
|
|
22
|
+
mimeType: input.mimeType,
|
|
23
|
+
metadata: input.metadata
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async listArtifacts(runId) {
|
|
27
|
+
return [...this.#byRun.get(runId) ?? []];
|
|
28
|
+
}
|
|
29
|
+
#record(input) {
|
|
30
|
+
const artifact = {
|
|
31
|
+
id: `art-${++this.#seq}`,
|
|
32
|
+
runId: input.runId,
|
|
33
|
+
path: input.path,
|
|
34
|
+
type: input.type,
|
|
35
|
+
mimeType: input.mimeType,
|
|
36
|
+
size: input.size,
|
|
37
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
38
|
+
metadata: input.metadata
|
|
39
|
+
};
|
|
40
|
+
const list = this.#byRun.get(input.runId) ?? [];
|
|
41
|
+
list.push(artifact);
|
|
42
|
+
this.#byRun.set(input.runId, list);
|
|
43
|
+
return artifact;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { MemoryArtifactStore as t };
|