@webskill/sdk 0.1.1 → 0.1.3

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.
@@ -1,6 +1,6 @@
1
1
  import { L as SkillManifest, N as SkillDocument, S as FileSystemProvider, c as LlmClient, j as SkillCatalogEntry, u as LlmMessage, v as UiBridge } from "./types-CgNC-oQu-Dq_A1yA-.js";
2
- import { U as RuntimeRun, it as WebSkillRuntime } from "./index-oG5Nzgb9.js";
3
- import { d as SkillManager } from "./index-Dc4X2N54.js";
2
+ import { ct as WebSkillRuntime, q as RuntimeRun } from "./index-CqMuvcb2.js";
3
+ import { f as SkillManager } from "./index-CPuwsnmB.js";
4
4
  //#region ../governance/dist/index.d.ts
5
5
  //#region src/types.d.ts
6
6
  type CandidateStatus = 'draft' | 'pending-review' | 'approved' | 'published' | 'rejected';
@@ -1,5 +1,5 @@
1
- import { E as validateSkills, T as resolveInsideRoot, u as WebSkillError, v as isValidSkillName } from "./memoryArtifactStore-C9lFVqPF-U8nXvqL9.js";
2
- import { i as NodeFS } from "./dist-Cc3Mqi3_.js";
1
+ import { T as validateSkills, _ as isValidSkillName, l as WebSkillError, w as resolveInsideRoot } from "./dist-DS1sfgHa.js";
2
+ import { i as NodeFS } from "./dist-Cm_j6Jol.js";
3
3
  import path from "node:path";
4
4
  import { mkdtemp } from "node:fs/promises";
5
5
  import { tmpdir } from "node:os";
@@ -1,5 +1,5 @@
1
1
  import { C as JsonSchema, H as SkillsLockfile, L as SkillManifest, P as SkillInstallSource, S as FileSystemProvider, W as VerifyResult, _ as RenderResultRequest, o as InteractionRequest, s as InteractionResponse, v as UiBridge, x as FileStat } from "./types-CgNC-oQu-Dq_A1yA-.js";
2
- import { G as SchemaInferer, K as ScriptExecutionContext, Y as ToolDefinition, Z as ToolResult, c as ApprovalScope, k as NetworkPolicy, l as BridgeCapabilities, q as ScriptExecutor, v as FsArtifactStore, y as FsMemoryStore } from "./index-oG5Nzgb9.js";
2
+ import { $ as ToolDefinition, N as NetworkPolicy, X as ScriptExecutionContext, Y as SchemaInferer, Z as ScriptExecutor, b as FsArtifactStore, d as BridgeCapabilities, tt as ToolResult, u as ApprovalScope, x as FsMemoryStore } from "./index-CqMuvcb2.js";
3
3
  import { Readable, Writable } from "node:stream";
4
4
  //#region ../node/dist/index.d.ts
5
5
  //#region src/fs/nodeFs.d.ts
@@ -172,11 +172,20 @@ interface LlmEnvConfig {
172
172
  apiKey: string;
173
173
  model: string;
174
174
  }
175
+ /** per-provider env 配置(baseUrl 可选,客户端自带默认) */
176
+ interface ProviderEnvConfig {
177
+ apiKey: string;
178
+ model: string;
179
+ baseUrl?: string;
180
+ }
175
181
  /**
176
- * 解析 .env(简单 KEY=VALUE 行解析,不引依赖),
177
182
  * 读取 VITE_BASE_URL / VITE_API_KEY / VITE_MODEL_NAME;缺项返回 undefined 供测试 skip 判断。
178
183
  */
179
184
  declare function loadLlmConfigFromEnv(dotenvPath?: string): LlmEnvConfig | undefined;
185
+ /** ANTHROPIC_API_KEY / ANTHROPIC_MODEL(可选 ANTHROPIC_BASE_URL);缺项返回 undefined */
186
+ declare function loadAnthropicConfigFromEnv(dotenvPath?: string): ProviderEnvConfig | undefined;
187
+ /** GOOGLE_API_KEY / GOOGLE_MODEL(可选 GOOGLE_BASE_URL);缺项返回 undefined */
188
+ declare function loadGoogleConfigFromEnv(dotenvPath?: string): ProviderEnvConfig | undefined;
180
189
  interface LlmCapabilities {
181
190
  available: boolean;
182
191
  nonStreaming: boolean;
@@ -192,4 +201,4 @@ interface LlmCapabilities {
192
201
  */
193
202
  declare function probeLlmCapabilities(config: LlmEnvConfig): Promise<LlmCapabilities>;
194
203
  //#endregion
195
- export { LlmEnvConfig as a, OxcSchemaInferer as c, SkillManager as d, loadLlmConfigFromEnv as f, LlmCapabilities as i, SandboxOptions as l, readArchiveManifest as m, FileArtifactStore as n, NodeFS as o, probeLlmCapabilities as p, FileMemoryStore as r, NodeScriptExecutor as s, CliUiBridge as t, SandboxedScriptExecutor as u };
204
+ export { readArchiveManifest as _, LlmEnvConfig as a, OxcSchemaInferer as c, SandboxedScriptExecutor as d, SkillManager as f, probeLlmCapabilities as g, loadLlmConfigFromEnv as h, LlmCapabilities as i, ProviderEnvConfig as l, loadGoogleConfigFromEnv as m, FileArtifactStore as n, NodeFS as o, loadAnthropicConfigFromEnv as p, FileMemoryStore as r, NodeScriptExecutor as s, CliUiBridge as t, SandboxOptions as u };
@@ -21,6 +21,52 @@ declare class OpenAiCompatibleClient implements LlmClient {
21
21
  checkAvailability(): Promise<boolean>;
22
22
  }
23
23
  //#endregion
24
+ //#region src/llm/anthropicClient.d.ts
25
+ interface AnthropicClientConfig {
26
+ apiKey: string;
27
+ model: string;
28
+ /** 默认 https://api.anthropic.com */
29
+ baseUrl?: string;
30
+ /** 可注入 fetch(测试用 mock);缺省用全局 fetch */
31
+ fetchImpl?: typeof fetch;
32
+ /** 单次请求超时 */
33
+ requestTimeoutMs?: number;
34
+ /** max_tokens(Messages API 必填),默认 4096 */
35
+ maxTokens?: number;
36
+ }
37
+ /** Anthropic Messages API 客户端(零依赖 fetch;Node/浏览器通用) */
38
+ declare class AnthropicClient implements LlmClient {
39
+ #private;
40
+ constructor(config: AnthropicClientConfig);
41
+ complete(input: LlmCompleteInput): Promise<LlmResponse>;
42
+ /** SSE 流式:text_delta → text-delta;input_json_delta 按 block index 聚合 → tool-calls */
43
+ stream(input: LlmCompleteInput): AsyncIterable<LlmStreamEvent>;
44
+ /** 轻量探测(GET /v1/models),集成测试据此决定 skip */
45
+ checkAvailability(): Promise<boolean>;
46
+ }
47
+ //#endregion
48
+ //#region src/llm/googleGenAiClient.d.ts
49
+ interface GoogleGenAiClientConfig {
50
+ apiKey: string;
51
+ model: string;
52
+ /** 默认 https://generativelanguage.googleapis.com */
53
+ baseUrl?: string;
54
+ /** 可注入 fetch(测试用 mock);缺省用全局 fetch */
55
+ fetchImpl?: typeof fetch;
56
+ /** 单次请求超时 */
57
+ requestTimeoutMs?: number;
58
+ }
59
+ /** Google GenAI(generateContent / streamGenerateContent)客户端(零依赖 fetch) */
60
+ declare class GoogleGenAiClient implements LlmClient {
61
+ #private;
62
+ constructor(config: GoogleGenAiClientConfig);
63
+ complete(input: LlmCompleteInput): Promise<LlmResponse>;
64
+ /** SSE 流式:chunk.parts text → text-delta;functionCall 聚合 → tool-calls */
65
+ stream(input: LlmCompleteInput): AsyncIterable<LlmStreamEvent>;
66
+ /** 轻量探测(GET /v1beta/models),集成测试据此决定 skip */
67
+ checkAvailability(): Promise<boolean>;
68
+ }
69
+ //#endregion
24
70
  //#region src/llm/vercelAiAdapter.d.ts
25
71
  /**
26
72
  * Vercel AI SDK 适配层:纯数据转换,不 import SDK。
@@ -174,6 +220,8 @@ declare function createScriptContext(deps: {
174
220
  confirm?: (message: string) => Promise<boolean>;
175
221
  /** 宿主侧降级 warning 出口(网络阻断等;引擎接线到 run.warning trace) */
176
222
  onWarning?: (message: string) => void;
223
+ /** writeArtifact 创建产物后的回调(引擎记录新产物 ID,执行后单次 listArtifacts 过滤) */
224
+ onArtifactCreated?: (artifact: Artifact) => void;
177
225
  }): ScriptExecutionContext;
