@webskill/sdk 0.2.7 → 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.
@@ -125,13 +125,17 @@ var OpenAiCompatibleClient = class {
125
125
  type: "tool-calls",
126
126
  toolCalls: [...toolCallsByIndex.entries()].sort(([a], [b]) => a - b).map(([index, acc]) => {
127
127
  let args = {};
128
+ let parseError;
128
129
  try {
129
130
  args = JSON.parse(acc.arguments || "{}");
130
- } catch {}
131
+ } catch (e) {
132
+ parseError = e instanceof Error ? e.message : String(e);
133
+ }
131
134
  return {
132
135
  id: acc.id || `call-${index}`,
133
136
  name: acc.name,
134
- arguments: args
137
+ arguments: args,
138
+ ...parseError ? { argumentsParseError: parseError } : {}
135
139
  };
136
140
  })
137
141
  };
@@ -358,13 +362,17 @@ var AnthropicClient = class {
358
362
  type: "tool-calls",
359
363
  toolCalls: [...toolCallsByIndex.entries()].sort(([a], [b]) => a - b).map(([index, acc]) => {
360
364
  let args = {};
365
+ let parseError;
361
366
  try {
362
367
  args = JSON.parse(acc.arguments || "{}");
363
- } catch {}
368
+ } catch (e) {
369
+ parseError = e instanceof Error ? e.message : String(e);
370
+ }
364
371
  return {
365
372
  id: acc.id || `call-${index}`,
366
373
  name: acc.name,
367
- arguments: args
374
+ arguments: args,
375
+ ...parseError ? { argumentsParseError: parseError } : {}
368
376
  };
369
377
  })
370
378
  };
@@ -1896,7 +1904,8 @@ var AgentLoop = class {
1896
1904
  } });
1897
1905
  this.#emitTool(state, "started", call);
1898
1906
  let result;
1899
- if (call.name === "read_skill_file") result = await this.#handleReadSkillFile(call, state);
1907
+ if (call.argumentsParseError) result = toolError("VALIDATION_FAILED", `Tool arguments were not valid JSON: ${call.argumentsParseError}`);
1908
+ else if (call.name === "read_skill_file") result = await this.#handleReadSkillFile(call, state);
1900
1909
  else if (call.name === "ask_user") result = await this.#handleAskUser(call, state);
