@webskill/sdk 0.0.3 → 0.0.5

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,4 +1,4 @@
1
- import { $ as validateSkills, B as WebSkillError, D as normalizeToolContent, F as SKILL_MANIFEST_FILE, H as buildManifest, K as isValidSkillName, O as parseBridgeRequest, P as SKILLS_LOCKFILE, Q as resolveInsideRoot, Y as parseSkillMarkdown, et as verifyManifest, o as FsArtifactStore, s as FsMemoryStore, x as bridgeError } from "./dist-hMMxARXK.js";
1
+ import { B as SKILL_MANIFEST_FILE, G as WebSkillError, M as normalizeToolContent, N as parseBridgeRequest, Z as isValidSkillName, a as CapabilityApproval, at as verifyManifest, c as FsMemoryStore, et as parseSkillMarkdown, it as validateSkills, j as networkUrlHost, k as isNetworkAllowed, q as buildManifest, rt as resolveInsideRoot, s as FsArtifactStore, w as bridgeError, z as SKILLS_LOCKFILE } from "./dist-D405AlPD.js";
2
2
  import { existsSync, promises, readFileSync } from "node:fs";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -224,6 +224,11 @@ var NodeScriptExecutor = class {
224
224
  const baseName = (p) => p.split("/").pop() ?? p;
225
225
  const toPlatform$1 = (p) => p.split("/").join(path.sep);
226
226
  const messageOf$5 = (e) => e instanceof Error ? e.message : String(e);
227
+ /**
228
+ * 网络策略判定函数源码(注入 Worker;匹配逻辑单一来源在
229
+ * runtime/sandbox/networkPolicy.ts,Worker 线程不走 vitest 别名故注入而非 import)
230
+ */
231
+ const NETWORK_POLICY_LIB = `${isNetworkAllowed.toString()}\n${networkUrlHost.toString()}`;
227
232
  /** Worker 入口文件:src 为同目录 .ts;dist 为 dist/executor/ 下的 .js */
228
233
  function workerEntryPath() {
229
234
  const dir = path.dirname(fileURLToPath(import.meta.url));
@@ -245,6 +250,8 @@ var SandboxedScriptExecutor = class {
245
250
  #fs;
246
251
  #options;
247
252
  #capabilities;
253
+ #networkPolicy;
254
+ #approval;
248
255
  constructor(fs, options = {}) {
249
256
  this.#fs = fs;
250
257
  this.#options = options;
@@ -253,6 +260,11 @@ var SandboxedScriptExecutor = class {
253
260
  writeArtifact: options.capabilities?.writeArtifact ?? true,
254
261
  confirm: options.capabilities?.confirm ?? true
255
262
  };
263
+ this.#networkPolicy = options.networkPolicy ?? "deny-all";
264
+ this.#approval = new CapabilityApproval({
265
+ ...options.uiBridge ? { uiBridge: options.uiBridge } : {},
266
+ ...options.approvalScope ? { scope: options.approvalScope } : {}
267
+ });
256
268
  }
257
269
  async #locateScript(skillRoot, scriptName) {
258
270
  const tsPath = `${skillRoot}/scripts/${scriptName}.ts`;
@@ -302,7 +314,7 @@ var SandboxedScriptExecutor = class {
302
314
  skillName: context.skillName,
303
315
  runId: context.runId,
304
316
  args
305
- }, timeoutMs, (request) => this.#handleBridge(request, context));
317
+ }, timeoutMs, (request) => this.#handleBridge(request, context), (host) => context.onWarning?.(`Network request blocked by sandbox network policy: ${host}`));
306
318
  if (!result.ok) {
307
319
  const stderrSummary = result.stderr?.length ? ` | stderr: ${result.stderr.join(" | ").slice(0, 500)}` : "";
308
320
  return {
@@ -335,12 +347,16 @@ var SandboxedScriptExecutor = class {
335
347
  }
336
348
  }
337
349
  /** 起独立 Worker 执行任务;超时 terminate(同步死循环可杀);非零退出码 → TOOL_EXECUTION_FAILED */
338
- #runWorker(workerData, timeoutMs = 3e4, onBridge) {
350
+ #runWorker(workerData, timeoutMs = 3e4, onBridge, onNetworkBlocked) {
339
351
  const envWhitelist = this.#options.envWhitelist ?? [];
340
352
  const env = Object.fromEntries(envWhitelist.filter((key) => process.env[key] !== void 0).map((key) => [key, process.env[key]]));
341
353
  return new Promise((resolve, reject) => {
342
354
  const worker = new Worker(workerEntryPath(), {
343
- workerData,
355
+ workerData: {
356
+ ...workerData,
357
+ networkPolicy: this.#networkPolicy,
358
+ networkPolicyLib: NETWORK_POLICY_LIB
359
+ },
344
360
  env,
345
361
  resourceLimits: this.#options.resourceLimits ?? {
346
362
  maxOldGenerationSizeMb: 64,
@@ -361,6 +377,10 @@ var SandboxedScriptExecutor = class {
361
377
  fn();
362
378
  };
363
379
  worker.on("message", (msg) => {
380
+ if (msg?.type === "network-blocked") {
381
+ if (typeof msg.host === "string") onNetworkBlocked?.(msg.host);
382
+ return;
383
+ }
364
384
  if (msg?.type === "bridge" && onBridge) {
365
385
  const request = parseBridgeRequest(msg.request);
366
386
  const respond = (response) => worker.postMessage({
@@ -382,20 +402,36 @@ var SandboxedScriptExecutor = class {
382
402
  });
383
403
  });
384
404
  }
385
- /** 能力桥宿主侧处理:能力关闭即 TOOL_UNSUPPORTED;委托 context */
405
+ /** 能力桥宿主侧处理:能力关闭/授权拒绝即 TOOL_UNSUPPORTED;判定逻辑共用 runtime/sandbox/approval */
386
406
  async #handleBridge(request, context) {
387
- const unsupported = (capability) => bridgeError(request.id, "TOOL_UNSUPPORTED", `Capability "${capability}" is disabled`);
407
+ const gate = async (capability, message, details) => {
408
+ const decision = await this.#approval.authorize({
409
+ runId: context.runId,
410
+ capability,
411
+ mode: this.#capabilities[capability],
412
+ message,
413
+ ...details !== void 0 ? { details } : {}
414
+ });
415
+ if (decision === "allowed") return void 0;
416
+ return bridgeError(request.id, "TOOL_UNSUPPORTED", decision === "disabled" ? `Capability "${capability}" is disabled` : `Capability "${capability}" was denied by the user`);
417
+ };
388
418
  try {
389
419
  switch (request.kind) {
390
- case "readReference":
391
- if (!this.#capabilities.readReference) return unsupported("readReference");
420
+ case "readReference": {
421
+ const denied = await gate("readReference", `Script "${context.skillName}" wants to read reference "${request.path}"`, { path: request.path });
422
+ if (denied) return denied;
392
423
  return {
393
424
  id: request.id,
394
425
  ok: true,
395
426
  value: await context.readReference(request.path)
396
427
  };
428
+ }
397
429
  case "writeArtifact": {
398
- if (!this.#capabilities.writeArtifact) return unsupported("writeArtifact");
430
+ const denied = await gate("writeArtifact", `Script "${context.skillName}" wants to write artifact "${request.path}"`, {
431
+ path: request.path,
432
+ mimeType: request.mimeType
433
+ });
434
+ if (denied) return denied;
399
435
  const content = typeof request.content === "string" ? request.content : new Uint8Array(request.content);
400
436
  const artifact = await context.writeArtifact(request.path, content, { ...request.mimeType ? { mimeType: request.mimeType } : {} });
401
437
  return {
@@ -404,13 +440,16 @@ var SandboxedScriptExecutor = class {
404
440
  value: artifact
405
441
  };
406
442
  }
407
- case "confirm":
408
- if (!this.#capabilities.confirm || !context.confirm) return unsupported("confirm");
443
+ case "confirm": {
444
+ if (!context.confirm) return bridgeError(request.id, "TOOL_UNSUPPORTED", "Capability \"confirm\" is disabled");
445
+ const denied = await gate("confirm", `Script "${context.skillName}" asks for confirmation: ${request.message}`);
446
+ if (denied) return denied;
409
447
  return {
410
448
  id: request.id,
411
449
  ok: true,
412
450
  value: await context.confirm(request.message)
413
451
  };
452
+ }
414
453
  }
415
454
  } catch (e) {
416
455
  return bridgeError(request.id, e instanceof WebSkillError ? e.code : "TOOL_EXECUTION_FAILED", messageOf$5(e));
@@ -615,7 +654,8 @@ var FileMemoryStore = class extends FsMemoryStore {
615
654
  };
616
655
  /**
617
656
  * 命令行 UiBridge:ask→问答,confirm→y/n(带默认值),
618
- * form→逐字段提示(显示默认值与必填标记),select→编号列表。
657
+ * form→逐字段提示(显示默认值与必填标记),select→编号列表,
658
+ * authorize→授权询问(默认拒绝,仅显式 y/yes 批准)。
619
659
  * 输入/输出流可注入(测试用 PassThrough)。
620
660
  */
621
661
  var CliUiBridge = class {
@@ -659,6 +699,14 @@ var CliUiBridge = class {
659
699
  value: option ? option.value : void 0
660
700
  };
661
701
  }
702
+ case "authorize": {
703
+ this.#write(`[authorization required: ${input.capability}]\n`);
704
+ const answer = (await this.#question(`${input.message} [y/N] `)).trim().toLowerCase();
705
+ return {
706
+ id: input.id,
707
+ value: answer === "y" || answer === "yes"
708
+ };
709
+ }
662
710
  }
663
711
  }
664
712
  async progress(input) {
@@ -1,5 +1,5 @@
1
- import { Nt as FileSystemProvider, Vt as SkillCatalogEntry, gt as WebSkillRuntime, j as LlmMessage, k as LlmClient, mt as UiBridge, qt as SkillManifest, tt as RuntimeRun } from "./index-DnI0BTEp.js";
2
- import { d as SkillManager } from "./index-D65Jk0ju.js";
1
+ import { $t as SkillCatalogEntry, Et as WebSkillRuntime, F as LlmClient, Gt as FileSystemProvider, L as LlmMessage, an as SkillManifest, dt as RuntimeRun, wt as UiBridge } from "./index-BQDc-U1x.js";
2
+ import { d as SkillManager } from "./index-aEple804.js";
3
3
  //#region ../governance/dist/index.d.ts
4
4
  //#region src/types.d.ts
5
5
  type CandidateStatus = 'draft' | 'pending-review' | 'approved' | 'published' | 'rejected';
@@ -1,5 +1,5 @@
1
- import { $ as validateSkills, B as WebSkillError, K as isValidSkillName, Q as resolveInsideRoot } from "./dist-hMMxARXK.js";
2
- import { i as NodeFS } from "./dist-C1p26Ap9.js";
1
+ import { G as WebSkillError, Z as isValidSkillName, it as validateSkills, rt as resolveInsideRoot } from "./dist-D405AlPD.js";
2
+ import { i as NodeFS } from "./dist-Ixnb-hNR.js";
3
3
  import path from "node:path";
4
4
  import { mkdtemp } from "node:fs/promises";
5
5
  import { tmpdir } from "node:os";
@@ -1,6 +1,6 @@
1
1
  //#region ../core/dist/index.d.ts
2
2
  //#region src/errors.d.ts
3
- type WebSkillErrorCode = 'FS_NOT_FOUND' | 'FS_PATH_OUTSIDE_ROOT' | 'SKILL_NOT_FOUND' | 'SKILL_INVALID_METADATA' | 'SKILL_INVALID_NAME' | 'SKILL_DUPLICATE_NAME' | 'SKILL_UNSUPPORTED_SCRIPT' | 'VALIDATION_FAILED' | 'TOOL_NOT_FOUND' | 'TOOL_EXECUTION_FAILED' | 'TOOL_UNSUPPORTED' | 'TOOL_SCHEMA_UNAVAILABLE' | 'RUN_TIMEOUT' | 'RUN_MAX_TURNS_EXCEEDED' | 'RUN_FAILED' | 'RUN_CANCELLED' | 'RUN_INTERACTION_TIMEOUT' | 'UI_UNAVAILABLE' | 'LLM_UNAVAILABLE' | 'LLM_REQUEST_FAILED' | 'INSTALL_FAILED' | 'UNINSTALL_FAILED' | 'EXPORT_FAILED' | 'INTEGRITY_FAILED' | 'FS_PERMISSION_DENIED' | 'MCP_ENDPOINT_UNAVAILABLE' | 'MCP_TOOL_NOT_FOUND' | 'CANDIDATE_INVALID' | 'APPROVAL_REQUIRED' | 'SKILL_QUARANTINED' | 'SKILL_DISABLED' | 'GOVERNANCE_FAILED';
3
+ type WebSkillErrorCode = 'FS_NOT_FOUND' | 'FS_PATH_OUTSIDE_ROOT' | 'SKILL_NOT_FOUND' | 'SKILL_INVALID_METADATA' | 'SKILL_INVALID_NAME' | 'SKILL_DUPLICATE_NAME' | 'SKILL_UNSUPPORTED_SCRIPT' | 'VALIDATION_FAILED' | 'TOOL_NOT_FOUND' | 'TOOL_EXECUTION_FAILED' | 'NETWORK_BLOCKED' | 'TOOL_UNSUPPORTED' | 'TOOL_SCHEMA_UNAVAILABLE' | 'RUN_TIMEOUT' | 'RUN_MAX_TURNS_EXCEEDED' | 'RUN_FAILED' | 'RUN_CANCELLED' | 'RUN_INTERACTION_TIMEOUT' | 'UI_UNAVAILABLE' | 'LLM_UNAVAILABLE' | 'LLM_REQUEST_FAILED' | 'INSTALL_FAILED' | 'UNINSTALL_FAILED' | 'EXPORT_FAILED' | 'INTEGRITY_FAILED' | 'FS_PERMISSION_DENIED' | 'MCP_ENDPOINT_UNAVAILABLE' | 'MCP_TOOL_NOT_FOUND' | 'CANDIDATE_INVALID' | 'APPROVAL_REQUIRED' | 'SKILL_QUARANTINED' | 'SKILL_DISABLED' | 'GOVERNANCE_FAILED' | 'RUN_SNAPSHOT_NOT_FOUND' | 'RUN_SNAPSHOT_EXPIRED' | 'RUN_SNAPSHOT_INCOMPATIBLE';
4
4
  /** 所有公开 API 抛出的结构化错误,code 供上层可编程处理 */
5
5
  declare class WebSkillError extends Error {
6
6
  readonly code: WebSkillErrorCode;
@@ -472,6 +472,8 @@ interface ScriptExecutionContext {
472
472
  }): Promise<Artifact>;
473
473
  /** 脚本主动请求人在环确认;策略见 InteractionPolicy.confirmations */
474
474
  confirm?(message: string): Promise<boolean>;
475
+ /** 宿主侧降级 warning 出口(网络阻断等;引擎接线到 run.warning trace) */
476
+ onWarning?(message: string): void;
475
477
  }
476
478
  /** Schema 推导 port:纯文本静态分析脚本源码 → JSON Schema(best-effort) */
477
479
  interface SchemaInferer {
@@ -547,6 +549,8 @@ declare function createScriptContext(deps: {
547
549
  runId: string;
548
550
  /** 提供时暴露 context.confirm(由引擎按交互策略实现) */
549
551
  confirm?: (message: string) => Promise<boolean>;
552
+ /** 宿主侧降级 warning 出口(网络阻断等;引擎接线到 run.warning trace) */
553
+ onWarning?: (message: string) => void;
550
554
  }): ScriptExecutionContext;
551
555
  //#endregion
552
556
  //#region src/interaction/types.d.ts
@@ -573,6 +577,13 @@ type InteractionRequest = {
573
577
  label: string;
574
578
  value: unknown;
575
579
  }>;
580
+ } | {
581
+ /** 能力强制授权(require-approval):与脚本自发 confirm 区分,UI 渲染为授权样式 */
582
+ type: 'authorize';
583
+ id: string;
584
+ capability: 'readReference' | 'writeArtifact' | 'confirm';
585
+ message: string;
586
+ details?: unknown;
576
587
  };
577
588
  interface InteractionResponse {
578
589
  id: string;
@@ -657,7 +668,7 @@ type LifecycleHook = (ctx: LifecycleHookContext) => Promise<void | {
657
668
  }>;
658
669
  //#endregion
659
670
  //#region src/trace/types.d.ts
660
- type TraceEventType = 'skill.routed' | 'skill.activated' | 'llm.request' | 'llm.response' | 'tool.started' | 'tool.completed' | 'tool.failed' | 'artifact.created' | 'ui.requested' | 'ui.resumed' | 'ui.rendered' | 'run.warning' | 'run.completed' | 'run.cancelled' | 'run.failed';
671
+ type TraceEventType = 'skill.routed' | 'skill.activated' | 'llm.request' | 'llm.response' | 'tool.started' | 'tool.completed' | 'tool.failed' | 'artifact.created' | 'ui.requested' | 'ui.resumed' | 'ui.rendered' | 'run.warning' | 'run.completed' | 'run.cancelled' | 'run.failed' | 'run.resumed';
661
672
  interface TraceEvent {
662
673
  id: string;
663
674
  runId: string;
@@ -891,16 +902,72 @@ interface BridgeResponse {
891
902
  message: string;
892
903
  };
893
904
  }
905
+ /**
906
+ * 能力模式:true 直通 / false 关闭(TOOL_UNSUPPORTED)/ 'require-approval' 调用前强制授权
907
+ * (布尔语义与现状完全兼容)
908
+ */
909
+ type CapabilityMode = boolean | 'require-approval';
910
+ /** 授权粒度:'once-per-run'(默认,run 内同类能力批准一次)/ 'every-call'(每次调用都问) */
911
+ type ApprovalScope = 'once-per-run' | 'every-call';
894
912
  /** 三能力独立开关;缺省全开,显式 false 即关闭(TOOL_UNSUPPORTED) */
895
913
  interface BridgeCapabilities {
896
- readReference?: boolean;
897
- writeArtifact?: boolean;
898
- confirm?: boolean;
914
+ readReference?: CapabilityMode;
915
+ writeArtifact?: CapabilityMode;
916
+ confirm?: CapabilityMode;
899
917
  }
900
918
  /** 入站校验:非法 kind / 缺 id / 缺字段 → undefined(调用方忽略并记 warning) */
901
919
  declare function parseBridgeRequest(data: unknown): BridgeRequest | undefined;
902
920
  declare function bridgeError(id: string, code: string, message: string): BridgeResponse;
903
921
  //#endregion
922
+ //#region src/sandbox/networkPolicy.d.ts
923
+ /**
924
+ * 网络策略类型 + 匹配逻辑(单一来源:browser worker 经函数字符串注入、
925
+ * node worker 直接 import,禁止各自重复实现)。
926
+ *
927
+ * 注意:isNetworkAllowed 会被 toString() 内嵌进浏览器 Worker bootstrap,
928
+ * 函数体必须自包含(不引用模块内其它符号),且不得使用模板字符串/反引号。
929
+ */
930
+ type NetworkPolicy = 'deny-all' | 'allow-all' | {
931
+ allow: string[];
932
+ };
933
+ /**
934
+ * 判定 URL 是否被策略放行:
935
+ * - 'deny-all'(默认)全拒;'allow-all' 全放
936
+ * - { allow } 条目支持三种写法:
937
+ * - 精确域名 'api.example.com'(忽略端口与路径)
938
+ * - 通配 '*.example.com'(含 apex 与任意深度子域)
939
+ * - 源 'http://localhost:3000'(协议 + host + port 全等)
940
+ * - URL 解析失败一律拒绝
941
+ */
942
+ declare function isNetworkAllowed(policy: NetworkPolicy, url: string): boolean;
943
+ /** 阻断 trace 用的脱敏 host(解析失败返回占位,不记录完整 URL) */
944
+ declare function networkUrlHost(url: string): string;
945
+ //#endregion
946
+ //#region src/sandbox/approval.d.ts
947
+ /** 桥消息对应的三类能力 */
948
+ type BridgeCapability = 'readReference' | 'writeArtifact' | 'confirm';
949
+ /** allowed 放行;denied 用户拒绝/无法询问;disabled 能力关闭(两者都回 TOOL_UNSUPPORTED,仅消息不同) */
950
+ type ApprovalDecision = 'allowed' | 'denied' | 'disabled';
951
+ /**
952
+ * Per-capability 强制授权判定(宿主侧,browser/node 执行器共用单一来源)。
953
+ * 'require-approval' 模式下经注入的 UiBridge 发 authorize 交互;
954
+ * once-per-run(默认)在 run 内记忆已批准能力,every-call 每次调用都问。
955
+ */
956
+ declare class CapabilityApproval {
957
+ #private;
958
+ constructor(deps?: {
959
+ uiBridge?: UiBridge;
960
+ scope?: ApprovalScope;
961
+ });
962
+ authorize(input: {
963
+ runId: string;
964
+ capability: BridgeCapability;
965
+ mode: CapabilityMode;
966
+ message: string;
967
+ details?: unknown;
968
+ }): Promise<ApprovalDecision>;
969
+ }
970
+ //#endregion
904
971
  //#region src/trace/traceRecorder.d.ts
905
972
  interface TraceClock {
906
973
  now?: () => string;
@@ -940,6 +1007,56 @@ interface ExternalSkillProvider {
940
1007
  */
941
1008
  declare function mergeCatalogEntries(localEntries: SkillCatalogEntry[], providerEntries: SkillCatalogEntry[]): SkillCatalogEntry[];
942
1009
  //#endregion
1010
+ //#region src/engine/snapshot.d.ts
1011
+ declare const RUN_SNAPSHOT_SCHEMA_VERSION = 1;
1012
+ /** interrupted(等待用户)状态点的可恢复快照(D3 收窄版) */
1013
+ interface RunSnapshot {
1014
+ schemaVersion: 1;
1015
+ runId: string;
1016
+ sessionId: string;
1017
+ userPrompt: string;
1018
+ startedAt: string;
1019
+ /** 完整消息历史(含 system/user/assistant/tool) */
1020
+ messages: LlmMessage[];
1021
+ /** 当前轮次(护栏续算) */
1022
+ turn: number;
1023
+ activeSkillNames: string[];
1024
+ /** 已注册脚本工具定义(恢复后免重新激活) */
1025
+ activatedTools: ToolDefinition[];
1026
+ /** 等待中的交互(恢复时重新发起,表单重新渲染) */
1027
+ pendingInteraction: InteractionRequest;
1028
+ /** 进入 interrupted 时计算的过期时间 */
1029
+ interactionExpiresAt: string;
1030
+ config: {
1031
+ maxTurns: number;
1032
+ totalTimeoutMs: number;
1033
+ toolTimeoutMs: number;
1034
+ temperature?: number;
1035
+ };
1036
+ snapshotAt: string;
1037
+ }
1038
+ interface RunSnapshotStore {
1039
+ save(snapshot: RunSnapshot): Promise<void>;
1040
+ load(runId: string): Promise<RunSnapshot | undefined>;
1041
+ delete(runId: string): Promise<void>;
1042
+ list(): Promise<RunSnapshot[]>;
1043
+ }
1044
+ /**
1045
+ * FileSystemProvider 后端的快照存储:<root>/<runId>.snapshot.json。
1046
+ * 坏 JSON → RUN_SNAPSHOT_INCOMPATIBLE 并自动清理坏文件;runId 过路径安全校验。
1047
+ */
1048
+ declare class FsRunSnapshotStore implements RunSnapshotStore {
1049
+ #private;
1050
+ constructor(deps: {
1051
+ root: string;
1052
+ fs: FileSystemProvider;
1053
+ });
1054
+ save(snapshot: RunSnapshot): Promise<void>;
1055
+ load(runId: string): Promise<RunSnapshot | undefined>;
1056
+ delete(runId: string): Promise<void>;
1057
+ list(): Promise<RunSnapshot[]>;
1058
+ }
1059
+ //#endregion
943
1060
  //#region src/engine/agentLoop.d.ts
944
1061
  interface AgentLoopDeps {
945
1062
  llm: LlmClient;
@@ -971,6 +1088,8 @@ interface AgentLoopDeps {
971
1088
  skillProviders?: ExternalSkillProvider[];
972
1089
  /** Catalog 过滤钩子(治理状态拦截路由,如 quarantined/deprecated 过滤) */
973
1090
  catalogFilter?: (entries: SkillCatalogEntry[]) => SkillCatalogEntry[] | Promise<SkillCatalogEntry[]>;
1091
+ /** D3:interrupt 点快照存储(无配置则行为与现状完全一致) */
1092
+ snapshotStore?: RunSnapshotStore;
974
1093
  }
975
1094
  /**
976
1095
  * 多轮 Agent 循环。
@@ -986,6 +1105,11 @@ declare class AgentLoop {
986
1105
  route: RouteResult;
987
1106
  runId?: string;
988
1107
  }): Promise<RunResult>;
1108
+ /**
1109
+ * D3 恢复:以快照重建 LoopState,重新发起等待中的交互(表单重新渲染),
1110
+ * 应答后从快照轮次续跑主循环;totalTimeout 以快照 startedAt 续算。
1111
+ */
1112
+ resume(snapshot: RunSnapshot): Promise<RunResult>;
989
1113
  }
990
1114
  //#endregion
991
1115
  //#region src/engine/runtime.d.ts
@@ -1022,8 +1146,10 @@ interface WebSkillRuntimeDeps {
1022
1146
  /** opt-in:run 完成且未激活任何技能时回调(默认关闭,fire-and-forget) */
1023
1147
  onSkillMiss?: (input: {
1024
1148
  prompt: string;
1025
- run: RunResult['run'];
1149
+ run: RuntimeRun;
1026
1150
  }) => Promise<void>;
1151
+ /** D3:interrupt 点快照存储(配置后 interrupted run 可 resumeRun 恢复) */
1152
+ snapshotStore?: RunSnapshotStore;
1027
1153
  }
1028
1154
  /** runtime 门面:组合 discovery / router / agent loop / lifecycle */
1029
1155
  declare class WebSkillRuntime {
@@ -1034,6 +1160,14 @@ declare class WebSkillRuntime {
1034
1160
  get events(): EventBus;
1035
1161
  discover(): Promise<DiscoveryResult>;
1036
1162
  run(userPrompt: string): Promise<RunResult>;
1163
+ /** D3:列出可恢复的 interrupted run(供 UI 展示"未完成任务") */
1164
+ listInterruptedRuns(): Promise<RunSnapshot[]>;
1165
+ /**
1166
+ * D3 恢复 interrupted run:
1167
+ * 不存在 → RUN_SNAPSHOT_NOT_FOUND;schemaVersion 不匹配 → 删除 + RUN_SNAPSHOT_INCOMPATIBLE;
1168
+ * 已过期 → interaction-timeout 终态并删快照;否则重建 LoopState 重新发起交互续跑。
1169
+ */
1170
+ resumeRun(runId: string): Promise<RunResult>;
1037
1171
  }
1038
1172
  //#endregion
1039
- export { RunTerminationReason as $, VerifyResult as $t, LlmCompleteInput as A, CatalogRenderer as At, MockLlmQueueItem as B, SkillCatalog as Bt, InteractionRequest as C, mergeCatalogEntries as Ct, LifecycleHookContext as D, schemaToForm as Dt, LifecycleHook as E, resolveToolName as Et, LlmToolSpec as F, MemoryFS as Ft, ProgressiveRouter as G, SkillIssue as Gt, MockUiBridge as H, SkillDiscovery as Ht, MemoryArtifactStore as I, SKILLS_LOCKFILE as It, READ_SKILL_FILE_TOOL_NAME as J, SkillMetadata as Jt, READ_SKILL_FILE_INPUT_SCHEMA as K, SkillLocation as Kt, MemoryStore as L, SKILL_MANIFEST_FILE as Lt, LlmResponse as M, FileStat as Mt, LlmStreamEvent as N, FileSystemProvider as Nt, LifecycleListener as O, toLlmToolSpec as Ot, LlmToolCall as P, JsonSchema as Pt, RunResult as Q, ValidationReport as Qt, MockLlmClient as R, SKILL_NAME_MAX_LENGTH as Rt, InteractionPolicy as S, fromVercelStreamPart as St, LifecycleEvent as T, parseBridgeRequest as Tt, OpenAiCompatibleClient as U, SkillDocument as Ut, MockUiAnswer as V, SkillCatalogEntry as Vt, OpenAiCompatibleClientConfig as W, SkillInstallSource as Wt, RenderResultRequest as X, SkillSource as Xt, RenderBlock as Y, SkillReader as Yt, RouteResult as Z, SkillsLockfile as Zt, FsMemoryStore as _, WebSkillRuntimeDeps as _t, AgentLoopConfig as a, computeDigest as an, ScriptExecutor as at, HookRunnerOptions as b, createScriptContext as bt, ArtifactStore as c, jsonRenderer as cn, ToolResolution as ct, BridgeResponse as d, renderAvailableSkillsXml as dn, TraceEvent as dt, WebSkillError as en, RuntimePhase as et, EventBus as f, renderCatalogJson as fn, TraceEventType as ft, FsArtifactStore as g, xmlRenderer as gn, WebSkillRuntime as gt, FormField as h, verifyManifest as hn, VercelToolSpec as ht, AgentLoop as i, checkSkillRules as in, ScriptExecutionContext as it, LlmMessage as j, DiscoveryResult as jt, LlmClient as k, toVercelToolSpecs as kt, BridgeCapabilities as l, normalizePath as ln, ToolResult as lt, ExternalToolSource as m, validateSkills as mn, UiBridge as mt, ASK_USER_TOOL as n, buildCatalog as nn, RuntimeSession as nt, AgentLoopDeps as o, escapeXml as on, SkillRouter as ot, ExternalSkillProvider as p, resolveInsideRoot as pn, TraceRecorder as pt, READ_SKILL_FILE_TOOL as q, SkillManifest as qt, ASK_USER_TOOL_NAME as r, buildManifest as rn, SchemaInferer as rt, Artifact as s, isValidSkillName as sn, ToolDefinition as st, ASK_USER_INPUT_SCHEMA as t, WebSkillErrorCode as tn, RuntimeRun as tt, BridgeRequest as u, parseSkillMarkdown as un, TraceClock as ut, FullDisclosureRouter as v, bridgeError as vt, InteractionResponse as w, normalizeToolContent as wt, InMemoryStore as x, fromVercelResult as xt, HookRunner as y, buildRenderResult as yt, MockLlmHandler as z, SKILL_NAME_PATTERN as zt };
1173
+ export { READ_SKILL_FILE_INPUT_SCHEMA as $, SkillCatalogEntry as $t, InteractionResponse as A, createScriptContext as At, LlmToolCall as B, toLlmToolSpec as Bt, FsRunSnapshotStore as C, renderAvailableSkillsXml as Cn, TraceRecorder as Ct, InMemoryStore as D, verifyManifest as Dn, WebSkillRuntimeDeps as Dt, HookRunnerOptions as E, validateSkills as En, WebSkillRuntime as Et, LlmClient as F, networkUrlHost as Ft, MockLlmHandler as G, FileSystemProvider as Gt, MemoryArtifactStore as H, CatalogRenderer as Ht, LlmCompleteInput as I, normalizeToolContent as It, MockUiBridge as J, SKILLS_LOCKFILE as Jt, MockLlmQueueItem as K, JsonSchema as Kt, LlmMessage as L, parseBridgeRequest as Lt, LifecycleHook as M, fromVercelStreamPart as Mt, LifecycleHookContext as N, isNetworkAllowed as Nt, InteractionPolicy as O, xmlRenderer as On, bridgeError as Ot, LifecycleListener as P, mergeCatalogEntries as Pt, ProgressiveRouter as Q, SkillCatalog as Qt, LlmResponse as R, resolveToolName as Rt, FsMemoryStore as S, parseSkillMarkdown as Sn, TraceEventType as St, HookRunner as T, resolveInsideRoot as Tn, VercelToolSpec as Tt, MemoryStore as U, DiscoveryResult as Ut, LlmToolSpec as V, toVercelToolSpecs as Vt, MockLlmClient as W, FileStat as Wt, OpenAiCompatibleClient as X, SKILL_NAME_MAX_LENGTH as Xt, NetworkPolicy as Y, SKILL_MANIFEST_FILE as Yt, OpenAiCompatibleClientConfig as Z, SKILL_NAME_PATTERN as Zt, EventBus as _, computeDigest as _n, ToolDefinition as _t, AgentLoopConfig as a, SkillManifest as an, RouteResult as at, FormField as b, jsonRenderer as bn, TraceClock as bt, ApprovalScope as c, SkillSource as cn, RunSnapshotStore as ct, BridgeCapabilities as d, VerifyResult as dn, RuntimeRun as dt, SkillDiscovery as en, READ_SKILL_FILE_TOOL as et, BridgeCapability as f, WebSkillError as fn, RuntimeSession as ft, CapabilityMode as g, checkSkillRules as gn, SkillRouter as gt, CapabilityApproval as h, buildManifest as hn, ScriptExecutor as ht, AgentLoop as i, SkillLocation as in, RenderResultRequest as it, LifecycleEvent as j, fromVercelResult as jt, InteractionRequest as k, buildRenderResult as kt, Artifact as l, SkillsLockfile as ln, RunTerminationReason as lt, BridgeResponse as m, buildCatalog as mn, ScriptExecutionContext as mt, ASK_USER_TOOL as n, SkillInstallSource as nn, RUN_SNAPSHOT_SCHEMA_VERSION as nt, AgentLoopDeps as o, SkillMetadata as on, RunResult as ot, BridgeRequest as p, WebSkillErrorCode as pn, SchemaInferer as pt, MockUiAnswer as q, MemoryFS as qt, ASK_USER_TOOL_NAME as r, SkillIssue as rn, RenderBlock as rt, ApprovalDecision as s, SkillReader as sn, RunSnapshot as st, ASK_USER_INPUT_SCHEMA as t, SkillDocument as tn, READ_SKILL_FILE_TOOL_NAME as tt, ArtifactStore as u, ValidationReport as un, RuntimePhase as ut, ExternalSkillProvider as v, escapeXml as vn, ToolResolution as vt, FullDisclosureRouter as w, renderCatalogJson as wn, UiBridge as wt, FsArtifactStore as x, normalizePath as xn, TraceEvent as xt, ExternalToolSource as y, isValidSkillName as yn, ToolResult as yt, LlmStreamEvent as z, schemaToForm as zt };
@@ -1,4 +1,4 @@
1
- import { $t as VerifyResult, C as InteractionRequest, Mt as FileStat, Nt as FileSystemProvider, Pt as JsonSchema, Wt as SkillInstallSource, X as RenderResultRequest, Zt as SkillsLockfile, _ as FsMemoryStore, at as ScriptExecutor, g as FsArtifactStore, it as ScriptExecutionContext, l as BridgeCapabilities, lt as ToolResult, mt as UiBridge, qt as SkillManifest, rt as SchemaInferer, st as ToolDefinition, w as InteractionResponse } from "./index-DnI0BTEp.js";
1
+ import { A as InteractionResponse, Gt as FileSystemProvider, Kt as JsonSchema, S as FsMemoryStore, Wt as FileStat, Y as NetworkPolicy, _t as ToolDefinition, an as SkillManifest, c as ApprovalScope, d as BridgeCapabilities, dn as VerifyResult, ht as ScriptExecutor, it as RenderResultRequest, k as InteractionRequest, ln as SkillsLockfile, mt as ScriptExecutionContext, nn as SkillInstallSource, pt as SchemaInferer, wt as UiBridge, x as FsArtifactStore, yt as ToolResult } from "./index-BQDc-U1x.js";
2
2
  import { Readable, Writable } from "node:stream";
3
3
  //#region ../node/dist/index.d.ts
4
4
  //#region src/fs/nodeFs.d.ts
@@ -47,6 +47,12 @@ interface SandboxOptions {
47
47
  /** env 白名单(仅这些变量传入 Worker;默认空) */
48
48
  envWhitelist?: string[];
49
49
  capabilities?: BridgeCapabilities;
50
+ /** 网络策略:默认 'deny-all'(白名单见 runtime/sandbox/networkPolicy) */
51
+ networkPolicy?: NetworkPolicy;
52
+ /** require-approval 模式的授权询问出口(缺失时 require-approval 一律拒绝) */
53
+ uiBridge?: UiBridge;
54
+ /** 授权粒度:默认 'once-per-run' */
55
+ approvalScope?: ApprovalScope;
50
56
  }
51
57
  /**
52
58
  * D1:worker_threads 沙箱脚本执行器。
@@ -105,7 +111,8 @@ declare class FileMemoryStore extends FsMemoryStore {
105
111
  //#region src/ui/cliUiBridge.d.ts
106
112
  /**
107
113
  * 命令行 UiBridge:ask→问答,confirm→y/n(带默认值),
108
- * form→逐字段提示(显示默认值与必填标记),select→编号列表。
114
+ * form→逐字段提示(显示默认值与必填标记),select→编号列表,
115
+ * authorize→授权询问(默认拒绝,仅显式 y/yes 批准)。
109
116
  * 输入/输出流可注入(测试用 PassThrough)。
110
117
  */
111
118
  declare class CliUiBridge implements UiBridge {
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as RunTerminationReason, $t as VerifyResult, A as LlmCompleteInput, At as CatalogRenderer, B as MockLlmQueueItem, Bt as SkillCatalog, C as InteractionRequest, Ct as mergeCatalogEntries, D as LifecycleHookContext, Dt as schemaToForm, E as LifecycleHook, Et as resolveToolName, F as LlmToolSpec, Ft as MemoryFS, G as ProgressiveRouter, Gt as SkillIssue, H as MockUiBridge, Ht as SkillDiscovery, I as MemoryArtifactStore, It as SKILLS_LOCKFILE, J as READ_SKILL_FILE_TOOL_NAME, Jt as SkillMetadata, K as READ_SKILL_FILE_INPUT_SCHEMA, Kt as SkillLocation, L as MemoryStore, Lt as SKILL_MANIFEST_FILE, M as LlmResponse, Mt as FileStat, N as LlmStreamEvent, Nt as FileSystemProvider, O as LifecycleListener, Ot as toLlmToolSpec, P as LlmToolCall, Pt as JsonSchema, Q as RunResult, Qt as ValidationReport, R as MockLlmClient, Rt as SKILL_NAME_MAX_LENGTH, S as InteractionPolicy, St as fromVercelStreamPart, T as LifecycleEvent, Tt as parseBridgeRequest, U as OpenAiCompatibleClient, Ut as SkillDocument, V as MockUiAnswer, Vt as SkillCatalogEntry, W as OpenAiCompatibleClientConfig, Wt as SkillInstallSource, X as RenderResultRequest, Xt as SkillSource, Y as RenderBlock, Yt as SkillReader, Z as RouteResult, Zt as SkillsLockfile, _ as FsMemoryStore, _t as WebSkillRuntimeDeps, a as AgentLoopConfig, an as computeDigest, at as ScriptExecutor, b as HookRunnerOptions, bt as createScriptContext, c as ArtifactStore, cn as jsonRenderer, ct as ToolResolution, d as BridgeResponse, dn as renderAvailableSkillsXml, dt as TraceEvent, en as WebSkillError, et as RuntimePhase, f as EventBus, fn as renderCatalogJson, ft as TraceEventType, g as FsArtifactStore, gn as xmlRenderer, gt as WebSkillRuntime, h as FormField, hn as verifyManifest, ht as VercelToolSpec, i as AgentLoop, in as checkSkillRules, it as ScriptExecutionContext, j as LlmMessage, jt as DiscoveryResult, k as LlmClient, kt as toVercelToolSpecs, l as BridgeCapabilities, ln as normalizePath, lt as ToolResult, m as ExternalToolSource, mn as validateSkills, mt as UiBridge, n as ASK_USER_TOOL, nn as buildCatalog, nt as RuntimeSession, o as AgentLoopDeps, on as escapeXml, ot as SkillRouter, p as ExternalSkillProvider, pn as resolveInsideRoot, pt as TraceRecorder, q as READ_SKILL_FILE_TOOL, qt as SkillManifest, r as ASK_USER_TOOL_NAME, rn as buildManifest, rt as SchemaInferer, s as Artifact, sn as isValidSkillName, st as ToolDefinition, t as ASK_USER_INPUT_SCHEMA, tn as WebSkillErrorCode, tt as RuntimeRun, u as BridgeRequest, un as parseSkillMarkdown, ut as TraceClock, v as FullDisclosureRouter, vt as bridgeError, w as InteractionResponse, wt as normalizeToolContent, x as InMemoryStore, xt as fromVercelResult, y as HookRunner, yt as buildRenderResult, z as MockLlmHandler, zt as SKILL_NAME_PATTERN } from "./index-DnI0BTEp.js";
2
- export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, type AgentLoopConfig, type AgentLoopDeps, type Artifact, type ArtifactStore, type BridgeCapabilities, type BridgeRequest, type BridgeResponse, type CatalogRenderer, type DiscoveryResult, EventBus, type ExternalSkillProvider, type ExternalToolSource, type FileStat, type FileSystemProvider, type FormField, FsArtifactStore, FsMemoryStore, FullDisclosureRouter, HookRunner, type HookRunnerOptions, InMemoryStore, 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, MemoryArtifactStore, MemoryFS, type MemoryStore, MockLlmClient, type MockLlmHandler, type MockLlmQueueItem, type MockUiAnswer, MockUiBridge, OpenAiCompatibleClient, type OpenAiCompatibleClientConfig, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, type RenderBlock, type RenderResultRequest, type RouteResult, type RunResult, type RunTerminationReason, type RuntimePhase, type RuntimeRun, type RuntimeSession, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, type SchemaInferer, type ScriptExecutionContext, type ScriptExecutor, type SkillCatalog, type SkillCatalogEntry, SkillDiscovery, type SkillDocument, type SkillInstallSource, type SkillIssue, type SkillLocation, type SkillManifest, type SkillMetadata, SkillReader, type SkillRouter, type SkillSource, type SkillsLockfile, type ToolDefinition, type ToolResolution, type ToolResult, type TraceClock, type TraceEvent, type TraceEventType, TraceRecorder, type UiBridge, type ValidationReport, type VercelToolSpec, type VerifyResult, WebSkillError, type WebSkillErrorCode, WebSkillRuntime, type WebSkillRuntimeDeps, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkSkillRules, computeDigest, createScriptContext, escapeXml, fromVercelResult, fromVercelStreamPart, isValidSkillName, jsonRenderer, mergeCatalogEntries, normalizePath, normalizeToolContent, parseBridgeRequest, parseSkillMarkdown, renderAvailableSkillsXml, renderCatalogJson, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, validateSkills, verifyManifest, xmlRenderer };
1
+ import { $ as READ_SKILL_FILE_INPUT_SCHEMA, $t as SkillCatalogEntry, A as InteractionResponse, At as createScriptContext, B as LlmToolCall, Bt as toLlmToolSpec, C as FsRunSnapshotStore, Cn as renderAvailableSkillsXml, Ct as TraceRecorder, D as InMemoryStore, Dn as verifyManifest, Dt as WebSkillRuntimeDeps, E as HookRunnerOptions, En as validateSkills, Et as WebSkillRuntime, F as LlmClient, Ft as networkUrlHost, G as MockLlmHandler, Gt as FileSystemProvider, H as MemoryArtifactStore, Ht as CatalogRenderer, I as LlmCompleteInput, It as normalizeToolContent, J as MockUiBridge, Jt as SKILLS_LOCKFILE, K as MockLlmQueueItem, Kt as JsonSchema, L as LlmMessage, Lt as parseBridgeRequest, M as LifecycleHook, Mt as fromVercelStreamPart, N as LifecycleHookContext, Nt as isNetworkAllowed, O as InteractionPolicy, On as xmlRenderer, Ot as bridgeError, P as LifecycleListener, Pt as mergeCatalogEntries, Q as ProgressiveRouter, Qt as SkillCatalog, R as LlmResponse, Rt as resolveToolName, S as FsMemoryStore, Sn as parseSkillMarkdown, St as TraceEventType, T as HookRunner, Tn as resolveInsideRoot, Tt as VercelToolSpec, U as MemoryStore, Ut as DiscoveryResult, V as LlmToolSpec, Vt as toVercelToolSpecs, W as MockLlmClient, Wt as FileStat, X as OpenAiCompatibleClient, Xt as SKILL_NAME_MAX_LENGTH, Y as NetworkPolicy, Yt as SKILL_MANIFEST_FILE, Z as OpenAiCompatibleClientConfig, Zt as SKILL_NAME_PATTERN, _ as EventBus, _n as computeDigest, _t as ToolDefinition, a as AgentLoopConfig, an as SkillManifest, at as RouteResult, b as FormField, bn as jsonRenderer, bt as TraceClock, c as ApprovalScope, cn as SkillSource, ct as RunSnapshotStore, d as BridgeCapabilities, dn as VerifyResult, dt as RuntimeRun, en as SkillDiscovery, et as READ_SKILL_FILE_TOOL, f as BridgeCapability, fn as WebSkillError, ft as RuntimeSession, g as CapabilityMode, gn as checkSkillRules, gt as SkillRouter, h as CapabilityApproval, hn as buildManifest, ht as ScriptExecutor, i as AgentLoop, in as SkillLocation, it as RenderResultRequest, j as LifecycleEvent, jt as fromVercelResult, k as InteractionRequest, kt as buildRenderResult, l as Artifact, ln as SkillsLockfile, lt as RunTerminationReason, m as BridgeResponse, mn as buildCatalog, mt as ScriptExecutionContext, n as ASK_USER_TOOL, nn as SkillInstallSource, nt as RUN_SNAPSHOT_SCHEMA_VERSION, o as AgentLoopDeps, on as SkillMetadata, ot as RunResult, p as BridgeRequest, pn as WebSkillErrorCode, pt as SchemaInferer, q as MockUiAnswer, qt as MemoryFS, r as ASK_USER_TOOL_NAME, rn as SkillIssue, rt as RenderBlock, s as ApprovalDecision, sn as SkillReader, st as RunSnapshot, t as ASK_USER_INPUT_SCHEMA, tn as SkillDocument, tt as READ_SKILL_FILE_TOOL_NAME, u as ArtifactStore, un as ValidationReport, ut as RuntimePhase, v as ExternalSkillProvider, vn as escapeXml, vt as ToolResolution, w as FullDisclosureRouter, wn as renderCatalogJson, wt as UiBridge, x as FsArtifactStore, xn as normalizePath, xt as TraceEvent, y as ExternalToolSource, yn as isValidSkillName, yt as ToolResult, z as LlmStreamEvent, zt as schemaToForm } from "./index-BQDc-U1x.js";
2
+ export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, type AgentLoopConfig, type AgentLoopDeps, type ApprovalDecision, type ApprovalScope, type Artifact, type ArtifactStore, type BridgeCapabilities, type BridgeCapability, type BridgeRequest, type BridgeResponse, CapabilityApproval, type CapabilityMode, type CatalogRenderer, type DiscoveryResult, EventBus, type ExternalSkillProvider, type ExternalToolSource, type FileStat, type FileSystemProvider, type FormField, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FullDisclosureRouter, HookRunner, type HookRunnerOptions, InMemoryStore, 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, MemoryArtifactStore, MemoryFS, type MemoryStore, MockLlmClient, type MockLlmHandler, type MockLlmQueueItem, type MockUiAnswer, MockUiBridge, 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, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, type SchemaInferer, type ScriptExecutionContext, type ScriptExecutor, type SkillCatalog, type SkillCatalogEntry, SkillDiscovery, type SkillDocument, type SkillInstallSource, type SkillIssue, type SkillLocation, type SkillManifest, type SkillMetadata, SkillReader, type SkillRouter, type SkillSource, type SkillsLockfile, type ToolDefinition, type ToolResolution, type ToolResult, type TraceClock, type TraceEvent, type TraceEventType, TraceRecorder, type UiBridge, type ValidationReport, type VercelToolSpec, type VerifyResult, WebSkillError, type WebSkillErrorCode, WebSkillRuntime, type WebSkillRuntimeDeps, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkSkillRules, computeDigest, createScriptContext, escapeXml, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isValidSkillName, jsonRenderer, mergeCatalogEntries, networkUrlHost, normalizePath, normalizeToolContent, parseBridgeRequest, parseSkillMarkdown, renderAvailableSkillsXml, renderCatalogJson, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, validateSkills, verifyManifest, xmlRenderer };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as validateSkills, A as schemaToForm, B as WebSkillError, C as createScriptContext, D as normalizeToolContent, E as mergeCatalogEntries, F as SKILL_MANIFEST_FILE, G as escapeXml, H as buildManifest, I as SKILL_NAME_MAX_LENGTH, J as normalizePath, K as isValidSkillName, L as SKILL_NAME_PATTERN, M as toVercelToolSpecs, N as MemoryFS, O as parseBridgeRequest, P as SKILLS_LOCKFILE, Q as resolveInsideRoot, R as SkillDiscovery, S as buildRenderResult, T as fromVercelStreamPart, U as checkSkillRules, V as buildCatalog, W as computeDigest, X as renderAvailableSkillsXml, Y as parseSkillMarkdown, Z as renderCatalogJson, _ as READ_SKILL_FILE_TOOL, a as EventBus, b as WebSkillRuntime, c as FullDisclosureRouter, d as MemoryArtifactStore, et as verifyManifest, f as MockLlmClient, g as READ_SKILL_FILE_INPUT_SCHEMA, h as ProgressiveRouter, i as AgentLoop, j as toLlmToolSpec, k as resolveToolName, l as HookRunner, m as OpenAiCompatibleClient, n as ASK_USER_TOOL, o as FsArtifactStore, p as MockUiBridge, q as jsonRenderer, r as ASK_USER_TOOL_NAME, s as FsMemoryStore, t as ASK_USER_INPUT_SCHEMA, tt as xmlRenderer, u as InMemoryStore, v as READ_SKILL_FILE_TOOL_NAME, w as fromVercelResult, x as bridgeError, y as TraceRecorder, z as SkillReader } from "./dist-hMMxARXK.js";
1
+ import { $ as normalizePath, A as mergeCatalogEntries, B as SKILL_MANIFEST_FILE, C as WebSkillRuntime, D as fromVercelResult, E as createScriptContext, F as schemaToForm, G as WebSkillError, H as SKILL_NAME_PATTERN, I as toLlmToolSpec, J as checkSkillRules, K as buildCatalog, L as toVercelToolSpecs, M as normalizeToolContent, N as parseBridgeRequest, O as fromVercelStreamPart, P as resolveToolName, Q as jsonRenderer, R as MemoryFS, S as TraceRecorder, T as buildRenderResult, U as SkillDiscovery, V as SKILL_NAME_MAX_LENGTH, W as SkillReader, X as escapeXml, Y as computeDigest, Z as isValidSkillName, _ as ProgressiveRouter, a as CapabilityApproval, at as verifyManifest, b as READ_SKILL_FILE_TOOL_NAME, c as FsMemoryStore, d as HookRunner, et as parseSkillMarkdown, f as InMemoryStore, g as OpenAiCompatibleClient, h as MockUiBridge, i as AgentLoop, it as validateSkills, j as networkUrlHost, k as isNetworkAllowed, l as FsRunSnapshotStore, m as MockLlmClient, n as ASK_USER_TOOL, nt as renderCatalogJson, o as EventBus, ot as xmlRenderer, p as MemoryArtifactStore, q as buildManifest, r as ASK_USER_TOOL_NAME, rt as resolveInsideRoot, s as FsArtifactStore, t as ASK_USER_INPUT_SCHEMA, tt as renderAvailableSkillsXml, u as FullDisclosureRouter, v as READ_SKILL_FILE_INPUT_SCHEMA, w as bridgeError, x as RUN_SNAPSHOT_SCHEMA_VERSION, y as READ_SKILL_FILE_TOOL, z as SKILLS_LOCKFILE } from "./dist-D405AlPD.js";
2
2
 
3
- export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, EventBus, FsArtifactStore, FsMemoryStore, FullDisclosureRouter, HookRunner, InMemoryStore, MemoryArtifactStore, MemoryFS, MockLlmClient, MockUiBridge, OpenAiCompatibleClient, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SkillDiscovery, SkillReader, TraceRecorder, WebSkillError, WebSkillRuntime, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkSkillRules, computeDigest, createScriptContext, escapeXml, fromVercelResult, fromVercelStreamPart, isValidSkillName, jsonRenderer, mergeCatalogEntries, normalizePath, normalizeToolContent, parseBridgeRequest, parseSkillMarkdown, renderAvailableSkillsXml, renderCatalogJson, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, validateSkills, verifyManifest, xmlRenderer };
3
+ export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, CapabilityApproval, EventBus, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FullDisclosureRouter, HookRunner, InMemoryStore, MemoryArtifactStore, MemoryFS, MockLlmClient, MockUiBridge, OpenAiCompatibleClient, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, RUN_SNAPSHOT_SCHEMA_VERSION, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SkillDiscovery, SkillReader, TraceRecorder, WebSkillError, WebSkillRuntime, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkSkillRules, computeDigest, createScriptContext, escapeXml, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isValidSkillName, jsonRenderer, mergeCatalogEntries, networkUrlHost, normalizePath, normalizeToolContent, parseBridgeRequest, parseSkillMarkdown, renderAvailableSkillsXml, renderCatalogJson, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, validateSkills, verifyManifest, xmlRenderer };
package/dist/mcp.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Ct as mergeCatalogEntries, F as LlmToolSpec, Pt as JsonSchema, Ut as SkillDocument, Vt as SkillCatalogEntry, lt as ToolResult, m as ExternalToolSource, p as ExternalSkillProvider } from "./index-DnI0BTEp.js";
1
+ import { $t as SkillCatalogEntry, Kt as JsonSchema, Pt as mergeCatalogEntries, V as LlmToolSpec, tn as SkillDocument, v as ExternalSkillProvider, y as ExternalToolSource, yt as ToolResult } from "./index-BQDc-U1x.js";
2
2
  import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
3
3
  import { JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js";
4
4
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
package/dist/mcp.js CHANGED
@@ -1,4 +1,4 @@
1
- import { B as WebSkillError, D as normalizeToolContent, E as mergeCatalogEntries } from "./dist-hMMxARXK.js";
1
+ import { A as mergeCatalogEntries, G as WebSkillError, M as normalizeToolContent } from "./dist-D405AlPD.js";
2
2
  import { fromJSONSchema } from "zod";
3
3
 
4
4
  //#region ../mcp/dist/index.js
package/dist/node.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { $t as VerifyResult, It as SKILLS_LOCKFILE, Lt as SKILL_MANIFEST_FILE, Wt as SkillInstallSource, Zt as SkillsLockfile, bt as createScriptContext, qt as SkillManifest } from "./index-DnI0BTEp.js";
2
- import { a as LlmEnvConfig, c as OxcSchemaInferer, d as SkillManager, f as loadLlmConfigFromEnv, i as LlmCapabilities, l as SandboxOptions, m as readArchiveManifest, n as FileArtifactStore, o as NodeFS, p as probeLlmCapabilities, r as FileMemoryStore, s as NodeScriptExecutor, t as CliUiBridge, u as SandboxedScriptExecutor } from "./index-D65Jk0ju.js";
1
+ import { At as createScriptContext, Jt as SKILLS_LOCKFILE, Yt as SKILL_MANIFEST_FILE, an as SkillManifest, dn as VerifyResult, ln as SkillsLockfile, nn as SkillInstallSource } from "./index-BQDc-U1x.js";
2
+ import { a as LlmEnvConfig, c as OxcSchemaInferer, d as SkillManager, f as loadLlmConfigFromEnv, i as LlmCapabilities, l as SandboxOptions, m as readArchiveManifest, n as FileArtifactStore, o as NodeFS, p as probeLlmCapabilities, r as FileMemoryStore, s as NodeScriptExecutor, t as CliUiBridge, u as SandboxedScriptExecutor } from "./index-aEple804.js";
3
3
  export { CliUiBridge, FileArtifactStore, FileMemoryStore, type LlmCapabilities, type LlmEnvConfig, NodeFS, NodeScriptExecutor, OxcSchemaInferer, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, type SandboxOptions, SandboxedScriptExecutor, SkillManager, type SkillManifest, type SkillInstallSource as SkillSource, type SkillsLockfile, type VerifyResult, createScriptContext, loadLlmConfigFromEnv, probeLlmCapabilities, readArchiveManifest };
package/dist/node.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as createScriptContext, F as SKILL_MANIFEST_FILE, P as SKILLS_LOCKFILE } from "./dist-hMMxARXK.js";
2
- import { a as NodeScriptExecutor, c as SkillManager, d as readArchiveManifest, i as NodeFS, l as loadLlmConfigFromEnv, n as FileArtifactStore, o as OxcSchemaInferer, r as FileMemoryStore, s as SandboxedScriptExecutor, t as CliUiBridge, u as probeLlmCapabilities } from "./dist-C1p26Ap9.js";
1
+ import { B as SKILL_MANIFEST_FILE, E as createScriptContext, z as SKILLS_LOCKFILE } from "./dist-D405AlPD.js";
2
+ import { a as NodeScriptExecutor, c as SkillManager, d as readArchiveManifest, i as NodeFS, l as loadLlmConfigFromEnv, n as FileArtifactStore, o as OxcSchemaInferer, r as FileMemoryStore, s as SandboxedScriptExecutor, t as CliUiBridge, u as probeLlmCapabilities } from "./dist-Ixnb-hNR.js";
3
3
 
4
4
  export { CliUiBridge, FileArtifactStore, FileMemoryStore, NodeFS, NodeScriptExecutor, OxcSchemaInferer, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SandboxedScriptExecutor, SkillManager, createScriptContext, loadLlmConfigFromEnv, probeLlmCapabilities, readArchiveManifest };
@@ -1,4 +1,4 @@
1
- import { C as InteractionRequest, X as RenderResultRequest, mt as UiBridge, w as InteractionResponse } from "./index-DnI0BTEp.js";
1
+ import { A as InteractionResponse, it as RenderResultRequest, k as InteractionRequest, wt as UiBridge } from "./index-BQDc-U1x.js";
2
2
  //#region ../ui-react/dist/index.d.ts
3
3
  //#region src/bridgeState.d.ts
4
4
  /**
package/dist/ui-react.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as interactionToFormModel, f as collectValues, x as shapeInteractionValue, y as renderMiniMarkdown } from "./dist-RcqvzAGF.js";
1
+ import { _ as interactionToFormModel, f as collectValues, x as shapeInteractionValue, y as renderMiniMarkdown } from "./dist-BM-VcQ90.js";
2
2
  import { useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
 
@@ -145,7 +145,7 @@ function InteractionForm({ bridge }) {
145
145
  className: "webskill-form__title",
146
146
  children: model.title
147
147
  }) : null,
148
- model.message && model.kind === "form" ? /* @__PURE__ */ jsx("p", {
148
+ model.message && (model.kind === "form" || model.kind === "authorize") ? /* @__PURE__ */ jsx("p", {
149
149
  className: "webskill-form__message",
150
150
  children: model.message
151
151
  }) : null,
package/dist/ui-vue.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as InteractionRequest, X as RenderResultRequest, mt as UiBridge, w as InteractionResponse } from "./index-DnI0BTEp.js";
1
+ import { A as InteractionResponse, it as RenderResultRequest, k as InteractionRequest, wt as UiBridge } from "./index-BQDc-U1x.js";
2
2
  import { PropType } from "vue";
3
3
  //#region ../ui-vue/dist/index.d.ts
4
4
  //#region src/bridgeState.d.ts
package/dist/ui-vue.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as interactionToFormModel, f as collectValues, x as shapeInteractionValue, y as renderMiniMarkdown } from "./dist-RcqvzAGF.js";
1
+ import { _ as interactionToFormModel, f as collectValues, x as shapeInteractionValue, y as renderMiniMarkdown } from "./dist-BM-VcQ90.js";
2
2
  import { defineComponent, h, reactive, ref } from "vue";
3
3
 
4
4
  //#region ../ui-vue/dist/index.js
@@ -112,7 +112,7 @@ const InteractionForm = defineComponent({
112
112
  }
113
113
  }, [
114
114
  model.title ? h("div", { class: "webskill-form__title" }, model.title) : null,
115
- model.message && model.kind === "form" ? h("p", { class: "webskill-form__message" }, model.message) : null,
115
+ model.message && (model.kind === "form" || model.kind === "authorize") ? h("p", { class: "webskill-form__message" }, model.message) : null,
116
116
  ...model.controls.map((control) => h("div", { key: control.name }, [renderControl(control), invalid.value.includes(control.name) ? h("div", { class: "webskill-form__error" }, "This field is required") : null])),
117
117
  h("div", { class: "webskill-form__actions" }, [h("button", {
118
118
  type: "submit",
package/dist/ui.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { C as InteractionRequest, X as RenderResultRequest, Y as RenderBlock, mt as UiBridge, w as InteractionResponse, yt as buildRenderResult } from "./index-DnI0BTEp.js";
1
+ import { A as InteractionResponse, it as RenderResultRequest, k as InteractionRequest, kt as buildRenderResult, rt as RenderBlock, wt as UiBridge } from "./index-BQDc-U1x.js";
2
2
  //#region ../ui/dist/index.d.ts
3
3
  //#region src/model/formModel.d.ts
4
4
  interface FormModel {
5
- kind: 'ask' | 'confirm' | 'form' | 'select';
5
+ kind: 'ask' | 'confirm' | 'form' | 'select' | 'authorize';
6
6
  title?: string;
7
7
  message?: string;
8
8
  controls: ControlModel[];
@@ -23,7 +23,7 @@ interface ControlModel {
23
23
  }
24
24
  /** 提交值按请求类型归形(WebFormBridge 与框架组件库共享单一来源) */
25
25
  declare function shapeInteractionValue(model: FormModel, values: Record<string, unknown>): unknown;
26
- /** 四类 InteractionRequest → 统一中间模型(框架无关) */
26
+ /** 五类 InteractionRequest → 统一中间模型(框架无关) */
27
27
  declare function interactionToFormModel(request: InteractionRequest): FormModel;
28
28
  //#endregion
29
29
  //#region src/model/collectValues.d.ts
package/dist/ui.js CHANGED
@@ -1,4 +1,4 @@
1
- import { S as buildRenderResult } from "./dist-hMMxARXK.js";
2
- import { C as toOpenUiLang, S as toA2uiMessages, _ as interactionToFormModel, a as LitRendererBridge, b as renderRenderResult, c as VERCEL_INTERACTION_TOOL_NAME, d as WebFormBridge, f as collectValues, g as fromVercelToolResult, h as fromOpenUiAction, i as A2UI_VERSION, l as VercelUiBridge, m as fromA2uiAction, n as A2UI_CANCEL_ACTION, o as OPENUI_CANCEL_ACTION, p as ensureStyles, r as A2UI_SUBMIT_ACTION, s as OPENUI_SUBMIT_ACTION, t as A2UI_BASIC_CATALOG_ID, u as WEBSKILL_STYLES_CSS, v as renderBlocks, w as toVercelToolInvocation, x as shapeInteractionValue, y as renderMiniMarkdown } from "./dist-RcqvzAGF.js";
1
+ import { T as buildRenderResult } from "./dist-D405AlPD.js";
2
+ import { C as toOpenUiLang, S as toA2uiMessages, _ as interactionToFormModel, a as LitRendererBridge, b as renderRenderResult, c as VERCEL_INTERACTION_TOOL_NAME, d as WebFormBridge, f as collectValues, g as fromVercelToolResult, h as fromOpenUiAction, i as A2UI_VERSION, l as VercelUiBridge, m as fromA2uiAction, n as A2UI_CANCEL_ACTION, o as OPENUI_CANCEL_ACTION, p as ensureStyles, r as A2UI_SUBMIT_ACTION, s as OPENUI_SUBMIT_ACTION, t as A2UI_BASIC_CATALOG_ID, u as WEBSKILL_STYLES_CSS, v as renderBlocks, w as toVercelToolInvocation, x as shapeInteractionValue, y as renderMiniMarkdown } from "./dist-BM-VcQ90.js";
3
3
 
4
4
  export { A2UI_BASIC_CATALOG_ID, A2UI_CANCEL_ACTION, A2UI_SUBMIT_ACTION, A2UI_VERSION, LitRendererBridge, OPENUI_CANCEL_ACTION, OPENUI_SUBMIT_ACTION, VERCEL_INTERACTION_TOOL_NAME, VercelUiBridge, WEBSKILL_STYLES_CSS, WebFormBridge, buildRenderResult, collectValues, ensureStyles, fromA2uiAction, fromOpenUiAction, fromVercelToolResult, interactionToFormModel, renderBlocks, renderMiniMarkdown, renderRenderResult, shapeInteractionValue, toA2uiMessages, toOpenUiLang, toVercelToolInvocation };