178
226
  //#endregion
179
227
  //#region src/lifecycle/types.d.ts
@@ -695,4 +743,4 @@ declare class WebSkillRuntime {
695
743
  resumeRun(runId: string): Promise<RunResult>;
696
744
  }
697
745
  //#endregion
698
- export { TraceEvent as $, OpenAiCompatibleClient as A, RunSnapshotStore as B, HookRunnerOptions as C, LifecycleHookContext as D, LifecycleHook as E, READ_SKILL_FILE_TOOL_NAME as F, SchemaInferer as G, RuntimePhase as H, RUN_SNAPSHOT_SCHEMA_VERSION as I, SkillRouter as J, ScriptExecutionContext as K, RouteResult as L, ProgressiveRouter as M, READ_SKILL_FILE_INPUT_SCHEMA as N, LifecycleListener as O, READ_SKILL_FILE_TOOL as P, TraceClock as Q, RunResult as R, HookRunner as S, LifecycleEvent as T, RuntimeRun as U, RunTerminationReason as V, RuntimeSession as W, ToolResolution as X, ToolDefinition as Y, ToolResult as Z, ExternalToolSource as _, parseBridgeRequest as _t, AgentLoopConfig as a, WebSkillRuntimeDeps as at, FsRunSnapshotStore as b, toLlmToolSpec as bt, ApprovalScope as c, createScriptContext as ct, BridgeRequest as d, fromVercelResult as dt, TraceEventType as et, BridgeResponse as f, fromVercelStreamPart as ft, ExternalSkillProvider as g, normalizeToolContent as gt, EventBus as h, networkUrlHost as ht, AgentLoop as i, WebSkillRuntime as it, OpenAiCompatibleClientConfig as j, NetworkPolicy as k, BridgeCapabilities as l, createWebSkillApi as lt, CapabilityMode as m, mergeCatalogEntries as mt, ASK_USER_TOOL as n, VercelToolSpec as nt, AgentLoopDeps as o, bridgeError as ot, CapabilityApproval as p, isNetworkAllowed as pt, ScriptExecutor as q, ASK_USER_TOOL_NAME as r, WebSkillApi as rt, ApprovalDecision as s, buildRenderResult as st, ASK_USER_INPUT_SCHEMA as t, TraceRecorder as tt, BridgeCapability as u, extractChartSpec as ut, FsArtifactStore as v, resolveToolName as vt, InstalledSkillManifest as w, FullDisclosureRouter as x, toVercelToolSpecs as xt, FsMemoryStore as y, schemaToForm as yt, RunSnapshot as z };
746
+ export { ToolDefinition as $, LifecycleHook as A, RUN_SNAPSHOT_SCHEMA_VERSION as B, FullDisclosureRouter as C, schemaToForm as Ct, HookRunnerOptions as D, HookRunner as E, OpenAiCompatibleClientConfig as F, RunTerminationReason as G, RunResult as H, ProgressiveRouter as I, RuntimeSession as J, RuntimePhase as K, READ_SKILL_FILE_INPUT_SCHEMA as L, LifecycleListener as M, NetworkPolicy as N, InstalledSkillManifest as O, OpenAiCompatibleClient as P, SkillRouter as Q, READ_SKILL_FILE_TOOL as R, FsRunSnapshotStore as S, resolveToolName as St, GoogleGenAiClientConfig as T, toVercelToolSpecs as Tt, RunSnapshot as U, RouteResult as V, RunSnapshotStore as W, ScriptExecutionContext as X, SchemaInferer as Y, ScriptExecutor as Z, EventBus as _, isNetworkAllowed as _t, AgentLoopConfig as a, TraceRecorder as at, FsArtifactStore as b, normalizeToolContent as bt, AnthropicClientConfig as c, WebSkillRuntime as ct, BridgeCapabilities as d, buildRenderResult as dt, ToolResolution as et, BridgeCapability as f, createScriptContext as ft, CapabilityMode as g, fromVercelStreamPart as gt, CapabilityApproval as h, fromVercelResult as ht, AgentLoop as i, TraceEventType as it, LifecycleHookContext as j, LifecycleEvent as k, ApprovalDecision as l, WebSkillRuntimeDeps as lt, BridgeResponse as m, extractChartSpec as mt, ASK_USER_TOOL as n, TraceClock as nt, AgentLoopDeps as o, VercelToolSpec as ot, BridgeRequest as p, createWebSkillApi as pt, RuntimeRun as q, ASK_USER_TOOL_NAME as r, TraceEvent as rt, AnthropicClient as s, WebSkillApi as st, ASK_USER_INPUT_SCHEMA as t, ToolResult as tt, ApprovalScope as u, bridgeError as ut, ExternalSkillProvider as v, mergeCatalogEntries as vt, GoogleGenAiClient as w, toLlmToolSpec as wt, FsMemoryStore as x, parseBridgeRequest as xt, ExternalToolSource as y, networkUrlHost as yt, READ_SKILL_FILE_TOOL_NAME as z };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { $ as exportSkills, A as SkillCatalog, B as SkillReader, C as JsonSchema, D as SKILL_NAME_MAX_LENGTH, E as SKILL_MANIFEST_FILE, F as SkillIssue, G as WebSkillError, H as SkillsLockfile, I as SkillLocation, J as buildManifest, K as WebSkillErrorCode, L as SkillManifest, M as SkillDiscovery, N as SkillDocument, O as SKILL_NAME_PATTERN, P as SkillInstallSource, Q as escapeXml, R as SkillMetadata, S as FileSystemProvider, T as SKILLS_LOCKFILE, U as ValidationReport, V as SkillSource, W as VerifyResult, X as checkSkillRules, Y as checkDependencyCycles, Z as computeDigest, _ as RenderResultRequest, a as InteractionPolicy, at as renderAvailableSkillsXml, b as DiscoveryResult, c as LlmClient, ct as validateSkills, d as LlmResponse, et as isValidSkillName, f as LlmStreamEvent, g as RenderBlock, h as MemoryStore, i as FormField, it as parseSkillPackManifest, j as SkillCatalogEntry, k as SKILL_PACK_FILE, l as LlmCompleteInput, lt as verifyManifest, m as LlmToolSpec, n as ArtifactStore, nt as normalizePath, o as InteractionRequest, ot as renderCatalogJson, p as LlmToolCall, q as buildCatalog, r as ChartSpec, rt as parseSkillMarkdown, s as InteractionResponse, st as resolveInsideRoot, t as Artifact, tt as jsonRenderer, u as LlmMessage, ut as xmlRenderer, v as UiBridge, w as MemoryFS, x as FileStat, y as CatalogRenderer, z as SkillPackManifest } from "./types-CgNC-oQu-Dq_A1yA-.js";
2
- import { $ as TraceEvent, A as OpenAiCompatibleClient, B as RunSnapshotStore, C as HookRunnerOptions, D as LifecycleHookContext, E as LifecycleHook, F as READ_SKILL_FILE_TOOL_NAME, G as SchemaInferer, H as RuntimePhase, I as RUN_SNAPSHOT_SCHEMA_VERSION, J as SkillRouter, K as ScriptExecutionContext, L as RouteResult, M as ProgressiveRouter, N as READ_SKILL_FILE_INPUT_SCHEMA, O as LifecycleListener, P as READ_SKILL_FILE_TOOL, Q as TraceClock, R as RunResult, S as HookRunner, T as LifecycleEvent, U as RuntimeRun, V as RunTerminationReason, W as RuntimeSession, X as ToolResolution, Y as ToolDefinition, Z as ToolResult, _ as ExternalToolSource, _t as parseBridgeRequest, a as AgentLoopConfig, at as WebSkillRuntimeDeps, b as FsRunSnapshotStore, bt as toLlmToolSpec, c as ApprovalScope, ct as createScriptContext, d as BridgeRequest, dt as fromVercelResult, et as TraceEventType, f as BridgeResponse, ft as fromVercelStreamPart, g as ExternalSkillProvider, gt as normalizeToolContent, h as EventBus, ht as networkUrlHost, i as AgentLoop, it as WebSkillRuntime, j as OpenAiCompatibleClientConfig, k as NetworkPolicy, l as BridgeCapabilities, lt as createWebSkillApi, m as CapabilityMode, mt as mergeCatalogEntries, n as ASK_USER_TOOL, nt as VercelToolSpec, o as AgentLoopDeps, ot as bridgeError, p as CapabilityApproval, pt as isNetworkAllowed, q as ScriptExecutor, r as ASK_USER_TOOL_NAME, rt as WebSkillApi, s as ApprovalDecision, st as buildRenderResult, t as ASK_USER_INPUT_SCHEMA, tt as TraceRecorder, u as BridgeCapability, ut as extractChartSpec, v as FsArtifactStore, vt as resolveToolName, w as InstalledSkillManifest, x as FullDisclosureRouter, xt as toVercelToolSpecs, y as FsMemoryStore, yt as schemaToForm, z as RunSnapshot } from "./index-oG5Nzgb9.js";
3
- export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, type AgentLoopConfig, type AgentLoopDeps, type ApprovalDecision, type ApprovalScope, type Artifact, type ArtifactStore, type BridgeCapabilities, type BridgeCapability, type BridgeRequest, type BridgeResponse, CapabilityApproval, type CapabilityMode, type CatalogRenderer, type ChartSpec, type DiscoveryResult, EventBus, type ExternalSkillProvider, type ExternalToolSource, type FileStat, type FileSystemProvider, type FormField, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FullDisclosureRouter, 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 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, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isValidSkillName, jsonRenderer, mergeCatalogEntries, networkUrlHost, normalizePath, normalizeToolContent, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, renderAvailableSkillsXml, renderCatalogJson, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, validateSkills, verifyManifest, xmlRenderer };
2
+ import { $ as ToolDefinition, A as LifecycleHook, B as RUN_SNAPSHOT_SCHEMA_VERSION, C as FullDisclosureRouter, Ct as schemaToForm, D as HookRunnerOptions, E as HookRunner, 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, P as OpenAiCompatibleClient, Q as SkillRouter, R as READ_SKILL_FILE_TOOL, S as FsRunSnapshotStore, St as resolveToolName, T as GoogleGenAiClientConfig, Tt as toVercelToolSpecs, U as RunSnapshot, V as RouteResult, W as RunSnapshotStore, X as ScriptExecutionContext, Y as SchemaInferer, Z as ScriptExecutor, _ as EventBus, _t as isNetworkAllowed, a as AgentLoopConfig, at as TraceRecorder, b as FsArtifactStore, bt as normalizeToolContent, c as AnthropicClientConfig, ct as WebSkillRuntime, d as BridgeCapabilities, dt as buildRenderResult, et as ToolResolution, f as BridgeCapability, ft as createScriptContext, g as CapabilityMode, gt as fromVercelStreamPart, h as CapabilityApproval, ht as fromVercelResult, i as AgentLoop, it as TraceEventType, j as LifecycleHookContext, k as LifecycleEvent, l as ApprovalDecision, lt as WebSkillRuntimeDeps, m as BridgeResponse, mt as extractChartSpec, n as ASK_USER_TOOL, nt as TraceClock, o as AgentLoopDeps, ot as VercelToolSpec, p as BridgeRequest, pt as createWebSkillApi, q as RuntimeRun, r as ASK_USER_TOOL_NAME, rt as TraceEvent, s as AnthropicClient, st as WebSkillApi, t as ASK_USER_INPUT_SCHEMA, tt as ToolResult, u as ApprovalScope, ut as bridgeError, v as ExternalSkillProvider, vt as mergeCatalogEntries, w as GoogleGenAiClient, wt as toLlmToolSpec, x as FsMemoryStore, xt as parseBridgeRequest, y as ExternalToolSource, yt as networkUrlHost, z as READ_SKILL_FILE_TOOL_NAME } from "./index-CqMuvcb2.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 Artifact, type ArtifactStore, type BridgeCapabilities, type BridgeCapability, type BridgeRequest, type BridgeResponse, CapabilityApproval, type CapabilityMode, type CatalogRenderer, type ChartSpec, 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 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, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isValidSkillName, jsonRenderer, mergeCatalogEntries, networkUrlHost, normalizePath, normalizeToolContent, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, renderAvailableSkillsXml, renderCatalogJson, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, validateSkills, verifyManifest, xmlRenderer };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as renderAvailableSkillsXml, D as verifyManifest, E as validateSkills, O as xmlRenderer, S as parseSkillPackManifest, T as resolveInsideRoot, _ as exportSkills, a as SKILL_NAME_MAX_LENGTH, b as normalizePath, c as SkillDiscovery, d as buildCatalog, f as buildManifest, g as escapeXml, h as computeDigest, i as SKILL_MANIFEST_FILE, l as SkillReader, m as checkSkillRules, n as MemoryFS, o as SKILL_NAME_PATTERN, p as checkDependencyCycles, r as SKILLS_LOCKFILE, s as SKILL_PACK_FILE, u as WebSkillError, v as isValidSkillName, w as renderCatalogJson, x as parseSkillMarkdown, y as jsonRenderer } from "./memoryArtifactStore-C9lFVqPF-U8nXvqL9.js";
2
- import { A as normalizeToolContent, C as createWebSkillApi, D as isNetworkAllowed, E as fromVercelStreamPart, F as toVercelToolSpecs, M as resolveToolName, N as schemaToForm, O as mergeCatalogEntries, P as toLlmToolSpec, S as createScriptContext, T as fromVercelResult, _ as RUN_SNAPSHOT_SCHEMA_VERSION, a as CapabilityApproval, b as bridgeError, c as FsMemoryStore, d as HookRunner, f as OpenAiCompatibleClient, g as READ_SKILL_FILE_TOOL_NAME, h as READ_SKILL_FILE_TOOL, i as AgentLoop, j as parseBridgeRequest, k as networkUrlHost, l as FsRunSnapshotStore, m as READ_SKILL_FILE_INPUT_SCHEMA, n as ASK_USER_TOOL, o as EventBus, p as ProgressiveRouter, r as ASK_USER_TOOL_NAME, s as FsArtifactStore, t as ASK_USER_INPUT_SCHEMA, u as FullDisclosureRouter, v as TraceRecorder, w as extractChartSpec, x as buildRenderResult, y as WebSkillRuntime } from "./dist-D5fsiETF.js";
1
+ import { C as renderCatalogJson, D as xmlRenderer, E as verifyManifest, S as renderAvailableSkillsXml, T as validateSkills, _ as isValidSkillName, a as SKILL_NAME_PATTERN, b as parseSkillMarkdown, c as SkillReader, d as buildManifest, f as checkDependencyCycles, g as exportSkills, h as escapeXml, i as SKILL_NAME_MAX_LENGTH, l as WebSkillError, m as computeDigest, n as SKILLS_LOCKFILE, o as SKILL_PACK_FILE, p as checkSkillRules, r as SKILL_MANIFEST_FILE, s as SkillDiscovery, t as MemoryFS, u as buildCatalog, v as jsonRenderer, w as resolveInsideRoot, x as parseSkillPackManifest, y as normalizePath } from "./dist-DS1sfgHa.js";
2
+ import { A as mergeCatalogEntries, C as buildRenderResult, D as fromVercelResult, E as extractChartSpec, F as schemaToForm, I as toLlmToolSpec, L as toVercelToolSpecs, M as normalizeToolContent, N as parseBridgeRequest, O as fromVercelStreamPart, P as resolveToolName, S as bridgeError, T as createWebSkillApi, _ as READ_SKILL_FILE_TOOL, a as AnthropicClient, b as TraceRecorder, c as FsArtifactStore, d as FullDisclosureRouter, f as GoogleGenAiClient, g as READ_SKILL_FILE_INPUT_SCHEMA, h as ProgressiveRouter, i as AgentLoop, j as networkUrlHost, k as isNetworkAllowed, 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 createScriptContext, x as WebSkillRuntime, y as RUN_SNAPSHOT_SCHEMA_VERSION } from "./dist-DZobLFh6.js";
3
3
 
