dsh-plugin-capabilities 0.3.1 → 0.3.3
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/lib/client.js +43 -8
- package/lib/client.js.map +2 -2
- package/package.json +1 -1
- package/src/client/MarketTab.tsx +21 -0
- package/src/client/SkillsTab.tsx +33 -10
- package/src/client/css.ts +13 -5
- package/src/client/locales.ts +4 -0
- package/src/client/primitives.d.ts +6 -0
package/lib/client.js
CHANGED
|
@@ -78,7 +78,7 @@ var CSS = `
|
|
|
78
78
|
.dpc-label{display:flex;flex-direction:column;gap:4px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary)}
|
|
79
79
|
.dpc-label>span:first-child{color:var(--dsw-alias-label-tertiary)}
|
|
80
80
|
.dpc-input,.dpc-textarea,.dpc-select{width:100%;box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:7px 10px;outline:none;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px}
|
|
81
|
-
.dpc-textarea{min-height:
|
|
81
|
+
.dpc-textarea{min-height:320px;resize:vertical;font-family:var(--ds-font-family-code);line-height:1.5}
|
|
82
82
|
.dpc-textarea[data-short='true']{min-height:96px}
|
|
83
83
|
.dpc-input:focus-visible,.dpc-textarea:focus-visible,.dpc-select:focus-visible{border-color:var(--dsw-alias-state-business-primary);box-shadow:0 0 0 2px color-mix(in srgb,var(--dsw-alias-state-business-primary) 18%,transparent)}
|
|
84
84
|
.dpc-checks{display:flex;gap:16px;font-size:13px;line-height:20px}
|
|
@@ -91,8 +91,9 @@ var CSS = `
|
|
|
91
91
|
/* Editor dialogs (new skill / server): 640px wide so markdown bodies and
|
|
92
92
|
command/arg/env lines stop wrapping mid-token; the content column scrolls
|
|
93
93
|
on short viewports instead of clipping past the dialog edge. */
|
|
94
|
-
.dpc-modalForm.dpc-modalForm{width:min(
|
|
94
|
+
.dpc-modalForm.dpc-modalForm{width:min(760px,100%)}
|
|
95
95
|
.dpc-modalScroll.dpc-modalScroll{max-height:calc(100vh - 160px);overflow-y:auto}
|
|
96
|
+
.dpc-mdPreview{min-height:320px;max-height:60vh;overflow-y:auto;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:8px 12px;background:var(--dsw-alias-bg-layer-1);font-size:13px}
|
|
96
97
|
.dpc-importScroll{display:flex;flex-direction:column;gap:14px;max-height:min(400px,52vh);overflow-y:auto;padding:2px 4px 2px 2px}
|
|
97
98
|
.dpc-importGroup{display:flex;flex-direction:column;gap:8px}
|
|
98
99
|
.dpc-importHead{display:flex;align-items:center;gap:8px;padding:0 2px}
|
|
@@ -140,15 +141,22 @@ var CSS = `
|
|
|
140
141
|
.dpc-format .dpc-form{margin-top:8px}
|
|
141
142
|
.dpc-formatHint{margin:2px 0 0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary)}
|
|
142
143
|
.dpc-code{margin:4px 0 8px;border:1px solid var(--dsw-alias-border-l2);border-radius:6px;padding:8px 10px;overflow-x:auto;background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);font-family:var(--ds-font-family-code);font-size:11px;line-height:17px;white-space:pre}
|
|
143
|
-
/* Market detail modal.
|
|
144
|
+
/* Market detail modal. The host dialog card is a fixed 380px column with no
|
|
145
|
+
scroll, which the long-form intros turn into a clipped strip \u2014 widen it
|
|
146
|
+
(doubled selector outranks the module class regardless of style order),
|
|
147
|
+
cap the height, and scroll inside the content region. */
|
|
148
|
+
.dpc-marketDialog.dpc-marketDialog{width:min(720px,100%);max-height:calc(100vh - 48px)}
|
|
149
|
+
.dpc-marketContent{overflow-y:auto;min-height:0}
|
|
150
|
+
.dpc-detailTagsRow{display:flex;flex-wrap:wrap;gap:4px;margin:0 0 8px}
|
|
144
151
|
.dpc-detailDesc{margin:0;font-size:13px;line-height:20px}
|
|
145
|
-
.dpc-detailSection{margin-top:
|
|
152
|
+
.dpc-detailSection{margin-top:14px;display:flex;flex-direction:column;gap:6px}
|
|
146
153
|
.dpc-detailLabel{font-size:11px;line-height:16px;color:var(--dsw-alias-label-secondary)}
|
|
147
154
|
.dpc-detailTags{display:flex;flex-wrap:wrap;gap:4px}
|
|
148
|
-
.dpc-skillList{margin:0;padding:0;list-style:none;display:
|
|
155
|
+
.dpc-skillList{margin:0;padding:0;list-style:none;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 18px}
|
|
149
156
|
.dpc-skillItem{display:flex;gap:8px;align-items:baseline;font-size:12px;line-height:18px;min-width:0}
|
|
150
157
|
.dpc-skillName{font-family:var(--ds-font-family-code);color:var(--dsw-alias-label-primary);white-space:nowrap;flex:none}
|
|
151
158
|
.dpc-skillDesc{color:var(--dsw-alias-label-secondary);min-width:0}
|
|
159
|
+
@media(max-width:560px){.dpc-skillList{grid-template-columns:minmax(0,1fr)}}
|
|
152
160
|
@media(max-width:680px){.dpc-cards{grid-template-columns:minmax(0,1fr)}}
|
|
153
161
|
`;
|
|
154
162
|
|
|
@@ -344,6 +352,9 @@ function MarketTab(props) {
|
|
|
344
352
|
open: detailRepo !== null || detailServer !== null,
|
|
345
353
|
onClose: () => setDetail(null),
|
|
346
354
|
title: detailRepo !== null ? title(detailRepo) : detailServer !== null ? title(detailServer) : "",
|
|
355
|
+
closeLabel: t("close"),
|
|
356
|
+
className: "dpc-marketDialog",
|
|
357
|
+
contentClassName: "dpc-marketContent",
|
|
347
358
|
footer: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
348
359
|
detailRepo !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { className: "dpc-link", href: detailRepo.homepage ?? detailRepo.url, target: "_blank", rel: "noreferrer", children: t("marketHome") }),
|
|
349
360
|
detailServer !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { className: "dpc-link", href: detailServer.homepage, target: "_blank", rel: "noreferrer", children: t("marketHome") }),
|
|
@@ -364,6 +375,16 @@ function MarketTab(props) {
|
|
|
364
375
|
), children: t("marketUninstall") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "primary", disabled: busyId !== null, onClick: () => void doInstallMcp(detailServer), children: busyId === detailServer.id ? t("marketInstalling") : t("marketAdd") }))
|
|
365
376
|
] }),
|
|
366
377
|
children: [
|
|
378
|
+
(detailRepo !== null || detailServer !== null) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dpc-detailTagsRow", children: [
|
|
379
|
+
detailRepo !== null && detailRepo.skillCount !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpc-tag", children: t("marketSkillCount").replace("{n}", String(detailRepo.skillCount)) }),
|
|
380
|
+
detailRepo !== null && detailRepo.installedId !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpc-tag", "data-kind": "source", children: t("marketInstalled") }),
|
|
381
|
+
detailServer !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
382
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpc-tag", children: detailServer.transport }),
|
|
383
|
+
detailServer.runtime !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpc-tag", children: detailServer.runtime }),
|
|
384
|
+
detailServer.category !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpc-tag", children: detailServer.category }),
|
|
385
|
+
detailServer.installed && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpc-tag", "data-kind": "source", children: t("marketInstalled") })
|
|
386
|
+
] })
|
|
387
|
+
] }),
|
|
367
388
|
detailRepo !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
368
389
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "dpc-detailDesc", children: longText(detailRepo) }),
|
|
369
390
|
detailRepo.skills !== void 0 && detailRepo.skills.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dpc-detailSection", children: [
|
|
@@ -1021,6 +1042,7 @@ function SkillsTab(props) {
|
|
|
1021
1042
|
const { t, injected } = props;
|
|
1022
1043
|
const [skills, setSkills] = (0, import_react3.useState)(null);
|
|
1023
1044
|
const [editor, setEditor] = (0, import_react3.useState)(null);
|
|
1045
|
+
const [preview, setPreview] = (0, import_react3.useState)(false);
|
|
1024
1046
|
const [confirmName, setConfirmName] = (0, import_react3.useState)(null);
|
|
1025
1047
|
const [busy, setBusy] = (0, import_react3.useState)(false);
|
|
1026
1048
|
const [outcome, setOutcome] = (0, import_react3.useState)(null);
|
|
@@ -1059,6 +1081,7 @@ function SkillsTab(props) {
|
|
|
1059
1081
|
}, [injected, reload, t]);
|
|
1060
1082
|
const openCreate = () => {
|
|
1061
1083
|
setFormError(null);
|
|
1084
|
+
setPreview(false);
|
|
1062
1085
|
setEditor({ mode: "create", name: "", description: "", whenToUse: "", modelInvocable: true, userInvocable: true, content: "" });
|
|
1063
1086
|
};
|
|
1064
1087
|
const openExisting = async (skill) => {
|
|
@@ -1066,6 +1089,7 @@ function SkillsTab(props) {
|
|
|
1066
1089
|
setFormError(null);
|
|
1067
1090
|
try {
|
|
1068
1091
|
const body = await injected.get(skill.name);
|
|
1092
|
+
setPreview(!skill.editable);
|
|
1069
1093
|
setEditor({
|
|
1070
1094
|
mode: skill.editable ? "edit" : "view",
|
|
1071
1095
|
name: skill.name,
|
|
@@ -1413,9 +1437,16 @@ function SkillsTab(props) {
|
|
|
1413
1437
|
t("userInvocable")
|
|
1414
1438
|
] })
|
|
1415
1439
|
] }),
|
|
1416
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("
|
|
1417
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.
|
|
1418
|
-
|
|
1440
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-label", children: [
|
|
1441
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-cardRow", children: [
|
|
1442
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: t("skillContent") }),
|
|
1443
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dpc-spacer" }),
|
|
1444
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dpc-segments", role: "tablist", "aria-label": t("skillContent"), children: [
|
|
1445
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", role: "tab", "aria-selected": preview, className: "dpc-segment", "data-active": preview ? "true" : void 0, onClick: () => setPreview(true), children: t("skillPreview") }),
|
|
1446
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", role: "tab", "aria-selected": !preview, className: "dpc-segment", "data-active": !preview ? "true" : void 0, onClick: () => setPreview(false), children: readOnly ? t("skillPlainText") : t("edit") })
|
|
1447
|
+
] })
|
|
1448
|
+
] }),
|
|
1449
|
+
preview ? typeof import_dsh_client_ui_primitives3.MarkdownText === "function" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dpc-mdPreview", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives3.MarkdownText, { text: editor.content }) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("textarea", { className: "dpc-textarea", value: editor.content, readOnly: true }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1419
1450
|
"textarea",
|
|
1420
1451
|
{
|
|
1421
1452
|
className: "dpc-textarea",
|
|
@@ -1566,6 +1597,8 @@ var zh = {
|
|
|
1566
1597
|
skillDescription: "\u63CF\u8FF0",
|
|
1567
1598
|
skillWhenToUse: "\u4F7F\u7528\u65F6\u673A\uFF08\u53EF\u9009\uFF09",
|
|
1568
1599
|
skillContent: "\u6B63\u6587\uFF08Markdown\uFF09",
|
|
1600
|
+
skillPreview: "Markdown \u9884\u89C8",
|
|
1601
|
+
skillPlainText: "\u7EAF\u6587\u672C",
|
|
1569
1602
|
modelInvocable: "\u5141\u8BB8\u6A21\u578B\u8C03\u7528",
|
|
1570
1603
|
userInvocable: "\u5141\u8BB8\u7528\u6237 / \u8C03\u7528",
|
|
1571
1604
|
save: "\u4FDD\u5B58",
|
|
@@ -1696,6 +1729,8 @@ var en = {
|
|
|
1696
1729
|
skillDescription: "Description",
|
|
1697
1730
|
skillWhenToUse: "When to use (optional)",
|
|
1698
1731
|
skillContent: "Body (Markdown)",
|
|
1732
|
+
skillPreview: "Markdown preview",
|
|
1733
|
+
skillPlainText: "Plain text",
|
|
1699
1734
|
modelInvocable: "Model-invocable",
|
|
1700
1735
|
userInvocable: "User-invocable (/)",
|
|
1701
1736
|
save: "Save",
|