@webskill/sdk 0.0.1
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/LICENSE +21 -0
- package/README.md +85 -0
- package/dist/browser.d.ts +219 -0
- package/dist/browser.js +856 -0
- package/dist/dist-9fczg9Pa.js +1122 -0
- package/dist/dist-B_ldNWwT.js +1975 -0
- package/dist/dist-RcqvzAGF.js +15382 -0
- package/dist/governance.d.ts +440 -0
- package/dist/governance.js +844 -0
- package/dist/index-88KNOnbr.d.ts +955 -0
- package/dist/index-Bq-bTWh3.d.ts +219 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/mcp.d.ts +237 -0
- package/dist/mcp.js +513 -0
- package/dist/node.d.ts +3 -0
- package/dist/node.js +4 -0
- package/dist/ui-react.d.ts +40 -0
- package/dist/ui-react.js +239 -0
- package/dist/ui-vue.d.ts +72 -0
- package/dist/ui-vue.js +196 -0
- package/dist/ui.d.ts +171 -0
- package/dist/ui.js +4 -0
- package/package.json +91 -0
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { Mt as FileSystemProvider, Rt as SkillCatalogEntry, ht as WebSkillRuntime, j as LlmMessage, k as LlmClient, pt as UiBridge, tt as RuntimeRun } from "./index-88KNOnbr.js";
|
|
2
|
+
import { f as SkillManager, p as SkillManifest } from "./index-Bq-bTWh3.js";
|
|
3
|
+
//#region ../governance/dist/index.d.ts
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
type CandidateStatus = 'draft' | 'pending-review' | 'approved' | 'published' | 'rejected';
|
|
6
|
+
type CandidateSource = 'runtime-miss' | 'document' | 'manual';
|
|
7
|
+
type CandidateRisk = 'low' | 'medium' | 'high';
|
|
8
|
+
interface CandidateFile {
|
|
9
|
+
path: string;
|
|
10
|
+
kind: 'skill-md' | 'script' | 'reference' | 'asset';
|
|
11
|
+
content: string;
|
|
12
|
+
}
|
|
13
|
+
interface CandidateSkill {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
status: CandidateStatus;
|
|
18
|
+
source: CandidateSource;
|
|
19
|
+
risk: CandidateRisk;
|
|
20
|
+
riskReasons: string[];
|
|
21
|
+
files: CandidateFile[];
|
|
22
|
+
suggestedTests?: string[];
|
|
23
|
+
createdAt: string;
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
metadata?: Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
interface AuditEvent {
|
|
28
|
+
id: string;
|
|
29
|
+
type: string;
|
|
30
|
+
target: string;
|
|
31
|
+
actor?: string;
|
|
32
|
+
ts: string;
|
|
33
|
+
data?: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
interface AuditLog {
|
|
36
|
+
append(event: Omit<AuditEvent, 'id' | 'ts'> & {
|
|
37
|
+
id?: string;
|
|
38
|
+
ts?: string;
|
|
39
|
+
}): Promise<AuditEvent>;
|
|
40
|
+
query(filter: {
|
|
41
|
+
target?: string;
|
|
42
|
+
type?: string;
|
|
43
|
+
since?: string;
|
|
44
|
+
}): Promise<AuditEvent[]>;
|
|
45
|
+
}
|
|
46
|
+
interface SkillVersion {
|
|
47
|
+
versionId: string;
|
|
48
|
+
parentVersionId?: string;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
reason: string;
|
|
51
|
+
manifest: SkillManifest;
|
|
52
|
+
auditEventId?: string;
|
|
53
|
+
}
|
|
54
|
+
type SkillState = 'active' | 'quarantined' | 'deprecated' | 'disabled';
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/candidate/candidateNormalizer.d.ts
|
|
57
|
+
/** 剥 markdown fence 与 <think> 块、截取首尾 {};非对象 → CANDIDATE_INVALID */
|
|
58
|
+
declare function parseJsonObject(raw: string): Record<string, unknown>;
|
|
59
|
+
/** 小写连字符化、≤64、过 isValidSkillName */
|
|
60
|
+
declare function sanitizeCandidateName(raw: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* 文件归一:补 SKILL.md;路径含 `..` / 以 `/` 开头 / 含 `\` → CANDIDATE_INVALID;
|
|
63
|
+
* scripts/ 下必须是 .ts/.js。
|
|
64
|
+
*/
|
|
65
|
+
declare function normalizeCandidateFiles(files: Array<{
|
|
66
|
+
path: string;
|
|
67
|
+
content: string;
|
|
68
|
+
}>, name: string, description: string): CandidateFile[];
|
|
69
|
+
/** 含脚本且 LLM 自报 low → 强制 medium 并追加"必须人工审批"原因 */
|
|
70
|
+
declare function normalizeRisk(declared: unknown, files: CandidateFile[], reasons: string[]): {
|
|
71
|
+
risk: CandidateRisk;
|
|
72
|
+
reasons: string[];
|
|
73
|
+
};
|
|
74
|
+
/** 不信任归一化管线全链路;状态恒为 draft */
|
|
75
|
+
declare function normalizeCandidate(input: {
|
|
76
|
+
raw: Record<string, unknown>;
|
|
77
|
+
source: CandidateSource;
|
|
78
|
+
now?: () => string;
|
|
79
|
+
createId?: () => string;
|
|
80
|
+
}): CandidateSkill;
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/candidate/candidateValidator.d.ts
|
|
83
|
+
/** 候选校验:缺 SKILL.md / 非法扩展名 → CANDIDATE_INVALID */
|
|
84
|
+
declare function validateCandidate(candidate: CandidateSkill): void;
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/candidate/candidateStore.d.ts
|
|
87
|
+
/** 逐文件持久化的候选存储:<managedRoot>/.webskill/candidates/<id>.json */
|
|
88
|
+
declare class CandidateStore {
|
|
89
|
+
#private;
|
|
90
|
+
constructor(deps: {
|
|
91
|
+
root: string;
|
|
92
|
+
fs: FileSystemProvider;
|
|
93
|
+
});
|
|
94
|
+
save(candidate: CandidateSkill): Promise<void>;
|
|
95
|
+
get(id: string): Promise<CandidateSkill>;
|
|
96
|
+
list(): Promise<CandidateSkill[]>;
|
|
97
|
+
updateStatus(id: string, status: CandidateStatus, now?: string): Promise<CandidateSkill>;
|
|
98
|
+
}
|
|
99
|
+
/** 硬门禁:仅 published 可转换为 Catalog 条目,否则 APPROVAL_REQUIRED */
|
|
100
|
+
declare function candidateToCatalogEntry(candidate: CandidateSkill): SkillCatalogEntry;
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/candidate/llmCandidateGenerator.d.ts
|
|
103
|
+
/** LLM 候选生成器:prompt 强制约束 + 不信任归一化管线 + candidate.created 审计 */
|
|
104
|
+
declare class LlmCandidateGenerator {
|
|
105
|
+
#private;
|
|
106
|
+
constructor(deps: {
|
|
107
|
+
llm: LlmClient;
|
|
108
|
+
audit?: AuditLog;
|
|
109
|
+
now?: () => string;
|
|
110
|
+
createId?: () => string;
|
|
111
|
+
});
|
|
112
|
+
generate(input: {
|
|
113
|
+
prompt: string;
|
|
114
|
+
source: CandidateSource;
|
|
115
|
+
context?: string;
|
|
116
|
+
}): Promise<CandidateSkill>;
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/approval/policies.d.ts
|
|
120
|
+
interface ApprovalDecision {
|
|
121
|
+
needsHuman: boolean;
|
|
122
|
+
reason: string;
|
|
123
|
+
}
|
|
124
|
+
interface ApprovalPolicy {
|
|
125
|
+
evaluate(candidate: CandidateSkill): ApprovalDecision;
|
|
126
|
+
}
|
|
127
|
+
/** 默认策略:任何候选都必须人工审批 */
|
|
128
|
+
declare class AlwaysHumanApprovalPolicy implements ApprovalPolicy {
|
|
129
|
+
evaluate(candidate: CandidateSkill): ApprovalDecision;
|
|
130
|
+
}
|
|
131
|
+
/** 规则组合策略:首个命中的规则胜出,全部未命中走 fallback(默认 AlwaysHuman) */
|
|
132
|
+
declare class CompositeApprovalPolicy implements ApprovalPolicy {
|
|
133
|
+
#private;
|
|
134
|
+
constructor(rules: Array<(candidate: CandidateSkill) => ApprovalDecision | undefined>, fallback?: ApprovalPolicy);
|
|
135
|
+
evaluate(candidate: CandidateSkill): ApprovalDecision;
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/versioning/skillVersionStore.d.ts
|
|
139
|
+
/** 版本存储:manifest 快照 + parentVersionId 链;回滚 = 追加新版本(谱系不断) */
|
|
140
|
+
declare class SkillVersionStore {
|
|
141
|
+
#private;
|
|
142
|
+
constructor(deps: {
|
|
143
|
+
root: string;
|
|
144
|
+
fs: FileSystemProvider;
|
|
145
|
+
now?: () => string;
|
|
146
|
+
createId?: () => string;
|
|
147
|
+
audit?: AuditLog;
|
|
148
|
+
});
|
|
149
|
+
add(skillName: string, input: {
|
|
150
|
+
reason: string;
|
|
151
|
+
manifest: SkillManifest;
|
|
152
|
+
parentVersionId?: string;
|
|
153
|
+
}): Promise<SkillVersion>;
|
|
154
|
+
list(skillName: string): Promise<SkillVersion[]>;
|
|
155
|
+
get(skillName: string, versionId: string): Promise<SkillVersion>;
|
|
156
|
+
/** 回滚:基于旧 manifest 追加新版本 + skill.rolled_back 审计 */
|
|
157
|
+
rollback(skillName: string, targetVersionId: string, input: {
|
|
158
|
+
actor?: string;
|
|
159
|
+
reason?: string;
|
|
160
|
+
}): Promise<SkillVersion>;
|
|
161
|
+
}
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region src/approval/approvalWorkflow.d.ts
|
|
164
|
+
/** 审批工作流:review(UiBridge confirm 真实接线)/ publish(校验→安装→版本→审计) */
|
|
165
|
+
declare class ApprovalWorkflow {
|
|
166
|
+
#private;
|
|
167
|
+
constructor(deps: {
|
|
168
|
+
policy: ApprovalPolicy;
|
|
169
|
+
audit: AuditLog;
|
|
170
|
+
store: CandidateStore;
|
|
171
|
+
skillManager: SkillManager;
|
|
172
|
+
versions: SkillVersionStore;
|
|
173
|
+
fs?: FileSystemProvider;
|
|
174
|
+
});
|
|
175
|
+
/** 策略评估;needs-human 时经 UiBridge confirm 真实询问,按应答迁移状态 */
|
|
176
|
+
review(candidateId: string, input: {
|
|
177
|
+
actor: string;
|
|
178
|
+
uiBridge?: UiBridge;
|
|
179
|
+
}): Promise<CandidateSkill>;
|
|
180
|
+
/** publish 全链路:approved 前置 → 写出 staging → validateSkills → install → 版本 → 审计 */
|
|
181
|
+
publish(candidateId: string, input: {
|
|
182
|
+
actor: string;
|
|
183
|
+
}): Promise<SkillManifest>;
|
|
184
|
+
}
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region src/audit/fsAuditLog.d.ts
|
|
187
|
+
/** JSONL 追加的审计日志:<managedRoot>/.webskill/audit.jsonl;跨实例可恢复查询 */
|
|
188
|
+
declare class FsAuditLog implements AuditLog {
|
|
189
|
+
#private;
|
|
190
|
+
constructor(deps: {
|
|
191
|
+
root: string;
|
|
192
|
+
fs: FileSystemProvider;
|
|
193
|
+
now?: () => string;
|
|
194
|
+
createId?: () => string;
|
|
195
|
+
});
|
|
196
|
+
append(event: Omit<AuditEvent, 'id' | 'ts'> & {
|
|
197
|
+
id?: string;
|
|
198
|
+
ts?: string;
|
|
199
|
+
}): Promise<AuditEvent>;
|
|
200
|
+
query(filter: {
|
|
201
|
+
target?: string;
|
|
202
|
+
type?: string;
|
|
203
|
+
since?: string;
|
|
204
|
+
}): Promise<AuditEvent[]>;
|
|
205
|
+
}
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/repair/failureAnalyzer.d.ts
|
|
208
|
+
interface FailureDiagnosis {
|
|
209
|
+
cause: string;
|
|
210
|
+
suggestedFix: string;
|
|
211
|
+
errorCode?: string;
|
|
212
|
+
}
|
|
213
|
+
/** 失败诊断:trace 摘要 → LLM 诊断(JSON);无 LLM 时规则版(错误码归类) */
|
|
214
|
+
declare class FailureAnalyzer {
|
|
215
|
+
#private;
|
|
216
|
+
constructor(deps?: {
|
|
217
|
+
llm?: LlmClient;
|
|
218
|
+
});
|
|
219
|
+
analyze(input: {
|
|
220
|
+
run: RuntimeRun;
|
|
221
|
+
}): Promise<FailureDiagnosis>;
|
|
222
|
+
}
|
|
223
|
+
//#endregion
|
|
224
|
+
//#region src/repair/repairPlanner.d.ts
|
|
225
|
+
interface RepairOption {
|
|
226
|
+
kind: 'patch' | 'rollback' | 'quarantine';
|
|
227
|
+
description: string;
|
|
228
|
+
patch?: Array<{
|
|
229
|
+
path: string;
|
|
230
|
+
content: string;
|
|
231
|
+
}>;
|
|
232
|
+
targetVersionId?: string;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* 修订选项规划:patch(按诊断给具体文件变更)/ rollback(有旧版本时)/ quarantine。
|
|
236
|
+
* 注意:任何 option 的 apply 都必须经 ApprovalWorkflow 审批后执行。
|
|
237
|
+
*/
|
|
238
|
+
declare class RepairPlanner {
|
|
239
|
+
plan(input: {
|
|
240
|
+
diagnosis: FailureDiagnosis;
|
|
241
|
+
skillName: string;
|
|
242
|
+
versions: SkillVersion[];
|
|
243
|
+
}): RepairOption[];
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/state/skillStatePolicy.d.ts
|
|
247
|
+
/**
|
|
248
|
+
* 降级治理:states.json 持久化;失败达阈值 → quarantined;
|
|
249
|
+
* canRoute 仅 active;canExecute active|deprecated;disabled 执行抛 SKILL_DISABLED;
|
|
250
|
+
* 卸载/状态变更经 UiBridge confirm 审批。
|
|
251
|
+
*/
|
|
252
|
+
declare class SkillStatePolicy {
|
|
253
|
+
#private;
|
|
254
|
+
constructor(deps: {
|
|
255
|
+
root: string;
|
|
256
|
+
fs: FileSystemProvider;
|
|
257
|
+
audit?: AuditLog;
|
|
258
|
+
failureThreshold?: number;
|
|
259
|
+
});
|
|
260
|
+
getState(skillName: string): Promise<SkillState>;
|
|
261
|
+
listStates(): Promise<Record<string, SkillState>>;
|
|
262
|
+
setState(skillName: string, state: SkillState, input: {
|
|
263
|
+
actor?: string;
|
|
264
|
+
reason?: string;
|
|
265
|
+
}): Promise<void>;
|
|
266
|
+
/** 失败计数;达阈值(默认 3)→ quarantined + 审计 */
|
|
267
|
+
recordFailure(skillName: string, input?: {
|
|
268
|
+
actor?: string;
|
|
269
|
+
}): Promise<SkillState>;
|
|
270
|
+
canRoute(state: SkillState): boolean;
|
|
271
|
+
canExecute(state: SkillState): boolean;
|
|
272
|
+
/** disabled → SKILL_DISABLED;quarantined → SKILL_QUARANTINED */
|
|
273
|
+
assertExecutable(skillName: string): Promise<void>;
|
|
274
|
+
/** runtime catalogFilter 实现:quarantined/deprecated/disabled 技能被路由过滤 */
|
|
275
|
+
catalogFilter(): (entries: SkillCatalogEntry[]) => Promise<SkillCatalogEntry[]>;
|
|
276
|
+
/** 卸载需显式审批(UiBridge confirm 真实接线);拒绝 → APPROVAL_REQUIRED */
|
|
277
|
+
uninstall(skillName: string, input: {
|
|
278
|
+
actor: string;
|
|
279
|
+
uiBridge: UiBridge;
|
|
280
|
+
skillManager: SkillManager;
|
|
281
|
+
}): Promise<void>;
|
|
282
|
+
}
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region src/evaluation/types.d.ts
|
|
285
|
+
interface EvaluationTask {
|
|
286
|
+
id: string;
|
|
287
|
+
prompt: string;
|
|
288
|
+
/** 字符串 → output 包含判定;函数 → 自定义判定 */
|
|
289
|
+
expected?: string | ((output: string, run: RuntimeRun) => boolean);
|
|
290
|
+
skillNames?: string[];
|
|
291
|
+
metadata?: Record<string, unknown>;
|
|
292
|
+
}
|
|
293
|
+
interface EvaluationResult {
|
|
294
|
+
taskId: string;
|
|
295
|
+
ok: boolean;
|
|
296
|
+
score: number;
|
|
297
|
+
output?: string;
|
|
298
|
+
error?: string;
|
|
299
|
+
}
|
|
300
|
+
interface EvaluationReport {
|
|
301
|
+
id: string;
|
|
302
|
+
generatedAt: string;
|
|
303
|
+
results: EvaluationResult[];
|
|
304
|
+
summary: {
|
|
305
|
+
total: number;
|
|
306
|
+
passed: number;
|
|
307
|
+
failed: number;
|
|
308
|
+
averageScore?: number;
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
//#endregion
|
|
312
|
+
//#region src/evaluation/evaluationRunner.d.ts
|
|
313
|
+
/** 批量评估:顺序执行(单任务异常不中断批);expected 参与判定;结构化报告 */
|
|
314
|
+
declare class EvaluationRunner {
|
|
315
|
+
#private;
|
|
316
|
+
constructor(deps: {
|
|
317
|
+
runtime: WebSkillRuntime;
|
|
318
|
+
now?: () => string;
|
|
319
|
+
createId?: () => string;
|
|
320
|
+
});
|
|
321
|
+
run(tasks: EvaluationTask[]): Promise<EvaluationReport>;
|
|
322
|
+
}
|
|
323
|
+
//#endregion
|
|
324
|
+
//#region src/evaluation/testSuggestion.d.ts
|
|
325
|
+
/** 失败 trace → 回归评估任务建议(prompt 复现 + expected 错误模式) */
|
|
326
|
+
declare function suggestFromFailedRun(run: RuntimeRun): EvaluationTask;
|
|
327
|
+
//#endregion
|
|
328
|
+
//#region src/scoring/skillScorer.d.ts
|
|
329
|
+
declare const SCORING_WEIGHTS: {
|
|
330
|
+
readonly success: 0.5;
|
|
331
|
+
readonly usage: 0.2;
|
|
332
|
+
readonly eval: 0.2;
|
|
333
|
+
readonly risk: 0.1;
|
|
334
|
+
};
|
|
335
|
+
interface ScoreInput {
|
|
336
|
+
/** 0..1(skill:{name} memory 的 successes/(successes+failures)) */
|
|
337
|
+
successRate: number;
|
|
338
|
+
usageCount: number;
|
|
339
|
+
/** 0..1,缺省按 0 计 */
|
|
340
|
+
evalScore?: number;
|
|
341
|
+
risk: 'low' | 'medium' | 'high';
|
|
342
|
+
/** usage 归一基线(默认 100 次 = 1.0) */
|
|
343
|
+
usageBaseline?: number;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* 综合评分:successRate*W_SUCCESS + usageNorm*W_USAGE + evalScore*W_EVAL − risk*W_RISK
|
|
347
|
+
* (clamp [0,1]);低于阈值给 improve 建议。usage 数据来自 skill:{name} memory scope。
|
|
348
|
+
*/
|
|
349
|
+
declare class SkillScorer {
|
|
350
|
+
#private;
|
|
351
|
+
constructor(weights?: {
|
|
352
|
+
success: number;
|
|
353
|
+
usage: number;
|
|
354
|
+
eval: number;
|
|
355
|
+
risk: number;
|
|
356
|
+
}, improveThreshold?: number);
|
|
357
|
+
score(input: ScoreInput): {
|
|
358
|
+
value: number;
|
|
359
|
+
suggestion?: string;
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
//#endregion
|
|
363
|
+
//#region src/scoring/similarity.d.ts
|
|
364
|
+
declare function jaccardSimilarity(a: string, b: string): number;
|
|
365
|
+
/** 描述词集 Jaccard 查重 */
|
|
366
|
+
declare class SimilarityDetector {
|
|
367
|
+
#private;
|
|
368
|
+
constructor(threshold?: number);
|
|
369
|
+
/** 返回首个超过阈值的已有技能名;无重复返回 undefined */
|
|
370
|
+
findDuplicate(description: string, existing: Array<{
|
|
371
|
+
name: string;
|
|
372
|
+
description: string;
|
|
373
|
+
}>): string | undefined;
|
|
374
|
+
}
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region src/scoring/dependencyGraph.d.ts
|
|
377
|
+
/** 技能引用依赖图(references/ 中引用其他技能的声明关系) */
|
|
378
|
+
declare class DependencyGraph {
|
|
379
|
+
#private;
|
|
380
|
+
addDependency(from: string, to: string): void;
|
|
381
|
+
dependenciesOf(name: string): string[];
|
|
382
|
+
dependentsOf(name: string): string[];
|
|
383
|
+
}
|
|
384
|
+
//#endregion
|
|
385
|
+
//#region src/documents/documentSource.d.ts
|
|
386
|
+
interface SourceDocument {
|
|
387
|
+
path: string;
|
|
388
|
+
content: string;
|
|
389
|
+
hash: string;
|
|
390
|
+
}
|
|
391
|
+
/** 读文档 + sha256 hash(变更检测用) */
|
|
392
|
+
declare function readDocument(fs: FileSystemProvider, path: string): Promise<SourceDocument>;
|
|
393
|
+
//#endregion
|
|
394
|
+
//#region src/documents/documentSkillExtractor.d.ts
|
|
395
|
+
/** 文档 → LLM 抽取 → 完整防御管线 → draft 候选(source: document) */
|
|
396
|
+
declare class DocumentSkillExtractor {
|
|
397
|
+
#private;
|
|
398
|
+
constructor(deps: {
|
|
399
|
+
llm: LlmClient;
|
|
400
|
+
audit?: AuditLog;
|
|
401
|
+
now?: () => string;
|
|
402
|
+
createId?: () => string;
|
|
403
|
+
});
|
|
404
|
+
extract(input: {
|
|
405
|
+
document: SourceDocument;
|
|
406
|
+
nameHint?: string;
|
|
407
|
+
}): Promise<CandidateSkill>;
|
|
408
|
+
/** hash 变化 → 生成新候选(关联原技能名,不覆盖已发布技能);无变化返回 changed:false */
|
|
409
|
+
checkUpdate(input: {
|
|
410
|
+
document: SourceDocument;
|
|
411
|
+
previousHash: string;
|
|
412
|
+
previousSkillName?: string;
|
|
413
|
+
}): Promise<{
|
|
414
|
+
changed: boolean;
|
|
415
|
+
candidate?: CandidateSkill;
|
|
416
|
+
}>;
|
|
417
|
+
}
|
|
418
|
+
//#endregion
|
|
419
|
+
//#region src/missHook.d.ts
|
|
420
|
+
/**
|
|
421
|
+
* runtime-miss 现成适配(opt-in):run 未激活技能时生成 draft 候选入库待审。
|
|
422
|
+
* 返回的 hook 失败会向上抛(由 runtime 降级为 warning)。
|
|
423
|
+
*/
|
|
424
|
+
declare function createMissHook(deps: {
|
|
425
|
+
generator: LlmCandidateGenerator;
|
|
426
|
+
store: CandidateStore;
|
|
427
|
+
audit?: AuditLog;
|
|
428
|
+
}): (input: {
|
|
429
|
+
prompt: string;
|
|
430
|
+
run: RuntimeRun;
|
|
431
|
+
}) => Promise<void>;
|
|
432
|
+
//#endregion
|
|
433
|
+
//#region src/llmText.d.ts
|
|
434
|
+
/**
|
|
435
|
+
* 文本补全:优先走流式(慢速本地模型下非流式整响应缓冲会触发 fetch 头超时,
|
|
436
|
+
* SSE 首包秒到不受此限);无 stream 的客户端回退 complete。
|
|
437
|
+
*/
|
|
438
|
+
declare function completeText(llm: LlmClient, messages: LlmMessage[]): Promise<string>;
|
|
439
|
+
//#endregion
|
|
440
|
+
export { AlwaysHumanApprovalPolicy, type ApprovalDecision, type ApprovalPolicy, ApprovalWorkflow, type AuditEvent, type AuditLog, type CandidateFile, type CandidateRisk, type CandidateSkill, type CandidateSource, type CandidateStatus, CandidateStore, CompositeApprovalPolicy, DependencyGraph, DocumentSkillExtractor, type EvaluationReport, type EvaluationResult, EvaluationRunner, type EvaluationTask, FailureAnalyzer, type FailureDiagnosis, FsAuditLog, LlmCandidateGenerator, type RepairOption, RepairPlanner, SCORING_WEIGHTS, type ScoreInput, SimilarityDetector, SkillScorer, type SkillState, SkillStatePolicy, type SkillVersion, SkillVersionStore, type SourceDocument, candidateToCatalogEntry, completeText, createMissHook, jaccardSimilarity, normalizeCandidate, normalizeCandidateFiles, normalizeRisk, parseJsonObject, readDocument, sanitizeCandidateName, suggestFromFailedRun, validateCandidate };
|