@webskill/sdk 0.1.5 → 0.2.1
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/README.md +16 -10
- package/dist/browser.d.ts +37 -3
- package/dist/browser.js +106 -8
- package/dist/{dist-CfBOjJ4p.js → dist-BJobG0i-.js} +30 -7
- package/dist/{dist-LIFS3ZjI.js → dist-BRGQcLqR.js} +405 -179
- package/dist/{dist-fZFZaf43.js → dist-D0saNPi_.js} +22 -4
- package/dist/{dist-DuGN5x0v.js → dist-DrySSQ5R.js} +185 -50
- package/dist/env--jJB-TSX-04klhTYi.js +143 -0
- package/dist/env-BPUBZCwJ-4jat_SVG.d.ts +38 -0
- package/dist/governance.d.ts +43 -7
- package/dist/governance.js +168 -11
- package/dist/{index-Bun1aEf4.d.ts → index-BmzysJX5.d.ts} +48 -38
- package/dist/{index-COuOu6gw.d.ts → index-gjFuBevI.d.ts} +53 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/mcp.d.ts +3 -3
- package/dist/mcp.js +28 -8
- package/dist/node.d.ts +5 -4
- package/dist/node.js +5 -4
- package/dist/processSandboxEntry.d.ts +1 -0
- package/dist/processSandboxEntry.js +202 -0
- package/dist/{testing-BmR48Pn1.js → testing-B4pq6JYa.js} +1 -1
- package/dist/testing.d.ts +3 -2
- package/dist/testing.js +3 -2
- package/dist/{types-CgNC-oQu-DEcIBJKG.d.ts → types-CKm5G_eQ-8W8FnP4u.d.ts} +13 -2
- package/dist/ui-react.d.ts +4 -2
- package/dist/ui-react.js +25 -4
- package/dist/ui-vue.d.ts +3 -2
- package/dist/ui-vue.js +44 -15
- package/dist/ui.d.ts +5 -3
- package/dist/ui.js +2 -2
- package/package.json +21 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ 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, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SKILL_PACK_FILE, type SchemaInferer, type ScriptExecutionContext, type ScriptExecutor, 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, 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 checkDependencyCycles, A as SKILL_NAME_PATTERN, B as SkillMetadata, C as FileStat, D as SKILLS_LOCKFILE, E as MemoryFS, F as SkillDocument, G as ValidationReport, H as SkillReader, I as SkillInstallSource, J as WebSkillErrorCode, K as VerifyResult, L as SkillIssue, M as SkillCatalog, N as SkillCatalogEntry, O as SKILL_MANIFEST_FILE, P as SkillDiscovery, Q as buildManifest, R as SkillLocation, S as DiscoveryResult, T as JsonSchema, U as SkillSource, V as SkillPackManifest, W as SkillsLockfile, X as atomicWriteText, Y as assertSafePathSegment, Z as buildCatalog, _ as RenderResultRequest, _t as xmlRenderer, a as InteractionPolicy, at as jsonRenderer, b as CatalogRenderer, c as LlmClient, ct as parseSkillPackManifest, d as LlmResponse, dt as renderCatalogJson, et as checkSkillRules, f as LlmStreamEvent, ft as resolveArchiveLimits, g as RenderBlock, gt as verifyManifest, h as MemoryStore, ht as validateSkills, i as FormField, it as isValidSkillName, j as SKILL_PACK_FILE, k as SKILL_NAME_MAX_LENGTH, l as LlmCompleteInput, lt as readResponseWithLimit, m as LlmToolSpec, mt as unzipWithLimits, n as ArtifactStore, nt as escapeXml, o as InteractionRequest, ot as normalizePath, p as LlmToolCall, pt as resolveInsideRoot, q as WebSkillError, r as ChartSpec, rt as exportSkills, s as InteractionResponse, st as parseSkillMarkdown, t as Artifact, tt as computeDigest, u as LlmMessage, ut as renderAvailableSkillsXml, v as UiBridge, w as FileSystemProvider, x as DEFAULT_ARCHIVE_LIMITS, y as ArchiveLimits, z as SkillManifest } from "./types-CKm5G_eQ-8W8FnP4u.js";
|
|
2
|
+
import { $ as SerializingMemoryStore, A as LifecycleHook, B as RUN_SNAPSHOT_SCHEMA_VERSION, C as FullDisclosureRouter, Ct as normalizeToolContent, D as HookRunnerOptions, Dt as toLlmToolSpec, E as HookRunner, Et as schemaToForm, 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 toVercelToolSpecs, P as OpenAiCompatibleClient, Q as ScriptExecutor, R as READ_SKILL_FILE_TOOL, S as FsRunSnapshotStore, St as networkUrlHost, T as GoogleGenAiClientConfig, Tt as resolveToolName, 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, 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 parseBridgeRequest, x as FsMemoryStore, xt as mergeCatalogEntries, y as ExternalToolSource, yt as fromVercelStreamPart, z as READ_SKILL_FILE_TOOL_NAME } from "./index-gjFuBevI.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 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 };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { A as
|
|
1
|
+
import { A as unzipWithLimits, C as parseSkillMarkdown, D as renderCatalogJson, E as renderAvailableSkillsXml, M as verifyManifest, N as xmlRenderer, O as resolveArchiveLimits, S as normalizePath, T as readResponseWithLimit, _ as computeDigest, a as SKILL_NAME_MAX_LENGTH, b as isValidSkillName, c as SkillDiscovery, d as assertSafePathSegment, f as atomicWriteText, g as checkSkillRules, h as checkDependencyCycles, i as SKILL_MANIFEST_FILE, j as validateSkills, k as resolveInsideRoot, l as SkillReader, m as buildManifest, n as MemoryFS, o as SKILL_NAME_PATTERN, p as buildCatalog, r as SKILLS_LOCKFILE, s as SKILL_PACK_FILE, t as DEFAULT_ARCHIVE_LIMITS, u as WebSkillError, v as escapeXml, w as parseSkillPackManifest, x as jsonRenderer, y as exportSkills } from "./dist-D0saNPi_.js";
|
|
2
|
+
import { A as isNetworkAllowed, C as bridgeError, D as extractChartSpec, E as createWebSkillApi, F as resolveToolName, I as schemaToForm, L as toLlmToolSpec, M as networkUrlHost, N as normalizeToolContent, O as fromVercelResult, P as parseBridgeRequest, R as toVercelToolSpecs, 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 } from "./dist-DrySSQ5R.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, SkillDiscovery, SkillReader, TraceRecorder, WebSkillError, WebSkillRuntime, assertSafePathSegment, 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, 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 };
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as SkillDocument, N as SkillCatalogEntry, T as JsonSchema, m as LlmToolSpec } from "./types-
|
|
2
|
-
import {
|
|
1
|
+
import { F as SkillDocument, N as SkillCatalogEntry, T as JsonSchema, m as LlmToolSpec } from "./types-CKm5G_eQ-8W8FnP4u.js";
|
|
2
|
+
import { it as ToolResult, v as ExternalSkillProvider, xt as mergeCatalogEntries, y as ExternalToolSource } from "./index-gjFuBevI.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";
|
|
@@ -182,7 +182,7 @@ interface ServedSkill {
|
|
|
182
182
|
}>;
|
|
183
183
|
}
|
|
184
184
|
/** 注册端:在页面 MCP server 上一行声明动态技能(prompt + resources + tools) */
|
|
185
|
-
declare function serveSkillAsMcp(server: McpServer, skill: ServedSkill): void
|
|
185
|
+
declare function serveSkillAsMcp(server: McpServer, skill: ServedSkill): Promise<void>;
|
|
186
186
|
//#endregion
|
|
187
187
|
//#region src/skills/catalogMerge.d.ts
|
|
188
188
|
/**
|
package/dist/mcp.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { u as WebSkillError } from "./dist-
|
|
2
|
-
import {
|
|
3
|
-
import { fromJSONSchema } from "zod";
|
|
4
|
-
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
5
|
-
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
6
|
-
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
1
|
+
import { u as WebSkillError } from "./dist-D0saNPi_.js";
|
|
2
|
+
import { N as normalizeToolContent, j as mergeCatalogEntries } from "./dist-DrySSQ5R.js";
|
|
7
3
|
|
|
8
4
|
//#region ../mcp/dist/index.js
|
|
9
5
|
/**
|
|
@@ -346,8 +342,15 @@ var TemporarySkillProvider = class {
|
|
|
346
342
|
}
|
|
347
343
|
}
|
|
348
344
|
};
|
|
345
|
+
async function loadFromJSONSchema() {
|
|
346
|
+
try {
|
|
347
|
+
return (await import("zod")).fromJSONSchema;
|
|
348
|
+
} catch (e) {
|
|
349
|
+
throw new WebSkillError("MCP_ENDPOINT_UNAVAILABLE", "The \"zod\" package is required to serve skills as MCP tools; install it first (npm i zod)", e);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
349
352
|
/** 注册端:在页面 MCP server 上一行声明动态技能(prompt + resources + tools) */
|
|
350
|
-
function serveSkillAsMcp(server, skill) {
|
|
353
|
+
async function serveSkillAsMcp(server, skill) {
|
|
351
354
|
server.registerPrompt(skill.name, { description: skill.description }, async () => ({ messages: [{
|
|
352
355
|
role: "user",
|
|
353
356
|
content: {
|
|
@@ -362,7 +365,7 @@ function serveSkillAsMcp(server, skill) {
|
|
|
362
365
|
}] }));
|
|
363
366
|
for (const tool of skill.tools ?? []) server.registerTool(tool.name, {
|
|
364
367
|
description: tool.description ?? "",
|
|
365
|
-
...tool.inputSchema ? { inputSchema:
|
|
368
|
+
...tool.inputSchema ? { inputSchema: (await loadFromJSONSchema())(tool.inputSchema) } : {}
|
|
366
369
|
}, async (args) => {
|
|
367
370
|
return { content: normalizeToolContent(await tool.handler(args ?? {})).map((item) => item.type === "text" ? {
|
|
368
371
|
type: "text",
|
|
@@ -521,6 +524,22 @@ var McpRuntimePlugin = class {
|
|
|
521
524
|
};
|
|
522
525
|
}
|
|
523
526
|
};
|
|
527
|
+
async function loadMcpSdk() {
|
|
528
|
+
try {
|
|
529
|
+
const [client, sse, streamable] = await Promise.all([
|
|
530
|
+
import("@modelcontextprotocol/sdk/client/index.js"),
|
|
531
|
+
import("@modelcontextprotocol/sdk/client/sse.js"),
|
|
532
|
+
import("@modelcontextprotocol/sdk/client/streamableHttp.js")
|
|
533
|
+
]);
|
|
534
|
+
return {
|
|
535
|
+
Client: client.Client,
|
|
536
|
+
SSEClientTransport: sse.SSEClientTransport,
|
|
537
|
+
StreamableHTTPClientTransport: streamable.StreamableHTTPClientTransport
|
|
538
|
+
};
|
|
539
|
+
} catch (e) {
|
|
540
|
+
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
|
+
}
|
|
542
|
+
}
|
|
524
543
|
const messageOf = (e) => e instanceof Error ? e.message : String(e);
|
|
525
544
|
/**
|
|
526
545
|
* 远程 MCP endpoint 装配:SDK 官方 StreamableHTTPClientTransport(默认)/
|
|
@@ -529,6 +548,7 @@ const messageOf = (e) => e instanceof Error ? e.message : String(e);
|
|
|
529
548
|
* 返回 close 句柄:断开后 unregister(临时技能随既有生命周期自然消失)。
|
|
530
549
|
*/
|
|
531
550
|
async function connectRemoteEndpoint(registry, config) {
|
|
551
|
+
const { Client, SSEClientTransport, StreamableHTTPClientTransport } = await loadMcpSdk();
|
|
532
552
|
const url = new URL(config.url);
|
|
533
553
|
const requestInit = config.headers ? { headers: config.headers } : void 0;
|
|
534
554
|
const transport = config.transport === "sse" ? new SSEClientTransport(url, { ...requestInit ? { requestInit } : {} }) : new StreamableHTTPClientTransport(url, { ...requestInit ? { requestInit } : {} });
|
package/dist/node.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { D as SKILLS_LOCKFILE, I as SkillInstallSource, K as VerifyResult, O as SKILL_MANIFEST_FILE, W as SkillsLockfile, z as SkillManifest } from "./types-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { D as SKILLS_LOCKFILE, I as SkillInstallSource, K as VerifyResult, O as SKILL_MANIFEST_FILE, W as SkillsLockfile, z as SkillManifest } from "./types-CKm5G_eQ-8W8FnP4u.js";
|
|
2
|
+
import { ht as createScriptContext } from "./index-gjFuBevI.js";
|
|
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-BmzysJX5.js";
|
|
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,5 +1,6 @@
|
|
|
1
|
-
import { i as SKILL_MANIFEST_FILE, r as SKILLS_LOCKFILE } from "./dist-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { i as SKILL_MANIFEST_FILE, r as SKILLS_LOCKFILE } from "./dist-D0saNPi_.js";
|
|
2
|
+
import { T as createScriptContext } from "./dist-DrySSQ5R.js";
|
|
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-BRGQcLqR.js";
|
|
4
5
|
|
|
5
|
-
export { CliUiBridge, FileArtifactStore, FileMemoryStore, NodeFS, NodeScriptExecutor, OxcSchemaInferer, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SandboxedScriptExecutor, SkillManager, createScriptContext,
|
|
6
|
+
export { CliUiBridge, FileArtifactStore, FileMemoryStore, NodeFS, NodeScriptExecutor, OxcSchemaInferer, ProcessSandboxExecutor, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SandboxedScriptExecutor, SkillManager, createScriptContext, exportArchive, probeLlmCapabilities, readArchiveManifest };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
5
|
+
|
|
6
|
+
//#region ../node/dist/executor/processSandboxEntry.js
|
|
7
|
+
/**
|
|
8
|
+
* ProcessSandbox 子进程入口(child_process.fork + --permission)。
|
|
9
|
+
* 与 worker_threads 入口同构:任务经 workerData 等价的 argv[2] JSON 传入(fork 无 workerData,
|
|
10
|
+
* 经环境变量 PROCESS_SANDBOX_TASK 传 JSON);能力桥 RPC 经 process IPC。
|
|
11
|
+
*
|
|
12
|
+
* 权限模型(--permission,experimental)负责 fs 维度:读仅限 skillRoot(+入口目录),
|
|
13
|
+
* 写仅限 artifactDir;子进程/Worker/addons 默认禁(module.register 在其下不可用——
|
|
14
|
+
* 内部钩子线程同属 WorkerThreads,实证后已移除裸模块钩子)。网络无权限维度:
|
|
15
|
+
* 仍靠 globalThis.fetch/WebSocket patch(函数源码经任务 JSON 注入,单一来源在
|
|
16
|
+
* runtime/sandbox/networkPolicy.ts);node:net 裸模块为已知残余面(文档明示)。
|
|
17
|
+
* .js 走 data: URL 导入(permission 下实证可用);.ts 走中性临时目录 file URL。
|
|
18
|
+
*/
|
|
19
|
+
const send = (message) => {
|
|
20
|
+
process.send?.(message);
|
|
21
|
+
};
|
|
22
|
+
const pending = /* @__PURE__ */ new Map();
|
|
23
|
+
let bridgeSeq = 0;
|
|
24
|
+
function callCapability(kind, payload) {
|
|
25
|
+
const request = {
|
|
26
|
+
kind,
|
|
27
|
+
id: `br-${++bridgeSeq}`,
|
|
28
|
+
...payload
|
|
29
|
+
};
|
|
30
|
+
return new Promise((resolve, reject) => {
|
|
31
|
+
pending.set(request.id, {
|
|
32
|
+
resolve,
|
|
33
|
+
reject
|
|
34
|
+
});
|
|
35
|
+
send({
|
|
36
|
+
type: "bridge",
|
|
37
|
+
request
|
|
38
|
+
});
|
|
39
|
+
}).then((response) => {
|
|
40
|
+
const r = response;
|
|
41
|
+
if (!r.ok) {
|
|
42
|
+
const err = new Error(r.error?.message ?? "capability call failed");
|
|
43
|
+
err.code = r.error?.code ?? "TOOL_EXECUTION_FAILED";
|
|
44
|
+
throw err;
|
|
45
|
+
}
|
|
46
|
+
return r.value;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function blockedError(host) {
|
|
50
|
+
const err = /* @__PURE__ */ new Error(`Network request blocked by sandbox network policy: ${host}`);
|
|
51
|
+
err.code = "NETWORK_BLOCKED";
|
|
52
|
+
return err;
|
|
53
|
+
}
|
|
54
|
+
function setupNetworkGuards(task) {
|
|
55
|
+
const policy = task.networkPolicy ?? "deny-all";
|
|
56
|
+
if (!task.networkPolicyLib) return;
|
|
57
|
+
const { isNetworkAllowed, networkUrlHost } = new Function(`${task.networkPolicyLib}\nreturn { isNetworkAllowed: isNetworkAllowed, networkUrlHost: networkUrlHost };`)();
|
|
58
|
+
const gate = (rawUrl) => {
|
|
59
|
+
const url = String(rawUrl);
|
|
60
|
+
if (isNetworkAllowed(policy, url)) return null;
|
|
61
|
+
const host = networkUrlHost(url);
|
|
62
|
+
send({
|
|
63
|
+
type: "network-blocked",
|
|
64
|
+
host
|
|
65
|
+
});
|
|
66
|
+
return blockedError(host);
|
|
67
|
+
};
|
|
68
|
+
const originalFetch = globalThis["fetch"];
|
|
69
|
+
if (typeof originalFetch === "function") globalThis["fetch"] = (input, init) => {
|
|
70
|
+
const raw = typeof input === "string" ? input : input instanceof URL ? input.href : input?.url ?? String(input);
|
|
71
|
+
const blocked = gate(raw);
|
|
72
|
+
if (blocked) return Promise.reject(blocked);
|
|
73
|
+
return originalFetch(input, init);
|
|
74
|
+
};
|
|
75
|
+
const OriginalWebSocket = globalThis["WebSocket"];
|
|
76
|
+
if (typeof OriginalWebSocket === "function") globalThis["WebSocket"] = class extends OriginalWebSocket {
|
|
77
|
+
constructor(url, protocols) {
|
|
78
|
+
const blocked = gate(String(url));
|
|
79
|
+
if (blocked) throw blocked;
|
|
80
|
+
super(url, protocols);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
let task_scratchDir;
|
|
85
|
+
async function loadModule(scriptPath, scriptSource) {
|
|
86
|
+
if (scriptPath.endsWith(".js") && scriptSource !== void 0) return await import(`data:text/javascript;charset=utf-8,${encodeURIComponent(`${scriptSource}\n//# ${Date.now()}`)}`);
|
|
87
|
+
if (scriptPath.endsWith(".ts") && scriptSource !== void 0) {
|
|
88
|
+
const base = task_scratchDir ?? await mkdtemp(path.join(tmpdir(), "webskill-psbx-ts-"));
|
|
89
|
+
const dir = await mkdtemp(path.join(base, "ts-"));
|
|
90
|
+
try {
|
|
91
|
+
const file = path.join(dir, "script.ts");
|
|
92
|
+
await writeFile(file, scriptSource);
|
|
93
|
+
return await import(`${pathToFileURL(file).href}?t=${Date.now()}`);
|
|
94
|
+
} finally {
|
|
95
|
+
await rm(dir, {
|
|
96
|
+
recursive: true,
|
|
97
|
+
force: true
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return await import(`${pathToFileURL(scriptPath).href}?t=${Date.now()}`);
|
|
102
|
+
}
|
|
103
|
+
async function main(task) {
|
|
104
|
+
task_scratchDir = task.scratchDir;
|
|
105
|
+
setupNetworkGuards(task);
|
|
106
|
+
process.on("message", (msg) => {
|
|
107
|
+
if (msg?.type === "bridge-response" && msg.response?.id) {
|
|
108
|
+
const entry = pending.get(msg.response.id);
|
|
109
|
+
if (entry) {
|
|
110
|
+
pending.delete(msg.response.id);
|
|
111
|
+
entry.resolve(msg.response);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
if (task.mode === "load") {
|
|
116
|
+
try {
|
|
117
|
+
const mod = await loadModule(task.scriptPath, task.scriptSource);
|
|
118
|
+
send({
|
|
119
|
+
type: "load-result",
|
|
120
|
+
ok: true,
|
|
121
|
+
definition: {
|
|
122
|
+
description: typeof mod["description"] === "string" ? mod["description"] : void 0,
|
|
123
|
+
inputSchema: mod["inputSchema"] !== void 0 ? mod["inputSchema"] : void 0,
|
|
124
|
+
hasRun: typeof mod["run"] === "function"
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
} catch (e) {
|
|
128
|
+
const err = e;
|
|
129
|
+
send({
|
|
130
|
+
type: "load-result",
|
|
131
|
+
ok: false,
|
|
132
|
+
error: {
|
|
133
|
+
code: err?.code ?? "TOOL_EXECUTION_FAILED",
|
|
134
|
+
message: String(err?.message ?? e)
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const stdout = [];
|
|
141
|
+
const stderr = [];
|
|
142
|
+
const originals = {
|
|
143
|
+
log: console.log,
|
|
144
|
+
info: console.info,
|
|
145
|
+
debug: console.debug,
|
|
146
|
+
warn: console.warn,
|
|
147
|
+
error: console.error
|
|
148
|
+
};
|
|
149
|
+
console.log = console.info = console.debug = (...args) => stdout.push(args.map(String).join(" "));
|
|
150
|
+
console.warn = console.error = (...args) => stderr.push(args.map(String).join(" "));
|
|
151
|
+
try {
|
|
152
|
+
const mod = await loadModule(task.scriptPath, task.scriptSource);
|
|
153
|
+
if (typeof mod["run"] !== "function") throw new Error("Script does not export a run function");
|
|
154
|
+
const context = {
|
|
155
|
+
skillName: task.skillName ?? "",
|
|
156
|
+
runId: task.runId ?? "",
|
|
157
|
+
readReference: (path) => callCapability("readReference", { path }),
|
|
158
|
+
writeArtifact: (path, content, options) => callCapability("writeArtifact", {
|
|
159
|
+
path,
|
|
160
|
+
content: typeof content === "string" ? content : Array.from(content ?? []),
|
|
161
|
+
mimeType: options?.mimeType
|
|
162
|
+
}),
|
|
163
|
+
confirm: (message) => callCapability("confirm", { message })
|
|
164
|
+
};
|
|
165
|
+
const runFn = mod["run"];
|
|
166
|
+
const value = await runFn(task.args ?? {}, context);
|
|
167
|
+
send({
|
|
168
|
+
type: "execute-result",
|
|
169
|
+
ok: true,
|
|
170
|
+
value: value === void 0 ? null : value,
|
|
171
|
+
stdout,
|
|
172
|
+
stderr
|
|
173
|
+
});
|
|
174
|
+
} catch (e) {
|
|
175
|
+
const err = e;
|
|
176
|
+
send({
|
|
177
|
+
type: "execute-result",
|
|
178
|
+
ok: false,
|
|
179
|
+
error: {
|
|
180
|
+
code: err?.code ?? "TOOL_EXECUTION_FAILED",
|
|
181
|
+
message: String(err?.message ?? e)
|
|
182
|
+
},
|
|
183
|
+
stdout,
|
|
184
|
+
stderr
|
|
185
|
+
});
|
|
186
|
+
} finally {
|
|
187
|
+
console.log = originals.log;
|
|
188
|
+
console.info = originals.info;
|
|
189
|
+
console.debug = originals.debug;
|
|
190
|
+
console.warn = originals.warn;
|
|
191
|
+
console.error = originals.error;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
process.on("message", (msg) => {
|
|
195
|
+
if (msg?.type === "task" && msg.task) main(msg.task).then(() => process.exit(0), (e) => {
|
|
196
|
+
console.error(e);
|
|
197
|
+
process.exit(1);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
//#endregion
|
|
202
|
+
export { };
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
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-
|
|
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-8W8FnP4u.js";
|
|
2
|
+
import { a as loadGoogleConfigFromEnv, i as loadAnthropicConfigFromEnv, n as LlmEnvConfig, o as loadLlmConfigFromEnv, r as ProviderEnvConfig } from "./env-BPUBZCwJ-4jat_SVG.js";
|
|
2
3
|
//#region ../runtime/dist/testing.d.ts
|
|
3
4
|
//#region src/llm/mockLlmClient.d.ts
|
|
4
5
|
type MockLlmHandler = (input: LlmCompleteInput) => LlmResponse | Promise<LlmResponse>;
|
|
@@ -70,4 +71,4 @@ declare class MemoryArtifactStore implements ArtifactStore {
|
|
|
70
71
|
listArtifacts(runId: string): Promise<Artifact[]>;
|
|
71
72
|
}
|
|
72
73
|
//#endregion
|
|
73
|
-
export { InMemoryStore, MemoryArtifactStore, MockLlmClient, type MockLlmHandler, type MockLlmQueueItem, type MockUiAnswer, MockUiBridge };
|
|
74
|
+
export { InMemoryStore, type LlmEnvConfig, MemoryArtifactStore, MockLlmClient, type MockLlmHandler, type MockLlmQueueItem, type MockUiAnswer, MockUiBridge, type ProviderEnvConfig, loadAnthropicConfigFromEnv, loadGoogleConfigFromEnv, loadLlmConfigFromEnv };
|
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { t as MemoryArtifactStore } from "./memoryArtifactStore-C9lFVqPF-yFz6yJj0.js";
|
|
2
|
-
import { n as
|
|
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-B4pq6JYa.js";
|
|
3
4
|
|
|
4
|
-
export { InMemoryStore, MemoryArtifactStore, MockLlmClient, MockUiBridge };
|
|
5
|
+
export { InMemoryStore, MemoryArtifactStore, MockLlmClient, MockUiBridge, loadAnthropicConfigFromEnv, loadGoogleConfigFromEnv, loadLlmConfigFromEnv };
|
|
@@ -127,6 +127,8 @@ interface FileSystemProvider {
|
|
|
127
127
|
remove(path: string, options?: {
|
|
128
128
|
recursive?: boolean;
|
|
129
129
|
}): Promise<void>;
|
|
130
|
+
/** 原子重命名(lockfile 等先写临时文件再 rename 的场景;实现侧无原生 rename 时 copy+remove 兜底) */
|
|
131
|
+
rename(from: string, to: string): Promise<void>;
|
|
130
132
|
}
|
|
131
133
|
//#endregion
|
|
132
134
|
//#region src/fs/memoryFs.d.ts
|
|
@@ -146,8 +148,13 @@ declare class MemoryFS implements FileSystemProvider {
|
|
|
146
148
|
remove(path: string, options?: {
|
|
147
149
|
recursive?: boolean;
|
|
148
150
|
}): Promise<void>;
|
|
151
|
+
rename(from: string, to: string): Promise<void>;
|
|
149
152
|
}
|
|
150
153
|
//#endregion
|
|
154
|
+
//#region src/fs/atomicWrite.d.ts
|
|
155
|
+
/** 原子写文本:先写临时文件再 rename(进程崩溃不留下半写文件;lockfile 等账本场景) */
|
|
156
|
+
declare function atomicWriteText(fs: FileSystemProvider, path: string, content: string): Promise<void>;
|
|
157
|
+
//#endregion
|
|
151
158
|
//#region src/fs/pathSecurity.d.ts
|
|
152
159
|
/** 统一分隔符为 `/`,去除 `.` 段与重复分隔符(不解析 `..`) */
|
|
153
160
|
declare function normalizePath(path: string): string;
|
|
@@ -365,7 +372,7 @@ declare function escapeXml(text: string): string;
|
|
|
365
372
|
declare function renderAvailableSkillsXml(catalog: SkillCatalog): string;
|
|
366
373
|
declare const xmlRenderer: CatalogRenderer;
|
|
367
374
|
//#endregion
|
|
368
|
-
//#region ../runtime/dist/types-
|
|
375
|
+
//#region ../runtime/dist/types-CKm5G_eQ.d.ts
|
|
369
376
|
//#region src/llm/streamTypes.d.ts
|
|
370
377
|
/** 流式 LLM 事件(OpenAI SSE / Vercel fullStream 统一映射) */
|
|
371
378
|
type LlmStreamEvent = {
|
|
@@ -528,6 +535,8 @@ interface RenderResultRequest {
|
|
|
528
535
|
/** @stable */
|
|
529
536
|
interface UiBridge {
|
|
530
537
|
request(input: InteractionRequest): Promise<InteractionResponse>;
|
|
538
|
+
/** 尽力取消等待中的 request(如交互超时后清理遗留表单/提示;可选实现) */
|
|
539
|
+
cancel?(id: string): void | Promise<void>;
|
|
531
540
|
progress?(input: {
|
|
532
541
|
runId: string;
|
|
533
542
|
message: string;
|
|
@@ -570,6 +579,8 @@ interface MemoryStore {
|
|
|
570
579
|
value: unknown;
|
|
571
580
|
}>>;
|
|
572
581
|
clear(scope?: string): Promise<void>;
|
|
582
|
+
/** 可选:scope 级原子段(read-modify-write 全段串行;fn 收到底层 store,禁止重入装饰器自身) */
|
|
583
|
+
transaction?<T>(scope: string, fn: (inner: MemoryStore) => Promise<T>): Promise<T>;
|
|
573
584
|
}
|
|
574
585
|
//#endregion
|
|
575
|
-
export {
|
|
586
|
+
export { checkDependencyCycles as $, SKILL_NAME_PATTERN as A, SkillMetadata as B, FileStat as C, SKILLS_LOCKFILE as D, MemoryFS as E, SkillDocument as F, ValidationReport as G, SkillReader as H, SkillInstallSource as I, WebSkillErrorCode as J, VerifyResult as K, SkillIssue as L, SkillCatalog as M, SkillCatalogEntry as N, SKILL_MANIFEST_FILE as O, SkillDiscovery as P, buildManifest as Q, SkillLocation as R, DiscoveryResult as S, JsonSchema as T, SkillSource as U, SkillPackManifest as V, SkillsLockfile as W, atomicWriteText as X, assertSafePathSegment as Y, buildCatalog as Z, RenderResultRequest as _, xmlRenderer as _t, InteractionPolicy as a, jsonRenderer as at, CatalogRenderer as b, LlmClient as c, parseSkillPackManifest as ct, LlmResponse as d, renderCatalogJson as dt, checkSkillRules as et, LlmStreamEvent as f, resolveArchiveLimits as ft, RenderBlock as g, verifyManifest as gt, MemoryStore as h, validateSkills as ht, FormField as i, isValidSkillName as it, SKILL_PACK_FILE as j, SKILL_NAME_MAX_LENGTH as k, LlmCompleteInput as l, readResponseWithLimit as lt, LlmToolSpec as m, unzipWithLimits as mt, ArtifactStore as n, escapeXml as nt, InteractionRequest as o, normalizePath as ot, LlmToolCall as p, resolveInsideRoot as pt, WebSkillError as q, ChartSpec as r, exportSkills as rt, InteractionResponse as s, parseSkillMarkdown as st, Artifact as t, computeDigest as tt, LlmMessage as u, renderAvailableSkillsXml as ut, UiBridge as v, FileSystemProvider as w, DEFAULT_ARCHIVE_LIMITS as x, ArchiveLimits as y, SkillManifest 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-
|
|
1
|
+
import { _ as RenderResultRequest, o as InteractionRequest, s as InteractionResponse, v as UiBridge } from "./types-CKm5G_eQ-8W8FnP4u.js";
|
|
2
2
|
//#region ../ui-react/dist/index.d.ts
|
|
3
3
|
//#region src/bridgeState.d.ts
|
|
4
4
|
/**
|
|
@@ -9,6 +9,8 @@ declare class ReactBridgeState implements UiBridge {
|
|
|
9
9
|
#private;
|
|
10
10
|
pending: InteractionRequest | null;
|
|
11
11
|
latestResult: RenderResultRequest | null;
|
|
12
|
+
/** 当前流式 runId(并发 run 隔离:新 runId 重置文本) */
|
|
13
|
+
streamingRunId: string | null;
|
|
12
14
|
streamingText: string;
|
|
13
15
|
/** React useSyncExternalStore 兼容订阅 */
|
|
14
16
|
subscribe: (listener: () => void) => (() => void);
|
|
@@ -16,7 +18,7 @@ declare class ReactBridgeState implements UiBridge {
|
|
|
16
18
|
/** 组件提交/取消回调 */
|
|
17
19
|
resolve(response: InteractionResponse): void;
|
|
18
20
|
renderResult(input: RenderResultRequest): Promise<void>;
|
|
19
|
-
onTextDelta(
|
|
21
|
+
onTextDelta(runId: string, delta: string): Promise<void>;
|
|
20
22
|
}
|
|
21
23
|
//#endregion
|
|
22
24
|
//#region src/components/InteractionForm.d.ts
|
package/dist/ui-react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as renderMiniMarkdown, m as collectValues, w as shapeInteractionValue, x as renderMiniChart, y as interactionToFormModel } from "./dist-
|
|
1
|
+
import { S as renderMiniMarkdown, m as collectValues, w as shapeInteractionValue, x as renderMiniChart, y as interactionToFormModel } from "./dist-BJobG0i-.js";
|
|
2
2
|
import { useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -10,6 +10,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
var ReactBridgeState = class {
|
|
11
11
|
pending = null;
|
|
12
12
|
latestResult = null;
|
|
13
|
+
/** 当前流式 runId(并发 run 隔离:新 runId 重置文本) */
|
|
14
|
+
streamingRunId = null;
|
|
13
15
|
streamingText = "";
|
|
14
16
|
#listeners = /* @__PURE__ */ new Set();
|
|
15
17
|
#resolvers = /* @__PURE__ */ new Map();
|
|
@@ -41,14 +43,20 @@ var ReactBridgeState = class {
|
|
|
41
43
|
this.latestResult = input;
|
|
42
44
|
this.#emit();
|
|
43
45
|
}
|
|
44
|
-
async onTextDelta(
|
|
46
|
+
async onTextDelta(runId, delta) {
|
|
47
|
+
if (this.streamingRunId !== runId) {
|
|
48
|
+
this.streamingRunId = runId;
|
|
49
|
+
this.streamingText = "";
|
|
50
|
+
}
|
|
45
51
|
this.streamingText += delta;
|
|
46
52
|
this.#emit();
|
|
47
53
|
}
|
|
48
54
|
};
|
|
49
|
-
function Control({ control }) {
|
|
55
|
+
function Control({ control, invalid }) {
|
|
56
|
+
const controlId = `webskill-field-${control.name}`;
|
|
50
57
|
const label = /* @__PURE__ */ jsxs("label", {
|
|
51
58
|
className: "webskill-form__label",
|
|
59
|
+
htmlFor: controlId,
|
|
52
60
|
children: [control.label, control.required ? " *" : ""]
|
|
53
61
|
});
|
|
54
62
|
const description = control.description ? /* @__PURE__ */ jsx("div", {
|
|
@@ -64,6 +72,8 @@ function Control({ control }) {
|
|
|
64
72
|
description,
|
|
65
73
|
/* @__PURE__ */ jsx("input", {
|
|
66
74
|
type: "checkbox",
|
|
75
|
+
id: controlId,
|
|
76
|
+
"aria-invalid": invalid || void 0,
|
|
67
77
|
className: "webskill-form__input",
|
|
68
78
|
"data-webskill-control": control.name,
|
|
69
79
|
defaultChecked: control.defaultValue === true
|
|
@@ -77,6 +87,8 @@ function Control({ control }) {
|
|
|
77
87
|
label,
|
|
78
88
|
description,
|
|
79
89
|
/* @__PURE__ */ jsx("select", {
|
|
90
|
+
id: controlId,
|
|
91
|
+
"aria-invalid": invalid || void 0,
|
|
80
92
|
className: "webskill-form__input",
|
|
81
93
|
"data-webskill-control": control.name,
|
|
82
94
|
children: (control.options ?? []).map((option, i) => /* @__PURE__ */ jsx("option", {
|
|
@@ -94,6 +106,8 @@ function Control({ control }) {
|
|
|
94
106
|
label,
|
|
95
107
|
description,
|
|
96
108
|
/* @__PURE__ */ jsx("textarea", {
|
|
109
|
+
id: controlId,
|
|
110
|
+
"aria-invalid": invalid || void 0,
|
|
97
111
|
className: "webskill-form__input",
|
|
98
112
|
"data-webskill-control": control.name,
|
|
99
113
|
defaultValue: control.defaultValue !== void 0 ? String(control.defaultValue) : ""
|
|
@@ -108,6 +122,8 @@ function Control({ control }) {
|
|
|
108
122
|
description,
|
|
109
123
|
/* @__PURE__ */ jsx("input", {
|
|
110
124
|
type: control.control === "number" ? "number" : "text",
|
|
125
|
+
id: controlId,
|
|
126
|
+
"aria-invalid": invalid || void 0,
|
|
111
127
|
className: "webskill-form__input",
|
|
112
128
|
"data-webskill-control": control.name,
|
|
113
129
|
defaultValue: control.defaultValue !== void 0 ? String(control.defaultValue) : ""
|
|
@@ -151,7 +167,12 @@ function InteractionForm({ bridge }) {
|
|
|
151
167
|
}) : null,
|
|
152
168
|
model.controls.map((control) => /* @__PURE__ */ jsxs("div", {
|
|
153
169
|
className: invalid.includes(control.name) ? "webskill-form__control--invalid" : void 0,
|
|
154
|
-
children: [/* @__PURE__ */ jsx(Control, {
|
|
170
|
+
children: [/* @__PURE__ */ jsx(Control, {
|
|
171
|
+
control,
|
|
172
|
+
invalid: invalid.includes(control.name)
|
|
173
|
+
}), invalid.includes(control.name) ? /* @__PURE__ */ jsx("div", {
|
|
174
|
+
id: `webskill-error-${control.name}`,
|
|
175
|
+
role: "alert",
|
|
155
176
|
className: "webskill-form__error",
|
|
156
177
|
children: "This field is required"
|
|
157
178
|
}) : null]
|
package/dist/ui-vue.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { _ as RenderResultRequest, o as InteractionRequest, s as InteractionResponse, v as UiBridge } from "./types-
|
|
1
|
+
import { _ as RenderResultRequest, o as InteractionRequest, s as InteractionResponse, v as UiBridge } from "./types-CKm5G_eQ-8W8FnP4u.js";
|
|
2
2
|
import { PropType } from "vue";
|
|
3
3
|
//#region ../ui-vue/dist/index.d.ts
|
|
4
4
|
//#region src/bridgeState.d.ts
|
|
5
5
|
interface VueBridgeSnapshot {
|
|
6
6
|
pending: InteractionRequest | null;
|
|
7
7
|
latestResult: RenderResultRequest | null;
|
|
8
|
+
streamingRunId: string | null;
|
|
8
9
|
streamingText: string;
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
@@ -18,7 +19,7 @@ declare class VueBridgeState implements UiBridge {
|
|
|
18
19
|
/** 组件提交/取消回调 */
|
|
19
20
|
resolve(response: InteractionResponse): void;
|
|
20
21
|
renderResult(input: RenderResultRequest): Promise<void>;
|
|
21
|
-
onTextDelta(
|
|
22
|
+
onTextDelta(runId: string, delta: string): Promise<void>;
|
|
22
23
|
}
|
|
23
24
|
//#endregion
|
|
24
25
|
//#region src/components/interactionForm.d.ts
|