@webskill/sdk 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mcp.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as SkillDocument, P as SkillCatalogEntry, T as JsonSchema, m as LlmToolSpec } from "./types-CKm5G_eQ-krKWW8WV.js";
2
- import { it as ToolResult, v as ExternalSkillProvider, xt as mergeCatalogEntries, y as ExternalToolSource } from "./index-DJOha4b6.js";
1
+ import { G as SkillDocument, P as JsonSchema, U as SkillCatalogEntry, m as LlmToolSpec } from "./types-AmKCKJn_-BogJPQHU.js";
2
+ import { St as mergeCatalogEntries, it as ToolResult, v as ExternalSkillProvider, y as ExternalToolSource } from "./index-QrHtAudz.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";
@@ -214,7 +214,7 @@ declare class ExperimentalWebMcpAdapter {
214
214
  enabled?: boolean;
215
215
  });
216
216
  isAvailable(): boolean;
217
- /** 工具清单(listTools 缺失/失败时返回 undefined);描述含 inputSchema 时透传 */
217
+ /** 工具清单(listTools 缺失时返回 undefined;调用失败时告警后返回 undefined) */
218
218
  listTools(): Promise<WebMcpToolDescriptor[] | undefined>;
219
219
  /** 工具名清单(listTools 缺失/失败时返回 undefined) */
220
220
  listToolNames(): Promise<string[] | undefined>;
@@ -235,6 +235,8 @@ declare class McpRuntimePlugin implements ExternalToolSource {
235
235
  resolver?: McpToolResolver;
236
236
  /** 已知的 endpoint 名(注销后仍按 MCP_ENDPOINT_UNAVAILABLE 响应,而非 TOOL_NOT_FOUND) */
237
237
  endpoints?: string[];
238
+ /** endpoint 不可用时的告警出口(默认 console.warn) */
239
+ onWarning?(message: string): void;
238
240
  });
239
241
  listToolSpecs(): Promise<LlmToolSpec[]>;
240
242
  canHandle(llmToolName: string): boolean;
package/dist/mcp.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { C as messageOf, d as assertRemoteUrlAllowed, u as WebSkillError } from "./dist-BQzncxXg.js";
2
- import { P as normalizeToolContent, j as mergeCatalogEntries } from "./dist-BXpDDZpR.js";
2
+ import { I as normalizeToolContent, M as mergeCatalogEntries } from "./dist-B9VLwOME.js";
3
3
 
4
4
  //#region ../mcp/dist/index.js
5
5
  /**
@@ -418,13 +418,14 @@ var ExperimentalWebMcpAdapter = class {
418
418
  isAvailable() {
419
419
  return this.#enabled && typeof this.#resolveApi()?.executeTool === "function";
420
420
  }
421
- /** 工具清单(listTools 缺失/失败时返回 undefined);描述含 inputSchema 时透传 */
421
+ /** 工具清单(listTools 缺失时返回 undefined;调用失败时告警后返回 undefined) */
422
422
  async listTools() {
423
423
  const api = this.#resolveApi();
424
424
  if (typeof api?.listTools !== "function") return void 0;
425
425
  try {
426
426
  return extractToolDescriptors(await api.listTools());
427
- } catch {
427
+ } catch (e) {
428
+ console.warn(`[webskill] navigator.modelContext.listTools() failed: ${e instanceof Error ? e.message : String(e)}`);
428
429
  return;
429
430
  }
430
431
  }
