@webskill/sdk 0.14.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-Bfga1TmS.js → approval-BnLLCOG0.js} +235 -2932
- package/dist/browser.d.ts +106 -5
- package/dist/browser.js +364 -10
- 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-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-DQwGvHAI.d.ts → index-CQYo4tcT.d.ts} +85 -6
- package/dist/{index-sd-gVKey.d.ts → index-CU2md8R1.d.ts} +26 -18
- package/dist/{index-CWoKOFBP.d.ts → index-Oc3H89TJ.d.ts} +159 -3
- 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-owdCdaw-.js +533 -0
- package/dist/node.d.ts +3 -3
- package/dist/node.js +106 -9
- 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-D5YhlCdY.js → skill-CAJMsLod.js} +44 -372
- package/dist/{skillVersionStore-D-qHk9ZE-C0OFDTQY.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-C3V6lAeO-BgeOvc1Y.d.ts → types-C3V6lAeO-BIf7UB2e.d.ts} +17 -1
- 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-swXsWoAe.js → webskillLitCatalog-DSqVFQjK.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
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { t as WebSkillError } from "./errors-BDZNpC13.js";
|
|
2
|
+
|
|
3
|
+
//#region ../runtime/src/interaction/surface.ts
|
|
4
|
+
const MAX_SURFACE_BYTES = 256 * 1024;
|
|
5
|
+
const MAX_ACTIONS = 32;
|
|
6
|
+
const MAX_NODES = 2e3;
|
|
7
|
+
const MAX_NODE_DEPTH = 32;
|
|
8
|
+
const MAX_JSON_DEPTH = 16;
|
|
9
|
+
const MAX_PATCH_OPERATIONS = 128;
|
|
10
|
+
const actionIntents = /* @__PURE__ */ new Set([
|
|
11
|
+
"submit",
|
|
12
|
+
"cancel",
|
|
13
|
+
"select",
|
|
14
|
+
"download",
|
|
15
|
+
"refresh"
|
|
16
|
+
]);
|
|
17
|
+
function isRecord(value) {
|
|
18
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
19
|
+
}
|
|
20
|
+
function reject(message) {
|
|
21
|
+
throw new WebSkillError("VALIDATION_FAILED", message);
|
|
22
|
+
}
|
|
23
|
+
function requireString(value, name) {
|
|
24
|
+
if (typeof value !== "string" || value.trim() === "") reject(`${name} must be a non-empty string`);
|
|
25
|
+
}
|
|
26
|
+
function requireNonNegativeInteger(value, name) {
|
|
27
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) reject(`${name} must be a non-negative integer`);
|
|
28
|
+
}
|
|
29
|
+
function isJsonValue(value, depth = 0) {
|
|
30
|
+
if (depth > MAX_JSON_DEPTH || value === void 0 || typeof value === "function" || typeof value === "symbol") return false;
|
|
31
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return true;
|
|
32
|
+
if (typeof value === "number") return Number.isFinite(value);
|
|
33
|
+
if (Array.isArray(value)) return value.every((item) => isJsonValue(item, depth + 1));
|
|
34
|
+
if (!isRecord(value)) return false;
|
|
35
|
+
return Object.keys(value).every((key) => key !== "__proto__" && key !== "constructor" && isJsonValue(value[key], depth + 1));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Runtime 只做结构校验;组件名白名单与 props schema 属于 catalog 语义,
|
|
39
|
+
* 留在 `@webskill/ui`——runtime 不得为了校验反向依赖 ui。
|
|
40
|
+
*/
|
|
41
|
+
function assertNode(value, path, depth, counter) {
|
|
42
|
+
if (depth > MAX_NODE_DEPTH) reject(`A UI spec tree must not nest deeper than ${MAX_NODE_DEPTH} levels`);
|
|
43
|
+
if (++counter.nodes > MAX_NODES) reject(`A UI spec tree must contain at most ${MAX_NODES} nodes`);
|
|
44
|
+
if (!isRecord(value)) reject(`${path} must be an object`);
|
|
45
|
+
requireString(value["component"], `${path}.component`);
|
|
46
|
+
if (value["id"] !== void 0) requireString(value["id"], `${path}.id`);
|
|
47
|
+
if (value["props"] !== void 0 && (!isRecord(value["props"]) || !isJsonValue(value["props"]))) reject(`${path}.props must be a JSON object`);
|
|
48
|
+
const children = value["children"];
|
|
49
|
+
if (children === void 0) return;
|
|
50
|
+
if (!Array.isArray(children)) reject(`${path}.children must be an array`);
|
|
51
|
+
children.forEach((child, index) => assertNode(child, `${path}.children[${index}]`, depth + 1, counter));
|
|
52
|
+
}
|
|
53
|
+
function assertActions(value) {
|
|
54
|
+
if (value === void 0) return;
|
|
55
|
+
if (!Array.isArray(value) || value.length > MAX_ACTIONS) reject(`Surface actions must contain at most ${MAX_ACTIONS} items`);
|
|
56
|
+
for (const action of value) {
|
|
57
|
+
if (!isRecord(action)) reject("A surface action must be an object");
|
|
58
|
+
requireString(action["id"], "Surface action ID");
|
|
59
|
+
const intent = action["intent"];
|
|
60
|
+
if (typeof intent !== "string" || !actionIntents.has(intent)) reject("Surface action intent is invalid");
|
|
61
|
+
if (action["awaitResponse"] !== void 0 && typeof action["awaitResponse"] !== "boolean") reject("Surface action awaitResponse must be a boolean");
|
|
62
|
+
if (action["nonce"] !== void 0 && (typeof action["nonce"] !== "string" || action["nonce"] === "")) reject("Surface action nonce must be a non-empty string");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** Validates the allowlisted, data-only node tree accepted by a UI surface renderer. @experimental */
|
|
66
|
+
function validateUiSpecNode(value) {
|
|
67
|
+
assertNode(value, "root", 0, { nodes: 0 });
|
|
68
|
+
if (!isJsonValue(value)) reject("A UI spec tree must contain JSON data only");
|
|
69
|
+
if (JSON.stringify(value).length > MAX_SURFACE_BYTES) reject(`A UI spec tree exceeds the ${MAX_SURFACE_BYTES}-byte limit`);
|
|
70
|
+
return structuredClone(value);
|
|
71
|
+
}
|
|
72
|
+
function assertPatch(value) {
|
|
73
|
+
if (!isRecord(value)) reject("A surface patch operation must be an object");
|
|
74
|
+
if (value["op"] !== "replace" && value["op"] !== "merge" && value["op"] !== "append") reject("Surface patch operation is invalid");
|
|
75
|
+
requireString(value["path"], "Surface patch path");
|
|
76
|
+
if (!value["path"].startsWith("/")) reject("Surface patch path must be a JSON pointer");
|
|
77
|
+
if (!isJsonValue(value["value"])) reject("Surface patch value must be JSON data");
|
|
78
|
+
}
|
|
79
|
+
/** Validates an individual event in the framework-neutral surface stream. @experimental */
|
|
80
|
+
function validateUiSpecEvent(value) {
|
|
81
|
+
if (!isRecord(value) || typeof value["type"] !== "string") reject("A UI surface event must have a type");
|
|
82
|
+
if (value["runId"] !== void 0) requireString(value["runId"], "Surface event run ID");
|
|
83
|
+
switch (value["type"]) {
|
|
84
|
+
case "open":
|
|
85
|
+
requireString(value["id"], "UI surface ID");
|
|
86
|
+
assertActions(value["actions"]);
|
|
87
|
+
return {
|
|
88
|
+
type: "open",
|
|
89
|
+
...value["runId"] ? { runId: value["runId"] } : {},
|
|
90
|
+
id: value["id"],
|
|
91
|
+
node: validateUiSpecNode(value["node"]),
|
|
92
|
+
...value["actions"] ? { actions: structuredClone(value["actions"]) } : {}
|
|
93
|
+
};
|
|
94
|
+
case "patch":
|
|
95
|
+
requireString(value["id"], "Surface patch ID");
|
|
96
|
+
requireNonNegativeInteger(value["revision"], "Surface patch revision");
|
|
97
|
+
if (!Array.isArray(value["operations"]) || value["operations"].length === 0) reject("A surface patch requires operations");
|
|
98
|
+
if (value["operations"].length > MAX_PATCH_OPERATIONS) reject(`A surface patch must contain at most ${MAX_PATCH_OPERATIONS} operations`);
|
|
99
|
+
for (const operation of value["operations"]) assertPatch(operation);
|
|
100
|
+
return {
|
|
101
|
+
type: "patch",
|
|
102
|
+
...value["runId"] ? { runId: value["runId"] } : {},
|
|
103
|
+
id: value["id"],
|
|
104
|
+
revision: value["revision"],
|
|
105
|
+
operations: structuredClone(value["operations"])
|
|
106
|
+
};
|
|
107
|
+
case "complete":
|
|
108
|
+
requireString(value["id"], "Surface completion ID");
|
|
109
|
+
requireNonNegativeInteger(value["revision"], "Surface completion revision");
|
|
110
|
+
return {
|
|
111
|
+
type: "complete",
|
|
112
|
+
...value["runId"] ? { runId: value["runId"] } : {},
|
|
113
|
+
id: value["id"],
|
|
114
|
+
revision: value["revision"]
|
|
115
|
+
};
|
|
116
|
+
case "error":
|
|
117
|
+
requireString(value["id"], "Surface error ID");
|
|
118
|
+
requireString(value["code"], "Surface error code");
|
|
119
|
+
requireString(value["message"], "Surface error message");
|
|
120
|
+
return {
|
|
121
|
+
type: "error",
|
|
122
|
+
...value["runId"] ? { runId: value["runId"] } : {},
|
|
123
|
+
id: value["id"],
|
|
124
|
+
code: value["code"],
|
|
125
|
+
message: value["message"]
|
|
126
|
+
};
|
|
127
|
+
case "cancel":
|
|
128
|
+
requireString(value["id"], "Surface cancellation ID");
|
|
129
|
+
return {
|
|
130
|
+
type: "cancel",
|
|
131
|
+
...value["runId"] ? { runId: value["runId"] } : {},
|
|
132
|
+
id: value["id"]
|
|
133
|
+
};
|
|
134
|
+
default: return reject("UI surface event type is invalid");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/** Extracts validated surface stream events from structured tool output. @experimental */
|
|
138
|
+
function extractUiSpecEvents(data) {
|
|
139
|
+
if (!isRecord(data) || data["$surface"] === void 0) return [];
|
|
140
|
+
const raw = data["$surface"];
|
|
141
|
+
return (Array.isArray(raw) ? raw : [raw]).map((event) => validateUiSpecEvent(event));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
//#endregion
|
|
145
|
+
export { validateUiSpecEvent as n, validateUiSpecNode as r, extractUiSpecEvents as t };
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as UiBridge, c as InteractionResponse, l as LlmClient, m as LlmStreamEvent, n as ArtifactStore, p as LlmResponse, s as InteractionRequest, t as Artifact, u as LlmCompleteInput, v as MemoryStore } from "./types-C3V6lAeO-
|
|
1
|
+
import { S as UiBridge, c as InteractionResponse, l as LlmClient, m as LlmStreamEvent, n as ArtifactStore, p as LlmResponse, s as InteractionRequest, t as Artifact, u as LlmCompleteInput, v as MemoryStore } from "./types-C3V6lAeO-BIf7UB2e.js";
|
|
2
2
|
import { a as loadGoogleConfigFromEnv, i as loadAnthropicConfigFromEnv, n as LlmEnvConfig, o as loadLlmConfigFromEnv, r as ProviderEnvConfig } from "./env-AK3cSMEA-Dli6QU5E.js";
|
|
3
3
|
//#region ../runtime/dist/testing.d.ts
|
|
4
4
|
//#region src/llm/mockLlmClient.d.ts
|
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 };
|
|
@@ -13,6 +13,10 @@ type WebSkillErrorCode = 'FS_NOT_FOUND' | 'FS_PATH_OUTSIDE_ROOT' | 'SKILL_NOT_FO
|
|
|
13
13
|
'DATA_SOURCE_TOO_LARGE' |
|
|
14
14
|
/** 宿主环境缺少读取下载目录的前置条件(0.14.0 分册 20 FR-20.6) */
|
|
15
15
|
'DOWNLOADS_UNAVAILABLE' |
|
|
16
|
+
/** 脚本要读的上传文件不在本轮触发消息里(0.15.0 分册 17) */
|
|
17
|
+
'UPLOAD_FILE_NOT_FOUND' |
|
|
18
|
+
/** 上传文件超预算。与 DATA_SOURCE_TOO_LARGE 同口径:拒绝而不截断 */
|
|
19
|
+
'UPLOAD_FILE_TOO_LARGE' |
|
|
16
20
|
/** 用户拒绝了这次工具调用(0.14.0 分册 20) */
|
|
17
21
|
'TOOL_DENIED';
|
|
18
22
|
/**
|
|
@@ -390,6 +394,18 @@ interface RemoteUrlPolicy {
|
|
|
390
394
|
*/
|
|
391
395
|
declare function assertRemoteUrlAllowed(rawUrl: string, policy?: RemoteUrlPolicy): URL;
|
|
392
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
|
|
393
409
|
//#region src/ui/types.d.ts
|
|
394
410
|
/**
|
|
395
411
|
* 声明式 UI 的节点:框架无关,技能脚本与 LLM 产出同一形状。
|
|
@@ -1126,4 +1142,4 @@ interface MemoryStore {
|
|
|
1126
1142
|
transaction?<T>(scope: string, fn: (inner: MemoryStore) => Promise<T>): Promise<T>;
|
|
1127
1143
|
}
|
|
1128
1144
|
//#endregion
|
|
1129
|
-
export { SKILLS_LOCKFILE as $,
|
|
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,
|
|
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 {
|