@webskill/sdk 0.2.4 → 0.2.6

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.
@@ -1,12 +1,11 @@
1
- import { A as unzipWithLimits, b as isValidSkillName, d as assertSafePathSegment, j as validateSkills, k as resolveInsideRoot, u as WebSkillError } from "./dist-D7MsoMPx.js";
2
- import { S as WebSkillRuntime } from "./dist-CV64gN62.js";
3
- import { i as NodeFS, s as ProcessSandboxExecutor, u as exportArchive } from "./dist-Chgf2tcy.js";
1
+ import { C as messageOf, M as unzipWithLimits, N as validateSkills, f as assertSafePathSegment, j as resolveInsideRoot, u as WebSkillError, x as isValidSkillName } from "./dist-BQzncxXg.js";
2
+ import { S as WebSkillRuntime } from "./dist-BXpDDZpR.js";
3
+ import { i as NodeFS, s as ProcessSandboxExecutor, u as exportArchive } from "./dist-DWFDb1Ww.js";
4
4
  import path from "node:path";
5
5
  import { tmpdir } from "node:os";
6
6
  import { mkdtemp } from "node:fs/promises";
7
- import { createHash } from "node:crypto";
8
7
 
9
- //#region ../governance/dist/index.js
8
+ //#region ../governance/dist/documentSource-C6gq6pbk.js
10
9
  const invalid = (message, details) => {
11
10
  throw new WebSkillError("CANDIDATE_INVALID", message, details);
12
11
  };
@@ -217,181 +216,12 @@ var LlmCandidateGenerator = class {
217
216
  return candidate;
218
217
  }
219
218
  };
220
- /** 默认策略:任何候选都必须人工审批 */
221
- var AlwaysHumanApprovalPolicy = class {
222
- evaluate(candidate) {
223
- return {
224
- needsHuman: true,
225
- reason: `Candidate "${candidate.name}" requires human approval (risk: ${candidate.risk})`
226
- };
227
- }
228
- };
229
- /** 规则组合策略:首个命中的规则胜出,全部未命中走 fallback(默认 AlwaysHuman) */
230
- var CompositeApprovalPolicy = class {
231
- #rules;
232
- #fallback;
233
- constructor(rules, fallback) {
234
- this.#rules = rules;
235
- this.#fallback = fallback ?? new AlwaysHumanApprovalPolicy();
236
- }
237
- evaluate(candidate) {
238
- for (const rule of this.#rules) {
239
- const decision = rule(candidate);
240
- if (decision) return decision;
241
- }
242
- return this.#fallback.evaluate(candidate);
243
- }
244
- };
245
- const messageOf$1 = (e) => e instanceof Error ? e.message : String(e);
246
- /** 审批工作流:review(UiBridge confirm 真实接线)/ publish(校验→安装→版本→审计) */
247
- var ApprovalWorkflow = class {
248
- #policy;
249
- #audit;
250
- #store;
251
- #skillManager;
252
- #versions;
253
- #fs;
254
- constructor(deps) {
255
- this.#policy = deps.policy;
256
- this.#audit = deps.audit;
257
- this.#store = deps.store;
258
- this.#skillManager = deps.skillManager;
259
- this.#versions = deps.versions;
260
- this.#fs = deps.fs ?? new NodeFS();
261
- }
262
- /** 策略评估;needs-human 时经 UiBridge confirm 真实询问,按应答迁移状态 */
263
- async review(candidateId, input) {
264
- const candidate = await this.#store.get(candidateId);
265
- if (candidate.status !== "draft" && candidate.status !== "pending-review") throw new WebSkillError("GOVERNANCE_FAILED", `Candidate "${candidateId}" cannot be reviewed from status "${candidate.status}"`);
266
- const decision = this.#policy.evaluate(candidate);
267
- let approved;
268
- if (decision.needsHuman) {
269
- if (!input.uiBridge) {
270
- await this.#store.updateStatus(candidateId, "pending-review");
271
- throw new WebSkillError("APPROVAL_REQUIRED", `Candidate "${candidate.name}" requires human approval: ${decision.reason}`);
272
- }
273
- await this.#store.updateStatus(candidateId, "pending-review");
274
- const response = await input.uiBridge.request({
275
- type: "confirm",
276
- id: `approval-${candidateId}`,
277
- message: `Approve candidate "${candidate.name}" (risk: ${candidate.risk})? ${decision.reason}`,
278
- defaultValue: false
279
- });
280
- approved = response.cancelled !== true && response.value === true;
281
- } else approved = true;
282
- const updated = await this.#store.updateStatus(candidateId, approved ? "approved" : "rejected");
283
- await this.#audit.append({
284
- type: "candidate.reviewed",
285
- target: candidateId,
286
- actor: input.actor,
287
- data: {
288
- approved,
289
- reason: decision.reason
290
- }
291
- });
292
- return updated;
293
- }
294
- /** publish 全链路:approved 前置 → 写出 staging → validateSkills → install → 版本 → 审计 */
295
- async publish(candidateId, input) {
296
- const candidate = await this.#store.get(candidateId);
297
- if (candidate.status !== "approved") throw new WebSkillError("APPROVAL_REQUIRED", `Candidate "${candidate.name}" must be approved before publishing (status: ${candidate.status})`);
298
- const stagingRoot = (await mkdtemp(path.join(tmpdir(), "webskill-candidate-"))).split(path.sep).join("/");
299
- try {
300
- const skillDir = `${stagingRoot}/${candidate.name}`;
301
- for (const file of candidate.files) await this.#fs.writeText(resolveInsideRoot(skillDir, file.path), file.content);
302
- const report = await validateSkills(this.#fs, [stagingRoot]);
303
- if (!report.ok) {
304
- const errors = report.issues.filter((i) => i.severity === "error");
305
- throw new WebSkillError("GOVERNANCE_FAILED", `Candidate "${candidate.name}" failed validation: ${errors.map((i) => i.message).join("; ")}`, errors);
306
- }
307
- const manifest = await this.#skillManager.install({
308
- type: "local",
309
- path: skillDir
310
- });
311
- const archiveOut = `${stagingRoot}/version-archive.zip`;
312
- await exportArchive(this.#fs, `${this.#skillManager.managedRoot}/${candidate.name}`, {
313
- format: "zip",
314
- outPath: archiveOut
315
- });
316
- await this.#versions.add(candidate.name, {
317
- reason: `Publish candidate ${candidateId}`,
318
- manifest,
319
- archive: await this.#fs.readBinary(archiveOut)
320
- });
321
- await this.#store.updateStatus(candidateId, "published");
322
- await this.#audit.append({
323
- type: "skill.published",
324
- target: candidate.name,
325
- actor: input.actor,
326
- data: {
327
- candidateId,
328
- digest: manifest.integrity.digest
329
- }
330
- });
331
- return manifest;
332
- } catch (e) {
333
- if (e instanceof WebSkillError) throw e;
334
- throw new WebSkillError("GOVERNANCE_FAILED", `Failed to publish candidate "${candidateId}": ${messageOf$1(e)}`, e);
335
- } finally {
336
- try {
337
- await this.#fs.remove(stagingRoot, { recursive: true });
338
- } catch {}
339
- }
340
- }
341
- /**
342
- * 真实回滚(受审批保护:仅经显式 actor 调用并全程审计):
343
- * 版本归档解包 → staging 校验 → 原子安装(复用安装管线 swap)→ 追加新版本 + 审计。
344
- * RepairPlanner 的 rollback 选项(targetVersionId)经本方法执行。
345
- */
346
- async applyRollback(skillName, versionId, input) {
347
- assertSafePathSegment(skillName, "skill name");
348
- assertSafePathSegment(versionId, "version id");
349
- const version = await this.#versions.get(skillName, versionId);
350
- const archive = await this.#versions.readArchive(skillName, versionId);
351
- const stagingRoot = (await mkdtemp(path.join(tmpdir(), "webskill-rollback-"))).split(path.sep).join("/");
352
- try {
353
- const skillDir = `${stagingRoot}/${skillName}`;
354
- for (const [rel, content] of await unzipWithLimits(archive)) {
355
- if (rel.endsWith("/")) continue;
356
- await this.#fs.writeBinary(resolveInsideRoot(skillDir, rel), content);
357
- }
358
- const report = await validateSkills(this.#fs, [stagingRoot]);
359
- if (!report.ok) {
360
- const errors = report.issues.filter((i) => i.severity === "error");
361
- throw new WebSkillError("GOVERNANCE_FAILED", `Rollback archive of "${skillName}" failed validation: ${errors.map((i) => i.message).join("; ")}`, errors);
362
- }
363
- const manifest = await this.#skillManager.install({
364
- type: "local",
365
- path: skillDir
366
- });
367
- if (manifest.integrity.digest !== version.manifest.integrity.digest) throw new WebSkillError("GOVERNANCE_FAILED", `Rollback of "${skillName}" to version "${versionId}" produced a digest mismatch: expected ${version.manifest.integrity.digest}, got ${manifest.integrity.digest}`);
368
- await this.#versions.add(skillName, {
369
- reason: input.reason ?? `Rollback to version ${versionId}`,
370
- manifest,
371
- archive
372
- });
373
- await this.#audit.append({
374
- type: "skill.rolled_back",
375
- target: skillName,
376
- actor: input.actor,
377
- data: {
378
- targetVersionId: versionId,
379
- reason: input.reason
380
- }
381
- });
382
- return manifest;
383
- } catch (e) {
384
- if (e instanceof WebSkillError) throw e;
385
- throw new WebSkillError("GOVERNANCE_FAILED", `Failed to roll back "${skillName}" to version "${versionId}": ${messageOf$1(e)}`, e);
386
- } finally {
387
- try {
388
- await this.#fs.remove(stagingRoot, { recursive: true });
389
- } catch {}
390
- }
391
- }
392
- };
393
219
  const fileOf$1 = (root) => `${root}/.webskill/audit.jsonl`;