4
- export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, CapabilityApproval, EventBus, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FullDisclosureRouter, 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, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isValidSkillName, jsonRenderer, mergeCatalogEntries, networkUrlHost, normalizePath, normalizeToolContent, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, renderAvailableSkillsXml, renderCatalogJson, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, validateSkills, verifyManifest, xmlRenderer };
4
+ export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, AnthropicClient, CapabilityApproval, 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, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isValidSkillName, jsonRenderer, mergeCatalogEntries, networkUrlHost, normalizePath, normalizeToolContent, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, renderAvailableSkillsXml, renderCatalogJson, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, validateSkills, verifyManifest, xmlRenderer };
package/dist/mcp.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { C as JsonSchema, N as SkillDocument, j as SkillCatalogEntry, m as LlmToolSpec } from "./types-CgNC-oQu-Dq_A1yA-.js";
2
- import { Z as ToolResult, _ as ExternalToolSource, g as ExternalSkillProvider, mt as mergeCatalogEntries } from "./index-oG5Nzgb9.js";
2
+ import { tt as ToolResult, v as ExternalSkillProvider, vt as mergeCatalogEntries, y as ExternalToolSource } from "./index-CqMuvcb2.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";
@@ -35,6 +35,11 @@ type TransportState = 'idle' | 'listening' | 'connected' | 'closed' | 'failed';
35
35
  interface MessageChannelTransportOptions {
36
36
  /** 缺省 = 当前 origin(无 window 环境时不校验);显式 ['*'] 才全放行 */
37
37
  allowedOrigins?: string[];
38
+ /**
39
+ * 严格 origin 模式(window 场景建议开启):开启后空/undefined origin 一律拒绝;
40
+ * 默认 false(兼容无 origin 概念的 MessagePort)
41
+ */
42
+ strictOrigin?: boolean;
38
43
  /** start 后等待首个合法消息的超时;0/缺省 = 不超时 */
39
44
  connectionTimeoutMs?: number;
40
45
  }
