@webskill/sdk 0.5.0 → 0.6.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 +2 -2
  2. package/dist/agent.js +57 -15
  3. package/dist/browser.d.ts +101 -5
  4. package/dist/browser.js +421 -11
  5. package/dist/{catalogComponents-DV7cPpUm-C77AEEx9.js → catalogComponents-Dr5dFMAb-Dacibl1e.js} +126 -44
  6. package/dist/{dist-bewtXYlO.js → dist-DnYG2-eY.js} +53 -14
  7. package/dist/{dist-6C03DShK.js → dist-DusANsrn.js} +981 -185
  8. package/dist/{env--jJB-TSX-04klhTYi.js → env-8cY40DXB-CGnEVZby.js} +7 -6
  9. package/dist/{env-BPUBZCwJ-4jat_SVG.d.ts → env-AK3cSMEA-Dli6QU5E.d.ts} +4 -3
  10. package/dist/governance.d.ts +3 -3
  11. package/dist/governance.js +1 -1
  12. package/dist/{index-Bsqg4ftU.d.ts → index-BMocOEi0.d.ts} +13 -7
  13. package/dist/{index-D_7ZZjkl.d.ts → index-BuTpBMzr.d.ts} +69 -6
  14. package/dist/{index-vBz_FC9w.d.ts → index-C-KFAZoF.d.ts} +298 -52
  15. package/dist/index.d.ts +3 -3
  16. package/dist/index.js +3 -3
  17. package/dist/mcp.d.ts +39 -8
  18. package/dist/mcp.js +53 -19
  19. package/dist/{memoryArtifactStore-BtOeB_hm-tj3fC5ip.js → memoryArtifactStore-52Zn9npI-BMPYwvoy.js} +10 -2
  20. package/dist/node.d.ts +4 -4
  21. package/dist/node.js +9 -2
  22. package/dist/{openUiLibrary-W3Ce896k-ClFTRZFs.js → openUiLibrary-Bdrji9qK-DzAxRlTY.js} +3 -3
  23. package/dist/{skillVersionStore-BzLbzFOL-CxwIewHJ.d.ts → skillVersionStore-BzLbzFOL-CxdAFWO2.d.ts} +1 -1
  24. package/dist/{testing-DDCJWvgA.js → testing-CYTFqkDm.js} +1 -1
  25. package/dist/testing.d.ts +2 -2
  26. package/dist/testing.js +3 -3
  27. package/dist/{types-D_hoCri8-BnNPiZCi.d.ts → types-4pg-qp_I-Gq63X8Oa.d.ts} +33 -8
  28. package/dist/ui-react.d.ts +2 -2
  29. package/dist/ui-react.js +66 -23
  30. package/dist/ui-vue.d.ts +1 -1
  31. package/dist/ui-vue.js +13 -8
  32. package/dist/ui.d.ts +3 -3
  33. package/dist/ui.js +2 -2
  34. package/dist/{webskillLitCatalog-_mugzRHx-DiuJpCuf.js → webskillLitCatalog-_mugzRHx-B_54vxum.js} +1 -1
  35. package/package.json +1 -1
