@webskill/sdk 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +13 -4
- package/dist/browser.js +16 -6
- package/dist/{catalogComponents-C_V39rbF-B94i0fW7.js → catalogComponents-C_V39rbF-BOHveMWa.js} +254 -9090
- package/dist/{dist-BdOW8N4V.js → dist-B9VLwOME.js} +67 -16
- package/dist/governance.d.ts +29 -196
- package/dist/governance.js +38 -199
- package/dist/{index-BNQNSDKg.d.ts → index-7DVaZJU7.d.ts} +21 -4
- package/dist/{index-BpIK7tJM.d.ts → index-QrHtAudz.d.ts} +16 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/{jsonRenderRegistry-9GrWP_hE-CMkryt1H.js → jsonRenderRegistry-9GrWP_hE-CQY8bT9w.js} +1 -1
- package/dist/mcp.d.ts +5 -3
- package/dist/mcp.js +9 -4
- package/dist/node.d.ts +49 -4
- package/dist/node.js +2064 -4
- package/dist/{openUiLibrary-B8-Cvou9-Cu1QZqoT.js → openUiLibrary-B8-Cvou9-D3RsU2EB.js} +1 -1
- package/dist/sandboxWorkerEntry.js +12 -3
- package/dist/{index-BHL5FWGw.d.ts → skillVersionStore-B7rGjtMi-BgnQho9v.d.ts} +128 -3
- package/dist/testing.d.ts +1 -1
- package/dist/{types-7fnqDVrf-BnRQjVU3.d.ts → types-AmKCKJn_-BogJPQHU.d.ts} +3 -1
- package/dist/ui-react.d.ts +2 -2
- package/dist/ui-react.js +4 -4
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +1 -1
- package/package.json +1 -1
- package/dist/dist-CcMIUXeZ.js +0 -1896
package/dist/governance.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { C as messageOf,
|
|
2
|
-
import { S as WebSkillRuntime } from "./dist-BdOW8N4V.js";
|
|
3
|
-
import { i as NodeFS, s as ProcessSandboxExecutor, u as exportArchive } from "./dist-CcMIUXeZ.js";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import { tmpdir } from "node:os";
|
|
6
|
-
import { mkdtemp } from "node:fs/promises";
|
|
1
|
+
import { C as messageOf, f as assertSafePathSegment, u as WebSkillError, x as isValidSkillName } from "./dist-BQzncxXg.js";
|
|
7
2
|
|
|
8
|
-
//#region ../governance/dist/
|
|
3
|
+
//#region ../governance/dist/index.js
|
|
9
4
|
const invalid = (message, details) => {
|
|
10
5
|
throw new WebSkillError("CANDIDATE_INVALID", message, details);
|
|
11
6
|
};
|
|
@@ -216,6 +211,31 @@ var LlmCandidateGenerator = class {
|
|
|
216
211
|
return candidate;
|
|
217
212
|
}
|
|
218
213
|
};
|
|
214
|
+
/** 默认策略:任何候选都必须人工审批 */
|
|
215
|
+
var AlwaysHumanApprovalPolicy = class {
|
|
216
|
+
evaluate(candidate) {
|
|
217
|
+
return {
|
|
218
|
+
needsHuman: true,
|
|
219
|
+
reason: `Candidate "${candidate.name}" requires human approval (risk: ${candidate.risk})`
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
/** 规则组合策略:首个命中的规则胜出,全部未命中走 fallback(默认 AlwaysHuman) */
|
|
224
|
+
var CompositeApprovalPolicy = class {
|
|
225
|
+
#rules;
|
|
226
|
+
#fallback;
|
|
227
|
+
constructor(rules, fallback) {
|
|
228
|
+
this.#rules = rules;
|
|
229
|
+
this.#fallback = fallback ?? new AlwaysHumanApprovalPolicy();
|
|
230
|
+
}
|
|
231
|
+
evaluate(candidate) {
|
|
232
|
+
for (const rule of this.#rules) {
|
|
233
|
+
const decision = rule(candidate);
|
|
234
|
+
if (decision) return decision;
|
|
235
|
+
}
|
|
236
|
+
return this.#fallback.evaluate(candidate);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
219
239
|
const fileOf$1 = (root) => `${root}/.webskill/audit.jsonl`;
|
|
220
240
|
/** 环境无关 sha256(WebCrypto;Node ≥17 与浏览器均有 globalThis.crypto.subtle) */
|
|
221
241
|
const sha256Hex$1 = async (text) => {
|
|
@@ -289,12 +309,14 @@ var FsAuditLog = class {
|
|
|
289
309
|
if (!await this.#fs.exists(path)) return [];
|
|
290
310
|
const raw = await this.#fs.readText(path);
|
|
291
311
|
const events = [];
|
|
312
|
+
let skippedLines = 0;
|
|
292
313
|
for (const line of raw.split("\n")) {
|
|
293
314
|
if (line.trim() === "") continue;
|
|
294
315
|
let event;
|
|
295
316
|
try {
|
|
296
317
|
event = JSON.parse(line);
|
|
297
318
|
} catch {
|
|
319
|
+
skippedLines += 1;
|
|
298
320
|
continue;
|
|
299
321
|
}
|
|
300
322
|
if (filter.target !== void 0 && event.target !== filter.target) continue;
|
|
@@ -302,6 +324,7 @@ var FsAuditLog = class {
|
|
|
302
324
|
if (filter.since !== void 0 && event.ts < filter.since) continue;
|
|
303
325
|
events.push(event);
|
|
304
326
|
}
|
|
327
|
+
if (skippedLines > 0) console.warn(`[webskill] Audit log at ${path} contains ${skippedLines} unparsable line(s) skipped by query; run verifyChain() to check integrity`);
|
|
305
328
|
return events;
|
|
306
329
|
}
|
|
307
330
|
/** hash 链完整性校验:逐行重算 hash 并核对 prevHash 链接 */
|
|
@@ -461,14 +484,18 @@ var FailureAnalyzer = class {
|
|
|
461
484
|
return {
|
|
462
485
|
cause: String(parsed["cause"] ?? "Unknown cause"),
|
|
463
486
|
suggestedFix: String(parsed["suggestedFix"] ?? "Manual inspection required"),
|
|
464
|
-
...typeof parsed["errorCode"] === "string" ? { errorCode: parsed["errorCode"] } : firstCode ? { errorCode: firstCode } : {}
|
|
487
|
+
...typeof parsed["errorCode"] === "string" ? { errorCode: parsed["errorCode"] } : firstCode ? { errorCode: firstCode } : {},
|
|
488
|
+
source: "llm"
|
|
465
489
|
};
|
|
466
|
-
} catch {
|
|
490
|
+
} catch (e) {
|
|
491
|
+
console.warn(`[webskill] LLM diagnosis output was not valid JSON, falling back to rule-based diagnosis: ${e instanceof Error ? e.message : String(e)}`);
|
|
492
|
+
}
|
|
467
493
|
}
|
|
468
494
|
return {
|
|
469
495
|
cause: firstCode ? ERROR_CAUSES[firstCode] ?? `Failure with code ${firstCode}` : "Unknown failure (no error code in trace)",
|
|
470
496
|
suggestedFix: firstCode ? `Inspect the component responsible for ${firstCode}` : "Inspect the run trace manually",
|
|
471
|
-
...firstCode ? { errorCode: firstCode } : {}
|
|
497
|
+
...firstCode ? { errorCode: firstCode } : {},
|
|
498
|
+
source: "rules"
|
|
472
499
|
};
|
|
473
500
|
}
|
|
474
501
|
};
|
|
@@ -809,194 +836,6 @@ async function readDocument(fs, path) {
|
|
|
809
836
|
hash: await sha256Hex(content)
|
|
810
837
|
};
|
|
811
838
|
}
|
|
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
|
-
}
|
|
1000
839
|
const EXTRACT_PROMPT = (doc, nameHint) => [
|
|
1001
840
|
"Extract an executable skill from the following document as STRICT JSON only.",
|
|
1002
841
|
"Schema: {\"name\": string, \"description\": string, \"risk\": \"low\"|\"medium\"|\"high\",",
|
|
@@ -1080,4 +919,4 @@ function createMissHook(deps) {
|
|
|
1080
919
|
}
|
|
1081
920
|
|
|
1082
921
|
//#endregion
|
|
1083
|
-
export { AlwaysHumanApprovalPolicy,
|
|
922
|
+
export { AlwaysHumanApprovalPolicy, CandidateStore, CompositeApprovalPolicy, DependencyGraph, DocumentSkillExtractor, EvaluationRunner, FailureAnalyzer, FsAuditLog, LlmCandidateGenerator, RepairPlanner, SCORING_WEIGHTS, SimilarityDetector, SkillScorer, SkillStatePolicy, SkillVersionStore, candidateToCatalogEntry, completeText, createMissHook, jaccardSimilarity, normalizeCandidate, normalizeCandidateFiles, normalizeRisk, parseJsonObject, readDocument, sanitizeCandidateName, suggestFromFailedRun, validateCandidate };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as UiSurfaceSnapshot, P as JsonSchema, _ as RenderResultRequest, b as UiSurfaceAction, g as RenderBlock, o as InteractionRequest, r as ChartSpec, s as InteractionResponse, v as UiBridge, y as UiSurface } from "./types-
|
|
2
|
-
import { y as ExternalToolSource } from "./index-
|
|
1
|
+
import { D as UiSurfaceSnapshot, P as JsonSchema, _ as RenderResultRequest, b as UiSurfaceAction, g as RenderBlock, o as InteractionRequest, r as ChartSpec, s as InteractionResponse, v as UiBridge, y as UiSurface } from "./types-AmKCKJn_-BogJPQHU.js";
|
|
2
|
+
import { y as ExternalToolSource } from "./index-QrHtAudz.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { ComponentType, ReactNode } from "react";
|
|
5
5
|
//#region ../ui/dist/index.d.ts
|
|
@@ -499,6 +499,23 @@ declare class LitRendererBridge implements UiBridge {
|
|
|
499
499
|
}
|
|
500
500
|
//#endregion
|
|
501
501
|
//#region src/a2uiRuntime/loadLitCatalog.d.ts
|
|
502
|
+
/** catalog 里单个组件的最小可见面(A2UI `LitComponentApi` 的结构子集) */
|
|
503
|
+
interface A2uiCatalogComponent {
|
|
504
|
+
readonly name: string;
|
|
505
|
+
readonly tagName: string;
|
|
506
|
+
readonly schema: unknown;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* A2UI catalog 句柄的最小结构契约。
|
|
510
|
+
*
|
|
511
|
+
* 与 optionalPeers/openUiRuntime.ts 同一约定:**不引用** `@a2ui/*` 的包类型。
|
|
512
|
+
* 它们是 optional peer,写进签名后会原样进入已发布的 `.d.ts`,
|
|
513
|
+
* 未安装 A2UI 的消费方 `tsc --noEmit` 会撞 TS2307(install-smoke 的类型探针实测)。
|
|
514
|
+
*/
|
|
515
|
+
interface A2uiCatalogHandle {
|
|
516
|
+
readonly id: string;
|
|
517
|
+
readonly components: ReadonlyMap<string, A2uiCatalogComponent>;
|
|
518
|
+
}
|
|
502
519
|
/**
|
|
503
520
|
* BYOC Lit 元素的加载入口。
|
|
504
521
|
*
|
|
@@ -506,7 +523,7 @@ declare class LitRendererBridge implements UiBridge {
|
|
|
506
523
|
* 因此只能经动态 import 进来:未用 A2UI 档的应用不为这段体积买单,
|
|
507
524
|
* 缺依赖时给出带安装提示的 `UI_UNAVAILABLE`,而不是一个空白 surface。
|
|
508
525
|
*/
|
|
509
|
-
declare function loadWebSkillLitCatalog(): Promise<
|
|
526
|
+
declare function loadWebSkillLitCatalog(): Promise<A2uiCatalogHandle>;
|
|
510
527
|
//#endregion
|
|
511
528
|
//#region src/optionalPeers/openUiRuntime.d.ts
|
|
512
529
|
/**
|
|
@@ -577,4 +594,4 @@ interface LoadedOpenUiPeers {
|
|
|
577
594
|
*/
|
|
578
595
|
declare function loadOpenUiPeers(): Promise<LoadedOpenUiPeers>;
|
|
579
596
|
//#endregion
|
|
580
|
-
export {
|
|
597
|
+
export { WEBSKILL_SURFACE_ACTION as $, SurfaceRendererProvenance as A, toA2uiSurfaceAction as At, UiSpecNode as B, toVercelToolInvocation as Bt, OPENUI_AUTHORIZE_ACTION as C, renderBlocks as Ct, OpenUiRendererProps as D, shapeInteractionValue as Dt, OPENUI_SURFACE_ACTION as E, renderRenderResult as Et, UiCatalogInput as F, toOpenUiSurfaceLang as Ft, VERCEL_INTERACTION_TOOL_NAME as G, UiSpecValidation as H, UiCatalogPromptOptions as I, toSurface as It, VercelSurfaceDataPart as J, VERCEL_SURFACE_ACTION_DATA_PART_TYPE as K, UiCatalogToolSourceOptions as L, toUiSurfaceActionDispatch as Lt, UI_SPEC_COMPONENT as M, toJsonRenderSpec as Mt, UiActionDef as N, toOpenUiLang as Nt, OpenUiRuntime as O, toA2uiMessages as Ot, UiCatalog as P, toOpenUiSpecLang as Pt, WEBSKILL_STYLES_CSS as Q, UiComponentDef as R, toUiSurfaceDescriptor as Rt, LoadedOpenUiPeers as S, loadWebSkillLitCatalog as St, OPENUI_SUBMIT_ACTION as T, renderMiniMarkdown as Tt, UiSurfaceActionDispatch as U, UiSpecSurfaceProps as V, uiCatalog as Vt, UiSurfaceDescriptor as W, VercelUiBridge as X, VercelToolInvocation as Y, WEBSKILL_A2UI_CATALOG_ID as Z, CollectedValues as _, fromVercelSurfaceAction as _t, A2UI_SPEC_FORM_PATH as a, chartToTable as at, JsonRenderSpec as b, isUiSpecSurface as bt, A2UI_VERSION as c, decodeInteractionResponse as ct, A2uiCatalogHandle as d, fromA2uiAction as dt, WebFormBridge as et, A2uiComponentShape as f, fromA2uiSpecAction as ft, CHART_PALETTE as g, fromUiSurfaceActionDispatch as gt, A2uiSpecMessageOptions as h, fromOpenUiSurfaceAction as ht, A2UI_SPEC_ACTION as i, buildA2uiCatalogDefinition as it, UI_CATALOG_GROUPS as j, toA2uiSurfaceMessages as jt, RENDER_UI_TOOL as k, toA2uiSpecMessages as kt, A2uiCatalogComponent as l, defineUiCatalog as lt, A2uiSpecActionEvent as m, fromOpenUiAction as mt, A2UI_CANCEL_ACTION as n, a2uiComponentSchema as nt, A2UI_SUBMIT_ACTION as o, collectValues as ot, A2uiMessage as p, fromA2uiSurfaceAction as pt, VERCEL_SURFACE_DATA_PART_TYPE as q, A2UI_COMMON_TYPES as r, a2uiComponentShapes as rt, A2UI_SURFACE_ACTION as s, createUiCatalogToolSource as st, A2UI_BASIC_CATALOG_ID as t, ZodRuntime as tt, A2uiCatalogDefinition as u, ensureStyles as ut, ControlModel as v, fromVercelToolResult as vt, OPENUI_CANCEL_ACTION as w, renderMiniChart as wt, LitRendererBridge as x, loadOpenUiPeers as xt, FormModel as y, interactionToFormModel as yt, UiSpecIssue as z, toVercelSurfaceDataPart as zt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as UiSurfaceDrafts, G as SkillDocument, H as SkillCatalog, K as SkillInstallSource, N as FileSystemProvider, P as JsonSchema, U as SkillCatalogEntry, W as SkillDiscovery, Y as SkillManifest, _ as RenderResultRequest, a as InteractionPolicy, c as LlmClient, d as LlmResponse, f as LlmStreamEvent, g as RenderBlock, h as MemoryStore, i as FormField, it as WebSkillErrorCode, j as DiscoveryResult, l as LlmCompleteInput, m as LlmToolSpec, n as ArtifactStore, o as InteractionRequest, r as ChartSpec, t as Artifact, tt as ValidationReport, u as LlmMessage, v as UiBridge, w as UiSurfaceEvent, x as UiSurfaceActionRequest, y as UiSurface } from "./types-
|
|
1
|
+
import { C as UiSurfaceDrafts, G as SkillDocument, H as SkillCatalog, K as SkillInstallSource, N as FileSystemProvider, P as JsonSchema, U as SkillCatalogEntry, W as SkillDiscovery, Y as SkillManifest, _ as RenderResultRequest, a as InteractionPolicy, c as LlmClient, d as LlmResponse, f as LlmStreamEvent, g as RenderBlock, h as MemoryStore, i as FormField, it as WebSkillErrorCode, j as DiscoveryResult, l as LlmCompleteInput, m as LlmToolSpec, n as ArtifactStore, o as InteractionRequest, r as ChartSpec, t as Artifact, tt as ValidationReport, u as LlmMessage, v as UiBridge, w as UiSurfaceEvent, x as UiSurfaceActionRequest, y as UiSurface } from "./types-AmKCKJn_-BogJPQHU.js";
|
|
2
2
|
//#region ../runtime/dist/index.d.ts
|
|
3
3
|
//#region src/llm/openAiCompatibleClient.d.ts
|
|
4
4
|
interface OpenAiCompatibleClientConfig {
|
|
@@ -428,6 +428,7 @@ declare class FsMemoryStore implements MemoryStore {
|
|
|
428
428
|
constructor(deps: {
|
|
429
429
|
root: string;
|
|
430
430
|
fs: FileSystemProvider;
|
|
431
|
+
onWarning?: (message: string) => void;
|
|
431
432
|
});
|
|
432
433
|
get(scope: string, key: string): Promise<unknown>;
|
|
433
434
|
set(scope: string, key: string, value: unknown): Promise<void>;
|
|
@@ -472,6 +473,7 @@ declare class FsArtifactStore implements ArtifactStore {
|
|
|
472
473
|
constructor(deps: {
|
|
473
474
|
root: string;
|
|
474
475
|
fs: FileSystemProvider;
|
|
476
|
+
onWarning?: (message: string) => void;
|
|
475
477
|
});
|
|
476
478
|
createTextArtifact(input: {
|
|
477
479
|
runId: string;
|
|
@@ -557,6 +559,18 @@ type NetworkPolicy = 'deny-all' | 'allow-all' | {
|
|
|
557
559
|
declare function isNetworkAllowed(policy: NetworkPolicy, url: string): boolean;
|
|
558
560
|
/** 阻断 trace 用的脱敏 host(解析失败返回占位,不记录完整 URL) */
|
|
559
561
|
declare function networkUrlHost(url: string): string;
|
|
562
|
+
/**
|
|
563
|
+
* 网络策略判定逻辑的可注入源码(单一来源)。
|
|
564
|
+
*
|
|
565
|
+
* 0.2.8 C4:此前各注入点直接拼 `isNetworkAllowed.toString()`,依赖**函数名在产物里保持不变**。
|
|
566
|
+
* SDK 自身不压缩,但消费方一旦跑生产构建,打包器会把导出函数改名(`function Ke(...)`),
|
|
567
|
+
* 注入后的沙箱里 `isNetworkAllowed` 就是 undefined —— 沙箱内任何 fetch 直接
|
|
568
|
+
* TOOL_EXECUTION_FAILED,网络白名单形同虚设。dev server 不压缩,所以只在真实产物上暴露。
|
|
569
|
+
*
|
|
570
|
+
* 因此改为把函数源码绑定到**固定的变量名**上:`var isNetworkAllowed = function Ke(...) {…};`
|
|
571
|
+
* ——名字随便压缩,绑定名恒定。两个函数都自包含(不引用模块内其它符号),故可独立绑定。
|
|
572
|
+
*/
|
|
573
|
+
declare function networkPolicyLibSource(): string;
|
|
560
574
|
//#endregion
|
|
561
575
|
//#region src/sandbox/errorCodes.d.ts
|
|
562
576
|
/**
|
|
@@ -867,4 +881,4 @@ declare class WebSkillRuntime {
|
|
|
867
881
|
cancel(runId: string): boolean;
|
|
868
882
|
}
|
|
869
883
|
//#endregion
|
|
870
|
-
export { SerializingMemoryStore as $, LifecycleHook as A,
|
|
884
|
+
export { SerializingMemoryStore as $, LifecycleHook as A, schemaToForm as At, RUN_SNAPSHOT_SCHEMA_VERSION as B, FullDisclosureRouter as C, networkPolicyLibSource as Ct, HookRunnerOptions as D, normalizeToolError as Dt, HookRunner as E, normalizeToolContent 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, toVercelToolSpecs as Mt, NetworkPolicy as N, validateUiSurface as Nt, InstalledSkillManifest as O, parseBridgeRequest as Ot, OpenAiCompatibleClient as P, validateUiSurfaceEvent as Pt, ScriptExecutor as Q, READ_SKILL_FILE_TOOL as R, FsRunSnapshotStore as S, mergeCatalogEntries as St, GoogleGenAiClientConfig as T, normalizeErrorCode 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, fromVercelStreamPart 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, toLlmToolSpec as jt, LifecycleEvent as k, resolveToolName 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, extractUiSurfaceEvents as vt, GoogleGenAiClient as w, networkUrlHost as wt, FsMemoryStore as x, isNetworkAllowed as xt, ExternalToolSource as y, fromVercelResult as yt, READ_SKILL_FILE_TOOL_NAME as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as SkillSource, A as DEFAULT_ARCHIVE_LIMITS, B as SKILL_NAME_PATTERN, C as UiSurfaceDrafts, Ct as renderCatalogJson, D as UiSurfaceSnapshot, Dt as validateSkills, E as UiSurfacePatch, Et as unzipWithLimits, F as MemoryFS, G as SkillDocument, H as SkillCatalog, I as RemoteUrlPolicy, J as SkillLocation, K as SkillInstallSource, L as SKILLS_LOCKFILE, M as FileStat, N as FileSystemProvider, O as ArchiveLimits, Ot as verifyManifest, P as JsonSchema, Q as SkillReader, R as SKILL_MANIFEST_FILE, S as UiSurfaceActionResponse, St as renderAvailableSkillsXml, T as UiSurfaceFormField, Tt as resolveInsideRoot, U as SkillCatalogEntry, V as SKILL_PACK_FILE, W as SkillDiscovery, X as SkillMetadata, Y as SkillManifest, Z as SkillPackManifest, _ as RenderResultRequest, _t as messageOf, a as InteractionPolicy, at as assertRemoteUrlAllowed, b as UiSurfaceAction, bt as parseSkillPackManifest, c as LlmClient, ct as buildCatalog, d as LlmResponse, dt as checkSkillRules, et as SkillsLockfile, f as LlmStreamEvent, ft as computeDigest, g as RenderBlock, gt as jsonRenderer, h as MemoryStore, ht as isValidSkillName, i as FormField, it as WebSkillErrorCode, j as DiscoveryResult, k as CatalogRenderer, kt as xmlRenderer, l as LlmCompleteInput, lt as buildManifest, m as LlmToolSpec, mt as exportSkills, n as ArtifactStore, nt as VerifyResult, o as InteractionRequest, ot as assertSafePathSegment, p as LlmToolCall, pt as escapeXml, q as SkillIssue, r as ChartSpec, rt as WebSkillError, s as InteractionResponse, st as atomicWriteText, t as Artifact, tt as ValidationReport, u as LlmMessage, ut as checkDependencyCycles, v as UiBridge, vt as normalizePath, w as UiSurfaceEvent, wt as resolveArchiveLimits, x as UiSurfaceActionRequest, xt as readResponseWithLimit, y as UiSurface, yt as parseSkillMarkdown, z as SKILL_NAME_MAX_LENGTH } from "./types-
|
|
2
|
-
import { $ as SerializingMemoryStore, A as LifecycleHook, At as
|
|
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 UiSurface, type UiSurfaceAction, type UiSurfaceActionRequest, type UiSurfaceActionResponse, type UiSurfaceDrafts, type UiSurfaceEvent, type UiSurfaceFormField, type UiSurfacePatch, type UiSurfaceSnapshot, 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, extractUiSurfaceEvents, 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, validateUiSurface, validateUiSurfaceEvent, verifyManifest, xmlRenderer };
|
|
1
|
+
import { $ as SkillSource, A as DEFAULT_ARCHIVE_LIMITS, B as SKILL_NAME_PATTERN, C as UiSurfaceDrafts, Ct as renderCatalogJson, D as UiSurfaceSnapshot, Dt as validateSkills, E as UiSurfacePatch, Et as unzipWithLimits, F as MemoryFS, G as SkillDocument, H as SkillCatalog, I as RemoteUrlPolicy, J as SkillLocation, K as SkillInstallSource, L as SKILLS_LOCKFILE, M as FileStat, N as FileSystemProvider, O as ArchiveLimits, Ot as verifyManifest, P as JsonSchema, Q as SkillReader, R as SKILL_MANIFEST_FILE, S as UiSurfaceActionResponse, St as renderAvailableSkillsXml, T as UiSurfaceFormField, Tt as resolveInsideRoot, U as SkillCatalogEntry, V as SKILL_PACK_FILE, W as SkillDiscovery, X as SkillMetadata, Y as SkillManifest, Z as SkillPackManifest, _ as RenderResultRequest, _t as messageOf, a as InteractionPolicy, at as assertRemoteUrlAllowed, b as UiSurfaceAction, bt as parseSkillPackManifest, c as LlmClient, ct as buildCatalog, d as LlmResponse, dt as checkSkillRules, et as SkillsLockfile, f as LlmStreamEvent, ft as computeDigest, g as RenderBlock, gt as jsonRenderer, h as MemoryStore, ht as isValidSkillName, i as FormField, it as WebSkillErrorCode, j as DiscoveryResult, k as CatalogRenderer, kt as xmlRenderer, l as LlmCompleteInput, lt as buildManifest, m as LlmToolSpec, mt as exportSkills, n as ArtifactStore, nt as VerifyResult, o as InteractionRequest, ot as assertSafePathSegment, p as LlmToolCall, pt as escapeXml, q as SkillIssue, r as ChartSpec, rt as WebSkillError, s as InteractionResponse, st as atomicWriteText, t as Artifact, tt as ValidationReport, u as LlmMessage, ut as checkDependencyCycles, v as UiBridge, vt as normalizePath, w as UiSurfaceEvent, wt as resolveArchiveLimits, x as UiSurfaceActionRequest, xt as readResponseWithLimit, y as UiSurface, yt as parseSkillMarkdown, z as SKILL_NAME_MAX_LENGTH } from "./types-AmKCKJn_-BogJPQHU.js";
|
|
2
|
+
import { $ as SerializingMemoryStore, A as LifecycleHook, At as schemaToForm, B as RUN_SNAPSHOT_SCHEMA_VERSION, C as FullDisclosureRouter, Ct as networkPolicyLibSource, D as HookRunnerOptions, Dt as normalizeToolError, E as HookRunner, Et as normalizeToolContent, 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, Mt as toVercelToolSpecs, N as NetworkPolicy, Nt as validateUiSurface, O as InstalledSkillManifest, Ot as parseBridgeRequest, P as OpenAiCompatibleClient, Pt as validateUiSurfaceEvent, Q as ScriptExecutor, R as READ_SKILL_FILE_TOOL, S as FsRunSnapshotStore, St as mergeCatalogEntries, T as GoogleGenAiClientConfig, Tt as normalizeErrorCode, 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 fromVercelStreamPart, 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, jt as toLlmToolSpec, k as LifecycleEvent, kt as resolveToolName, 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 extractUiSurfaceEvents, w as GoogleGenAiClient, wt as networkUrlHost, x as FsMemoryStore, xt as isNetworkAllowed, y as ExternalToolSource, yt as fromVercelResult, z as READ_SKILL_FILE_TOOL_NAME } from "./index-QrHtAudz.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 UiSurface, type UiSurfaceAction, type UiSurfaceActionRequest, type UiSurfaceActionResponse, type UiSurfaceDrafts, type UiSurfaceEvent, type UiSurfaceFormField, type UiSurfacePatch, type UiSurfaceSnapshot, 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, extractUiSurfaceEvents, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isValidSkillName, jsonRenderer, mergeCatalogEntries, messageOf, networkPolicyLibSource, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, readResponseWithLimit, renderAvailableSkillsXml, renderCatalogJson, resolveArchiveLimits, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, unzipWithLimits, validateSkills, validateUiSurface, validateUiSurfaceEvent, verifyManifest, xmlRenderer };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { A as resolveArchiveLimits, C as messageOf, D as readResponseWithLimit, E as parseSkillPackManifest, F as xmlRenderer, M as unzipWithLimits, N as validateSkills, O as renderAvailableSkillsXml, P as verifyManifest, S as jsonRenderer, T as parseSkillMarkdown, _ as checkSkillRules, a as SKILL_NAME_MAX_LENGTH, b as exportSkills, c as SkillDiscovery, d as assertRemoteUrlAllowed, f as assertSafePathSegment, g as checkDependencyCycles, h as buildManifest, i as SKILL_MANIFEST_FILE, j as resolveInsideRoot, k as renderCatalogJson, l as SkillReader, m as buildCatalog, n as MemoryFS, o as SKILL_NAME_PATTERN, p as atomicWriteText, r as SKILLS_LOCKFILE, s as SKILL_PACK_FILE, t as DEFAULT_ARCHIVE_LIMITS, u as WebSkillError, v as computeDigest, w as normalizePath, x as isValidSkillName, y as escapeXml } from "./dist-BQzncxXg.js";
|
|
2
|
-
import { A as fromVercelStreamPart, B as
|
|
2
|
+
import { A as fromVercelStreamPart, B as schemaToForm, C as bridgeError, D as extractChartSpec, E as createWebSkillApi, F as normalizeErrorCode, H as toVercelToolSpecs, I as normalizeToolContent, L as normalizeToolError, M as mergeCatalogEntries, N as networkPolicyLibSource, O as extractUiSurfaceEvents, P as networkUrlHost, R as parseBridgeRequest, S as WebSkillRuntime, T as createScriptContext, U as validateUiSurface, V as toLlmToolSpec, W as validateUiSurfaceEvent, _ as READ_SKILL_FILE_TOOL, a as AnthropicClient, b as SerializingMemoryStore, c as FsArtifactStore, d as FullDisclosureRouter, f as GoogleGenAiClient, g as READ_SKILL_FILE_INPUT_SCHEMA, h as ProgressiveRouter, i as AgentLoop, j as isNetworkAllowed, k as fromVercelResult, l as FsMemoryStore, m as OpenAiCompatibleClient, n as ASK_USER_TOOL, o as CapabilityApproval, p as HookRunner, r as ASK_USER_TOOL_NAME, s as EventBus, t as ASK_USER_INPUT_SCHEMA, u as FsRunSnapshotStore, v as READ_SKILL_FILE_TOOL_NAME, w as buildRenderResult, x as TraceRecorder, y as RUN_SNAPSHOT_SCHEMA_VERSION, z as resolveToolName } from "./dist-B9VLwOME.js";
|
|
3
3
|
|
|
4
|
-
export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, AnthropicClient, CapabilityApproval, DEFAULT_ARCHIVE_LIMITS, EventBus, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FullDisclosureRouter, GoogleGenAiClient, HookRunner, MemoryFS, 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, SKILL_PACK_FILE, SerializingMemoryStore, SkillDiscovery, SkillReader, TraceRecorder, WebSkillError, WebSkillRuntime, assertRemoteUrlAllowed, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, extractUiSurfaceEvents, 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, validateUiSurface, validateUiSurfaceEvent, verifyManifest, xmlRenderer };
|
|
4
|
+
export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, AnthropicClient, CapabilityApproval, DEFAULT_ARCHIVE_LIMITS, EventBus, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FullDisclosureRouter, GoogleGenAiClient, HookRunner, MemoryFS, 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, SKILL_PACK_FILE, SerializingMemoryStore, SkillDiscovery, SkillReader, TraceRecorder, WebSkillError, WebSkillRuntime, assertRemoteUrlAllowed, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, extractUiSurfaceEvents, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isValidSkillName, jsonRenderer, mergeCatalogEntries, messageOf, networkPolicyLibSource, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, readResponseWithLimit, renderAvailableSkillsXml, renderCatalogJson, resolveArchiveLimits, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, unzipWithLimits, validateSkills, validateUiSurface, validateUiSurfaceEvent, verifyManifest, xmlRenderer };
|
package/dist/{jsonRenderRegistry-9GrWP_hE-CMkryt1H.js → jsonRenderRegistry-9GrWP_hE-CQY8bT9w.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ft as uiCatalog } from "./dist-CtBLBbEz.js";
|
|
2
|
-
import { n as catalogComponentImpls } from "./catalogComponents-C_V39rbF-
|
|
2
|
+
import { n as catalogComponentImpls } from "./catalogComponents-C_V39rbF-BOHveMWa.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as SkillDocument, P as JsonSchema, U as SkillCatalogEntry, m as LlmToolSpec } from "./types-
|
|
2
|
-
import { St as mergeCatalogEntries, it as ToolResult, v as ExternalSkillProvider, y as ExternalToolSource } from "./index-
|
|
1
|
+
import { G as SkillDocument, P as JsonSchema, U as SkillCatalogEntry, m as LlmToolSpec } from "./types-AmKCKJn_-BogJPQHU.js";
|
|
2
|
+
import { St as mergeCatalogEntries, it as ToolResult, v as ExternalSkillProvider, y as ExternalToolSource } from "./index-QrHtAudz.js";
|
|
3
3
|
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
4
4
|
import { JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js";
|
|
5
5
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -214,7 +214,7 @@ declare class ExperimentalWebMcpAdapter {
|
|
|
214
214
|
enabled?: boolean;
|
|
215
215
|
});
|
|
216
216
|
isAvailable(): boolean;
|
|
217
|
-
/** 工具清单(listTools
|
|
217
|
+
/** 工具清单(listTools 缺失时返回 undefined;调用失败时告警后返回 undefined) */
|
|
218
218
|
listTools(): Promise<WebMcpToolDescriptor[] | undefined>;
|
|
219
219
|
/** 工具名清单(listTools 缺失/失败时返回 undefined) */
|
|
220
220
|
listToolNames(): Promise<string[] | undefined>;
|
|
@@ -235,6 +235,8 @@ declare class McpRuntimePlugin implements ExternalToolSource {
|
|
|
235
235
|
resolver?: McpToolResolver;
|
|
236
236
|
/** 已知的 endpoint 名(注销后仍按 MCP_ENDPOINT_UNAVAILABLE 响应,而非 TOOL_NOT_FOUND) */
|
|
237
237
|
endpoints?: string[];
|
|
238
|
+
/** endpoint 不可用时的告警出口(默认 console.warn) */
|
|
239
|
+
onWarning?(message: string): void;
|
|
238
240
|
});
|
|
239
241
|
listToolSpecs(): Promise<LlmToolSpec[]>;
|
|
240
242
|
canHandle(llmToolName: string): boolean;
|
package/dist/mcp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as messageOf, d as assertRemoteUrlAllowed, u as WebSkillError } from "./dist-BQzncxXg.js";
|
|
2
|
-
import {
|
|
2
|
+
import { I as normalizeToolContent, M as mergeCatalogEntries } from "./dist-B9VLwOME.js";
|
|
3
3
|
|
|
4
4
|
//#region ../mcp/dist/index.js
|
|
5
5
|
/**
|
|
@@ -418,13 +418,14 @@ var ExperimentalWebMcpAdapter = class {
|
|
|
418
418
|
isAvailable() {
|
|
419
419
|
return this.#enabled && typeof this.#resolveApi()?.executeTool === "function";
|
|
420
420
|
}
|
|
421
|
-
/** 工具清单(listTools
|
|
421
|
+
/** 工具清单(listTools 缺失时返回 undefined;调用失败时告警后返回 undefined) */
|
|
422
422
|
async listTools() {
|
|
423
423
|
const api = this.#resolveApi();
|
|
424
424
|
if (typeof api?.listTools !== "function") return void 0;
|
|
425
425
|
try {
|
|
426
426
|
return extractToolDescriptors(await api.listTools());
|
|
427
|
-
} catch {
|
|
427
|
+
} catch (e) {
|
|
428
|
+
console.warn(`[webskill] navigator.modelContext.listTools() failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
428
429
|
return;
|
|
429
430
|
}
|
|
430
431
|
}
|
|
@@ -460,11 +461,13 @@ var McpRuntimePlugin = class {
|
|
|
460
461
|
#resolver;
|
|
461
462
|
#webMcp;
|
|
462
463
|
#configuredEndpoints;
|
|
464
|
+
#onWarning;
|
|
463
465
|
constructor(deps) {
|
|
464
466
|
this.#registry = deps.registry;
|
|
465
467
|
this.#resolver = deps.resolver ?? new McpToolResolver(deps.registry);
|
|
466
468
|
this.#webMcp = deps.webMcp;
|
|
467
469
|
this.#configuredEndpoints = deps.endpoints ?? [];
|
|
470
|
+
this.#onWarning = deps.onWarning ?? ((message) => console.warn(message));
|
|
468
471
|
}
|
|
469
472
|
#endpoints() {
|
|
470
473
|
return [.../* @__PURE__ */ new Set([...this.#configuredEndpoints, ...this.#registry.endpoints()])];
|
|
@@ -481,7 +484,9 @@ var McpRuntimePlugin = class {
|
|
|
481
484
|
properties: {}
|
|
482
485
|
}
|
|
483
486
|
});
|
|
484
|
-
} catch {
|
|
487
|
+
} catch (e) {
|
|
488
|
+
this.#onWarning(`[webskill] MCP endpoint "${endpoint}" is unavailable; its tools are omitted from this turn: ${e instanceof Error ? e.message : String(e)}`);
|
|
489
|
+
}
|
|
485
490
|
if (this.#webMcp?.isAvailable()) {
|
|
486
491
|
const tools = await this.#webMcp.listTools();
|
|
487
492
|
for (const tool of tools ?? []) specs.push({
|
package/dist/node.d.ts
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
|
-
import { K as SkillInstallSource, L as SKILLS_LOCKFILE, R as SKILL_MANIFEST_FILE, Y as SkillManifest, et as SkillsLockfile, nt as VerifyResult } from "./types-
|
|
2
|
-
import { ht as createScriptContext } from "./index-
|
|
1
|
+
import { K as SkillInstallSource, L as SKILLS_LOCKFILE, N as FileSystemProvider, R as SKILL_MANIFEST_FILE, Y as SkillManifest, et as SkillsLockfile, nt as VerifyResult, v as UiBridge } from "./types-AmKCKJn_-BogJPQHU.js";
|
|
2
|
+
import { Q as ScriptExecutor, dt as WebSkillRuntime, ft as WebSkillRuntimeDeps, ht as createScriptContext } from "./index-QrHtAudz.js";
|
|
3
3
|
import { n as LlmEnvConfig, s as probeLlmCapabilities, t as LlmCapabilities } from "./env-BPUBZCwJ-4jat_SVG.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { C as ProcessSandboxExecutor, D as SkillManager, E as SandboxedScriptExecutor, O as exportArchive, S as OxcSchemaInferer, T as SandboxOptions, _ as CliUiBridge, a as AuditLog, b as NodeFS, c as CandidateSkill, d as CandidateStore, h as SkillVersionStore, k as readArchiveManifest, r as ApprovalPolicy, v as FileArtifactStore, w as ProcessSandboxOptions, x as NodeScriptExecutor, y as FileMemoryStore } from "./skillVersionStore-B7rGjtMi-BgnQho9v.js";
|
|
5
|
+
//#region ../governance/dist/node.d.ts
|
|
6
|
+
//#region src/approval/approvalWorkflow.d.ts
|
|
7
|
+
/** 审批工作流:review(UiBridge confirm 真实接线)/ publish(校验→安装→版本→审计) */
|
|
8
|
+
declare class ApprovalWorkflow {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(deps: {
|
|
11
|
+
policy: ApprovalPolicy;
|
|
12
|
+
audit: AuditLog;
|
|
13
|
+
store: CandidateStore;
|
|
14
|
+
skillManager: SkillManager;
|
|
15
|
+
versions: SkillVersionStore;
|
|
16
|
+
fs?: FileSystemProvider;
|
|
17
|
+
});
|
|
18
|
+
/** 策略评估;needs-human 时经 UiBridge confirm 真实询问,按应答迁移状态 */
|
|
19
|
+
review(candidateId: string, input: {
|
|
20
|
+
actor: string;
|
|
21
|
+
uiBridge?: UiBridge;
|
|
22
|
+
}): Promise<CandidateSkill>;
|
|
23
|
+
/** publish 全链路:approved 前置 → 写出 staging → validateSkills → install → 版本 → 审计 */
|
|
24
|
+
publish(candidateId: string, input: {
|
|
25
|
+
actor: string;
|
|
26
|
+
}): Promise<SkillManifest>;
|
|
27
|
+
/**
|
|
28
|
+
* 真实回滚(受审批保护:仅经显式 actor 调用并全程审计):
|
|
29
|
+
* 版本归档解包 → staging 校验 → 原子安装(复用安装管线 swap)→ 追加新版本 + 审计。
|
|
30
|
+
* RepairPlanner 的 rollback 选项(targetVersionId)经本方法执行。
|
|
31
|
+
*/
|
|
32
|
+
applyRollback(skillName: string, versionId: string, input: {
|
|
33
|
+
actor: string;
|
|
34
|
+
reason?: string;
|
|
35
|
+
}): Promise<SkillManifest>;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/evaluation/evaluationRuntime.d.ts
|
|
39
|
+
/**
|
|
40
|
+
* 治理评估专用 runtime 装配(不可信技能试用路径):
|
|
41
|
+
* 默认注入 ProcessSandboxExecutor(fork + --permission 真实进程隔离;子进程
|
|
42
|
+
* env 默认清空防密钥泄露,需透传时经 ProcessSandboxOptions.envWhitelist 显式放行)。
|
|
43
|
+
* 可配置 executor 切回 SandboxedScriptExecutor(worker_threads 能力面收敛形态,
|
|
44
|
+
* 非安全边界;envWhitelist 同样适用于该执行器)。
|
|
45
|
+
*/
|
|
46
|
+
declare function createEvaluationRuntime(deps: WebSkillRuntimeDeps & {
|
|
47
|
+
executor?: ScriptExecutor;
|
|
48
|
+
}): WebSkillRuntime;
|
|
49
|
+
//#endregion
|
|
50
|
+
export { ApprovalWorkflow, CliUiBridge, FileArtifactStore, FileMemoryStore, type LlmCapabilities, type LlmEnvConfig, NodeFS, NodeScriptExecutor, OxcSchemaInferer, ProcessSandboxExecutor, type ProcessSandboxOptions, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, type SandboxOptions, SandboxedScriptExecutor, type SkillInstallSource, SkillManager, type SkillManifest, type SkillsLockfile, type VerifyResult, createEvaluationRuntime, createScriptContext, exportArchive, probeLlmCapabilities, readArchiveManifest };
|