394
- const sha256Hex = (text) => createHash("sha256").update(text, "utf8").digest("hex");
220
+ /** 环境无关 sha256(WebCrypto;Node ≥17 与浏览器均有 globalThis.crypto.subtle) */
221
+ const sha256Hex$1 = async (text) => {
222
+ const digest = await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(text));
223
+ return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("");
224
+ };
395
225
  /** 链字段之外的规范化事件载荷(hash 计算输入) */
396
226
  function canonical(event) {
397
227
  return JSON.stringify({
@@ -433,7 +263,7 @@ var FsAuditLog = class {
433
263
  if (lines.length === 0) return "GENESIS";
434
264
  try {
435
265
  const last = JSON.parse(lines.at(-1));
436
- return last.hash ?? sha256Hex(canonical(last));
266
+ return last.hash ?? await sha256Hex$1(canonical(last));
437
267
  } catch (e) {
438
268
  throw new WebSkillError("GOVERNANCE_FAILED", `Audit log tail line at ${path} is corrupted; refusing to append (the chain must not silently restart)`, e);
439
269
  }
@@ -449,7 +279,7 @@ var FsAuditLog = class {
449
279
  ...event.data !== void 0 ? { data: event.data } : {},
450
280
  prevHash
451
281
  };
452
- full.hash = sha256Hex(canonical(full));
282
+ full.hash = await sha256Hex$1(canonical(full));
453
283
  await this.#fs.appendText(fileOf$1(this.#root), `${JSON.stringify(full)}\n`);
454
284
  this.#lastHash = full.hash;
455
285
  return full;
@@ -496,7 +326,7 @@ var FsAuditLog = class {
496
326
  brokenAt: i,
497
327
  reason: "prevHash link mismatch (events may have been removed or reordered)"
498
328
  };
499
- const expectedHash = sha256Hex(canonical(event));
329
+ const expectedHash = await sha256Hex$1(canonical(event));
500
330
  if (event.hash !== expectedHash) return {
501
331
  ok: false,
502
332
  brokenAt: i,
@@ -511,19 +341,22 @@ const dirOf = (root, skillName) => {
511
341
  assertSafePathSegment(skillName, "skill name");
512
342
  return `${root}/.webskill/versions/${skillName}`;
513
343
  };
514
- /** 版本存储:manifest 快照 + parentVersionId 链;回滚 = 追加新版本(谱系不断) */
344
+ /** 版本存储:manifest 快照 + parentVersionId 链;回滚 = 追加新版本(谱系不断)。
345
+ * 保留策略:maxArchivesPerSkill(默认 5)超出时清理最旧版本(json + zip 归档一并删除)。 */
515
346
  var SkillVersionStore = class {
516
347
  #root;
517
348
  #fs;
518
349
  #now;
519
350
  #createId;
520
351
  #audit;
352
+ #maxArchives;
521
353
  constructor(deps) {
522
354
  this.#root = deps.root.replace(/\/+$/, "");
523
355
  this.#fs = deps.fs;
524
356
  this.#now = deps.now;
525
357
  this.#createId = deps.createId;
526
358
  this.#audit = deps.audit;
359
+ this.#maxArchives = deps.maxArchivesPerSkill ?? 5;
527
360
  }
528
361
  async add(skillName, input) {
529
362
  const existing = await this.list(skillName);
@@ -541,8 +374,19 @@ var SkillVersionStore = class {
541
374
  version.archivePath = archivePath;
542
375
  }
543
376
  await this.#fs.writeText(`${dirOf(this.#root, skillName)}/${version.versionId}.json`, JSON.stringify(version, null, 2));
377
+ await this.#prune(skillName);
544
378
  return version;
545
379
  }
380
+ /** 保留策略:超出 maxArchivesPerSkill 时按 createdAt 清理最旧版本(json + zip) */
381
+ async #prune(skillName) {
382
+ const versions = await this.list(skillName);
383
+ const excess = versions.length - this.#maxArchives;
384
+ if (excess <= 0) return;
385
+ for (const old of versions.slice(0, excess)) {
386
+ await this.#fs.remove(`${dirOf(this.#root, skillName)}/${old.versionId}.json`);
387
+ if (old.archivePath && await this.#fs.exists(old.archivePath)) await this.#fs.remove(old.archivePath);
388
+ }
389
+ }
546
390
  /** 读取版本归档字节(applyRollback 用;未捕获归档的旧版本 → GOVERNANCE_FAILED) */
547
391
  async readArchive(skillName, versionId) {
548
392
  const version = await this.get(skillName, versionId);
@@ -804,7 +648,6 @@ var SkillStatePolicy = class {
804
648
  });
805
649
  }
806
650
  };
807
- const messageOf = (e) => e instanceof Error ? e.message : String(e);
808
651
  function matchExpected(expected, output, run) {
809
652
  if (expected === void 0) return run.status === "completed";
810
653
  if (typeof expected === "string") return output.includes(expected);
@@ -859,19 +702,6 @@ var EvaluationRunner = class {
859
702
  };
860
703
  }
861
704
  };
862
- /**
863
- * 治理评估专用 runtime 装配(不可信技能试用路径):
864
- * 默认注入 ProcessSandboxExecutor(fork + --permission 真实进程隔离;子进程
865
- * env 默认清空防密钥泄露,需透传时经 ProcessSandboxOptions.envWhitelist 显式放行)。
866
- * 可配置 executor 切回 SandboxedScriptExecutor(worker_threads 能力面收敛形态,
867
- * 非安全边界;envWhitelist 同样适用于该执行器)。
868
- */
869
- function createEvaluationRuntime(deps) {
870
- return new WebSkillRuntime({
871
- ...deps,
872
- executor: deps.executor ?? new ProcessSandboxExecutor(deps.fs)
873
- });
874
- }
875
705
  /** 失败 trace → 回归评估任务建议(prompt 复现 + expected 错误模式) */
876
706
  function suggestFromFailedRun(run) {
877
707
  const errorPatterns = run.trace.filter((e) => e.type === "tool.failed" || e.type === "run.failed").map((e) => String(e.data?.["code"] ?? e.message ?? "")).filter(Boolean);
@@ -965,15 +795,208 @@ var DependencyGraph = class DependencyGraph {
965
795
  return out.sort();
966
796
  }
967
797
  };
798
+ /** 环境无关 sha256(WebCrypto;Node ≥17 与浏览器均有 globalThis.crypto.subtle) */
799
+ async function sha256Hex(text) {
800
+ const digest = await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(text));
801
+ return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("");
802
+ }
968
803
  /** 读文档 + sha256 hash(变更检测用) */
969
804
  async function readDocument(fs, path) {
970
805
  const content = await fs.readText(path);
971
806
  return {
972
807
  path,
973
808
  content,
974
- hash: createHash("sha256").update(content).digest("hex")
809
+ hash: await sha256Hex(content)
975
810
  };
976
811
  }
812
+
813
+ //#endregion
814
+ //#region ../governance/dist/index.js
815
+ /** 默认策略:任何候选都必须人工审批 */
816
+ var AlwaysHumanApprovalPolicy = class {
817
+ evaluate(candidate) {
818
+ return {
819
+ needsHuman: true,
820
+ reason: `Candidate "${candidate.name}" requires human approval (risk: ${candidate.risk})`
821
+ };
822
+ }
823
+ };
824
+ /** 规则组合策略:首个命中的规则胜出,全部未命中走 fallback(默认 AlwaysHuman) */
825
+ var CompositeApprovalPolicy = class {
826
+ #rules;
827
+ #fallback;
828
+ constructor(rules, fallback) {
829
+ this.#rules = rules;
830
+ this.#fallback = fallback ?? new AlwaysHumanApprovalPolicy();
831
+ }
832
+ evaluate(candidate) {
833
+ for (const rule of this.#rules) {
834
+ const decision = rule(candidate);
835
+ if (decision) return decision;
836
+ }
837
+ return this.#fallback.evaluate(candidate);
838
+ }
839
+ };
840
+ /** 审批工作流:review(UiBridge confirm 真实接线)/ publish(校验→安装→版本→审计) */
841
+ var ApprovalWorkflow = class {
842
+ #policy;
843
+ #audit;
844
+ #store;
845
+ #skillManager;
846
+ #versions;
847
+ #fs;
848
+ constructor(deps) {
849
+ this.#policy = deps.policy;
850
+ this.#audit = deps.audit;
851
+ this.#store = deps.store;
852
+ this.#skillManager = deps.skillManager;
853
+ this.#versions = deps.versions;
854
+ this.#fs = deps.fs ?? new NodeFS();
855
+ }
856
+ /** 策略评估;needs-human 时经 UiBridge confirm 真实询问,按应答迁移状态 */
857
+ async review(candidateId, input) {
858
+ const candidate = await this.#store.get(candidateId);
859
+ if (candidate.status !== "draft" && candidate.status !== "pending-review") throw new WebSkillError("GOVERNANCE_FAILED", `Candidate "${candidateId}" cannot be reviewed from status "${candidate.status}"`);
860
+ const decision = this.#policy.evaluate(candidate);
861
+ let approved;
862
+ if (decision.needsHuman) {
863
+ if (!input.uiBridge) {
864
+ await this.#store.updateStatus(candidateId, "pending-review");
865
+ throw new WebSkillError("APPROVAL_REQUIRED", `Candidate "${candidate.name}" requires human approval: ${decision.reason}`);
866
+ }
867
+ await this.#store.updateStatus(candidateId, "pending-review");
868
+ const response = await input.uiBridge.request({
869
+ type: "confirm",
870
+ id: `approval-${candidateId}`,
871
+ message: `Approve candidate "${candidate.name}" (risk: ${candidate.risk})? ${decision.reason}`,
872
+ defaultValue: false
873
+ });
874
+ approved = response.cancelled !== true && response.value === true;
875
+ } else approved = true;
876
+ const updated = await this.#store.updateStatus(candidateId, approved ? "approved" : "rejected");
877
+ await this.#audit.append({
878
+ type: "candidate.reviewed",
879
+ target: candidateId,
880
+ actor: input.actor,
881
+ data: {
882
+ approved,
883
+ reason: decision.reason
884
+ }
885
+ });
886
+ return updated;
887
+ }
888
+ /** publish 全链路:approved 前置 → 写出 staging → validateSkills → install → 版本 → 审计 */
889
+ async publish(candidateId, input) {
890
+ const candidate = await this.#store.get(candidateId);
891
+ if (candidate.status !== "approved") throw new WebSkillError("APPROVAL_REQUIRED", `Candidate "${candidate.name}" must be approved before publishing (status: ${candidate.status})`);
892
+ const stagingRoot = (await mkdtemp(path.join(tmpdir(), "webskill-candidate-"))).split(path.sep).join("/");
893
+ try {
894
+ const skillDir = `${stagingRoot}/${candidate.name}`;
895
+ for (const file of candidate.files) await this.#fs.writeText(resolveInsideRoot(skillDir, file.path), file.content);
896
+ const report = await validateSkills(this.#fs, [stagingRoot]);
897
+ if (!report.ok) {
898
+ const errors = report.issues.filter((i) => i.severity === "error");
899
+ throw new WebSkillError("GOVERNANCE_FAILED", `Candidate "${candidate.name}" failed validation: ${errors.map((i) => i.message).join("; ")}`, errors);
900
+ }
901
+ const manifest = await this.#skillManager.install({
902
+ type: "local",
903
+ path: skillDir
904
+ });
905
+ const archiveOut = `${stagingRoot}/version-archive.zip`;
906
+ await exportArchive(this.#fs, `${this.#skillManager.managedRoot}/${candidate.name}`, {
907
+ format: "zip",
908
+ outPath: archiveOut
909
+ });
910
+ await this.#versions.add(candidate.name, {
911
+ reason: `Publish candidate ${candidateId}`,
912
+ manifest,
913
+ archive: await this.#fs.readBinary(archiveOut)
914
+ });
915
+ await this.#store.updateStatus(candidateId, "published");
916
+ await this.#audit.append({
917
+ type: "skill.published",
918
+ target: candidate.name,
919
+ actor: input.actor,
920
+ data: {
921
+ candidateId,
922
+ digest: manifest.integrity.digest
923
+ }
924
+ });
925
+ return manifest;
926
+ } catch (e) {
927
+ if (e instanceof WebSkillError) throw e;
928
+ throw new WebSkillError("GOVERNANCE_FAILED", `Failed to publish candidate "${candidateId}": ${messageOf(e)}`, e);
929
+ } finally {
930
+ try {
931
+ await this.#fs.remove(stagingRoot, { recursive: true });
932
+ } catch {}
933
+ }
934
+ }
935
+ /**
936
+ * 真实回滚(受审批保护:仅经显式 actor 调用并全程审计):
937
+ * 版本归档解包 → staging 校验 → 原子安装(复用安装管线 swap)→ 追加新版本 + 审计。
938
+ * RepairPlanner 的 rollback 选项(targetVersionId)经本方法执行。
939
+ */
940
+ async applyRollback(skillName, versionId, input) {
941
+ assertSafePathSegment(skillName, "skill name");
942
+ assertSafePathSegment(versionId, "version id");
943
+ const version = await this.#versions.get(skillName, versionId);
944
+ const archive = await this.#versions.readArchive(skillName, versionId);
945
+ const stagingRoot = (await mkdtemp(path.join(tmpdir(), "webskill-rollback-"))).split(path.sep).join("/");
946
+ try {
947
+ const skillDir = `${stagingRoot}/${skillName}`;
948
+ for (const [rel, content] of await unzipWithLimits(archive)) {
949
+ if (rel.endsWith("/")) continue;
950
+ await this.#fs.writeBinary(resolveInsideRoot(skillDir, rel), content);
951
+ }
952
+ const report = await validateSkills(this.#fs, [stagingRoot]);
953
+ if (!report.ok) {
954
+ const errors = report.issues.filter((i) => i.severity === "error");
955
+ throw new WebSkillError("GOVERNANCE_FAILED", `Rollback archive of "${skillName}" failed validation: ${errors.map((i) => i.message).join("; ")}`, errors);
956
+ }
957
+ const manifest = await this.#skillManager.install({
958
+ type: "local",
959
+ path: skillDir
960
+ });
961
+ if (manifest.integrity.digest !== version.manifest.integrity.digest) throw new WebSkillError("GOVERNANCE_FAILED", `Rollback of "${skillName}" to version "${versionId}" produced a digest mismatch: expected ${version.manifest.integrity.digest}, got ${manifest.integrity.digest}`);
962
+ await this.#versions.add(skillName, {
963
+ reason: input.reason ?? `Rollback to version ${versionId}`,
964
+ manifest,
965
+ archive
966
+ });
967
+ await this.#audit.append({
968
+ type: "skill.rolled_back",
969
+ target: skillName,
970
+ actor: input.actor,
971
+ data: {
972
+ targetVersionId: versionId,
973
+ reason: input.reason
974
+ }
975
+ });
976
+ return manifest;
977
+ } catch (e) {
978
+ if (e instanceof WebSkillError) throw e;
979
+ throw new WebSkillError("GOVERNANCE_FAILED", `Failed to roll back "${skillName}" to version "${versionId}": ${messageOf(e)}`, e);
980
+ } finally {
981
+ try {
982
+ await this.#fs.remove(stagingRoot, { recursive: true });
983
+ } catch {}
984
+ }
985
+ }
986
+ };
987
+ /**
988
+ * 治理评估专用 runtime 装配(不可信技能试用路径):
989
+ * 默认注入 ProcessSandboxExecutor(fork + --permission 真实进程隔离;子进程
990
+ * env 默认清空防密钥泄露,需透传时经 ProcessSandboxOptions.envWhitelist 显式放行)。
991
+ * 可配置 executor 切回 SandboxedScriptExecutor(worker_threads 能力面收敛形态,
992
+ * 非安全边界;envWhitelist 同样适用于该执行器)。
993
+ */
994
+ function createEvaluationRuntime(deps) {
995
+ return new WebSkillRuntime({
996
+ ...deps,
997
+ executor: deps.executor ?? new ProcessSandboxExecutor(deps.fs)
998
+ });
999
+ }
977
1000
  const EXTRACT_PROMPT = (doc, nameHint) => [
978
1001
  "Extract an executable skill from the following document as STRICT JSON only.",
979
1002
  "Schema: {\"name\": string, \"description\": string, \"risk\": \"low\"|\"medium\"|\"high\",",
@@ -1,4 +1,4 @@
1
- import { F as SkillDocument, G as ValidationReport, I as SkillInstallSource, J as WebSkillErrorCode, M as SkillCatalog, N as SkillCatalogEntry, P as SkillDiscovery, S as DiscoveryResult, T as JsonSchema, _ as RenderResultRequest, a as InteractionPolicy, c as LlmClient, d as LlmResponse, f as LlmStreamEvent, g as RenderBlock, h as MemoryStore, i as FormField, l as LlmCompleteInput, m as LlmToolSpec, n as ArtifactStore, o as InteractionRequest, r as ChartSpec, t as Artifact, u as LlmMessage, v as UiBridge, w as FileSystemProvider, z as SkillManifest } from "./types-CKm5G_eQ-BqyXnvoR.js";
1
+ import { B as SkillManifest, F as SkillDiscovery, I as SkillDocument, K as ValidationReport, L as SkillInstallSource, N as SkillCatalog, P as SkillCatalogEntry, S as DiscoveryResult, T as JsonSchema, Y as WebSkillErrorCode, _ as RenderResultRequest, a as InteractionPolicy, c as LlmClient, d as LlmResponse, f as LlmStreamEvent, g as RenderBlock, h as MemoryStore, i as FormField, l as LlmCompleteInput, m as LlmToolSpec, n as ArtifactStore, o as InteractionRequest, r as ChartSpec, t as Artifact, u as LlmMessage, v as UiBridge, w as FileSystemProvider } from "./types-CKm5G_eQ-krKWW8WV.js";
2
2
  //#region ../runtime/dist/index.d.ts
3
3
  //#region src/llm/openAiCompatibleClient.d.ts
4
4
  interface OpenAiCompatibleClientConfig {
@@ -270,6 +270,8 @@ interface AgentLoopConfig {
270
270
  renderResult?: 'off';
271
271
  /** 工具结果回喂上限(字节,默认 100_000;超长头尾保留 + 完整内容落 artifact) */
272
272
  toolResultMaxBytes?: number;
273
+ /** session paramHistory 保留条数上限(默认 50,超出裁最旧) */
274
+ paramHistoryLimit?: number;
273
275
  }
274
276
  /** 技能状态拦截 port(治理装配;无注入默认全放行) */
275
277
  interface SkillStateGuard {
@@ -379,6 +381,7 @@ type LifecycleListener = (event: LifecycleEvent) => void;
379
381
  /** 生命周期事件总线:只读观测,支持按阶段或通配订阅 */
380
382
  declare class EventBus {
381
383
  #private;
384
+ constructor(onListenerError?: (error: unknown, event: LifecycleEvent) => void);
382
385
  /** 返回取消订阅函数 */
383
386
  on(phase: RuntimePhase | '*', listener: LifecycleListener): () => void;
384
387
  /** 当前订阅者数量(流式 delta 零订阅零开销判断用) */
@@ -436,6 +439,8 @@ declare class FsMemoryStore implements MemoryStore {
436
439
  declare class SerializingMemoryStore implements MemoryStore {
437
440
  #private;
438
441
  constructor(inner: MemoryStore);
442
+ /** 当前链上的 scope 数(监控/测试用;空闲时应回落到 0) */
443
+ get trackedScopeCount(): number;
439
444
  get(scope: string, key: string): Promise<unknown>;
440
445
  set(scope: string, key: string, value: unknown): Promise<void>;
441
446
  delete(scope: string, key: string): Promise<void>;
@@ -649,6 +654,8 @@ interface RunSnapshot {
649
654
  renderBlocks?: RenderBlock[];
650
655
  /** 交互 id 序号(resume 后续算,避免 id 冲突;旧快照缺省从 0 起) */
651
656
  interactionSeq?: number;
657
+ /** 已累计的交互等待 ms(resume 后续算,保持 totalTimeout 排除交互等待的语义;旧快照缺省为 0) */
658
+ pausedMs?: number;
652
659
  /** 进入 interrupted 时计算的过期时间 */
653
660
  interactionExpiresAt: string;
654
661
  config: {
@@ -731,6 +738,12 @@ interface AgentLoopDeps {
731
738
  declare class AgentLoop {
732
739
  #private;
733
740
  constructor(deps: AgentLoopDeps, config?: AgentLoopConfig);
741
+ /**
742
+ * 取消进行中的 run:触发该 run 的 AbortController(与 totalTimeout 硬期限同一通道),
743
+ * run 以 cancelled(RUN_CANCELLED)终止;未找到(已终态或不属于本实例)返回 false。
744
+ * 取消在下一个中断点生效(LLM complete/stream 调用;交互等待不强制中断)。
745
+ */
746
+ cancel(runId: string): boolean;
734
747
  run(input: {
735
748
  sessionId: string;
736
749
  userPrompt: string;
@@ -807,9 +820,12 @@ declare class WebSkillRuntime {
807
820
  /**
808
821
  * 多会话:session 对象的 run(prompt) 跨 run 延续消息历史(同一 session 对话上下文连续)。
809
822
  * 既有 runtime.run(prompt) 保持无状态单次语义不变。
823
+ * 同 handle 并发 run 经 per-handle 队列串行化(防历史 last-writer-wins 丢轮次);
824
+ * maxHistoryMessages(默认 100)超出时滚动裁剪中段(保留首尾;边界对齐 tool 契约)。
810
825
  */
811
826
  createSession(options?: {
812
827
  sessionId?: string;
828
+ maxHistoryMessages?: number;
813
829
  }): RuntimeSessionHandle;
814
830
  discover(): Promise<DiscoveryResult>;
815
831
  run(userPrompt: string, options?: {
@@ -825,6 +841,12 @@ declare class WebSkillRuntime {
825
841
  * @experimental
826
842
  */
827
843
  resumeRun(runId: string): Promise<RunResult>;
844
+ /**
845
+ * 取消进行中的 run(chatbot Stop 按钮等):触发该 run 的 AbortController,
846
+ * run 以 cancelled(RUN_CANCELLED)终止;未找到活跃 run 返回 false。
847
+ * 取消在下一个中断点生效(LLM complete/stream;交互等待不强制中断)。
848
+ */
849
+ cancel(runId: string): boolean;
828
850
  }
829
851
  //#endregion
830
852
  export { SerializingMemoryStore as $, LifecycleHook as A, toVercelToolSpecs as At, RUN_SNAPSHOT_SCHEMA_VERSION as B, FullDisclosureRouter as C, normalizeErrorCode as Ct, HookRunnerOptions as D, resolveToolName as Dt, HookRunner as E, parseBridgeRequest as Et, OpenAiCompatibleClientConfig as F, RunTerminationReason as G, RunResult as H, ProgressiveRouter as I, RuntimeSession as J, RuntimePhase as K, READ_SKILL_FILE_INPUT_SCHEMA as L, LifecycleListener as M, NetworkPolicy as N, InstalledSkillManifest as O, schemaToForm as Ot, OpenAiCompatibleClient as P, ScriptExecutor as Q, READ_SKILL_FILE_TOOL as R, FsRunSnapshotStore as S, networkUrlHost as St, GoogleGenAiClientConfig as T, normalizeToolError as Tt, RunSnapshot as U, RouteResult as V, RunSnapshotStore as W, SchemaInferer as X, RuntimeSessionHandle as Y, ScriptExecutionContext as Z, EventBus as _, extractChartSpec as _t, AgentLoopConfig as a, TraceClock as at, FsArtifactStore as b, isNetworkAllowed as bt, AnthropicClientConfig as c, TraceRecorder as ct, BridgeCapabilities as d, WebSkillRuntime as dt, SkillRouter as et, BridgeCapability as f, WebSkillRuntimeDeps as ft, CapabilityMode as g, createWebSkillApi as gt, CapabilityApproval as h, createScriptContext as ht, AgentLoop as i, ToolResult as it, LifecycleHookContext as j, LifecycleEvent as k, toLlmToolSpec as kt, ApprovalDecision as l, VercelToolSpec as lt, BridgeResponse as m, buildRenderResult as mt, ASK_USER_TOOL as n, ToolDefinition as nt, AgentLoopDeps as o, TraceEvent as ot, BridgeRequest as p, bridgeError as pt, RuntimeRun as q, ASK_USER_TOOL_NAME as r, ToolResolution as rt, AnthropicClient as s, TraceEventType as st, ASK_USER_INPUT_SCHEMA as t, SkillStateGuard as tt, ApprovalScope as u, WebSkillApi as ut, ExternalSkillProvider as v, fromVercelResult as vt, GoogleGenAiClient as w, normalizeToolContent as wt, FsMemoryStore as x, mergeCatalogEntries as xt, ExternalToolSource as y, fromVercelStreamPart as yt, READ_SKILL_FILE_TOOL_NAME as z };
@@ -1,5 +1,5 @@
1
- import { C as FileStat, I as SkillInstallSource, K as VerifyResult, T as JsonSchema, W as SkillsLockfile, _ as RenderResultRequest, o as InteractionRequest, s as InteractionResponse, v as UiBridge, w as FileSystemProvider, y as ArchiveLimits, z as SkillManifest } from "./types-CKm5G_eQ-BqyXnvoR.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-DZShzhon.js";
1
+ import { B as SkillManifest, C as FileStat, G as SkillsLockfile, L as SkillInstallSource, T as JsonSchema, _ as RenderResultRequest, o as InteractionRequest, q as VerifyResult, s as InteractionResponse, v as UiBridge, w as FileSystemProvider, y as ArchiveLimits } from "./types-CKm5G_eQ-krKWW8WV.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-DJOha4b6.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
@@ -106,6 +106,8 @@ interface ProcessSandboxOptions {
106
106
  uiBridge?: UiBridge;
107
107
  /** 授权粒度:默认 'once-per-run' */
108
108
  approvalScope?: ApprovalScope;
109
+ /** 池维护告警出口(recycle 重生失败等;默认 console.warn) */
110
+ onWarning?: (message: string) => void;
109
111
  }
110
112
  /**
111
113
  * child_process.fork + --permission 进程沙箱(真实进程隔离)。
@@ -120,7 +122,7 @@ declare class ProcessSandboxExecutor implements ScriptExecutor {
120
122
  #private;
121
123
  constructor(fs: FileSystemProvider, options?: ProcessSandboxOptions);
122
124
  get poolSize(): number;
123
- /** 池全部子进程销毁(测试收尾/进程退出前调用) */
125
+ /** 池全部子进程销毁(测试收尾/进程退出前调用);排队中的 acquire 一律 reject(不悬挂) */
124
126
  dispose(): Promise<void>;
125
127
  loadDefinition(skillRoot: string, scriptName: string): Promise<ToolDefinition>;
126
128
  execute(input: {
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as checkDependencyCycles, A as SKILL_NAME_PATTERN, B as SkillMetadata, C as FileStat, D as SKILLS_LOCKFILE, E as MemoryFS, F as SkillDocument, G as ValidationReport, H as SkillReader, I as SkillInstallSource, J as WebSkillErrorCode, K as VerifyResult, L as SkillIssue, M as SkillCatalog, N as SkillCatalogEntry, O as SKILL_MANIFEST_FILE, P as SkillDiscovery, Q as buildManifest, R as SkillLocation, S as DiscoveryResult, T as JsonSchema, U as SkillSource, V as SkillPackManifest, W as SkillsLockfile, X as atomicWriteText, Y as assertSafePathSegment, Z as buildCatalog, _ as RenderResultRequest, _t as xmlRenderer, a as InteractionPolicy, at as jsonRenderer, b as CatalogRenderer, c as LlmClient, ct as parseSkillPackManifest, d as LlmResponse, dt as renderCatalogJson, et as checkSkillRules, f as LlmStreamEvent, ft as resolveArchiveLimits, g as RenderBlock, gt as verifyManifest, h as MemoryStore, ht as validateSkills, i as FormField, it as isValidSkillName, j as SKILL_PACK_FILE, k as SKILL_NAME_MAX_LENGTH, l as LlmCompleteInput, lt as readResponseWithLimit, m as LlmToolSpec, mt as unzipWithLimits, n as ArtifactStore, nt as escapeXml, o as InteractionRequest, ot as normalizePath, p as LlmToolCall, pt as resolveInsideRoot, q as WebSkillError, r as ChartSpec, rt as exportSkills, s as InteractionResponse, st as parseSkillMarkdown, t as Artifact, tt as computeDigest, u as LlmMessage, ut as renderAvailableSkillsXml, v as UiBridge, w as FileSystemProvider, x as DEFAULT_ARCHIVE_LIMITS, y as ArchiveLimits, z as SkillManifest } from "./types-CKm5G_eQ-BqyXnvoR.js";
2
- import { $ as SerializingMemoryStore, A as LifecycleHook, At as toVercelToolSpecs, B as RUN_SNAPSHOT_SCHEMA_VERSION, C as FullDisclosureRouter, Ct as normalizeErrorCode, D as HookRunnerOptions, Dt as resolveToolName, E as HookRunner, Et as parseBridgeRequest, F as OpenAiCompatibleClientConfig, G as RunTerminationReason, H as RunResult, I as ProgressiveRouter, J as RuntimeSession, K as RuntimePhase, L as READ_SKILL_FILE_INPUT_SCHEMA, M as LifecycleListener, N as NetworkPolicy, O as InstalledSkillManifest, Ot as schemaToForm, P as OpenAiCompatibleClient, Q as ScriptExecutor, R as READ_SKILL_FILE_TOOL, S as FsRunSnapshotStore, St as networkUrlHost, T as GoogleGenAiClientConfig, Tt as normalizeToolError, U as RunSnapshot, V as RouteResult, W as RunSnapshotStore, X as SchemaInferer, Y as RuntimeSessionHandle, Z as ScriptExecutionContext, _ as EventBus, _t as extractChartSpec, a as AgentLoopConfig, at as TraceClock, b as FsArtifactStore, bt as isNetworkAllowed, c as AnthropicClientConfig, ct as TraceRecorder, d as BridgeCapabilities, dt as WebSkillRuntime, et as SkillRouter, f as BridgeCapability, ft as WebSkillRuntimeDeps, g as CapabilityMode, gt as createWebSkillApi, h as CapabilityApproval, ht as createScriptContext, i as AgentLoop, it as ToolResult, j as LifecycleHookContext, k as LifecycleEvent, kt as toLlmToolSpec, l as ApprovalDecision, lt as VercelToolSpec, m as BridgeResponse, mt as buildRenderResult, n as ASK_USER_TOOL, nt as ToolDefinition, o as AgentLoopDeps, ot as TraceEvent, p as BridgeRequest, pt as bridgeError, q as RuntimeRun, r as ASK_USER_TOOL_NAME, rt as ToolResolution, s as AnthropicClient, st as TraceEventType, t as ASK_USER_INPUT_SCHEMA, tt as SkillStateGuard, u as ApprovalScope, ut as WebSkillApi, v as ExternalSkillProvider, vt as fromVercelResult, w as GoogleGenAiClient, wt as normalizeToolContent, x as FsMemoryStore, xt as mergeCatalogEntries, y as ExternalToolSource, yt as fromVercelStreamPart, z as READ_SKILL_FILE_TOOL_NAME } from "./index-DZShzhon.js";
3
- export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, type AgentLoopConfig, type AgentLoopDeps, AnthropicClient, type AnthropicClientConfig, type ApprovalDecision, type ApprovalScope, type ArchiveLimits, type Artifact, type ArtifactStore, type BridgeCapabilities, type BridgeCapability, type BridgeRequest, type BridgeResponse, CapabilityApproval, type CapabilityMode, type CatalogRenderer, type ChartSpec, DEFAULT_ARCHIVE_LIMITS, type DiscoveryResult, EventBus, type ExternalSkillProvider, type ExternalToolSource, type FileStat, type FileSystemProvider, type FormField, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FullDisclosureRouter, GoogleGenAiClient, type GoogleGenAiClientConfig, HookRunner, type HookRunnerOptions, type InstalledSkillManifest, type InteractionPolicy, type InteractionRequest, type InteractionResponse, type JsonSchema, type LifecycleEvent, type LifecycleHook, type LifecycleHookContext, type LifecycleListener, type LlmClient, type LlmCompleteInput, type LlmMessage, type LlmResponse, type LlmStreamEvent, type LlmToolCall, type LlmToolSpec, MemoryFS, type MemoryStore, type NetworkPolicy, OpenAiCompatibleClient, type OpenAiCompatibleClientConfig, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, RUN_SNAPSHOT_SCHEMA_VERSION, type RenderBlock, type RenderResultRequest, type RouteResult, type RunResult, type RunSnapshot, type RunSnapshotStore, type RunTerminationReason, type RuntimePhase, type RuntimeRun, type RuntimeSession, type RuntimeSessionHandle, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SKILL_PACK_FILE, type SchemaInferer, type ScriptExecutionContext, type ScriptExecutor, SerializingMemoryStore, type SkillCatalog, type SkillCatalogEntry, SkillDiscovery, type SkillDocument, type SkillInstallSource, type SkillIssue, type SkillLocation, type SkillManifest, type SkillMetadata, type SkillPackManifest, SkillReader, type SkillRouter, type SkillSource, type SkillStateGuard, type SkillsLockfile, type ToolDefinition, type ToolResolution, type ToolResult, type TraceClock, type TraceEvent, type TraceEventType, TraceRecorder, type UiBridge, type ValidationReport, type VercelToolSpec, type VerifyResult, type WebSkillApi, WebSkillError, type WebSkillErrorCode, WebSkillRuntime, type WebSkillRuntimeDeps, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isValidSkillName, jsonRenderer, mergeCatalogEntries, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, readResponseWithLimit, renderAvailableSkillsXml, renderCatalogJson, resolveArchiveLimits, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, unzipWithLimits, validateSkills, verifyManifest, xmlRenderer };
1
+ import { $ as buildCatalog, A as SKILL_NAME_MAX_LENGTH, B as SkillManifest, C as FileStat, D as RemoteUrlPolicy, E as MemoryFS, F as SkillDiscovery, G as SkillsLockfile, H as SkillPackManifest, I as SkillDocument, J as WebSkillError, K as ValidationReport, L as SkillInstallSource, M as SKILL_PACK_FILE, N as SkillCatalog, O as SKILLS_LOCKFILE, P as SkillCatalogEntry, Q as atomicWriteText, R as SkillIssue, S as DiscoveryResult, T as JsonSchema, U as SkillReader, V as SkillMetadata, W as SkillSource, X as assertRemoteUrlAllowed, Y as WebSkillErrorCode, Z as assertSafePathSegment, _ as RenderResultRequest, _t as unzipWithLimits, a as InteractionPolicy, at as exportSkills, b as CatalogRenderer, bt as xmlRenderer, c as LlmClient, ct as messageOf, d as LlmResponse, dt as parseSkillPackManifest, et as buildManifest, f as LlmStreamEvent, ft as readResponseWithLimit, g as RenderBlock, gt as resolveInsideRoot, h as MemoryStore, ht as resolveArchiveLimits, i as FormField, it as escapeXml, j as SKILL_NAME_PATTERN, k as SKILL_MANIFEST_FILE, l as LlmCompleteInput, lt as normalizePath, m as LlmToolSpec, mt as renderCatalogJson, n as ArtifactStore, nt as checkSkillRules, o as InteractionRequest, ot as isValidSkillName, p as LlmToolCall, pt as renderAvailableSkillsXml, q as VerifyResult, r as ChartSpec, rt as computeDigest, s as InteractionResponse, st as jsonRenderer, t as Artifact, tt as checkDependencyCycles, u as LlmMessage, ut as parseSkillMarkdown, v as UiBridge, vt as validateSkills, w as FileSystemProvider, x as DEFAULT_ARCHIVE_LIMITS, y as ArchiveLimits, yt as verifyManifest, z as SkillLocation } from "./types-CKm5G_eQ-krKWW8WV.js";
2
+ import { $ as SerializingMemoryStore, A as LifecycleHook, At as toVercelToolSpecs, B as RUN_SNAPSHOT_SCHEMA_VERSION, C as FullDisclosureRouter, Ct as normalizeErrorCode, D as HookRunnerOptions, Dt as resolveToolName, E as HookRunner, Et as parseBridgeRequest, F as OpenAiCompatibleClientConfig, G as RunTerminationReason, H as RunResult, I as ProgressiveRouter, J as RuntimeSession, K as RuntimePhase, L as READ_SKILL_FILE_INPUT_SCHEMA, M as LifecycleListener, N as NetworkPolicy, O as InstalledSkillManifest, Ot as schemaToForm, P as OpenAiCompatibleClient, Q as ScriptExecutor, R as READ_SKILL_FILE_TOOL, S as FsRunSnapshotStore, St as networkUrlHost, T as GoogleGenAiClientConfig, Tt as normalizeToolError, U as RunSnapshot, V as RouteResult, W as RunSnapshotStore, X as SchemaInferer, Y as RuntimeSessionHandle, Z as ScriptExecutionContext, _ as EventBus, _t as extractChartSpec, a as AgentLoopConfig, at as TraceClock, b as FsArtifactStore, bt as isNetworkAllowed, c as AnthropicClientConfig, ct as TraceRecorder, d as BridgeCapabilities, dt as WebSkillRuntime, et as SkillRouter, f as BridgeCapability, ft as WebSkillRuntimeDeps, g as CapabilityMode, gt as createWebSkillApi, h as CapabilityApproval, ht as createScriptContext, i as AgentLoop, it as ToolResult, j as LifecycleHookContext, k as LifecycleEvent, kt as toLlmToolSpec, l as ApprovalDecision, lt as VercelToolSpec, m as BridgeResponse, mt as buildRenderResult, n as ASK_USER_TOOL, nt as ToolDefinition, o as AgentLoopDeps, ot as TraceEvent, p as BridgeRequest, pt as bridgeError, q as RuntimeRun, r as ASK_USER_TOOL_NAME, rt as ToolResolution, s as AnthropicClient, st as TraceEventType, t as ASK_USER_INPUT_SCHEMA, tt as SkillStateGuard, u as ApprovalScope, ut as WebSkillApi, v as ExternalSkillProvider, vt as fromVercelResult, w as GoogleGenAiClient, wt as normalizeToolContent, x as FsMemoryStore, xt as mergeCatalogEntries, y as ExternalToolSource, yt as fromVercelStreamPart, z as READ_SKILL_FILE_TOOL_NAME } from "./index-DJOha4b6.js";
3
+ export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, type AgentLoopConfig, type AgentLoopDeps, AnthropicClient, type AnthropicClientConfig, type ApprovalDecision, type ApprovalScope, type ArchiveLimits, type Artifact, type ArtifactStore, type BridgeCapabilities, type BridgeCapability, type BridgeRequest, type BridgeResponse, CapabilityApproval, type CapabilityMode, type CatalogRenderer, type ChartSpec, DEFAULT_ARCHIVE_LIMITS, type DiscoveryResult, EventBus, type ExternalSkillProvider, type ExternalToolSource, type FileStat, type FileSystemProvider, type FormField, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FullDisclosureRouter, GoogleGenAiClient, type GoogleGenAiClientConfig, HookRunner, type HookRunnerOptions, type InstalledSkillManifest, type InteractionPolicy, type InteractionRequest, type InteractionResponse, type JsonSchema, type LifecycleEvent, type LifecycleHook, type LifecycleHookContext, type LifecycleListener, type LlmClient, type LlmCompleteInput, type LlmMessage, type LlmResponse, type LlmStreamEvent, type LlmToolCall, type LlmToolSpec, MemoryFS, type MemoryStore, type NetworkPolicy, OpenAiCompatibleClient, type OpenAiCompatibleClientConfig, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, RUN_SNAPSHOT_SCHEMA_VERSION, type RemoteUrlPolicy, type RenderBlock, type RenderResultRequest, type RouteResult, type RunResult, type RunSnapshot, type RunSnapshotStore, type RunTerminationReason, type RuntimePhase, type RuntimeRun, type RuntimeSession, type RuntimeSessionHandle, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SKILL_PACK_FILE, type SchemaInferer, type ScriptExecutionContext, type ScriptExecutor, SerializingMemoryStore, type SkillCatalog, type SkillCatalogEntry, SkillDiscovery, type SkillDocument, type SkillInstallSource, type SkillIssue, type SkillLocation, type SkillManifest, type SkillMetadata, type SkillPackManifest, SkillReader, type SkillRouter, type SkillSource, type SkillStateGuard, type SkillsLockfile, type ToolDefinition, type ToolResolution, type ToolResult, type TraceClock, type TraceEvent, type TraceEventType, TraceRecorder, type UiBridge, type ValidationReport, type VercelToolSpec, type VerifyResult, type WebSkillApi, WebSkillError, type WebSkillErrorCode, WebSkillRuntime, type WebSkillRuntimeDeps, assertRemoteUrlAllowed, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isValidSkillName, jsonRenderer, mergeCatalogEntries, messageOf, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, readResponseWithLimit, renderAvailableSkillsXml, renderCatalogJson, resolveArchiveLimits, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, unzipWithLimits, validateSkills, verifyManifest, xmlRenderer };