@@ -236,4 +241,26 @@ declare class McpRuntimePlugin implements ExternalToolSource {
236
241
  call(llmToolName: string, args: Record<string, unknown>): Promise<ToolResult>;
237
242
  }
238
243
  //#endregion
239
- export { type BrowserModelContextLike, EndpointRegistry, ExperimentalWebMcpAdapter, type McpClientLike, McpRuntimePlugin, McpToolResolver, MessageChannelTransport, type MessageChannelTransportOptions, type MessagePortLike, type ServedSkill, TemporarySkillProvider, type TransportState, type WebMcpToolDescriptor, catalogMerge, endpointToolLlmName, parseEndpointToolLlmName, parseWebMcpToolLlmName, serveSkillAsMcp, validateJsonRpcMessage, webMcpToolLlmName };
244
+ //#region src/remote/connectRemoteEndpoint.d.ts
245
+ interface RemoteEndpointConfig {
246
+ /** registry 中的名字(endpoint:tool 引用) */
247
+ endpoint: string;
248
+ url: string;
249
+ /** 默认 'streamable-http'(现行标准);'sse' 为遗留兼容 */
250
+ transport?: 'streamable-http' | 'sse';
251
+ /** 鉴权等请求头(Bearer 等),经 transport requestInit.headers 透传 */
252
+ headers?: Record<string, string>;
253
+ /** 连接超时;0/缺省 = 不超时 */
254
+ timeoutMs?: number;
255
+ }
256
+ /**
257
+ * 远程 MCP endpoint 装配:SDK 官方 StreamableHTTPClientTransport(默认)/
258
+ * SSEClientTransport(遗留)连接远端 server,注册进 EndpointRegistry——
259
+ * endpoint:tool 解析、TTL+版本缓存、临时技能消费自动生效。
260
+ * 返回 close 句柄:断开后 unregister(临时技能随既有生命周期自然消失)。
261
+ */
262
+ declare function connectRemoteEndpoint(registry: EndpointRegistry<McpClientLike>, config: RemoteEndpointConfig): Promise<{
263
+ close(): Promise<void>;
264
+ }>;
265
+ //#endregion
266
+ export { type BrowserModelContextLike, EndpointRegistry, ExperimentalWebMcpAdapter, type McpClientLike, McpRuntimePlugin, McpToolResolver, MessageChannelTransport, type MessageChannelTransportOptions, type MessagePortLike, type RemoteEndpointConfig, type ServedSkill, TemporarySkillProvider, type TransportState, type WebMcpToolDescriptor, catalogMerge, connectRemoteEndpoint, endpointToolLlmName, parseEndpointToolLlmName, parseWebMcpToolLlmName, serveSkillAsMcp, validateJsonRpcMessage, webMcpToolLlmName };
package/dist/mcp.js CHANGED
@@ -1,6 +1,9 @@
1
- import { u as WebSkillError } from "./memoryArtifactStore-C9lFVqPF-U8nXvqL9.js";
2
- import { A as normalizeToolContent, O as mergeCatalogEntries } from "./dist-D5fsiETF.js";
1
+ import { l as WebSkillError } from "./dist-DS1sfgHa.js";
2
+ import { A as mergeCatalogEntries, M as normalizeToolContent } from "./dist-DZobLFh6.js";
3
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";
4
7
 
