@webskill/sdk 0.2.8 → 0.4.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/README.md +42 -0
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +4 -9
- package/dist/{catalogComponents-C_V39rbF-BOHveMWa.js → catalogComponents-KsujmL4b-Clx1kCnU.js} +278 -122
- package/dist/client-BCM6Z3yq-qUQNkKrK.js +7787 -0
- package/dist/{dist-BQzncxXg.js → dist-8oQRa8Xz.js} +212 -13
- package/dist/{dist-B9VLwOME.js → dist-C-Sh0MDU.js} +1019 -317
- package/dist/{dist-CtBLBbEz.js → dist-D9Lcn5Pp.js} +528 -838
- package/dist/governance.d.ts +46 -11
- package/dist/governance.js +152 -25
- package/dist/{index-7DVaZJU7.d.ts → index-CHXxDccV.d.ts} +62 -144
- package/dist/{index-QrHtAudz.d.ts → index-DLfR2Y6I.d.ts} +412 -21
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -3
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +2 -2
- package/dist/memoryArtifactStore-BtOeB_hm-tj3fC5ip.js +78 -0
- package/dist/node.d.ts +297 -4
- package/dist/node.js +281 -7
- package/dist/{openUiLibrary-B8-Cvou9-D3RsU2EB.js → openUiLibrary-YLS-cxyT-C96jWDQq.js} +6 -5
- package/dist/skillVersionStore-uyefLPR1-DXOzbksv.d.ts +158 -0
- package/dist/stdio-CFMoANJJ-BxrTeXh7.js +31 -0
- package/dist/{testing-BUoXvm1u.js → testing-DDCJWvgA.js} +8 -6
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +2 -2
- package/dist/{types-AmKCKJn_-BogJPQHU.d.ts → types-7Wcg--Vh-1YlQ4jF9.d.ts} +219 -70
- package/dist/types-WovEf4ED-CZSDiiBU.js +6215 -0
- package/dist/ui-react.d.ts +329 -18
- package/dist/ui-react.js +3715 -3464
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui-vue.js +1 -1
- package/dist/ui.d.ts +4 -3
- package/dist/ui.js +3 -3
- package/dist/{webskillLitCatalog-CNaUpasU-CfSRvqCZ.js → webskillLitCatalog-CSTbhBe_-CYIs5BX8.js} +312 -122
- package/package.json +4 -7
- package/dist/jsonRenderRegistry-9GrWP_hE-CQY8bT9w.js +0 -2468
- package/dist/memoryArtifactStore-C9lFVqPF-yFz6yJj0.js +0 -48
- package/dist/skillVersionStore-B7rGjtMi-BgnQho9v.d.ts +0 -365
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
//#region ../runtime/dist/memoryArtifactStore-C9lFVqPF.js
|
|
2
|
-
/** 内存 ArtifactStore:测试与浏览器降级用;索引随进程生命周期存在 */
|
|
3
|
-
var MemoryArtifactStore = class {
|
|
4
|
-
#byRun = /* @__PURE__ */ new Map();
|
|
5
|
-
#seq = 0;
|
|
6
|
-
async createTextArtifact(input) {
|
|
7
|
-
return this.#record({
|
|
8
|
-
runId: input.runId,
|
|
9
|
-
path: input.path,
|
|
10
|
-
type: "text",
|
|
11
|
-
size: new TextEncoder().encode(input.content).length,
|
|
12
|
-
mimeType: input.mimeType,
|
|
13
|
-
metadata: input.metadata
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
async createBinaryArtifact(input) {
|
|
17
|
-
return this.#record({
|
|
18
|
-
runId: input.runId,
|
|
19
|
-
path: input.path,
|
|
20
|
-
type: "binary",
|
|
21
|
-
size: input.content.length,
|
|
22
|
-
mimeType: input.mimeType,
|
|
23
|
-
metadata: input.metadata
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
async listArtifacts(runId) {
|
|
27
|
-
return [...this.#byRun.get(runId) ?? []];
|
|
28
|
-
}
|
|
29
|
-
#record(input) {
|
|
30
|
-
const artifact = {
|
|
31
|
-
id: `art-${++this.#seq}`,
|
|
32
|
-
runId: input.runId,
|
|
33
|
-
path: input.path,
|
|
34
|
-
type: input.type,
|
|
35
|
-
mimeType: input.mimeType,
|
|
36
|
-
size: input.size,
|
|
37
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
38
|
-
metadata: input.metadata
|
|
39
|
-
};
|
|
40
|
-
const list = this.#byRun.get(input.runId) ?? [];
|
|
41
|
-
list.push(artifact);
|
|
42
|
-
this.#byRun.set(input.runId, list);
|
|
43
|
-
return artifact;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
//#endregion
|
|
48
|
-
export { MemoryArtifactStore as t };
|
|
@@ -1,365 +0,0 @@
|
|
|
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
|
-
import { Readable, Writable } from "node:stream";
|
|
4
|
-
//#region ../node/dist/index.d.ts
|
|
5
|
-
//#region src/fs/nodeFs.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* 基于 node:fs/promises 的 FileSystemProvider;接受 `/` 风格路径,写入自动创建父目录。
|
|
8
|
-
* 可选 root 模式:构造传入 root 后,read/write 操作先做 realpath 包含校验
|
|
9
|
-
* (root 与目标都 realpath 后前缀比对),经符号链接逃逸 root → FS_PATH_OUTSIDE_ROOT。
|
|
10
|
-
*/
|
|
11
|
-
declare class NodeFS implements FileSystemProvider {
|
|
12
|
-
#private;
|
|
13
|
-
readonly kind = "node";
|
|
14
|
-
constructor(deps?: {
|
|
15
|
-
root?: string;
|
|
16
|
-
});
|
|
17
|
-
/** root 模式:全部方法(read/write/exists/stat/list/mkdir/remove/rename)目标 realpath 必须落在 root realpath 前缀内 */
|
|
18
|
-
withRoot(root: string): NodeFS;
|
|
19
|
-
readText(p: string): Promise<string>;
|
|
20
|
-
writeText(p: string, content: string): Promise<void>;
|
|
21
|
-
appendText(p: string, content: string): Promise<void>;
|
|
22
|
-
readBinary(p: string): Promise<Uint8Array>;
|
|
23
|
-
writeBinary(p: string, content: Uint8Array): Promise<void>;
|
|
24
|
-
exists(p: string): Promise<boolean>;
|
|
25
|
-
stat(p: string): Promise<FileStat>;
|
|
26
|
-
list(p: string): Promise<FileStat[]>;
|
|
27
|
-
mkdir(p: string): Promise<void>;
|
|
28
|
-
remove(p: string, options?: {
|
|
29
|
-
recursive?: boolean;
|
|
30
|
-
}): Promise<void>;
|
|
31
|
-
rename(from: string, to: string): Promise<void>;
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region src/executor/nodeScriptExecutor.d.ts
|
|
35
|
-
/**
|
|
36
|
-
* 进程内脚本执行器。接口按沙箱语义设计(context 无隐式宿主访问),
|
|
37
|
-
* worker_threads 沙箱见 deferred-items D1。
|
|
38
|
-
*/
|
|
39
|
-
declare class NodeScriptExecutor implements ScriptExecutor {
|
|
40
|
-
#private;
|
|
41
|
-
constructor(fs: FileSystemProvider);
|
|
42
|
-
loadDefinition(skillRoot: string, scriptName: string): Promise<ToolDefinition>;
|
|
43
|
-
execute(input: {
|
|
44
|
-
skillRoot: string;
|
|
45
|
-
scriptName: string;
|
|
46
|
-
args: Record<string, unknown>;
|
|
47
|
-
context: Parameters<ScriptExecutor['execute']>[0]['context'];
|
|
48
|
-
timeoutMs: number;
|
|
49
|
-
}): Promise<ToolResult>;
|
|
50
|
-
}
|
|
51
|
-
//#endregion
|
|
52
|
-
//#region src/executor/sandboxedScriptExecutor.d.ts
|
|
53
|
-
interface SandboxOptions {
|
|
54
|
-
/** 默认 { maxOldGenerationSizeMb: 64, maxYoungGenerationSizeMb: 16 } */
|
|
55
|
-
resourceLimits?: {
|
|
56
|
-
maxOldGenerationSizeMb?: number;
|
|
57
|
-
maxYoungGenerationSizeMb?: number;
|
|
58
|
-
};
|
|
59
|
-
/** env 白名单(仅这些变量传入 Worker;默认空) */
|
|
60
|
-
envWhitelist?: string[];
|
|
61
|
-
capabilities?: BridgeCapabilities;
|
|
62
|
-
/** 网络策略:默认 'deny-all'(白名单见 runtime/sandbox/networkPolicy) */
|
|
63
|
-
networkPolicy?: NetworkPolicy;
|
|
64
|
-
/** 裸模块 allowlist(默认 []:一切 node: 内置模块全禁;按需放行如 ['node:path']) */
|
|
65
|
-
allowedModules?: string[];
|
|
66
|
-
/** require-approval 模式的授权询问出口(缺失时 require-approval 一律拒绝) */
|
|
67
|
-
uiBridge?: UiBridge;
|
|
68
|
-
/** 授权粒度:默认 'once-per-run' */
|
|
69
|
-
approvalScope?: ApprovalScope;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* D1:worker_threads 沙箱脚本执行器。
|
|
73
|
-
* 每次执行独立 Worker(resourceLimits + env 白名单),loadDefinition 同样在
|
|
74
|
-
* Worker 内完成(禁止主进程 import 不可信脚本);超时 terminate(可杀同步死循环)。
|
|
75
|
-
* 能力桥协议与浏览器同一来源(runtime/sandbox/bridgeProtocol)。
|
|
76
|
-
*
|
|
77
|
-
* 诚实标注:本执行器做的是**能力面收敛**(网络策略、模块 allowlist、资源限额、
|
|
78
|
-
* 超时强杀),**不是安全边界**——Worker 内脚本与宿主共享进程;
|
|
79
|
-
* 已知主动逃逸面(process.binding/_linkedBinding/dlopen/openStdin/reallyExit/abort)
|
|
80
|
-
* 已在入口删除(0.2.3),常规 import 拦截之外不承诺防御其它宿主共享面;
|
|
81
|
-
* 禁止假定其可隔离不可信脚本(隔离级需求用 ProcessSandboxExecutor)。
|
|
82
|
-
*/
|
|
83
|
-
declare class SandboxedScriptExecutor implements ScriptExecutor {
|
|
84
|
-
#private;
|
|
85
|
-
constructor(fs: FileSystemProvider, options?: SandboxOptions);
|
|
86
|
-
loadDefinition(skillRoot: string, scriptName: string): Promise<ToolDefinition>;
|
|
87
|
-
execute(input: {
|
|
88
|
-
skillRoot: string;
|
|
89
|
-
scriptName: string;
|
|
90
|
-
args: Record<string, unknown>;
|
|
91
|
-
context: ScriptExecutionContext;
|
|
92
|
-
timeoutMs: number;
|
|
93
|
-
}): Promise<ToolResult>;
|
|
94
|
-
}
|
|
95
|
-
//#endregion
|
|
96
|
-
//#region src/executor/processSandboxExecutor.d.ts
|
|
97
|
-
interface ProcessSandboxOptions {
|
|
98
|
-
/** 温池大小(并发上限;执行后 kill 并补位重生),默认 2 */
|
|
99
|
-
poolSize?: number;
|
|
100
|
-
/** 透传给子进程的环境变量白名单(默认 []:子进程 env 为空,防密钥泄露) */
|
|
101
|
-
envWhitelist?: string[];
|
|
102
|
-
capabilities?: BridgeCapabilities;
|
|
103
|
-
/** 网络策略:默认 'deny-all'(权限模型无网络维度,补丁兜底;node:net 裸模块为已知残余面) */
|
|
104
|
-
networkPolicy?: NetworkPolicy;
|
|
105
|
-
/** require-approval 模式的授权询问出口 */
|
|
106
|
-
uiBridge?: UiBridge;
|
|
107
|
-
/** 授权粒度:默认 'once-per-run' */
|
|
108
|
-
approvalScope?: ApprovalScope;
|
|
109
|
-
/** 池维护告警出口(recycle 重生失败等;默认 console.warn) */
|
|
110
|
-
onWarning?: (message: string) => void;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* child_process.fork + --permission 进程沙箱(真实进程隔离)。
|
|
114
|
-
* 每个子进程以 `--permission --allow-fs-read=<入口目录> --allow-fs-read=<skillRoot>
|
|
115
|
-
* --allow-fs-write=<artifactDir>` 启动:fs 维度由权限模型管控(experimental),
|
|
116
|
-
* 子进程/Worker/addons 默认禁;网络无权限维度仍靠 fetch/WebSocket patch。
|
|
117
|
-
* 能力桥协议与 worker_threads 沙箱同一形态(readReference/writeArtifact/confirm + 授权)。
|
|
118
|
-
* 温池(默认 2):同 skillRoot 复用子进程;执行后 kill 并补位重生;并发上限即池大小。
|
|
119
|
-
* 超时 kill(同步死循环可杀);非零退出码 → TOOL_EXECUTION_FAILED。
|
|
120
|
-
*/
|
|
121
|
-
declare class ProcessSandboxExecutor implements ScriptExecutor {
|
|
122
|
-
#private;
|
|
123
|
-
constructor(fs: FileSystemProvider, options?: ProcessSandboxOptions);
|
|
124
|
-
get poolSize(): number;
|
|
125
|
-
/** 池全部子进程销毁(测试收尾/进程退出前调用);排队中的 acquire 一律 reject(不悬挂) */
|
|
126
|
-
dispose(): Promise<void>;
|
|
127
|
-
loadDefinition(skillRoot: string, scriptName: string): Promise<ToolDefinition>;
|
|
128
|
-
execute(input: {
|
|
129
|
-
skillRoot: string;
|
|
130
|
-
scriptName: string;
|
|
131
|
-
args: Record<string, unknown>;
|
|
132
|
-
context: ScriptExecutionContext;
|
|
133
|
-
timeoutMs: number;
|
|
134
|
-
}): Promise<ToolResult>;
|
|
135
|
-
}
|
|
136
|
-
//#endregion
|
|
137
|
-
//#region src/schema/oxcSchemaInferer.d.ts
|
|
138
|
-
/**
|
|
139
|
-
* D2 Schema 推导(OXC 静态文本分析,宿主侧执行,不进沙箱)。
|
|
140
|
-
* TS 类型标注为主路径,JSDoc @param 为辅路径;不支持类型降级 string 并标 'x-inferred'。
|
|
141
|
-
*/
|
|
142
|
-
declare class OxcSchemaInferer implements SchemaInferer {
|
|
143
|
-
inferSchemaFromSource(source: string, options?: {
|
|
144
|
-
fileName?: string;
|
|
145
|
-
}): JsonSchema | undefined;
|
|
146
|
-
}
|
|
147
|
-
//#endregion
|
|
148
|
-
//#region src/artifacts/fileArtifactStore.d.ts
|
|
149
|
-
/**
|
|
150
|
-
* FileArtifactStore:兼容别名,语义同阶段 2-4。
|
|
151
|
-
* 实现已上移到 runtime 的 FsArtifactStore;node 侧保留 NodeFS 默认值。
|
|
152
|
-
*/
|
|
153
|
-
declare class FileArtifactStore extends FsArtifactStore {
|
|
154
|
-
constructor(deps: {
|
|
155
|
-
root: string;
|
|
156
|
-
fs?: FileSystemProvider;
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
//#endregion
|
|
160
|
-
//#region src/memory/fileMemoryStore.d.ts
|
|
161
|
-
/**
|
|
162
|
-
* FileMemoryStore:兼容别名,语义同阶段 3。
|
|
163
|
-
* 实现已上移到 runtime 的 FsMemoryStore;node 侧保留 NodeFS 默认值。
|
|
164
|
-
*/
|
|
165
|
-
declare class FileMemoryStore extends FsMemoryStore {
|
|
166
|
-
constructor(deps: {
|
|
167
|
-
root: string;
|
|
168
|
-
fs?: FileSystemProvider;
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
//#endregion
|
|
172
|
-
//#region src/ui/cliUiBridge.d.ts
|
|
173
|
-
/**
|
|
174
|
-
* 命令行 UiBridge:ask→问答,confirm→y/n(带默认值),
|
|
175
|
-
* form→逐字段提示(显示默认值与必填标记),select→编号列表,
|
|
176
|
-
* authorize→授权询问(默认拒绝,仅显式 y/yes 批准)。
|
|
177
|
-
* 输入/输出流可注入(测试用 PassThrough)。
|
|
178
|
-
*/
|
|
179
|
-
declare class CliUiBridge implements UiBridge {
|
|
180
|
-
#private;
|
|
181
|
-
constructor(deps?: {
|
|
182
|
-
input?: Readable;
|
|
183
|
-
output?: Writable;
|
|
184
|
-
});
|
|
185
|
-
request(input: InteractionRequest): Promise<InteractionResponse>;
|
|
186
|
-
progress(input: {
|
|
187
|
-
runId: string;
|
|
188
|
-
message: string;
|
|
189
|
-
value?: number;
|
|
190
|
-
}): Promise<void>;
|
|
191
|
-
renderResult(input: RenderResultRequest): Promise<void>;
|
|
192
|
-
}
|
|
193
|
-
//#endregion
|
|
194
|
-
//#region src/skillManagement/skillManager.d.ts
|
|
195
|
-
/**
|
|
196
|
-
* 技能管理门面:统一安装管线(staging → 解析 name → 校验 → 拷贝 → manifest → lockfile),
|
|
197
|
-
* 任何失败清理现场抛 INSTALL_FAILED。
|
|
198
|
-
* @stable
|
|
199
|
-
*/
|
|
200
|
-
declare class SkillManager {
|
|
201
|
-
#private;
|
|
202
|
-
constructor(deps: {
|
|
203
|
-
managedRoot: string;
|
|
204
|
-
fs?: FileSystemProvider;
|
|
205
|
-
fetchImpl?: typeof fetch;
|
|
206
|
-
/** D2 安装期 schema 预推导(默认 true,可关) */
|
|
207
|
-
schemaInference?: boolean;
|
|
208
|
-
/** 归档体积三重上限(缺省 DEFAULT_ARCHIVE_LIMITS) */
|
|
209
|
-
archiveLimits?: ArchiveLimits;
|
|
210
|
-
/** install/uninstall 成功后的变更回调(宿主接线缓存失效,如 WebSkillRuntime.invalidate) */
|
|
211
|
-
onChanged?: () => void;
|
|
212
|
-
});
|
|
213
|
-
/** 托管根目录(治理发布归档捕获等只读场景) */
|
|
214
|
-
get managedRoot(): string;
|
|
215
|
-
install(source: SkillInstallSource, options?: {
|
|
216
|
-
expectedSha256?: string;
|
|
217
|
-
}): Promise<SkillManifest>;
|
|
218
|
-
uninstall(name: string): Promise<void>;
|
|
219
|
-
verifyIntegrity(name: string): Promise<VerifyResult>;
|
|
220
|
-
listInstalled(): Promise<SkillsLockfile>;
|
|
221
|
-
exportArchive(name: string, options: {
|
|
222
|
-
format: 'zip' | 'tar';
|
|
223
|
-
outPath: string;
|
|
224
|
-
}): Promise<string>;
|
|
225
|
-
/** 多技能包集导出(webskill.skill-pack.json + 各技能目录含 manifest),写 outPath 并返回 */
|
|
226
|
-
exportPack(names: string[], options: {
|
|
227
|
-
outPath: string;
|
|
228
|
-
}): Promise<string>;
|
|
229
|
-
}
|
|
230
|
-
//#endregion
|
|
231
|
-
//#region src/skillManagement/export/archiveExporter.d.ts
|
|
232
|
-
/** 导出技能目录全部文件(含 manifest)为 zip/tar 归档,返回 outPath */
|
|
233
|
-
declare function exportArchive(fs: FileSystemProvider, skillRoot: string, options: {
|
|
234
|
-
format: 'zip' | 'tar';
|
|
235
|
-
outPath: string;
|
|
236
|
-
}): Promise<string>;
|
|
237
|
-
/** 只解出归档中的 webskill.skill-manifest.json 条目(安装前预览) */
|
|
238
|
-
declare function readArchiveManifest(fs: FileSystemProvider, archivePath: string): Promise<SkillManifest>;
|
|
239
|
-
//#endregion
|
|
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 };
|