@webskill/sdk 0.1.5 → 0.2.1
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/README.md +16 -10
- package/dist/browser.d.ts +37 -3
- package/dist/browser.js +106 -8
- package/dist/{dist-CfBOjJ4p.js → dist-BJobG0i-.js} +30 -7
- package/dist/{dist-LIFS3ZjI.js → dist-BRGQcLqR.js} +405 -179
- package/dist/{dist-fZFZaf43.js → dist-D0saNPi_.js} +22 -4
- package/dist/{dist-DuGN5x0v.js → dist-DrySSQ5R.js} +185 -50
- package/dist/env--jJB-TSX-04klhTYi.js +143 -0
- package/dist/env-BPUBZCwJ-4jat_SVG.d.ts +38 -0
- package/dist/governance.d.ts +43 -7
- package/dist/governance.js +168 -11
- package/dist/{index-Bun1aEf4.d.ts → index-BmzysJX5.d.ts} +48 -38
- package/dist/{index-COuOu6gw.d.ts → index-gjFuBevI.d.ts} +53 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/mcp.d.ts +3 -3
- package/dist/mcp.js +28 -8
- package/dist/node.d.ts +5 -4
- package/dist/node.js +5 -4
- package/dist/processSandboxEntry.d.ts +1 -0
- package/dist/processSandboxEntry.js +202 -0
- package/dist/{testing-BmR48Pn1.js → testing-B4pq6JYa.js} +1 -1
- package/dist/testing.d.ts +3 -2
- package/dist/testing.js +3 -2
- package/dist/{types-CgNC-oQu-DEcIBJKG.d.ts → types-CKm5G_eQ-8W8FnP4u.d.ts} +13 -2
- package/dist/ui-react.d.ts +4 -2
- package/dist/ui-react.js +25 -4
- package/dist/ui-vue.d.ts +3 -2
- package/dist/ui-vue.js +44 -15
- package/dist/ui.d.ts +5 -3
- package/dist/ui.js +2 -2
- package/package.json +21 -9
package/dist/ui-vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as renderMiniMarkdown, m as collectValues, w as shapeInteractionValue, x as renderMiniChart, y as interactionToFormModel } from "./dist-
|
|
1
|
+
import { S as renderMiniMarkdown, m as collectValues, w as shapeInteractionValue, x as renderMiniChart, y as interactionToFormModel } from "./dist-BJobG0i-.js";
|
|
2
2
|
import { defineComponent, h, reactive, ref } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region ../ui-vue/dist/index.js
|
|
@@ -10,6 +10,7 @@ var VueBridgeState = class {
|
|
|
10
10
|
state = reactive({
|
|
11
11
|
pending: null,
|
|
12
12
|
latestResult: null,
|
|
13
|
+
streamingRunId: null,
|
|
13
14
|
streamingText: ""
|
|
14
15
|
});
|
|
15
16
|
#resolvers = /* @__PURE__ */ new Map();
|
|
@@ -30,18 +31,28 @@ var VueBridgeState = class {
|
|
|
30
31
|
async renderResult(input) {
|
|
31
32
|
this.state.latestResult = input;
|
|
32
33
|
}
|
|
33
|
-
async onTextDelta(
|
|
34
|
+
async onTextDelta(runId, delta) {
|
|
35
|
+
if (this.state.streamingRunId !== runId) {
|
|
36
|
+
this.state.streamingRunId = runId;
|
|
37
|
+
this.state.streamingText = "";
|
|
38
|
+
}
|
|
34
39
|
this.state.streamingText += delta;
|
|
35
40
|
}
|
|
36
41
|
};
|
|
37
|
-
function renderControl(control) {
|
|
38
|
-
const
|
|
42
|
+
function renderControl(control, invalid) {
|
|
43
|
+
const controlId = `webskill-field-${control.name}`;
|
|
44
|
+
const label = h("label", {
|
|
45
|
+
class: "webskill-form__label",
|
|
46
|
+
for: controlId
|
|
47
|
+
}, [control.label, ...control.required ? [" *"] : []]);
|
|
39
48
|
const description = control.description ? h("div", { class: "webskill-form__description" }, control.description) : null;
|
|
40
49
|
let input;
|
|
41
50
|
switch (control.control) {
|
|
42
51
|
case "boolean":
|
|
43
52
|
input = h("input", {
|
|
44
53
|
type: "checkbox",
|
|
54
|
+
id: controlId,
|
|
55
|
+
"aria-invalid": invalid || void 0,
|
|
45
56
|
class: "webskill-form__input",
|
|
46
57
|
"data-webskill-control": control.name,
|
|
47
58
|
checked: control.defaultValue === true
|
|
@@ -49,6 +60,8 @@ function renderControl(control) {
|
|
|
49
60
|
break;
|
|
50
61
|
case "select":
|
|
51
62
|
input = h("select", {
|
|
63
|
+
id: controlId,
|
|
64
|
+
"aria-invalid": invalid || void 0,
|
|
52
65
|
class: "webskill-form__input",
|
|
53
66
|
"data-webskill-control": control.name
|
|
54
67
|
}, (control.options ?? []).map((option) => h("option", {
|
|
@@ -58,6 +71,8 @@ function renderControl(control) {
|
|
|
58
71
|
break;
|
|
59
72
|
case "textarea":
|
|
60
73
|
input = h("textarea", {
|
|
74
|
+
id: controlId,
|
|
75
|
+
"aria-invalid": invalid || void 0,
|
|
61
76
|
class: "webskill-form__input",
|
|
62
77
|
"data-webskill-control": control.name,
|
|
63
78
|
value: control.defaultValue !== void 0 ? String(control.defaultValue) : ""
|
|
@@ -65,6 +80,8 @@ function renderControl(control) {
|
|
|
65
80
|
break;
|
|
66
81
|
default: input = h("input", {
|
|
67
82
|
type: control.control === "number" ? "number" : "text",
|
|
83
|
+
id: controlId,
|
|
84
|
+
"aria-invalid": invalid || void 0,
|
|
68
85
|
class: "webskill-form__input",
|
|
69
86
|
"data-webskill-control": control.name,
|
|
70
87
|
value: control.defaultValue !== void 0 ? String(control.defaultValue) : ""
|
|
@@ -113,7 +130,11 @@ const InteractionForm = defineComponent({
|
|
|
113
130
|
}, [
|
|
114
131
|
model.title ? h("div", { class: "webskill-form__title" }, model.title) : null,
|
|
115
132
|
model.message && (model.kind === "form" || model.kind === "authorize") ? h("p", { class: "webskill-form__message" }, model.message) : null,
|
|
116
|
-
...model.controls.map((control) => h("div", { key: control.name }, [renderControl(control), invalid.value.includes(control.name) ? h("div", {
|
|
133
|
+
...model.controls.map((control) => h("div", { key: control.name }, [renderControl(control, invalid.value.includes(control.name)), invalid.value.includes(control.name) ? h("div", {
|
|
134
|
+
id: `webskill-error-${control.name}`,
|
|
135
|
+
role: "alert",
|
|
136
|
+
class: "webskill-form__error"
|
|
137
|
+
}, "This field is required") : null])),
|
|
117
138
|
h("div", { class: "webskill-form__actions" }, [h("button", {
|
|
118
139
|
type: "submit",
|
|
119
140
|
class: "webskill-form__button webskill-form__button--primary"
|
|
@@ -132,20 +153,28 @@ const InteractionForm = defineComponent({
|
|
|
132
153
|
});
|
|
133
154
|
function renderBlock(block, key) {
|
|
134
155
|
switch (block.type) {
|
|
135
|
-
case "chart":
|
|
136
|
-
|
|
137
|
-
onVnodeMounted: (vnode) => {
|
|
156
|
+
case "chart": {
|
|
157
|
+
const renderChart = (vnode) => {
|
|
138
158
|
const el = vnode.el;
|
|
139
159
|
if (el) el.replaceChildren(renderMiniChart(block.chart, el.ownerDocument));
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
160
|
+
};
|
|
161
|
+
return h("div", {
|
|
162
|
+
key,
|
|
163
|
+
onVnodeMounted: renderChart,
|
|
164
|
+
onVnodeUpdated: renderChart
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
case "markdown": {
|
|
168
|
+
const renderMd = (vnode) => {
|
|
145
169
|
const el = vnode.el;
|
|
146
170
|
if (el) el.replaceChildren(renderMiniMarkdown(block.text, el.ownerDocument));
|
|
147
|
-
}
|
|
148
|
-
|
|
171
|
+
};
|
|
172
|
+
return h("div", {
|
|
173
|
+
key,
|
|
174
|
+
onVnodeMounted: renderMd,
|
|
175
|
+
onVnodeUpdated: renderMd
|
|
176
|
+
});
|
|
177
|
+
}
|
|
149
178
|
case "json": return h("pre", {
|
|
150
179
|
key,
|
|
151
180
|
class: "webskill-result__json"
|
package/dist/ui.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as RenderResultRequest, g as RenderBlock, o as InteractionRequest, r as ChartSpec, s as InteractionResponse, v as UiBridge } from "./types-
|
|
2
|
-
import {
|
|
1
|
+
import { _ as RenderResultRequest, g as RenderBlock, o as InteractionRequest, r as ChartSpec, s as InteractionResponse, v as UiBridge } from "./types-CKm5G_eQ-8W8FnP4u.js";
|
|
2
|
+
import { mt as buildRenderResult } from "./index-gjFuBevI.js";
|
|
3
3
|
//#region ../ui/dist/index.d.ts
|
|
4
4
|
//#region src/model/formModel.d.ts
|
|
5
5
|
interface FormModel {
|
|
@@ -50,7 +50,7 @@ declare function renderMiniMarkdown(text: string, doc: Document): HTMLElement;
|
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/chart/miniChart.d.ts
|
|
52
52
|
/** 固定 8 色循环调色板 */
|
|
53
|
-
declare const CHART_PALETTE: readonly [
|
|
53
|
+
declare const CHART_PALETTE: readonly ["#4e79a7", "#f28e2b", "#e15759", "#76b7b2", "#59a14f", "#edc948", "#b07aa1", "#ff9da7"];
|
|
54
54
|
/**
|
|
55
55
|
* ChartSpec → SVG(bar 等宽柱 + 值标签;line 折线 + 点;pie 扇形 + 图例;空数据容错)
|
|
56
56
|
* @stable
|
|
@@ -77,6 +77,8 @@ declare class WebFormBridge implements UiBridge {
|
|
|
77
77
|
styles?: boolean;
|
|
78
78
|
});
|
|
79
79
|
request(input: InteractionRequest): Promise<InteractionResponse>;
|
|
80
|
+
/** 尽力取消等待中的 request(超时后清理遗留表单) */
|
|
81
|
+
cancel(id: string): void;
|
|
80
82
|
renderResult(input: RenderResultRequest): Promise<void>;
|
|
81
83
|
progress(input: {
|
|
82
84
|
runId: string;
|
package/dist/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as renderRenderResult, D as toVercelToolInvocation, E as toOpenUiLang, S as renderMiniMarkdown, T as toA2uiMessages, _ as fromOpenUiAction, a as CHART_PALETTE, b as renderBlocks, c as OPENUI_SUBMIT_ACTION, d as WEBSKILL_STYLES_CSS, f as WebFormBridge, g as fromA2uiAction, h as ensureStyles, i as A2UI_VERSION, l as VERCEL_INTERACTION_TOOL_NAME, m as collectValues, n as A2UI_CANCEL_ACTION, o as LitRendererBridge, p as chartToTable, r as A2UI_SUBMIT_ACTION, s as OPENUI_CANCEL_ACTION, t as A2UI_BASIC_CATALOG_ID, u as VercelUiBridge, v as fromVercelToolResult, w as shapeInteractionValue, x as renderMiniChart, y as interactionToFormModel } from "./dist-
|
|
1
|
+
import { w as buildRenderResult } from "./dist-DrySSQ5R.js";
|
|
2
|
+
import { C as renderRenderResult, D as toVercelToolInvocation, E as toOpenUiLang, S as renderMiniMarkdown, T as toA2uiMessages, _ as fromOpenUiAction, a as CHART_PALETTE, b as renderBlocks, c as OPENUI_SUBMIT_ACTION, d as WEBSKILL_STYLES_CSS, f as WebFormBridge, g as fromA2uiAction, h as ensureStyles, i as A2UI_VERSION, l as VERCEL_INTERACTION_TOOL_NAME, m as collectValues, n as A2UI_CANCEL_ACTION, o as LitRendererBridge, p as chartToTable, r as A2UI_SUBMIT_ACTION, s as OPENUI_CANCEL_ACTION, t as A2UI_BASIC_CATALOG_ID, u as VercelUiBridge, v as fromVercelToolResult, w as shapeInteractionValue, x as renderMiniChart, y as interactionToFormModel } from "./dist-BJobG0i-.js";
|
|
3
3
|
|
|
4
4
|
export { A2UI_BASIC_CATALOG_ID, A2UI_CANCEL_ACTION, A2UI_SUBMIT_ACTION, A2UI_VERSION, CHART_PALETTE, LitRendererBridge, OPENUI_CANCEL_ACTION, OPENUI_SUBMIT_ACTION, VERCEL_INTERACTION_TOOL_NAME, VercelUiBridge, WEBSKILL_STYLES_CSS, WebFormBridge, buildRenderResult, chartToTable, collectValues, ensureStyles, fromA2uiAction, fromOpenUiAction, fromVercelToolResult, interactionToFormModel, renderBlocks, renderMiniChart, renderMiniMarkdown, renderRenderResult, shapeInteractionValue, toA2uiMessages, toOpenUiLang, toVercelToolInvocation };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webskill/sdk",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"description": "WebSkill
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "WebSkill \u2014 browser/Node agent skill runtime (skills, tools, MCP, governance, UI)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -58,17 +58,17 @@
|
|
|
58
58
|
"typecheck": "tsc --noEmit"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
62
61
|
"fflate": "0.8.3",
|
|
63
|
-
"
|
|
64
|
-
"tar": "7.5.21",
|
|
65
|
-
"yaml": "^2.9.0",
|
|
66
|
-
"zod": "^4.4.3"
|
|
62
|
+
"yaml": "^2.9.0"
|
|
67
63
|
},
|
|
68
64
|
"peerDependencies": {
|
|
69
65
|
"react": ">=19.0.0",
|
|
70
66
|
"react-dom": ">=19.0.0",
|
|
71
|
-
"vue": ">=3.5.0"
|
|
67
|
+
"vue": ">=3.5.0",
|
|
68
|
+
"@modelcontextprotocol/sdk": ">=1.29.0",
|
|
69
|
+
"oxc-parser": ">=0.141.0",
|
|
70
|
+
"tar": ">=7.5.0",
|
|
71
|
+
"zod": ">=4.0.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependenciesMeta": {
|
|
74
74
|
"react": {
|
|
@@ -79,6 +79,18 @@
|
|
|
79
79
|
},
|
|
80
80
|
"vue": {
|
|
81
81
|
"optional": true
|
|
82
|
+
},
|
|
83
|
+
"@modelcontextprotocol/sdk": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
86
|
+
"oxc-parser": {
|
|
87
|
+
"optional": true
|
|
88
|
+
},
|
|
89
|
+
"tar": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"zod": {
|
|
93
|
+
"optional": true
|
|
82
94
|
}
|
|
83
95
|
},
|
|
84
96
|
"devDependencies": {
|
|
@@ -93,6 +105,6 @@
|
|
|
93
105
|
"@webskill/ui-react": "workspace:*",
|
|
94
106
|
"@webskill/ui-vue": "workspace:*",
|
|
95
107
|
"tsdown": "0.22.13",
|
|
96
|
-
"typescript": "
|
|
108
|
+
"typescript": "6.0.3"
|
|
97
109
|
}
|
|
98
110
|
}
|