@webskill/sdk 0.8.0 → 0.9.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/dist/agent.d.ts +1 -1
  2. package/dist/agent.js +1 -1
  3. package/dist/browser.d.ts +3 -3
  4. package/dist/browser.js +22 -8
  5. package/dist/{catalogComponents-DfxxfUvn-D55Gbb2l.js → catalogComponents-DfxxfUvn-T7Ic8QFV.js} +593 -562
  6. package/dist/{dist-CJqQsIm9.js → dist-BQe1uglQ.js} +2 -2
  7. package/dist/{dist-59XlqDuv.js → dist-Bev6i6Ip.js} +10 -2
  8. package/dist/{dist-DmI5SBBF.js → dist-CFmkV45C.js} +44 -12
  9. package/dist/{eventTypes-g1BXL6x5-CibcOftR.js → eventTypes-DbOpAECr-BjcjZVms.js} +10 -2
  10. package/dist/governance.d.ts +11 -3
  11. package/dist/governance.js +9 -9
  12. package/dist/{index-P9J2LTfU.d.ts → index-DXNTIa-6.d.ts} +2 -2
  13. package/dist/{index-fLskQfAS.d.ts → index-lLcCpHE-.d.ts} +2 -2
  14. package/dist/{index-K-eewlGL.d.ts → index-znZjobkr.d.ts} +7 -2
  15. package/dist/index.d.ts +11 -3
  16. package/dist/index.js +13 -4
  17. package/dist/mcp.d.ts +7 -2
  18. package/dist/mcp.js +9 -5
  19. package/dist/{memoryArtifactStore-52Zn9npI-upv5OWYf.js → memoryArtifactStore-52Zn9npI-LbCQaqyx.js} +1 -1
  20. package/dist/node.d.ts +3 -3
  21. package/dist/node.js +6 -6
  22. package/dist/{openUiLibrary-DURlAxjk-CU6AzfSW.js → openUiLibrary-DURlAxjk-Do_yqg3u.js} +2 -2
  23. package/dist/{skillVersionStore-Bl-ElD45-gRfSaAby.d.ts → skillVersionStore-Bl-ElD45-dMJ8Ybhb.d.ts} +1 -1
  24. package/dist/{testing-BCUO5gZR.js → testing-Csg5ljNm.js} +2 -2
  25. package/dist/testing.d.ts +1 -1
  26. package/dist/testing.js +2 -2
  27. package/dist/{types-B3n0cMZu-BdcqQ35O.d.ts → types-B3n0cMZu-BDhheIhX.d.ts} +9 -1
  28. package/dist/ui-react.d.ts +8 -2
  29. package/dist/ui-react.js +8 -5
  30. package/dist/ui-vue.d.ts +1 -1
  31. package/dist/ui-vue.js +1 -1
  32. package/dist/ui.d.ts +3 -3
  33. package/dist/ui.js +2 -2
  34. package/dist/{webskillLitCatalog-DwTwSBFt-DiXXpNZA.js → webskillLitCatalog-DwTwSBFt-BG7kL-Es.js} +1 -1
  35. package/package.json +1 -1
