@webskill/sdk 0.8.0 → 0.10.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.
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +6 -2
- package/dist/browser.d.ts +5 -3
- package/dist/browser.js +35 -13
- package/dist/{catalogComponents-DfxxfUvn-D55Gbb2l.js → catalogComponents-DTcYfpLQ-CcoOaz-Z.js} +1946 -976
- package/dist/{dist-CJqQsIm9.js → dist-1OFC-zax.js} +7 -5
- package/dist/{dist-DmI5SBBF.js → dist-BViUeszk.js} +393 -44
- package/dist/{dist-59XlqDuv.js → dist-Bev6i6Ip.js} +10 -2
- package/dist/{eventTypes-g1BXL6x5-CibcOftR.js → eventTypes-s2uwAcLG-Go3l_dUe.js} +13 -2
- package/dist/governance.d.ts +37 -6
- package/dist/governance.js +53 -15
- package/dist/{index-P9J2LTfU.d.ts → index-B0QPLWPZ.d.ts} +6 -2
- package/dist/{index-fLskQfAS.d.ts → index-BF4E1a9j.d.ts} +10 -3
- package/dist/{index-K-eewlGL.d.ts → index-DtFdMKBX.d.ts} +69 -7
- package/dist/index.d.ts +11 -3
- package/dist/index.js +13 -4
- package/dist/mcp.d.ts +23 -3
- package/dist/mcp.js +70 -25
- package/dist/{memoryArtifactStore-52Zn9npI-upv5OWYf.js → memoryArtifactStore-52Zn9npI-LbCQaqyx.js} +1 -1
- package/dist/node.d.ts +3 -3
- package/dist/node.js +6 -6
- package/dist/{openUiLibrary-DURlAxjk-CU6AzfSW.js → openUiLibrary-CIrV--Ad-B8zG_91e.js} +3 -3
- package/dist/{skillVersionStore-Bl-ElD45-gRfSaAby.d.ts → skillVersionStore-D-qHk9ZE-DBsYYCWn.d.ts} +13 -5
- package/dist/{testing-BCUO5gZR.js → testing-WPTyXQYt.js} +28 -5
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +2 -2
- package/dist/{types-B3n0cMZu-BdcqQ35O.d.ts → types-CrRcT-LM-DZAp8sWv.d.ts} +44 -3
- package/dist/ui-react.d.ts +17 -2
- package/dist/ui-react.js +123 -39
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui-vue.js +1 -1
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +2 -2
- package/dist/{webskillLitCatalog-DwTwSBFt-DiXXpNZA.js → webskillLitCatalog-BJrphK0y-SGmRXaaO.js} +2 -2
- package/package.json +1 -1
package/dist/agent.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
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 };
|
|
1
|
+
import { $ as TodoList, A as PagePerceptionReader, B as SKILL_GENERATION_SYSTEM_PROMPT, C as PageActionRequest, D as PageAuditSink, E as PageActionUi, F as PerceptionAuditSink, G as SkillGenerationToolSourceOptions, H as SkillGenerationMessages, I as PerceptionCaptureOptions, J as SubAgentRunInput, K as SkillGenerator, L as PerceptionRecord, M as ParentBudget, N as PerceivedImage, O as PagePerceptionPolicy, P as PerceivedNode, Q as TodoItem, R as PerceptionResult, S as PageActionRecord, T as PageActionToolSourceOptions, U as SkillGenerationOutcome, V as SkillCandidateSink, W as SkillGenerationPolicy, X as TODO_SYSTEM_PROMPT, Y as SubAgentRunner, Z as TodoEvent, _ as PageActionExecutor, a as DelegationOrchestratorOptions, at as createPageActionToolSource, b as PageActionPolicy, c as DelegationToolSourceOptions, ct as createTodoToolSource, d as ImageCaptureBudget, et as TodoListener, f as MANAGE_TODO_TOOL, g as PERCEPTION_SYSTEM_PROMPT, h as PERCEIVE_PAGE_TOOL, i as DelegationOrchestrator, it as createDelegationToolSource, j as PagePerceptionToolSourceOptions, k as PagePerceptionPolicyOptions, l as GENERATE_SKILL_TOOL, lt as withDelegationOrigin, m as PAGE_ACTION_TOOL, n as DELEGATION_SYSTEM_PROMPT, nt as TodoStore, o as DelegationRequest, ot as createPagePerceptionToolSource, p as PAGE_ACTION_SYSTEM_PROMPT, q as SkillGeneratorOptions, r as DelegationBudget, rt as TodoToolSourceOptions, s as DelegationResult, st as createSkillGenerationToolSource, t as DELEGATE_TASK_TOOL, tt as TodoStatus, u as GeneratedSkillDraft, v as PageActionKind, w as PageActionScope, x as PageActionPolicyOptions, y as PageActionOutcome, z as PerceptionScope } from "./index-BF4E1a9j.js";
|
|
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 SkillGenerationMessages, 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 {
|
|
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 = [
|
|
@@ -276,6 +276,10 @@ function ok(events, text) {
|
|
|
276
276
|
}
|
|
277
277
|
const DEFAULT_MAX_PER_SESSION = 3;
|
|
278
278
|
const SCRIPT_EXTENSIONS = [".ts", ".js"];
|
|
279
|
+
/** 缺省英文模板:与 0.9.0 之前硬编码的正文逐字一致 */
|
|
280
|
+
function defaultConfirmSkill(draft) {
|
|
281
|
+
return `Save this conversation as the skill "${draft.name}"? ${draft.description}\nIt will be submitted for review, not activated. Please check the preview below for anything that must not be stored.`;
|
|
282
|
+
}
|
|
279
283
|
function fail(message, details) {
|
|
280
284
|
throw new WebSkillError("SKILL_GENERATION_VALIDATION_FAILED", message, details);
|
|
281
285
|
}
|
|
@@ -338,7 +342,7 @@ var SkillGenerator = class {
|
|
|
338
342
|
type: "authorize",
|
|
339
343
|
id: `skill-generation-${this.#requestSeq}`,
|
|
340
344
|
capability: "confirm",
|
|
341
|
-
message:
|
|
345
|
+
message: this.#options.messages?.confirmSkill?.(draft) ?? defaultConfirmSkill(draft),
|
|
342
346
|
details: { preview: previewOf(draft) }
|
|
343
347
|
});
|
|
344
348
|
if (response.cancelled === true || response.value === false) return { status: "declined" };
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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-
|
|
1
|
+
import { Ct as VerifyResult, L as FileStat, M as ArchiveLimits, R as FileSystemProvider, S as UiBridge, _t as SkillsLockfile, b as RenderResultRequest, c as InteractionResponse, dt as SkillManifest, l as LlmClient, m as LlmStreamEvent, o as InteractionPolicy, p as LlmResponse, s as InteractionRequest, st as SkillInstallSource, u as LlmCompleteInput, v as MemoryStore, wt as WebSkillError, xt as UnsignedPolicy, yt as TrustedKeyStore } from "./types-CrRcT-LM-DZAp8sWv.js";
|
|
2
|
+
import { Dt as ScriptExecutor, Et as ScriptExecutionContext, Hn as parseBridgeRequest, Jt as ToolDefinition, O as ExternalSkillProvider, Xt as ToolResult, Y as NetworkPolicy, _ as BridgeCapabilities, b as BridgeResponse, f as ApprovalScope, k as ExternalToolSource, pn as WebSkillApi, vn as bridgeError, y as BridgeRequest } from "./index-DtFdMKBX.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-BF4E1a9j.js";
|
|
4
4
|
//#region ../browser/dist/index.d.ts
|
|
5
5
|
//#region src/fs/featureDetection.d.ts
|
|
6
6
|
/** 检测当前环境是否可用 OPFS(navigator.storage.getDirectory) */
|
|
@@ -290,6 +290,8 @@ interface LlmEntryConfig {
|
|
|
290
290
|
apiKey?: string;
|
|
291
291
|
model: string;
|
|
292
292
|
requestTimeoutMs?: number;
|
|
293
|
+
/** Anthropic extended thinking 预算(0.10.0 遗留项 #1);仅 anthropic 档消费。undefined=默认开,0=关(0.10.0 #40.4) */
|
|
294
|
+
thinkingBudgetTokens?: number;
|
|
293
295
|
}
|
|
294
296
|
/** 四档客户端都能自查可达性,所以工厂的返回类型直接把探测能力算进契约 */
|
|
295
297
|
type ConfiguredLlmClient = LlmClient & {
|
package/dist/browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
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-
|
|
3
|
-
import { n as MockLlmClient } from "./testing-
|
|
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-BViUeszk.js";
|
|
3
|
+
import { n as MockLlmClient } from "./testing-WPTyXQYt.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
|
|
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) {
|
|
@@ -1383,11 +1397,15 @@ function createLlmClient(config) {
|
|
|
1383
1397
|
...config.requestTimeoutMs !== void 0 ? { requestTimeoutMs: config.requestTimeoutMs } : {}
|
|
1384
1398
|
};
|
|
1385
1399
|
const apiKey = config.apiKey?.trim() ?? "";
|
|
1386
|
-
if (config.provider === "anthropic")
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1400
|
+
if (config.provider === "anthropic") {
|
|
1401
|
+
const thinkingBudgetTokens = config.thinkingBudgetTokens ?? 1e4;
|
|
1402
|
+
return new AnthropicClient({
|
|
1403
|
+
...common,
|
|
1404
|
+
apiKey,
|
|
1405
|
+
model: config.model,
|
|
1406
|
+
...thinkingBudgetTokens > 0 ? { thinkingBudgetTokens } : {}
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1391
1409
|
if (config.provider === "google") return new GoogleGenAiClient({
|
|
1392
1410
|
...common,
|
|
1393
1411
|
apiKey,
|
|
@@ -1759,6 +1777,10 @@ function valueOf(element) {
|
|
|
1759
1777
|
const value = element.value;
|
|
1760
1778
|
return value === "" ? void 0 : clip(value);
|
|
1761
1779
|
}
|
|
1780
|
+
if (element.getAttribute("role") === "combobox") {
|
|
1781
|
+
const value = element.getAttribute("data-value");
|
|
1782
|
+
return value === null || value === "" ? void 0 : clip(value);
|
|
1783
|
+
}
|
|
1762
1784
|
}
|
|
1763
1785
|
/**
|
|
1764
1786
|
* 隐藏节点不进结果:屏幕上看不见的东西,用户没有机会发现它被读走了。
|