5
8
  //#region ../mcp/dist/index.js
6
9
  /**
@@ -41,12 +44,14 @@ var MessageChannelTransport = class {
41
44
  onmessage;
42
45
  #port;
43
46
  #allowedOrigins;
47
+ #strictOrigin;
44
48
  #connectionTimeoutMs;
45
49
  #state = "idle";
46
50
  #listener;
47
51
  #connectionTimer;
48
52
  constructor(port, options = {}) {
49
53
  this.#port = port;
54
+ this.#strictOrigin = options.strictOrigin ?? false;
50
55
  this.#connectionTimeoutMs = options.connectionTimeoutMs ?? 0;
51
56
  if (options.allowedOrigins !== void 0) this.#allowedOrigins = options.allowedOrigins;
52
57
  else {
@@ -87,7 +92,7 @@ var MessageChannelTransport = class {
87
92
  #originAllowed(origin) {
88
93
  if (this.#allowedOrigins === void 0) return true;
89
94
  if (this.#allowedOrigins.includes("*")) return true;
90
- if (origin === void 0 || origin === "") return true;
95
+ if (origin === void 0 || origin === "") return !this.#strictOrigin;
91
96
  return this.#allowedOrigins.includes(origin);
92
97
  }
93
98
  #onInbound(event) {
@@ -164,7 +169,7 @@ var EndpointRegistry = class {
164
169
  for (const resolve of queue) resolve(client);
165
170
  }
166
171
  };
167
- const messageOf$2 = (e) => e instanceof Error ? e.message : String(e);
172
+ const messageOf$3 = (e) => e instanceof Error ? e.message : String(e);
168
173
  const failure$1 = (code, message) => ({
169
174
  ok: false,
170
175
  content: [],
@@ -189,20 +194,20 @@ var McpToolResolver = class {
189
194
  try {
190
195
  client = this.#registry.get(endpoint);
191
196
  } catch (e) {
192
- return failure$1("MCP_ENDPOINT_UNAVAILABLE", messageOf$2(e));
197
+ return failure$1("MCP_ENDPOINT_UNAVAILABLE", messageOf$3(e));
193
198
  }
194
199
  let names;
195
200
  try {
196
201
  names = await this.#toolNames(endpoint, client);
197
202
  } catch (e) {
198
- return failure$1("MCP_ENDPOINT_UNAVAILABLE", `Failed to list tools: ${messageOf$2(e)}`);
203
+ return failure$1("MCP_ENDPOINT_UNAVAILABLE", `Failed to list tools: ${messageOf$3(e)}`);
199
204
  }
200
205
  if (!names.has(toolName)) {
201
206
  this.#cache.delete(endpoint);
202
207
  try {
203
208
  names = await this.#toolNames(endpoint, client);
204
209
  } catch (e) {
205
- return failure$1("MCP_ENDPOINT_UNAVAILABLE", `Failed to list tools: ${messageOf$2(e)}`);
210
+ return failure$1("MCP_ENDPOINT_UNAVAILABLE", `Failed to list tools: ${messageOf$3(e)}`);
206
211
  }
207
212
  if (!names.has(toolName)) return failure$1("MCP_TOOL_NOT_FOUND", `Tool "${toolName}" not found on endpoint "${endpoint}"`);
208
213
  }
@@ -213,7 +218,7 @@ var McpToolResolver = class {
213
218
  });
214
219
  return this.#normalizeCallResult(raw);
215
220
  } catch (e) {
216
- return failure$1("MCP_ENDPOINT_UNAVAILABLE", `Tool "${toolName}" on endpoint "${endpoint}" failed: ${messageOf$2(e)}`);
221
+ return failure$1("MCP_ENDPOINT_UNAVAILABLE", `Tool "${toolName}" on endpoint "${endpoint}" failed: ${messageOf$3(e)}`);
217
222
  }
218
223
  }
219
224
  async #toolNames(endpoint, client) {
@@ -260,7 +265,7 @@ function webMcpToolLlmName(toolName) {
260
265
  function parseWebMcpToolLlmName(llmName) {
261
266
  return llmName.startsWith("mcp__") && llmName.length > 5 ? llmName.slice(5) : void 0;
262
267
  }
263
- const messageOf$1 = (e) => e instanceof Error ? e.message : String(e);
268
+ const messageOf$2 = (e) => e instanceof Error ? e.message : String(e);
264
269
  const textOfContent = (content) => {
265
270
  if (typeof content === "string") return content;
266
271
  if (typeof content === "object" && content !== null) {
@@ -306,7 +311,7 @@ var TemporarySkillProvider = class {
306
311
  try {
307
312
  result = await client.getPrompt({ name });
308
313
  } catch (e) {
309
- throw new WebSkillError("SKILL_NOT_FOUND", `Prompt "${name}" not found on endpoint "${this.#endpoint}": ${messageOf$1(e)}`, e);
314
+ throw new WebSkillError("SKILL_NOT_FOUND", `Prompt "${name}" not found on endpoint "${this.#endpoint}": ${messageOf$2(e)}`, e);
310
315
  }
311
316
  const body = (result.messages ?? []).map((m) => textOfContent(m.content)).filter(Boolean).join("\n\n");
312
317
  return {
@@ -331,7 +336,7 @@ var TemporarySkillProvider = class {
331
336
  try {
332
337
  return this.#registry.get(this.#endpoint);
333
338
  } catch (e) {
334
- throw new WebSkillError("MCP_ENDPOINT_UNAVAILABLE", messageOf$1(e), e);
339
+ throw new WebSkillError("MCP_ENDPOINT_UNAVAILABLE", messageOf$2(e), e);
335
340
  }
336
341
  }
337
342
  };
@@ -367,7 +372,7 @@ function serveSkillAsMcp(server, skill) {
367
372
  * 实现单一来源在 runtime(runtime 自身合并也用同一函数)。
368
373
  */
