@webskill/sdk 0.14.0 → 0.16.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 +3 -3
- package/dist/agent.js +2842 -3
- package/dist/{dist-Bfga1TmS.js → approval-BnLLCOG0.js} +235 -2932
- package/dist/browser.d.ts +242 -8
- package/dist/browser.js +687 -40
- package/dist/{openUiLibrary-BKXW7Iwx-DjvEnMlJ.js → dist-CTsxblSD.js} +496 -28
- package/dist/{echarts-De78wXqV.js → echarts-BE7oV_Dl.js} +1 -1
- package/dist/{env-8cY40DXB-CGnEVZby.js → env-Bj1MI2Ww.js} +1 -1
- package/dist/errors-BDZNpC13.js +22 -0
- package/dist/{eventTypes-FllCrX-Z-DNDeHWoG.js → eventTypes-CwciaqCU.js} +37 -2
- package/dist/external-_ZRQe-V9.js +53 -0
- package/dist/governance.d.ts +38 -3
- package/dist/governance.js +86 -4
- package/dist/{index-DQwGvHAI.d.ts → index-BLfnO7sz.d.ts} +406 -19
- package/dist/{index-CWoKOFBP.d.ts → index-DbVqg2V3.d.ts} +159 -3
- package/dist/{index-sd-gVKey.d.ts → index-DeXgdtHa.d.ts} +26 -18
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1001 -5
- package/dist/kind-DxgS8LM-.js +77 -0
- package/dist/linkedDocument-xNXF-z8n.js +94 -0
- package/dist/llm-B7lLH0ZI.js +1767 -0
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +41 -4
- package/dist/memoryArtifactStore-D6dLeY55.js +48 -0
- package/dist/miniChart-lauNtZu8.js +528 -0
- package/dist/node.d.ts +3 -3
- package/dist/node.js +106 -9
- package/dist/openUiLibrary-BWEBU9P-.js +30 -0
- package/dist/openUiSpecLang-BIK6CWlW.js +1849 -0
- package/dist/pathSecurity-B1owvJAF.js +65 -0
- package/dist/processSandboxEntry.js +5 -1
- package/dist/renderResult-D9Q-Vu2x.js +143 -0
- package/dist/{rolldown-runtime-BOF7iYI8.js → rolldown-runtime-BHkdefai.js} +1 -2
- package/dist/sandboxWorkerEntry.js +5 -1
- package/dist/{dist-D5YhlCdY.js → skill-CAJMsLod.js} +44 -372
- package/dist/{skillVersionStore-D-qHk9ZE-C0OFDTQY.d.ts → skillVersionStore-B24Jjjry-CsbzF7Oe.d.ts} +14 -2
- package/dist/surface-DVGiCmwq.js +145 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +64 -3
- package/dist/types-BuacBov_.js +89 -0
- package/dist/{types-C3V6lAeO-BgeOvc1Y.d.ts → types-C3V6lAeO-BUpcRLER.d.ts} +28 -1
- package/dist/ui-react.d.ts +18 -5
- package/dist/ui-react.js +130781 -6951
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui-vue.js +12 -3
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +1254 -3
- package/dist/urlSafety-CiSuCJvX.js +65 -0
- package/dist/webSkillApi-DOOyz2G5.js +106 -0
- package/dist/{webskillLitCatalog-D_zCqeQF-swXsWoAe.js → webskillLitCatalog-poL1qhBp.js} +11 -3
- package/package.json +1 -1
- package/dist/catalogComponents-BgAJN0p8-Cr55ouOg.js +0 -124384
- package/dist/client-BCM6Z3yq-qUQNkKrK.js +0 -7787
- package/dist/dist-BnqAkSS6.js +0 -2384
- package/dist/dist-CiaDIqkV.js +0 -3509
- package/dist/dist-DxyxmXPU-DGC-dpXf.js +0 -5621
- package/dist/memoryArtifactStore-52Zn9npI-BxtUkrgV.js +0 -86
- package/dist/stdio-CFMoANJJ-BxrTeXh7.js +0 -31
- package/dist/testing-Cm8MseLF.js +0 -142
- package/dist/types-WovEf4ED-CZSDiiBU.js +0 -6215
package/dist/browser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { $ as
|
|
1
|
+
import { Ct as SkillsLockfile, Et as TrustedKeyStore, H as FileStat, Mt as WebSkillError, N as ArchiveLimits, S as UiBridge, U as FileSystemProvider, _t as SkillManifest, b as RenderResultRequest, c as InteractionResponse, jt as VerifyResult, kt as UnsignedPolicy, l as LlmClient, m as LlmStreamEvent, o as InteractionPolicy, p as LlmResponse, pt as SkillInstallSource, s as InteractionRequest, u as LlmCompleteInput, v as MemoryStore } from "./types-C3V6lAeO-BUpcRLER.js";
|
|
2
|
+
import { Kt as ScriptExecutionContext, M as DocumentSurfaceHost, R as ExternalSkillProvider, S as BridgeResponse, Un as WebSkillApi, Yn as bridgeError, ct as NetworkPolicy, gn as ToolDefinition, m as ApprovalScope, ot as LinkedDocumentReader, qt as ScriptExecutor, x as BridgeRequest, y as BridgeCapabilities, yn as ToolResult, yr as parseBridgeRequest, z as ExternalToolSource } from "./index-DbVqg2V3.js";
|
|
3
|
+
import { $ as NestedFrameRef, Ct as PagePerceptionPolicy, It as PerceptionScopeInput, Pt as PerceptionResult, Tt as PagePerceptionReader, Xt as SubtreeRejection, ft as PageActionOutcome, gt as PageActionRequest, jt as PerceptionCaptureOptions, kt as PerceivedNode, ut as PageActionExecutor, vt as PageActionScopeInput, yt as PageActionTarget } from "./index-BLfnO7sz.js";
|
|
4
4
|
//#region ../browser/dist/index.d.ts
|
|
5
5
|
//#region src/fs/featureDetection.d.ts
|
|
6
6
|
/** 检测当前环境是否可用 OPFS(navigator.storage.getDirectory) */
|
|
@@ -39,7 +39,7 @@ declare class OpfsProvider implements FileSystemProvider {
|
|
|
39
39
|
*
|
|
40
40
|
* 协议(宿主 ↔ Worker):
|
|
41
41
|
* - 宿主 → Worker:{type:'load', id, source, networkPolicy?} 请求加载脚本定义
|
|
42
|
-
* - 宿主 → Worker:{type:'execute', id, skillName, runId, source, args, networkPolicy?} 请求执行
|
|
42
|
+
* - 宿主 → Worker:{type:'execute', id, skillName, runId, source, args, networkPolicy?, documentSurface?} 请求执行
|
|
43
43
|
* - Worker → 宿主:{type:'load-result', id, ok, definition?, error?}
|
|
44
44
|
* - Worker → 宿主:{type:'execute-result', id, ok, value?, stdout, stderr, error?}
|
|
45
45
|
* - Worker → 宿主:{type:'bridge', request} 能力桥 RPC(readReference/writeArtifact/confirm)
|
|
@@ -418,6 +418,12 @@ interface RoleHint {
|
|
|
418
418
|
}
|
|
419
419
|
//#endregion
|
|
420
420
|
//#region src/dom/perception.d.ts
|
|
421
|
+
/**
|
|
422
|
+
* 句柄的用途(分册 14 §6.1)。`anchor` 只能做 `perceive_page` 的子树根,
|
|
423
|
+
* 拿去 `act_on_page` 一律被拒——否则放宽读的范围会顺带放宽写的范围。
|
|
424
|
+
* @experimental
|
|
425
|
+
*/
|
|
426
|
+
type HandleKind = 'action' | 'anchor';
|
|
421
427
|
interface DomPerceptionReaderOptions {
|
|
422
428
|
/** 选择器求值的根;缺省 `globalThis.document` */
|
|
423
429
|
document?: Document;
|
|
@@ -456,8 +462,12 @@ interface DomPerceptionReaderOptions {
|
|
|
456
462
|
interface DomPerceptionReader extends PagePerceptionReader {
|
|
457
463
|
read(scope: PerceptionScopeInput): readonly PerceivedNode[];
|
|
458
464
|
read(scope: PerceptionScopeInput, capture: PerceptionCaptureOptions): Promise<PerceptionResult>;
|
|
465
|
+
/** 子树续读(分册 14):只能缩小范围,拒绝以返回值而非抛错表达 */
|
|
466
|
+
readSubtree(scope: PerceptionScopeInput, ref: string, capture?: PerceptionCaptureOptions): Promise<PerceptionResult | SubtreeRejection>;
|
|
459
467
|
/** 把句柄换回元素;未知或已过期的句柄返回 undefined。供执行器使用,不自建第二张表 */
|
|
460
468
|
resolve(ref: string): Element | undefined;
|
|
469
|
+
/** 句柄的用途;`anchor` 只能做子树根,执行器据此拒掉写动作(分册 14 §6.1) */
|
|
470
|
+
handleKindOf(ref: string): HandleKind | undefined;
|
|
461
471
|
/** 句柄所属的帧;主文档目标返回 undefined(FR-24.6 的确认卡措辞与审计据此区分) */
|
|
462
472
|
frameOf(ref: string): string | undefined;
|
|
463
473
|
/** 操作前的活动模态快照;与操作后做差集即「本次新打开的模态」(FR-25.6) */
|
|
@@ -496,6 +506,11 @@ interface DomPageActionOptions {
|
|
|
496
506
|
* 不注入即 `attach` 一律按「用户取消」处理 —— Agent 永远传不进本地路径。
|
|
497
507
|
*/
|
|
498
508
|
pickFiles?: () => Promise<readonly File[] | undefined>;
|
|
509
|
+
/**
|
|
510
|
+
* `back` 作用的文档;缺省 `globalThis.document`。
|
|
511
|
+
* 其余动作不用它——它们的文档从元素自带的 `ownerDocument` 取,跨帧时才不会拿错。
|
|
512
|
+
*/
|
|
513
|
+
document?: Document;
|
|
499
514
|
}
|
|
500
515
|
/**
|
|
501
516
|
* @experimental
|
|
@@ -537,6 +552,11 @@ type PageAgentReply = {
|
|
|
537
552
|
type: 'perceive-result';
|
|
538
553
|
result: PerceptionResult;
|
|
539
554
|
targets: readonly PageAgentTargetEntry[];
|
|
555
|
+
/**
|
|
556
|
+
* 这批句柄属于哪个文档(分册 11 / FR-11.1)。**可选**是有意的:
|
|
557
|
+
* 0.15.0 的页面侧处理器不会回它,此时 reader 退回单分片,行为逐字不变。
|
|
558
|
+
*/
|
|
559
|
+
document?: PageDocumentIdentity;
|
|
540
560
|
} | {
|
|
541
561
|
type: 'execute-result';
|
|
542
562
|
outcome: PageActionOutcome;
|
|
@@ -545,6 +565,18 @@ type PageAgentReply = {
|
|
|
545
565
|
code: string;
|
|
546
566
|
message: string;
|
|
547
567
|
};
|
|
568
|
+
/**
|
|
569
|
+
* 文档标识(分册 11 / FR-11.1)。
|
|
570
|
+
*
|
|
571
|
+
* `key` 是**不透明**的:SDK 只拿它做相等比较与分片,不解析、不从中还原地址。
|
|
572
|
+
* `url` / `title` 只用于确认卡与留痕的可读性,不参与任何判定。
|
|
573
|
+
* @experimental
|
|
574
|
+
*/
|
|
575
|
+
interface PageDocumentIdentity {
|
|
576
|
+
key: string;
|
|
577
|
+
url?: string;
|
|
578
|
+
title?: string;
|
|
579
|
+
}
|
|
548
580
|
/**
|
|
549
581
|
* 感知期随结果一并回传的句柄描述表(D-13-3);**不进模型上下文**。
|
|
550
582
|
*
|
|
@@ -562,22 +594,117 @@ interface PageAgentTargetEntry {
|
|
|
562
594
|
}
|
|
563
595
|
//#endregion
|
|
564
596
|
//#region src/remote/registry.d.ts
|
|
597
|
+
/**
|
|
598
|
+
* 句柄解析结果(0.16.0 分册 11 / FR-11.6)。
|
|
599
|
+
*
|
|
600
|
+
* 三种失败必须可区分:「不在当前这一页」「那一页已经变了」「从没见过」——
|
|
601
|
+
* 它们对模型的下一步要求完全不同,压成一个 `undefined` 就只能让它盲试。
|
|
602
|
+
* @experimental
|
|
603
|
+
*/
|
|
604
|
+
type TargetResolution = {
|
|
605
|
+
status: 'ok';
|
|
606
|
+
target: PageActionTarget;
|
|
607
|
+
} |
|
|
608
|
+
/** 认识,但它属于另一个还活着的页面 */
|
|
609
|
+
{
|
|
610
|
+
status: 'unfocused';
|
|
611
|
+
} |
|
|
612
|
+
/** 认识过,但它那一页已经变了或被丢弃了 */
|
|
613
|
+
{
|
|
614
|
+
status: 'expired';
|
|
615
|
+
} |
|
|
616
|
+
/** 从没见过(含上一轮 run 的句柄) */
|
|
617
|
+
{
|
|
618
|
+
status: 'unknown';
|
|
619
|
+
};
|
|
565
620
|
/**
|
|
566
621
|
* 感知期写入、执行期读取的句柄描述表(分册 13 / FR-13.3)。
|
|
567
622
|
*
|
|
568
623
|
* 由**宿主创建并同时交给 reader 和 executor**——两者共享同一个实例是本册的装配前提。
|
|
569
624
|
* 工厂单独导出就是为了让这件事在宿主代码里显式可见,
|
|
570
625
|
* 而不是藏在某个工厂内部让人以为「自己会连上」。
|
|
626
|
+
*
|
|
627
|
+
* 0.16.0 起按**文档**分片(分册 11 / D-11-1(d)):分片键是一个不透明串,
|
|
628
|
+
* 「标签页」只是宿主给它的一种解释——本包不认识标签页,也不该认识(AC-G8)。
|
|
571
629
|
* @experimental
|
|
572
630
|
*/
|
|
573
631
|
interface RemoteTargetRegistry {
|
|
574
|
-
/**
|
|
575
|
-
|
|
632
|
+
/**
|
|
633
|
+
* 用新一批条目**整体替换**该文档分片的旧表,并把焦点移到它。
|
|
634
|
+
* `document` 缺省即单分片形态,行为与 0.15.0 逐字一致。
|
|
635
|
+
*/
|
|
636
|
+
replace(entries: readonly PageAgentTargetEntry[], document?: PageDocumentIdentity): void;
|
|
637
|
+
/** 只查当前焦点分片。语义与 0.15.0 一致,既有调用点不必改 */
|
|
576
638
|
get(ref: string): PageActionTarget | undefined;
|
|
639
|
+
/** `get` 的可诊断版本;`get` 保留是因为 `PageActionExecutor.describe` 的同步契约不能动 */
|
|
640
|
+
resolve(ref: string): TargetResolution;
|
|
641
|
+
/** 把后续的 `get` / `resolve` 指向该分片;分片不存在时焦点仍然移过去(其 `get` 全落空) */
|
|
642
|
+
focus(shard: string): void;
|
|
643
|
+
readonly focused: string | undefined;
|
|
644
|
+
/** 焦点分片的文档标识;用于留痕与确认卡文案,**不参与**任何判定 */
|
|
645
|
+
describePage(): PageDocumentIdentity | undefined;
|
|
646
|
+
/** 该分片失效(文档变了 / 标签页关了)。**不影响其它分片**(FR-11.3 / AC-11.5) */
|
|
647
|
+
drop(shard: string): void;
|
|
648
|
+
/** run 结束时清空(FR-11.4)。它只丢句柄,**不关闭任何标签页**——那是用户的浏览器 */
|
|
649
|
+
clear(): void;
|
|
650
|
+
/** 当前焦点分片的条目数;单分片下与 0.15.0 同值 */
|
|
577
651
|
readonly size: number;
|
|
652
|
+
readonly shardCount: number;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* 分片数的防泄漏软上限(分册 11 / DV-2)。
|
|
656
|
+
*
|
|
657
|
+
* 它**不是** FR-11.5 那个容量闸门:那一条管的是「同时有几个**标签页**可操作」,
|
|
658
|
+
* 触顶硬拒绝,落在 `TabWorksetPolicy`。这里管的是同一个标签页里连续跳页攒下的历史分片,
|
|
659
|
+
* 那些本来就该失效,按最久未使用逐出即可,逐出不构成对模型的拒绝。
|
|
660
|
+
*/
|
|
661
|
+
declare const SHARD_SOFT_LIMIT = 24;
|
|
662
|
+
/**
|
|
663
|
+
* 把解析结果翻译成给模型看的补充说明(分册 11 / FR-11.6);
|
|
664
|
+
* 接到 `PageActionPolicyOptions.diagnose` 上即可:
|
|
665
|
+
*
|
|
666
|
+
* ```ts
|
|
667
|
+
* diagnose: (ref) => explainResolution(targets.resolve(ref))
|
|
668
|
+
* ```
|
|
669
|
+
*
|
|
670
|
+
* `unknown` 返回 `undefined` 而不是自己拼一句:让 policy 落回它的缺省文案,
|
|
671
|
+
* 于是 AC-11.3 要求的「与 0.15.0 逐字相同」是**构造性**成立的,
|
|
672
|
+
* 而不是靠两个文件里的字符串抄得一样。
|
|
673
|
+
* @experimental
|
|
674
|
+
*/
|
|
675
|
+
declare function explainResolution(resolution: TargetResolution): string | undefined;
|
|
676
|
+
/** @experimental */
|
|
677
|
+
interface RemoteTargetRegistryOptions {
|
|
678
|
+
/** 分片数软上限;缺省 `SHARD_SOFT_LIMIT`。小于 1 的值按 1 处理 */
|
|
679
|
+
maxShards?: number;
|
|
578
680
|
}
|
|
579
681
|
/** @experimental */
|
|
580
|
-
declare function createRemoteTargetRegistry(): RemoteTargetRegistry;
|
|
682
|
+
declare function createRemoteTargetRegistry(options?: RemoteTargetRegistryOptions): RemoteTargetRegistry;
|
|
683
|
+
//#endregion
|
|
684
|
+
//#region src/remote/documentIdentity.d.ts
|
|
685
|
+
/**
|
|
686
|
+
* 文档标识(0.16.0 分册 11 · FR-11.1)。
|
|
687
|
+
*
|
|
688
|
+
* 它有且只有两个消费者,且**必须是同一个函数**:
|
|
689
|
+
* ① 感知回复里的 `document.key`,决定这批句柄进哪个分片;
|
|
690
|
+
* ② `PageActionOutcome.navigated`,执行前后各取一次。
|
|
691
|
+
* 两处各写一套判定,就会出现「操作说导航了、分片说没换」的不一致(AC-11.4 / AC-13.4 验的就是这个)。
|
|
692
|
+
*/
|
|
693
|
+
/** `Window` 的最小切面;取这个而不是 `Window` 是为了让本模块在无 DOM 的测试里也能跑 */
|
|
694
|
+
interface DocumentLocationView {
|
|
695
|
+
readonly location: {
|
|
696
|
+
readonly href: string;
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* `instance` + 当前地址。真导航换 `instance`,帧内路由(SPA)换 `href`,
|
|
701
|
+
* 两类都被这一个串覆盖——靠 origin 比对识别不出后者。
|
|
702
|
+
*
|
|
703
|
+
* `href` 含 hash 是有意的:纯 hash 跳转在很多站点上会换掉整块内容,
|
|
704
|
+
* 判成换文档是安全侧的选择(代价是多感知一次;漏判没有便宜的补救)。
|
|
705
|
+
* @experimental
|
|
706
|
+
*/
|
|
707
|
+
declare function documentKey(view: DocumentLocationView | null | undefined): string | undefined;
|
|
581
708
|
//#endregion
|
|
582
709
|
//#region src/remote/reader.d.ts
|
|
583
710
|
/** @experimental */
|
|
@@ -587,6 +714,12 @@ interface RemotePerceptionReaderOptions {
|
|
|
587
714
|
targets: RemoteTargetRegistry;
|
|
588
715
|
/** 单次感知超时毫秒;缺省 10000 */
|
|
589
716
|
timeoutMs?: number;
|
|
717
|
+
/**
|
|
718
|
+
* 刚读到的是哪个文档(分册 11)。宿主据此维护「标签页 → 分片」的归属,
|
|
719
|
+
* 页面自己跳走时才知道该丢哪个分片。**SDK 不替宿主记这层映射**——
|
|
720
|
+
* 那需要标签页概念,而本包不认识标签页(AC-G8)。
|
|
721
|
+
*/
|
|
722
|
+
onDocument?: (document: PageDocumentIdentity) => void;
|
|
590
723
|
}
|
|
591
724
|
/**
|
|
592
725
|
* 跨上下文的页面感知(分册 13 / FR-13.2)。
|
|
@@ -649,6 +782,99 @@ interface PageAgentHandler {
|
|
|
649
782
|
*/
|
|
650
783
|
declare function createPageAgentHandler(options?: PageAgentHandlerOptions): PageAgentHandler;
|
|
651
784
|
//#endregion
|
|
785
|
+
//#region src/remote/frameRouter.d.ts
|
|
786
|
+
/**
|
|
787
|
+
* 一次感知能铺开的上限(0.14.0 分册 16 FR-16.4)。
|
|
788
|
+
*
|
|
789
|
+
* 兜底的是**帧数与节点总量**,不是层数。0.13.0 D-18-8 用深度上限兜底,
|
|
790
|
+
* 前提是「路径由宿主写死」;自动发现一进来那个前提就没了:
|
|
791
|
+
* 三层的页面可能只有 5 个节点,两层的门户可能挂着 40 个 iframe。
|
|
792
|
+
* 层数是错的度量,总量才是。
|
|
793
|
+
* @experimental
|
|
794
|
+
*/
|
|
795
|
+
interface FrameBudget {
|
|
796
|
+
maxFrames: number;
|
|
797
|
+
maxNodes: number;
|
|
798
|
+
}
|
|
799
|
+
/** @experimental */
|
|
800
|
+
declare const DEFAULT_FRAME_BUDGET: FrameBudget;
|
|
801
|
+
/**
|
|
802
|
+
* 一次投递的回执。
|
|
803
|
+
*
|
|
804
|
+
* `documentUrl` 是应答**实际来自**的文档地址,用于导航漂移判定:
|
|
805
|
+
* 投递地址是上一刻算出来的,那一帧完全可能在往返之间导航走。
|
|
806
|
+
* @experimental
|
|
807
|
+
*/
|
|
808
|
+
interface FrameDelivery {
|
|
809
|
+
reply: PageAgentReply;
|
|
810
|
+
documentUrl: string;
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* 解析嵌套帧时宿主能拿到的上下文。
|
|
814
|
+
*
|
|
815
|
+
* `visited` 由路由器攒、由宿主读:去重需要比较地址,而地址对路由器是不透明的
|
|
816
|
+
* (D-11-1)。让宿主自己在 dispatcher 里存一份则解决不了生命周期——
|
|
817
|
+
* dispatcher 是长期对象,一次编排结束后没人通知它清空。
|
|
818
|
+
* @experimental
|
|
819
|
+
*/
|
|
820
|
+
interface FrameResolveContext<A> {
|
|
821
|
+
/** 发现这个嵌套帧的那一帧的地址 */
|
|
822
|
+
readonly parent: A;
|
|
823
|
+
/** 本次感知已投递过的地址,按投递顺序 */
|
|
824
|
+
readonly visited: readonly A[];
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* 宿主实现的那一半(分册 11 FR-11.1):**寻址**。
|
|
828
|
+
*
|
|
829
|
+
* 地址类型 `A` 对路由器完全不透明:不比较、不序列化、不持久化,
|
|
830
|
+
* 只在同一次编排内原样传递。扩展宿主用帧号,`postMessage` 宿主用 URL,
|
|
831
|
+
* 两者不需要迁就同一个形状。
|
|
832
|
+
* @experimental
|
|
833
|
+
*/
|
|
834
|
+
interface FrameDispatcher<A> {
|
|
835
|
+
/** 从哪里开始下钻 */
|
|
836
|
+
mainFrame(): A | Promise<A>;
|
|
837
|
+
/** 把一次请求送到某个地址 */
|
|
838
|
+
send(address: A, request: PageAgentRequest): Promise<FrameDelivery>;
|
|
839
|
+
/**
|
|
840
|
+
* 把某一帧报上来的嵌套帧引用换成可投递的地址。
|
|
841
|
+
*
|
|
842
|
+
* 解析不出(跨源、不可达、不在宿主白名单里、已经读过)时返回 `undefined`,
|
|
843
|
+
* 该帧被跳过并留说明,**不算错误**。这是帧可达性的唯一出口:
|
|
844
|
+
* SDK 不带任何缺省白名单,也不因为「导出了」就替宿主放行一帧(D-11-4)。
|
|
845
|
+
*/
|
|
846
|
+
resolveNestedFrame(nested: NestedFrameRef, context: FrameResolveContext<A>): Promise<A | undefined> | A | undefined;
|
|
847
|
+
}
|
|
848
|
+
/** @experimental */
|
|
849
|
+
interface FrameRouterOptions<A> {
|
|
850
|
+
dispatcher: FrameDispatcher<A>;
|
|
851
|
+
budget?: Partial<FrameBudget>;
|
|
852
|
+
/**
|
|
853
|
+
* 主帧的帧名(D-11-3)。不给则主帧节点**不带** `frame`——
|
|
854
|
+
* 主帧就是「这个页面」,给它加一段前缀只会让每个节点都变吵。
|
|
855
|
+
* 主帧本身就是外壳里的一帧时(模型要能区分外壳与业务帧)才给。
|
|
856
|
+
*/
|
|
857
|
+
mainFrameLabel?: string;
|
|
858
|
+
}
|
|
859
|
+
/** @experimental */
|
|
860
|
+
interface FrameRouter {
|
|
861
|
+
perceive(request: PageAgentRequest & {
|
|
862
|
+
type: 'perceive';
|
|
863
|
+
}): Promise<PageAgentReply>;
|
|
864
|
+
execute(request: PageAgentRequest & {
|
|
865
|
+
type: 'execute';
|
|
866
|
+
}): Promise<PageAgentReply>;
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* 逐帧下钻并汇总(分册 16 FR-16.2 / FR-16.3 / FR-16.4,分册 11 FR-11.2)。
|
|
870
|
+
*
|
|
871
|
+
* 编排本身与浏览器 API 无关:它只认 `PageAgentRequest` / `PageAgentReply`,
|
|
872
|
+
* 寻址全压在宿主实现的 `FrameDispatcher` 里。因此这个模块可以在 Service Worker
|
|
873
|
+
* 里实例化,也可以服务不按帧号寻址的宿主。
|
|
874
|
+
* @experimental
|
|
875
|
+
*/
|
|
876
|
+
declare function createFrameRouter<A>(options: FrameRouterOptions<A>): FrameRouter;
|
|
877
|
+
//#endregion
|
|
652
878
|
//#region src/dom/imageCapture.d.ts
|
|
653
879
|
/**
|
|
654
880
|
* 取像级别(0.6.0 FR-12.1)。裁决 D-3 已取消 L3 栅格化,只剩两级。
|
|
@@ -1204,6 +1430,14 @@ declare const DOCUMENT_SURFACE_AUDIT_EVENT = "document.surface.open";
|
|
|
1204
1430
|
* 无 `allow-top-navigation` 改不了它的地址。
|
|
1205
1431
|
*/
|
|
1206
1432
|
declare function openDocumentSurface(input: OpenDocumentInput, options: DocumentSurfaceOptions): Promise<WindowLike>;
|
|
1433
|
+
/**
|
|
1434
|
+
* 把 `openDocumentSurface` 柯里化成 `DocumentSurfaceHost`(0.15.0 分册 13 FR-13.3)。
|
|
1435
|
+
*
|
|
1436
|
+
* **只绑定选项,不新增任何逻辑**:体积上限、握手超时、`DOCUMENT_SURFACE_DECLINED`
|
|
1437
|
+
* 与审计事件全部沿用上面那一份实现(FR-13.5「逐条不变」的实现基础)。
|
|
1438
|
+
* @experimental
|
|
1439
|
+
*/
|
|
1440
|
+
declare function createDocumentSurfaceHost(options: DocumentSurfaceOptions): DocumentSurfaceHost;
|
|
1207
1441
|
//#endregion
|
|
1208
1442
|
//#region src/viewer/shell.d.ts
|
|
1209
1443
|
/**
|
|
@@ -1280,4 +1514,4 @@ declare function watchBlockedResources(host: ViewerBlockedHost, notice: ViewerBl
|
|
|
1280
1514
|
/** 提示文案的单一来源;判据直接引用,不各写一份字面量 */
|
|
1281
1515
|
declare function blockedMessage(origins: readonly string[]): string;
|
|
1282
1516
|
//#endregion
|
|
1283
|
-
export { type BlockedEventLike, type BridgeCapabilities, type BridgeRequest, type BridgeResponse, type BrowserHostBundle, type BrowserHostOptions, type BrowserHostOverrides, BrowserSkillManager, BrowserWorkerScriptExecutor, type CaptureFailure, type CaptureLevel, type CapturedImage, type ChromeBuiltinAvailability, ChromeBuiltinLlmClient, type CompressResult, type ConfiguredLlmClient, DEFAULT_MAX_VIEWER_PAYLOAD_BYTES, DOCUMENT_SURFACE_AUDIT_EVENT, DOCX_UNEXTRACTED, type DictationAvailability, type DictationOptions, type DictationSession, type DocumentSurfaceAudit, type DocumentSurfaceOptions, type DomPageActionExecutor, type DomPageActionOptions, type DomPerceptionReader, type DomPerceptionReaderOptions, type FetchLinkedDocumentOptions, HOST_PORT_MATRIX, type HostChatbotAdapterShape, type HostConnectFacadeShape, type HostConsoleBackendShape, type HostKind, type HostSurface, type IframeSandboxOptions, IframeWorkerLike, type InspectHostWiringInput, type LlmClientConfig, type LlmEntryConfig, type MainToWorkerMessage, type OpenDocumentInput, OpfsProvider, type PageAgentHandler, type PageAgentHandlerOptions, type PageAgentReply, type PageAgentRequest, type PageAgentTargetEntry, type PageAgentTransport, type PortApplicability, type PortReport, type PortSpec, type PortStatus, type RemotePageActionExecutorOptions, type RemotePerceptionReaderOptions, type RemoteTargetRegistry, type RoleHint, SANDBOX_PAGE_SCRIPT_SOURCE, type SandboxMode, type SerializedError, TsTranspiler, type TypeScriptSupportOptions, VIEWER_SANDBOX_TOKENS, type ViewerBlockedHost, type ViewerBlockedNotice, type ViewerBlockedResult, type ViewerCspOptions, type ViewerDocument, type ViewerShellHost, type ViewerShellMount, type ViewerShellResult, WORKER_BOOTSTRAP_SOURCE, type WindowLike, type WorkerEvent, type WorkerFactory, type WorkerLike, type WorkerRequest, WorkerRuntimeClient, type WorkerRuntimeClientDeps, type WorkerRuntimeHostOverrides, type WorkerScopeLike, WorkerUiBridge, XLSX_UNEXTRACTED, blockedMessage, bridgeError, captureElementImage, checkDictationAvailability, compressImageToBudget, createBrowserChatbotHost, createDomPageActionExecutor, createDomPerceptionReader, createEncryptedMemoryStore, createFetchLinkedDocumentReader, createIframeWorker, createLlmClient, createPageAgentHandler, createRemotePageActionExecutor, createRemotePerceptionReader, createRemoteTargetRegistry, deleteMemoryEncryptionKey, extractDocxText, extractXlsxText, extractZipWeb, generateMemoryEncryptionKey, inspectHostWiring, installWebSkillNavigator, isCapturableElement, isCaptureFailure, isEncryptedMemoryValue, isOpfsAvailable, missingPorts, openDocumentSurface, openMemoryEncryptionKey, parseBridgeRequest, parseMainMessage, parseWorkerEvent, probeChromeBuiltinAvailability, sha256HexWeb, startDictation, startViewerShell, startWorkerRuntimeHost, viewerCspHeader, watchBlockedResources };
|
|
1517
|
+
export { type BlockedEventLike, type BridgeCapabilities, type BridgeRequest, type BridgeResponse, type BrowserHostBundle, type BrowserHostOptions, type BrowserHostOverrides, BrowserSkillManager, BrowserWorkerScriptExecutor, type CaptureFailure, type CaptureLevel, type CapturedImage, type ChromeBuiltinAvailability, ChromeBuiltinLlmClient, type CompressResult, type ConfiguredLlmClient, DEFAULT_FRAME_BUDGET, DEFAULT_MAX_VIEWER_PAYLOAD_BYTES, DOCUMENT_SURFACE_AUDIT_EVENT, DOCX_UNEXTRACTED, type DictationAvailability, type DictationOptions, type DictationSession, type DocumentLocationView, type DocumentSurfaceAudit, type DocumentSurfaceOptions, type DomPageActionExecutor, type DomPageActionOptions, type DomPerceptionReader, type DomPerceptionReaderOptions, type FetchLinkedDocumentOptions, type FrameBudget, type FrameDelivery, type FrameDispatcher, type FrameResolveContext, type FrameRouter, type FrameRouterOptions, HOST_PORT_MATRIX, type HandleKind, type HostChatbotAdapterShape, type HostConnectFacadeShape, type HostConsoleBackendShape, type HostKind, type HostSurface, type IframeSandboxOptions, IframeWorkerLike, type InspectHostWiringInput, type LlmClientConfig, type LlmEntryConfig, type MainToWorkerMessage, type OpenDocumentInput, OpfsProvider, type PageAgentHandler, type PageAgentHandlerOptions, type PageAgentReply, type PageAgentRequest, type PageAgentTargetEntry, type PageAgentTransport, type PageDocumentIdentity, type PortApplicability, type PortReport, type PortSpec, type PortStatus, type RemotePageActionExecutorOptions, type RemotePerceptionReaderOptions, type RemoteTargetRegistry, type RemoteTargetRegistryOptions, type RoleHint, SANDBOX_PAGE_SCRIPT_SOURCE, SHARD_SOFT_LIMIT, type SandboxMode, type SerializedError, type TargetResolution, TsTranspiler, type TypeScriptSupportOptions, VIEWER_SANDBOX_TOKENS, type ViewerBlockedHost, type ViewerBlockedNotice, type ViewerBlockedResult, type ViewerCspOptions, type ViewerDocument, type ViewerShellHost, type ViewerShellMount, type ViewerShellResult, WORKER_BOOTSTRAP_SOURCE, type WindowLike, type WorkerEvent, type WorkerFactory, type WorkerLike, type WorkerRequest, WorkerRuntimeClient, type WorkerRuntimeClientDeps, type WorkerRuntimeHostOverrides, type WorkerScopeLike, WorkerUiBridge, XLSX_UNEXTRACTED, blockedMessage, bridgeError, captureElementImage, checkDictationAvailability, compressImageToBudget, createBrowserChatbotHost, createDocumentSurfaceHost, createDomPageActionExecutor, createDomPerceptionReader, createEncryptedMemoryStore, createFetchLinkedDocumentReader, createFrameRouter, createIframeWorker, createLlmClient, createPageAgentHandler, createRemotePageActionExecutor, createRemotePerceptionReader, createRemoteTargetRegistry, deleteMemoryEncryptionKey, documentKey, explainResolution, extractDocxText, extractXlsxText, extractZipWeb, generateMemoryEncryptionKey, inspectHostWiring, installWebSkillNavigator, isCapturableElement, isCaptureFailure, isEncryptedMemoryValue, isOpfsAvailable, missingPorts, openDocumentSurface, openMemoryEncryptionKey, parseBridgeRequest, parseMainMessage, parseWorkerEvent, probeChromeBuiltinAvailability, sha256HexWeb, startDictation, startViewerShell, startWorkerRuntimeHost, viewerCspHeader, watchBlockedResources };
|