@webskill/sdk 0.2.3 → 0.2.5
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 +3 -2
- package/dist/browser.js +47 -15
- package/dist/{dist-NM4Mylx4.js → dist-B77plHjw.js} +230 -105
- package/dist/{dist-D0saNPi_.js → dist-BQzncxXg.js} +98 -5
- package/dist/{dist-CvIMVwr3.js → dist-Chk8iB-E.js} +101 -38
- package/dist/{dist-BJobG0i-.js → dist-DNSG9FqC.js} +108 -69
- package/dist/governance.d.ts +13 -5
- package/dist/governance.js +50 -20
- package/dist/{index-iqcz3_NS.d.ts → index-CsDJvYGV.d.ts} +8 -3
- package/dist/{index-gjFuBevI.d.ts → index-DfINBEOy.d.ts} +29 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/mcp.d.ts +7 -3
- package/dist/mcp.js +35 -18
- package/dist/node.d.ts +3 -3
- package/dist/node.js +3 -3
- package/dist/processSandboxEntry.js +11 -0
- package/dist/sandboxWorkerEntry.js +11 -0
- package/dist/{testing-B4pq6JYa.js → testing-BUoXvm1u.js} +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/dist/{types-CKm5G_eQ-8W8FnP4u.d.ts → types-CKm5G_eQ-krKWW8WV.d.ts} +40 -7
- 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.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as SerializingMemoryStore, A as LifecycleHook, B as RUN_SNAPSHOT_SCHEMA_VERSION, C as FullDisclosureRouter, Ct as
|
|
3
|
-
export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, type AgentLoopConfig, type AgentLoopDeps, AnthropicClient, type AnthropicClientConfig, type ApprovalDecision, type ApprovalScope, type ArchiveLimits, type Artifact, type ArtifactStore, type BridgeCapabilities, type BridgeCapability, type BridgeRequest, type BridgeResponse, CapabilityApproval, type CapabilityMode, type CatalogRenderer, type ChartSpec, DEFAULT_ARCHIVE_LIMITS, type DiscoveryResult, EventBus, type ExternalSkillProvider, type ExternalToolSource, type FileStat, type FileSystemProvider, type FormField, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FullDisclosureRouter, GoogleGenAiClient, type GoogleGenAiClientConfig, HookRunner, type HookRunnerOptions, type InstalledSkillManifest, type InteractionPolicy, type InteractionRequest, type InteractionResponse, type JsonSchema, type LifecycleEvent, type LifecycleHook, type LifecycleHookContext, type LifecycleListener, type LlmClient, type LlmCompleteInput, type LlmMessage, type LlmResponse, type LlmStreamEvent, type LlmToolCall, type LlmToolSpec, MemoryFS, type MemoryStore, type NetworkPolicy, OpenAiCompatibleClient, type OpenAiCompatibleClientConfig, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, RUN_SNAPSHOT_SCHEMA_VERSION, type RenderBlock, type RenderResultRequest, type RouteResult, type RunResult, type RunSnapshot, type RunSnapshotStore, type RunTerminationReason, type RuntimePhase, type RuntimeRun, type RuntimeSession, type RuntimeSessionHandle, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SKILL_PACK_FILE, type SchemaInferer, type ScriptExecutionContext, type ScriptExecutor, SerializingMemoryStore, type SkillCatalog, type SkillCatalogEntry, SkillDiscovery, type SkillDocument, type SkillInstallSource, type SkillIssue, type SkillLocation, type SkillManifest, type SkillMetadata, type SkillPackManifest, SkillReader, type SkillRouter, type SkillSource, type SkillStateGuard, type SkillsLockfile, type ToolDefinition, type ToolResolution, type ToolResult, type TraceClock, type TraceEvent, type TraceEventType, TraceRecorder, type UiBridge, type ValidationReport, type VercelToolSpec, type VerifyResult, type WebSkillApi, WebSkillError, type WebSkillErrorCode, WebSkillRuntime, type WebSkillRuntimeDeps, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isValidSkillName, jsonRenderer, mergeCatalogEntries, networkUrlHost, normalizePath, normalizeToolContent, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, readResponseWithLimit, renderAvailableSkillsXml, renderCatalogJson, resolveArchiveLimits, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, unzipWithLimits, validateSkills, verifyManifest, xmlRenderer };
|
|
1
|
+
import { $ as buildCatalog, A as SKILL_NAME_MAX_LENGTH, B as SkillManifest, C as FileStat, D as RemoteUrlPolicy, E as MemoryFS, F as SkillDiscovery, G as SkillsLockfile, H as SkillPackManifest, I as SkillDocument, J as WebSkillError, K as ValidationReport, L as SkillInstallSource, M as SKILL_PACK_FILE, N as SkillCatalog, O as SKILLS_LOCKFILE, P as SkillCatalogEntry, Q as atomicWriteText, R as SkillIssue, S as DiscoveryResult, T as JsonSchema, U as SkillReader, V as SkillMetadata, W as SkillSource, X as assertRemoteUrlAllowed, Y as WebSkillErrorCode, Z as assertSafePathSegment, _ as RenderResultRequest, _t as unzipWithLimits, a as InteractionPolicy, at as exportSkills, b as CatalogRenderer, bt as xmlRenderer, c as LlmClient, ct as messageOf, d as LlmResponse, dt as parseSkillPackManifest, et as buildManifest, f as LlmStreamEvent, ft as readResponseWithLimit, g as RenderBlock, gt as resolveInsideRoot, h as MemoryStore, ht as resolveArchiveLimits, i as FormField, it as escapeXml, j as SKILL_NAME_PATTERN, k as SKILL_MANIFEST_FILE, l as LlmCompleteInput, lt as normalizePath, m as LlmToolSpec, mt as renderCatalogJson, n as ArtifactStore, nt as checkSkillRules, o as InteractionRequest, ot as isValidSkillName, p as LlmToolCall, pt as renderAvailableSkillsXml, q as VerifyResult, r as ChartSpec, rt as computeDigest, s as InteractionResponse, st as jsonRenderer, t as Artifact, tt as checkDependencyCycles, u as LlmMessage, ut as parseSkillMarkdown, v as UiBridge, vt as validateSkills, w as FileSystemProvider, x as DEFAULT_ARCHIVE_LIMITS, y as ArchiveLimits, yt as verifyManifest, z as SkillLocation } from "./types-CKm5G_eQ-krKWW8WV.js";
|
|
2
|
+
import { $ as SerializingMemoryStore, A as LifecycleHook, At as toVercelToolSpecs, B as RUN_SNAPSHOT_SCHEMA_VERSION, C as FullDisclosureRouter, Ct as normalizeErrorCode, D as HookRunnerOptions, Dt as resolveToolName, E as HookRunner, Et as parseBridgeRequest, F as OpenAiCompatibleClientConfig, G as RunTerminationReason, H as RunResult, I as ProgressiveRouter, J as RuntimeSession, K as RuntimePhase, L as READ_SKILL_FILE_INPUT_SCHEMA, M as LifecycleListener, N as NetworkPolicy, O as InstalledSkillManifest, Ot as schemaToForm, P as OpenAiCompatibleClient, Q as ScriptExecutor, R as READ_SKILL_FILE_TOOL, S as FsRunSnapshotStore, St as networkUrlHost, T as GoogleGenAiClientConfig, Tt as normalizeToolError, U as RunSnapshot, V as RouteResult, W as RunSnapshotStore, X as SchemaInferer, Y as RuntimeSessionHandle, Z as ScriptExecutionContext, _ as EventBus, _t as extractChartSpec, a as AgentLoopConfig, at as TraceClock, b as FsArtifactStore, bt as isNetworkAllowed, c as AnthropicClientConfig, ct as TraceRecorder, d as BridgeCapabilities, dt as WebSkillRuntime, et as SkillRouter, f as BridgeCapability, ft as WebSkillRuntimeDeps, g as CapabilityMode, gt as createWebSkillApi, h as CapabilityApproval, ht as createScriptContext, i as AgentLoop, it as ToolResult, j as LifecycleHookContext, k as LifecycleEvent, kt as toLlmToolSpec, l as ApprovalDecision, lt as VercelToolSpec, m as BridgeResponse, mt as buildRenderResult, n as ASK_USER_TOOL, nt as ToolDefinition, o as AgentLoopDeps, ot as TraceEvent, p as BridgeRequest, pt as bridgeError, q as RuntimeRun, r as ASK_USER_TOOL_NAME, rt as ToolResolution, s as AnthropicClient, st as TraceEventType, t as ASK_USER_INPUT_SCHEMA, tt as SkillStateGuard, u as ApprovalScope, ut as WebSkillApi, v as ExternalSkillProvider, vt as fromVercelResult, w as GoogleGenAiClient, wt as normalizeToolContent, x as FsMemoryStore, xt as mergeCatalogEntries, y as ExternalToolSource, yt as fromVercelStreamPart, z as READ_SKILL_FILE_TOOL_NAME } from "./index-DfINBEOy.js";
|
|
3
|
+
export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, type AgentLoopConfig, type AgentLoopDeps, AnthropicClient, type AnthropicClientConfig, type ApprovalDecision, type ApprovalScope, type ArchiveLimits, type Artifact, type ArtifactStore, type BridgeCapabilities, type BridgeCapability, type BridgeRequest, type BridgeResponse, CapabilityApproval, type CapabilityMode, type CatalogRenderer, type ChartSpec, DEFAULT_ARCHIVE_LIMITS, type DiscoveryResult, EventBus, type ExternalSkillProvider, type ExternalToolSource, type FileStat, type FileSystemProvider, type FormField, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FullDisclosureRouter, GoogleGenAiClient, type GoogleGenAiClientConfig, HookRunner, type HookRunnerOptions, type InstalledSkillManifest, type InteractionPolicy, type InteractionRequest, type InteractionResponse, type JsonSchema, type LifecycleEvent, type LifecycleHook, type LifecycleHookContext, type LifecycleListener, type LlmClient, type LlmCompleteInput, type LlmMessage, type LlmResponse, type LlmStreamEvent, type LlmToolCall, type LlmToolSpec, MemoryFS, type MemoryStore, type NetworkPolicy, OpenAiCompatibleClient, type OpenAiCompatibleClientConfig, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, RUN_SNAPSHOT_SCHEMA_VERSION, type RemoteUrlPolicy, type RenderBlock, type RenderResultRequest, type RouteResult, type RunResult, type RunSnapshot, type RunSnapshotStore, type RunTerminationReason, type RuntimePhase, type RuntimeRun, type RuntimeSession, type RuntimeSessionHandle, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SKILL_PACK_FILE, type SchemaInferer, type ScriptExecutionContext, type ScriptExecutor, SerializingMemoryStore, type SkillCatalog, type SkillCatalogEntry, SkillDiscovery, type SkillDocument, type SkillInstallSource, type SkillIssue, type SkillLocation, type SkillManifest, type SkillMetadata, type SkillPackManifest, SkillReader, type SkillRouter, type SkillSource, type SkillStateGuard, type SkillsLockfile, type ToolDefinition, type ToolResolution, type ToolResult, type TraceClock, type TraceEvent, type TraceEventType, TraceRecorder, type UiBridge, type ValidationReport, type VercelToolSpec, type VerifyResult, type WebSkillApi, WebSkillError, type WebSkillErrorCode, WebSkillRuntime, type WebSkillRuntimeDeps, 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/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { A as isNetworkAllowed, C as bridgeError, D as extractChartSpec, E as createWebSkillApi, F as
|
|
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-B77plHjw.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, normalizePath, normalizeToolContent, 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-DfINBEOy.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";
|
|
@@ -63,7 +63,7 @@ declare class MessageChannelTransport implements Transport {
|
|
|
63
63
|
/** endpoint 名 → client 注册表;单调版本号,事件驱动等待(禁止轮询) */
|
|
64
64
|
declare class EndpointRegistry<TClient> {
|
|
65
65
|
#private;
|
|
66
|
-
/** 注册新 endpoint
|
|
66
|
+
/** 注册新 endpoint;重名抛错;含 `__`(endpoint:tool 分隔符)或保留名 mcp 拒绝 */
|
|
67
67
|
register(endpoint: string, client: TClient): void;
|
|
68
68
|
/** 热替换 client,版本号 +1 */
|
|
69
69
|
set(endpoint: string, client: TClient): void;
|
|
@@ -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 {
|
|
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-B77plHjw.js";
|
|
3
3
|
|
|
4
4
|
//#region ../mcp/dist/index.js
|
|
5
5
|
/**
|
|
@@ -117,8 +117,9 @@ var EndpointRegistry = class {
|
|
|
117
117
|
#clients = /* @__PURE__ */ new Map();
|
|
118
118
|
#versions = /* @__PURE__ */ new Map();
|
|
119
119
|
#waiters = /* @__PURE__ */ new Map();
|
|
120
|
-
/** 注册新 endpoint
|
|
120
|
+
/** 注册新 endpoint;重名抛错;含 `__`(endpoint:tool 分隔符)或保留名 mcp 拒绝 */
|
|
121
121
|
register(endpoint, client) {
|
|
122
|
+
if (endpoint.includes("__") || endpoint === "mcp") throw new Error(`Endpoint name ${JSON.stringify(endpoint)} is not allowed (no "__" segments, "mcp" is reserved)`);
|
|
122
123
|
if (this.#clients.has(endpoint)) throw new Error(`Endpoint "${endpoint}" is already registered`);
|
|
123
124
|
this.#clients.set(endpoint, client);
|
|
124
125
|
this.#versions.set(endpoint, (this.#versions.get(endpoint) ?? 0) + 1);
|
|
@@ -171,7 +172,8 @@ var EndpointRegistry = class {
|
|
|
171
172
|
for (const resolve of queue) resolve(client);
|
|
172
173
|
}
|
|
173
174
|
};
|
|
174
|
-
|
|
175
|
+
/** MCP 结果单项 text 上限(64KB) */
|
|
176
|
+
const MAX_MCP_RESULT_TEXT_BYTES = 64 * 1024;
|
|
175
177
|
const failure$1 = (code, message) => ({
|
|
176
178
|
ok: false,
|
|
177
179
|
content: [],
|
|
@@ -196,20 +198,20 @@ var McpToolResolver = class {
|
|
|
196
198
|
try {
|
|
197
199
|
client = this.#registry.get(endpoint);
|
|
198
200
|
} catch (e) {
|
|
199
|
-
return failure$1("MCP_ENDPOINT_UNAVAILABLE", messageOf
|
|
201
|
+
return failure$1("MCP_ENDPOINT_UNAVAILABLE", messageOf(e));
|
|
200
202
|
}
|
|
201
203
|
let names;
|
|
202
204
|
try {
|
|
203
205
|
names = await this.#toolNames(endpoint, client);
|
|
204
206
|
} catch (e) {
|
|
205
|
-
return failure$1("MCP_ENDPOINT_UNAVAILABLE", `Failed to list tools: ${messageOf
|
|
207
|
+
return failure$1("MCP_ENDPOINT_UNAVAILABLE", `Failed to list tools: ${messageOf(e)}`);
|
|
206
208
|
}
|
|
207
209
|
if (!names.has(toolName)) {
|
|
208
210
|
this.#cache.delete(endpoint);
|
|
209
211
|
try {
|
|
210
212
|
names = await this.#toolNames(endpoint, client);
|
|
211
213
|
} catch (e) {
|
|
212
|
-
return failure$1("MCP_ENDPOINT_UNAVAILABLE", `Failed to list tools: ${messageOf
|
|
214
|
+
return failure$1("MCP_ENDPOINT_UNAVAILABLE", `Failed to list tools: ${messageOf(e)}`);
|
|
213
215
|
}
|
|
214
216
|
if (!names.has(toolName)) return failure$1("MCP_TOOL_NOT_FOUND", `Tool "${toolName}" not found on endpoint "${endpoint}"`);
|
|
215
217
|
}
|
|
@@ -220,7 +222,7 @@ var McpToolResolver = class {
|
|
|
220
222
|
});
|
|
221
223
|
return this.#normalizeCallResult(raw);
|
|
222
224
|
} catch (e) {
|
|
223
|
-
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)}`);
|
|
224
226
|
}
|
|
225
227
|
}
|
|
226
228
|
async #toolNames(endpoint, client) {
|
|
@@ -235,14 +237,16 @@ var McpToolResolver = class {
|
|
|
235
237
|
});
|
|
236
238
|
return names;
|
|
237
239
|
}
|
|
238
|
-
/** CallToolResult → ToolResult;isError
|
|
240
|
+
/** CallToolResult → ToolResult;isError 转失败;形状消毒(无 content 且无 isError 不当作 ok)+ 大小上限 */
|
|
239
241
|
#normalizeCallResult(raw) {
|
|
240
242
|
const result = raw;
|
|
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)}`);
|
|
241
244
|
const content = normalizeToolContent(result?.content ?? raw);
|
|
242
245
|
if (result?.isError === true) {
|
|
243
246
|
const text = content.map((c) => c.text ?? "").filter(Boolean).join("\n");
|
|
244
247
|
return failure$1("TOOL_EXECUTION_FAILED", text || "MCP tool returned an error");
|
|
245
248
|
}
|
|
249
|
+
for (const item of content) if (item.text !== void 0 && item.text.length > MAX_MCP_RESULT_TEXT_BYTES) item.text = `${item.text.slice(0, MAX_MCP_RESULT_TEXT_BYTES)}…[truncated ${item.text.length - MAX_MCP_RESULT_TEXT_BYTES} chars]`;
|
|
246
250
|
return {
|
|
247
251
|
ok: true,
|
|
248
252
|
content
|
|
@@ -267,7 +271,6 @@ function webMcpToolLlmName(toolName) {
|
|
|
267
271
|
function parseWebMcpToolLlmName(llmName) {
|
|
268
272
|
return llmName.startsWith("mcp__") && llmName.length > 5 ? llmName.slice(5) : void 0;
|
|
269
273
|
}
|
|
270
|
-
const messageOf$2 = (e) => e instanceof Error ? e.message : String(e);
|
|
271
274
|
const textOfContent = (content) => {
|
|
272
275
|
if (typeof content === "string") return content;
|
|
273
276
|
if (typeof content === "object" && content !== null) {
|
|
@@ -313,7 +316,7 @@ var TemporarySkillProvider = class {
|
|
|
313
316
|
try {
|
|
314
317
|
result = await client.getPrompt({ name });
|
|
315
318
|
} catch (e) {
|
|
316
|
-
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);
|
|
317
320
|
}
|
|
318
321
|
const body = (result.messages ?? []).map((m) => textOfContent(m.content)).filter(Boolean).join("\n\n");
|
|
319
322
|
return {
|
|
@@ -338,7 +341,7 @@ var TemporarySkillProvider = class {
|
|
|
338
341
|
try {
|
|
339
342
|
return this.#registry.get(this.#endpoint);
|
|
340
343
|
} catch (e) {
|
|
341
|
-
throw new WebSkillError("MCP_ENDPOINT_UNAVAILABLE", messageOf
|
|
344
|
+
throw new WebSkillError("MCP_ENDPOINT_UNAVAILABLE", messageOf(e), e);
|
|
342
345
|
}
|
|
343
346
|
}
|
|
344
347
|
};
|
|
@@ -381,7 +384,6 @@ async function serveSkillAsMcp(server, skill) {
|
|
|
381
384
|
* 实现单一来源在 runtime(runtime 自身合并也用同一函数)。
|
|
382
385
|
*/
|
|
383
386
|
const catalogMerge = mergeCatalogEntries;
|
|
384
|
-
const messageOf$1 = (e) => e instanceof Error ? e.message : String(e);
|
|
385
387
|
const failure = (code, message) => ({
|
|
386
388
|
ok: false,
|
|
387
389
|
content: [],
|
|
@@ -414,7 +416,7 @@ var ExperimentalWebMcpAdapter = class {
|
|
|
414
416
|
this.#enabled = options?.enabled ?? false;
|
|
415
417
|
}
|
|
416
418
|
isAvailable() {
|
|
417
|
-
return typeof this.#resolveApi()?.executeTool === "function";
|
|
419
|
+
return this.#enabled && typeof this.#resolveApi()?.executeTool === "function";
|
|
418
420
|
}
|
|
419
421
|
/** 工具清单(listTools 缺失/失败时返回 undefined);描述含 inputSchema 时透传 */
|
|
420
422
|
async listTools() {
|
|
@@ -444,7 +446,7 @@ var ExperimentalWebMcpAdapter = class {
|
|
|
444
446
|
content: normalizeToolContent(await api.executeTool(toolName, JSON.stringify(args)))
|
|
445
447
|
};
|
|
446
448
|
} catch (e) {
|
|
447
|
-
return failure("TOOL_EXECUTION_FAILED", `WebMCP tool "${toolName}" failed: ${messageOf
|
|
449
|
+
return failure("TOOL_EXECUTION_FAILED", `WebMCP tool "${toolName}" failed: ${messageOf(e)}`);
|
|
448
450
|
}
|
|
449
451
|
}
|
|
450
452
|
};
|
|
@@ -540,7 +542,6 @@ async function loadMcpSdk() {
|
|
|
540
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);
|
|
541
543
|
}
|
|
542
544
|
}
|
|
543
|
-
const messageOf = (e) => e instanceof Error ? e.message : String(e);
|
|
544
545
|
/**
|
|
545
546
|
* 远程 MCP endpoint 装配:SDK 官方 StreamableHTTPClientTransport(默认)/
|
|
546
547
|
* SSEClientTransport(遗留)连接远端 server,注册进 EndpointRegistry——
|
|
@@ -549,7 +550,16 @@ const messageOf = (e) => e instanceof Error ? e.message : String(e);
|
|
|
549
550
|
*/
|
|
550
551
|
async function connectRemoteEndpoint(registry, config) {
|
|
551
552
|
const { Client, SSEClientTransport, StreamableHTTPClientTransport } = await loadMcpSdk();
|
|
552
|
-
|
|
553
|
+
let url;
|
|
554
|
+
try {
|
|
555
|
+
url = new URL(config.url);
|
|
556
|
+
} catch (e) {
|
|
557
|
+
throw new WebSkillError("MCP_ENDPOINT_UNAVAILABLE", `Invalid remote MCP endpoint URL for "${config.endpoint}": ${JSON.stringify(config.url)}`, e);
|
|
558
|
+
}
|
|
559
|
+
assertRemoteUrlAllowed(url.href, {
|
|
560
|
+
allowHttp: config.allowHttp ?? false,
|
|
561
|
+
allowPrivateHosts: config.allowPrivateHosts ?? false
|
|
562
|
+
});
|
|
553
563
|
const requestInit = config.headers ? { headers: config.headers } : void 0;
|
|
554
564
|
const transport = config.transport === "sse" ? new SSEClientTransport(url, { ...requestInit ? { requestInit } : {} }) : new StreamableHTTPClientTransport(url, { ...requestInit ? { requestInit } : {} });
|
|
555
565
|
const client = new Client({
|
|
@@ -570,7 +580,14 @@ async function connectRemoteEndpoint(registry, config) {
|
|
|
570
580
|
} catch {}
|
|
571
581
|
throw unavailable(e);
|
|
572
582
|
}
|
|
573
|
-
|
|
583
|
+
try {
|
|
584
|
+
registry.register(config.endpoint, client);
|
|
585
|
+
} catch (e) {
|
|
586
|
+
try {
|
|
587
|
+
await client.close();
|
|
588
|
+
} catch {}
|
|
589
|
+
throw unavailable(e);
|
|
590
|
+
}
|
|
574
591
|
let closed = false;
|
|
575
592
|
return { close: async () => {
|
|
576
593
|
if (closed) return;
|
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-DfINBEOy.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-CsDJvYGV.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-B77plHjw.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-Chk8iB-E.js";
|
|
5
5
|
|
|
6
6
|
export { CliUiBridge, FileArtifactStore, FileMemoryStore, NodeFS, NodeScriptExecutor, OxcSchemaInferer, ProcessSandboxExecutor, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SandboxedScriptExecutor, SkillManager, createScriptContext, exportArchive, probeLlmCapabilities, readArchiveManifest };
|
|
@@ -16,6 +16,16 @@ import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
|
16
16
|
* runtime/sandbox/networkPolicy.ts);node:net 裸模块为已知残余面(文档明示)。
|
|
17
17
|
* .js 走 data: URL 导入(permission 下实证可用);.ts 走中性临时目录 file URL。
|
|
18
18
|
*/
|
|
19
|
+
/** 不可序列化返回值统一报错(不静默丢数据;0.2.4 跨执行器语义统一) */
|
|
20
|
+
function assertSerializable(value) {
|
|
21
|
+
try {
|
|
22
|
+
structuredClone(value);
|
|
23
|
+
} catch (e) {
|
|
24
|
+
const err = /* @__PURE__ */ new Error(`Script returned a non-serializable value: ${e instanceof Error ? e.message : String(e)}`);
|
|
25
|
+
err.code = "TOOL_EXECUTION_FAILED";
|
|
26
|
+
throw err;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
19
29
|
const send = (message) => {
|
|
20
30
|
process.send?.(message);
|
|
21
31
|
};
|
|
@@ -164,6 +174,7 @@ async function main(task) {
|
|
|
164
174
|
};
|
|
165
175
|
const runFn = mod["run"];
|
|
166
176
|
const value = await runFn(task.args ?? {}, context);
|
|
177
|
+
assertSerializable(value);
|
|
167
178
|
send({
|
|
168
179
|
type: "execute-result",
|
|
169
180
|
ok: true,
|
|
@@ -67,6 +67,16 @@ async function loadModule(scriptPath, scriptSource) {
|
|
|
67
67
|
}
|
|
68
68
|
return await import(`${pathToFileURL(scriptPath).href}?t=${Date.now()}`);
|
|
69
69
|
}
|
|
70
|
+
/** 不可序列化返回值统一报错(不静默丢数据;0.2.4 跨执行器语义统一) */
|
|
71
|
+
function assertSerializable(value) {
|
|
72
|
+
try {
|
|
73
|
+
structuredClone(value);
|
|
74
|
+
} catch (e) {
|
|
75
|
+
const err = /* @__PURE__ */ new Error(`Script returned a non-serializable value: ${e instanceof Error ? e.message : String(e)}`);
|
|
76
|
+
err.code = "TOOL_EXECUTION_FAILED";
|
|
77
|
+
throw err;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
70
80
|
function post(message) {
|
|
71
81
|
port.postMessage(message);
|
|
72
82
|
}
|
|
@@ -216,6 +226,7 @@ async function main() {
|
|
|
216
226
|
};
|
|
217
227
|
const runFn = mod["run"];
|
|
218
228
|
const value = await runFn(task.args ?? {}, context);
|
|
229
|
+
assertSerializable(value);
|
|
219
230
|
post({
|
|
220
231
|
type: "execute-result",
|
|
221
232
|
ok: true,
|
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;
|
|
@@ -118,6 +124,8 @@ interface FileSystemProvider {
|
|
|
118
124
|
readonly kind: string;
|
|
119
125
|
readText(path: string): Promise<string>;
|
|
120
126
|
writeText(path: string, content: string): Promise<void>;
|
|
127
|
+
/** 真追加(审计日志等 append-only 账本;不整读改写) */
|
|
128
|
+
appendText(path: string, content: string): Promise<void>;
|
|
121
129
|
readBinary(path: string): Promise<Uint8Array>;
|
|
122
130
|
writeBinary(path: string, content: Uint8Array): Promise<void>;
|
|
123
131
|
exists(path: string): Promise<boolean>;
|
|
@@ -129,6 +137,11 @@ interface FileSystemProvider {
|
|
|
129
137
|
}): Promise<void>;
|
|
130
138
|
/** 原子重命名(lockfile 等先写临时文件再 rename 的场景;实现侧无原生 rename 时 copy+remove 兜底) */
|
|
131
139
|
rename(from: string, to: string): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* 可选:返回 root 限定视图(realpath 包含校验全方法生效)。
|
|
142
|
+
* 实现:NodeFS 支持;缺省(无此方法)时调用方按词法校验降级。
|
|
143
|
+
*/
|
|
144
|
+
withRoot?(root: string): FileSystemProvider;
|
|
132
145
|
}
|
|
133
146
|
//#endregion
|
|
134
147
|
//#region src/fs/memoryFs.d.ts
|
|
@@ -139,6 +152,7 @@ declare class MemoryFS implements FileSystemProvider {
|
|
|
139
152
|
constructor();
|
|
140
153
|
readText(path: string): Promise<string>;
|
|
141
154
|
writeText(path: string, content: string): Promise<void>;
|
|
155
|
+
appendText(path: string, content: string): Promise<void>;
|
|
142
156
|
readBinary(path: string): Promise<Uint8Array>;
|
|
143
157
|
writeBinary(path: string, content: Uint8Array): Promise<void>;
|
|
144
158
|
exists(path: string): Promise<boolean>;
|
|
@@ -152,17 +166,17 @@ declare class MemoryFS implements FileSystemProvider {
|
|
|
152
166
|
}
|
|
153
167
|
//#endregion
|
|
154
168
|
//#region src/fs/atomicWrite.d.ts
|
|
155
|
-
/**
|
|
169
|
+
/**
|
|
170
|
+
* 原子写文本:先写临时文件再 rename(进程崩溃不留下半写文件;lockfile 等账本场景)。
|
|
171
|
+
* 原子性强弱取决于 provider 的 rename 实现:NodeFS/MemoryFS 为真 rename;
|
|
172
|
+
* OPFS 无原生 move,rename 是 copy+delete(非原子,崩溃可能残留双份),
|
|
173
|
+
* 对崩溃一致性要求极高的场景在浏览器侧需知悉此前提。
|
|
174
|
+
*/
|
|
156
175
|
declare function atomicWriteText(fs: FileSystemProvider, path: string, content: string): Promise<void>;
|
|
157
176
|
//#endregion
|
|
158
177
|
//#region src/fs/pathSecurity.d.ts
|
|
159
178
|
/** 统一分隔符为 `/`,去除 `.` 段与重复分隔符(不解析 `..`) */
|
|
160
179
|
declare function normalizePath(path: string): string;
|
|
161
|
-
/**
|
|
162
|
-
* 外部标识(runId、candidateId、skillName、versionId 等)作为单一路径段使用前的统一校验:
|
|
163
|
-
* 拒绝空串、`.`、`..`、含 `/` 或 `\`、含 `:`(Windows 盘符/ADS)。
|
|
164
|
-
* 违规抛 FS_PATH_OUTSIDE_ROOT(kind 用于错误消息定位,如 "runId")。
|
|
165
|
-
*/
|
|
166
180
|
declare function assertSafePathSegment(segment: string, kind: string): void;
|
|
167
181
|
/**
|
|
168
182
|
* 将相对路径安全地解析到 root 之内。
|
|
@@ -174,6 +188,25 @@ declare function assertSafePathSegment(segment: string, kind: string): void;
|
|
|
174
188
|
*/
|
|
175
189
|
declare function resolveInsideRoot(root: string, relativePath: string): string;
|
|
176
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
|
|
177
210
|
//#region src/skill/types.d.ts
|
|
178
211
|
type SkillSource = 'local' | 'mcp' | 'generated' | 'installed';
|
|
179
212
|
/**
|
|
@@ -583,4 +616,4 @@ interface MemoryStore {
|
|
|
583
616
|
transaction?<T>(scope: string, fn: (inner: MemoryStore) => Promise<T>): Promise<T>;
|
|
584
617
|
}
|
|
585
618
|
//#endregion
|
|
586
|
-
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-DfINBEOy.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-B77plHjw.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 };
|