@webskill/sdk 0.5.0 → 0.7.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 +274 -42
- package/dist/browser.d.ts +127 -5
- package/dist/browser.js +611 -17
- package/dist/{catalogComponents-DV7cPpUm-C77AEEx9.js → catalogComponents-Dr5dFMAb-DKH_7VPI.js} +848 -974
- package/dist/{dist-6C03DShK.js → dist-D0qW6e40.js} +1213 -210
- package/dist/{dist-bewtXYlO.js → dist-DnYG2-eY.js} +53 -14
- package/dist/{env--jJB-TSX-04klhTYi.js → env-8cY40DXB-CGnEVZby.js} +7 -6
- package/dist/{env-BPUBZCwJ-4jat_SVG.d.ts → env-AK3cSMEA-Dli6QU5E.d.ts} +4 -3
- package/dist/eventTypes-DjIQpt8Y-Bj3vghj4.js +32 -0
- package/dist/governance.d.ts +78 -11
- package/dist/governance.js +173 -50
- package/dist/{index-D_7ZZjkl.d.ts → index-Ba3xFtfz.d.ts} +222 -8
- package/dist/{index-Bsqg4ftU.d.ts → index-BwsK9lGk.d.ts} +13 -7
- package/dist/{index-vBz_FC9w.d.ts → index-DkbABR43.d.ts} +336 -52
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/mcp.d.ts +159 -11
- package/dist/mcp.js +276 -45
- package/dist/{memoryArtifactStore-BtOeB_hm-tj3fC5ip.js → memoryArtifactStore-52Zn9npI-BMPYwvoy.js} +10 -2
- package/dist/node.d.ts +4 -4
- package/dist/node.js +11 -3
- package/dist/{openUiLibrary-W3Ce896k-ClFTRZFs.js → openUiLibrary-Bdrji9qK-D2LxmM-a.js} +3 -3
- package/dist/{skillVersionStore-BzLbzFOL-CxwIewHJ.d.ts → skillVersionStore-Bl-ElD45-CWPvGvoq.d.ts} +8 -2
- package/dist/{testing-DDCJWvgA.js → testing-CYTFqkDm.js} +1 -1
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +3 -3
- package/dist/{types-D_hoCri8-BnNPiZCi.d.ts → types-CcxRLdJG-DCXyw1US.d.ts} +62 -10
- package/dist/ui-react.d.ts +5 -3
- package/dist/ui-react.js +72 -47
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui-vue.js +13 -8
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +2 -2
- package/dist/{webskillLitCatalog-_mugzRHx-DiuJpCuf.js → webskillLitCatalog-_mugzRHx-B_54vxum.js} +1 -1
- package/package.json +1 -1
package/dist/browser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { A as ArchiveLimits, F as FileStat, I as FileSystemProvider, _ as MemoryStore, _t as UnsignedPolicy, bt as WebSkillError, c as InteractionResponse, ht as TrustedKeyStore, l as LlmClient, m as LlmStreamEvent, o as InteractionPolicy, p as LlmResponse, pt as SkillsLockfile, rt as SkillInstallSource, s as InteractionRequest, st as SkillManifest, u as LlmCompleteInput, x as UiBridge, y as RenderResultRequest, yt as VerifyResult } from "./types-CcxRLdJG-DCXyw1US.js";
|
|
2
|
+
import { Et as ScriptExecutor, Fn as parseBridgeRequest, Kt as ToolResult, O as ExternalSkillProvider, Tt as ScriptExecutionContext, Wt as ToolDefinition, Y as NetworkPolicy, _ as BridgeCapabilities, b as BridgeResponse, cn as WebSkillApi, f as ApprovalScope, k as ExternalToolSource, pn as bridgeError, y as BridgeRequest } from "./index-DkbABR43.js";
|
|
3
|
+
import { A as PagePerceptionReader, C as PageActionRequest, I as PerceptionCaptureOptions, P as PerceivedNode, R as PerceptionResult, _ as PageActionExecutor, w as PageActionScope, y as PageActionOutcome, z as PerceptionScope } from "./index-Ba3xFtfz.js";
|
|
4
4
|
//#region ../browser/dist/index.d.ts
|
|
5
5
|
//#region src/fs/featureDetection.d.ts
|
|
6
6
|
/** 检测当前环境是否可用 OPFS(navigator.storage.getDirectory) */
|
|
@@ -331,14 +331,44 @@ declare function checkDictationAvailability(): DictationAvailability;
|
|
|
331
331
|
*/
|
|
332
332
|
declare function startDictation(options: DictationOptions): DictationSession;
|
|
333
333
|
//#endregion
|
|
334
|
+
//#region src/media/compressImage.d.ts
|
|
335
|
+
/** 图片压缩结果;`originalBytes`/`compressedBytes` 供 UI 显示「3.2 MB → 1.8 MB」(FR-11.3 可见性) */
|
|
336
|
+
interface CompressResult {
|
|
337
|
+
blob: Blob;
|
|
338
|
+
originalBytes: number;
|
|
339
|
+
compressedBytes: number;
|
|
340
|
+
/** 是否发生过缩放(仅降质未缩放时为 false) */
|
|
341
|
+
scaled: boolean;
|
|
342
|
+
/** 实际输出所用的 JPEG 质量;未经压缩管线时为 undefined */
|
|
343
|
+
quality?: number;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* 把图片压到字节预算内(0.6.0 FR-11.3)。
|
|
347
|
+
* 先逐级降质,仍超限则按长边逐步缩放,最多 5 轮;仍超限抛 `ATTACHMENT_TOO_LARGE`。
|
|
348
|
+
*
|
|
349
|
+
* 编码一律交给平台(`OffscreenCanvas.convertToBlob`),不手写编码器(AGENTS.md §6)。
|
|
350
|
+
* 因此本函数只能在浏览器里用,落在 `@webskill/browser` 而不是 core/runtime(AC-G6)。
|
|
351
|
+
*/
|
|
352
|
+
declare function compressImageToBudget(file: Blob, maxBytes: number): Promise<CompressResult>;
|
|
353
|
+
//#endregion
|
|
334
354
|
//#region src/dom/perception.d.ts
|
|
335
355
|
interface DomPerceptionReaderOptions {
|
|
336
356
|
/** 选择器求值的根;缺省 `globalThis.document` */
|
|
337
357
|
document?: Document;
|
|
358
|
+
/**
|
|
359
|
+
* 可操作范围(需求 23)。缺省即**不发任何句柄**,感知结果与 0.6.0 逐字相同。
|
|
360
|
+
* 它与感知范围分开声明:可读不等于可操作(FR-23.1)。
|
|
361
|
+
*/
|
|
362
|
+
actionScope?: PageActionScope;
|
|
338
363
|
}
|
|
339
|
-
/** DOM
|
|
364
|
+
/** DOM 遍历是同步的;不取像时比 `PagePerceptionReader` 窄,调用方无需 await @experimental */
|
|
340
365
|
interface DomPerceptionReader extends PagePerceptionReader {
|
|
341
366
|
read(scope: PerceptionScope): readonly PerceivedNode[];
|
|
367
|
+
read(scope: PerceptionScope, capture: PerceptionCaptureOptions): Promise<PerceptionResult>;
|
|
368
|
+
/** 把句柄换回元素;未知或已过期的句柄返回 undefined。供执行器使用,不自建第二张表 */
|
|
369
|
+
resolve(ref: string): Element | undefined;
|
|
370
|
+
/** 元素当前是否仍在可操作范围内(执行前的第二道闸门,AC-23.3) */
|
|
371
|
+
inActionScope(element: Element): boolean;
|
|
342
372
|
}
|
|
343
373
|
/**
|
|
344
374
|
* DOM 遍历实现(设计 09 §2 的「实现层」)。产出只有角色 / 名称 / 值,
|
|
@@ -350,6 +380,63 @@ interface DomPerceptionReader extends PagePerceptionReader {
|
|
|
350
380
|
*/
|
|
351
381
|
declare function createDomPerceptionReader(options?: DomPerceptionReaderOptions): DomPerceptionReader;
|
|
352
382
|
//#endregion
|
|
383
|
+
//#region src/dom/pageAction.d.ts
|
|
384
|
+
/**
|
|
385
|
+
* DOM 页面操作执行器(需求 23 FR-23.4)。
|
|
386
|
+
*
|
|
387
|
+
* 句柄表由 reader 持有——执行器**不自建第二张表**,否则「单次有效」会有两套过期时机。
|
|
388
|
+
*/
|
|
389
|
+
interface DomPageActionOptions {
|
|
390
|
+
/** 发放句柄的那个 reader;`resolve` / `inActionScope` 都从它取 */
|
|
391
|
+
reader: DomPerceptionReader;
|
|
392
|
+
}
|
|
393
|
+
/** DOM 操作是同步的;比 `PageActionExecutor` 窄,调用方无需 await @experimental */
|
|
394
|
+
interface DomPageActionExecutor extends PageActionExecutor {
|
|
395
|
+
execute(request: PageActionRequest): PageActionOutcome;
|
|
396
|
+
}
|
|
397
|
+
/** @experimental */
|
|
398
|
+
declare function createDomPageActionExecutor(options: DomPageActionOptions): DomPageActionExecutor;
|
|
399
|
+
//#endregion
|
|
400
|
+
//#region src/dom/imageCapture.d.ts
|
|
401
|
+
/**
|
|
402
|
+
* 取像级别(0.6.0 FR-12.1)。裁决 D-3 已取消 L3 栅格化,只剩两级。
|
|
403
|
+
* @experimental
|
|
404
|
+
*/
|
|
405
|
+
type CaptureLevel = 'src' | 'canvas';
|
|
406
|
+
/** @experimental */
|
|
407
|
+
interface CapturedImage {
|
|
408
|
+
id: string;
|
|
409
|
+
mimeType: string;
|
|
410
|
+
/** base64,不含 `data:` 前缀 */
|
|
411
|
+
data: string;
|
|
412
|
+
level: CaptureLevel;
|
|
413
|
+
originalBytes: number;
|
|
414
|
+
/** 压缩后字节数;未压缩时与 `originalBytes` 相同 */
|
|
415
|
+
bytes: number;
|
|
416
|
+
}
|
|
417
|
+
/** @experimental */
|
|
418
|
+
interface CaptureFailure {
|
|
419
|
+
id: string;
|
|
420
|
+
/** 必须说明是哪一级、为什么;只写 "image unavailable" 不足以让用户判断该怎么办 */
|
|
421
|
+
reason: string;
|
|
422
|
+
triedLevels: readonly CaptureLevel[];
|
|
423
|
+
}
|
|
424
|
+
/** @experimental */
|
|
425
|
+
declare function isCaptureFailure(result: CapturedImage | CaptureFailure): result is CaptureFailure;
|
|
426
|
+
/** 只有这三种标签能取像;其余元素连取像入口都不进(FR-12.1,由 T-02-15 守门) @experimental */
|
|
427
|
+
declare function isCapturableElement(element: Element): boolean;
|
|
428
|
+
/**
|
|
429
|
+
* 取一个元素的图像(0.6.0 FR-12.1)。
|
|
430
|
+
*
|
|
431
|
+
* 按元素类型分派,不做无意义的尝试:`<img>` 只走 L1,`<canvas>` / `<svg>` 只走 L2,
|
|
432
|
+
* 两者互不兜底。失败返回 `CaptureFailure` 而不是抛错——一张图抓不到不该让整次感知失败。
|
|
433
|
+
* @experimental
|
|
434
|
+
*/
|
|
435
|
+
declare function captureElementImage(element: Element, options: {
|
|
436
|
+
id: string;
|
|
437
|
+
maxBytes: number;
|
|
438
|
+
}): Promise<CapturedImage | CaptureFailure>;
|
|
439
|
+
//#endregion
|
|
353
440
|
//#region src/host/protocol.d.ts
|
|
354
441
|
/** 主线程 → Worker 的 LLM 配置;mockResponses 供 E2E/测试注入确定性 Mock */
|
|
355
442
|
interface LlmClientConfig {
|
|
@@ -521,4 +608,39 @@ declare class WorkerUiBridge implements UiBridge {
|
|
|
521
608
|
onTextDelta(runId: string, delta: string): Promise<void>;
|
|
522
609
|
}
|
|
523
610
|
//#endregion
|
|
524
|
-
|
|
611
|
+
//#region src/memory/encryptedMemoryStore.d.ts
|
|
612
|
+
/**
|
|
613
|
+
* 某条已读出的记忆值是否是密文信封。观测方(如 console)据此决定要不要去取密钥:
|
|
614
|
+
* 加密关着的时候不该为了读一条明文而凭空建出一把密钥。
|
|
615
|
+
* @experimental
|
|
616
|
+
*/
|
|
617
|
+
declare function isEncryptedMemoryValue(value: unknown): boolean;
|
|
618
|
+
/**
|
|
619
|
+
* 用 AES-GCM 包装一个 MemoryStore:值加密后再交给 `inner`,读取时解密。
|
|
620
|
+
* 密钥不可用(未解锁 / 无 Web Crypto)时**拒绝读写并抛结构化错误**,
|
|
621
|
+
* 不静默降级成明文——那会让「已加密」的承诺失效而用户无从察觉。
|
|
622
|
+
*
|
|
623
|
+
* `scopes` 限定加密范围。默认全加密;宿主通常只加密存放个人数据的
|
|
624
|
+
* `user:` 作用域,把运行观测(会话参数历史、技能统计)留作明文供 console 读取。
|
|
625
|
+
* @experimental
|
|
626
|
+
*/
|
|
627
|
+
declare function createEncryptedMemoryStore(inner: MemoryStore, key: CryptoKey | undefined, options?: {
|
|
628
|
+
scopes?: (scope: string) => boolean;
|
|
629
|
+
}): MemoryStore;
|
|
630
|
+
/**
|
|
631
|
+
* 生成一把不可导出的 AES-GCM 256 密钥(FR-19.5)。不可导出意味着页面脚本
|
|
632
|
+
* 拿不到原始字节,只能通过 Web Crypto 使用它;宿主负责持久化这个句柄(如 IndexedDB)。
|
|
633
|
+
* @experimental
|
|
634
|
+
*/
|
|
635
|
+
declare function generateMemoryEncryptionKey(): Promise<CryptoKey>;
|
|
636
|
+
/**
|
|
637
|
+
* 取(必要时生成)本地数据加密密钥并持久化在 IndexedDB(FR-19.5)。
|
|
638
|
+
* 存的是 `CryptoKey` 句柄本身而不是密钥字节:结构化克隆能存它,
|
|
639
|
+
* 而它是 non-extractable 的,页面脚本与扩展都读不出原始字节。
|
|
640
|
+
* @experimental
|
|
641
|
+
*/
|
|
642
|
+
declare function openMemoryEncryptionKey(name?: string): Promise<CryptoKey>;
|
|
643
|
+
/** 删除本地数据加密密钥;清除画像与记录时一并调用,避免留下解不开的旧密文 @experimental */
|
|
644
|
+
declare function deleteMemoryEncryptionKey(name?: string): Promise<void>;
|
|
645
|
+
//#endregion
|
|
646
|
+
export { type BridgeCapabilities, type BridgeRequest, type BridgeResponse, BrowserSkillManager, BrowserWorkerScriptExecutor, type CaptureFailure, type CaptureLevel, type CapturedImage, type ChromeBuiltinAvailability, ChromeBuiltinLlmClient, type CompressResult, type ConfiguredLlmClient, type DictationAvailability, type DictationOptions, type DictationSession, type DomPageActionExecutor, type DomPageActionOptions, type DomPerceptionReader, type DomPerceptionReaderOptions, IframeWorkerLike, type LlmClientConfig, type LlmEntryConfig, type MainToWorkerMessage, OpfsProvider, type SandboxMode, type SerializedError, TsTranspiler, type TypeScriptSupportOptions, WORKER_BOOTSTRAP_SOURCE, type WorkerEvent, type WorkerFactory, type WorkerLike, type WorkerRequest, WorkerRuntimeClient, type WorkerRuntimeClientDeps, type WorkerRuntimeHostOverrides, type WorkerScopeLike, WorkerUiBridge, bridgeError, captureElementImage, checkDictationAvailability, compressImageToBudget, createDomPageActionExecutor, createDomPerceptionReader, createEncryptedMemoryStore, createIframeWorker, createLlmClient, deleteMemoryEncryptionKey, extractZipWeb, generateMemoryEncryptionKey, installWebSkillNavigator, isCapturableElement, isCaptureFailure, isEncryptedMemoryValue, isOpfsAvailable, openMemoryEncryptionKey, parseBridgeRequest, parseMainMessage, parseWorkerEvent, probeChromeBuiltinAvailability, sha256HexWeb, startDictation, startWorkerRuntimeHost };
|