369
374
  const catalogMerge = mergeCatalogEntries;
370
- const messageOf = (e) => e instanceof Error ? e.message : String(e);
375
+ const messageOf$1 = (e) => e instanceof Error ? e.message : String(e);
371
376
  const failure = (code, message) => ({
372
377
  ok: false,
373
378
  content: [],
@@ -430,7 +435,7 @@ var ExperimentalWebMcpAdapter = class {
430
435
  content: normalizeToolContent(await api.executeTool(toolName, JSON.stringify(args)))
431
436
  };
432
437
  } catch (e) {
433
- return failure("TOOL_EXECUTION_FAILED", `WebMCP tool "${toolName}" failed: ${messageOf(e)}`);
438
+ return failure("TOOL_EXECUTION_FAILED", `WebMCP tool "${toolName}" failed: ${messageOf$1(e)}`);
434
439
  }
435
440
  }
436
441
  };
@@ -510,6 +515,48 @@ var McpRuntimePlugin = class {
510
515
  };
511
516
  }
512
517
  };
518
+ const messageOf = (e) => e instanceof Error ? e.message : String(e);
519
+ /**
520
+ * 远程 MCP endpoint 装配:SDK 官方 StreamableHTTPClientTransport(默认)/
521
+ * SSEClientTransport(遗留)连接远端 server,注册进 EndpointRegistry——
522
+ * endpoint:tool 解析、TTL+版本缓存、临时技能消费自动生效。
523
+ * 返回 close 句柄:断开后 unregister(临时技能随既有生命周期自然消失)。
524
+ */
525
+ async function connectRemoteEndpoint(registry, config) {
526
+ const url = new URL(config.url);
527
+ const requestInit = config.headers ? { headers: config.headers } : void 0;
528
+ const transport = config.transport === "sse" ? new SSEClientTransport(url, { ...requestInit ? { requestInit } : {} }) : new StreamableHTTPClientTransport(url, { ...requestInit ? { requestInit } : {} });
529
+ const client = new Client({
530
+ name: "webskill-remote-client",
531
+ version: "0.1.0"
532
+ });
533
+ const unavailable = (e) => new WebSkillError("MCP_ENDPOINT_UNAVAILABLE", `Failed to connect remote MCP endpoint "${config.endpoint}" at ${config.url}: ${messageOf(e)}`, e);
534
+ try {
535
+ let connect = client.connect(transport);
536
+ if (config.timeoutMs && config.timeoutMs > 0) {
537
+ const timeoutMs = config.timeoutMs;
538
+ connect = Promise.race([connect, new Promise((_resolve, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error(`Connection timed out after ${timeoutMs}ms`)), timeoutMs))]);
539
+ }
540
+ await connect;
541
+ } catch (e) {
542
+ try {
543
+ await client.close();
544
+ } catch {}
545
+ throw unavailable(e);
546
+ }
547
+ registry.register(config.endpoint, client);
548
+ let closed = false;
549
+ return { close: async () => {
550
+ if (closed) return;
551
+ closed = true;
552
+ registry.unregister(config.endpoint);
553
+ try {
554
+ await client.close();
555
+ } catch (e) {
556
+ throw new WebSkillError("MCP_ENDPOINT_UNAVAILABLE", `Failed to close remote MCP endpoint "${config.endpoint}": ${messageOf(e)}`, e);
557
+ }
558
+ } };
559
+ }
513
560
 