package/dist/agent.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as TodoListener, A as PagePerceptionReader, B as SKILL_GENERATION_SYSTEM_PROMPT, C as PageActionRequest, D as PageAuditSink, E as PageActionUi, F as PerceptionAuditSink, G as SkillGenerator, H as SkillGenerationOutcome, I as PerceptionCaptureOptions, J as SubAgentRunner, K as SkillGeneratorOptions, L as PerceptionRecord, M as ParentBudget, N as PerceivedImage, O as PagePerceptionPolicy, P as PerceivedNode, Q as TodoList, R as PerceptionResult, S as PageActionRecord, T as PageActionToolSourceOptions, U as SkillGenerationPolicy, V as SkillCandidateSink, W as SkillGenerationToolSourceOptions, X as TodoEvent, Y as TODO_SYSTEM_PROMPT, Z as TodoItem, _ as PageActionExecutor, a as DelegationOrchestratorOptions, at as createPagePerceptionToolSource, b as PageActionPolicy, c as DelegationToolSourceOptions, ct as withDelegationOrigin, d as ImageCaptureBudget, et as TodoStatus, f as MANAGE_TODO_TOOL, g as PERCEPTION_SYSTEM_PROMPT, h as PERCEIVE_PAGE_TOOL, i as DelegationOrchestrator, it as createPageActionToolSource, j as PagePerceptionToolSourceOptions, k as PagePerceptionPolicyOptions, l as GENERATE_SKILL_TOOL, m as PAGE_ACTION_TOOL, n as DELEGATION_SYSTEM_PROMPT, nt as TodoToolSourceOptions, o as DelegationRequest, ot as createSkillGenerationToolSource, p as PAGE_ACTION_SYSTEM_PROMPT, q as SubAgentRunInput, r as DelegationBudget, rt as createDelegationToolSource, s as DelegationResult, st as createTodoToolSource, t as DELEGATE_TASK_TOOL, tt as TodoStore, u as GeneratedSkillDraft, v as PageActionKind, w as PageActionScope, x as PageActionPolicyOptions, y as PageActionOutcome, z as PerceptionScope } from "./index-fLskQfAS.js";
1
+ import { $ as TodoListener, A as PagePerceptionReader, B as SKILL_GENERATION_SYSTEM_PROMPT, C as PageActionRequest, D as PageAuditSink, E as PageActionUi, F as PerceptionAuditSink, G as SkillGenerator, H as SkillGenerationOutcome, I as PerceptionCaptureOptions, J as SubAgentRunner, K as SkillGeneratorOptions, L as PerceptionRecord, M as ParentBudget, N as PerceivedImage, O as PagePerceptionPolicy, P as PerceivedNode, Q as TodoList, R as PerceptionResult, S as PageActionRecord, T as PageActionToolSourceOptions, U as SkillGenerationPolicy, V as SkillCandidateSink, W as SkillGenerationToolSourceOptions, X as TodoEvent, Y as TODO_SYSTEM_PROMPT, Z as TodoItem, _ as PageActionExecutor, a as DelegationOrchestratorOptions, at as createPagePerceptionToolSource, b as PageActionPolicy, c as DelegationToolSourceOptions, ct as withDelegationOrigin, d as ImageCaptureBudget, et as TodoStatus, f as MANAGE_TODO_TOOL, g as PERCEPTION_SYSTEM_PROMPT, h as PERCEIVE_PAGE_TOOL, i as DelegationOrchestrator, it as createPageActionToolSource, j as PagePerceptionToolSourceOptions, k as PagePerceptionPolicyOptions, l as GENERATE_SKILL_TOOL, m as PAGE_ACTION_TOOL, n as DELEGATION_SYSTEM_PROMPT, nt as TodoToolSourceOptions, o as DelegationRequest, ot as createSkillGenerationToolSource, p as PAGE_ACTION_SYSTEM_PROMPT, q as SubAgentRunInput, r as DelegationBudget, rt as createDelegationToolSource, s as DelegationResult, st as createTodoToolSource, t as DELEGATE_TASK_TOOL, tt as TodoStore, u as GeneratedSkillDraft, v as PageActionKind, w as PageActionScope, x as PageActionPolicyOptions, y as PageActionOutcome, z as PerceptionScope } from "./index-lLcCpHE-.js";
2
2
  export { DELEGATE_TASK_TOOL, DELEGATION_SYSTEM_PROMPT, type DelegationBudget, DelegationOrchestrator, type DelegationOrchestratorOptions, type DelegationRequest, type DelegationResult, type DelegationToolSourceOptions, GENERATE_SKILL_TOOL, type GeneratedSkillDraft, type ImageCaptureBudget, MANAGE_TODO_TOOL, PAGE_ACTION_SYSTEM_PROMPT, PAGE_ACTION_TOOL, PERCEIVE_PAGE_TOOL, PERCEPTION_SYSTEM_PROMPT, type PageActionExecutor, type PageActionKind, type PageActionOutcome, PageActionPolicy, type PageActionPolicyOptions, type PageActionRecord, type PageActionRequest, type PageActionScope, type PageActionToolSourceOptions, type PageActionUi, type PageAuditSink, PagePerceptionPolicy, type PagePerceptionPolicyOptions, type PagePerceptionReader, type PagePerceptionToolSourceOptions, type ParentBudget, type PerceivedImage, type PerceivedNode, type PerceptionAuditSink, type PerceptionCaptureOptions, type PerceptionRecord, type PerceptionResult, type PerceptionScope, SKILL_GENERATION_SYSTEM_PROMPT, type SkillCandidateSink, type SkillGenerationOutcome, type SkillGenerationPolicy, type SkillGenerationToolSourceOptions, SkillGenerator, type SkillGeneratorOptions, type SubAgentRunInput, type SubAgentRunner, TODO_SYSTEM_PROMPT, type TodoEvent, type TodoItem, type TodoList, type TodoListener, type TodoStatus, TodoStore, type TodoToolSourceOptions, createDelegationToolSource, createPageActionToolSource, createPagePerceptionToolSource, createSkillGenerationToolSource, createTodoToolSource, withDelegationOrigin };
package/dist/agent.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as messageOf, D as isValidSkillName, M as parseSkillMarkdown, m as WebSkillError } from "./dist-59XlqDuv.js";
1
+ import { M as messageOf, P as parseSkillMarkdown, h as WebSkillError, k as isValidSkillName } from "./dist-Bev6i6Ip.js";
2
2
 