package/dist/agent.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as SubAgentRunInput, B as createDelegationToolSource, C as SKILL_GENERATION_SYSTEM_PROMPT, D as SkillGenerationToolSourceOptions, E as SkillGenerationPolicy, F as TodoList, H as createSkillGenerationToolSource, I as TodoListener, L as TodoStatus, M as TODO_SYSTEM_PROMPT, N as TodoEvent, O as SkillGenerator, P as TodoItem, R as TodoStore, S as PerceptionScope, T as SkillGenerationOutcome, U as createTodoToolSource, V as createPagePerceptionToolSource, W as withDelegationOrigin, _ as PagePerceptionToolSourceOptions, a as DelegationOrchestratorOptions, b as PerceptionAuditSink, c as DelegationToolSourceOptions, d as MANAGE_TODO_TOOL, f as PERCEIVE_PAGE_TOOL, g as PagePerceptionReader, h as PagePerceptionPolicyOptions, i as DelegationOrchestrator, j as SubAgentRunner, k as SkillGeneratorOptions, l as GENERATE_SKILL_TOOL, m as PagePerceptionPolicy, n as DELEGATION_SYSTEM_PROMPT, o as DelegationRequest, p as PERCEPTION_SYSTEM_PROMPT, r as DelegationBudget, s as DelegationResult, t as DELEGATE_TASK_TOOL, u as GeneratedSkillDraft, v as ParentBudget, w as SkillCandidateSink, x as PerceptionRecord, y as PerceivedNode, z as TodoToolSourceOptions } from "./index-D_7ZZjkl.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, MANAGE_TODO_TOOL, PERCEIVE_PAGE_TOOL, PERCEPTION_SYSTEM_PROMPT, PagePerceptionPolicy, type PagePerceptionPolicyOptions, type PagePerceptionReader, type PagePerceptionToolSourceOptions, type ParentBudget, type PerceivedNode, type PerceptionAuditSink, type PerceptionRecord, 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, createPagePerceptionToolSource, createSkillGenerationToolSource, createTodoToolSource, withDelegationOrigin };
1
+ import { A as SkillGenerationPolicy, B as TodoListener, C as PerceptionCaptureOptions, D as SKILL_GENERATION_SYSTEM_PROMPT, E as PerceptionScope, F as SubAgentRunner, G as createPagePerceptionToolSource, H as TodoStore, I as TODO_SYSTEM_PROMPT, J as withDelegationOrigin, K as createSkillGenerationToolSource, L as TodoEvent, M as SkillGenerator, N as SkillGeneratorOptions, O as SkillCandidateSink, P as SubAgentRunInput, R as TodoItem, S as PerceptionAuditSink, T as PerceptionResult, U as TodoToolSourceOptions, V as TodoStatus, W as createDelegationToolSource, _ as PagePerceptionReader, a as DelegationOrchestratorOptions, b as PerceivedImage, c as DelegationToolSourceOptions, d as ImageCaptureBudget, f as MANAGE_TODO_TOOL, g as PagePerceptionPolicyOptions, h as PagePerceptionPolicy, i as DelegationOrchestrator, j as SkillGenerationToolSourceOptions, k as SkillGenerationOutcome, l as GENERATE_SKILL_TOOL, m as PERCEPTION_SYSTEM_PROMPT, n as DELEGATION_SYSTEM_PROMPT, o as DelegationRequest, p as PERCEIVE_PAGE_TOOL, q as createTodoToolSource, r as DelegationBudget, s as DelegationResult, t as DELEGATE_TASK_TOOL, u as GeneratedSkillDraft, v as PagePerceptionToolSourceOptions, w as PerceptionRecord, x as PerceivedNode, y as ParentBudget, z as TodoList } from "./index-BuTpBMzr.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, PERCEIVE_PAGE_TOOL, PERCEPTION_SYSTEM_PROMPT, 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, createPagePerceptionToolSource, createSkillGenerationToolSource, createTodoToolSource, withDelegationOrigin };
package/dist/agent.js CHANGED
@@ -359,14 +359,22 @@ var SkillGenerator = class {
359
359
  /**
360
360
  * 技能自动生成的系统提示词。默认不注册工具,因此这段提示词只在
361
361
  * 宿主打开开关时才进入上下文(设计 02 §1.3)。
362
+ *
363
+ * 触发条件写成正面清单而不是「不要自发调用」(0.6.0 FR-18.5):实测中后者会连
364
+ * 「帮我写一份流程规范」这类明确的沉淀请求一起抑制掉,开关等于白开。
362
365
  */
363
366
  const SKILL_GENERATION_SYSTEM_PROMPT = [
364
367
  "## Saving a reusable skill",
365
368
  "",
366
- "When the user has walked you through a procedure that is worth reusing, you may call",
367
- "`generate_skill` to turn it into a skill candidate.",
369
+ "Call `generate_skill` when the user asks you to define a procedure, policy, workflow,",
370
+ "standard, or checklist that they will reuse later — for example \"draft a process for ...\",",
371
+ "\"write a standard for ...\", \"create a checklist for ...\".",
372
+ "",
373
+ "Do not call it for one-off answers, factual questions, or content the user only needs once.",
374
+ "",
375
+ "Before calling it, ask the user for the missing details: scope, the roles involved, and",
376
+ "any constraints. Do not emit a generic template when information is insufficient.",
368
377
  "",
369
- "- Never call it on your own initiative for one-off answers; only for repeatable procedures.",
370
378
  "- `content` must be a complete SKILL.md: YAML frontmatter with `name` and `description`,",
371
379
  " then the instructions as Markdown. The frontmatter `name` must equal the `name` argument.",
372
380
  "- Put helper scripts under `scripts/` and use the `.ts` or `.js` extension.",
@@ -730,9 +738,10 @@ function withDelegationOrigin(bridge, origin) {
730
738
  /**
731
739
  * 页面只读感知策略(需求 10)。
732
740
  *
733
- * **`perceive()` 不接受任何参数**——这是「白名单判定不受模型输出影响」
741
+ * **`perceive()` 不接受任何范围参数**——这是「白名单判定不受模型输出影响」
734
742
  * (AC-10.8)的实现方式。不是先拿模型给的范围再去校验,而是模型压根没有
735
743
  * 表达范围的入口:能被读的区域只由构造时的 `scope` 决定。
744
+ * 唯一的参数是取像预算(`PerceptionCaptureOptions`),它里面没有任何范围字段。
736
745
  *
737
746
  * 本类**没有**任何点击 / 输入 / 提交 / 导航 / 滚动方法(FR-10.7)。
738
747
  * @experimental
@@ -760,15 +769,27 @@ var PagePerceptionPolicy = class {
760
769
  this.#listeners.add(listener);
761
770
  return () => this.#listeners.delete(listener);
762
771
  }
763
- async perceive() {
772
+ async perceive(capture) {
764
773
  if (!this.enabled) throw new WebSkillError("PERCEPTION_NOT_ENABLED", "Page perception is not enabled: the host declared no readable regions.");
765
774
  const scope = this.#options.scope;
766
- const nodes = await this.#options.reader.read(scope);
775
+ const raw = await this.#options.reader.read(scope, capture);
776
+ const result = Array.isArray(raw) ? { nodes: raw } : raw;
777
+ const nodes = result.nodes;
778
+ const images = result.images ?? [];
779
+ const imagesOmitted = result.imagesOmitted ?? 0;
767
780
  const record = {
768
781
  at: this.#options.now?.() ?? (/* @__PURE__ */ new Date()).toISOString(),
769
782
  include: [...scope.include],
770
783
  exclude: [...scope.exclude ?? []],
771
- nodeCount: nodes.length
784
+ nodeCount: nodes.length,
785
+ ...capture?.images === true ? {
786
+ images: {
787
+ src: images.filter((image) => image.level === "src").length,
788
+ canvas: images.filter((image) => image.level === "canvas").length
789
+ },
790
+ imagesOmitted,
791
+ imageFailures: result.imageFailures ?? 0
792
+ } : {}
772
793
  };
773
794
  this.#records = [record, ...this.#records].slice(0, 50);
774
795
  for (const listener of this.#listeners) listener(record);
@@ -779,11 +800,18 @@ var PagePerceptionPolicy = class {
779
800
  include: record.include,
780
801
  exclude: record.exclude,
781
802
  nodeCount: record.nodeCount,
782
- at: record.at
803
+ at: record.at,
804
+ ...record.images !== void 0 ? {
805
+ imageCount: record.images.src + record.images.canvas,
806
+ imagesOmitted,
807
+ imageFailures: record.imageFailures
808
+ } : {}
783
809
  }
784
810
  });