@@ -460,11 +461,13 @@ var McpRuntimePlugin = class {
460
461
  #resolver;
461
462
  #webMcp;
462
463
  #configuredEndpoints;
464
+ #onWarning;
463
465
  constructor(deps) {
464
466
  this.#registry = deps.registry;
465
467
  this.#resolver = deps.resolver ?? new McpToolResolver(deps.registry);
466
468
  this.#webMcp = deps.webMcp;
467
469
  this.#configuredEndpoints = deps.endpoints ?? [];
470
+ this.#onWarning = deps.onWarning ?? ((message) => console.warn(message));
468
471
  }
469
472
  #endpoints() {
470
473
  return [.../* @__PURE__ */ new Set([...this.#configuredEndpoints, ...this.#registry.endpoints()])];
@@ -481,7 +484,9 @@ var McpRuntimePlugin = class {
481
484
  properties: {}
482
485
  }
483
486
  });
484
- } catch {}
487
+ } catch (e) {
488
+ this.#onWarning(`[webskill] MCP endpoint "${endpoint}" is unavailable; its tools are omitted from this turn: ${e instanceof Error ? e.message : String(e)}`);
489
+ }
485
490
  if (this.#webMcp?.isAvailable()) {
486
491
  const tools = await this.#webMcp.listTools();
487
492
  for (const tool of tools ?? []) specs.push({
package/dist/node.d.ts CHANGED
@@ -1,5 +1,50 @@
1
- import { B as SkillManifest, G as SkillsLockfile, L as SkillInstallSource, O as SKILLS_LOCKFILE, k as SKILL_MANIFEST_FILE, q as VerifyResult } from "./types-CKm5G_eQ-krKWW8WV.js";
2
- import { ht as createScriptContext } from "./index-DJOha4b6.js";
1
+ import { K as SkillInstallSource, L as SKILLS_LOCKFILE, N as FileSystemProvider, R as SKILL_MANIFEST_FILE, Y as SkillManifest, et as SkillsLockfile, nt as VerifyResult, v as UiBridge } from "./types-AmKCKJn_-BogJPQHU.js";
2
+ import { Q as ScriptExecutor, dt as WebSkillRuntime, ft as WebSkillRuntimeDeps, ht as createScriptContext } from "./index-QrHtAudz.js";
3
3
  import { n as LlmEnvConfig, s as probeLlmCapabilities, t as LlmCapabilities } from "./env-BPUBZCwJ-4jat_SVG.js";
4
- import { a as NodeScriptExecutor, c as ProcessSandboxOptions, d as SkillManager, f as exportArchive, i as NodeFS, l as SandboxOptions, n as FileArtifactStore, o as OxcSchemaInferer, p as readArchiveManifest, r as FileMemoryStore, s as ProcessSandboxExecutor, t as CliUiBridge, u as SandboxedScriptExecutor } from "./index-DRlYzdr2.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 };
4
+ import { C as ProcessSandboxExecutor, D as SkillManager, E as SandboxedScriptExecutor, O as exportArchive, S as OxcSchemaInferer, T as SandboxOptions, _ as CliUiBridge, a as AuditLog, b as NodeFS, c as CandidateSkill, d as CandidateStore, h as SkillVersionStore, k as readArchiveManifest, r as ApprovalPolicy, v as FileArtifactStore, w as ProcessSandboxOptions, x as NodeScriptExecutor, y as FileMemoryStore } from "./skillVersionStore-B7rGjtMi-BgnQho9v.js";
5
+ //#region ../governance/dist/node.d.ts
6
+ //#region src/approval/approvalWorkflow.d.ts
7
+ /** 审批工作流:review(UiBridge confirm 真实接线)/ publish(校验→安装→版本→审计) */
8
+ declare class ApprovalWorkflow {
9
+ #private;
10
+ constructor(deps: {
11
+ policy: ApprovalPolicy;
12
+ audit: AuditLog;
13
+ store: CandidateStore;
14
+ skillManager: SkillManager;
15
+ versions: SkillVersionStore;
16
+ fs?: FileSystemProvider;
17
+ });
18
+ /** 策略评估;needs-human 时经 UiBridge confirm 真实询问,按应答迁移状态 */
19
+ review(candidateId: string, input: {
20
+ actor: string;
21
+ uiBridge?: UiBridge;
22
+ }): Promise<CandidateSkill>;
23
+ /** publish 全链路:approved 前置 → 写出 staging → validateSkills → install → 版本 → 审计 */
24
+ publish(candidateId: string, input: {
25
+ actor: string;
26
+ }): Promise<SkillManifest>;
27
+ /**
28
+ * 真实回滚(受审批保护:仅经显式 actor 调用并全程审计):
29
+ * 版本归档解包 → staging 校验 → 原子安装(复用安装管线 swap)→ 追加新版本 + 审计。
30
+ * RepairPlanner 的 rollback 选项(targetVersionId)经本方法执行。
31
+ */
32
+ applyRollback(skillName: string, versionId: string, input: {
33
+ actor: string;
34
+ reason?: string;
35
+ }): Promise<SkillManifest>;
36
+ }
37
+ //#endregion
38
+ //#region src/evaluation/evaluationRuntime.d.ts
39
+ /**
40
+ * 治理评估专用 runtime 装配(不可信技能试用路径):
41
+ * 默认注入 ProcessSandboxExecutor(fork + --permission 真实进程隔离;子进程
42
+ * env 默认清空防密钥泄露,需透传时经 ProcessSandboxOptions.envWhitelist 显式放行)。
43
+ * 可配置 executor 切回 SandboxedScriptExecutor(worker_threads 能力面收敛形态,
44
+ * 非安全边界;envWhitelist 同样适用于该执行器)。
45
+ */
46
+ declare function createEvaluationRuntime(deps: WebSkillRuntimeDeps & {
47
+ executor?: ScriptExecutor;
48
+ }): WebSkillRuntime;
49
+ //#endregion
50
+ export { ApprovalWorkflow, 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, createEvaluationRuntime, createScriptContext, exportArchive, probeLlmCapabilities, readArchiveManifest };