@webskill/sdk 0.12.0 → 0.14.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 +3 -3
- package/dist/browser.d.ts +250 -9
- package/dist/browser.js +1257 -95
- package/dist/{catalogComponents-BgAJN0p8-C3K8klJd.js → catalogComponents-BgAJN0p8-Cr55ouOg.js} +348 -14
- package/dist/{dist-sdKFgERo.js → dist-Bfga1TmS.js} +368 -34
- package/dist/{dist-DU9KDAuR.js → dist-BnqAkSS6.js} +965 -49
- package/dist/{dist-DqcL6jKO.js → dist-CiaDIqkV.js} +2 -2
- package/dist/{dist-Bev6i6Ip.js → dist-D5YhlCdY.js} +59 -1
- package/dist/governance.d.ts +3 -3
- package/dist/governance.js +2 -2
- package/dist/{index-C9pzXLKy.d.ts → index-CWoKOFBP.d.ts} +86 -5
- package/dist/{index-DFhU1uks.d.ts → index-DQwGvHAI.d.ts} +447 -22
- package/dist/{index-3fCHc1mQ.d.ts → index-sd-gVKey.d.ts} +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -5
- package/dist/mcp.d.ts +77 -3
- package/dist/mcp.js +78 -4
- package/dist/{memoryArtifactStore-52Zn9npI-LbCQaqyx.js → memoryArtifactStore-52Zn9npI-BxtUkrgV.js} +1 -1
- package/dist/node.d.ts +3 -3
- package/dist/node.js +6 -6
- package/dist/{openUiLibrary-BKXW7Iwx-DaymVubt.js → openUiLibrary-BKXW7Iwx-DjvEnMlJ.js} +2 -2
- package/dist/{skillVersionStore-D-qHk9ZE-DheTIwAB.d.ts → skillVersionStore-D-qHk9ZE-C0OFDTQY.d.ts} +1 -1
- package/dist/{testing-WPTyXQYt.js → testing-Cm8MseLF.js} +2 -2
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +2 -2
- package/dist/{types-DLctJep_-B5G4uk2u.d.ts → types-C3V6lAeO-BgeOvc1Y.d.ts} +63 -4
- package/dist/ui-react.d.ts +2 -2
- package/dist/ui-react.js +13 -11
- 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-D_zCqeQF-C9lrvvMr.js → webskillLitCatalog-D_zCqeQF-swXsWoAe.js} +1 -1
- package/package.json +2 -1
package/dist/agent.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { E as DEFAULT_MAX_DATA_SOURCE_BYTES } from "./index-
|
|
2
|
-
import { $ as
|
|
3
|
-
export { type ActionFrameScope, DEFAULT_MAX_DATA_SOURCE_BYTES, DELEGATE_TASK_TOOL, DELEGATION_SYSTEM_PROMPT, type DataSourceAuditSink, type DataSourceDef, type DataSourceKind, DataSourcePolicy, type DataSourcePolicyOptions, type DataSourceRecord, type DataSourceTransport, type DelegationBudget, DelegationOrchestrator, type DelegationOrchestratorOptions, type DelegationRequest, type DelegationResult, type DelegationToolSourceOptions, type FrameNote, type FrameScope, GENERATE_SKILL_TOOL, type GeneratedSkillDraft, type HttpDataSourceOptions, type ImageCaptureBudget, MANAGE_TODO_TOOL, PAGE_ACTION_KINDS, 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 PageActionScopeInput, type PageActionTarget, 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, type PerceptionScopeInput, SKILL_GENERATION_SYSTEM_PROMPT, type SkillCandidateSink, type SkillGenerationMessages, type SkillGenerationOutcome, type SkillGenerationPolicy, type SkillGenerationToolSourceOptions, SkillGenerator, type SkillGeneratorOptions, type SkillTraceEvidence, type SkillTraceEvidenceStep, type SubAgentRunInput, type SubAgentRunner, TODO_SYSTEM_PROMPT, type TodoEvent, type TodoItem, type TodoList, type TodoListener, type TodoStatus, TodoStore, type TodoToolSourceOptions, createDelegationToolSource, createHttpDataSourceTransport, createPageActionToolSource, createPagePerceptionToolSource, createSkillGenerationToolSource, createTodoToolSource, toActionFrameScopes, toFrameScopes, withDelegationOrigin };
|
|
1
|
+
import { E as DEFAULT_MAX_DATA_SOURCE_BYTES } from "./index-CWoKOFBP.js";
|
|
2
|
+
import { $ as PageActionOutcome, $t as frameSteps, A as DownloadedFilePolicyOptions, At as SkillGenerationToolSourceOptions, B as ImageCaptureBudget, Bt as TodoList, C as DelegationResult, Ct as PerceptionScopeInput, D as DownloadedFileEntry, Dt as SkillGenerationMessages, E as DownloadedFileConsent, Et as SkillCandidateSink, F as FrameNote, Ft as SubAgentRunInput, G as PAGE_ACTION_SYSTEM_PROMPT, Gt as createDelegationToolSource, H as MANAGE_TODO_TOOL, Ht as TodoStatus, I as FrameScope, It as SubAgentRunner, J as PERCEPTION_PAGING_DEFAULTS, Jt as createPageActionToolSource, K as PAGE_ACTION_TOOL, Kt as createDownloadedFileToolSource, L as GENERATE_SKILL_TOOL, Lt as TODO_SYSTEM_PROMPT, M as DownloadedFileReader, Mt as SkillGeneratorOptions, N as DownloadedFileRecord, Nt as SkillTraceEvidence, O as DownloadedFileListing, Ot as SkillGenerationOutcome, P as DownloadedFileToolSourceOptions, Pt as SkillTraceEvidenceStep, Q as PageActionKind, Qt as frameLabel, R as GeneratedSkillDraft, Rt as TodoEvent, S as DelegationRequest, St as PerceptionScope, T as DownloadedFileAction, Tt as SKILL_GENERATION_SYSTEM_PROMPT, U as NestedFrameRef, Ut as TodoStore, V as LIST_DOWNLOADED_FILES_TOOL, Vt as TodoListener, W as PAGE_ACTION_KINDS, Wt as TodoToolSourceOptions, X as PageActionConsent, Xt as createSkillGenerationToolSource, Y as PERCEPTION_SYSTEM_PROMPT, Yt as createPagePerceptionToolSource, Z as PageActionExecutor, Zt as createTodoToolSource, _ as DataSourceRecord, _t as PerceptionAuditSink, a as DataSourceAuditSink, at as PageActionScopeInput, b as DelegationOrchestrator, bt as PerceptionRecord, c as DataSourceCandidatePolicy, ct as PageActionUi, d as DataSourceCandidateStore, dt as PagePerceptionPolicyOptions, en as toActionFrameScopes, et as PageActionPolicy, f as DataSourceDef, ft as PagePerceptionReader, g as DataSourceProvenance, gt as PerceivedNode, h as DataSourcePolicyOptions, ht as PerceivedImage, i as DELEGATION_SYSTEM_PROMPT, it as PageActionScope, j as DownloadedFileReadResult, jt as SkillGenerator, k as DownloadedFilePolicy, kt as SkillGenerationPolicy, l as DataSourceCandidatePolicyOptions, lt as PageAuditSink, m as DataSourcePolicy, mt as ParentBudget, n as ConsentUi, nn as withDelegationOrigin, nt as PageActionRecord, o as DataSourceCandidate, ot as PageActionTarget, p as DataSourceKind, pt as PagePerceptionToolSourceOptions, q as PERCEIVE_PAGE_TOOL, qt as createHttpDataSourceTransport, r as DELEGATE_TASK_TOOL, rt as PageActionRequest, s as DataSourceCandidateAuditSink, st as PageActionToolSourceOptions, t as ActionFrameScope, tn as toFrameScopes, tt as PageActionPolicyOptions, u as DataSourceCandidateRecord, ut as PagePerceptionPolicy, v as DataSourceTransport, vt as PerceptionCaptureOptions, w as DelegationToolSourceOptions, wt as READ_DOWNLOADED_FILE_TOOL, x as DelegationOrchestratorOptions, xt as PerceptionResult, y as DelegationBudget, yt as PerceptionPagingBudget, z as HttpDataSourceOptions, zt as TodoItem } from "./index-DQwGvHAI.js";
|
|
3
|
+
export { type ActionFrameScope, type ConsentUi, DEFAULT_MAX_DATA_SOURCE_BYTES, DELEGATE_TASK_TOOL, DELEGATION_SYSTEM_PROMPT, type DataSourceAuditSink, type DataSourceCandidate, type DataSourceCandidateAuditSink, DataSourceCandidatePolicy, type DataSourceCandidatePolicyOptions, type DataSourceCandidateRecord, type DataSourceCandidateStore, type DataSourceDef, type DataSourceKind, DataSourcePolicy, type DataSourcePolicyOptions, type DataSourceProvenance, type DataSourceRecord, type DataSourceTransport, type DelegationBudget, DelegationOrchestrator, type DelegationOrchestratorOptions, type DelegationRequest, type DelegationResult, type DelegationToolSourceOptions, type DownloadedFileAction, type DownloadedFileConsent, type DownloadedFileEntry, type DownloadedFileListing, DownloadedFilePolicy, type DownloadedFilePolicyOptions, type DownloadedFileReadResult, type DownloadedFileReader, type DownloadedFileRecord, type DownloadedFileToolSourceOptions, type FrameNote, type FrameScope, GENERATE_SKILL_TOOL, type GeneratedSkillDraft, type HttpDataSourceOptions, type ImageCaptureBudget, LIST_DOWNLOADED_FILES_TOOL, MANAGE_TODO_TOOL, type NestedFrameRef, PAGE_ACTION_KINDS, PAGE_ACTION_SYSTEM_PROMPT, PAGE_ACTION_TOOL, PERCEIVE_PAGE_TOOL, PERCEPTION_PAGING_DEFAULTS, PERCEPTION_SYSTEM_PROMPT, type PageActionConsent, type PageActionExecutor, type PageActionKind, type PageActionOutcome, PageActionPolicy, type PageActionPolicyOptions, type PageActionRecord, type PageActionRequest, type PageActionScope, type PageActionScopeInput, type PageActionTarget, type PageActionToolSourceOptions, type PageActionUi, type PageAuditSink, PagePerceptionPolicy, type PagePerceptionPolicyOptions, type PagePerceptionReader, type PagePerceptionToolSourceOptions, type ParentBudget, type PerceivedImage, type PerceivedNode, type PerceptionAuditSink, type PerceptionCaptureOptions, type PerceptionPagingBudget, type PerceptionRecord, type PerceptionResult, type PerceptionScope, type PerceptionScopeInput, READ_DOWNLOADED_FILE_TOOL, SKILL_GENERATION_SYSTEM_PROMPT, type SkillCandidateSink, type SkillGenerationMessages, type SkillGenerationOutcome, type SkillGenerationPolicy, type SkillGenerationToolSourceOptions, SkillGenerator, type SkillGeneratorOptions, type SkillTraceEvidence, type SkillTraceEvidenceStep, type SubAgentRunInput, type SubAgentRunner, TODO_SYSTEM_PROMPT, type TodoEvent, type TodoItem, type TodoList, type TodoListener, type TodoStatus, TodoStore, type TodoToolSourceOptions, createDelegationToolSource, createDownloadedFileToolSource, createHttpDataSourceTransport, createPageActionToolSource, createPagePerceptionToolSource, createSkillGenerationToolSource, createTodoToolSource, frameLabel, frameSteps, toActionFrameScopes, toFrameScopes, withDelegationOrigin };
|
package/dist/agent.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as DEFAULT_MAX_DATA_SOURCE_BYTES } from "./dist-
|
|
2
|
-
import { C as
|
|
1
|
+
import { f as DEFAULT_MAX_DATA_SOURCE_BYTES } from "./dist-Bfga1TmS.js";
|
|
2
|
+
import { A as frameLabel, C as createDelegationToolSource, D as createPagePerceptionToolSource, E as createPageActionToolSource, M as toActionFrameScopes, N as toFrameScopes, O as createSkillGenerationToolSource, P as withDelegationOrigin, S as TodoStore, T as createHttpDataSourceTransport, _ as PagePerceptionPolicy, a as DelegationOrchestrator, b as SkillGenerator, c as LIST_DOWNLOADED_FILES_TOOL, d as PAGE_ACTION_SYSTEM_PROMPT, f as PAGE_ACTION_TOOL, g as PageActionPolicy, h as PERCEPTION_SYSTEM_PROMPT, i as DataSourcePolicy, j as frameSteps, k as createTodoToolSource, l as MANAGE_TODO_TOOL, m as PERCEPTION_PAGING_DEFAULTS, n as DELEGATION_SYSTEM_PROMPT, o as DownloadedFilePolicy, p as PERCEIVE_PAGE_TOOL, r as DataSourceCandidatePolicy, s as GENERATE_SKILL_TOOL, t as DELEGATE_TASK_TOOL, u as PAGE_ACTION_KINDS, v as READ_DOWNLOADED_FILE_TOOL, w as createDownloadedFileToolSource, x as TODO_SYSTEM_PROMPT, y as SKILL_GENERATION_SYSTEM_PROMPT } from "./dist-BnqAkSS6.js";
|
|
3
3
|
|
|
4
|
-
export { DEFAULT_MAX_DATA_SOURCE_BYTES, DELEGATE_TASK_TOOL, DELEGATION_SYSTEM_PROMPT, DataSourcePolicy, DelegationOrchestrator, GENERATE_SKILL_TOOL, MANAGE_TODO_TOOL, PAGE_ACTION_KINDS, PAGE_ACTION_SYSTEM_PROMPT, PAGE_ACTION_TOOL, PERCEIVE_PAGE_TOOL, PERCEPTION_SYSTEM_PROMPT, PageActionPolicy, PagePerceptionPolicy, SKILL_GENERATION_SYSTEM_PROMPT, SkillGenerator, TODO_SYSTEM_PROMPT, TodoStore, createDelegationToolSource, createHttpDataSourceTransport, createPageActionToolSource, createPagePerceptionToolSource, createSkillGenerationToolSource, createTodoToolSource, toActionFrameScopes, toFrameScopes, withDelegationOrigin };
|
|
4
|
+
export { DEFAULT_MAX_DATA_SOURCE_BYTES, DELEGATE_TASK_TOOL, DELEGATION_SYSTEM_PROMPT, DataSourceCandidatePolicy, DataSourcePolicy, DelegationOrchestrator, DownloadedFilePolicy, GENERATE_SKILL_TOOL, LIST_DOWNLOADED_FILES_TOOL, MANAGE_TODO_TOOL, PAGE_ACTION_KINDS, PAGE_ACTION_SYSTEM_PROMPT, PAGE_ACTION_TOOL, PERCEIVE_PAGE_TOOL, PERCEPTION_PAGING_DEFAULTS, PERCEPTION_SYSTEM_PROMPT, PageActionPolicy, PagePerceptionPolicy, READ_DOWNLOADED_FILE_TOOL, SKILL_GENERATION_SYSTEM_PROMPT, SkillGenerator, TODO_SYSTEM_PROMPT, TodoStore, createDelegationToolSource, createDownloadedFileToolSource, createHttpDataSourceTransport, createPageActionToolSource, createPagePerceptionToolSource, createSkillGenerationToolSource, createTodoToolSource, frameLabel, frameSteps, toActionFrameScopes, toFrameScopes, withDelegationOrigin };
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { At as VerifyResult, Ct as SkillsLockfile, Et as TrustedKeyStore, H as FileStat, N as ArchiveLimits, Ot as UnsignedPolicy, S as UiBridge, U as FileSystemProvider, _t as SkillManifest, b as RenderResultRequest, c as InteractionResponse, jt as WebSkillError, 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-BgeOvc1Y.js";
|
|
2
|
+
import { F as ExternalSkillProvider, Ht as ScriptExecutionContext, I as ExternalToolSource, Ln as WebSkillApi, S as BridgeResponse, Un as bridgeError, Ut as ScriptExecutor, at as NetworkPolicy, fn as ToolDefinition, hn as ToolResult, m as ApprovalScope, pr as parseBridgeRequest, rt as LinkedDocumentReader, x as BridgeRequest, y as BridgeCapabilities } from "./index-CWoKOFBP.js";
|
|
3
|
+
import { $ as PageActionOutcome, Ct as PerceptionScopeInput, Z as PageActionExecutor, at as PageActionScopeInput, ft as PagePerceptionReader, gt as PerceivedNode, ot as PageActionTarget, rt as PageActionRequest, ut as PagePerceptionPolicy, vt as PerceptionCaptureOptions, xt as PerceptionResult } from "./index-DQwGvHAI.js";
|
|
4
4
|
//#region ../browser/dist/index.d.ts
|
|
5
5
|
//#region src/fs/featureDetection.d.ts
|
|
6
6
|
/** 检测当前环境是否可用 OPFS(navigator.storage.getDirectory) */
|
|
@@ -204,7 +204,10 @@ declare class BrowserWorkerScriptExecutor implements ScriptExecutor {
|
|
|
204
204
|
*/
|
|
205
205
|
declare class IframeWorkerLike implements WorkerLike {
|
|
206
206
|
#private;
|
|
207
|
-
constructor(iframe: HTMLIFrameElement, hostWindow: Window, channelId: string
|
|
207
|
+
constructor(iframe: HTMLIFrameElement, hostWindow: Window, channelId: string, readyTimeout?: {
|
|
208
|
+
readonly ms: number;
|
|
209
|
+
readonly documentUrl: string;
|
|
210
|
+
});
|
|
208
211
|
get ready(): boolean;
|
|
209
212
|
get channelId(): string;
|
|
210
213
|
markReady(): void;
|
|
@@ -216,10 +219,43 @@ declare class IframeWorkerLike implements WorkerLike {
|
|
|
216
219
|
terminate(): void;
|
|
217
220
|
}
|
|
218
221
|
/**
|
|
219
|
-
*
|
|
222
|
+
* 静态沙箱页的中继脚本源码(分册 12 / FR-12.3)。
|
|
223
|
+
*
|
|
224
|
+
* 宿主把它落成一个独立文件并用 `<script src>` 引入——**不得内联**:
|
|
225
|
+
* sandbox 页虽允许 `unsafe-inline`,但外链能让「沙箱页脚本 = SDK 原样产物」在审计时可核对。
|
|
226
|
+
*
|
|
227
|
+
* 与 srcdoc 形态的两点区别,都源于「静态页在加载完时还不知道要跑什么」:
|
|
228
|
+
* - **引导源码**随宿主的 `sandbox-init` 消息到达,而不是内嵌在文档里;
|
|
229
|
+
* - **channelId** 由第一条来自 `parent` 的消息 latch。SDK 导出的是一份与宿主无关的源码,
|
|
230
|
+
* 不可能预知宿主这次生成的 id。latch 前先认 `event.source === parent`:少了这句,
|
|
231
|
+
* 任何把本页嵌进去的第三方 frame 都能抢先 latch 一个自己的 id,
|
|
232
|
+
* 让真正的宿主消息全部被丢弃——一个纯粹的拒绝服务面。
|
|
233
|
+
*
|
|
234
|
+
* 本源码不含任何扩展 API:sandbox 页拿不到它们(实证)。
|
|
235
|
+
* `ENVELOPE` 与宿主侧同源(同一个模块常量),两边各写一份字面量会在改名时静默失配。
|
|
236
|
+
* @experimental
|
|
237
|
+
*/
|
|
238
|
+
declare const SANDBOX_PAGE_SCRIPT_SOURCE: string;
|
|
239
|
+
/**
|
|
240
|
+
* 静态沙箱文档形态的选项(分册 12 / FR-12.1)。
|
|
241
|
+
*
|
|
242
|
+
* MV3 下 srcdoc 继承父页 `extension_pages` CSP,内联脚本必被拒,
|
|
243
|
+
* 因此扩展宿主必须指定一个自带 sandbox CSP 的静态页。
|
|
244
|
+
* @experimental
|
|
245
|
+
*/
|
|
246
|
+
interface IframeSandboxOptions {
|
|
247
|
+
/** 沙箱文档地址(扩展宿主传扩展内 URL);不给即沿用 srcdoc */
|
|
248
|
+
documentUrl?: string;
|
|
249
|
+
/** 承载 iframe 的文档,缺省为全局 `document` */
|
|
250
|
+
doc?: Document;
|
|
251
|
+
/** 等 `sandbox-ready` 的上限,缺省 10000。仅 `documentUrl` 形态有效 */
|
|
252
|
+
readyTimeoutMs?: number;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* 创建 opaque iframe 沙箱 Worker:srcdoc(默认)或宿主指定的静态沙箱页承载 classic Worker。
|
|
220
256
|
* 返回 IframeWorkerLike(协议与 blob Worker 完全一致:load/execute/bridge/network-blocked)。
|
|
221
257
|
*/
|
|
222
|
-
declare function createIframeWorker(bootstrapSource: string,
|
|
258
|
+
declare function createIframeWorker(bootstrapSource: string, options?: Document | IframeSandboxOptions): IframeWorkerLike;
|
|
223
259
|
//#endregion
|
|
224
260
|
//#region src/navigator.d.ts
|
|
225
261
|
declare global {
|
|
@@ -366,6 +402,21 @@ interface CompressResult {
|
|
|
366
402
|
*/
|
|
367
403
|
declare function compressImageToBudget(file: Blob, maxBytes: number): Promise<CompressResult>;
|
|
368
404
|
//#endregion
|
|
405
|
+
//#region src/dom/promotion.d.ts
|
|
406
|
+
/**
|
|
407
|
+
* 非标可交互元素的识别与角色提升(0.14.0 分册 15)。
|
|
408
|
+
*
|
|
409
|
+
* 现代前端用 `div` / `span` 做按钮是常态,它们在无障碍树里全落到 `generic`,
|
|
410
|
+
* 于是拿不到句柄——模型读得到那几个字,却点不动。本模块补的就是这一段判定。
|
|
411
|
+
*
|
|
412
|
+
* 整套逻辑默认关闭,由 `createDomPerceptionReader` 的 `promoteRoles` 开启(D-15-1)。
|
|
413
|
+
*/
|
|
414
|
+
/** 宿主声明的角色逃生舱:四种通用信号都不带的元素,由宿主点名(FR-15.6) */
|
|
415
|
+
interface RoleHint {
|
|
416
|
+
role: string;
|
|
417
|
+
selectors: readonly string[];
|
|
418
|
+
}
|
|
419
|
+
//#endregion
|
|
369
420
|
//#region src/dom/perception.d.ts
|
|
370
421
|
interface DomPerceptionReaderOptions {
|
|
371
422
|
/** 选择器求值的根;缺省 `globalThis.document` */
|
|
@@ -375,6 +426,31 @@ interface DomPerceptionReaderOptions {
|
|
|
375
426
|
* 它与感知范围分开声明:可读不等于可操作(FR-23.1)。
|
|
376
427
|
*/
|
|
377
428
|
actionScope?: PageActionScopeInput;
|
|
429
|
+
/**
|
|
430
|
+
* 非标可交互元素的角色提升(分册 15)。缺省 `false`,行为与 0.13.0 逐字相同(D-15-1)。
|
|
431
|
+
*
|
|
432
|
+
* 它改的是「同一个 `include` 命中的元素判成什么角色」,**不是**「读哪些元素」:
|
|
433
|
+
* 范围外的元素不会因为提升而进快照。
|
|
434
|
+
*/
|
|
435
|
+
promoteRoles?: boolean;
|
|
436
|
+
/**
|
|
437
|
+
* 宿主注入的行为事实:该元素是否挂过 click 类监听器(FR-15.1 信号 0)。
|
|
438
|
+
* 探针要改页面的 `EventTarget.prototype`,那是扩展的活;SDK 只认这个钩子(D-15-5)。
|
|
439
|
+
*/
|
|
440
|
+
interactiveHint?: (element: Element) => boolean;
|
|
441
|
+
/**
|
|
442
|
+
* 逃生舱:四种通用信号都不带的元素,由宿主显式声明其角色(FR-15.6)。
|
|
443
|
+
* 性质与范围白名单相同——改它就是改模型的可操作面,只能在装配期声明。
|
|
444
|
+
*/
|
|
445
|
+
roleHints?: readonly RoleHint[];
|
|
446
|
+
/**
|
|
447
|
+
* 嵌套帧自动下钻(分册 16)。缺省 `false`,行为与 0.13.0 逐字相同(D-16-2)。
|
|
448
|
+
*
|
|
449
|
+
* 开启后,范围内**未授权**的嵌套帧不再只给一句「没读」:有 http(s) 地址的进
|
|
450
|
+
* `PerceptionResult.nestedFrames` 交给外壳继续投递,无地址的同源帧就地内联。
|
|
451
|
+
* 0.13.0 D-18-3 的「不自动下钻」已被 0.14.0 分册 16 §0.1 推翻。
|
|
452
|
+
*/
|
|
453
|
+
discoverNestedFrames?: boolean;
|
|
378
454
|
}
|
|
379
455
|
/** DOM 遍历是同步的;不取像时比 `PagePerceptionReader` 窄,调用方无需 await @experimental */
|
|
380
456
|
interface DomPerceptionReader extends PagePerceptionReader {
|
|
@@ -431,6 +507,148 @@ type DomPageActionExecutor = PageActionExecutor;
|
|
|
431
507
|
/** @experimental */
|
|
432
508
|
declare function createDomPageActionExecutor(options: DomPageActionOptions): DomPageActionExecutor;
|
|
433
509
|
//#endregion
|
|
510
|
+
//#region src/remote/types.d.ts
|
|
511
|
+
/**
|
|
512
|
+
* 跨上下文页面代理的传输端口(分册 13 / FR-13.1)。
|
|
513
|
+
*
|
|
514
|
+
* SDK 不关心底下是扩展消息、`MessagePort` 还是 WebSocket;
|
|
515
|
+
* 只要求一次请求对应一次应答,且请求 / 应答都能被 structured clone 搬运。
|
|
516
|
+
* @experimental
|
|
517
|
+
*/
|
|
518
|
+
interface PageAgentTransport {
|
|
519
|
+
send(request: PageAgentRequest): Promise<PageAgentReply>;
|
|
520
|
+
}
|
|
521
|
+
/** @experimental */
|
|
522
|
+
type PageAgentRequest = {
|
|
523
|
+
type: 'perceive';
|
|
524
|
+
scope: PerceptionScopeInput;
|
|
525
|
+
capture?: PerceptionCaptureOptions;
|
|
526
|
+
} | {
|
|
527
|
+
type: 'execute';
|
|
528
|
+
request: PageActionRequest;
|
|
529
|
+
};
|
|
530
|
+
/**
|
|
531
|
+
* 应答。失败走 `error` 变体而**不是**让 `send()` reject:
|
|
532
|
+
* structured clone 不保留原型,跨上下文的 reject 到本地就是一个没有错误码的 `Error`。
|
|
533
|
+
* 显式回码,本地再重建 `WebSkillError`,错误码才能穿过边界。
|
|
534
|
+
* @experimental
|
|
535
|
+
*/
|
|
536
|
+
type PageAgentReply = {
|
|
537
|
+
type: 'perceive-result';
|
|
538
|
+
result: PerceptionResult;
|
|
539
|
+
targets: readonly PageAgentTargetEntry[];
|
|
540
|
+
} | {
|
|
541
|
+
type: 'execute-result';
|
|
542
|
+
outcome: PageActionOutcome;
|
|
543
|
+
} | {
|
|
544
|
+
type: 'error';
|
|
545
|
+
code: string;
|
|
546
|
+
message: string;
|
|
547
|
+
};
|
|
548
|
+
/**
|
|
549
|
+
* 感知期随结果一并回传的句柄描述表(D-13-3);**不进模型上下文**。
|
|
550
|
+
*
|
|
551
|
+
* 不塞进 `PerceivedNode`:那会改 `@webskill/agent` 的公开契约,
|
|
552
|
+
* 且这些字段对本地形态毫无意义(本地执行器直接读 DOM)。
|
|
553
|
+
* @experimental
|
|
554
|
+
*/
|
|
555
|
+
interface PageAgentTargetEntry {
|
|
556
|
+
ref: string;
|
|
557
|
+
role: string;
|
|
558
|
+
name?: string;
|
|
559
|
+
secret?: boolean;
|
|
560
|
+
frame?: string;
|
|
561
|
+
elevated?: boolean;
|
|
562
|
+
}
|
|
563
|
+
//#endregion
|
|
564
|
+
//#region src/remote/registry.d.ts
|
|
565
|
+
/**
|
|
566
|
+
* 感知期写入、执行期读取的句柄描述表(分册 13 / FR-13.3)。
|
|
567
|
+
*
|
|
568
|
+
* 由**宿主创建并同时交给 reader 和 executor**——两者共享同一个实例是本册的装配前提。
|
|
569
|
+
* 工厂单独导出就是为了让这件事在宿主代码里显式可见,
|
|
570
|
+
* 而不是藏在某个工厂内部让人以为「自己会连上」。
|
|
571
|
+
* @experimental
|
|
572
|
+
*/
|
|
573
|
+
interface RemoteTargetRegistry {
|
|
574
|
+
/** 用新一批条目**整体替换**旧表 */
|
|
575
|
+
replace(entries: readonly PageAgentTargetEntry[]): void;
|
|
576
|
+
get(ref: string): PageActionTarget | undefined;
|
|
577
|
+
readonly size: number;
|
|
578
|
+
}
|
|
579
|
+
/** @experimental */
|
|
580
|
+
declare function createRemoteTargetRegistry(): RemoteTargetRegistry;
|
|
581
|
+
//#endregion
|
|
582
|
+
//#region src/remote/reader.d.ts
|
|
583
|
+
/** @experimental */
|
|
584
|
+
interface RemotePerceptionReaderOptions {
|
|
585
|
+
transport: PageAgentTransport;
|
|
586
|
+
/** 与执行器共享的句柄表;两者必须传同一个实例 */
|
|
587
|
+
targets: RemoteTargetRegistry;
|
|
588
|
+
/** 单次感知超时毫秒;缺省 10000 */
|
|
589
|
+
timeoutMs?: number;
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* 跨上下文的页面感知(分册 13 / FR-13.2)。
|
|
593
|
+
*
|
|
594
|
+
* 把句柄描述表写进 registry,**只把 `result` 返回给调用方**——
|
|
595
|
+
* 返回值就是标准 `PerceptionResult`,不夹带任何新字段(AC-13.2)。
|
|
596
|
+
* @experimental
|
|
597
|
+
*/
|
|
598
|
+
declare function createRemotePerceptionReader(options: RemotePerceptionReaderOptions): PagePerceptionReader;
|
|
599
|
+
//#endregion
|
|
600
|
+
//#region src/remote/executor.d.ts
|
|
601
|
+
/** @experimental */
|
|
602
|
+
interface RemotePageActionExecutorOptions {
|
|
603
|
+
transport: PageAgentTransport;
|
|
604
|
+
/** 与 reader 共享的句柄表;两者必须传同一个实例 */
|
|
605
|
+
targets: RemoteTargetRegistry;
|
|
606
|
+
/** 单次执行超时毫秒;缺省 10000 */
|
|
607
|
+
timeoutMs?: number;
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* 跨上下文的页面操作执行器(分册 13 / FR-13.3)。
|
|
611
|
+
* @experimental
|
|
612
|
+
*/
|
|
613
|
+
declare function createRemotePageActionExecutor(options: RemotePageActionExecutorOptions): PageActionExecutor;
|
|
614
|
+
//#endregion
|
|
615
|
+
//#region src/remote/handler.d.ts
|
|
616
|
+
/** @experimental */
|
|
617
|
+
interface PageAgentHandlerOptions {
|
|
618
|
+
/**
|
|
619
|
+
* 可操作范围。**由页面侧声明**,不接受请求方传入——
|
|
620
|
+
* 从请求里读它等于让 agent 自行声明自己能操作什么,是权限提升。
|
|
621
|
+
*/
|
|
622
|
+
actionScope?: PageActionScopeInput;
|
|
623
|
+
document?: Document;
|
|
624
|
+
/** `attach` 的文件来源;必须由用户手势触发。不注入即 `attach` 一律按「用户取消」处理 */
|
|
625
|
+
pickFiles?: () => Promise<readonly File[] | undefined>;
|
|
626
|
+
/** 非标可交互元素的角色提升(分册 15);缺省关闭 */
|
|
627
|
+
promoteRoles?: boolean;
|
|
628
|
+
/** 宿主注入的 click 监听器事实(FR-15.1 信号 0) */
|
|
629
|
+
interactiveHint?: (element: Element) => boolean;
|
|
630
|
+
/** 宿主声明的角色逃生舱(FR-15.6) */
|
|
631
|
+
roleHints?: readonly RoleHint[];
|
|
632
|
+
/** 嵌套帧自动发现(分册 16);缺省关闭 */
|
|
633
|
+
discoverNestedFrames?: boolean;
|
|
634
|
+
}
|
|
635
|
+
/** @experimental */
|
|
636
|
+
interface PageAgentHandler {
|
|
637
|
+
handle(request: PageAgentRequest): Promise<PageAgentReply>;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* 页面侧处理器(分册 13 / FR-13.7)。
|
|
641
|
+
*
|
|
642
|
+
* 必须是工厂而不是裸函数:`DomPerceptionReader` **是有状态的**——
|
|
643
|
+
* `resolve(ref)` 依赖上一次感知发出的句柄表,模态提升状态也跨调用累积。
|
|
644
|
+
* 每次请求新建 reader,`execute` 就永远 resolve 不到 `perceive` 发出的 ref。
|
|
645
|
+
*
|
|
646
|
+
* 它**不自己收发消息**:只做「请求进、应答出」。监听消息通道、判断消息是不是给自己的、
|
|
647
|
+
* 回不回 `true`——那些全是宿主的事,本包不得出现任何扩展 API。
|
|
648
|
+
* @experimental
|
|
649
|
+
*/
|
|
650
|
+
declare function createPageAgentHandler(options?: PageAgentHandlerOptions): PageAgentHandler;
|
|
651
|
+
//#endregion
|
|
434
652
|
//#region src/dom/imageCapture.d.ts
|
|
435
653
|
/**
|
|
436
654
|
* 取像级别(0.6.0 FR-12.1)。裁决 D-3 已取消 L3 栅格化,只剩两级。
|
|
@@ -465,8 +683,7 @@ declare function isCapturableElement(element: Element): boolean;
|
|
|
465
683
|
* 按元素类型分派,不做无意义的尝试:`<img>` 只走 L1,`<canvas>` / `<svg>` 只走 L2,
|
|
466
684
|
* 两者互不兜底。失败返回 `CaptureFailure` 而不是抛错——一张图抓不到不该让整次感知失败。
|
|
467
685
|
* @experimental
|
|
468
|
-
*/
|
|
469
|
-
declare function captureElementImage(element: Element, options: {
|
|
686
|
+
*/ declare function captureElementImage(element: Element, options: {
|
|
470
687
|
id: string;
|
|
471
688
|
maxBytes: number;
|
|
472
689
|
}): Promise<CapturedImage | CaptureFailure>;
|
|
@@ -860,6 +1077,30 @@ declare const DOCX_UNEXTRACTED: readonly ["styles", "heading levels", "images",
|
|
|
860
1077
|
*/
|
|
861
1078
|
declare function extractDocxText(bytes: Uint8Array): Promise<string>;
|
|
862
1079
|
//#endregion
|
|
1080
|
+
//#region src/document/xlsx.d.ts
|
|
1081
|
+
/**
|
|
1082
|
+
* xlsx 文本抽取(0.13.0 分册 12)。
|
|
1083
|
+
*
|
|
1084
|
+
* **零新增依赖**:xlsx 和 docx 是同一种容器(OPC = zip + XML),
|
|
1085
|
+
* 所以沿用 docx 那条路 —— zip 走仓内既有的 `unzipWithLimits`(fflate,
|
|
1086
|
+
* 自带解压体积上限,顺带挡住 zip 炸弹),XML 走浏览器原生 `DOMParser`。
|
|
1087
|
+
*
|
|
1088
|
+
* ⚠️ `DOMParser` 是浏览器 API,Node 没有 —— 所以这个模块只在 `@webskill/browser`。
|
|
1089
|
+
* Node 宿主没有 xlsx 能力,与 docx 同一条**显式声明**的限制,不是静默降级(备案 D55)。
|
|
1090
|
+
*/
|
|
1091
|
+
/**
|
|
1092
|
+
* **不抽取**的内容,逐条写明而不是笼统说「尽力而为」(FR-12.4)。
|
|
1093
|
+
*
|
|
1094
|
+
* 公式只取 Excel 自己写进文件的缓存值:零依赖求值等于自写一个表达式引擎。
|
|
1095
|
+
*/
|
|
1096
|
+
declare const XLSX_UNEXTRACTED: readonly ["styles", "conditional formatting", "merged cell reconstruction", "charts", "images", "comments", "pivot tables", "macros", "hidden row and column marking", "formula expressions (only cached values are read)"];
|
|
1097
|
+
/**
|
|
1098
|
+
* 从 xlsx 字节里抽出文本,每个工作表一段、段首是表名。
|
|
1099
|
+
*
|
|
1100
|
+
* @throws WebSkillError 归档损坏、旧版 `.xls`、缺 `xl/workbook.xml`、工作表关系解不开、XML 解析失败
|
|
1101
|
+
*/
|
|
1102
|
+
declare function extractXlsxText(bytes: Uint8Array): Promise<string>;
|
|
1103
|
+
//#endregion
|
|
863
1104
|
//#region src/viewer/viewerCsp.d.ts
|
|
864
1105
|
/** 宿主可配置的白名单方向;技能声明不了这些(FR-18.3 第 3 条) */
|
|
865
1106
|
interface ViewerCspOptions {
|
|
@@ -1039,4 +1280,4 @@ declare function watchBlockedResources(host: ViewerBlockedHost, notice: ViewerBl
|
|
|
1039
1280
|
/** 提示文案的单一来源;判据直接引用,不各写一份字面量 */
|
|
1040
1281
|
declare function blockedMessage(origins: readonly string[]): string;
|
|
1041
1282
|
//#endregion
|
|
1042
|
-
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, IframeWorkerLike, type InspectHostWiringInput, type LlmClientConfig, type LlmEntryConfig, type MainToWorkerMessage, type OpenDocumentInput, OpfsProvider, type PortApplicability, type PortReport, type PortSpec, type PortStatus, 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, blockedMessage, bridgeError, captureElementImage, checkDictationAvailability, compressImageToBudget, createBrowserChatbotHost, createDomPageActionExecutor, createDomPerceptionReader, createEncryptedMemoryStore, createFetchLinkedDocumentReader, createIframeWorker, createLlmClient, deleteMemoryEncryptionKey, extractDocxText, extractZipWeb, generateMemoryEncryptionKey, inspectHostWiring, installWebSkillNavigator, isCapturableElement, isCaptureFailure, isEncryptedMemoryValue, isOpfsAvailable, missingPorts, openDocumentSurface, openMemoryEncryptionKey, parseBridgeRequest, parseMainMessage, parseWorkerEvent, probeChromeBuiltinAvailability, sha256HexWeb, startDictation, startViewerShell, startWorkerRuntimeHost, viewerCspHeader, watchBlockedResources };
|
|
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 };
|