3
3
  //#region ../agent/dist/index.js
4
4
  const STATUSES = [
package/dist/browser.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { A as ArchiveLimits, F as FileStat, I as FileSystemProvider, St as WebSkillError, _ as MemoryStore, _t as TrustedKeyStore, at as SkillInstallSource, c as InteractionResponse, ht as SkillsLockfile, l as LlmClient, lt as SkillManifest, m as LlmStreamEvent, o as InteractionPolicy, p as LlmResponse, s as InteractionRequest, u as LlmCompleteInput, x as UiBridge, xt as VerifyResult, y as RenderResultRequest, yt as UnsignedPolicy } from "./types-B3n0cMZu-BdcqQ35O.js";
2
- import { Et as ScriptExecutor, O as ExternalSkillProvider, Tt as ScriptExecutionContext, Vn as parseBridgeRequest, Y as NetworkPolicy, Yt as ToolResult, _ as BridgeCapabilities, _n as bridgeError, b as BridgeResponse, f as ApprovalScope, fn as WebSkillApi, k as ExternalToolSource, qt as ToolDefinition, y as BridgeRequest } from "./index-K-eewlGL.js";
3
- import { A as PagePerceptionReader, C as PageActionRequest, I as PerceptionCaptureOptions, O as PagePerceptionPolicy, P as PerceivedNode, R as PerceptionResult, _ as PageActionExecutor, w as PageActionScope, y as PageActionOutcome, z as PerceptionScope } from "./index-fLskQfAS.js";
1
+ import { Ct as WebSkillError, I as FileStat, L as FileSystemProvider, St as VerifyResult, _ as MemoryStore, bt as UnsignedPolicy, c as InteractionResponse, gt as SkillsLockfile, j as ArchiveLimits, l as LlmClient, m as LlmStreamEvent, o as InteractionPolicy, ot as SkillInstallSource, p as LlmResponse, s as InteractionRequest, u as LlmCompleteInput, ut as SkillManifest, vt as TrustedKeyStore, x as UiBridge, y as RenderResultRequest } from "./types-B3n0cMZu-BDhheIhX.js";
2
+ import { Et as ScriptExecutor, O as ExternalSkillProvider, Tt as ScriptExecutionContext, Vn as parseBridgeRequest, Y as NetworkPolicy, Yt as ToolResult, _ as BridgeCapabilities, _n as bridgeError, b as BridgeResponse, f as ApprovalScope, fn as WebSkillApi, k as ExternalToolSource, qt as ToolDefinition, y as BridgeRequest } from "./index-znZjobkr.js";
3
+ import { A as PagePerceptionReader, C as PageActionRequest, I as PerceptionCaptureOptions, O as PagePerceptionPolicy, P as PerceivedNode, R as PerceptionResult, _ as PageActionExecutor, w as PageActionScope, y as PageActionOutcome, z as PerceptionScope } from "./index-lLcCpHE-.js";
4
4
  //#region ../browser/dist/index.d.ts
5
5
  //#region src/fs/featureDetection.d.ts
6
6
  /** 检测当前环境是否可用 OPFS(navigator.storage.getDirectory) */
package/dist/browser.js CHANGED
@@ -1,6 +1,6 @@
1
- import { A as messageOf, D as isValidSkillName, E as exportSkills, F as readSkillSignature, G as verifyManifest, K as verifySkillSignature, M as parseSkillMarkdown, N as parseSkillPackManifest, P as readResponseWithLimit, U as unzipWithLimits, W as validateSkills, _ as atomicWriteText, f as SkillDiscovery, h as assertRemoteUrlAllowed, 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 detectSkillArchiveShapeFromFs, y as buildManifest, z as resolveInsideRoot } from "./dist-59XlqDuv.js";
2
- import { B as bridgeError, C as ProgressiveRouter, S as OpenAiCompatibleClient, U as createWebSkillApi, a as AgentLoop, b as GoogleGenAiClient, c as CapabilityApproval, dt as parseBridgeRequest, g as FsRunSnapshotStore, h as FsMemoryStore, it as mergeCatalogEntries, lt as normalizeToolContent, m as FsArtifactStore, o as AnthropicClient, ot as networkPolicyLibSource, ut as normalizeToolError } from "./dist-DmI5SBBF.js";
3
- import { n as MockLlmClient } from "./testing-BCUO5gZR.js";
1
+ import { D as exportSkills, F as parseSkillPackManifest, G as unzipWithLimits, I as readResponseWithLimit, J as verifySkillSignature, K as validateSkills, L as readSkillSignature, M as messageOf, O as isAtomicTempPath, P as parseSkillMarkdown, T as detectSkillArchiveShapeFromFs, V as resolveInsideRoot, b as buildManifest, c as SKILL_MANIFEST_FILE, d as SKILL_PACK_FILE, g as assertRemoteUrlAllowed, h as WebSkillError, i as MANIFEST_EXCLUDED_FILES, k as isValidSkillName, p as SkillDiscovery, q as verifyManifest, s as SKILLS_LOCKFILE, v as atomicWriteText, y as buildCatalog } from "./dist-Bev6i6Ip.js";
2
+ import { B as bridgeError, C as ProgressiveRouter, S as OpenAiCompatibleClient, U as createWebSkillApi, a as AgentLoop, b as GoogleGenAiClient, c as CapabilityApproval, dt as parseBridgeRequest, g as FsRunSnapshotStore, h as FsMemoryStore, it as mergeCatalogEntries, lt as normalizeToolContent, m as FsArtifactStore, o as AnthropicClient, ot as networkPolicyLibSource, ut as normalizeToolError } from "./dist-CFmkV45C.js";
3
+ import { n as MockLlmClient } from "./testing-Csg5ljNm.js";
4
4
 
5
5
  //#region ../browser/dist/index.js
6
6
  /** 检测当前环境是否可用 OPFS(navigator.storage.getDirectory) */
@@ -155,6 +155,20 @@ var OpfsProvider = class {
155
155
  }
156
156
  async rename(from, to) {
157
157
  if ((await this.stat(from)).type === "directory") throw new WebSkillError("FS_PERMISSION_DENIED", `rename of directories is not supported on OPFS: ${from}`);
158
+ const fromSegments = this.#segments(from);
159
+ const fromName = fromSegments.pop();
160
+ if (!fromName) throw new WebSkillError("FS_NOT_FOUND", `Invalid path: ${from}`);
161
+ const toSegments = this.#segments(to);
162
+ const toName = toSegments.pop();
163
+ if (!toName) throw new WebSkillError("FS_NOT_FOUND", `Invalid path: ${to}`);
164
+ const file = await (await this.#walkDir(`/${fromSegments.join("/")}`, false)).getFileHandle(fromName);
165
+ const mover = file.move;
166
+ if (`/${fromSegments.join("/")}` === `/${toSegments.join("/")}` && typeof mover === "function") {
167
+ await this.#wrap(from, async () => {
168
+ await mover.call(file, toName);
169
+ });
170
+ return;
171
+ }
158
172
  await this.writeBinary(to, await this.readBinary(from));
159
173
  await this.remove(from);
160
174
  }
