@webskill/sdk 0.2.8 → 0.3.0

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.
Files changed (35) hide show
  1. package/README.md +42 -0
  2. package/dist/browser.d.ts +2 -2
  3. package/dist/browser.js +4 -5
  4. package/dist/client-BCM6Z3yq-qUQNkKrK.js +7787 -0
  5. package/dist/{dist-BQzncxXg.js → dist-8oQRa8Xz.js} +212 -13
  6. package/dist/{dist-CtBLBbEz.js → dist-ZKaM8j06.js} +2 -2
  7. package/dist/{dist-B9VLwOME.js → dist-rorEJsNi.js} +530 -44
  8. package/dist/governance.d.ts +4 -4
  9. package/dist/governance.js +1 -1
  10. package/dist/{index-QrHtAudz.d.ts → index-8d-oEDww.d.ts} +201 -2
  11. package/dist/{index-7DVaZJU7.d.ts → index-wiV5X8Rz.d.ts} +2 -2
  12. package/dist/index.d.ts +3 -3
  13. package/dist/index.js +3 -3
  14. package/dist/{jsonRenderRegistry-9GrWP_hE-CQY8bT9w.js → jsonRenderRegistry-9GrWP_hE-U6Do3Kid.js} +1 -1
  15. package/dist/mcp.d.ts +2 -2
  16. package/dist/mcp.js +2 -2
  17. package/dist/node.d.ts +293 -4
  18. package/dist/node.js +281 -7
  19. package/dist/{openUiLibrary-B8-Cvou9-D3RsU2EB.js → openUiLibrary-B8-Cvou9-BbpNTXS3.js} +1 -1
  20. package/dist/skillVersionStore-DOEI9ptb-BxbYL70B.d.ts +127 -0
  21. package/dist/stdio-CFMoANJJ-BxrTeXh7.js +31 -0
  22. package/dist/{testing-BUoXvm1u.js → testing-CsrG3XLz.js} +1 -1
  23. package/dist/testing.d.ts +1 -1
  24. package/dist/testing.js +1 -1
  25. package/dist/{types-AmKCKJn_-BogJPQHU.d.ts → types-AmKCKJn_-VGabeXK4.d.ts} +137 -2
  26. package/dist/types-WovEf4ED-CZSDiiBU.js +6215 -0
  27. package/dist/ui-react.d.ts +2 -2
  28. package/dist/ui-react.js +5 -5
  29. package/dist/ui-vue.d.ts +1 -1
  30. package/dist/ui-vue.js +1 -1
  31. package/dist/ui.d.ts +2 -2
  32. package/dist/ui.js +2 -2
  33. package/dist/{webskillLitCatalog-CNaUpasU-CfSRvqCZ.js → webskillLitCatalog-CNaUpasU-BslMcxRZ.js} +1 -1
  34. package/package.json +4 -7
  35. package/dist/skillVersionStore-B7rGjtMi-BgnQho9v.d.ts +0 -365
package/README.md CHANGED
@@ -49,6 +49,12 @@ npm install @webskill/sdk
49
49
  React/Vue integrations require their respective peer dependencies
50
50
  (`react` + `react-dom`, or `vue`), which are optional.
51
51
 
52
+ `zod` ships as a direct dependency: the `@webskill/sdk/ui` catalog references it
53
+ in its static import graph and in its public types, so declaring it optional
54
+ would misrepresent the artifact. Hosts do not need to install it themselves.
55
+ `tar`, `oxc-parser` and `@modelcontextprotocol/sdk` remain optional peers —
56
+ they are loaded lazily and only when the corresponding API is called.
57
+
52
58
  ## Requirements
53
59
 
54
60
  - Node.js >= 22.18 (native type stripping for `.ts` skill scripts)
@@ -214,6 +220,42 @@ import { MockLlmClient, MockUiBridge, InMemoryStore, MemoryArtifactStore } from
214
220
  const llm = new MockLlmClient([{ content: 'deterministic answer' }]);
