@webskill/sdk 0.13.0 → 0.15.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 +2442 -3
- package/dist/{dist-ExSQky4C.js → approval-BnLLCOG0.js} +277 -2934
- package/dist/browser.d.ts +327 -8
- package/dist/browser.js +1017 -51
- package/dist/{openUiLibrary-BKXW7Iwx-CWWBVOkE.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-Y07N8IAC.js} +14 -2
- package/dist/external-_ZRQe-V9.js +53 -0
- package/dist/governance.d.ts +15 -3
- package/dist/governance.js +86 -4
- package/dist/{index-iBm9tJL_.d.ts → index-CQYo4tcT.d.ts} +469 -10
- package/dist/{index-C3XdItd_.d.ts → index-CU2md8R1.d.ts} +26 -18
- package/dist/{index-DkvBhJQy.d.ts → index-Oc3H89TJ.d.ts} +204 -4
- 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 +56 -3
- package/dist/mcp.js +75 -5
- package/dist/memoryArtifactStore-D6dLeY55.js +48 -0
- package/dist/miniChart-owdCdaw-.js +533 -0
- package/dist/node.d.ts +3 -3
- package/dist/node.js +110 -13
- package/dist/openUiLibrary-CY_ADoe0.js +30 -0
- package/dist/openUiSpecLang-DuOCdw9G.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-Bev6i6Ip.js → skill-CAJMsLod.js} +44 -314
- package/dist/{skillVersionStore-D-qHk9ZE-DheTIwAB.d.ts → skillVersionStore-B24Jjjry-C4zomhMZ.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-DLctJep_-B5G4uk2u.d.ts → types-C3V6lAeO-BIf7UB2e.d.ts} +79 -4
- package/dist/types-TUydnxaj.js +78 -0
- package/dist/ui-react.d.ts +12 -5
- package/dist/ui-react.js +128548 -4729
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui-vue.js +11 -2
- 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-C9lrvvMr.js → webskillLitCatalog-DSqVFQjK.js} +11 -3
- package/package.json +1 -1
- package/dist/catalogComponents-BgAJN0p8-CYEXSk45.js +0 -124384
- package/dist/client-BCM6Z3yq-qUQNkKrK.js +0 -7787
- package/dist/dist-DqcL6jKO.js +0 -3509
- package/dist/dist-DxyxmXPU-DGC-dpXf.js +0 -5621
- package/dist/dist-GK6dtjRv.js +0 -1493
- package/dist/memoryArtifactStore-52Zn9npI-LbCQaqyx.js +0 -86
- package/dist/stdio-CFMoANJJ-BxrTeXh7.js +0 -31
- package/dist/testing-WPTyXQYt.js +0 -142
- package/dist/types-WovEf4ED-CZSDiiBU.js +0 -6215
package/dist/testing.js
CHANGED
|
@@ -1,5 +1,66 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
1
|
+
import { t as MockLlmClient } from "./llm-B7lLH0ZI.js";
|
|
2
|
+
import { t as MemoryArtifactStore } from "./memoryArtifactStore-D6dLeY55.js";
|
|
3
|
+
import { n as loadGoogleConfigFromEnv, r as loadLlmConfigFromEnv, t as loadAnthropicConfigFromEnv } from "./env-Bj1MI2Ww.js";
|
|
4
4
|
|
|
5
|
+
//#region ../runtime/src/interaction/mockUiBridge.ts
|
|
6
|
+
/**
|
|
7
|
+
* 测试用 UiBridge:按请求 id 或类型预设应答(永不 resolve 的 handler 可模拟超时);
|
|
8
|
+
* 记录全部请求供断言。
|
|
9
|
+
*/
|
|
10
|
+
var MockUiBridge = class {
|
|
11
|
+
requests = [];
|
|
12
|
+
#answers = /* @__PURE__ */ new Map();
|
|
13
|
+
#fallback;
|
|
14
|
+
/** key 为请求 id 或请求类型('ask' | 'confirm' | 'form' | 'select') */
|
|
15
|
+
respondTo(key, answer) {
|
|
16
|
+
this.#answers.set(key, answer);
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
setFallback(answer) {
|
|
20
|
+
this.#fallback = answer;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
async request(input) {
|
|
24
|
+
this.requests.push(input);
|
|
25
|
+
const answer = this.#answers.get(input.id) ?? this.#answers.get(input.type) ?? this.#fallback;
|
|
26
|
+
if (!answer) return {
|
|
27
|
+
id: input.id,
|
|
28
|
+
cancelled: true
|
|
29
|
+
};
|
|
30
|
+
return typeof answer === "function" ? answer(input) : answer;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region ../runtime/src/memory/inMemoryStore.ts
|
|
36
|
+
/** 内存 MemoryStore:测试与浏览器降级用 */
|
|
37
|
+
var InMemoryStore = class {
|
|
38
|
+
#data = /* @__PURE__ */ new Map();
|
|
39
|
+
async get(scope, key) {
|
|
40
|
+
return this.#data.get(scope)?.get(key);
|
|
41
|
+
}
|
|
42
|
+
async set(scope, key, value) {
|
|
43
|
+
let bucket = this.#data.get(scope);
|
|
44
|
+
if (!bucket) {
|
|
45
|
+
bucket = /* @__PURE__ */ new Map();
|
|
46
|
+
this.#data.set(scope, bucket);
|
|
47
|
+
}
|
|
48
|
+
bucket.set(key, value);
|
|
49
|
+
}
|
|
50
|
+
async delete(scope, key) {
|
|
51
|
+
this.#data.get(scope)?.delete(key);
|
|
52
|
+
}
|
|
53
|
+
async list(scope) {
|
|
54
|
+
return [...(this.#data.get(scope) ?? /* @__PURE__ */ new Map()).entries()].map(([key, value]) => ({
|
|
55
|
+
key,
|
|
56
|
+
value
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
async clear(scope) {
|
|
60
|
+
if (scope === void 0) this.#data.clear();
|
|
61
|
+
else this.#data.delete(scope);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
5
66
|
export { InMemoryStore, MemoryArtifactStore, MockLlmClient, MockUiBridge, loadAnthropicConfigFromEnv, loadGoogleConfigFromEnv, loadLlmConfigFromEnv };
|
|
@@ -10,7 +10,15 @@ type WebSkillErrorCode = 'FS_NOT_FOUND' | 'FS_PATH_OUTSIDE_ROOT' | 'SKILL_NOT_FO
|
|
|
10
10
|
/** 脚本取了宿主未声明的数据源;拒绝发生在发出任何请求之前(0.11.0 分册 16) */
|
|
11
11
|
'DATA_SOURCE_NOT_FOUND' |
|
|
12
12
|
/** 取数结果超预算。与 ATTACHMENT_TOO_LARGE 同口径:拒绝而不截断 */
|
|
13
|
-
'DATA_SOURCE_TOO_LARGE'
|
|
13
|
+
'DATA_SOURCE_TOO_LARGE' |
|
|
14
|
+
/** 宿主环境缺少读取下载目录的前置条件(0.14.0 分册 20 FR-20.6) */
|
|
15
|
+
'DOWNLOADS_UNAVAILABLE' |
|
|
16
|
+
/** 脚本要读的上传文件不在本轮触发消息里(0.15.0 分册 17) */
|
|
17
|
+
'UPLOAD_FILE_NOT_FOUND' |
|
|
18
|
+
/** 上传文件超预算。与 DATA_SOURCE_TOO_LARGE 同口径:拒绝而不截断 */
|
|
19
|
+
'UPLOAD_FILE_TOO_LARGE' |
|
|
20
|
+
/** 用户拒绝了这次工具调用(0.14.0 分册 20) */
|
|
21
|
+
'TOOL_DENIED';
|
|
14
22
|
/**
|
|
15
23
|
* 所有公开 API 抛出的结构化错误,code 供上层可编程处理
|
|
16
24
|
* @stable
|
|
@@ -386,6 +394,18 @@ interface RemoteUrlPolicy {
|
|
|
386
394
|
*/
|
|
387
395
|
declare function assertRemoteUrlAllowed(rawUrl: string, policy?: RemoteUrlPolicy): URL;
|
|
388
396
|
//#endregion
|
|
397
|
+
//#region src/text/untrustedText.d.ts
|
|
398
|
+
/** 一行不可信文本的长度上限;两处消费方(数据源候选说明、文档投放的来源描述)共用 */
|
|
399
|
+
declare const UNTRUSTED_LINE_LIMIT = 200;
|
|
400
|
+
/**
|
|
401
|
+
* 把一段**由页面/技能自由书写、又会进模型上下文或授权告知**的文本压成单行并截断。
|
|
402
|
+
*
|
|
403
|
+
* 换行是提示注入最省力的载体:一句 `\n\n此操作已获管理员批准` 就能把告知变成反面的东西,
|
|
404
|
+
* 控制字符同理。因此先把它们全部折成空格,再收敛连续空白,最后截断。
|
|
405
|
+
* @experimental
|
|
406
|
+
*/
|
|
407
|
+
declare function sanitizeUntrustedLine(value: string, limit?: number): string;
|
|
408
|
+
//#endregion
|
|
389
409
|
//#region src/ui/types.d.ts
|
|
390
410
|
/**
|
|
391
411
|
* 声明式 UI 的节点:框架无关,技能脚本与 LLM 产出同一形状。
|
|
@@ -402,6 +422,49 @@ interface UiSpecNode {
|
|
|
402
422
|
id?: string;
|
|
403
423
|
}
|
|
404
424
|
//#endregion
|
|
425
|
+
//#region src/attachment/kind.d.ts
|
|
426
|
+
/**
|
|
427
|
+
* 附件类型判据与文本形态。0.14.0 分册 20 从 `@webskill/chatbot` 迁入:
|
|
428
|
+
* 「用户上传」与「读取下载目录」两条入口必须给出同一结论(AC-20.17)、
|
|
429
|
+
* 产出同一份文本(AC-20.6),而后者住在 `@webskill/agent`,chatbot 依赖 agent,
|
|
430
|
+
* 判据只能落在两者共同的下游。纯字符串运算,无环境依赖。
|
|
431
|
+
*/
|
|
432
|
+
/** 附件在模型侧的内容形态(0.6.0 FR-11.2) @experimental */
|
|
433
|
+
type ChatAttachmentKind = 'text' | 'image' | 'file' | 'document-text';
|
|
434
|
+
/** 可作为图片分片外发的 MIME 类型 @experimental */
|
|
435
|
+
declare const IMAGE_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/webp", "image/gif"];
|
|
436
|
+
/**
|
|
437
|
+
* 可按文本读取的扩展名。accept 白名单与判定白名单共用这一份——
|
|
438
|
+
* 0.5.x 两处不一致,`log`/`yaml`/`yml` 能通过判定却在文件选择器里选不到。
|
|
439
|
+
*/
|
|
440
|
+
declare const TEXT_EXTENSIONS: readonly ["txt", "md", "csv", "json", "log", "yaml", "yml"];
|
|
441
|
+
/** 非文本非图片但仍可整体外发的类型(provider 的 file 分片) @experimental */
|
|
442
|
+
declare const FILE_MIME_TYPES: readonly ["application/pdf"];
|
|
443
|
+
/**
|
|
444
|
+
* 需要**客户端先抽取成文本**才能外发的类型(FR-23.9 / 0.13.0 FR-12.5)。
|
|
445
|
+
* 不走直通的 `file`:docx / xlsx 发给 provider 会被当成二进制垃圾。
|
|
446
|
+
*/
|
|
447
|
+
declare const DOCX_MIME = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
448
|
+
declare const XLSX_MIME = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
449
|
+
/** 文本类附件进模型上下文的字符上限(0.6.0) @experimental */
|
|
450
|
+
declare const ATTACHMENT_TEXT_LIMIT: number;
|
|
451
|
+
/** 分类集中一处,不散落在各 UI 分支里 @experimental */
|
|
452
|
+
declare function classifyAttachment(contentType: string, fileName: string): ChatAttachmentKind | undefined;
|
|
453
|
+
/** `formatAttachmentText` 的入参 @experimental */
|
|
454
|
+
interface AttachmentTextInput {
|
|
455
|
+
name: string;
|
|
456
|
+
contentType: string;
|
|
457
|
+
body: string;
|
|
458
|
+
kind: 'text' | 'document-text';
|
|
459
|
+
/** 缺省即用户当场上传;`'download'` 时标签里额外标出本机下载目录(0.14.0 FR-20.5) */
|
|
460
|
+
origin?: 'upload' | 'download';
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* 文本类附件进模型上下文的最终形态。两条入口共用,差别只有出处那一段(0.14.0 D-20-6)。
|
|
464
|
+
* @experimental
|
|
465
|
+
*/
|
|
466
|
+
declare function formatAttachmentText(input: AttachmentTextInput): string;
|
|
467
|
+
//#endregion
|
|
405
468
|
//#region src/skill/types.d.ts
|
|
406
469
|
type SkillSource = 'local' | 'mcp' | 'generated' | 'installed';
|
|
407
470
|
/**
|
|
@@ -415,6 +478,11 @@ interface SkillMetadata {
|
|
|
415
478
|
version?: string;
|
|
416
479
|
/** 声明式依赖:精确技能名列表(无版本约束);缺依赖/循环依赖 → error 级校验 */
|
|
417
480
|
dependencies?: string[];
|
|
481
|
+
/**
|
|
482
|
+
* 脚本要用的数据源 id(0.14.0 分册 19)。只有 id,不含地址——地址由宿主提供,随宿主变。
|
|
483
|
+
* 存在性只能在运行期判定,因此解析与静态校验都不看这个字段。
|
|
484
|
+
*/
|
|
485
|
+
'data-sources'?: string[];
|
|
418
486
|
[key: string]: unknown;
|
|
419
487
|
}
|
|
420
488
|
interface SkillLocation {
|
|
@@ -637,7 +705,7 @@ declare function escapeXml(text: string): string;
|
|
|
637
705
|
declare function renderAvailableSkillsXml(catalog: SkillCatalog): string;
|
|
638
706
|
declare const xmlRenderer: CatalogRenderer;
|
|
639
707
|
//#endregion
|
|
640
|
-
//#region ../runtime/dist/types-
|
|
708
|
+
//#region ../runtime/dist/types-C3V6lAeO.d.ts
|
|
641
709
|
//#region src/llm/streamTypes.d.ts
|
|
642
710
|
/** 流式 LLM 事件(OpenAI SSE / Vercel fullStream 统一映射) */
|
|
643
711
|
type LlmStreamEvent = {
|
|
@@ -858,7 +926,9 @@ type InteractionRequest = {
|
|
|
858
926
|
*/
|
|
859
927
|
type: 'authorize';
|
|
860
928
|
id: string;
|
|
861
|
-
capability: 'readReference' | 'readAsset' | 'writeArtifact' | 'confirm' | 'fetchData' | 'pageAction' | 'readLinkedDocument'
|
|
929
|
+
capability: 'readReference' | 'readAsset' | 'writeArtifact' | 'confirm' | 'fetchData' | 'pageAction' | 'readLinkedDocument' |
|
|
930
|
+
/** 读取本机下载目录(0.14.0 分册 20) */
|
|
931
|
+
'readDownloadedFile';
|
|
862
932
|
message: string;
|
|
863
933
|
details?: unknown;
|
|
864
934
|
});
|
|
@@ -866,6 +936,11 @@ interface InteractionResponse {
|
|
|
866
936
|
id: string;
|
|
867
937
|
value?: unknown;
|
|
868
938
|
cancelled?: boolean;
|
|
939
|
+
/**
|
|
940
|
+
* 用户在授权卡上勾了「不再询问」(需求 11 / FR-11.2)。
|
|
941
|
+
* 只有 `type: 'authorize'` 的响应会带;不勾即**不带**,而不是带 `false`。
|
|
942
|
+
*/
|
|
943
|
+
remembered?: boolean;
|
|
869
944
|
}
|
|
870
945
|
/**
|
|
871
946
|
* 依据用户画像给出的建议值(FR-19.4)。**不会预填进控件**:
|
|
@@ -1067,4 +1142,4 @@ interface MemoryStore {
|
|
|
1067
1142
|
transaction?<T>(scope: string, fn: (inner: MemoryStore) => Promise<T>): Promise<T>;
|
|
1068
1143
|
}
|
|
1069
1144
|
//#endregion
|
|
1070
|
-
export {
|
|
1145
|
+
export { SKILLS_LOCKFILE as $, messageOf as $t, extractSkillCandidate as A, ValidationReport as At, DiscoveryResult as B, checkDependencyCycles as Bt, UiSpecActionCapability as C, SkillsLockfile as Ct, UiSpecSnapshot as D, UNTRUSTED_LINE_LIMIT as Dt, UiSpecPatch as E, TrustedKeyStore as Et, CatalogRenderer as F, assertRemoteUrlAllowed as Ft, IMAGE_MIME_TYPES as G, detectSkillArchiveShapeFromFs as Gt, FileStat as H, classifyAttachment as Ht, ChatAttachmentKind as I, assertSafePathSegment as It, MemoryFS as J, formatAttachmentText as Jt, JsonSchema as K, escapeXml as Kt, CryptoKeyLike as L, atomicWriteText as Lt, ATTACHMENT_TEXT_LIMIT as M, WebSkillError as Mt, ArchiveLimits as N, WebSkillErrorCode as Nt, UiSurfaceActionRequest as O, UiSpecNode as Ot, AttachmentTextInput as P, XLSX_MIME as Pt, SIGNATURE_SCHEMA_VERSION as Q, keyIdOf as Qt, DEFAULT_ARCHIVE_LIMITS as R, buildCatalog as Rt, UiBridge as S, SkillSource as St, UiSpecEvent as T, TrustedKey as Tt, FileSystemProvider as U, computeDigest as Ut, FILE_MIME_TYPES as V, checkSkillRules as Vt, FsTrustedKeyStore as W, detectSkillArchiveShape as Wt, PageQuery as X, isValidSkillName as Xt, Page as Y, isAtomicTempPath as Yt, RemoteUrlPolicy as Z, jsonRenderer as Zt, LlmToolSpec as _, xmlRenderer as _n, SkillManifest as _t, InteractionOrigin as a, renderAvailableSkillsXml as an, SignatureAuditSink as at, RenderResultRequest as b, SkillReader as bt, InteractionResponse as c, resolveInsideRoot as cn, SkillArchiveShape as ct, LlmContentPart as d, signaturePayloadBytes as dn, SkillDiscovery as dt, normalizePath as en, SKILL_MANIFEST_FILE as et, LlmMessage as f, stripArchiveRoot as fn, SkillDocument as ft, LlmToolCall as g, verifySkillSignature as gn, SkillManagerPort as gt, LlmTokenUsage as h, verifyManifest as hn, SkillLocation as ht, FormField as i, readSkillSignature as in, SKILL_SIGNATURE_FILE as it, ATOMIC_TMP_SUFFIX_PATTERN as j, VerifyResult as jt, UiSurfaceActionResponse as k, UnsignedPolicy as kt, LlmClient as l, sanitizeUntrustedLine as ln, SkillCatalog as lt, LlmStreamEvent as m, validateSkills as mn, SkillIssue as mt, ArtifactStore as n, parseSkillPackManifest as nn, SKILL_NAME_PATTERN as nt, InteractionPolicy as o, renderCatalogJson as on, SignatureVerdict as ot, LlmResponse as p, unzipWithLimits as pn, SkillInstallSource as pt, MANIFEST_EXCLUDED_FILES as q, exportSkills as qt, ChartSpec as r, readResponseWithLimit as rn, SKILL_PACK_FILE as rt, InteractionRequest as s, resolveArchiveLimits as sn, SkillArchiveDetection as st, Artifact as t, parseSkillMarkdown as tn, SKILL_NAME_MAX_LENGTH as tt, LlmCompleteInput as u, signSkill as un, SkillCatalogEntry as ut, MemoryStore as v, SkillMetadata as vt, UiSpecDrafts as w, TEXT_EXTENSIONS as wt, SkillCandidateMarker as x, SkillSignature as xt, RenderBlock as y, SkillPackManifest as yt, DOCX_MIME as z, buildManifest as zt };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//#region ../agent/src/frame.ts
|
|
2
|
+
/**
|
|
3
|
+
* 帧指称的展示形式(分册 18 FR-18.2)。
|
|
4
|
+
*
|
|
5
|
+
* 感知与操作两侧各自声明自己的 scope 类型(那是刻意的,见各自 types.ts),
|
|
6
|
+
* 但「一条帧路径写成给人看的字符串」只能有一份实现——
|
|
7
|
+
* 两处各写一遍,审计里的帧名和确认卡里的帧名就会慢慢对不上。
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* 帧路径的稳定展示串:`'self'` / `'#a'` / `'#a >>> #b'`。
|
|
11
|
+
*
|
|
12
|
+
* `>>>` **只是展示分隔符**:CSS 选择器里可以合法出现任意字符,
|
|
13
|
+
* 反向解析这个串取回路径是不成立的,实现层一律传原始形状(D-18-1)。
|
|
14
|
+
* @experimental
|
|
15
|
+
*/
|
|
16
|
+
function frameLabel(frame) {
|
|
17
|
+
if (typeof frame === "string") return frame;
|
|
18
|
+
if (frame.length === 0) return "self";
|
|
19
|
+
return frame.join(" >>> ");
|
|
20
|
+
}
|
|
21
|
+
/** 把两种形状归一成逐层选择器数组;`'self'` 与空数组都归一成空数组 @experimental */
|
|
22
|
+
function frameSteps(frame) {
|
|
23
|
+
if (typeof frame === "string") return frame === "self" ? [] : [frame];
|
|
24
|
+
return frame;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region ../agent/src/perception/types.ts
|
|
29
|
+
/**
|
|
30
|
+
* 两种形状归一成帧列表;旧形状等价于一条 `frame:'self'`(FR-24.1)。
|
|
31
|
+
*
|
|
32
|
+
* **这是判别的单一来源。** 散在各处写 `'frames' in scope` 会让
|
|
33
|
+
* 「旧配置还等价吗」这个问题没有唯一答案。
|
|
34
|
+
* @experimental
|
|
35
|
+
*/
|
|
36
|
+
function toFrameScopes(scope) {
|
|
37
|
+
if ("frames" in scope) return scope.frames;
|
|
38
|
+
return [{
|
|
39
|
+
frame: "self",
|
|
40
|
+
include: scope.include,
|
|
41
|
+
...scope.exclude ? { exclude: scope.exclude } : {}
|
|
42
|
+
}];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region ../agent/src/pageAction/types.ts
|
|
47
|
+
/**
|
|
48
|
+
* 两种形状归一成帧列表;旧形状等价于一条 `frame:'self'`。
|
|
49
|
+
* 与感知侧的 `toFrameScopes` 一样,是本侧判别的**单一来源**。
|
|
50
|
+
* @experimental
|
|
51
|
+
*/
|
|
52
|
+
function toActionFrameScopes(scope) {
|
|
53
|
+
if ("frames" in scope) return scope.frames;
|
|
54
|
+
return [{
|
|
55
|
+
frame: "self",
|
|
56
|
+
include: scope.include,
|
|
57
|
+
...scope.exclude ? { exclude: scope.exclude } : {}
|
|
58
|
+
}];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* 本版的操作集(FR-25.1)。导航、拖拽、滚动仍不在内。
|
|
62
|
+
*
|
|
63
|
+
* `select`/`set`/`attach` 与既有三个走**同一条** policy 路径,
|
|
64
|
+
* 范围白名单、逐次确认、审计三条硬约束因此天然覆盖到它们——
|
|
65
|
+
* 前提是新动作不绕过 policy 直接调执行器(AC-25.4 守这一点)。
|
|
66
|
+
* @experimental
|
|
67
|
+
*/
|
|
68
|
+
const PAGE_ACTION_KINDS = [
|
|
69
|
+
"click",
|
|
70
|
+
"fill",
|
|
71
|
+
"submit",
|
|
72
|
+
"select",
|
|
73
|
+
"set",
|
|
74
|
+
"attach"
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
export { frameSteps as a, frameLabel as i, toActionFrameScopes as n, toFrameScopes as r, PAGE_ACTION_KINDS as t };
|
package/dist/ui-react.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { C as UiSpecActionCapability, D as UiSpecSnapshot, O as UiSurfaceActionRequest, S as UiBridge, T as UiSpecEvent, b as RenderResultRequest,
|
|
2
|
-
import {
|
|
1
|
+
import { C as UiSpecActionCapability, D as UiSpecSnapshot, O as UiSurfaceActionRequest, Ot as UiSpecNode, S as UiBridge, T as UiSpecEvent, b as RenderResultRequest, c as InteractionResponse, k as UiSurfaceActionResponse, s as InteractionRequest, w as UiSpecDrafts } from "./types-C3V6lAeO-BIf7UB2e.js";
|
|
2
|
+
import { N as DocumentSurfacePort } from "./index-Oc3H89TJ.js";
|
|
3
|
+
import { J as SurfaceHostControlTexts, P as InteractionSpecLabels, q as SurfaceFormTexts, v as ChartFontSizes } from "./index-CU2md8R1.js";
|
|
3
4
|
import { z } from "zod";
|
|
4
5
|
import React$1, { ComponentType, ReactNode } from "react";
|
|
5
6
|
import "react/jsx-runtime";
|
|
@@ -391,6 +392,8 @@ interface UiSurfaceListProps {
|
|
|
391
392
|
runId?: string;
|
|
392
393
|
registry?: SurfaceRegistry;
|
|
393
394
|
onAction?(event: UiSurfaceActionEvent): void;
|
|
395
|
+
/** 文档投放端口(0.15.0 分册 13);缺席时 `OpenDocument` 整个不渲染 */
|
|
396
|
+
documentSurface?: DocumentSurfacePort;
|
|
394
397
|
}
|
|
395
398
|
interface UiSurfaceSnapshotListProps {
|
|
396
399
|
snapshots: readonly UiSpecSnapshot[];
|
|
@@ -402,11 +405,13 @@ interface UiSurfaceSnapshotListProps {
|
|
|
402
405
|
surfaceId: string;
|
|
403
406
|
value: Record<string, unknown>;
|
|
404
407
|
}): void;
|
|
408
|
+
/** 同上 */
|
|
409
|
+
documentSurface?: DocumentSurfacePort;
|
|
405
410
|
}
|
|
406
411
|
/** Renders Native surface snapshots, including persisted assistant-message history. @experimental */
|
|
407
|
-
declare function UiSurfaceSnapshotList({ snapshots, registry, onAction, drafts, onDraftChange }: UiSurfaceSnapshotListProps): import("react").JSX.Element | null;
|
|
412
|
+
declare function UiSurfaceSnapshotList({ snapshots, registry, onAction, drafts, onDraftChange, documentSurface }: UiSurfaceSnapshotListProps): import("react").JSX.Element | null;
|
|
408
413
|
/** Renders the current Native surface snapshots exposed by a React bridge. @experimental */
|
|
409
|
-
declare function UiSurfaceList({ bridge, runId, registry, onAction }: UiSurfaceListProps): import("react").JSX.Element;
|
|
414
|
+
declare function UiSurfaceList({ bridge, runId, registry, onAction, documentSurface }: UiSurfaceListProps): import("react").JSX.Element;
|
|
410
415
|
//#endregion
|
|
411
416
|
//#region src/catalog/NativeSpecSurface.d.ts
|
|
412
417
|
/** native registry 覆盖的组件名;与 catalog 的一致性由测试强制(21 号文档 §5.2) */
|
|
@@ -425,6 +430,8 @@ interface NativeSpecSurfaceProps {
|
|
|
425
430
|
surfaceId: string;
|
|
426
431
|
value: Record<string, unknown>;
|
|
427
432
|
}): void;
|
|
433
|
+
/** 文档投放端口(0.15.0 分册 13);缺席时 `OpenDocument` 整个不渲染 */
|
|
434
|
+
documentSurface?: DocumentSurfacePort;
|
|
428
435
|
/** 宿主已提供卡片外壳时传 `'none'`,避免嵌套两层卡片。缺省 `'card'`。 */
|
|
429
436
|
shell?: 'card' | 'none';
|
|
430
437
|
}
|
|
@@ -435,7 +442,7 @@ interface NativeSpecSurfaceProps {
|
|
|
435
442
|
* 表单行为(草稿跨刷新、必填拦截、默认值)由本组件承接——
|
|
436
443
|
* 节点树取代六类 surface 后,这里是 native 档唯一的渲染实现。
|
|
437
444
|
*/
|
|
438
|
-
declare function NativeSpecSurface({ surfaceId, spec, actions, registry, runId, draft, onAction, onDraftChange, shell }: NativeSpecSurfaceProps): import("react").JSX.Element;
|
|
445
|
+
declare function NativeSpecSurface({ surfaceId, spec, actions, registry, runId, draft, onAction, onDraftChange, documentSurface, shell }: NativeSpecSurfaceProps): import("react").JSX.Element;
|
|
439
446
|
//#endregion
|
|
440
447
|
//#region src/catalog/JsonRenderSpecSurface.d.ts
|
|
441
448
|
interface JsonRenderSpecSurfaceProps {
|