514
561
  //#endregion
515
- export { EndpointRegistry, ExperimentalWebMcpAdapter, McpRuntimePlugin, McpToolResolver, MessageChannelTransport, TemporarySkillProvider, catalogMerge, endpointToolLlmName, parseEndpointToolLlmName, parseWebMcpToolLlmName, serveSkillAsMcp, validateJsonRpcMessage, webMcpToolLlmName };
562
+ export { EndpointRegistry, ExperimentalWebMcpAdapter, McpRuntimePlugin, McpToolResolver, MessageChannelTransport, TemporarySkillProvider, catalogMerge, connectRemoteEndpoint, endpointToolLlmName, parseEndpointToolLlmName, parseWebMcpToolLlmName, serveSkillAsMcp, validateJsonRpcMessage, webMcpToolLlmName };
@@ -0,0 +1,48 @@
1
+ //#region ../runtime/dist/memoryArtifactStore-C9lFVqPF.js
2
+ /** 内存 ArtifactStore:测试与浏览器降级用;索引随进程生命周期存在 */
3
+ var MemoryArtifactStore = class {
4
+ #byRun = /* @__PURE__ */ new Map();
5
+ #seq = 0;
6
+ async createTextArtifact(input) {
7
+ return this.#record({
8
+ runId: input.runId,
9
+ path: input.path,
10
+ type: "text",
11
+ size: new TextEncoder().encode(input.content).length,
12
+ mimeType: input.mimeType,
13
+ metadata: input.metadata
14
+ });
15
+ }
16
+ async createBinaryArtifact(input) {
17
+ return this.#record({
18
+ runId: input.runId,
19
+ path: input.path,
20
+ type: "binary",
21
+ size: input.content.length,
22
+ mimeType: input.mimeType,
23
+ metadata: input.metadata
24
+ });
25
+ }
26
+ async listArtifacts(runId) {
27
+ return [...this.#byRun.get(runId) ?? []];
28
+ }
29
+ #record(input) {
30
+ const artifact = {
31
+ id: `art-${++this.#seq}`,
32
+ runId: input.runId,
33
+ path: input.path,
34
+ type: input.type,
35
+ mimeType: input.mimeType,
36
+ size: input.size,
37
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
38
+ metadata: input.metadata
39
+ };
40
+ const list = this.#byRun.get(input.runId) ?? [];
41
+ list.push(artifact);
42
+ this.#byRun.set(input.runId, list);
43
+ return artifact;
44
+ }
45
+ };
46
+
47
+ //#endregion
48
+ export { MemoryArtifactStore as t };
package/dist/node.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { E as SKILL_MANIFEST_FILE, H as SkillsLockfile, L as SkillManifest, P as SkillInstallSource, T as SKILLS_LOCKFILE, W as VerifyResult } from "./types-CgNC-oQu-Dq_A1yA-.js";
2
- import { ct as createScriptContext } from "./index-oG5Nzgb9.js";
3
- import { a as LlmEnvConfig, c as OxcSchemaInferer, d as SkillManager, f as loadLlmConfigFromEnv, i as LlmCapabilities, l as SandboxOptions, m as readArchiveManifest, n as FileArtifactStore, o as NodeFS, p as probeLlmCapabilities, r as FileMemoryStore, s as NodeScriptExecutor, t as CliUiBridge, u as SandboxedScriptExecutor } from "./index-Dc4X2N54.js";
4
- export { CliUiBridge, FileArtifactStore, FileMemoryStore, type LlmCapabilities, type LlmEnvConfig, NodeFS, NodeScriptExecutor, OxcSchemaInferer, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, type SandboxOptions, SandboxedScriptExecutor, type SkillInstallSource, SkillManager, type SkillManifest, type SkillsLockfile, type VerifyResult, createScriptContext, loadLlmConfigFromEnv, probeLlmCapabilities, readArchiveManifest };
2
+ import { ft as createScriptContext } from "./index-CqMuvcb2.js";
3
+ import { _ as readArchiveManifest, a as LlmEnvConfig, c as OxcSchemaInferer, d as SandboxedScriptExecutor, f as SkillManager, g as probeLlmCapabilities, h as loadLlmConfigFromEnv, i as LlmCapabilities, l as ProviderEnvConfig, m as loadGoogleConfigFromEnv, n as FileArtifactStore, o as NodeFS, p as loadAnthropicConfigFromEnv, r as FileMemoryStore, s as NodeScriptExecutor, t as CliUiBridge, u as SandboxOptions } from "./index-CPuwsnmB.js";
4
+ export { CliUiBridge, FileArtifactStore, FileMemoryStore, type LlmCapabilities, type LlmEnvConfig, NodeFS, NodeScriptExecutor, OxcSchemaInferer, type ProviderEnvConfig, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, type SandboxOptions, SandboxedScriptExecutor, type SkillInstallSource, SkillManager, type SkillManifest, type SkillsLockfile, type VerifyResult, createScriptContext, loadAnthropicConfigFromEnv, loadGoogleConfigFromEnv, loadLlmConfigFromEnv, probeLlmCapabilities, readArchiveManifest };
package/dist/node.js CHANGED
@@ -1,5 +1,5 @@
1
- import { i as SKILL_MANIFEST_FILE, r as SKILLS_LOCKFILE } from "./memoryArtifactStore-C9lFVqPF-U8nXvqL9.js";
2
- import { S as createScriptContext } from "./dist-D5fsiETF.js";
3
- import { a as NodeScriptExecutor, c as SkillManager, d as readArchiveManifest, i as NodeFS, l as loadLlmConfigFromEnv, n as FileArtifactStore, o as OxcSchemaInferer, r as FileMemoryStore, s as SandboxedScriptExecutor, t as CliUiBridge, u as probeLlmCapabilities } from "./dist-Cc3Mqi3_.js";
1
+ import { n as SKILLS_LOCKFILE, r as SKILL_MANIFEST_FILE } from "./dist-DS1sfgHa.js";
2
+ import { w as createScriptContext } from "./dist-DZobLFh6.js";
3
+ import { a as NodeScriptExecutor, c as SkillManager, d as loadLlmConfigFromEnv, f as probeLlmCapabilities, i as NodeFS, l as loadAnthropicConfigFromEnv, n as FileArtifactStore, o as OxcSchemaInferer, p as readArchiveManifest, r as FileMemoryStore, s as SandboxedScriptExecutor, t as CliUiBridge, u as loadGoogleConfigFromEnv } from "./dist-Cm_j6Jol.js";
4
4
 