@@ -444,23 +458,23 @@ async function sha256HexWeb(data) {
444
458
  const digest = await crypto.subtle.digest("SHA-256", bytes);
445
459
  return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("");
446
460
  }
447
- /** 递归拷贝目录(含子目录与二进制文件) */
461
+ /** 递归拷贝目录(含子目录与二进制文件;原子写中断残留的 `.tmp-*` 不拷贝) */
448
462
  async function copyDir(fs, from, to) {
449
463
  await fs.mkdir(to);
450
464
  for (const entry of await fs.list(from)) {
451
465
  const name = entry.path.split("/").pop() ?? "";
452
466
  if (entry.type === "directory") await copyDir(fs, entry.path, `${to}/${name}`);
453
- else await fs.writeBinary(`${to}/${name}`, await fs.readBinary(entry.path));
467
+ else if (!isAtomicTempPath(name)) await fs.writeBinary(`${to}/${name}`, await fs.readBinary(entry.path));
454
468
  }
455
469
  }
456
- /** 递归列出目录内全部文件(相对路径,posix 分隔) */
470
+ /** 递归列出目录内全部文件(相对路径,posix 分隔;原子写中断残留的 `.tmp-*` 不计入) */
457
471
  async function listFiles(fs, root, prefix = "") {
458
472
  const out = [];
459
473
  for (const entry of await fs.list(root)) {
460
474
  const name = entry.path.split("/").pop() ?? "";
461
475
  const rel = prefix === "" ? name : `${prefix}/${name}`;
462
476
  if (entry.type === "directory") out.push(...await listFiles(fs, entry.path, rel));
463
- else out.push(rel);
477
+ else if (!isAtomicTempPath(name)) out.push(rel);
464
478
  }
465
479
  return out;
466
480
  }
@@ -825,7 +839,7 @@ var BrowserSkillManager = class {
825
839
  files,
826
840
  sha256: sha256HexWeb
827
841
  });
828
- await this.#fs.writeText(`${skillRoot}/${SKILL_MANIFEST_FILE}`, JSON.stringify(manifest, null, 2));
842
+ await atomicWriteText(this.#fs, `${skillRoot}/${SKILL_MANIFEST_FILE}`, JSON.stringify(manifest, null, 2));
829
843
  return manifest;
830
844
  }
831
845
  async #readManifest(skillRoot) {