@webskill/sdk 0.2.4 → 0.2.6
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/browser.d.ts +2 -2
- package/dist/browser.js +17 -13
- package/dist/{dist-D7MsoMPx.js → dist-BQzncxXg.js} +70 -3
- package/dist/{dist-CV64gN62.js → dist-BXpDDZpR.js} +255 -116
- package/dist/{dist-CeNAzFYi.js → dist-DNSG9FqC.js} +108 -69
- package/dist/{dist-Chgf2tcy.js → dist-DWFDb1Ww.js} +76 -31
- package/dist/governance.d.ts +98 -94
- package/dist/governance.js +221 -198
- package/dist/{index-DZShzhon.d.ts → index-DJOha4b6.d.ts} +23 -1
- package/dist/{index-DrHelz72.d.ts → index-DRlYzdr2.d.ts} +5 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/mcp.d.ts +6 -2
- package/dist/mcp.js +14 -14
- package/dist/node.d.ts +3 -3
- package/dist/node.js +3 -3
- package/dist/{testing-BN18eqbD.js → testing-BUoXvm1u.js} +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/dist/{types-CKm5G_eQ-BqyXnvoR.d.ts → types-CKm5G_eQ-krKWW8WV.d.ts} +32 -2
- package/dist/ui-react.d.ts +3 -1
- package/dist/ui-react.js +8 -1
- package/dist/ui-vue.d.ts +3 -1
- package/dist/ui-vue.js +8 -1
- package/dist/ui.d.ts +20 -6
- package/dist/ui.js +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { A as isNetworkAllowed, B as toVercelToolSpecs, C as bridgeError, D as extractChartSpec, E as createWebSkillApi, F as normalizeToolError, I as parseBridgeRequest, L as resolveToolName, M as networkUrlHost, N as normalizeErrorCode, O as fromVercelResult, P as normalizeToolContent, R as schemaToForm, S as WebSkillRuntime, T as createScriptContext, _ as READ_SKILL_FILE_TOOL, a as AnthropicClient, b as SerializingMemoryStore, c as FsArtifactStore, d as FullDisclosureRouter, f as GoogleGenAiClient, g as READ_SKILL_FILE_INPUT_SCHEMA, h as ProgressiveRouter, i as AgentLoop, j as mergeCatalogEntries, k as fromVercelStreamPart, l as FsMemoryStore, m as OpenAiCompatibleClient, n as ASK_USER_TOOL, o as CapabilityApproval, p as HookRunner, r as ASK_USER_TOOL_NAME, s as EventBus, t as ASK_USER_INPUT_SCHEMA, u as FsRunSnapshotStore, v as READ_SKILL_FILE_TOOL_NAME, w as buildRenderResult, x as TraceRecorder, y as RUN_SNAPSHOT_SCHEMA_VERSION, z as toLlmToolSpec } from "./dist-
|
|
1
|
+
import { A as resolveArchiveLimits, C as messageOf, D as readResponseWithLimit, E as parseSkillPackManifest, F as xmlRenderer, M as unzipWithLimits, N as validateSkills, O as renderAvailableSkillsXml, P as verifyManifest, S as jsonRenderer, T as parseSkillMarkdown, _ as checkSkillRules, a as SKILL_NAME_MAX_LENGTH, b as exportSkills, c as SkillDiscovery, d as assertRemoteUrlAllowed, f as assertSafePathSegment, g as checkDependencyCycles, h as buildManifest, i as SKILL_MANIFEST_FILE, j as resolveInsideRoot, k as renderCatalogJson, l as SkillReader, m as buildCatalog, n as MemoryFS, o as SKILL_NAME_PATTERN, p as atomicWriteText, r as SKILLS_LOCKFILE, s as SKILL_PACK_FILE, t as DEFAULT_ARCHIVE_LIMITS, u as WebSkillError, v as computeDigest, w as normalizePath, x as isValidSkillName, y as escapeXml } from "./dist-BQzncxXg.js";
|
|
2
|
+
import { A as isNetworkAllowed, B as toVercelToolSpecs, C as bridgeError, D as extractChartSpec, E as createWebSkillApi, F as normalizeToolError, I as parseBridgeRequest, L as resolveToolName, M as networkUrlHost, N as normalizeErrorCode, O as fromVercelResult, P as normalizeToolContent, R as schemaToForm, S as WebSkillRuntime, T as createScriptContext, _ as READ_SKILL_FILE_TOOL, a as AnthropicClient, b as SerializingMemoryStore, c as FsArtifactStore, d as FullDisclosureRouter, f as GoogleGenAiClient, g as READ_SKILL_FILE_INPUT_SCHEMA, h as ProgressiveRouter, i as AgentLoop, j as mergeCatalogEntries, k as fromVercelStreamPart, l as FsMemoryStore, m as OpenAiCompatibleClient, n as ASK_USER_TOOL, o as CapabilityApproval, p as HookRunner, r as ASK_USER_TOOL_NAME, s as EventBus, t as ASK_USER_INPUT_SCHEMA, u as FsRunSnapshotStore, v as READ_SKILL_FILE_TOOL_NAME, w as buildRenderResult, x as TraceRecorder, y as RUN_SNAPSHOT_SCHEMA_VERSION, z as toLlmToolSpec } from "./dist-BXpDDZpR.js";
|
|
3
3
|
|
|
4
|
-
export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, AnthropicClient, CapabilityApproval, DEFAULT_ARCHIVE_LIMITS, EventBus, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FullDisclosureRouter, GoogleGenAiClient, HookRunner, MemoryFS, OpenAiCompatibleClient, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, RUN_SNAPSHOT_SCHEMA_VERSION, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SKILL_PACK_FILE, SerializingMemoryStore, SkillDiscovery, SkillReader, TraceRecorder, WebSkillError, WebSkillRuntime, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isValidSkillName, jsonRenderer, mergeCatalogEntries, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, readResponseWithLimit, renderAvailableSkillsXml, renderCatalogJson, resolveArchiveLimits, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, unzipWithLimits, validateSkills, verifyManifest, xmlRenderer };
|
|
4
|
+
export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, AnthropicClient, CapabilityApproval, DEFAULT_ARCHIVE_LIMITS, EventBus, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FullDisclosureRouter, GoogleGenAiClient, HookRunner, MemoryFS, OpenAiCompatibleClient, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, RUN_SNAPSHOT_SCHEMA_VERSION, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SKILL_PACK_FILE, SerializingMemoryStore, SkillDiscovery, SkillReader, TraceRecorder, WebSkillError, WebSkillRuntime, assertRemoteUrlAllowed, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isValidSkillName, jsonRenderer, mergeCatalogEntries, messageOf, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, readResponseWithLimit, renderAvailableSkillsXml, renderCatalogJson, resolveArchiveLimits, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, unzipWithLimits, validateSkills, verifyManifest, xmlRenderer };
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { it as ToolResult, v as ExternalSkillProvider, xt as mergeCatalogEntries, y as ExternalToolSource } from "./index-
|
|
1
|
+
import { I as SkillDocument, P as SkillCatalogEntry, T as JsonSchema, m as LlmToolSpec } from "./types-CKm5G_eQ-krKWW8WV.js";
|
|
2
|
+
import { it as ToolResult, v as ExternalSkillProvider, xt as mergeCatalogEntries, y as ExternalToolSource } from "./index-DJOha4b6.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";
|
|
@@ -252,6 +252,10 @@ interface RemoteEndpointConfig {
|
|
|
252
252
|
headers?: Record<string, string>;
|
|
253
253
|
/** 连接超时;0/缺省 = 不超时 */
|
|
254
254
|
timeoutMs?: number;
|
|
255
|
+
/** 显式允许 http://(SSRF 防护默认仅 https) */
|
|
256
|
+
allowHttp?: boolean;
|
|
257
|
+
/** 显式允许私有/环回/链路本地地址(SSRF 防护默认拒绝) */
|
|
258
|
+
allowPrivateHosts?: boolean;
|
|
255
259
|
}
|
|
256
260
|
/**
|
|
257
261
|
* 远程 MCP endpoint 装配:SDK 官方 StreamableHTTPClientTransport(默认)/
|
package/dist/mcp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u as WebSkillError } from "./dist-
|
|
2
|
-
import { P as normalizeToolContent, j as mergeCatalogEntries } from "./dist-
|
|
1
|
+
import { C as messageOf, d as assertRemoteUrlAllowed, u as WebSkillError } from "./dist-BQzncxXg.js";
|
|
2
|
+
import { P as normalizeToolContent, j as mergeCatalogEntries } from "./dist-BXpDDZpR.js";
|
|
3
3
|
|
|
4
4
|
//#region ../mcp/dist/index.js
|
|
5
5
|
/**
|
|
@@ -172,7 +172,6 @@ var EndpointRegistry = class {
|
|
|
172
172
|
for (const resolve of queue) resolve(client);
|
|
173
173
|
}
|
|
174
174
|
};
|
|
175
|
-
const messageOf$3 = (e) => e instanceof Error ? e.message : String(e);
|
|
176
175
|
/** MCP 结果单项 text 上限(64KB) */
|
|
177
176
|
const MAX_MCP_RESULT_TEXT_BYTES = 64 * 1024;
|
|
178
177
|
const failure$1 = (code, message) => ({
|
|
@@ -199,20 +198,20 @@ var McpToolResolver = class {
|
|
|
199
198
|
try {
|
|
200
199
|
client = this.#registry.get(endpoint);
|
|
201
200
|
} catch (e) {
|
|
202
|
-
return failure$1("MCP_ENDPOINT_UNAVAILABLE", messageOf
|
|
201
|
+
return failure$1("MCP_ENDPOINT_UNAVAILABLE", messageOf(e));
|
|
203
202
|
}
|
|
204
203
|
let names;
|
|
205
204
|
try {
|
|
206
205
|
names = await this.#toolNames(endpoint, client);
|
|
207
206
|
} catch (e) {
|
|
208
|
-
return failure$1("MCP_ENDPOINT_UNAVAILABLE", `Failed to list tools: ${messageOf
|
|
207
|
+
return failure$1("MCP_ENDPOINT_UNAVAILABLE", `Failed to list tools: ${messageOf(e)}`);
|
|
209
208
|
}
|
|
210
209
|
if (!names.has(toolName)) {
|
|
211
210
|
this.#cache.delete(endpoint);
|
|
212
211
|
try {
|
|
213
212
|
names = await this.#toolNames(endpoint, client);
|
|
214
213
|
} catch (e) {
|
|
215
|
-
return failure$1("MCP_ENDPOINT_UNAVAILABLE", `Failed to list tools: ${messageOf
|
|
214
|
+
return failure$1("MCP_ENDPOINT_UNAVAILABLE", `Failed to list tools: ${messageOf(e)}`);
|
|
216
215
|
}
|
|
217
216
|
if (!names.has(toolName)) return failure$1("MCP_TOOL_NOT_FOUND", `Tool "${toolName}" not found on endpoint "${endpoint}"`);
|
|
218
217
|
}
|
|
@@ -223,7 +222,7 @@ var McpToolResolver = class {
|
|
|
223
222
|
});
|
|
224
223
|
return this.#normalizeCallResult(raw);
|
|
225
224
|
} catch (e) {
|
|
226
|
-
return failure$1("MCP_ENDPOINT_UNAVAILABLE", `Tool "${toolName}" on endpoint "${endpoint}" failed: ${messageOf
|
|
225
|
+
return failure$1("MCP_ENDPOINT_UNAVAILABLE", `Tool "${toolName}" on endpoint "${endpoint}" failed: ${messageOf(e)}`);
|
|
227
226
|
}
|
|
228
227
|
}
|
|
229
228
|
async #toolNames(endpoint, client) {
|
|
@@ -241,7 +240,7 @@ var McpToolResolver = class {
|
|
|
241
240
|
/** CallToolResult → ToolResult;isError 转失败;形状消毒(无 content 且无 isError 不当作 ok)+ 大小上限 */
|
|
242
241
|
#normalizeCallResult(raw) {
|
|
243
242
|
const result = raw;
|
|
244
|
-
if (result?.isError !== true && result?.content === void 0) return failure$1("MCP_ENDPOINT_UNAVAILABLE", `MCP tool returned a malformed result (no "content" and no "isError"): ${messageOf
|
|
243
|
+
if (result?.isError !== true && result?.content === void 0) return failure$1("MCP_ENDPOINT_UNAVAILABLE", `MCP tool returned a malformed result (no "content" and no "isError"): ${messageOf(raw).slice(0, 200)}`);
|
|
245
244
|
const content = normalizeToolContent(result?.content ?? raw);
|
|
246
245
|
if (result?.isError === true) {
|
|
247
246
|
const text = content.map((c) => c.text ?? "").filter(Boolean).join("\n");
|
|
@@ -272,7 +271,6 @@ function webMcpToolLlmName(toolName) {
|
|
|
272
271
|
function parseWebMcpToolLlmName(llmName) {
|
|
273
272
|
return llmName.startsWith("mcp__") && llmName.length > 5 ? llmName.slice(5) : void 0;
|
|
274
273
|
}
|
|
275
|
-
const messageOf$2 = (e) => e instanceof Error ? e.message : String(e);
|
|
276
274
|
const textOfContent = (content) => {
|
|
277
275
|
if (typeof content === "string") return content;
|
|
278
276
|
if (typeof content === "object" && content !== null) {
|
|
@@ -318,7 +316,7 @@ var TemporarySkillProvider = class {
|
|
|
318
316
|
try {
|
|
319
317
|
result = await client.getPrompt({ name });
|
|
320
318
|
} catch (e) {
|
|
321
|
-
throw new WebSkillError("SKILL_NOT_FOUND", `Prompt "${name}" not found on endpoint "${this.#endpoint}": ${messageOf
|
|
319
|
+
throw new WebSkillError("SKILL_NOT_FOUND", `Prompt "${name}" not found on endpoint "${this.#endpoint}": ${messageOf(e)}`, e);
|
|
322
320
|
}
|
|
323
321
|
const body = (result.messages ?? []).map((m) => textOfContent(m.content)).filter(Boolean).join("\n\n");
|
|
324
322
|
return {
|
|
@@ -343,7 +341,7 @@ var TemporarySkillProvider = class {
|
|
|
343
341
|
try {
|
|
344
342
|
return this.#registry.get(this.#endpoint);
|
|
345
343
|
} catch (e) {
|
|
346
|
-
throw new WebSkillError("MCP_ENDPOINT_UNAVAILABLE", messageOf
|
|
344
|
+
throw new WebSkillError("MCP_ENDPOINT_UNAVAILABLE", messageOf(e), e);
|
|
347
345
|
}
|
|
348
346
|
}
|
|
349
347
|
};
|
|
@@ -386,7 +384,6 @@ async function serveSkillAsMcp(server, skill) {
|
|
|
386
384
|
* 实现单一来源在 runtime(runtime 自身合并也用同一函数)。
|
|
387
385
|
*/
|
|
388
386
|
const catalogMerge = mergeCatalogEntries;
|
|
389
|
-
const messageOf$1 = (e) => e instanceof Error ? e.message : String(e);
|
|
390
387
|
const failure = (code, message) => ({
|
|
391
388
|
ok: false,
|
|
392
389
|
content: [],
|
|
@@ -449,7 +446,7 @@ var ExperimentalWebMcpAdapter = class {
|
|
|
449
446
|
content: normalizeToolContent(await api.executeTool(toolName, JSON.stringify(args)))
|
|
450
447
|
};
|
|
451
448
|
} catch (e) {
|
|
452
|
-
return failure("TOOL_EXECUTION_FAILED", `WebMCP tool "${toolName}" failed: ${messageOf
|
|
449
|
+
return failure("TOOL_EXECUTION_FAILED", `WebMCP tool "${toolName}" failed: ${messageOf(e)}`);
|
|
453
450
|
}
|
|
454
451
|
}
|
|
455
452
|
};
|
|
@@ -545,7 +542,6 @@ async function loadMcpSdk() {
|
|
|
545
542
|
throw new WebSkillError("MCP_ENDPOINT_UNAVAILABLE", "The \"@modelcontextprotocol/sdk\" package is required for remote MCP endpoints; install it first (npm i @modelcontextprotocol/sdk)", e);
|
|
546
543
|
}
|
|
547
544
|
}
|
|
548
|
-
const messageOf = (e) => e instanceof Error ? e.message : String(e);
|
|
549
545
|
/**
|
|
550
546
|
* 远程 MCP endpoint 装配:SDK 官方 StreamableHTTPClientTransport(默认)/
|
|
551
547
|
* SSEClientTransport(遗留)连接远端 server,注册进 EndpointRegistry——
|
|
@@ -560,6 +556,10 @@ async function connectRemoteEndpoint(registry, config) {
|
|
|
560
556
|
} catch (e) {
|
|
561
557
|
throw new WebSkillError("MCP_ENDPOINT_UNAVAILABLE", `Invalid remote MCP endpoint URL for "${config.endpoint}": ${JSON.stringify(config.url)}`, e);
|
|
562
558
|
}
|
|
559
|
+
assertRemoteUrlAllowed(url.href, {
|
|
560
|
+
allowHttp: config.allowHttp ?? false,
|
|
561
|
+
allowPrivateHosts: config.allowPrivateHosts ?? false
|
|
562
|
+
});
|
|
563
563
|
const requestInit = config.headers ? { headers: config.headers } : void 0;
|
|
564
564
|
const transport = config.transport === "sse" ? new SSEClientTransport(url, { ...requestInit ? { requestInit } : {} }) : new StreamableHTTPClientTransport(url, { ...requestInit ? { requestInit } : {} });
|
|
565
565
|
const client = new Client({
|
package/dist/node.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ht as createScriptContext } from "./index-
|
|
1
|
+
import { B as SkillManifest, G as SkillsLockfile, L as SkillInstallSource, O as SKILLS_LOCKFILE, k as SKILL_MANIFEST_FILE, q as VerifyResult } from "./types-CKm5G_eQ-krKWW8WV.js";
|
|
2
|
+
import { ht as createScriptContext } from "./index-DJOha4b6.js";
|
|
3
3
|
import { n as LlmEnvConfig, s as probeLlmCapabilities, t as LlmCapabilities } from "./env-BPUBZCwJ-4jat_SVG.js";
|
|
4
|
-
import { a as NodeScriptExecutor, c as ProcessSandboxOptions, d as SkillManager, f as exportArchive, i as NodeFS, l as SandboxOptions, n as FileArtifactStore, o as OxcSchemaInferer, p as readArchiveManifest, r as FileMemoryStore, s as ProcessSandboxExecutor, t as CliUiBridge, u as SandboxedScriptExecutor } from "./index-
|
|
4
|
+
import { a as NodeScriptExecutor, c as ProcessSandboxOptions, d as SkillManager, f as exportArchive, i as NodeFS, l as SandboxOptions, n as FileArtifactStore, o as OxcSchemaInferer, p as readArchiveManifest, r as FileMemoryStore, s as ProcessSandboxExecutor, t as CliUiBridge, u as SandboxedScriptExecutor } from "./index-DRlYzdr2.js";
|
|
5
5
|
export { CliUiBridge, FileArtifactStore, FileMemoryStore, type LlmCapabilities, type LlmEnvConfig, NodeFS, NodeScriptExecutor, OxcSchemaInferer, ProcessSandboxExecutor, type ProcessSandboxOptions, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, type SandboxOptions, SandboxedScriptExecutor, type SkillInstallSource, SkillManager, type SkillManifest, type SkillsLockfile, type VerifyResult, createScriptContext, exportArchive, probeLlmCapabilities, readArchiveManifest };
|
package/dist/node.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as SKILL_MANIFEST_FILE, r as SKILLS_LOCKFILE } from "./dist-
|
|
2
|
-
import { T as createScriptContext } from "./dist-
|
|
1
|
+
import { i as SKILL_MANIFEST_FILE, r as SKILLS_LOCKFILE } from "./dist-BQzncxXg.js";
|
|
2
|
+
import { T as createScriptContext } from "./dist-BXpDDZpR.js";
|
|
3
3
|
import { i as probeLlmCapabilities } from "./env--jJB-TSX-04klhTYi.js";
|
|
4
|
-
import { a as NodeScriptExecutor, c as SandboxedScriptExecutor, d as readArchiveManifest, i as NodeFS, l as SkillManager, n as FileArtifactStore, o as OxcSchemaInferer, r as FileMemoryStore, s as ProcessSandboxExecutor, t as CliUiBridge, u as exportArchive } from "./dist-
|
|
4
|
+
import { a as NodeScriptExecutor, c as SandboxedScriptExecutor, d as readArchiveManifest, i as NodeFS, l as SkillManager, n as FileArtifactStore, o as OxcSchemaInferer, r as FileMemoryStore, s as ProcessSandboxExecutor, t as CliUiBridge, u as exportArchive } from "./dist-DWFDb1Ww.js";
|
|
5
5
|
|
|
6
6
|
export { CliUiBridge, FileArtifactStore, FileMemoryStore, NodeFS, NodeScriptExecutor, OxcSchemaInferer, ProcessSandboxExecutor, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SandboxedScriptExecutor, SkillManager, createScriptContext, exportArchive, probeLlmCapabilities, readArchiveManifest };
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as LlmClient, d as LlmResponse, f as LlmStreamEvent, h as MemoryStore, l as LlmCompleteInput, n as ArtifactStore, o as InteractionRequest, s as InteractionResponse, t as Artifact, v as UiBridge } from "./types-CKm5G_eQ-
|
|
1
|
+
import { c as LlmClient, d as LlmResponse, f as LlmStreamEvent, h as MemoryStore, l as LlmCompleteInput, n as ArtifactStore, o as InteractionRequest, s as InteractionResponse, t as Artifact, v as UiBridge } from "./types-CKm5G_eQ-krKWW8WV.js";
|
|
2
2
|
import { a as loadGoogleConfigFromEnv, i as loadAnthropicConfigFromEnv, n as LlmEnvConfig, o as loadLlmConfigFromEnv, r as ProviderEnvConfig } from "./env-BPUBZCwJ-4jat_SVG.js";
|
|
3
3
|
//#region ../runtime/dist/testing.d.ts
|
|
4
4
|
//#region src/llm/mockLlmClient.d.ts
|
package/dist/testing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as MemoryArtifactStore } from "./memoryArtifactStore-C9lFVqPF-yFz6yJj0.js";
|
|
2
2
|
import { n as loadGoogleConfigFromEnv, r as loadLlmConfigFromEnv, t as loadAnthropicConfigFromEnv } from "./env--jJB-TSX-04klhTYi.js";
|
|
3
|
-
import { n as MockLlmClient, r as MockUiBridge, t as InMemoryStore } from "./testing-
|
|
3
|
+
import { n as MockLlmClient, r as MockUiBridge, t as InMemoryStore } from "./testing-BUoXvm1u.js";
|
|
4
4
|
|
|
5
5
|
export { InMemoryStore, MemoryArtifactStore, MockLlmClient, MockUiBridge, loadAnthropicConfigFromEnv, loadGoogleConfigFromEnv, loadLlmConfigFromEnv };
|
|
@@ -10,6 +10,8 @@ declare class WebSkillError extends Error {
|
|
|
10
10
|
readonly details?: unknown;
|
|
11
11
|
constructor(code: WebSkillErrorCode, message: string, details?: unknown);
|
|
12
12
|
}
|
|
13
|
+
/** unknown 异常取消息文本(全仓单一来源,勿再本地重复定义) */
|
|
14
|
+
declare function messageOf(e: unknown): string;
|
|
13
15
|
//#endregion
|
|
14
16
|
//#region src/contracts/jsonSchema.d.ts
|
|
15
17
|
/**
|
|
@@ -34,6 +36,10 @@ type SkillInstallSource = {
|
|
|
34
36
|
} | {
|
|
35
37
|
type: 'http';
|
|
36
38
|
url: string;
|
|
39
|
+
/** 显式允许 http://(SSRF 防护默认仅 https) */
|
|
40
|
+
allowHttp?: boolean;
|
|
41
|
+
/** 显式允许私有/环回/链路本地地址(SSRF 防护默认拒绝) */
|
|
42
|
+
allowPrivateHosts?: boolean;
|
|
37
43
|
} | {
|
|
38
44
|
type: 'archive';
|
|
39
45
|
data: ArrayBuffer;
|
|
@@ -160,7 +166,12 @@ declare class MemoryFS implements FileSystemProvider {
|
|
|
160
166
|
}
|
|
161
167
|
//#endregion
|
|
162
168
|
//#region src/fs/atomicWrite.d.ts
|
|
163
|
-
/**
|
|
169
|
+
/**
|
|
170
|
+
* 原子写文本:先写临时文件再 rename(进程崩溃不留下半写文件;lockfile 等账本场景)。
|
|
171
|
+
* 原子性强弱取决于 provider 的 rename 实现:NodeFS/MemoryFS 为真 rename;
|
|
172
|
+
* OPFS 无原生 move,rename 是 copy+delete(非原子,崩溃可能残留双份),
|
|
173
|
+
* 对崩溃一致性要求极高的场景在浏览器侧需知悉此前提。
|
|
174
|
+
*/
|
|
164
175
|
declare function atomicWriteText(fs: FileSystemProvider, path: string, content: string): Promise<void>;
|
|
165
176
|
//#endregion
|
|
166
177
|
//#region src/fs/pathSecurity.d.ts
|
|
@@ -177,6 +188,25 @@ declare function assertSafePathSegment(segment: string, kind: string): void;
|
|
|
177
188
|
*/
|
|
178
189
|
declare function resolveInsideRoot(root: string, relativePath: string): string;
|
|
179
190
|
//#endregion
|
|
191
|
+
//#region src/net/urlSafety.d.ts
|
|
192
|
+
/**
|
|
193
|
+
* SSRF 防护(单一来源:node http 安装源与 mcp 远程 endpoint 共用):
|
|
194
|
+
* - 协议限 https(http 需显式 opt-in)
|
|
195
|
+
* - 默认拒私有/环回/链路本地地址字面量(127.0.0.0/8、RFC1918、169.254.0.0/16、localhost、::1、fe80::/10)
|
|
196
|
+
* 注意:仅校验 URL 字面量主机名;DNS 解析到私有地址的 rebinding 场景不在此层覆盖。
|
|
197
|
+
*/
|
|
198
|
+
interface RemoteUrlPolicy {
|
|
199
|
+
/** 显式允许 http://(默认仅 https) */
|
|
200
|
+
allowHttp?: boolean;
|
|
201
|
+
/** 显式允许私有/环回/链路本地地址(默认拒绝) */
|
|
202
|
+
allowPrivateHosts?: boolean;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* 校验远程 URL 是否允许连接;违规抛 NETWORK_BLOCKED。
|
|
206
|
+
* rawUrl 非合法 URL 时抛 TypeError(由调用方按自身错误码包装)。
|
|
207
|
+
*/
|
|
208
|
+
declare function assertRemoteUrlAllowed(rawUrl: string, policy?: RemoteUrlPolicy): URL;
|
|
209
|
+
//#endregion
|
|
180
210
|
//#region src/skill/types.d.ts
|
|
181
211
|
type SkillSource = 'local' | 'mcp' | 'generated' | 'installed';
|
|
182
212
|
/**
|
|
@@ -586,4 +616,4 @@ interface MemoryStore {
|
|
|
586
616
|
transaction?<T>(scope: string, fn: (inner: MemoryStore) => Promise<T>): Promise<T>;
|
|
587
617
|
}
|
|
588
618
|
//#endregion
|
|
589
|
-
export {
|
|
619
|
+
export { buildCatalog as $, SKILL_NAME_MAX_LENGTH as A, SkillManifest as B, FileStat as C, RemoteUrlPolicy as D, MemoryFS as E, SkillDiscovery as F, SkillsLockfile as G, SkillPackManifest as H, SkillDocument as I, WebSkillError as J, ValidationReport as K, SkillInstallSource as L, SKILL_PACK_FILE as M, SkillCatalog as N, SKILLS_LOCKFILE as O, SkillCatalogEntry as P, atomicWriteText as Q, SkillIssue as R, DiscoveryResult as S, JsonSchema as T, SkillReader as U, SkillMetadata as V, SkillSource as W, assertRemoteUrlAllowed as X, WebSkillErrorCode as Y, assertSafePathSegment as Z, RenderResultRequest as _, unzipWithLimits as _t, InteractionPolicy as a, exportSkills as at, CatalogRenderer as b, xmlRenderer as bt, LlmClient as c, messageOf as ct, LlmResponse as d, parseSkillPackManifest as dt, buildManifest as et, LlmStreamEvent as f, readResponseWithLimit as ft, RenderBlock as g, resolveInsideRoot as gt, MemoryStore as h, resolveArchiveLimits as ht, FormField as i, escapeXml as it, SKILL_NAME_PATTERN as j, SKILL_MANIFEST_FILE as k, LlmCompleteInput as l, normalizePath as lt, LlmToolSpec as m, renderCatalogJson as mt, ArtifactStore as n, checkSkillRules as nt, InteractionRequest as o, isValidSkillName as ot, LlmToolCall as p, renderAvailableSkillsXml as pt, VerifyResult as q, ChartSpec as r, computeDigest as rt, InteractionResponse as s, jsonRenderer as st, Artifact as t, checkDependencyCycles as tt, LlmMessage as u, parseSkillMarkdown as ut, UiBridge as v, validateSkills as vt, FileSystemProvider as w, DEFAULT_ARCHIVE_LIMITS as x, ArchiveLimits as y, verifyManifest as yt, SkillLocation as z };
|
package/dist/ui-react.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as RenderResultRequest, o as InteractionRequest, s as InteractionResponse, v as UiBridge } from "./types-CKm5G_eQ-
|
|
1
|
+
import { _ as RenderResultRequest, o as InteractionRequest, s as InteractionResponse, v as UiBridge } from "./types-CKm5G_eQ-krKWW8WV.js";
|
|
2
2
|
//#region ../ui-react/dist/index.d.ts
|
|
3
3
|
//#region src/bridgeState.d.ts
|
|
4
4
|
/**
|
|
@@ -17,6 +17,8 @@ declare class ReactBridgeState implements UiBridge {
|
|
|
17
17
|
request(input: InteractionRequest): Promise<InteractionResponse>;
|
|
18
18
|
/** 组件提交/取消回调 */
|
|
19
19
|
resolve(response: InteractionResponse): void;
|
|
20
|
+
/** runtime 交互超时/取消:卸载表单并以 cancelled resolve pending Promise(防悬挂 + 残留) */
|
|
21
|
+
cancel(id: string): void;
|
|
20
22
|
renderResult(input: RenderResultRequest): Promise<void>;
|
|
21
23
|
onTextDelta(runId: string, delta: string): Promise<void>;
|
|
22
24
|
}
|
package/dist/ui-react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as renderMiniChart, E as shapeInteractionValue, h as collectValues, w as renderMiniMarkdown, x as interactionToFormModel } from "./dist-DNSG9FqC.js";
|
|
2
2
|
import { useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -39,6 +39,13 @@ var ReactBridgeState = class {
|
|
|
39
39
|
this.#emit();
|
|
40
40
|
resolver(response);
|
|
41
41
|
}
|
|
42
|
+
/** runtime 交互超时/取消:卸载表单并以 cancelled resolve pending Promise(防悬挂 + 残留) */
|
|
43
|
+
cancel(id) {
|
|
44
|
+
this.resolve({
|
|
45
|
+
id,
|
|
46
|
+
cancelled: true
|
|
47
|
+
});
|
|
48
|
+
}
|
|
42
49
|
async renderResult(input) {
|
|
43
50
|
this.latestResult = input;
|
|
44
51
|
this.#emit();
|
package/dist/ui-vue.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as RenderResultRequest, o as InteractionRequest, s as InteractionResponse, v as UiBridge } from "./types-CKm5G_eQ-
|
|
1
|
+
import { _ as RenderResultRequest, o as InteractionRequest, s as InteractionResponse, v as UiBridge } from "./types-CKm5G_eQ-krKWW8WV.js";
|
|
2
2
|
import { PropType } from "vue";
|
|
3
3
|
//#region ../ui-vue/dist/index.d.ts
|
|
4
4
|
//#region src/bridgeState.d.ts
|
|
@@ -18,6 +18,8 @@ declare class VueBridgeState implements UiBridge {
|
|
|
18
18
|
request(input: InteractionRequest): Promise<InteractionResponse>;
|
|
19
19
|
/** 组件提交/取消回调 */
|
|
20
20
|
resolve(response: InteractionResponse): void;
|
|
21
|
+
/** runtime 交互超时/取消:卸载表单并以 cancelled resolve pending Promise(防悬挂 + 残留) */
|
|
22
|
+
cancel(id: string): void;
|
|
21
23
|
renderResult(input: RenderResultRequest): Promise<void>;
|
|
22
24
|
onTextDelta(runId: string, delta: string): Promise<void>;
|
|
23
25
|
}
|
package/dist/ui-vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as renderMiniChart, E as shapeInteractionValue, h as collectValues, w as renderMiniMarkdown, x as interactionToFormModel } from "./dist-DNSG9FqC.js";
|
|
2
2
|
import { defineComponent, h, reactive, ref } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region ../ui-vue/dist/index.js
|
|
@@ -28,6 +28,13 @@ var VueBridgeState = class {
|
|
|
28
28
|
this.state.pending = null;
|
|
29
29
|
resolver(response);
|
|
30
30
|
}
|
|
31
|
+
/** runtime 交互超时/取消:卸载表单并以 cancelled resolve pending Promise(防悬挂 + 残留) */
|
|
32
|
+
cancel(id) {
|
|
33
|
+
this.resolve({
|
|
34
|
+
id,
|
|
35
|
+
cancelled: true
|
|
36
|
+
});
|
|
37
|
+
}
|
|
31
38
|
async renderResult(input) {
|
|
32
39
|
this.state.latestResult = input;
|
|
33
40
|
}
|
package/dist/ui.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as RenderResultRequest, g as RenderBlock, o as InteractionRequest, r as ChartSpec, s as InteractionResponse, v as UiBridge } from "./types-CKm5G_eQ-
|
|
2
|
-
import { mt as buildRenderResult } from "./index-
|
|
1
|
+
import { _ as RenderResultRequest, g as RenderBlock, o as InteractionRequest, r as ChartSpec, s as InteractionResponse, v as UiBridge } from "./types-CKm5G_eQ-krKWW8WV.js";
|
|
2
|
+
import { mt as buildRenderResult } from "./index-DJOha4b6.js";
|
|
3
3
|
//#region ../ui/dist/index.d.ts
|
|
4
4
|
//#region src/model/formModel.d.ts
|
|
5
5
|
interface FormModel {
|
|
@@ -35,7 +35,7 @@ interface CollectedValues {
|
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* 严格类型化控件值收集:
|
|
38
|
-
* - number 空串 → undefined(非 0)
|
|
38
|
+
* - number 空串 → undefined(非 0);非数值输入(NaN)按缺失处理(required 时入 missingRequired)
|
|
39
39
|
* - select 用 option 值本身经 JSON 编码比对命中(对象值可正确命中)
|
|
40
40
|
* - required 空值列入 missingRequired(由调用方阻止提交并标记)
|
|
41
41
|
*/
|
|
@@ -133,12 +133,15 @@ declare class VercelUiBridge implements UiBridge {
|
|
|
133
133
|
* - 每行一条语句 `identifier = Expression`,`root = Component(...)` 为入口
|
|
134
134
|
* - 组件调用参数为位置参数;字符串双引号反斜杠转义
|
|
135
135
|
* - 组件词汇(与应用 Library 约定):Form(title, children)、
|
|
136
|
+
* Text(content)(纯展示文本,authorize 的能力描述用)、
|
|
136
137
|
* TextField(name, label, required?, defaultValue?)、NumberField、BooleanField(name, label, default?)、
|
|
137
138
|
* SelectField(name, label, options)、SubmitButton(label, actionType, requestId)、
|
|
138
139
|
* CancelButton(label, actionType, requestId)
|
|
139
140
|
*/
|
|
140
141
|
declare const OPENUI_SUBMIT_ACTION = "webskill:submit";
|
|
141
142
|
declare const OPENUI_CANCEL_ACTION = "webskill:cancel";
|
|
143
|
+
/** authorize 的 Allow 专用动作(提交即批准 → value:true;Deny 走 cancel → cancelled:true) */
|
|
144
|
+
declare const OPENUI_AUTHORIZE_ACTION = "webskill:authorize";
|
|
142
145
|
/** @experimental */
|
|
143
146
|
declare function toOpenUiLang(request: InteractionRequest): string;
|
|
144
147
|
/**
|
|
@@ -170,10 +173,19 @@ interface A2uiMessage {
|
|
|
170
173
|
/** @experimental */
|
|
171
174
|
declare function toA2uiMessages(request: InteractionRequest): A2uiMessage[];
|
|
172
175
|
/**
|
|
173
|
-
*
|
|
176
|
+
* 按 InteractionRequest.type 解码提交值(绑定模型原样回传的是表单对象):
|
|
177
|
+
* confirm 仅 confirmed===true 批准;select 还原原始 option 值(非字符串值经 JSON 编码比对);
|
|
178
|
+
* form 的 number 字段转 number(NaN 保留原值);ask 取 answer;authorize 提交即批准。
|
|
179
|
+
* 纯转换器:任何直接使用 fromA2uiAction 的消费者都应经此拿到正确类型。
|
|
174
180
|
* @experimental
|
|
175
181
|
*/
|
|
176
|
-
declare function
|
|
182
|
+
declare function decodeInteractionResponse(request: InteractionRequest, response: InteractionResponse): InteractionResponse;
|
|
183
|
+
/**
|
|
184
|
+
* A2UI client→server action 事件 → InteractionResponse。
|
|
185
|
+
* 传入 request 时按类型解码提交值(见 decodeInteractionResponse)。
|
|
186
|
+
* @experimental
|
|
187
|
+
*/
|
|
188
|
+
declare function fromA2uiAction(event: unknown, request?: InteractionRequest): InteractionResponse;
|
|
177
189
|
//#endregion
|
|
178
190
|
//#region src/a2uiRuntime/litRendererBridge.d.ts
|
|
179
191
|
/** @experimental */
|
|
@@ -184,6 +196,8 @@ declare class LitRendererBridge implements UiBridge {
|
|
|
184
196
|
document?: Document;
|
|
185
197
|
});
|
|
186
198
|
request(input: InteractionRequest): Promise<InteractionResponse>;
|
|
199
|
+
/** runtime 交互超时/取消:移除 surface 并以 cancelled resolve pending Promise(防悬挂 + DOM 残留) */
|
|
200
|
+
cancel(id: string): void;
|
|
187
201
|
}
|
|
188
202
|
//#endregion
|
|
189
|
-
export { A2UI_BASIC_CATALOG_ID, A2UI_CANCEL_ACTION, A2UI_SUBMIT_ACTION, A2UI_VERSION, type A2uiMessage, CHART_PALETTE, type CollectedValues, type ControlModel, type FormModel, LitRendererBridge, OPENUI_CANCEL_ACTION, OPENUI_SUBMIT_ACTION, VERCEL_INTERACTION_TOOL_NAME, type VercelToolInvocation, VercelUiBridge, WEBSKILL_STYLES_CSS, WebFormBridge, buildRenderResult, chartToTable, collectValues, ensureStyles, fromA2uiAction, fromOpenUiAction, fromVercelToolResult, interactionToFormModel, renderBlocks, renderMiniChart, renderMiniMarkdown, renderRenderResult, shapeInteractionValue, toA2uiMessages, toOpenUiLang, toVercelToolInvocation };
|
|
203
|
+
export { A2UI_BASIC_CATALOG_ID, A2UI_CANCEL_ACTION, A2UI_SUBMIT_ACTION, A2UI_VERSION, type A2uiMessage, CHART_PALETTE, type CollectedValues, type ControlModel, type FormModel, LitRendererBridge, OPENUI_AUTHORIZE_ACTION, OPENUI_CANCEL_ACTION, OPENUI_SUBMIT_ACTION, VERCEL_INTERACTION_TOOL_NAME, type VercelToolInvocation, VercelUiBridge, WEBSKILL_STYLES_CSS, WebFormBridge, buildRenderResult, chartToTable, collectValues, decodeInteractionResponse, ensureStyles, fromA2uiAction, fromOpenUiAction, fromVercelToolResult, interactionToFormModel, renderBlocks, renderMiniChart, renderMiniMarkdown, renderRenderResult, shapeInteractionValue, toA2uiMessages, toOpenUiLang, toVercelToolInvocation };
|
package/dist/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { w as buildRenderResult } from "./dist-
|
|
2
|
-
import { C as
|
|
1
|
+
import { w as buildRenderResult } from "./dist-BXpDDZpR.js";
|
|
2
|
+
import { C as renderMiniChart, D as toA2uiMessages, E as shapeInteractionValue, O as toOpenUiLang, S as renderBlocks, T as renderRenderResult, _ as ensureStyles, a as CHART_PALETTE, b as fromVercelToolResult, c as OPENUI_CANCEL_ACTION, d as VercelUiBridge, f as WEBSKILL_STYLES_CSS, g as decodeInteractionResponse, h as collectValues, i as A2UI_VERSION, k as toVercelToolInvocation, l as OPENUI_SUBMIT_ACTION, m as chartToTable, n as A2UI_CANCEL_ACTION, o as LitRendererBridge, p as WebFormBridge, r as A2UI_SUBMIT_ACTION, s as OPENUI_AUTHORIZE_ACTION, t as A2UI_BASIC_CATALOG_ID, u as VERCEL_INTERACTION_TOOL_NAME, v as fromA2uiAction, w as renderMiniMarkdown, x as interactionToFormModel, y as fromOpenUiAction } from "./dist-DNSG9FqC.js";
|
|
3
3
|
|
|
4
|
-
export { A2UI_BASIC_CATALOG_ID, A2UI_CANCEL_ACTION, A2UI_SUBMIT_ACTION, A2UI_VERSION, CHART_PALETTE, LitRendererBridge, OPENUI_CANCEL_ACTION, OPENUI_SUBMIT_ACTION, VERCEL_INTERACTION_TOOL_NAME, VercelUiBridge, WEBSKILL_STYLES_CSS, WebFormBridge, buildRenderResult, chartToTable, collectValues, ensureStyles, fromA2uiAction, fromOpenUiAction, fromVercelToolResult, interactionToFormModel, renderBlocks, renderMiniChart, renderMiniMarkdown, renderRenderResult, shapeInteractionValue, toA2uiMessages, toOpenUiLang, toVercelToolInvocation };
|
|
4
|
+
export { A2UI_BASIC_CATALOG_ID, A2UI_CANCEL_ACTION, A2UI_SUBMIT_ACTION, A2UI_VERSION, CHART_PALETTE, LitRendererBridge, OPENUI_AUTHORIZE_ACTION, OPENUI_CANCEL_ACTION, OPENUI_SUBMIT_ACTION, VERCEL_INTERACTION_TOOL_NAME, VercelUiBridge, WEBSKILL_STYLES_CSS, WebFormBridge, buildRenderResult, chartToTable, collectValues, decodeInteractionResponse, ensureStyles, fromA2uiAction, fromOpenUiAction, fromVercelToolResult, interactionToFormModel, renderBlocks, renderMiniChart, renderMiniMarkdown, renderRenderResult, shapeInteractionValue, toA2uiMessages, toOpenUiLang, toVercelToolInvocation };
|