5
- export { CliUiBridge, FileArtifactStore, FileMemoryStore, NodeFS, NodeScriptExecutor, OxcSchemaInferer, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SandboxedScriptExecutor, SkillManager, createScriptContext, loadLlmConfigFromEnv, probeLlmCapabilities, readArchiveManifest };
5
+ export { CliUiBridge, FileArtifactStore, FileMemoryStore, NodeFS, NodeScriptExecutor, OxcSchemaInferer, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SandboxedScriptExecutor, SkillManager, createScriptContext, loadAnthropicConfigFromEnv, loadGoogleConfigFromEnv, loadLlmConfigFromEnv, probeLlmCapabilities, readArchiveManifest };
@@ -1,4 +1,4 @@
1
- import { u as WebSkillError } from "./memoryArtifactStore-C9lFVqPF-U8nXvqL9.js";
1
+ import { l as WebSkillError } from "./dist-DS1sfgHa.js";
2
2
 
3
3
  //#region ../runtime/dist/testing.js
4
4
  /**
package/dist/testing.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as MemoryArtifactStore } from "./memoryArtifactStore-C9lFVqPF-U8nXvqL9.js";
2
- import { n as MockLlmClient, r as MockUiBridge, t as InMemoryStore } from "./testing-pn3NhXSV.js";
1
+ import { t as MemoryArtifactStore } from "./memoryArtifactStore-C9lFVqPF-yFz6yJj0.js";
2
+ import { n as MockLlmClient, r as MockUiBridge, t as InMemoryStore } from "./testing-CbM6rJ-E.js";
3
3
 
4
4
  export { InMemoryStore, MemoryArtifactStore, MockLlmClient, MockUiBridge };
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-Dv4a1Jkm.js";
1
+ import { S as renderMiniMarkdown, m as collectValues, w as shapeInteractionValue, x as renderMiniChart, y as interactionToFormModel } from "./dist-DxGyAznR.js";
2
2
  import { useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
 
package/dist/ui-vue.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-Dv4a1Jkm.js";
1
+ import { S as renderMiniMarkdown, m as collectValues, w as shapeInteractionValue, x as renderMiniChart, y as interactionToFormModel } from "./dist-DxGyAznR.js";
2
2
  import { defineComponent, h, reactive, ref } from "vue";
3
3
 
4
4
  //#region ../ui-vue/dist/index.js
package/dist/ui.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { _ as RenderResultRequest, g as RenderBlock, o as InteractionRequest, r as ChartSpec, s as InteractionResponse, v as UiBridge } from "./types-CgNC-oQu-Dq_A1yA-.js";
2
- import { st as buildRenderResult } from "./index-oG5Nzgb9.js";
2
+ import { dt as buildRenderResult } from "./index-CqMuvcb2.js";
3
3
  //#region ../ui/dist/index.d.ts
4
4
  //#region src/model/formModel.d.ts
5
5
  interface FormModel {
@@ -174,16 +174,7 @@ declare function toA2uiMessages(request: InteractionRequest): A2uiMessage[];
174
174
  declare function fromA2uiAction(event: unknown): InteractionResponse;
175
175
  //#endregion
176
176
  //#region src/a2uiRuntime/litRendererBridge.d.ts
177
- /**
178
- * A2UI 运行时桥(Lit 渲染器路径):
179
- * InteractionRequest →(7A 转换器)→ A2UI v0.9.1 消息序列 →
180
- * @a2ui/web_core MessageProcessor 处理 → @a2ui/lit 渲染到容器 →
181
- * action 事件(合并双向绑定的表单数据模型)→ fromA2uiAction → InteractionResponse。
182
- *
183
- * 版本对齐:渲染器 @a2ui/lit@0.10.x 经 v0_9 入口同时接受 v0.9 / v0.9.1 消息
184
- * (schema 枚举 ['v0.9','v0.9.1']),与 7A v0.9.1 转换产物直接兼容。
185
- * @experimental
186
- */
177
+ /** @experimental */
187
178
  declare class LitRendererBridge implements UiBridge {
188
179
  #private;
189
180
  constructor(deps: {
package/dist/ui.js CHANGED
@@ -1,4 +1,4 @@
1
- import { x as buildRenderResult } from "./dist-D5fsiETF.js";
2
- import { C as renderRenderResult, D as toVercelToolInvocation, E as toOpenUiLang, S as renderMiniMarkdown, T as toA2uiMessages, _ as fromOpenUiAction, a as CHART_PALETTE, b as renderBlocks, c as OPENUI_SUBMIT_ACTION, d as WEBSKILL_STYLES_CSS, f as WebFormBridge, g as fromA2uiAction, h as ensureStyles, i as A2UI_VERSION, l as VERCEL_INTERACTION_TOOL_NAME, m as collectValues, n as A2UI_CANCEL_ACTION, o as LitRendererBridge, p as chartToTable, r as A2UI_SUBMIT_ACTION, s as OPENUI_CANCEL_ACTION, t as A2UI_BASIC_CATALOG_ID, u as VercelUiBridge, v as fromVercelToolResult, w as shapeInteractionValue, x as renderMiniChart, y as interactionToFormModel } from "./dist-Dv4a1Jkm.js";
1
+ import { C as buildRenderResult } from "./dist-DZobLFh6.js";
2
+ import { C as renderRenderResult, D as toVercelToolInvocation, E as toOpenUiLang, S as renderMiniMarkdown, T as toA2uiMessages, _ as fromOpenUiAction, a as CHART_PALETTE, b as renderBlocks, c as OPENUI_SUBMIT_ACTION, d as WEBSKILL_STYLES_CSS, f as WebFormBridge, g as fromA2uiAction, h as ensureStyles, i as A2UI_VERSION, l as VERCEL_INTERACTION_TOOL_NAME, m as collectValues, n as A2UI_CANCEL_ACTION, o as LitRendererBridge, p as chartToTable, r as A2UI_SUBMIT_ACTION, s as OPENUI_CANCEL_ACTION, t as A2UI_BASIC_CATALOG_ID, u as VercelUiBridge, v as fromVercelToolResult, w as shapeInteractionValue, x as renderMiniChart, y as interactionToFormModel } from "./dist-DxGyAznR.js";
3
3
 
4
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webskill/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "WebSkill — browser/Node agent skill runtime (skills, tools, MCP, governance, UI)",
5
5
  "license": "MIT",
6
6
  "type": "module",