785
811
  return {
786
812
  nodes,
813
+ images,
814
+ imagesOmitted,
787
815
  record
788
816
  };
789
817
  }
@@ -844,17 +872,31 @@ function createPagePerceptionToolSource(options) {
844
872
  canHandle: (name) => name === PERCEIVE_PAGE_TOOL,
845
873
  call: async () => {
846
874
  try {
847
- const { nodes, record } = await policy.perceive();
875
+ const budget = await options.imageCapture?.();
876
+ const capture = {
877
+ images: budget?.enabled === true,
878
+ maxImageBytes: budget?.maxImageBytes ?? 0,
879
+ maxImages: budget?.maxImages ?? 0
880
+ };
881
+ const { nodes, images, imagesOmitted, record } = await policy.perceive(capture);
882
+ const data = {
883
+ scope: record.include,
884
+ excluded: record.exclude,
885
+ nodes
886
+ };
887
+ if (imagesOmitted > 0) data["imagesOmitted"] = imagesOmitted;
888
+ if ((record.imageFailures ?? 0) > 0) data["imageFailures"] = record.imageFailures;
848
889
  return {
849
890
  ok: true,
850
891
  content: [{
851
892
  type: "json",
852
- data: {
853
- scope: record.include,
854
- excluded: record.exclude,
855
- nodes
856
- }
857
- }]
893
+ data
894
+ }, ...images.map((image) => ({
895
+ type: "image",
896
+ id: image.id,
897
+ mimeType: image.mimeType,
898
+ data: image.data
899
+ }))]
858
900
  };
859
901
  } catch (e) {
860
902
  return toolError("PERCEPTION_FAILED", `perceive_page failed: ${messageOf(e)}`);
package/dist/browser.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { N as FileStat, O as ArchiveLimits, P as FileSystemProvider, _t as VerifyResult, at as SkillManifest, b as UiBridge, c as InteractionResponse, dt as SkillsLockfile, ht as UnsignedPolicy, l as LlmClient, m as LlmStreamEvent, o as InteractionPolicy, p as LlmResponse, pt as TrustedKeyStore, s as InteractionRequest, tt as SkillInstallSource, u as LlmCompleteInput, vt as WebSkillError, y as RenderResultRequest } from "./types-D_hoCri8-BnNPiZCi.js";
2
- import { Bt as WebSkillApi, Nt as ToolResult, Ut as bridgeError, W as NetworkPolicy, b as ExternalSkillProvider, d as ApprovalScope, f as BridgeCapabilities, h as BridgeResponse, jt as ToolDefinition, ln as parseBridgeRequest, m as BridgeRequest, vt as ScriptExecutionContext, x as ExternalToolSource, yt as ScriptExecutor } from "./index-vBz_FC9w.js";
3
- import { S as PerceptionScope, g as PagePerceptionReader, y as PerceivedNode } from "./index-D_7ZZjkl.js";
1
+ import { N as FileStat, O as ArchiveLimits, P as FileSystemProvider, _ as MemoryStore, _t as VerifyResult, at as SkillManifest, b as UiBridge, c as InteractionResponse, dt as SkillsLockfile, ht as UnsignedPolicy, l as LlmClient, m as LlmStreamEvent, o as InteractionPolicy, p as LlmResponse, pt as TrustedKeyStore, s as InteractionRequest, tt as SkillInstallSource, u as LlmCompleteInput, vt as WebSkillError, y as RenderResultRequest } from "./types-4pg-qp_I-Gq63X8Oa.js";
2
+ import { Ct as ScriptExecutionContext, D as ExternalSkillProvider, J as NetworkPolicy, Mn as parseBridgeRequest, O as ExternalToolSource, Ut as ToolResult, Vt as ToolDefinition, _ as BridgeCapabilities, an as WebSkillApi, b as BridgeResponse, f as ApprovalScope, un as bridgeError, wt as ScriptExecutor, y as BridgeRequest } from "./index-C-KFAZoF.js";
3
+ import { C as PerceptionCaptureOptions, E as PerceptionScope, T as PerceptionResult, _ as PagePerceptionReader, x as PerceivedNode } from "./index-BuTpBMzr.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,35 @@ 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;
338
358
  }
