@webskill/sdk 0.2.4 → 0.2.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.
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +17 -13
- package/dist/{dist-CV64gN62.js → dist-B77plHjw.js} +147 -94
- package/dist/{dist-D7MsoMPx.js → dist-BQzncxXg.js} +70 -3
- package/dist/{dist-Chgf2tcy.js → dist-Chk8iB-E.js} +76 -31
- package/dist/{dist-CeNAzFYi.js → dist-DNSG9FqC.js} +108 -69
- package/dist/governance.d.ts +7 -4
- package/dist/governance.js +20 -8
- package/dist/{index-DrHelz72.d.ts → index-CsDJvYGV.d.ts} +5 -3
- package/dist/{index-DZShzhon.d.ts → index-DfINBEOy.d.ts} +11 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/mcp.d.ts +6 -2
- package/dist/mcp.js +14 -14
- package/dist/node.d.ts +3 -3
- package/dist/node.js +3 -3
- package/dist/{testing-BN18eqbD.js → testing-BUoXvm1u.js} +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/dist/{types-CKm5G_eQ-BqyXnvoR.d.ts → types-CKm5G_eQ-krKWW8WV.d.ts} +32 -2
- package/dist/ui-react.d.ts +3 -1
- package/dist/ui-react.js +8 -1
- package/dist/ui-vue.d.ts +3 -1
- package/dist/ui-vue.js +8 -1
- package/dist/ui.d.ts +20 -6
- package/dist/ui.js +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as WebSkillError } from "./dist-
|
|
1
|
+
import { u as WebSkillError } from "./dist-BQzncxXg.js";
|
|
2
2
|
|
|
3
3
|
//#region ../ui/dist/index.js
|
|
4
4
|
/** 提交值按请求类型归形(WebFormBridge 与框架组件库共享单一来源) */
|
|
@@ -78,8 +78,16 @@ function interactionToFormModel(request) {
|
|
|
78
78
|
}
|
|
79
79
|
const isEmpty = (v) => v === void 0 || v === "";
|
|
80
80
|
/**
|
|
81
|
+
* 控件名 → 属性选择器:优先 CSS.escape(标识符形式,免引号转义);
|
|
82
|
+
* 无 CSS.escape 的环境退化为引号包裹 + 转义反斜杠/双引号(防选择器注入崩溃)
|
|
83
|
+
*/
|
|
84
|
+
function controlSelector(name) {
|
|
85
|
+
if (typeof CSS !== "undefined" && typeof CSS.escape === "function") return `[data-webskill-control=${CSS.escape(name)}]`;
|
|
86
|
+
return `[data-webskill-control="${name.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"]`;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
81
89
|
* 严格类型化控件值收集:
|
|
82
|
-
* - number 空串 → undefined(非 0)
|
|
90
|
+
* - number 空串 → undefined(非 0);非数值输入(NaN)按缺失处理(required 时入 missingRequired)
|
|
83
91
|
* - select 用 option 值本身经 JSON 编码比对命中(对象值可正确命中)
|
|
84
92
|
* - required 空值列入 missingRequired(由调用方阻止提交并标记)
|
|
85
93
|
*/
|
|
@@ -87,13 +95,17 @@ function collectValues(controls, container) {
|
|
|
87
95
|
const values = {};
|
|
88
96
|
const missingRequired = [];
|
|
89
97
|
for (const control of controls) {
|
|
90
|
-
const el = container.querySelector(
|
|
98
|
+
const el = container.querySelector(controlSelector(control.name));
|
|
91
99
|
let value;
|
|
92
100
|
if (el === null) value = void 0;
|
|
93
101
|
else if (control.control === "boolean") value = el.checked;
|
|
94
102
|
else if (control.control === "number") {
|
|
95
103
|
const raw = el.value.trim();
|
|
96
|
-
|
|
104
|
+
if (raw === "") value = void 0;
|
|
105
|
+
else {
|
|
106
|
+
const n = Number(raw);
|
|
107
|
+
value = Number.isNaN(n) ? void 0 : n;
|
|
108
|
+
}
|
|
97
109
|
} else if (control.control === "select") {
|
|
98
110
|
const attr = el.value;
|
|
99
111
|
const hit = control.options?.find((o) => JSON.stringify(o.value) === attr);
|
|
@@ -736,12 +748,15 @@ var VercelUiBridge = class {
|
|
|
736
748
|
* - 每行一条语句 `identifier = Expression`,`root = Component(...)` 为入口
|
|
737
749
|
* - 组件调用参数为位置参数;字符串双引号反斜杠转义
|
|
738
750
|
* - 组件词汇(与应用 Library 约定):Form(title, children)、
|
|
751
|
+
* Text(content)(纯展示文本,authorize 的能力描述用)、
|
|
739
752
|
* TextField(name, label, required?, defaultValue?)、NumberField、BooleanField(name, label, default?)、
|
|
740
753
|
* SelectField(name, label, options)、SubmitButton(label, actionType, requestId)、
|
|
741
754
|
* CancelButton(label, actionType, requestId)
|
|
742
755
|
*/
|
|
743
756
|
const OPENUI_SUBMIT_ACTION = "webskill:submit";
|
|
744
757
|
const OPENUI_CANCEL_ACTION = "webskill:cancel";
|
|
758
|
+
/** authorize 的 Allow 专用动作(提交即批准 → value:true;Deny 走 cancel → cancelled:true) */
|
|
759
|
+
const OPENUI_AUTHORIZE_ACTION = "webskill:authorize";
|
|
745
760
|
const str = (s) => JSON.stringify(s);
|
|
746
761
|
const val = (v) => JSON.stringify(v ?? null);
|
|
747
762
|
function fieldStatements(fields) {
|
|
@@ -808,18 +823,19 @@ function toOpenUiLang(request) {
|
|
|
808
823
|
break;
|
|
809
824
|
case "authorize":
|
|
810
825
|
title = "Authorization required";
|
|
811
|
-
fields = [
|
|
812
|
-
name: "approved",
|
|
813
|
-
label: request.message,
|
|
814
|
-
control: "boolean",
|
|
815
|
-
defaultValue: false
|
|
816
|
-
}];
|
|
826
|
+
fields = [];
|
|
817
827
|
break;
|
|
818
828
|
}
|
|
819
829
|
lines.push(...fieldStatements(fields));
|
|
820
830
|
const children = fields.map((_, i) => `f${i}`);
|
|
821
|
-
|
|
822
|
-
|
|
831
|
+
const isAuthorize = request.type === "authorize";
|
|
832
|
+
if (isAuthorize) {
|
|
833
|
+
lines.push(`message = Text(${str(request.message)})`);
|
|
834
|
+
children.push("message");
|
|
835
|
+
}
|
|
836
|
+
const submitAction = isAuthorize ? OPENUI_AUTHORIZE_ACTION : OPENUI_SUBMIT_ACTION;
|
|
837
|
+
lines.push(`submit = SubmitButton(${str(isAuthorize ? "Allow" : "Submit")}, ${str(submitAction)}, ${str(request.id)})`);
|
|
838
|
+
lines.push(`cancel = CancelButton(${str(isAuthorize ? "Deny" : "Cancel")}, ${str(OPENUI_CANCEL_ACTION)}, ${str(request.id)})`);
|
|
823
839
|
lines.push(`root = Form(${val(title)}, [${[
|
|
824
840
|
...children,
|
|
825
841
|
"submit",
|
|
@@ -838,6 +854,10 @@ function fromOpenUiAction(action) {
|
|
|
838
854
|
id,
|
|
839
855
|
cancelled: true
|
|
840
856
|
};
|
|
857
|
+
if (a.type === "webskill:authorize") return {
|
|
858
|
+
id,
|
|
859
|
+
value: true
|
|
860
|
+
};
|
|
841
861
|
if (a.type === "webskill:submit") {
|
|
842
862
|
const formState = a.formState;
|
|
843
863
|
if (formState) return {
|
|
@@ -1002,20 +1022,70 @@ function toA2uiMessages(request) {
|
|
|
1002
1022
|
return messages;
|
|
1003
1023
|
}
|
|
1004
1024
|
/**
|
|
1005
|
-
*
|
|
1025
|
+
* 按 InteractionRequest.type 解码提交值(绑定模型原样回传的是表单对象):
|
|
1026
|
+
* confirm 仅 confirmed===true 批准;select 还原原始 option 值(非字符串值经 JSON 编码比对);
|
|
1027
|
+
* form 的 number 字段转 number(NaN 保留原值);ask 取 answer;authorize 提交即批准。
|
|
1028
|
+
* 纯转换器:任何直接使用 fromA2uiAction 的消费者都应经此拿到正确类型。
|
|
1029
|
+
* @experimental
|
|
1030
|
+
*/
|
|
1031
|
+
function decodeInteractionResponse(request, response) {
|
|
1032
|
+
if (response.cancelled) return response;
|
|
1033
|
+
const values = response.value;
|
|
1034
|
+
switch (request.type) {
|
|
1035
|
+
case "confirm": return {
|
|
1036
|
+
...response,
|
|
1037
|
+
value: values?.confirmed === true
|
|
1038
|
+
};
|
|
1039
|
+
case "ask": return {
|
|
1040
|
+
...response,
|
|
1041
|
+
value: values?.answer
|
|
1042
|
+
};
|
|
1043
|
+
case "select": {
|
|
1044
|
+
const raw = values?.selected;
|
|
1045
|
+
const option = request.options.find((o) => o.value === raw || JSON.stringify(o.value) === raw);
|
|
1046
|
+
return {
|
|
1047
|
+
...response,
|
|
1048
|
+
value: option ? option.value : raw
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
case "form": {
|
|
1052
|
+
if (typeof values !== "object" || values === null) return response;
|
|
1053
|
+
const out = { ...values };
|
|
1054
|
+
for (const field of request.fields) if (field.type === "number" && out[field.name] !== void 0) {
|
|
1055
|
+
const n = Number(out[field.name]);
|
|
1056
|
+
if (!Number.isNaN(n)) out[field.name] = n;
|
|
1057
|
+
}
|
|
1058
|
+
return {
|
|
1059
|
+
...response,
|
|
1060
|
+
value: out
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
case "authorize": return {
|
|
1064
|
+
...response,
|
|
1065
|
+
value: true
|
|
1066
|
+
};
|
|
1067
|
+
default: return response;
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* A2UI client→server action 事件 → InteractionResponse。
|
|
1072
|
+
* 传入 request 时按类型解码提交值(见 decodeInteractionResponse)。
|
|
1006
1073
|
* @experimental
|
|
1007
1074
|
*/
|
|
1008
|
-
function fromA2uiAction(event) {
|
|
1075
|
+
function fromA2uiAction(event, request) {
|
|
1009
1076
|
const e = event ?? {};
|
|
1010
1077
|
const id = String(e.context?.["requestId"] ?? "");
|
|
1011
1078
|
if (e.name === "webskill:cancel") return {
|
|
1012
1079
|
id,
|
|
1013
1080
|
cancelled: true
|
|
1014
1081
|
};
|
|
1015
|
-
if (e.name === "webskill:submit")
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1082
|
+
if (e.name === "webskill:submit") {
|
|
1083
|
+
const response = {
|
|
1084
|
+
id,
|
|
1085
|
+
value: e.context?.["values"] ?? e.context?.["form"] ?? e.context
|
|
1086
|
+
};
|
|
1087
|
+
return request ? decodeInteractionResponse(request, response) : response;
|
|
1088
|
+
}
|
|
1019
1089
|
return {
|
|
1020
1090
|
id,
|
|
1021
1091
|
value: e.context
|
|
@@ -1041,6 +1111,8 @@ function loadA2uiRuntime() {
|
|
|
1041
1111
|
var LitRendererBridge = class {
|
|
1042
1112
|
#mount;
|
|
1043
1113
|
#doc;
|
|
1114
|
+
/** 进行中的交互:id → resolve 与 surface 元素(cancel 时清理并以 cancelled resolve) */
|
|
1115
|
+
#pending = /* @__PURE__ */ new Map();
|
|
1044
1116
|
constructor(deps) {
|
|
1045
1117
|
this.#mount = deps.mount;
|
|
1046
1118
|
this.#doc = deps.document ?? deps.mount.ownerDocument;
|
|
@@ -1050,75 +1122,42 @@ var LitRendererBridge = class {
|
|
|
1050
1122
|
const messages = toA2uiMessages(input);
|
|
1051
1123
|
const surfaceId = `webskill-${input.id}`;
|
|
1052
1124
|
return new Promise((resolve) => {
|
|
1053
|
-
const
|
|
1054
|
-
|
|
1125
|
+
const entry = { resolve };
|
|
1126
|
+
this.#pending.set(input.id, entry);
|
|
1055
1127
|
const processor = new MessageProcessor([basicCatalog], (action) => {
|
|
1056
1128
|
const surfaces = processor.getClientDataModel("v0.9.1")?.surfaces;
|
|
1057
1129
|
const formValues = typeof surfaces?.[surfaceId] === "object" && surfaces[surfaceId] !== null ? surfaces[surfaceId]["form"] ?? action.context : action.context;
|
|
1058
|
-
|
|
1059
|
-
|
|
1130
|
+
this.#pending.delete(input.id);
|
|
1131
|
+
entry.surfaceEl?.remove();
|
|
1132
|
+
resolve(fromA2uiAction({
|
|
1060
1133
|
...action,
|
|
1061
1134
|
context: {
|
|
1062
1135
|
...action.context,
|
|
1063
1136
|
values: formValues
|
|
1064
1137
|
}
|
|
1065
|
-
});
|
|
1066
|
-
resolve(this.#decodeValue(input, response));
|
|
1138
|
+
}, input));
|
|
1067
1139
|
}, { version: "v0.9.1" });
|
|
1068
1140
|
processor.onSurfaceCreated((surface) => {
|
|
1069
1141
|
const el = this.#doc.createElement("a2ui-surface");
|
|
1070
1142
|
el.surface = surface;
|
|
1071
|
-
surfaceEl = el;
|
|
1143
|
+
entry.surfaceEl = el;
|
|
1072
1144
|
this.#mount.appendChild(el);
|
|
1073
1145
|
});
|
|
1074
1146
|
processor.processMessages(messages);
|
|
1075
1147
|
});
|
|
1076
1148
|
}
|
|
1077
|
-
/**
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
...response,
|
|
1088
|
-
value: values?.confirmed === true
|
|
1089
|
-
};
|
|
1090
|
-
case "ask": return {
|
|
1091
|
-
...response,
|
|
1092
|
-
value: values?.answer
|
|
1093
|
-
};
|
|
1094
|
-
case "select": {
|
|
1095
|
-
const raw = values?.selected;
|
|
1096
|
-
const option = input.options.find((o) => o.value === raw || JSON.stringify(o.value) === raw);
|
|
1097
|
-
return {
|
|
1098
|
-
...response,
|
|
1099
|
-
value: option ? option.value : raw
|
|
1100
|
-
};
|
|
1101
|
-
}
|
|
1102
|
-
case "form": {
|
|
1103
|
-
if (typeof values !== "object" || values === null) return response;
|
|
1104
|
-
const out = { ...values };
|
|
1105
|
-
for (const field of input.fields) if (field.type === "number" && out[field.name] !== void 0) {
|
|
1106
|
-
const n = Number(out[field.name]);
|
|
1107
|
-
if (!Number.isNaN(n)) out[field.name] = n;
|
|
1108
|
-
}
|
|
1109
|
-
return {
|
|
1110
|
-
...response,
|
|
1111
|
-
value: out
|
|
1112
|
-
};
|
|
1113
|
-
}
|
|
1114
|
-
case "authorize": return {
|
|
1115
|
-
...response,
|
|
1116
|
-
value: true
|
|
1117
|
-
};
|
|
1118
|
-
default: return response;
|
|
1119
|
-
}
|
|
1149
|
+
/** runtime 交互超时/取消:移除 surface 并以 cancelled resolve pending Promise(防悬挂 + DOM 残留) */
|
|
1150
|
+
cancel(id) {
|
|
1151
|
+
const entry = this.#pending.get(id);
|
|
1152
|
+
if (!entry) return;
|
|
1153
|
+
this.#pending.delete(id);
|
|
1154
|
+
entry.surfaceEl?.remove();
|
|
1155
|
+
entry.resolve({
|
|
1156
|
+
id,
|
|
1157
|
+
cancelled: true
|
|
1158
|
+
});
|
|
1120
1159
|
}
|
|
1121
1160
|
};
|
|
1122
1161
|
|
|
1123
1162
|
//#endregion
|
|
1124
|
-
export {
|
|
1163
|
+
export { renderMiniChart as C, toA2uiMessages as D, shapeInteractionValue as E, toOpenUiLang as O, renderBlocks as S, renderRenderResult as T, ensureStyles as _, CHART_PALETTE as a, fromVercelToolResult as b, OPENUI_CANCEL_ACTION as c, VercelUiBridge as d, WEBSKILL_STYLES_CSS as f, decodeInteractionResponse as g, collectValues as h, A2UI_VERSION as i, toVercelToolInvocation as k, OPENUI_SUBMIT_ACTION as l, chartToTable as m, A2UI_CANCEL_ACTION as n, LitRendererBridge as o, WebFormBridge as p, A2UI_SUBMIT_ACTION as r, OPENUI_AUTHORIZE_ACTION as s, A2UI_BASIC_CATALOG_ID as t, VERCEL_INTERACTION_TOOL_NAME as u, fromA2uiAction as v, renderMiniMarkdown as w, interactionToFormModel as x, fromOpenUiAction as y };
|
package/dist/governance.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Q as ScriptExecutor, dt as WebSkillRuntime, ft as WebSkillRuntimeDeps, q as RuntimeRun, tt as SkillStateGuard } from "./index-
|
|
3
|
-
import { d as SkillManager } from "./index-
|
|
1
|
+
import { B as SkillManifest, I as SkillDocument, P as SkillCatalogEntry, c as LlmClient, u as LlmMessage, v as UiBridge, w as FileSystemProvider } from "./types-CKm5G_eQ-krKWW8WV.js";
|
|
2
|
+
import { Q as ScriptExecutor, dt as WebSkillRuntime, ft as WebSkillRuntimeDeps, q as RuntimeRun, tt as SkillStateGuard } from "./index-DfINBEOy.js";
|
|
3
|
+
import { d as SkillManager } from "./index-CsDJvYGV.js";
|
|
4
4
|
//#region ../governance/dist/index.d.ts
|
|
5
5
|
//#region src/types.d.ts
|
|
6
6
|
type CandidateStatus = 'draft' | 'pending-review' | 'approved' | 'published' | 'rejected';
|
|
@@ -143,7 +143,8 @@ declare class CompositeApprovalPolicy implements ApprovalPolicy {
|
|
|
143
143
|
}
|
|
144
144
|
//#endregion
|
|
145
145
|
//#region src/versioning/skillVersionStore.d.ts
|
|
146
|
-
/** 版本存储:manifest 快照 + parentVersionId 链;回滚 =
|
|
146
|
+
/** 版本存储:manifest 快照 + parentVersionId 链;回滚 = 追加新版本(谱系不断)。
|
|
147
|
+
* 保留策略:maxArchivesPerSkill(默认 5)超出时清理最旧版本(json + zip 归档一并删除)。 */
|
|
147
148
|
declare class SkillVersionStore {
|
|
148
149
|
#private;
|
|
149
150
|
constructor(deps: {
|
|
@@ -152,6 +153,8 @@ declare class SkillVersionStore {
|
|
|
152
153
|
now?: () => string;
|
|
153
154
|
createId?: () => string;
|
|
154
155
|
audit?: AuditLog;
|
|
156
|
+
/** 每技能保留的版本/归档上限(默认 5,超出清理最旧) */
|
|
157
|
+
maxArchivesPerSkill?: number;
|
|
155
158
|
});
|
|
156
159
|
add(skillName: string, input: {
|
|
157
160
|
reason: string;
|
package/dist/governance.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { S as WebSkillRuntime } from "./dist-
|
|
3
|
-
import { i as NodeFS, s as ProcessSandboxExecutor, u as exportArchive } from "./dist-
|
|
1
|
+
import { C as messageOf, M as unzipWithLimits, N as validateSkills, f as assertSafePathSegment, j as resolveInsideRoot, u as WebSkillError, x as isValidSkillName } from "./dist-BQzncxXg.js";
|
|
2
|
+
import { S as WebSkillRuntime } from "./dist-B77plHjw.js";
|
|
3
|
+
import { i as NodeFS, s as ProcessSandboxExecutor, u as exportArchive } from "./dist-Chk8iB-E.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { tmpdir } from "node:os";
|
|
6
6
|
import { mkdtemp } from "node:fs/promises";
|
|
@@ -242,7 +242,6 @@ var CompositeApprovalPolicy = class {
|
|
|
242
242
|
return this.#fallback.evaluate(candidate);
|
|
243
243
|
}
|
|
244
244
|
};
|
|
245
|
-
const messageOf$1 = (e) => e instanceof Error ? e.message : String(e);
|
|
246
245
|
/** 审批工作流:review(UiBridge confirm 真实接线)/ publish(校验→安装→版本→审计) */
|
|
247
246
|
var ApprovalWorkflow = class {
|
|
248
247
|
#policy;
|
|
@@ -331,7 +330,7 @@ var ApprovalWorkflow = class {
|
|
|
331
330
|
return manifest;
|
|
332
331
|
} catch (e) {
|
|
333
332
|
if (e instanceof WebSkillError) throw e;
|
|
334
|
-
throw new WebSkillError("GOVERNANCE_FAILED", `Failed to publish candidate "${candidateId}": ${messageOf
|
|
333
|
+
throw new WebSkillError("GOVERNANCE_FAILED", `Failed to publish candidate "${candidateId}": ${messageOf(e)}`, e);
|
|
335
334
|
} finally {
|
|
336
335
|
try {
|
|
337
336
|
await this.#fs.remove(stagingRoot, { recursive: true });
|
|
@@ -382,7 +381,7 @@ var ApprovalWorkflow = class {
|
|
|
382
381
|
return manifest;
|
|
383
382
|
} catch (e) {
|
|
384
383
|
if (e instanceof WebSkillError) throw e;
|
|
385
|
-
throw new WebSkillError("GOVERNANCE_FAILED", `Failed to roll back "${skillName}" to version "${versionId}": ${messageOf
|
|
384
|
+
throw new WebSkillError("GOVERNANCE_FAILED", `Failed to roll back "${skillName}" to version "${versionId}": ${messageOf(e)}`, e);
|
|
386
385
|
} finally {
|
|
387
386
|
try {
|
|
388
387
|
await this.#fs.remove(stagingRoot, { recursive: true });
|
|
@@ -511,19 +510,22 @@ const dirOf = (root, skillName) => {
|
|
|
511
510
|
assertSafePathSegment(skillName, "skill name");
|
|
512
511
|
return `${root}/.webskill/versions/${skillName}`;
|
|
513
512
|
};
|
|
514
|
-
/** 版本存储:manifest 快照 + parentVersionId 链;回滚 =
|
|
513
|
+
/** 版本存储:manifest 快照 + parentVersionId 链;回滚 = 追加新版本(谱系不断)。
|
|
514
|
+
* 保留策略:maxArchivesPerSkill(默认 5)超出时清理最旧版本(json + zip 归档一并删除)。 */
|
|
515
515
|
var SkillVersionStore = class {
|
|
516
516
|
#root;
|
|
517
517
|
#fs;
|
|
518
518
|
#now;
|
|
519
519
|
#createId;
|
|
520
520
|
#audit;
|
|
521
|
+
#maxArchives;
|
|
521
522
|
constructor(deps) {
|
|
522
523
|
this.#root = deps.root.replace(/\/+$/, "");
|
|
523
524
|
this.#fs = deps.fs;
|
|
524
525
|
this.#now = deps.now;
|
|
525
526
|
this.#createId = deps.createId;
|
|
526
527
|
this.#audit = deps.audit;
|
|
528
|
+
this.#maxArchives = deps.maxArchivesPerSkill ?? 5;
|
|
527
529
|
}
|
|
528
530
|
async add(skillName, input) {
|
|
529
531
|
const existing = await this.list(skillName);
|
|
@@ -541,8 +543,19 @@ var SkillVersionStore = class {
|
|
|
541
543
|
version.archivePath = archivePath;
|
|
542
544
|
}
|
|
543
545
|
await this.#fs.writeText(`${dirOf(this.#root, skillName)}/${version.versionId}.json`, JSON.stringify(version, null, 2));
|
|
546
|
+
await this.#prune(skillName);
|
|
544
547
|
return version;
|
|
545
548
|
}
|
|
549
|
+
/** 保留策略:超出 maxArchivesPerSkill 时按 createdAt 清理最旧版本(json + zip) */
|
|
550
|
+
async #prune(skillName) {
|
|
551
|
+
const versions = await this.list(skillName);
|
|
552
|
+
const excess = versions.length - this.#maxArchives;
|
|
553
|
+
if (excess <= 0) return;
|
|
554
|
+
for (const old of versions.slice(0, excess)) {
|
|
555
|
+
await this.#fs.remove(`${dirOf(this.#root, skillName)}/${old.versionId}.json`);
|
|
556
|
+
if (old.archivePath && await this.#fs.exists(old.archivePath)) await this.#fs.remove(old.archivePath);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
546
559
|
/** 读取版本归档字节(applyRollback 用;未捕获归档的旧版本 → GOVERNANCE_FAILED) */
|
|
547
560
|
async readArchive(skillName, versionId) {
|
|
548
561
|
const version = await this.get(skillName, versionId);
|
|
@@ -804,7 +817,6 @@ var SkillStatePolicy = class {
|
|
|
804
817
|
});
|
|
805
818
|
}
|
|
806
819
|
};
|
|
807
|
-
const messageOf = (e) => e instanceof Error ? e.message : String(e);
|
|
808
820
|
function matchExpected(expected, output, run) {
|
|
809
821
|
if (expected === void 0) return run.status === "completed";
|
|
810
822
|
if (typeof expected === "string") return output.includes(expected);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { N as NetworkPolicy, Q as ScriptExecutor, X as SchemaInferer, Z as ScriptExecutionContext, b as FsArtifactStore, d as BridgeCapabilities, it as ToolResult, nt as ToolDefinition, u as ApprovalScope, x as FsMemoryStore } from "./index-
|
|
1
|
+
import { B as SkillManifest, C as FileStat, G as SkillsLockfile, L as SkillInstallSource, T as JsonSchema, _ as RenderResultRequest, o as InteractionRequest, q as VerifyResult, s as InteractionResponse, v as UiBridge, w as FileSystemProvider, y as ArchiveLimits } from "./types-CKm5G_eQ-krKWW8WV.js";
|
|
2
|
+
import { N as NetworkPolicy, Q as ScriptExecutor, X as SchemaInferer, Z as ScriptExecutionContext, b as FsArtifactStore, d as BridgeCapabilities, it as ToolResult, nt as ToolDefinition, u as ApprovalScope, x as FsMemoryStore } from "./index-DfINBEOy.js";
|
|
3
3
|
import { Readable, Writable } from "node:stream";
|
|
4
4
|
//#region ../node/dist/index.d.ts
|
|
5
5
|
//#region src/fs/nodeFs.d.ts
|
|
@@ -106,6 +106,8 @@ interface ProcessSandboxOptions {
|
|
|
106
106
|
uiBridge?: UiBridge;
|
|
107
107
|
/** 授权粒度:默认 'once-per-run' */
|
|
108
108
|
approvalScope?: ApprovalScope;
|
|
109
|
+
/** 池维护告警出口(recycle 重生失败等;默认 console.warn) */
|
|
110
|
+
onWarning?: (message: string) => void;
|
|
109
111
|
}
|
|
110
112
|
/**
|
|
111
113
|
* child_process.fork + --permission 进程沙箱(真实进程隔离)。
|
|
@@ -120,7 +122,7 @@ declare class ProcessSandboxExecutor implements ScriptExecutor {
|
|
|
120
122
|
#private;
|
|
121
123
|
constructor(fs: FileSystemProvider, options?: ProcessSandboxOptions);
|
|
122
124
|
get poolSize(): number;
|
|
123
|
-
/**
|
|
125
|
+
/** 池全部子进程销毁(测试收尾/进程退出前调用);排队中的 acquire 一律 reject(不悬挂) */
|
|
124
126
|
dispose(): Promise<void>;
|
|
125
127
|
loadDefinition(skillRoot: string, scriptName: string): Promise<ToolDefinition>;
|
|
126
128
|
execute(input: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { B as SkillManifest, F as SkillDiscovery, I as SkillDocument, K as ValidationReport, L as SkillInstallSource, N as SkillCatalog, P as SkillCatalogEntry, S as DiscoveryResult, T as JsonSchema, Y as WebSkillErrorCode, _ as RenderResultRequest, a as InteractionPolicy, c as LlmClient, d as LlmResponse, f as LlmStreamEvent, g as RenderBlock, h as MemoryStore, i as FormField, l as LlmCompleteInput, m as LlmToolSpec, n as ArtifactStore, o as InteractionRequest, r as ChartSpec, t as Artifact, u as LlmMessage, v as UiBridge, w as FileSystemProvider } from "./types-CKm5G_eQ-krKWW8WV.js";
|
|
2
2
|
//#region ../runtime/dist/index.d.ts
|
|
3
3
|
//#region src/llm/openAiCompatibleClient.d.ts
|
|
4
4
|
interface OpenAiCompatibleClientConfig {
|
|
@@ -270,6 +270,8 @@ interface AgentLoopConfig {
|
|
|
270
270
|
renderResult?: 'off';
|
|
271
271
|
/** 工具结果回喂上限(字节,默认 100_000;超长头尾保留 + 完整内容落 artifact) */
|
|
272
272
|
toolResultMaxBytes?: number;
|
|
273
|
+
/** session paramHistory 保留条数上限(默认 50,超出裁最旧) */
|
|
274
|
+
paramHistoryLimit?: number;
|
|
273
275
|
}
|
|
274
276
|
/** 技能状态拦截 port(治理装配;无注入默认全放行) */
|
|
275
277
|
interface SkillStateGuard {
|
|
@@ -379,6 +381,7 @@ type LifecycleListener = (event: LifecycleEvent) => void;
|
|
|
379
381
|
/** 生命周期事件总线:只读观测,支持按阶段或通配订阅 */
|
|
380
382
|
declare class EventBus {
|
|
381
383
|
#private;
|
|
384
|
+
constructor(onListenerError?: (error: unknown, event: LifecycleEvent) => void);
|
|
382
385
|
/** 返回取消订阅函数 */
|
|
383
386
|
on(phase: RuntimePhase | '*', listener: LifecycleListener): () => void;
|
|
384
387
|
/** 当前订阅者数量(流式 delta 零订阅零开销判断用) */
|
|
@@ -436,6 +439,8 @@ declare class FsMemoryStore implements MemoryStore {
|
|
|
436
439
|
declare class SerializingMemoryStore implements MemoryStore {
|
|
437
440
|
#private;
|
|
438
441
|
constructor(inner: MemoryStore);
|
|
442
|
+
/** 当前链上的 scope 数(监控/测试用;空闲时应回落到 0) */
|
|
443
|
+
get trackedScopeCount(): number;
|
|
439
444
|
get(scope: string, key: string): Promise<unknown>;
|
|
440
445
|
set(scope: string, key: string, value: unknown): Promise<void>;
|
|
441
446
|
delete(scope: string, key: string): Promise<void>;
|
|
@@ -649,6 +654,8 @@ interface RunSnapshot {
|
|
|
649
654
|
renderBlocks?: RenderBlock[];
|
|
650
655
|
/** 交互 id 序号(resume 后续算,避免 id 冲突;旧快照缺省从 0 起) */
|
|
651
656
|
interactionSeq?: number;
|
|
657
|
+
/** 已累计的交互等待 ms(resume 后续算,保持 totalTimeout 排除交互等待的语义;旧快照缺省为 0) */
|
|
658
|
+
pausedMs?: number;
|
|
652
659
|
/** 进入 interrupted 时计算的过期时间 */
|
|
653
660
|
interactionExpiresAt: string;
|
|
654
661
|
config: {
|
|
@@ -807,9 +814,12 @@ declare class WebSkillRuntime {
|
|
|
807
814
|
/**
|
|
808
815
|
* 多会话:session 对象的 run(prompt) 跨 run 延续消息历史(同一 session 对话上下文连续)。
|
|
809
816
|
* 既有 runtime.run(prompt) 保持无状态单次语义不变。
|
|
817
|
+
* 同 handle 并发 run 经 per-handle 队列串行化(防历史 last-writer-wins 丢轮次);
|
|
818
|
+
* maxHistoryMessages(默认 100)超出时滚动裁剪中段(保留首尾;边界对齐 tool 契约)。
|
|
810
819
|
*/
|
|
811
820
|
createSession(options?: {
|
|
812
821
|
sessionId?: string;
|
|
822
|
+
maxHistoryMessages?: number;
|
|
813
823
|
}): RuntimeSessionHandle;
|
|
814
824
|
discover(): Promise<DiscoveryResult>;
|
|
815
825
|
run(userPrompt: string, options?: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as SerializingMemoryStore, A as LifecycleHook, At as toVercelToolSpecs, B as RUN_SNAPSHOT_SCHEMA_VERSION, C as FullDisclosureRouter, Ct as normalizeErrorCode, D as HookRunnerOptions, Dt as resolveToolName, E as HookRunner, Et as parseBridgeRequest, F as OpenAiCompatibleClientConfig, G as RunTerminationReason, H as RunResult, I as ProgressiveRouter, J as RuntimeSession, K as RuntimePhase, L as READ_SKILL_FILE_INPUT_SCHEMA, M as LifecycleListener, N as NetworkPolicy, O as InstalledSkillManifest, Ot as schemaToForm, P as OpenAiCompatibleClient, Q as ScriptExecutor, R as READ_SKILL_FILE_TOOL, S as FsRunSnapshotStore, St as networkUrlHost, T as GoogleGenAiClientConfig, Tt as normalizeToolError, U as RunSnapshot, V as RouteResult, W as RunSnapshotStore, X as SchemaInferer, Y as RuntimeSessionHandle, Z as ScriptExecutionContext, _ as EventBus, _t as extractChartSpec, a as AgentLoopConfig, at as TraceClock, b as FsArtifactStore, bt as isNetworkAllowed, c as AnthropicClientConfig, ct as TraceRecorder, d as BridgeCapabilities, dt as WebSkillRuntime, et as SkillRouter, f as BridgeCapability, ft as WebSkillRuntimeDeps, g as CapabilityMode, gt as createWebSkillApi, h as CapabilityApproval, ht as createScriptContext, i as AgentLoop, it as ToolResult, j as LifecycleHookContext, k as LifecycleEvent, kt as toLlmToolSpec, l as ApprovalDecision, lt as VercelToolSpec, m as BridgeResponse, mt as buildRenderResult, n as ASK_USER_TOOL, nt as ToolDefinition, o as AgentLoopDeps, ot as TraceEvent, p as BridgeRequest, pt as bridgeError, q as RuntimeRun, r as ASK_USER_TOOL_NAME, rt as ToolResolution, s as AnthropicClient, st as TraceEventType, t as ASK_USER_INPUT_SCHEMA, tt as SkillStateGuard, u as ApprovalScope, ut as WebSkillApi, v as ExternalSkillProvider, vt as fromVercelResult, w as GoogleGenAiClient, wt as normalizeToolContent, x as FsMemoryStore, xt as mergeCatalogEntries, y as ExternalToolSource, yt as fromVercelStreamPart, z as READ_SKILL_FILE_TOOL_NAME } from "./index-
|
|
3
|
-
export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, type AgentLoopConfig, type AgentLoopDeps, AnthropicClient, type AnthropicClientConfig, type ApprovalDecision, type ApprovalScope, type ArchiveLimits, type Artifact, type ArtifactStore, type BridgeCapabilities, type BridgeCapability, type BridgeRequest, type BridgeResponse, CapabilityApproval, type CapabilityMode, type CatalogRenderer, type ChartSpec, DEFAULT_ARCHIVE_LIMITS, type DiscoveryResult, EventBus, type ExternalSkillProvider, type ExternalToolSource, type FileStat, type FileSystemProvider, type FormField, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FullDisclosureRouter, GoogleGenAiClient, type GoogleGenAiClientConfig, HookRunner, type HookRunnerOptions, type InstalledSkillManifest, type InteractionPolicy, type InteractionRequest, type InteractionResponse, type JsonSchema, type LifecycleEvent, type LifecycleHook, type LifecycleHookContext, type LifecycleListener, type LlmClient, type LlmCompleteInput, type LlmMessage, type LlmResponse, type LlmStreamEvent, type LlmToolCall, type LlmToolSpec, MemoryFS, type MemoryStore, type NetworkPolicy, OpenAiCompatibleClient, type OpenAiCompatibleClientConfig, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, RUN_SNAPSHOT_SCHEMA_VERSION, type RenderBlock, type RenderResultRequest, type RouteResult, type RunResult, type RunSnapshot, type RunSnapshotStore, type RunTerminationReason, type RuntimePhase, type RuntimeRun, type RuntimeSession, type RuntimeSessionHandle, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SKILL_PACK_FILE, type SchemaInferer, type ScriptExecutionContext, type ScriptExecutor, SerializingMemoryStore, type SkillCatalog, type SkillCatalogEntry, SkillDiscovery, type SkillDocument, type SkillInstallSource, type SkillIssue, type SkillLocation, type SkillManifest, type SkillMetadata, type SkillPackManifest, SkillReader, type SkillRouter, type SkillSource, type SkillStateGuard, type SkillsLockfile, type ToolDefinition, type ToolResolution, type ToolResult, type TraceClock, type TraceEvent, type TraceEventType, TraceRecorder, type UiBridge, type ValidationReport, type VercelToolSpec, type VerifyResult, type WebSkillApi, WebSkillError, type WebSkillErrorCode, WebSkillRuntime, type WebSkillRuntimeDeps, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isValidSkillName, jsonRenderer, mergeCatalogEntries, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, readResponseWithLimit, renderAvailableSkillsXml, renderCatalogJson, resolveArchiveLimits, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, unzipWithLimits, validateSkills, verifyManifest, xmlRenderer };
|
|
1
|
+
import { $ as buildCatalog, A as SKILL_NAME_MAX_LENGTH, B as SkillManifest, C as FileStat, D as RemoteUrlPolicy, E as MemoryFS, F as SkillDiscovery, G as SkillsLockfile, H as SkillPackManifest, I as SkillDocument, J as WebSkillError, K as ValidationReport, L as SkillInstallSource, M as SKILL_PACK_FILE, N as SkillCatalog, O as SKILLS_LOCKFILE, P as SkillCatalogEntry, Q as atomicWriteText, R as SkillIssue, S as DiscoveryResult, T as JsonSchema, U as SkillReader, V as SkillMetadata, W as SkillSource, X as assertRemoteUrlAllowed, Y as WebSkillErrorCode, Z as assertSafePathSegment, _ as RenderResultRequest, _t as unzipWithLimits, a as InteractionPolicy, at as exportSkills, b as CatalogRenderer, bt as xmlRenderer, c as LlmClient, ct as messageOf, d as LlmResponse, dt as parseSkillPackManifest, et as buildManifest, f as LlmStreamEvent, ft as readResponseWithLimit, g as RenderBlock, gt as resolveInsideRoot, h as MemoryStore, ht as resolveArchiveLimits, i as FormField, it as escapeXml, j as SKILL_NAME_PATTERN, k as SKILL_MANIFEST_FILE, l as LlmCompleteInput, lt as normalizePath, m as LlmToolSpec, mt as renderCatalogJson, n as ArtifactStore, nt as checkSkillRules, o as InteractionRequest, ot as isValidSkillName, p as LlmToolCall, pt as renderAvailableSkillsXml, q as VerifyResult, r as ChartSpec, rt as computeDigest, s as InteractionResponse, st as jsonRenderer, t as Artifact, tt as checkDependencyCycles, u as LlmMessage, ut as parseSkillMarkdown, v as UiBridge, vt as validateSkills, w as FileSystemProvider, x as DEFAULT_ARCHIVE_LIMITS, y as ArchiveLimits, yt as verifyManifest, z as SkillLocation } from "./types-CKm5G_eQ-krKWW8WV.js";
|
|
2
|
+
import { $ as SerializingMemoryStore, A as LifecycleHook, At as toVercelToolSpecs, B as RUN_SNAPSHOT_SCHEMA_VERSION, C as FullDisclosureRouter, Ct as normalizeErrorCode, D as HookRunnerOptions, Dt as resolveToolName, E as HookRunner, Et as parseBridgeRequest, F as OpenAiCompatibleClientConfig, G as RunTerminationReason, H as RunResult, I as ProgressiveRouter, J as RuntimeSession, K as RuntimePhase, L as READ_SKILL_FILE_INPUT_SCHEMA, M as LifecycleListener, N as NetworkPolicy, O as InstalledSkillManifest, Ot as schemaToForm, P as OpenAiCompatibleClient, Q as ScriptExecutor, R as READ_SKILL_FILE_TOOL, S as FsRunSnapshotStore, St as networkUrlHost, T as GoogleGenAiClientConfig, Tt as normalizeToolError, U as RunSnapshot, V as RouteResult, W as RunSnapshotStore, X as SchemaInferer, Y as RuntimeSessionHandle, Z as ScriptExecutionContext, _ as EventBus, _t as extractChartSpec, a as AgentLoopConfig, at as TraceClock, b as FsArtifactStore, bt as isNetworkAllowed, c as AnthropicClientConfig, ct as TraceRecorder, d as BridgeCapabilities, dt as WebSkillRuntime, et as SkillRouter, f as BridgeCapability, ft as WebSkillRuntimeDeps, g as CapabilityMode, gt as createWebSkillApi, h as CapabilityApproval, ht as createScriptContext, i as AgentLoop, it as ToolResult, j as LifecycleHookContext, k as LifecycleEvent, kt as toLlmToolSpec, l as ApprovalDecision, lt as VercelToolSpec, m as BridgeResponse, mt as buildRenderResult, n as ASK_USER_TOOL, nt as ToolDefinition, o as AgentLoopDeps, ot as TraceEvent, p as BridgeRequest, pt as bridgeError, q as RuntimeRun, r as ASK_USER_TOOL_NAME, rt as ToolResolution, s as AnthropicClient, st as TraceEventType, t as ASK_USER_INPUT_SCHEMA, tt as SkillStateGuard, u as ApprovalScope, ut as WebSkillApi, v as ExternalSkillProvider, vt as fromVercelResult, w as GoogleGenAiClient, wt as normalizeToolContent, x as FsMemoryStore, xt as mergeCatalogEntries, y as ExternalToolSource, yt as fromVercelStreamPart, z as READ_SKILL_FILE_TOOL_NAME } from "./index-DfINBEOy.js";
|
|
3
|
+
export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, type AgentLoopConfig, type AgentLoopDeps, AnthropicClient, type AnthropicClientConfig, type ApprovalDecision, type ApprovalScope, type ArchiveLimits, type Artifact, type ArtifactStore, type BridgeCapabilities, type BridgeCapability, type BridgeRequest, type BridgeResponse, CapabilityApproval, type CapabilityMode, type CatalogRenderer, type ChartSpec, DEFAULT_ARCHIVE_LIMITS, type DiscoveryResult, EventBus, type ExternalSkillProvider, type ExternalToolSource, type FileStat, type FileSystemProvider, type FormField, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FullDisclosureRouter, GoogleGenAiClient, type GoogleGenAiClientConfig, HookRunner, type HookRunnerOptions, type InstalledSkillManifest, type InteractionPolicy, type InteractionRequest, type InteractionResponse, type JsonSchema, type LifecycleEvent, type LifecycleHook, type LifecycleHookContext, type LifecycleListener, type LlmClient, type LlmCompleteInput, type LlmMessage, type LlmResponse, type LlmStreamEvent, type LlmToolCall, type LlmToolSpec, MemoryFS, type MemoryStore, type NetworkPolicy, OpenAiCompatibleClient, type OpenAiCompatibleClientConfig, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, RUN_SNAPSHOT_SCHEMA_VERSION, type RemoteUrlPolicy, type RenderBlock, type RenderResultRequest, type RouteResult, type RunResult, type RunSnapshot, type RunSnapshotStore, type RunTerminationReason, type RuntimePhase, type RuntimeRun, type RuntimeSession, type RuntimeSessionHandle, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SKILL_PACK_FILE, type SchemaInferer, type ScriptExecutionContext, type ScriptExecutor, SerializingMemoryStore, type SkillCatalog, type SkillCatalogEntry, SkillDiscovery, type SkillDocument, type SkillInstallSource, type SkillIssue, type SkillLocation, type SkillManifest, type SkillMetadata, type SkillPackManifest, SkillReader, type SkillRouter, type SkillSource, type SkillStateGuard, type SkillsLockfile, type ToolDefinition, type ToolResolution, type ToolResult, type TraceClock, type TraceEvent, type TraceEventType, TraceRecorder, type UiBridge, type ValidationReport, type VercelToolSpec, type VerifyResult, type WebSkillApi, WebSkillError, type WebSkillErrorCode, WebSkillRuntime, type WebSkillRuntimeDeps, assertRemoteUrlAllowed, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isValidSkillName, jsonRenderer, mergeCatalogEntries, messageOf, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, readResponseWithLimit, renderAvailableSkillsXml, renderCatalogJson, resolveArchiveLimits, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, unzipWithLimits, validateSkills, verifyManifest, xmlRenderer };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { A as isNetworkAllowed, B as toVercelToolSpecs, C as bridgeError, D as extractChartSpec, E as createWebSkillApi, F as normalizeToolError, I as parseBridgeRequest, L as resolveToolName, M as networkUrlHost, N as normalizeErrorCode, O as fromVercelResult, P as normalizeToolContent, R as schemaToForm, S as WebSkillRuntime, T as createScriptContext, _ 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 mergeCatalogEntries, k as fromVercelStreamPart, 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 toLlmToolSpec } from "./dist-
|
|
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 isNetworkAllowed, B as toVercelToolSpecs, C as bridgeError, D as extractChartSpec, E as createWebSkillApi, F as normalizeToolError, I as parseBridgeRequest, L as resolveToolName, M as networkUrlHost, N as normalizeErrorCode, O as fromVercelResult, P as normalizeToolContent, R as schemaToForm, S as WebSkillRuntime, T as createScriptContext, _ 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 mergeCatalogEntries, k as fromVercelStreamPart, 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 toLlmToolSpec } from "./dist-B77plHjw.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, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isValidSkillName, jsonRenderer, mergeCatalogEntries, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, readResponseWithLimit, renderAvailableSkillsXml, renderCatalogJson, resolveArchiveLimits, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, unzipWithLimits, validateSkills, verifyManifest, xmlRenderer };
|
|
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, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isValidSkillName, jsonRenderer, mergeCatalogEntries, messageOf, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, readResponseWithLimit, renderAvailableSkillsXml, renderCatalogJson, resolveArchiveLimits, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, unzipWithLimits, validateSkills, verifyManifest, xmlRenderer };
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { it as ToolResult, v as ExternalSkillProvider, xt as mergeCatalogEntries, y as ExternalToolSource } from "./index-
|
|
1
|
+
import { I as SkillDocument, P as SkillCatalogEntry, T as JsonSchema, m as LlmToolSpec } from "./types-CKm5G_eQ-krKWW8WV.js";
|
|
2
|
+
import { it as ToolResult, v as ExternalSkillProvider, xt as mergeCatalogEntries, y as ExternalToolSource } from "./index-DfINBEOy.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";
|
|
@@ -252,6 +252,10 @@ interface RemoteEndpointConfig {
|
|
|
252
252
|
headers?: Record<string, string>;
|
|
253
253
|
/** 连接超时;0/缺省 = 不超时 */
|
|
254
254
|
timeoutMs?: number;
|
|
255
|
+
/** 显式允许 http://(SSRF 防护默认仅 https) */
|
|
256
|
+
allowHttp?: boolean;
|
|
257
|
+
/** 显式允许私有/环回/链路本地地址(SSRF 防护默认拒绝) */
|
|
258
|
+
allowPrivateHosts?: boolean;
|
|
255
259
|
}
|
|
256
260
|
/**
|
|
257
261
|
* 远程 MCP endpoint 装配:SDK 官方 StreamableHTTPClientTransport(默认)/
|