1901
1910
  else {
1902
1911
  const resolution = resolveToolName(call.name, state.activated);
@@ -2264,8 +2273,9 @@ var AgentLoop = class {
2264
2273
  let scriptFiles;
2265
2274
  try {
2266
2275
  scriptFiles = (await this.#deps.fs.list(`${root}/scripts`)).filter((s) => s.type === "file").map((s) => baseName(s.path));
2267
- } catch {
2276
+ } catch (e) {
2268
2277
  scriptFiles = [];
2278
+ if (!(e instanceof WebSkillError && e.code === "FS_NOT_FOUND")) state.trace.record("run.warning", { message: `Failed to list scripts of skill "${skillName}": ${messageOf(e)}` });
2269
2279
  }
2270
2280
  for (const file of scriptFiles) {
2271
2281
  const match = /^(.*)\.(ts|js)$/.exec(file);
@@ -2402,10 +2412,11 @@ var AgentLoop = class {
2402
2412
  #nextInteractionId(state) {
2403
2413
  return `int-${++state.interactionSeq}`;
2404
2414
  }
2405
- async #memoryGet(scope, key) {
2415
+ async #memoryGet(scope, key, state) {
2406
2416
  try {
2407
2417
  return await this.#deps.memory?.get(scope, key);
2408
- } catch {
2418
+ } catch (e) {
2419
+ state.trace.record("run.warning", { message: `Memory read failed: ${messageOf(e)}` });
2409
2420
  return;
2410
2421
  }
2411
2422
  }
@@ -2430,7 +2441,7 @@ var AgentLoop = class {
2430
2441
  }
2431
2442
  return;
2432
2443
  }
2433
- await this.#memorySet(scope, key, mutate(await this.#memoryGet(scope, key)), state);
2444
+ await this.#memorySet(scope, key, mutate(await this.#memoryGet(scope, key, state)), state);
2434
2445
  }
2435
2446
  async #writeActivationMemory(skillName, state) {
2436
2447
  if (!this.#deps.memory) return;
@@ -2962,9 +2973,26 @@ const encode = (s) => encodeURIComponent(s);
2962
2973
  var FsMemoryStore = class {
2963
2974
  #root;
2964
2975
  #fs;
2976
+ #onWarning;
2965
2977
  constructor(deps) {
2966
2978
  this.#root = deps.root.replace(/\/+$/, "");
2967
2979
  this.#fs = deps.fs;
2980
+ this.#onWarning = deps.onWarning ?? ((message) => console.warn(message));
2981
+ }
2982
+ /**
2983
+ * 0.2.8 G2:损坏条目此前直接 remove——静默销毁用户数据,且对调用方伪装成「没有这条记忆」。
2984
+ * 改为隔离到 .corrupt 并告警:run 照常继续,但数据留存、故障可见。
2985
+ */
2986
+ async #quarantine(path, error) {
2987
+ const reason = error instanceof Error ? error.message : String(error);
2988
+ const target = `${path}.corrupt`;
2989
+ try {
2990
+ await this.#fs.rename(path, target);
2991
+ this.#onWarning(`[webskill] Corrupted memory entry quarantined to ${target}: ${reason}`);
2992
+ } catch (renameError) {
2993
+ const detail = renameError instanceof Error ? renameError.message : String(renameError);
2994
+ this.#onWarning(`[webskill] Corrupted memory entry at ${path} could not be quarantined (${detail}): ${reason}`);
2995
+ }
2968
2996
  }
2969
2997
  #scopeDir(scope) {
2970
2998
  return `${this.#root}/${encode(scope)}`;
@@ -2977,8 +3005,8 @@ var FsMemoryStore = class {
2977
3005
  if (!await this.#fs.exists(path)) return void 0;
2978
3006
  try {
2979
3007
  return JSON.parse(await this.#fs.readText(path));
2980
- } catch {
2981
- await this.#fs.remove(path);
3008
+ } catch (e) {
3009
+ await this.#quarantine(path, e);
2982
3010
  return;
2983
3011
  }
2984
3012
  }
@@ -3002,8 +3030,8 @@ var FsMemoryStore = class {
3002
3030
  key,
3003
3031
  value: JSON.parse(await this.#fs.readText(entry.path))
3004
3032
  });
3005
- } catch {
3006
- await this.#fs.remove(entry.path);
3033
+ } catch (e) {
3034
+ await this.#quarantine(entry.path, e);
3007
3035
  }
3008
3036
  }
3009
3037
  return out.sort((a, b) => a.key.localeCompare(b.key));
@@ -3027,9 +3055,11 @@ const INDEX_FILE = "index.json";
3027
3055
  var FsArtifactStore = class {
3028
3056
  #root;
3029
3057
  #fs;
3058
+ #onWarning;
3030
3059
  constructor(deps) {
3031
3060
  this.#root = deps.root.replace(/\/+$/, "");
3032
3061
  this.#fs = deps.fs;
3062
+ this.#onWarning = deps.onWarning ?? ((message) => console.warn(message));
3033
3063
  }
3034
3064
  async createTextArtifact(input) {
3035
3065
  const size = new TextEncoder().encode(input.content).length;
@@ -3055,8 +3085,15 @@ var FsArtifactStore = class {
3055
3085
  const raw = await this.#fs.readText(indexPath);
3056
3086
  try {
3057
3087
  return JSON.parse(raw).artifacts ?? [];
3058
- } catch {
3059
- await this.#fs.remove(indexPath);
3088
+ } catch (e) {
3089
+ const reason = e instanceof Error ? e.message : String(e);
3090
+ try {
3091
+ await this.#fs.rename(indexPath, `${indexPath}.corrupt`);
3092
+ this.#onWarning(`[webskill] Corrupted artifact index for run ${runId} quarantined to ${indexPath}.corrupt: ${reason}`);
3093
+ } catch (renameError) {
3094
+ const detail = renameError instanceof Error ? renameError.message : String(renameError);
3095
+ this.#onWarning(`[webskill] Corrupted artifact index for run ${runId} could not be quarantined (${detail}): ${reason}`);
3096
+ }
3060
3097
  return [];
3061
3098
  }
3062
3099
  }
@@ -3170,6 +3207,20 @@ function networkUrlHost(url) {
3170
3207
  return "(unparseable-url)";
3171
3208
  }
3172
3209
  }
3210
+ /**
3211
+ * 网络策略判定逻辑的可注入源码(单一来源)。
3212
+ *
3213
+ * 0.2.8 C4:此前各注入点直接拼 `isNetworkAllowed.toString()`,依赖**函数名在产物里保持不变**。
3214
+ * SDK 自身不压缩,但消费方一旦跑生产构建,打包器会把导出函数改名(`function Ke(...)`),
3215
+ * 注入后的沙箱里 `isNetworkAllowed` 就是 undefined —— 沙箱内任何 fetch 直接
3216
+ * TOOL_EXECUTION_FAILED,网络白名单形同虚设。dev server 不压缩,所以只在真实产物上暴露。
3217
+ *
3218
+ * 因此改为把函数源码绑定到**固定的变量名**上:`var isNetworkAllowed = function Ke(...) {…};`
3219
+ * ——名字随便压缩,绑定名恒定。两个函数都自包含(不引用模块内其它符号),故可独立绑定。
3220
+ */
3221
+ function networkPolicyLibSource() {
3222
+ return `var isNetworkAllowed = ${isNetworkAllowed.toString()};\nvar networkUrlHost = ${networkUrlHost.toString()};`;
3223
+ }
3173
3224
  /** WebSkillErrorCode 全量白名单(错误码归一用;与 core errors.ts 保持同步) */
3174
3225
  const WHITELIST = /* @__PURE__ */ new Set([
3175
3226
  "FS_NOT_FOUND",
@@ -3283,4 +3334,4 @@ var CapabilityApproval = class CapabilityApproval {
3283
3334
  };
3284
3335
 
3285
3336
  //#endregion
3286
- export { fromVercelStreamPart as A, toLlmToolSpec as B, bridgeError as C, extractChartSpec as D, createWebSkillApi as E, normalizeToolContent as F, validateUiSurface as H, normalizeToolError as I, parseBridgeRequest as L, mergeCatalogEntries as M, networkUrlHost as N, extractUiSurfaceEvents as O, normalizeErrorCode as P, resolveToolName as R, WebSkillRuntime as S, createScriptContext as T, validateUiSurfaceEvent as U, toVercelToolSpecs as V, READ_SKILL_FILE_TOOL as _, AnthropicClient as a, SerializingMemoryStore as b, FsArtifactStore as c, FullDisclosureRouter as d, GoogleGenAiClient as f, READ_SKILL_FILE_INPUT_SCHEMA as g, ProgressiveRouter as h, AgentLoop as i, isNetworkAllowed as j, fromVercelResult as k, FsMemoryStore as l, OpenAiCompatibleClient as m, ASK_USER_TOOL as n, CapabilityApproval as o, HookRunner as p, ASK_USER_TOOL_NAME as r, EventBus as s, ASK_USER_INPUT_SCHEMA as t, FsRunSnapshotStore as u, READ_SKILL_FILE_TOOL_NAME as v, buildRenderResult as w, TraceRecorder as x, RUN_SNAPSHOT_SCHEMA_VERSION as y, schemaToForm as z };
3337
+ export { fromVercelStreamPart as A, schemaToForm as B, bridgeError as C, extractChartSpec as D, createWebSkillApi as E, normalizeErrorCode as F, toVercelToolSpecs as H, normalizeToolContent as I, normalizeToolError as L, mergeCatalogEntries as M, networkPolicyLibSource as N, extractUiSurfaceEvents as O, networkUrlHost as P, parseBridgeRequest as R, WebSkillRuntime as S, createScriptContext as T, validateUiSurface as U, toLlmToolSpec as V, validateUiSurfaceEvent as W, READ_SKILL_FILE_TOOL as _, AnthropicClient as a, SerializingMemoryStore as b, FsArtifactStore as c, FullDisclosureRouter as d, GoogleGenAiClient as f, READ_SKILL_FILE_INPUT_SCHEMA as g, ProgressiveRouter as h, AgentLoop as i, isNetworkAllowed as j, fromVercelResult as k, FsMemoryStore as l, OpenAiCompatibleClient as m, ASK_USER_TOOL as n, CapabilityApproval as o, HookRunner as p, ASK_USER_TOOL_NAME as r, EventBus as s, ASK_USER_INPUT_SCHEMA as t, FsRunSnapshotStore as u, READ_SKILL_FILE_TOOL_NAME as v, buildRenderResult as w, TraceRecorder as x, RUN_SNAPSHOT_SCHEMA_VERSION as y, resolveToolName as z };
@@ -1,85 +1,37 @@
1
- import { G as SkillDocument, N as FileSystemProvider, U as SkillCatalogEntry, Y as SkillManifest, c as LlmClient, u as LlmMessage, v as UiBridge } from "./types-7fnqDVrf-BnRQjVU3.js";
2
- import { Q as ScriptExecutor, dt as WebSkillRuntime, ft as WebSkillRuntimeDeps, q as RuntimeRun, tt as SkillStateGuard } from "./index-BpIK7tJM.js";
3
- import { d as SkillManager } from "./index-BHL5FWGw.js";
4
- //#region ../governance/dist/documentSource-9dhqKIVQ.d.ts
5
- //#region src/types.d.ts
6
- type CandidateStatus = 'draft' | 'pending-review' | 'approved' | 'published' | 'rejected';
7
- type CandidateSource = 'runtime-miss' | 'document' | 'manual';
8
- type CandidateRisk = 'low' | 'medium' | 'high';
9
- interface CandidateFile {
1
+ import { G as SkillDocument, N as FileSystemProvider, U as SkillCatalogEntry, c as LlmClient, u as LlmMessage, v as UiBridge } from "./types-AmKCKJn_-BogJPQHU.js";
2
+ import { dt as WebSkillRuntime, q as RuntimeRun, tt as SkillStateGuard } from "./index-QrHtAudz.js";
3
+ import { D as SkillManager, a as AuditLog, c as CandidateSkill, d as CandidateStore, f as CompositeApprovalPolicy, g as candidateToCatalogEntry, h as SkillVersionStore, i as AuditEvent, l as CandidateSource, m as SkillVersion, n as ApprovalDecision, o as CandidateFile, p as SkillState, r as ApprovalPolicy, s as CandidateRisk, t as AlwaysHumanApprovalPolicy, u as CandidateStatus } from "./skillVersionStore-B7rGjtMi-BgnQho9v.js";
4
+ //#region ../governance/dist/index.d.ts
5
+ //#region src/candidate/candidateNormalizer.d.ts
6
+ /** markdown fence <think> 块、截取首尾 {};非对象 CANDIDATE_INVALID */
7
+ declare function parseJsonObject(raw: string): Record<string, unknown>;
8
+ /** 小写连字符化、≤64、过 isValidSkillName */
9
+ declare function sanitizeCandidateName(raw: string): string;
10
+ /**
11
+ * 文件归一:补 SKILL.md;路径含 `..` / 以 `/` 开头 / 含 `\` → CANDIDATE_INVALID;
12
+ * scripts/ 下必须是 .ts/.js。
13
+ */
14
+ declare function normalizeCandidateFiles(files: Array<{
10
15
  path: string;
11
- kind: 'skill-md' | 'script' | 'reference' | 'asset';
12
16
  content: string;
13
- }
14
- interface CandidateSkill {
15
- id: string;
16
- name: string;
17
- description: string;
18
- status: CandidateStatus;
19
- source: CandidateSource;
17
+ }>, name: string, description: string): CandidateFile[];
18
+ /** 含脚本且 LLM 自报 low → 强制 medium 并追加"必须人工审批"原因 */
19
+ declare function normalizeRisk(declared: unknown, files: CandidateFile[], reasons: string[]): {
20
20
  risk: CandidateRisk;
21
- riskReasons: string[];
22
- files: CandidateFile[];
23
- suggestedTests?: string[];
24
- createdAt: string;
25
- updatedAt: string;
26
- metadata?: Record<string, unknown>;
27
- }
28
- interface AuditEvent {
29
- id: string;
30
- type: string;
31
- target: string;
32
- actor?: string;
33
- ts: string;
34
- data?: Record<string, unknown>;
35
- /** hash 链:上一条事件的 hash(首条为 GENESIS) */
36
- prevHash?: string;
37
- /** 本事件规范化载荷 + prevHash 的 sha256 */
38
- hash?: string;
39
- }
40
- interface AuditLog {
41
- append(event: Omit<AuditEvent, 'id' | 'ts'> & {
42
- id?: string;
43
- ts?: string;
44
- }): Promise<AuditEvent>;
45
- query(filter: {
46
- target?: string;
47
- type?: string;
48
- since?: string;
49
- }): Promise<AuditEvent[]>;
50
- }
51
- interface SkillVersion {
52
- versionId: string;
53
- parentVersionId?: string;
54
- createdAt: string;
55
- reason: string;
56
- manifest: SkillManifest;
57
- auditEventId?: string;
58
- /** 发布时捕获的技能归档(zip 相对路径,applyRollback 恢复用;0.2.0 起记录) */
59
- archivePath?: string;
60
- }
61
- type SkillState = 'active' | 'quarantined' | 'deprecated' | 'disabled';
21
+ reasons: string[];
22
+ };
23
+ /** 不信任归一化管线全链路;状态恒为 draft */
24
+ declare function normalizeCandidate(input: {
25
+ raw: Record<string, unknown>;
26
+ source: CandidateSource;
27
+ now?: () => string;
28
+ createId?: () => string;
29
+ }): CandidateSkill;
62
30
  //#endregion
63
31
  //#region src/candidate/candidateValidator.d.ts
64
32
  /** 候选校验:缺 SKILL.md / 非法扩展名 → CANDIDATE_INVALID */
65
33
  declare function validateCandidate(candidate: CandidateSkill): void;
66
34
  //#endregion
67
- //#region src/candidate/candidateStore.d.ts
68
- /** 逐文件持久化的候选存储:<managedRoot>/.webskill/candidates/<id>.json */
69
- declare class CandidateStore {
70
- #private;
71
- constructor(deps: {
72
- root: string;
73
- fs: FileSystemProvider;
74
- });
75
- save(candidate: CandidateSkill): Promise<void>;
76
- get(id: string): Promise<CandidateSkill>;
77
- list(): Promise<CandidateSkill[]>;
78
- updateStatus(id: string, status: CandidateStatus, now?: string): Promise<CandidateSkill>;
79
- }
80
- /** 硬门禁:仅 published 可转换为 Catalog 条目,否则 APPROVAL_REQUIRED */
81
- declare function candidateToCatalogEntry(candidate: CandidateSkill): SkillCatalogEntry;
82
- //#endregion
83
35
  //#region src/candidate/llmCandidateGenerator.d.ts
84
36
  /** LLM 候选生成器:prompt 强制约束 + 不信任归一化管线 + candidate.created 审计 */
85
37
  declare class LlmCandidateGenerator {
@@ -97,37 +49,6 @@ declare class LlmCandidateGenerator {
97
49
  }): Promise<CandidateSkill>;
98
50
  }
99
51
  //#endregion
100
- //#region src/versioning/skillVersionStore.d.ts
101
- /** 版本存储:manifest 快照 + parentVersionId 链;回滚 = 追加新版本(谱系不断)。
102
- * 保留策略:maxArchivesPerSkill(默认 5)超出时清理最旧版本(json + zip 归档一并删除)。 */
103
- declare class SkillVersionStore {
104
- #private;
105
- constructor(deps: {
106
- root: string;
107
- fs: FileSystemProvider;
108
- now?: () => string;
109
- createId?: () => string;
110
- audit?: AuditLog;
111
- /** 每技能保留的版本/归档上限(默认 5,超出清理最旧) */
112
- maxArchivesPerSkill?: number;
113
- });
114
- add(skillName: string, input: {
115
- reason: string;
116
- manifest: SkillManifest;
117
- parentVersionId?: string;
118
- archive?: Uint8Array;
119
- }): Promise<SkillVersion>;
120
- /** 读取版本归档字节(applyRollback 用;未捕获归档的旧版本 → GOVERNANCE_FAILED) */
121
- readArchive(skillName: string, versionId: string): Promise<Uint8Array>;
122
- list(skillName: string): Promise<SkillVersion[]>;
123
- get(skillName: string, versionId: string): Promise<SkillVersion>;
124
- /** 回滚:基于旧 manifest 追加新版本 + skill.rolled_back 审计 */
125
- rollback(skillName: string, targetVersionId: string, input: {
126
- actor?: string;
127
- reason?: string;
128
- }): Promise<SkillVersion>;
129
- }
130
- //#endregion
131
52
  //#region src/audit/fsAuditLog.d.ts
132
53
  interface AuditChainVerification {
133
54
  ok: boolean;
@@ -167,6 +88,8 @@ interface FailureDiagnosis {
167
88
  cause: string;
168
89
  suggestedFix: string;
169
90
  errorCode?: string;
91
+ /** 诊断来源:'llm' 为模型输出,'rules' 为错误码归类兑底 */
92
+ source: 'llm' | 'rules';
170
93
  }
171
94
  /** 失败诊断:trace 摘要 → LLM 诊断(JSON);无 LLM 时规则版(错误码归类) */
172
95
  declare class FailureAnalyzer {
@@ -359,96 +282,6 @@ interface SourceDocument {
359
282
  /** 读文档 + sha256 hash(变更检测用) */
360
283
  declare function readDocument(fs: FileSystemProvider, path: string): Promise<SourceDocument>;
361
284
  //#endregion
362
- //#region ../governance/dist/index.d.ts
363
- //#region src/candidate/candidateNormalizer.d.ts
364
- /** 剥 markdown fence 与 <think> 块、截取首尾 {};非对象 → CANDIDATE_INVALID */
365
- declare function parseJsonObject(raw: string): Record<string, unknown>;
366
- /** 小写连字符化、≤64、过 isValidSkillName */
367
- declare function sanitizeCandidateName(raw: string): string;
368
- /**
369
- * 文件归一:补 SKILL.md;路径含 `..` / 以 `/` 开头 / 含 `\` → CANDIDATE_INVALID;
370
- * scripts/ 下必须是 .ts/.js。
371
- */
372
- declare function normalizeCandidateFiles(files: Array<{
373
- path: string;
374
- content: string;
375
- }>, name: string, description: string): CandidateFile[];
376
- /** 含脚本且 LLM 自报 low → 强制 medium 并追加"必须人工审批"原因 */
377
- declare function normalizeRisk(declared: unknown, files: CandidateFile[], reasons: string[]): {
378
- risk: CandidateRisk;
379
- reasons: string[];
380
- };
381
- /** 不信任归一化管线全链路;状态恒为 draft */
382
- declare function normalizeCandidate(input: {
383
- raw: Record<string, unknown>;
384
- source: CandidateSource;
385
- now?: () => string;
386
- createId?: () => string;
387
- }): CandidateSkill;
388
- //#endregion
389
- //#region src/approval/policies.d.ts
390
- interface ApprovalDecision {
391
- needsHuman: boolean;
392
- reason: string;
393
- }
394
- interface ApprovalPolicy {
395
- evaluate(candidate: CandidateSkill): ApprovalDecision;
396
- }
397
- /** 默认策略:任何候选都必须人工审批 */
398
- declare class AlwaysHumanApprovalPolicy implements ApprovalPolicy {
399
- evaluate(candidate: CandidateSkill): ApprovalDecision;
400
- }
401
- /** 规则组合策略:首个命中的规则胜出,全部未命中走 fallback(默认 AlwaysHuman) */
402
- declare class CompositeApprovalPolicy implements ApprovalPolicy {
403
- #private;
404
- constructor(rules: Array<(candidate: CandidateSkill) => ApprovalDecision | undefined>, fallback?: ApprovalPolicy);
405
- evaluate(candidate: CandidateSkill): ApprovalDecision;
406
- }
407
- //#endregion
408
- //#region src/approval/approvalWorkflow.d.ts
409
- /** 审批工作流:review(UiBridge confirm 真实接线)/ publish(校验→安装→版本→审计) */
410
- declare class ApprovalWorkflow {
411
- #private;
412
- constructor(deps: {
413
- policy: ApprovalPolicy;
414
- audit: AuditLog;
415
- store: CandidateStore;
416
- skillManager: SkillManager;
417
- versions: SkillVersionStore;
418
- fs?: FileSystemProvider;
419
- });
420
- /** 策略评估;needs-human 时经 UiBridge confirm 真实询问,按应答迁移状态 */
421
- review(candidateId: string, input: {
422
- actor: string;
423
- uiBridge?: UiBridge;
424
- }): Promise<CandidateSkill>;
425
- /** publish 全链路:approved 前置 → 写出 staging → validateSkills → install → 版本 → 审计 */
426
- publish(candidateId: string, input: {
427
- actor: string;
428
- }): Promise<SkillManifest>;
429
- /**
430
- * 真实回滚(受审批保护:仅经显式 actor 调用并全程审计):
431
- * 版本归档解包 → staging 校验 → 原子安装(复用安装管线 swap)→ 追加新版本 + 审计。
432
- * RepairPlanner 的 rollback 选项(targetVersionId)经本方法执行。
433
- */
434
- applyRollback(skillName: string, versionId: string, input: {
435
- actor: string;
436
- reason?: string;
437
- }): Promise<SkillManifest>;
438
- }
439
- //#endregion
440
- //#region src/evaluation/evaluationRuntime.d.ts
441
- /**
442
- * 治理评估专用 runtime 装配(不可信技能试用路径):
443
- * 默认注入 ProcessSandboxExecutor(fork + --permission 真实进程隔离;子进程
444
- * env 默认清空防密钥泄露,需透传时经 ProcessSandboxOptions.envWhitelist 显式放行)。
445
- * 可配置 executor 切回 SandboxedScriptExecutor(worker_threads 能力面收敛形态,
446
- * 非安全边界;envWhitelist 同样适用于该执行器)。
447
- */
448
- declare function createEvaluationRuntime(deps: WebSkillRuntimeDeps & {
449
- executor?: ScriptExecutor;
450
- }): WebSkillRuntime;
451
- //#endregion
452
285
  //#region src/documents/documentSkillExtractor.d.ts
453
286
  /** 文档 → LLM 抽取 → 完整防御管线 → draft 候选(source: document) */
454
287
  declare class DocumentSkillExtractor {
@@ -495,4 +328,4 @@ declare function createMissHook(deps: {
495
328
  */
496
329
  declare function completeText(llm: LlmClient, messages: LlmMessage[]): Promise<string>;
497
330
  //#endregion
498
- 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, createEvaluationRuntime, createMissHook, jaccardSimilarity, normalizeCandidate, normalizeCandidateFiles, normalizeRisk, parseJsonObject, readDocument, sanitizeCandidateName, suggestFromFailedRun, validateCandidate };
331
+ export { AlwaysHumanApprovalPolicy, type ApprovalDecision, type ApprovalPolicy, 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 };