215
221
  ```
216
222
 
223
+ ## `allowed-tools`
224
+
225
+ A skill may narrow the tool surface it needs by declaring `allowed-tools` in its
226
+ `SKILL.md` frontmatter. Three kinds of tools can be listed:
227
+
228
+ ```yaml
229
+ allowed-tools:
230
+ - render # a script of this skill (scripts/render.ts)
231
+ - endpoint:github/create_issue # one tool of an MCP endpoint
232
+ - endpoint:github/* # every tool of an MCP endpoint
233
+ - mcp#read_file # one page-provided (WebMCP) tool
234
+ ```
235
+
236
+ Matching rules:
237
+
238
+ - Only whole-entry matches and a trailing `/*` are supported. Wildcards in any
239
+ other position are not, and a bare `endpoint:github` is **not** a prefix
240
+ wildcard — it simply matches nothing.
241
+ - A bare identifier means a script of the declaring skill only. It never grants
242
+ access to another skill's script of the same name.
243
+
244
+ When several skills are active at the same time:
245
+
246
+ | Situation | Result |
247
+ | ---------------------------------------- | -------------------------------------------------------------------------------------------------------- |
248
+ | No active skill declares `allowed-tools` | Unrestricted |
249
+ | At least one active skill declares it | A tool is allowed if it matches any declaring skill's list, **or** if some active skill declares nothing |
250
+
251
+ Enforcement level differs per tool kind in 0.3.0:
252
+
253
+ - **Scripts** — enforced since 0.0.5: a script outside the list is not
254
+ registered, and calling it by name returns `TOOL_NOT_FOUND`.
255
+ - **MCP / WebMCP tools** — 0.3.0 only records a `run.warning` naming the tool
256
+ and the entry to add, and still allows the call. This becomes a rejection in
257
+ 0.4.0, so treat the warning as a build error in your own pipeline.
258
+
217
259
  ## Stability
218
260
 
219
261
  This package follows semver starting at 0.1.0. Public symbols carry JSDoc
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { K as SkillInstallSource, M as FileStat, N as FileSystemProvider, O as ArchiveLimits, Y as SkillManifest, _ as RenderResultRequest, a as InteractionPolicy, c as LlmClient, d as LlmResponse, et as SkillsLockfile, f as LlmStreamEvent, nt as VerifyResult, o as InteractionRequest, s as InteractionResponse, v as UiBridge } from "./types-AmKCKJn_-BogJPQHU.js";
2
- import { N as NetworkPolicy, Ot as parseBridgeRequest, Q as ScriptExecutor, Z as ScriptExecutionContext, d as BridgeCapabilities, it as ToolResult, m as BridgeResponse, nt as ToolDefinition, p as BridgeRequest, pt as bridgeError, u as ApprovalScope, ut as WebSkillApi, v as ExternalSkillProvider, y as ExternalToolSource } from "./index-QrHtAudz.js";
1
+ import { $ as SkillInstallSource, N as FileStat, O as ArchiveLimits, P as FileSystemProvider, _ as RenderResultRequest, a as InteractionPolicy, c as LlmClient, d as LlmResponse, f as LlmStreamEvent, lt as SkillsLockfile, mt as VerifyResult, o as InteractionRequest, rt as SkillManifest, s as InteractionResponse, v as UiBridge } from "./types-AmKCKJn_-VGabeXK4.js";
2
+ import { Ct as WebSkillApi, Et as bridgeError, F as NetworkPolicy, Vt as parseBridgeRequest, _t as ToolResult, ct as ScriptExecutor, d as BridgeCapabilities, ht as ToolDefinition, m as BridgeResponse, p as BridgeRequest, st as ScriptExecutionContext, u as ApprovalScope, v as ExternalSkillProvider, y as ExternalToolSource } from "./index-8d-oEDww.js";
3
3
  //#region ../browser/dist/index.d.ts
4
4
  //#region src/fs/featureDetection.d.ts
5
5
  /** 检测当前环境是否可用 OPFS(navigator.storage.getDirectory) */
package/dist/browser.js CHANGED
@@ -1,6 +1,6 @@
1
- import { C as messageOf, D as readResponseWithLimit, E as parseSkillPackManifest, M as unzipWithLimits, N as validateSkills, P as verifyManifest, T as parseSkillMarkdown, b as exportSkills, c as SkillDiscovery, d as assertRemoteUrlAllowed, h as buildManifest, i as SKILL_MANIFEST_FILE, j as resolveInsideRoot, m as buildCatalog, p as atomicWriteText, r as SKILLS_LOCKFILE, s as SKILL_PACK_FILE, u as WebSkillError, x as isValidSkillName } from "./dist-BQzncxXg.js";
2
- import { C as bridgeError, E as createWebSkillApi, I as normalizeToolContent, L as normalizeToolError, M as mergeCatalogEntries, N as networkPolicyLibSource, R as parseBridgeRequest, c as FsArtifactStore, h as ProgressiveRouter, i as AgentLoop, l as FsMemoryStore, m as OpenAiCompatibleClient, o as CapabilityApproval, u as FsRunSnapshotStore, y as RUN_SNAPSHOT_SCHEMA_VERSION } from "./dist-B9VLwOME.js";
3
- import { n as MockLlmClient } from "./testing-BUoXvm1u.js";
1
+ import { A as parseSkillMarkdown, B as unzipWithLimits, H as verifyManifest, L as resolveInsideRoot, M as readResponseWithLimit, O as messageOf, T as isValidSkillName, V as validateSkills, _ as atomicWriteText, f as SkillDiscovery, h as assertRemoteUrlAllowed, j as parseSkillPackManifest, m as WebSkillError, o as SKILLS_LOCKFILE, r as MANIFEST_EXCLUDED_FILES, s as SKILL_MANIFEST_FILE, u as SKILL_PACK_FILE, v as buildCatalog, w as exportSkills, y as buildManifest } from "./dist-8oQRa8Xz.js";
2
+ import { A as createWebSkillApi, B as normalizeToolContent, D as bridgeError, H as parseBridgeRequest, I as mergeCatalogEntries, L as networkPolicyLibSource, V as normalizeToolError, _ as ProgressiveRouter, c as FsArtifactStore, g as OpenAiCompatibleClient, i as AgentLoop, l as FsMemoryStore, o as CapabilityApproval, u as FsRunSnapshotStore, x as RUN_SNAPSHOT_SCHEMA_VERSION } from "./dist-rorEJsNi.js";
3
+ import { n as MockLlmClient } from "./testing-CsrG3XLz.js";
4
4
 
5
5
  //#region ../browser/dist/index.js
6
6
  /** 检测当前环境是否可用 OPFS(navigator.storage.getDirectory) */
@@ -702,10 +702,9 @@ var BrowserSkillManager = class {
702
702
  }
703
703
  }
704
704
  async #createManifest(skillRoot, input) {
705
- const excluded = /* @__PURE__ */ new Set([SKILL_MANIFEST_FILE, SKILLS_LOCKFILE]);
706
705
  const files = [];
707
706
  for (const rel of (await listFiles(this.#fs, skillRoot)).sort()) {
708
- if (excluded.has(rel.split("/").pop() ?? "")) continue;
707
+ if (MANIFEST_EXCLUDED_FILES.has(rel.split("/").pop() ?? "")) continue;
709
708
  const content = await this.#fs.readBinary(`${skillRoot}/${rel}`);
710
709
  files.push({
711
710
  path: rel,