@webskill/sdk 0.2.6 → 0.2.8
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/browser.d.ts +13 -4
- package/dist/browser.js +16 -6
- package/dist/catalogComponents-C_V39rbF-BOHveMWa.js +120303 -0
- package/dist/{dist-BXpDDZpR.js → dist-B9VLwOME.js} +464 -29
- package/dist/{dist-DNSG9FqC.js → dist-CtBLBbEz.js} +1186 -123
- package/dist/dist-DxyxmXPU-DGC-dpXf.js +5621 -0
- package/dist/echarts-DhNm2ene.js +78816 -0
- package/dist/governance.d.ts +29 -196
- package/dist/governance.js +38 -199
- package/dist/index-7DVaZJU7.d.ts +597 -0
- package/dist/{index-DJOha4b6.d.ts → index-QrHtAudz.d.ts} +37 -5
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/jsonRenderRegistry-9GrWP_hE-CQY8bT9w.js +2468 -0
- package/dist/mcp.d.ts +5 -3
- package/dist/mcp.js +9 -4
- package/dist/node.d.ts +49 -4
- package/dist/node.js +2064 -4
- package/dist/openUiLibrary-B8-Cvou9-D3RsU2EB.js +3785 -0
- package/dist/rolldown-runtime-BOF7iYI8.js +55 -0
- package/dist/sandboxWorkerEntry.js +12 -3
- package/dist/{index-DRlYzdr2.d.ts → skillVersionStore-B7rGjtMi-BgnQho9v.d.ts} +128 -3
- package/dist/testing.d.ts +1 -1
- package/dist/{types-CKm5G_eQ-krKWW8WV.d.ts → types-AmKCKJn_-BogJPQHU.d.ts} +129 -2
- package/dist/ui-react.d.ts +138 -2
- package/dist/ui-react.js +6935 -3
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui-vue.js +1 -1
- package/dist/ui.d.ts +3 -203
- package/dist/ui.js +3 -3
- package/dist/webskillLitCatalog-CNaUpasU-CfSRvqCZ.js +1601 -0
- package/package.json +2 -1
- package/dist/dist-DWFDb1Ww.js +0 -1896
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
|
|
3
|
+
//#region \0rolldown/runtime.js
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __esmMin = (fn, res, err) => () => {
|
|
11
|
+
if (err) throw err[0];
|
|
12
|
+
try {
|
|
13
|
+
return fn && (res = fn(fn = 0)), res;
|
|
14
|
+
} catch (e) {
|
|
15
|
+
throw err = [e], e;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
19
|
+
var __exportAll = (all, no_symbols) => {
|
|
20
|
+
let target = {};
|
|
21
|
+
for (var name in all) {
|
|
22
|
+
__defProp(target, name, {
|
|
23
|
+
get: all[name],
|
|
24
|
+
enumerable: true
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (!no_symbols) {
|
|
28
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
var __copyProps = (to, from, except, desc) => {
|
|
33
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
34
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
35
|
+
key = keys[i];
|
|
36
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
37
|
+
__defProp(to, key, {
|
|
38
|
+
get: ((k) => from[k]).bind(null, key),
|
|
39
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return to;
|
|
45
|
+
};
|
|
46
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
47
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
48
|
+
value: mod,
|
|
49
|
+
enumerable: true
|
|
50
|
+
}) : target, mod));
|
|
51
|
+
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
52
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
export { __require as a, __reExport as i, __esmMin as n, __toCommonJS as o, __exportAll as r, __toESM as s, __commonJSMin as t };
|
|
@@ -151,6 +151,7 @@ function setupNetworkGuards(task) {
|
|
|
151
151
|
*/
|
|
152
152
|
const internalExit = process.reallyExit.bind(process);
|
|
153
153
|
function stripProcessEscapeHatches() {
|
|
154
|
+
const remaining = [];
|
|
154
155
|
for (const key of [
|
|
155
156
|
"binding",
|
|
156
157
|
"_linkedBinding",
|
|
@@ -158,9 +159,17 @@ function stripProcessEscapeHatches() {
|
|
|
158
159
|
"openStdin",
|
|
159
160
|
"reallyExit",
|
|
160
161
|
"abort"
|
|
161
|
-
])
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
]) {
|
|
163
|
+
try {
|
|
164
|
+
Reflect.deleteProperty(process, key);
|
|
165
|
+
} catch {}
|
|
166
|
+
if (key in process) remaining.push(key);
|
|
167
|
+
}
|
|
168
|
+
if (remaining.length > 0) {
|
|
169
|
+
const err = /* @__PURE__ */ new Error(`Sandbox hardening failed: cannot remove process escape hatches (${remaining.join(", ")})`);
|
|
170
|
+
err.code = "TOOL_EXECUTION_FAILED";
|
|
171
|
+
throw err;
|
|
172
|
+
}
|
|
164
173
|
}
|
|
165
174
|
async function main() {
|
|
166
175
|
const task = workerData;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { N as NetworkPolicy, Q as ScriptExecutor, X as SchemaInferer, Z as ScriptExecutionContext, b as FsArtifactStore, d as BridgeCapabilities, it as ToolResult, nt as ToolDefinition, u as ApprovalScope, x as FsMemoryStore } from "./index-
|
|
1
|
+
import { K as SkillInstallSource, M as FileStat, N as FileSystemProvider, O as ArchiveLimits, P as JsonSchema, U as SkillCatalogEntry, Y as SkillManifest, _ as RenderResultRequest, et as SkillsLockfile, nt as VerifyResult, o as InteractionRequest, s as InteractionResponse, v as UiBridge } from "./types-AmKCKJn_-BogJPQHU.js";
|
|
2
|
+
import { N as NetworkPolicy, Q as ScriptExecutor, X as SchemaInferer, Z as ScriptExecutionContext, b as FsArtifactStore, d as BridgeCapabilities, it as ToolResult, nt as ToolDefinition, u as ApprovalScope, x as FsMemoryStore } from "./index-QrHtAudz.js";
|
|
3
3
|
import { Readable, Writable } from "node:stream";
|
|
4
4
|
//#region ../node/dist/index.d.ts
|
|
5
5
|
//#region src/fs/nodeFs.d.ts
|
|
@@ -237,4 +237,129 @@ declare function exportArchive(fs: FileSystemProvider, skillRoot: string, option
|
|
|
237
237
|
/** 只解出归档中的 webskill.skill-manifest.json 条目(安装前预览) */
|
|
238
238
|
declare function readArchiveManifest(fs: FileSystemProvider, archivePath: string): Promise<SkillManifest>;
|
|
239
239
|
//#endregion
|
|
240
|
-
|
|
240
|
+
//#region ../governance/dist/skillVersionStore-B7rGjtMi.d.ts
|
|
241
|
+
//#region src/types.d.ts
|
|
242
|
+
type CandidateStatus = 'draft' | 'pending-review' | 'approved' | 'published' | 'rejected';
|
|
243
|
+
type CandidateSource = 'runtime-miss' | 'document' | 'manual';
|
|
244
|
+
type CandidateRisk = 'low' | 'medium' | 'high';
|
|
245
|
+
interface CandidateFile {
|
|
246
|
+
path: string;
|
|
247
|
+
kind: 'skill-md' | 'script' | 'reference' | 'asset';
|
|
248
|
+
content: string;
|
|
249
|
+
}
|
|
250
|
+
interface CandidateSkill {
|
|
251
|
+
id: string;
|
|
252
|
+
name: string;
|
|
253
|
+
description: string;
|
|
254
|
+
status: CandidateStatus;
|
|
255
|
+
source: CandidateSource;
|
|
256
|
+
risk: CandidateRisk;
|
|
257
|
+
riskReasons: string[];
|
|
258
|
+
files: CandidateFile[];
|
|
259
|
+
suggestedTests?: string[];
|
|
260
|
+
createdAt: string;
|
|
261
|
+
updatedAt: string;
|
|
262
|
+
metadata?: Record<string, unknown>;
|
|
263
|
+
}
|
|
264
|
+
interface AuditEvent {
|
|
265
|
+
id: string;
|
|
266
|
+
type: string;
|
|
267
|
+
target: string;
|
|
268
|
+
actor?: string;
|
|
269
|
+
ts: string;
|
|
270
|
+
data?: Record<string, unknown>;
|
|
271
|
+
/** hash 链:上一条事件的 hash(首条为 GENESIS) */
|
|
272
|
+
prevHash?: string;
|
|
273
|
+
/** 本事件规范化载荷 + prevHash 的 sha256 */
|
|
274
|
+
hash?: string;
|
|
275
|
+
}
|
|
276
|
+
interface AuditLog {
|
|
277
|
+
append(event: Omit<AuditEvent, 'id' | 'ts'> & {
|
|
278
|
+
id?: string;
|
|
279
|
+
ts?: string;
|
|
280
|
+
}): Promise<AuditEvent>;
|
|
281
|
+
query(filter: {
|
|
282
|
+
target?: string;
|
|
283
|
+
type?: string;
|
|
284
|
+
since?: string;
|
|
285
|
+
}): Promise<AuditEvent[]>;
|
|
286
|
+
}
|
|
287
|
+
interface SkillVersion {
|
|
288
|
+
versionId: string;
|
|
289
|
+
parentVersionId?: string;
|
|
290
|
+
createdAt: string;
|
|
291
|
+
reason: string;
|
|
292
|
+
manifest: SkillManifest;
|
|
293
|
+
auditEventId?: string;
|
|
294
|
+
/** 发布时捕获的技能归档(zip 相对路径,applyRollback 恢复用;0.2.0 起记录) */
|
|
295
|
+
archivePath?: string;
|
|
296
|
+
}
|
|
297
|
+
type SkillState = 'active' | 'quarantined' | 'deprecated' | 'disabled';
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/candidate/candidateStore.d.ts
|
|
300
|
+
/** 逐文件持久化的候选存储:<managedRoot>/.webskill/candidates/<id>.json */
|
|
301
|
+
declare class CandidateStore {
|
|
302
|
+
#private;
|
|
303
|
+
constructor(deps: {
|
|
304
|
+
root: string;
|
|
305
|
+
fs: FileSystemProvider;
|
|
306
|
+
});
|
|
307
|
+
save(candidate: CandidateSkill): Promise<void>;
|
|
308
|
+
get(id: string): Promise<CandidateSkill>;
|
|
309
|
+
list(): Promise<CandidateSkill[]>;
|
|
310
|
+
updateStatus(id: string, status: CandidateStatus, now?: string): Promise<CandidateSkill>;
|
|
311
|
+
}
|
|
312
|
+
/** 硬门禁:仅 published 可转换为 Catalog 条目,否则 APPROVAL_REQUIRED */
|
|
313
|
+
declare function candidateToCatalogEntry(candidate: CandidateSkill): SkillCatalogEntry;
|
|
314
|
+
//#endregion
|
|
315
|
+
//#region src/approval/policies.d.ts
|
|
316
|
+
interface ApprovalDecision {
|
|
317
|
+
needsHuman: boolean;
|
|
318
|
+
reason: string;
|
|
319
|
+
}
|
|
320
|
+
interface ApprovalPolicy {
|
|
321
|
+
evaluate(candidate: CandidateSkill): ApprovalDecision;
|
|
322
|
+
}
|
|
323
|
+
/** 默认策略:任何候选都必须人工审批 */
|
|
324
|
+
declare class AlwaysHumanApprovalPolicy implements ApprovalPolicy {
|
|
325
|
+
evaluate(candidate: CandidateSkill): ApprovalDecision;
|
|
326
|
+
}
|
|
327
|
+
/** 规则组合策略:首个命中的规则胜出,全部未命中走 fallback(默认 AlwaysHuman) */
|
|
328
|
+
declare class CompositeApprovalPolicy implements ApprovalPolicy {
|
|
329
|
+
#private;
|
|
330
|
+
constructor(rules: Array<(candidate: CandidateSkill) => ApprovalDecision | undefined>, fallback?: ApprovalPolicy);
|
|
331
|
+
evaluate(candidate: CandidateSkill): ApprovalDecision;
|
|
332
|
+
}
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region src/versioning/skillVersionStore.d.ts
|
|
335
|
+
/** 版本存储:manifest 快照 + parentVersionId 链;回滚 = 追加新版本(谱系不断)。
|
|
336
|
+
* 保留策略:maxArchivesPerSkill(默认 5)超出时清理最旧版本(json + zip 归档一并删除)。 */
|
|
337
|
+
declare class SkillVersionStore {
|
|
338
|
+
#private;
|
|
339
|
+
constructor(deps: {
|
|
340
|
+
root: string;
|
|
341
|
+
fs: FileSystemProvider;
|
|
342
|
+
now?: () => string;
|
|
343
|
+
createId?: () => string;
|
|
344
|
+
audit?: AuditLog;
|
|
345
|
+
/** 每技能保留的版本/归档上限(默认 5,超出清理最旧) */
|
|
346
|
+
maxArchivesPerSkill?: number;
|
|
347
|
+
});
|
|
348
|
+
add(skillName: string, input: {
|
|
349
|
+
reason: string;
|
|
350
|
+
manifest: SkillManifest;
|
|
351
|
+
parentVersionId?: string;
|
|
352
|
+
archive?: Uint8Array;
|
|
353
|
+
}): Promise<SkillVersion>;
|
|
354
|
+
/** 读取版本归档字节(applyRollback 用;未捕获归档的旧版本 → GOVERNANCE_FAILED) */
|
|
355
|
+
readArchive(skillName: string, versionId: string): Promise<Uint8Array>;
|
|
356
|
+
list(skillName: string): Promise<SkillVersion[]>;
|
|
357
|
+
get(skillName: string, versionId: string): Promise<SkillVersion>;
|
|
358
|
+
/** 回滚:基于旧 manifest 追加新版本 + skill.rolled_back 审计 */
|
|
359
|
+
rollback(skillName: string, targetVersionId: string, input: {
|
|
360
|
+
actor?: string;
|
|
361
|
+
reason?: string;
|
|
362
|
+
}): Promise<SkillVersion>;
|
|
363
|
+
}
|
|
364
|
+
//#endregion
|
|
365
|
+
export { ProcessSandboxExecutor as C, SkillManager as D, SandboxedScriptExecutor as E, exportArchive as O, OxcSchemaInferer as S, SandboxOptions as T, CliUiBridge as _, AuditLog as a, NodeFS as b, CandidateSkill as c, CandidateStore as d, CompositeApprovalPolicy as f, candidateToCatalogEntry as g, SkillVersionStore as h, AuditEvent as i, readArchiveManifest as k, CandidateSource as l, SkillVersion as m, ApprovalDecision as n, CandidateFile as o, SkillState as p, ApprovalPolicy as r, CandidateRisk as s, AlwaysHumanApprovalPolicy as t, CandidateStatus as u, FileArtifactStore as v, ProcessSandboxOptions as w, NodeScriptExecutor as x, FileMemoryStore as y };
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as LlmClient, d as LlmResponse, f as LlmStreamEvent, h as MemoryStore, l as LlmCompleteInput, n as ArtifactStore, o as InteractionRequest, s as InteractionResponse, t as Artifact, v as UiBridge } from "./types-
|
|
1
|
+
import { c as LlmClient, d as LlmResponse, f as LlmStreamEvent, h as MemoryStore, l as LlmCompleteInput, n as ArtifactStore, o as InteractionRequest, s as InteractionResponse, t as Artifact, v as UiBridge } from "./types-AmKCKJn_-BogJPQHU.js";
|
|
2
2
|
import { a as loadGoogleConfigFromEnv, i as loadAnthropicConfigFromEnv, n as LlmEnvConfig, o as loadLlmConfigFromEnv, r as ProviderEnvConfig } from "./env-BPUBZCwJ-4jat_SVG.js";
|
|
3
3
|
//#region ../runtime/dist/testing.d.ts
|
|
4
4
|
//#region src/llm/mockLlmClient.d.ts
|
|
@@ -405,7 +405,7 @@ declare function escapeXml(text: string): string;
|
|
|
405
405
|
declare function renderAvailableSkillsXml(catalog: SkillCatalog): string;
|
|
406
406
|
declare const xmlRenderer: CatalogRenderer;
|
|
407
407
|
//#endregion
|
|
408
|
-
//#region ../runtime/dist/types-
|
|
408
|
+
//#region ../runtime/dist/types-AmKCKJn_.d.ts
|
|
409
409
|
//#region src/llm/streamTypes.d.ts
|
|
410
410
|
/** 流式 LLM 事件(OpenAI SSE / Vercel fullStream 统一映射) */
|
|
411
411
|
type LlmStreamEvent = {
|
|
@@ -437,6 +437,8 @@ interface LlmToolCall {
|
|
|
437
437
|
id: string;
|
|
438
438
|
name: string;
|
|
439
439
|
arguments: Record<string, unknown>;
|
|
440
|
+
/** 流式拼接后的 arguments 不是合法 JSON 时的错误描述;设置时 arguments 不可信 */
|
|
441
|
+
argumentsParseError?: string;
|
|
440
442
|
}
|
|
441
443
|
interface LlmResponse {
|
|
442
444
|
content?: string;
|
|
@@ -565,6 +567,125 @@ interface RenderResultRequest {
|
|
|
565
567
|
blocks: RenderBlock[];
|
|
566
568
|
artifacts?: Artifact[];
|
|
567
569
|
}
|
|
570
|
+
/** A user action exposed by a generative UI surface. @experimental */
|
|
571
|
+
interface UiSurfaceAction {
|
|
572
|
+
id: string;
|
|
573
|
+
label: string;
|
|
574
|
+
intent: 'submit' | 'cancel' | 'select' | 'download' | 'refresh';
|
|
575
|
+
disabled?: boolean;
|
|
576
|
+
/** Requests that the producing run waits for this action before continuing. @experimental */
|
|
577
|
+
awaitResponse?: boolean;
|
|
578
|
+
/** Runtime-generated action capability; model-provided values are never trusted. @experimental */
|
|
579
|
+
nonce?: string;
|
|
580
|
+
}
|
|
581
|
+
/** A runtime-owned request for a user action on a rendered UI surface. @experimental */
|
|
582
|
+
interface UiSurfaceActionRequest {
|
|
583
|
+
runId: string;
|
|
584
|
+
surfaceId: string;
|
|
585
|
+
actionId: string;
|
|
586
|
+
intent: UiSurfaceAction['intent'];
|
|
587
|
+
nonce: string;
|
|
588
|
+
}
|
|
589
|
+
/** A structured action returned by a renderer to the waiting run. @experimental */
|
|
590
|
+
interface UiSurfaceActionResponse extends UiSurfaceActionRequest {
|
|
591
|
+
value?: Record<string, unknown>;
|
|
592
|
+
cancelled?: boolean;
|
|
593
|
+
}
|
|
594
|
+
/** Serializable draft values for forms that belong to one interrupted run. @experimental */
|
|
595
|
+
type UiSurfaceDrafts = Record<string, Record<string, unknown>>;
|
|
596
|
+
/** A structured form field rendered inside a generative UI surface. @experimental */
|
|
597
|
+
interface UiSurfaceFormField {
|
|
598
|
+
name: string;
|
|
599
|
+
label: string;
|
|
600
|
+
type: 'text' | 'number' | 'date' | 'textarea' | 'select' | 'multi-select' | 'toggle' | 'file';
|
|
601
|
+
required?: boolean;
|
|
602
|
+
description?: string;
|
|
603
|
+
defaultValue?: unknown;
|
|
604
|
+
options?: Array<{
|
|
605
|
+
label: string;
|
|
606
|
+
value: unknown;
|
|
607
|
+
}>;
|
|
608
|
+
}
|
|
609
|
+
/** Framework-neutral generative UI surface. @experimental */
|
|
610
|
+
type UiSurface = {
|
|
611
|
+
kind: 'form';
|
|
612
|
+
id: string;
|
|
613
|
+
title?: string;
|
|
614
|
+
fields: UiSurfaceFormField[];
|
|
615
|
+
actions: UiSurfaceAction[];
|
|
616
|
+
} | {
|
|
617
|
+
kind: 'chart';
|
|
618
|
+
id: string;
|
|
619
|
+
chart: ChartSpec;
|
|
620
|
+
actions?: UiSurfaceAction[];
|
|
621
|
+
} | {
|
|
622
|
+
kind: 'table';
|
|
623
|
+
id: string;
|
|
624
|
+
columns: string[];
|
|
625
|
+
rows: unknown[][];
|
|
626
|
+
actions?: UiSurfaceAction[];
|
|
627
|
+
} | {
|
|
628
|
+
kind: 'metric';
|
|
629
|
+
id: string;
|
|
630
|
+
label: string;
|
|
631
|
+
value: string | number;
|
|
632
|
+
trend?: 'up' | 'down' | 'neutral';
|
|
633
|
+
} | {
|
|
634
|
+
kind: 'file';
|
|
635
|
+
id: string;
|
|
636
|
+
path: string;
|
|
637
|
+
mimeType?: string;
|
|
638
|
+
size?: number;
|
|
639
|
+
actions?: UiSurfaceAction[];
|
|
640
|
+
} | {
|
|
641
|
+
kind: 'custom';
|
|
642
|
+
id: string;
|
|
643
|
+
component: string;
|
|
644
|
+
props: unknown;
|
|
645
|
+
actions?: UiSurfaceAction[];
|
|
646
|
+
};
|
|
647
|
+
/** A bounded mutation applied to an existing UI surface. @experimental */
|
|
648
|
+
interface UiSurfacePatch {
|
|
649
|
+
op: 'replace' | 'merge' | 'append';
|
|
650
|
+
path: string;
|
|
651
|
+
value: unknown;
|
|
652
|
+
}
|
|
653
|
+
/** Incremental lifecycle event for a framework-neutral generative UI surface. @experimental */
|
|
654
|
+
type UiSurfaceEvent = {
|
|
655
|
+
runId?: string;
|
|
656
|
+
} & ({
|
|
657
|
+
type: 'open';
|
|
658
|
+
surface: UiSurface;
|
|
659
|
+
} | {
|
|
660
|
+
type: 'patch';
|
|
661
|
+
id: string;
|
|
662
|
+
revision: number;
|
|
663
|
+
operations: UiSurfacePatch[];
|
|
664
|
+
} | {
|
|
665
|
+
type: 'complete';
|
|
666
|
+
id: string;
|
|
667
|
+
revision: number;
|
|
668
|
+
} | {
|
|
669
|
+
type: 'error';
|
|
670
|
+
id: string;
|
|
671
|
+
code: string;
|
|
672
|
+
message: string;
|
|
673
|
+
} | {
|
|
674
|
+
type: 'cancel';
|
|
675
|
+
id: string;
|
|
676
|
+
});
|
|
677
|
+
/** Persisted state of a generative UI surface. @experimental */
|
|
678
|
+
interface UiSurfaceSnapshot {
|
|
679
|
+
surface: UiSurface;
|
|
680
|
+
revision: number;
|
|
681
|
+
status: 'active' | 'complete' | 'error' | 'cancelled';
|
|
682
|
+
/** Immutable producing run; supplied on open to support session persistence and replay. */
|
|
683
|
+
runId?: string;
|
|
684
|
+
error?: {
|
|
685
|
+
code: string;
|
|
686
|
+
message: string;
|
|
687
|
+
};
|
|
688
|
+
}
|
|
568
689
|
/** @stable */
|
|
569
690
|
interface UiBridge {
|
|
570
691
|
request(input: InteractionRequest): Promise<InteractionResponse>;
|
|
@@ -577,6 +698,12 @@ interface UiBridge {
|
|
|
577
698
|
}): Promise<void>;
|
|
578
699
|
/** 定义即可,阶段 7 消费 */
|
|
579
700
|
renderResult?(input: RenderResultRequest): Promise<void>;
|
|
701
|
+
/** Framework-neutral generative UI surface stream. @experimental */
|
|
702
|
+
renderSurface?(event: UiSurfaceEvent): Promise<void>;
|
|
703
|
+
/** Waits for an action declared with awaitResponse; optional for compatibility with legacy bridges. @experimental */
|
|
704
|
+
requestSurfaceAction?(input: UiSurfaceActionRequest): Promise<UiSurfaceActionResponse>;
|
|
705
|
+
/** Best-effort cleanup when a surface action wait times out or is cancelled. @experimental */
|
|
706
|
+
cancelSurfaceAction?(nonce: string): void | Promise<void>;
|
|
580
707
|
/** 流式文本增量(流式 LLM 路径下由 AgentLoop 转发) */
|
|
581
708
|
onTextDelta?(runId: string, delta: string): Promise<void> | void;
|
|
582
709
|
}
|
|
@@ -616,4 +743,4 @@ interface MemoryStore {
|
|
|
616
743
|
transaction?<T>(scope: string, fn: (inner: MemoryStore) => Promise<T>): Promise<T>;
|
|
617
744
|
}
|
|
618
745
|
//#endregion
|
|
619
|
-
export {
|
|
746
|
+
export { SkillSource as $, DEFAULT_ARCHIVE_LIMITS as A, SKILL_NAME_PATTERN as B, UiSurfaceDrafts as C, renderCatalogJson as Ct, UiSurfaceSnapshot as D, validateSkills as Dt, UiSurfacePatch as E, unzipWithLimits as Et, MemoryFS as F, SkillDocument as G, SkillCatalog as H, RemoteUrlPolicy as I, SkillLocation as J, SkillInstallSource as K, SKILLS_LOCKFILE as L, FileStat as M, FileSystemProvider as N, ArchiveLimits as O, verifyManifest as Ot, JsonSchema as P, SkillReader as Q, SKILL_MANIFEST_FILE as R, UiSurfaceActionResponse as S, renderAvailableSkillsXml as St, UiSurfaceFormField as T, resolveInsideRoot as Tt, SkillCatalogEntry as U, SKILL_PACK_FILE as V, SkillDiscovery as W, SkillMetadata as X, SkillManifest as Y, SkillPackManifest as Z, RenderResultRequest as _, messageOf as _t, InteractionPolicy as a, assertRemoteUrlAllowed as at, UiSurfaceAction as b, parseSkillPackManifest as bt, LlmClient as c, buildCatalog as ct, LlmResponse as d, checkSkillRules as dt, SkillsLockfile as et, LlmStreamEvent as f, computeDigest as ft, RenderBlock as g, jsonRenderer as gt, MemoryStore as h, isValidSkillName as ht, FormField as i, WebSkillErrorCode as it, DiscoveryResult as j, CatalogRenderer as k, xmlRenderer as kt, LlmCompleteInput as l, buildManifest as lt, LlmToolSpec as m, exportSkills as mt, ArtifactStore as n, VerifyResult as nt, InteractionRequest as o, assertSafePathSegment as ot, LlmToolCall as p, escapeXml as pt, SkillIssue as q, ChartSpec as r, WebSkillError as rt, InteractionResponse as s, atomicWriteText as st, Artifact as t, ValidationReport as tt, LlmMessage as u, checkDependencyCycles as ut, UiBridge as v, normalizePath as vt, UiSurfaceEvent as w, resolveArchiveLimits as wt, UiSurfaceActionRequest as x, readResponseWithLimit as xt, UiSurface as y, parseSkillMarkdown as yt, SKILL_NAME_MAX_LENGTH as z };
|
package/dist/ui-react.d.ts
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
import { _ as RenderResultRequest, o as InteractionRequest, s as InteractionResponse, v as UiBridge } from "./types-
|
|
1
|
+
import { C as UiSurfaceDrafts, D as UiSurfaceSnapshot, S as UiSurfaceActionResponse, _ as RenderResultRequest, b as UiSurfaceAction, o as InteractionRequest, s as InteractionResponse, v as UiBridge, w as UiSurfaceEvent, x as UiSurfaceActionRequest } from "./types-AmKCKJn_-BogJPQHU.js";
|
|
2
|
+
import { B as UiSpecNode } from "./index-7DVaZJU7.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { ComponentType, ReactNode } from "react";
|
|
2
5
|
//#region ../ui-react/dist/index.d.ts
|
|
6
|
+
//#region src/surfaceStore.d.ts
|
|
7
|
+
/** Observable, revision-checked snapshot store for framework-neutral UI surfaces. @experimental */
|
|
8
|
+
declare class UiSurfaceStore {
|
|
9
|
+
#private;
|
|
10
|
+
subscribe: (listener: () => void) => (() => void);
|
|
11
|
+
get snapshots(): readonly UiSurfaceSnapshot[];
|
|
12
|
+
apply(event: UiSurfaceEvent): void;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
3
15
|
//#region src/bridgeState.d.ts
|
|
16
|
+
interface ReactBridgeStateOptions {
|
|
17
|
+
onSurfaceDraftChange?(runId: string, surfaceId: string, value: Record<string, unknown>): Promise<void> | void;
|
|
18
|
+
}
|
|
4
19
|
/**
|
|
5
20
|
* React 桥接状态:UiBridge 实现 + useSyncExternalStore 兼容订阅。
|
|
6
21
|
* 应用创建实例传给 Runtime 与组件:<InteractionForm bridge={bridge} />。
|
|
@@ -8,10 +23,17 @@ import { _ as RenderResultRequest, o as InteractionRequest, s as InteractionResp
|
|
|
8
23
|
declare class ReactBridgeState implements UiBridge {
|
|
9
24
|
#private;
|
|
10
25
|
pending: InteractionRequest | null;
|
|
26
|
+
pendingSurfaceAction: UiSurfaceActionRequest | null;
|
|
11
27
|
latestResult: RenderResultRequest | null;
|
|
28
|
+
readonly surfaceStore: UiSurfaceStore;
|
|
12
29
|
/** 当前流式 runId(并发 run 隔离:新 runId 重置文本) */
|
|
13
30
|
streamingRunId: string | null;
|
|
14
31
|
streamingText: string;
|
|
32
|
+
constructor(options?: ReactBridgeStateOptions);
|
|
33
|
+
get surfaceSnapshots(): readonly UiSurfaceSnapshot[];
|
|
34
|
+
surfaceDrafts(runId: string): UiSurfaceDrafts;
|
|
35
|
+
restoreSurfaceDrafts(runId: string, drafts: UiSurfaceDrafts | undefined): void;
|
|
36
|
+
setSurfaceDraft(runId: string, surfaceId: string, value: Record<string, unknown>): void;
|
|
15
37
|
/** React useSyncExternalStore 兼容订阅 */
|
|
16
38
|
subscribe: (listener: () => void) => (() => void);
|
|
17
39
|
request(input: InteractionRequest): Promise<InteractionResponse>;
|
|
@@ -20,6 +42,11 @@ declare class ReactBridgeState implements UiBridge {
|
|
|
20
42
|
/** runtime 交互超时/取消:卸载表单并以 cancelled resolve pending Promise(防悬挂 + 残留) */
|
|
21
43
|
cancel(id: string): void;
|
|
22
44
|
renderResult(input: RenderResultRequest): Promise<void>;
|
|
45
|
+
renderSurface(event: UiSurfaceEvent): Promise<void>;
|
|
46
|
+
requestSurfaceAction(input: UiSurfaceActionRequest): Promise<UiSurfaceActionResponse>;
|
|
47
|
+
/** Resolves exactly one pending action capability; stale or duplicate nonces are ignored. */
|
|
48
|
+
resolveSurfaceAction(response: UiSurfaceActionResponse): boolean;
|
|
49
|
+
cancelSurfaceAction(nonce: string): void;
|
|
23
50
|
onTextDelta(runId: string, delta: string): Promise<void>;
|
|
24
51
|
}
|
|
25
52
|
//#endregion
|
|
@@ -41,4 +68,113 @@ declare function StreamingText({ bridge }: {
|
|
|
41
68
|
bridge: ReactBridgeState;
|
|
42
69
|
}): import("react").JSX.Element | null;
|
|
43
70
|
//#endregion
|
|
44
|
-
|
|
71
|
+
//#region src/surfaceRegistry.d.ts
|
|
72
|
+
interface CustomSurfaceActionEvent {
|
|
73
|
+
surfaceId: string;
|
|
74
|
+
actionId: string;
|
|
75
|
+
intent: UiSurfaceAction['intent'];
|
|
76
|
+
nonce?: string;
|
|
77
|
+
value?: Record<string, unknown>;
|
|
78
|
+
}
|
|
79
|
+
interface RegisteredSurfaceProps<Props> {
|
|
80
|
+
surfaceId: string;
|
|
81
|
+
props: Props;
|
|
82
|
+
actions: readonly UiSurfaceAction[];
|
|
83
|
+
onAction?(event: CustomSurfaceActionEvent): void;
|
|
84
|
+
}
|
|
85
|
+
interface SurfaceRegistration<Props> {
|
|
86
|
+
schema: z.ZodType<Props>;
|
|
87
|
+
component: ComponentType<RegisteredSurfaceProps<Props>>;
|
|
88
|
+
}
|
|
89
|
+
interface RegisteredSurface<Props> {
|
|
90
|
+
schema: z.ZodType<Props>;
|
|
91
|
+
component: ComponentType<RegisteredSurfaceProps<Props>>;
|
|
92
|
+
}
|
|
93
|
+
/** Explicit allowlist for Native custom surfaces. @experimental */
|
|
94
|
+
declare class SurfaceRegistry {
|
|
95
|
+
#private;
|
|
96
|
+
register<Props>(name: string, registration: SurfaceRegistration<Props>): this;
|
|
97
|
+
get(name: string): RegisteredSurface<unknown> | undefined;
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/components/UiSurfaceList.d.ts
|
|
101
|
+
interface UiSurfaceActionEvent {
|
|
102
|
+
runId?: string;
|
|
103
|
+
surfaceId: string;
|
|
104
|
+
actionId: string;
|
|
105
|
+
intent: UiSurfaceAction['intent'];
|
|
106
|
+
nonce?: string;
|
|
107
|
+
value?: Record<string, unknown>;
|
|
108
|
+
}
|
|
109
|
+
interface UiSurfaceListProps {
|
|
110
|
+
bridge: ReactBridgeState;
|
|
111
|
+
/** Limits the live renderer to a producing run; omit to render the full store. */
|
|
112
|
+
runId?: string;
|
|
113
|
+
registry?: SurfaceRegistry;
|
|
114
|
+
onAction?(event: UiSurfaceActionEvent): void;
|
|
115
|
+
}
|
|
116
|
+
interface UiSurfaceSnapshotListProps {
|
|
117
|
+
snapshots: readonly UiSurfaceSnapshot[];
|
|
118
|
+
registry?: SurfaceRegistry;
|
|
119
|
+
onAction?(event: UiSurfaceActionEvent): void;
|
|
120
|
+
drafts?: UiSurfaceDrafts;
|
|
121
|
+
onDraftChange?(event: {
|
|
122
|
+
runId: string;
|
|
123
|
+
surfaceId: string;
|
|
124
|
+
value: Record<string, unknown>;
|
|
125
|
+
}): void;
|
|
126
|
+
}
|
|
127
|
+
/** Renders Native surface snapshots, including persisted assistant-message history. @experimental */
|
|
128
|
+
declare function UiSurfaceSnapshotList({ snapshots, registry, onAction, drafts, onDraftChange }: UiSurfaceSnapshotListProps): import("react").JSX.Element | null;
|
|
129
|
+
/** Renders the current Native surface snapshots exposed by a React bridge. @experimental */
|
|
130
|
+
declare function UiSurfaceList({ bridge, runId, registry, onAction }: UiSurfaceListProps): import("react").JSX.Element;
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/catalog/NativeSpecSurface.d.ts
|
|
133
|
+
/** native registry 覆盖的组件名;与 catalog 的一致性由测试强制(21 号文档 §5.2) */
|
|
134
|
+
declare const NATIVE_SPEC_COMPONENTS: readonly string[];
|
|
135
|
+
interface NativeSpecSurfaceProps {
|
|
136
|
+
surfaceId: string;
|
|
137
|
+
spec: UiSpecNode;
|
|
138
|
+
actions: readonly UiSurfaceAction[];
|
|
139
|
+
registry?: SurfaceRegistry;
|
|
140
|
+
onAction?(event: CustomSurfaceActionEvent): void;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Native 档的 catalog registry:把声明树渲染成 ui-kit 组件。
|
|
144
|
+
* 越界组件名不静默降级,渲染成英文错误行(21 号文档 §8 第 5 条)。
|
|
145
|
+
*/
|
|
146
|
+
declare function NativeSpecSurface({ surfaceId, spec, actions, registry, onAction }: NativeSpecSurfaceProps): import("react").JSX.Element;
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region src/catalog/JsonRenderSpecSurface.d.ts
|
|
149
|
+
interface JsonRenderSpecSurfaceProps {
|
|
150
|
+
spec: UiSpecNode;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* `vercel` 档:同一份 catalog 声明树交给 json-render 的 Registry 渲染。
|
|
154
|
+
* `@json-render/*` 是 optional peer,未安装时给出英文说明而不是空白。
|
|
155
|
+
*/
|
|
156
|
+
declare function JsonRenderSpecSurface({ spec }: JsonRenderSpecSurfaceProps): import("react").JSX.Element | null;
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/catalog/OpenUiSpecSurface.d.ts
|
|
159
|
+
interface OpenUiSpecSurfaceProps {
|
|
160
|
+
spec: UiSpecNode;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* `openui` 档:同一份 catalog 声明树经 openui-lang 交给 OpenUI 的 Renderer。
|
|
164
|
+
* `@openuidev/react-lang` 是 optional peer,未安装时给出英文说明而不是空白。
|
|
165
|
+
*/
|
|
166
|
+
declare function OpenUiSpecSurface({ spec }: OpenUiSpecSurfaceProps): import("react").JSX.Element | null;
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/catalog/catalogComponents.d.ts
|
|
169
|
+
type CatalogNodeProps = {
|
|
170
|
+
props: Record<string, unknown>;
|
|
171
|
+
children?: ReactNode;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* catalog 16 个组件的展示实现:json-render 与 OpenUI 两档共用同一份,
|
|
175
|
+
* 避免"一个 catalog、多套 registry"退化成多套各自演进的视觉。
|
|
176
|
+
* 交互(表单值收集 / action 回传)由各档的宿主组件负责。
|
|
177
|
+
*/
|
|
178
|
+
declare const catalogComponentImpls: Record<string, (input: CatalogNodeProps) => ReactNode>;
|
|
179
|
+
//#endregion
|
|
180
|
+
export { type CatalogNodeProps, type CustomSurfaceActionEvent, InteractionForm, JsonRenderSpecSurface, type JsonRenderSpecSurfaceProps, NATIVE_SPEC_COMPONENTS, NativeSpecSurface, type NativeSpecSurfaceProps, OpenUiSpecSurface, type OpenUiSpecSurfaceProps, ReactBridgeState, type RegisteredSurfaceProps, ResultBlocks, StreamingText, type SurfaceRegistration, SurfaceRegistry, type UiSurfaceActionEvent, UiSurfaceList, type UiSurfaceListProps, UiSurfaceSnapshotList, type UiSurfaceSnapshotListProps, UiSurfaceStore, catalogComponentImpls };
|