339
- /** DOM 遍历是同步的;比 `PagePerceptionReader` 窄,调用方无需 await @experimental */
359
+ /** DOM 遍历是同步的;不取像时比 `PagePerceptionReader` 窄,调用方无需 await @experimental */
340
360
  interface DomPerceptionReader extends PagePerceptionReader {
341
361
  read(scope: PerceptionScope): readonly PerceivedNode[];
362
+ read(scope: PerceptionScope, capture: PerceptionCaptureOptions): Promise<PerceptionResult>;
342
363
  }
343
364
  /**
344
365
  * DOM 遍历实现(设计 09 §2 的「实现层」)。产出只有角色 / 名称 / 值,
@@ -350,6 +371,46 @@ interface DomPerceptionReader extends PagePerceptionReader {
350
371
  */
351
372
  declare function createDomPerceptionReader(options?: DomPerceptionReaderOptions): DomPerceptionReader;
352
373
  //#endregion
374
+ //#region src/dom/imageCapture.d.ts
375
+ /**
376
+ * 取像级别(0.6.0 FR-12.1)。裁决 D-3 已取消 L3 栅格化,只剩两级。
377
+ * @experimental
378
+ */
379
+ type CaptureLevel = 'src' | 'canvas';
380
+ /** @experimental */
381
+ interface CapturedImage {
382
+ id: string;
383
+ mimeType: string;
384
+ /** base64,不含 `data:` 前缀 */
385
+ data: string;
386
+ level: CaptureLevel;
387
+ originalBytes: number;
388
+ /** 压缩后字节数;未压缩时与 `originalBytes` 相同 */
389
+ bytes: number;
390
+ }
391
+ /** @experimental */
392
+ interface CaptureFailure {
393
+ id: string;
394
+ /** 必须说明是哪一级、为什么;只写 "image unavailable" 不足以让用户判断该怎么办 */
395
+ reason: string;
396
+ triedLevels: readonly CaptureLevel[];
397
+ }
398
+ /** @experimental */
399
+ declare function isCaptureFailure(result: CapturedImage | CaptureFailure): result is CaptureFailure;
400
+ /** 只有这三种标签能取像;其余元素连取像入口都不进(FR-12.1,由 T-02-15 守门) @experimental */
401
+ declare function isCapturableElement(element: Element): boolean;
402
+ /**
403
+ * 取一个元素的图像(0.6.0 FR-12.1)。
404
+ *
405
+ * 按元素类型分派,不做无意义的尝试:`<img>` 只走 L1,`<canvas>` / `<svg>` 只走 L2,
406
+ * 两者互不兜底。失败返回 `CaptureFailure` 而不是抛错——一张图抓不到不该让整次感知失败。
407
+ * @experimental
408
+ */
409
+ declare function captureElementImage(element: Element, options: {
410
+ id: string;
411
+ maxBytes: number;
412
+ }): Promise<CapturedImage | CaptureFailure>;
413
+ //#endregion
353
414
  //#region src/host/protocol.d.ts
354
415
  /** 主线程 → Worker 的 LLM 配置;mockResponses 供 E2E/测试注入确定性 Mock */
355
416
  interface LlmClientConfig {
@@ -521,4 +582,39 @@ declare class WorkerUiBridge implements UiBridge {
521
582
  onTextDelta(runId: string, delta: string): Promise<void>;
522
583
  }
523
584
  //#endregion
524
- export { type BridgeCapabilities, type BridgeRequest, type BridgeResponse, BrowserSkillManager, BrowserWorkerScriptExecutor, type ChromeBuiltinAvailability, ChromeBuiltinLlmClient, type ConfiguredLlmClient, type DictationAvailability, type DictationOptions, type DictationSession, 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, checkDictationAvailability, createDomPerceptionReader, createIframeWorker, createLlmClient, extractZipWeb, installWebSkillNavigator, isOpfsAvailable, parseBridgeRequest, parseMainMessage, parseWorkerEvent, probeChromeBuiltinAvailability, sha256HexWeb, startDictation, startWorkerRuntimeHost };
585
+ //#region src/memory/encryptedMemoryStore.d.ts
586
+ /**
587
+ * 某条已读出的记忆值是否是密文信封。观测方(如 console)据此决定要不要去取密钥:
588
+ * 加密关着的时候不该为了读一条明文而凭空建出一把密钥。
589
+ * @experimental
590
+ */
591
+ declare function isEncryptedMemoryValue(value: unknown): boolean;
592
+ /**
593
+ * 用 AES-GCM 包装一个 MemoryStore:值加密后再交给 `inner`,读取时解密。
594
+ * 密钥不可用(未解锁 / 无 Web Crypto)时**拒绝读写并抛结构化错误**,
595
+ * 不静默降级成明文——那会让「已加密」的承诺失效而用户无从察觉。
596
+ *
597
+ * `scopes` 限定加密范围。默认全加密;宿主通常只加密存放个人数据的
598
+ * `user:` 作用域,把运行观测(会话参数历史、技能统计)留作明文供 console 读取。
599
+ * @experimental
600
+ */
601
+ declare function createEncryptedMemoryStore(inner: MemoryStore, key: CryptoKey | undefined, options?: {
602
+ scopes?: (scope: string) => boolean;
603
+ }): MemoryStore;
604
+ /**
605
+ * 生成一把不可导出的 AES-GCM 256 密钥(FR-19.5)。不可导出意味着页面脚本
606
+ * 拿不到原始字节,只能通过 Web Crypto 使用它;宿主负责持久化这个句柄(如 IndexedDB)。
607
+ * @experimental
608
+ */
609
+ declare function generateMemoryEncryptionKey(): Promise<CryptoKey>;
610
+ /**
611
+ * 取(必要时生成)本地数据加密密钥并持久化在 IndexedDB(FR-19.5)。
612
+ * 存的是 `CryptoKey` 句柄本身而不是密钥字节:结构化克隆能存它,
613
+ * 而它是 non-extractable 的,页面脚本与扩展都读不出原始字节。
614
+ * @experimental
615
+ */
616
+ declare function openMemoryEncryptionKey(name?: string): Promise<CryptoKey>;
617
+ /** 删除本地数据加密密钥;清除画像与记录时一并调用,避免留下解不开的旧密文 @experimental */
618
+ declare function deleteMemoryEncryptionKey(name?: string): Promise<void>;
619
+ //#endregion
620
+ 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 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, createDomPerceptionReader, createEncryptedMemoryStore, createIframeWorker, createLlmClient, deleteMemoryEncryptionKey, extractZipWeb, generateMemoryEncryptionKey, installWebSkillNavigator, isCapturableElement, isCaptureFailure, isEncryptedMemoryValue, isOpfsAvailable, openMemoryEncryptionKey, parseBridgeRequest, parseMainMessage, parseWorkerEvent, probeChromeBuiltinAvailability, sha256HexWeb, startDictation, startWorkerRuntimeHost };