dsh-mcp-ops 0.2.0 → 0.2.2
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 +25 -8
- package/lib/client.js +197 -159
- package/lib/index.js +7 -1
- package/lib/mount.js +366 -148
- package/lib/oauth-store.js +81 -0
- package/lib/oauth-web.js +2 -1
- package/lib/oauth.js +29 -1
- package/lib/probe.js +20 -39
- package/lib/refs.js +10 -2
- package/lib/service.js +85 -16
- package/lib/sources/cordis-source.js +35 -13
- package/lib/system-ca.js +79 -0
- package/lib/tool-control.js +43 -3
- package/package.json +13 -12
package/lib/client.js
CHANGED
|
@@ -27,6 +27,38 @@ __export(index_exports, {
|
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(index_exports);
|
|
29
29
|
|
|
30
|
+
// src/client/sections/McpMark.tsx
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var MCP_MARK_16_VIEW_BOX = "-0.075 -0.075 24.15 24.15";
|
|
33
|
+
var MCP_MARK_16_PATH = "M13.85 0 a4.16 4.16 0 0 0 -2.95 1.217 L1.456 10.66 a0.835 0.835 0 0 0 0 1.18 a0.835 0.835 0 0 0 1.18 0 l9.442 -9.442 a2.49 2.49 0 0 1 3.541 0 a2.49 2.49 0 0 1 0 3.541 L8.59 12.97 l-0.1 0.1 a0.835 0.835 0 0 0 0 1.18 a0.835 0.835 0 0 0 1.18 0 l0.1 -0.098 l7.03 -7.034 a2.49 2.49 0 0 1 3.542 0 l0.049 0.05 a2.49 2.49 0 0 1 0 3.54 l-8.54 8.54 a1.96 1.96 0 0 0 0 2.755 l1.753 1.753 a0.835 0.835 0 0 0 1.18 0 a0.835 0.835 0 0 0 0 -1.18 l-1.753 -1.753 a0.266 0.266 0 0 1 0 -0.394 l8.54 -8.54 a4.185 4.185 0 0 0 0 -5.9 l-0.05 -0.05 a4.16 4.16 0 0 0 -2.95 -1.218 c-0.2 0 -0.401 0.02 -0.6 0.048 a4.17 4.17 0 0 0 -1.17 -3.552 A4.16 4.16 0 0 0 13.85 0 m0 3.333 a0.84 0.84 0 0 0 -0.59 0.245 L6.275 10.56 a4.186 4.186 0 0 0 0 5.902 a4.186 4.186 0 0 0 5.902 0 L19.16 9.48 a0.835 0.835 0 0 0 0 -1.18 a0.835 0.835 0 0 0 -1.18 0 l-6.985 6.984 a2.49 2.49 0 0 1 -3.54 0 a2.49 2.49 0 0 1 0 -3.54 l6.983 -6.985 a0.835 0.835 0 0 0 0 -1.18 a0.84 0.84 0 0 0 -0.59 -0.245";
|
|
34
|
+
function McpMark({ size = 16, className, decorative = false }) {
|
|
35
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
36
|
+
"svg",
|
|
37
|
+
{
|
|
38
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
39
|
+
viewBox: MCP_MARK_16_VIEW_BOX,
|
|
40
|
+
width: size,
|
|
41
|
+
height: size,
|
|
42
|
+
fill: "currentColor",
|
|
43
|
+
role: decorative ? void 0 : "img",
|
|
44
|
+
"aria-hidden": decorative ? true : void 0,
|
|
45
|
+
"aria-label": decorative ? void 0 : "Model Context Protocol",
|
|
46
|
+
className,
|
|
47
|
+
"data-role": "mcp-mark",
|
|
48
|
+
children: [
|
|
49
|
+
decorative ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("title", { children: "Model Context Protocol" }),
|
|
50
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: MCP_MARK_16_PATH, stroke: "currentColor", strokeWidth: 0.15, strokeLinejoin: "round" })
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/client/NavIcon.tsx
|
|
57
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
58
|
+
function McpNavIcon({ size }) {
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(McpMark, { size, decorative: true });
|
|
60
|
+
}
|
|
61
|
+
|
|
30
62
|
// src/client/remote-contribution.js
|
|
31
63
|
var import_zod = require("zod");
|
|
32
64
|
var diagnostic$schema = import_zod.z.object({
|
|
@@ -112,7 +144,8 @@ var toolsPayload$schema = import_zod.z.object({
|
|
|
112
144
|
tools: import_zod.z.array(toolRow$schema).readonly(),
|
|
113
145
|
mode: mode$schema,
|
|
114
146
|
hotSize: import_zod.z.number().readonly(),
|
|
115
|
-
hotLimit: import_zod.z.number().readonly()
|
|
147
|
+
hotLimit: import_zod.z.number().readonly(),
|
|
148
|
+
enforcement: import_zod.z.union([import_zod.z.literal("mask"), import_zod.z.literal("unavailable")]).readonly()
|
|
116
149
|
}).readonly();
|
|
117
150
|
var listResult$schema = import_zod.z.union([
|
|
118
151
|
import_zod.z.object({ ok: import_zod.z.literal(true).readonly(), value: payload$schema }).readonly(),
|
|
@@ -666,13 +699,13 @@ var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primit
|
|
|
666
699
|
var ConfirmDialog_default = { "dialog": "dsh-mcp-ops-ConfirmDialog-dialog", "modal": "dsh-mcp-ops-ConfirmDialog-modal", "title": "dsh-mcp-ops-ConfirmDialog-title", "body": "dsh-mcp-ops-ConfirmDialog-body", "actions": "dsh-mcp-ops-ConfirmDialog-actions", "danger": "dsh-mcp-ops-ConfirmDialog-danger" };
|
|
667
700
|
|
|
668
701
|
// src/client/sections/ConfirmDialog.tsx
|
|
669
|
-
var
|
|
702
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
670
703
|
function ConfirmDialog(props) {
|
|
671
|
-
return /* @__PURE__ */ (0,
|
|
672
|
-
/* @__PURE__ */ (0,
|
|
673
|
-
/* @__PURE__ */ (0,
|
|
674
|
-
/* @__PURE__ */ (0,
|
|
675
|
-
/* @__PURE__ */ (0,
|
|
704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives.Modal, { open: true, headless: true, title: props.title, onClose: props.onCancel, className: ConfirmDialog_default.dialog, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: ConfirmDialog_default.modal, "data-plugin": "dsh-mcp-ops", "data-role": "confirm-modal", children: [
|
|
705
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { className: ConfirmDialog_default.title, "data-role": "confirm-title", children: props.title }),
|
|
706
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: ConfirmDialog_default.body, children: props.body }),
|
|
707
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: ConfirmDialog_default.actions, children: [
|
|
708
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
676
709
|
import_dsh_client_ui_primitives.Button,
|
|
677
710
|
{
|
|
678
711
|
variant: props.danger ? "outline" : "primary",
|
|
@@ -683,7 +716,7 @@ function ConfirmDialog(props) {
|
|
|
683
716
|
children: props.yes
|
|
684
717
|
}
|
|
685
718
|
),
|
|
686
|
-
/* @__PURE__ */ (0,
|
|
719
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
687
720
|
import_dsh_client_ui_primitives.Button,
|
|
688
721
|
{
|
|
689
722
|
variant: "outline",
|
|
@@ -718,7 +751,7 @@ var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primi
|
|
|
718
751
|
var EnvPanel_default = { "panel": "dsh-mcp-ops-EnvPanel-panel", "toggle": "dsh-mcp-ops-EnvPanel-toggle", "switchWrap": "dsh-mcp-ops-EnvPanel-switchWrap", "hint": "dsh-mcp-ops-EnvPanel-hint", "intro": "dsh-mcp-ops-EnvPanel-intro", "rows": "dsh-mcp-ops-EnvPanel-rows", "rowLine": "dsh-mcp-ops-EnvPanel-rowLine", "field": "dsh-mcp-ops-EnvPanel-field", "fieldName": "dsh-mcp-ops-EnvPanel-fieldName", "fieldValue": "dsh-mcp-ops-EnvPanel-fieldValue", "input": "dsh-mcp-ops-EnvPanel-input", "checkbox": "dsh-mcp-ops-EnvPanel-checkbox", "remove": "dsh-mcp-ops-EnvPanel-remove", "dialog": "dsh-mcp-ops-EnvPanel-dialog", "modal": "dsh-mcp-ops-EnvPanel-modal", "modalTitle": "dsh-mcp-ops-EnvPanel-modalTitle", "batchHint": "dsh-mcp-ops-EnvPanel-batchHint", "textarea": "dsh-mcp-ops-EnvPanel-textarea", "batchActions": "dsh-mcp-ops-EnvPanel-batchActions", "batchButtons": "dsh-mcp-ops-EnvPanel-batchButtons", "actions": "dsh-mcp-ops-EnvPanel-actions", "note": "dsh-mcp-ops-EnvPanel-note", "error": "dsh-mcp-ops-EnvPanel-error", "saved": "dsh-mcp-ops-EnvPanel-saved" };
|
|
719
752
|
|
|
720
753
|
// src/client/sections/EnvPanel.tsx
|
|
721
|
-
var
|
|
754
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
722
755
|
function EnvPanel(props) {
|
|
723
756
|
const { t } = props;
|
|
724
757
|
const propsRef = (0, import_react.useRef)(props);
|
|
@@ -774,9 +807,9 @@ function EnvPanel(props) {
|
|
|
774
807
|
setBatchOpen(false);
|
|
775
808
|
setSaved(false);
|
|
776
809
|
};
|
|
777
|
-
return /* @__PURE__ */ (0,
|
|
778
|
-
/* @__PURE__ */ (0,
|
|
779
|
-
/* @__PURE__ */ (0,
|
|
810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: EnvPanel_default.panel, "data-plugin": "dsh-mcp-ops", "data-section": "env-panel", children: [
|
|
811
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: EnvPanel_default.toggle, children: [
|
|
812
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: EnvPanel_default.switchWrap, "data-role": "env-inject", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
780
813
|
import_dsh_client_ui_primitives2.Switch,
|
|
781
814
|
{
|
|
782
815
|
checked: pendingInject ?? props.injectGlobalEnv,
|
|
@@ -788,18 +821,18 @@ function EnvPanel(props) {
|
|
|
788
821
|
}
|
|
789
822
|
}
|
|
790
823
|
) }),
|
|
791
|
-
/* @__PURE__ */ (0,
|
|
824
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("envInject") })
|
|
792
825
|
] }),
|
|
793
|
-
/* @__PURE__ */ (0,
|
|
794
|
-
/* @__PURE__ */ (0,
|
|
795
|
-
error === null ? null : /* @__PURE__ */ (0,
|
|
826
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: EnvPanel_default.hint, children: t("envInjectHint") }),
|
|
827
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: EnvPanel_default.intro, children: t("envIntro") }),
|
|
828
|
+
error === null ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: EnvPanel_default.error, role: "alert", children: [
|
|
796
829
|
t("errorTitle"),
|
|
797
830
|
"\uFF1A",
|
|
798
831
|
error
|
|
799
832
|
] }),
|
|
800
|
-
rows.length === 0 ? /* @__PURE__ */ (0,
|
|
801
|
-
/* @__PURE__ */ (0,
|
|
802
|
-
/* @__PURE__ */ (0,
|
|
833
|
+
rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: EnvPanel_default.note, children: t("envEmpty") }) : null,
|
|
834
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: EnvPanel_default.rows, children: rows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: EnvPanel_default.rowLine, "data-env": row.name, children: [
|
|
835
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: `${EnvPanel_default.field} ${EnvPanel_default.fieldName}`, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
803
836
|
import_dsh_client_ui_primitives2.Input,
|
|
804
837
|
{
|
|
805
838
|
className: EnvPanel_default.input,
|
|
@@ -810,7 +843,7 @@ function EnvPanel(props) {
|
|
|
810
843
|
onChange: (event) => update(index, { name: event.target.value })
|
|
811
844
|
}
|
|
812
845
|
) }),
|
|
813
|
-
/* @__PURE__ */ (0,
|
|
846
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: `${EnvPanel_default.field} ${EnvPanel_default.fieldValue}`, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
814
847
|
import_dsh_client_ui_primitives2.Input,
|
|
815
848
|
{
|
|
816
849
|
className: EnvPanel_default.input,
|
|
@@ -822,7 +855,7 @@ function EnvPanel(props) {
|
|
|
822
855
|
onChange: (event) => update(index, { value: event.target.value })
|
|
823
856
|
}
|
|
824
857
|
) }),
|
|
825
|
-
/* @__PURE__ */ (0,
|
|
858
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
826
859
|
import_dsh_client_ui_primitives2.Checkbox,
|
|
827
860
|
{
|
|
828
861
|
checked: row.secret,
|
|
@@ -832,7 +865,7 @@ function EnvPanel(props) {
|
|
|
832
865
|
onChange: (next) => update(index, { secret: next })
|
|
833
866
|
}
|
|
834
867
|
),
|
|
835
|
-
/* @__PURE__ */ (0,
|
|
868
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
836
869
|
import_dsh_client_ui_primitives2.Button,
|
|
837
870
|
{
|
|
838
871
|
variant: "ghost",
|
|
@@ -848,7 +881,7 @@ function EnvPanel(props) {
|
|
|
848
881
|
}
|
|
849
882
|
)
|
|
850
883
|
] }, `env-${index}`)) }),
|
|
851
|
-
batchOpen ? /* @__PURE__ */ (0,
|
|
884
|
+
batchOpen ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
852
885
|
import_dsh_client_ui_primitives2.Modal,
|
|
853
886
|
{
|
|
854
887
|
open: true,
|
|
@@ -859,10 +892,10 @@ function EnvPanel(props) {
|
|
|
859
892
|
setBatchText("");
|
|
860
893
|
},
|
|
861
894
|
className: EnvPanel_default.dialog,
|
|
862
|
-
children: /* @__PURE__ */ (0,
|
|
863
|
-
/* @__PURE__ */ (0,
|
|
864
|
-
/* @__PURE__ */ (0,
|
|
865
|
-
/* @__PURE__ */ (0,
|
|
895
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: EnvPanel_default.modal, "data-plugin": "dsh-mcp-ops", "data-role": "env-batch-modal", children: [
|
|
896
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { className: EnvPanel_default.modalTitle, children: t("envBatchTitle") }),
|
|
897
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: EnvPanel_default.batchHint, children: t("envBatchHint") }),
|
|
898
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
866
899
|
"textarea",
|
|
867
900
|
{
|
|
868
901
|
className: EnvPanel_default.textarea,
|
|
@@ -874,8 +907,8 @@ function EnvPanel(props) {
|
|
|
874
907
|
onChange: (event) => setBatchText(event.target.value)
|
|
875
908
|
}
|
|
876
909
|
),
|
|
877
|
-
/* @__PURE__ */ (0,
|
|
878
|
-
/* @__PURE__ */ (0,
|
|
910
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: EnvPanel_default.batchActions, children: [
|
|
911
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
879
912
|
import_dsh_client_ui_primitives2.Checkbox,
|
|
880
913
|
{
|
|
881
914
|
checked: batchSecret,
|
|
@@ -885,9 +918,9 @@ function EnvPanel(props) {
|
|
|
885
918
|
onChange: setBatchSecret
|
|
886
919
|
}
|
|
887
920
|
),
|
|
888
|
-
/* @__PURE__ */ (0,
|
|
889
|
-
/* @__PURE__ */ (0,
|
|
890
|
-
/* @__PURE__ */ (0,
|
|
921
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: EnvPanel_default.batchButtons, children: [
|
|
922
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "primary", disabled: busy, "data-role": "env-batch-import", onClick: importBatch, children: t("envBatchImport") }),
|
|
923
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", disabled: busy, "data-role": "env-batch-cancel", onClick: () => {
|
|
891
924
|
setBatchOpen(false);
|
|
892
925
|
setBatchText("");
|
|
893
926
|
}, children: t("envBatchCancel") })
|
|
@@ -896,8 +929,8 @@ function EnvPanel(props) {
|
|
|
896
929
|
] })
|
|
897
930
|
}
|
|
898
931
|
) : null,
|
|
899
|
-
/* @__PURE__ */ (0,
|
|
900
|
-
/* @__PURE__ */ (0,
|
|
932
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: EnvPanel_default.actions, children: [
|
|
933
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
901
934
|
import_dsh_client_ui_primitives2.Button,
|
|
902
935
|
{
|
|
903
936
|
variant: "outline",
|
|
@@ -910,9 +943,9 @@ function EnvPanel(props) {
|
|
|
910
943
|
children: t("envAdd")
|
|
911
944
|
}
|
|
912
945
|
),
|
|
913
|
-
/* @__PURE__ */ (0,
|
|
914
|
-
/* @__PURE__ */ (0,
|
|
915
|
-
saved ? /* @__PURE__ */ (0,
|
|
946
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", disabled: busy, "data-role": "env-batch", onClick: () => setBatchOpen(true), children: t("envBatch") }),
|
|
947
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "primary", disabled: busy, "data-role": "env-save", onClick: () => void save(), children: busy ? t("refreshing") : t("formSave") }),
|
|
948
|
+
saved ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: EnvPanel_default.saved, children: t("saved") }) : null
|
|
916
949
|
] })
|
|
917
950
|
] });
|
|
918
951
|
}
|
|
@@ -933,13 +966,13 @@ function EnvPanel(props) {
|
|
|
933
966
|
var InjectionMode_default = { "panel": "dsh-mcp-ops-InjectionMode-panel", "option": "dsh-mcp-ops-InjectionMode-option", "hint": "dsh-mcp-ops-InjectionMode-hint" };
|
|
934
967
|
|
|
935
968
|
// src/client/sections/InjectionMode.tsx
|
|
936
|
-
var
|
|
969
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
937
970
|
var MODE_INPUT_NAME = "mcp-ops-injection-mode";
|
|
938
971
|
function InjectionMode(props) {
|
|
939
972
|
const { t, mode, busy } = props;
|
|
940
|
-
return /* @__PURE__ */ (0,
|
|
941
|
-
["search", "full"].map((value) => /* @__PURE__ */ (0,
|
|
942
|
-
/* @__PURE__ */ (0,
|
|
973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: InjectionMode_default.panel, "data-plugin": "dsh-mcp-ops", "data-section": "injection-mode", "data-mode": mode, children: [
|
|
974
|
+
["search", "full"].map((value) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: InjectionMode_default.option, "data-mode": value, children: [
|
|
975
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
943
976
|
"input",
|
|
944
977
|
{
|
|
945
978
|
type: "radio",
|
|
@@ -951,9 +984,9 @@ function InjectionMode(props) {
|
|
|
951
984
|
}
|
|
952
985
|
}
|
|
953
986
|
),
|
|
954
|
-
/* @__PURE__ */ (0,
|
|
987
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: value === "search" ? t("modeSearch") : t("modeFull") })
|
|
955
988
|
] }, value)),
|
|
956
|
-
/* @__PURE__ */ (0,
|
|
989
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: InjectionMode_default.hint, children: mode === "search" ? t("modeHintSearch") : t("modeHintFull") })
|
|
957
990
|
] });
|
|
958
991
|
}
|
|
959
992
|
|
|
@@ -1107,7 +1140,7 @@ function formValueOf(server) {
|
|
|
1107
1140
|
|
|
1108
1141
|
// src/client/sections/ServerForm.tsx
|
|
1109
1142
|
var import_dsh_client_ui_primitives3 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1110
|
-
var
|
|
1143
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1111
1144
|
function ServerForm(props) {
|
|
1112
1145
|
const { t, busy } = props;
|
|
1113
1146
|
const [value, setValue] = (0, import_react2.useState)(props.initial ?? emptyFormValue());
|
|
@@ -1151,7 +1184,7 @@ function ServerForm(props) {
|
|
|
1151
1184
|
rows[index] = { ...previous, ...part, ...cleared ? { value: "" } : {} };
|
|
1152
1185
|
patch({ env: rows });
|
|
1153
1186
|
};
|
|
1154
|
-
return /* @__PURE__ */ (0,
|
|
1187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1155
1188
|
"form",
|
|
1156
1189
|
{
|
|
1157
1190
|
ref: formRef,
|
|
@@ -1161,17 +1194,17 @@ function ServerForm(props) {
|
|
|
1161
1194
|
"data-mode": editing ? "edit" : "create",
|
|
1162
1195
|
onSubmit: submit,
|
|
1163
1196
|
children: [
|
|
1164
|
-
/* @__PURE__ */ (0,
|
|
1165
|
-
/* @__PURE__ */ (0,
|
|
1166
|
-
/* @__PURE__ */ (0,
|
|
1167
|
-
/* @__PURE__ */ (0,
|
|
1168
|
-
editing && props.onDelete !== void 0 ? /* @__PURE__ */ (0,
|
|
1197
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("header", { className: ServerForm_default.head, children: [
|
|
1198
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: ServerForm_default.title, children: editing ? t("formEdit") : t("formNew") }),
|
|
1199
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: ServerForm_default.headActions, children: [
|
|
1200
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "outline", size: "sm", disabled: busy, "data-role": "back", onClick: props.onCancel, children: t("backToList") }),
|
|
1201
|
+
editing && props.onDelete !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "outline", size: "sm", className: ServerForm_default.danger, disabled: busy, "data-role": "delete", onClick: props.onDelete, children: t("delete") }) : null
|
|
1169
1202
|
] })
|
|
1170
1203
|
] }),
|
|
1171
|
-
/* @__PURE__ */ (0,
|
|
1172
|
-
/* @__PURE__ */ (0,
|
|
1173
|
-
/* @__PURE__ */ (0,
|
|
1174
|
-
/* @__PURE__ */ (0,
|
|
1204
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: ServerForm_default.gridName, children: [
|
|
1205
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: ServerForm_default.field, children: [
|
|
1206
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: ServerForm_default.label, children: t("formName") }),
|
|
1207
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1175
1208
|
import_dsh_client_ui_primitives3.Input,
|
|
1176
1209
|
{
|
|
1177
1210
|
className: ServerForm_default.fieldInput,
|
|
@@ -1183,7 +1216,7 @@ function ServerForm(props) {
|
|
|
1183
1216
|
}
|
|
1184
1217
|
)
|
|
1185
1218
|
] }),
|
|
1186
|
-
/* @__PURE__ */ (0,
|
|
1219
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: ServerForm_default.checkWrap, "data-role": "form-enabled", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1187
1220
|
import_dsh_client_ui_primitives3.Checkbox,
|
|
1188
1221
|
{
|
|
1189
1222
|
checked: value.enabled,
|
|
@@ -1194,11 +1227,11 @@ function ServerForm(props) {
|
|
|
1194
1227
|
}
|
|
1195
1228
|
) })
|
|
1196
1229
|
] }),
|
|
1197
|
-
/* @__PURE__ */ (0,
|
|
1198
|
-
/* @__PURE__ */ (0,
|
|
1199
|
-
/* @__PURE__ */ (0,
|
|
1200
|
-
/* @__PURE__ */ (0,
|
|
1201
|
-
/* @__PURE__ */ (0,
|
|
1230
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("small", { className: ServerForm_default.hint, children: t("formNameHint") }),
|
|
1231
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: ServerForm_default.gridTransport, children: [
|
|
1232
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: ServerForm_default.field, children: [
|
|
1233
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: ServerForm_default.label, children: t("formTransport") }),
|
|
1234
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: ServerForm_default.transportWrap, "data-role": "form-transport", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1202
1235
|
import_dsh_client_ui_primitives3.Menu,
|
|
1203
1236
|
{
|
|
1204
1237
|
className: ServerForm_default.transportMenu,
|
|
@@ -1214,7 +1247,7 @@ function ServerForm(props) {
|
|
|
1214
1247
|
setTransportOpen(false);
|
|
1215
1248
|
},
|
|
1216
1249
|
onClose: () => setTransportOpen(false),
|
|
1217
|
-
anchor: /* @__PURE__ */ (0,
|
|
1250
|
+
anchor: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1218
1251
|
import_dsh_client_ui_primitives3.Button,
|
|
1219
1252
|
{
|
|
1220
1253
|
variant: "outline",
|
|
@@ -1225,22 +1258,22 @@ function ServerForm(props) {
|
|
|
1225
1258
|
"aria-expanded": transportOpen,
|
|
1226
1259
|
onClick: () => setTransportOpen((open) => !open),
|
|
1227
1260
|
children: [
|
|
1228
|
-
/* @__PURE__ */ (0,
|
|
1229
|
-
/* @__PURE__ */ (0,
|
|
1261
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: ServerForm_default.transportLabel, title: value.transport === "stdio" ? t("transportStdio") : t("transportHttp"), children: value.transport === "stdio" ? t("transportStdio") : t("transportHttp") }),
|
|
1262
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: ServerForm_default.transportChevron, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.IconChevronDownOutlineRegular, {}) })
|
|
1230
1263
|
]
|
|
1231
1264
|
}
|
|
1232
1265
|
)
|
|
1233
1266
|
}
|
|
1234
1267
|
) })
|
|
1235
1268
|
] }),
|
|
1236
|
-
/* @__PURE__ */ (0,
|
|
1237
|
-
/* @__PURE__ */ (0,
|
|
1238
|
-
value.transport === "stdio" ? /* @__PURE__ */ (0,
|
|
1269
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: ServerForm_default.field, children: [
|
|
1270
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: ServerForm_default.label, children: value.transport === "stdio" ? t("formCommand") : t("formUrl") }),
|
|
1271
|
+
value.transport === "stdio" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.Input, { className: ServerForm_default.fieldInput, value: value.command, disabled: busy, placeholder: t("phCommand"), "data-role": "form-command", onChange: (event) => patch({ command: event.target.value }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.Input, { className: ServerForm_default.fieldInput, value: value.url, disabled: busy, placeholder: t("phUrl"), "data-role": "form-url", onChange: (event) => patch({ url: event.target.value }) }) })
|
|
1239
1272
|
] })
|
|
1240
1273
|
] }),
|
|
1241
|
-
value.transport === "stdio" ? /* @__PURE__ */ (0,
|
|
1242
|
-
/* @__PURE__ */ (0,
|
|
1243
|
-
/* @__PURE__ */ (0,
|
|
1274
|
+
value.transport === "stdio" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: ServerForm_default.field, children: [
|
|
1275
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: ServerForm_default.label, children: t("formArgs") }),
|
|
1276
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1244
1277
|
"textarea",
|
|
1245
1278
|
{
|
|
1246
1279
|
rows: 3,
|
|
@@ -1251,10 +1284,10 @@ function ServerForm(props) {
|
|
|
1251
1284
|
onChange: (event) => patch({ argsText: event.target.value })
|
|
1252
1285
|
}
|
|
1253
1286
|
),
|
|
1254
|
-
/* @__PURE__ */ (0,
|
|
1255
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
1256
|
-
/* @__PURE__ */ (0,
|
|
1257
|
-
/* @__PURE__ */ (0,
|
|
1287
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("small", { className: ServerForm_default.preview, "data-role": "args-preview", children: args.length === 0 ? t("argsPreviewEmpty") : t("argsPreview", { preview: `${args.length} \xB7 ${args.join(" | ")}` }) })
|
|
1288
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: ServerForm_default.field, children: [
|
|
1289
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: ServerForm_default.label, children: t("formHeaders") }),
|
|
1290
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1258
1291
|
RowEditor,
|
|
1259
1292
|
{
|
|
1260
1293
|
t,
|
|
@@ -1264,11 +1297,11 @@ function ServerForm(props) {
|
|
|
1264
1297
|
}
|
|
1265
1298
|
)
|
|
1266
1299
|
] }),
|
|
1267
|
-
/* @__PURE__ */ (0,
|
|
1268
|
-
/* @__PURE__ */ (0,
|
|
1269
|
-
/* @__PURE__ */ (0,
|
|
1270
|
-
value.env.map((row, index) => /* @__PURE__ */ (0,
|
|
1271
|
-
/* @__PURE__ */ (0,
|
|
1300
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: ServerForm_default.field, "data-role": "form-env", children: [
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: ServerForm_default.label, children: t("formEnv") }),
|
|
1302
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: ServerForm_default.rows, children: [
|
|
1303
|
+
value.env.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: ServerForm_default.rowLine, "data-env-row": row.name, children: [
|
|
1304
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1272
1305
|
import_dsh_client_ui_primitives3.Input,
|
|
1273
1306
|
{
|
|
1274
1307
|
className: ServerForm_default.keyInput,
|
|
@@ -1279,7 +1312,7 @@ function ServerForm(props) {
|
|
|
1279
1312
|
onChange: (event) => updateEnv(index, { name: event.target.value })
|
|
1280
1313
|
}
|
|
1281
1314
|
),
|
|
1282
|
-
/* @__PURE__ */ (0,
|
|
1315
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1283
1316
|
import_dsh_client_ui_primitives3.Input,
|
|
1284
1317
|
{
|
|
1285
1318
|
className: ServerForm_default.valueInput,
|
|
@@ -1291,7 +1324,7 @@ function ServerForm(props) {
|
|
|
1291
1324
|
onChange: (event) => updateEnv(index, { value: event.target.value })
|
|
1292
1325
|
}
|
|
1293
1326
|
),
|
|
1294
|
-
/* @__PURE__ */ (0,
|
|
1327
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: ServerForm_default.checkWrap, title: t("formEnvSecret"), "data-role": "env-secret", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1295
1328
|
import_dsh_client_ui_primitives3.Checkbox,
|
|
1296
1329
|
{
|
|
1297
1330
|
checked: row.secret,
|
|
@@ -1302,7 +1335,7 @@ function ServerForm(props) {
|
|
|
1302
1335
|
onChange: (next) => updateEnv(index, { secret: next })
|
|
1303
1336
|
}
|
|
1304
1337
|
) }),
|
|
1305
|
-
/* @__PURE__ */ (0,
|
|
1338
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1306
1339
|
import_dsh_client_ui_primitives3.Button,
|
|
1307
1340
|
{
|
|
1308
1341
|
variant: "ghost",
|
|
@@ -1315,7 +1348,7 @@ function ServerForm(props) {
|
|
|
1315
1348
|
}
|
|
1316
1349
|
)
|
|
1317
1350
|
] }, `env-${index}`)),
|
|
1318
|
-
/* @__PURE__ */ (0,
|
|
1351
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1319
1352
|
import_dsh_client_ui_primitives3.Button,
|
|
1320
1353
|
{
|
|
1321
1354
|
variant: "outline",
|
|
@@ -1327,11 +1360,11 @@ function ServerForm(props) {
|
|
|
1327
1360
|
}
|
|
1328
1361
|
)
|
|
1329
1362
|
] }),
|
|
1330
|
-
/* @__PURE__ */ (0,
|
|
1363
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("small", { className: ServerForm_default.hint, children: t("formEnvHint") })
|
|
1331
1364
|
] }),
|
|
1332
|
-
value.transport === "stdio" ? /* @__PURE__ */ (0,
|
|
1333
|
-
/* @__PURE__ */ (0,
|
|
1334
|
-
/* @__PURE__ */ (0,
|
|
1365
|
+
value.transport === "stdio" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: ServerForm_default.field, children: [
|
|
1366
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: ServerForm_default.label, children: t("formCwd") }),
|
|
1367
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1335
1368
|
import_dsh_client_ui_primitives3.Input,
|
|
1336
1369
|
{
|
|
1337
1370
|
className: ServerForm_default.fieldInput,
|
|
@@ -1342,15 +1375,15 @@ function ServerForm(props) {
|
|
|
1342
1375
|
onChange: (event) => patch({ cwd: event.target.value })
|
|
1343
1376
|
}
|
|
1344
1377
|
),
|
|
1345
|
-
/* @__PURE__ */ (0,
|
|
1378
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("small", { className: ServerForm_default.hint, children: t("formCwdHint") })
|
|
1346
1379
|
] }) : null,
|
|
1347
|
-
/* @__PURE__ */ (0,
|
|
1348
|
-
/* @__PURE__ */ (0,
|
|
1349
|
-
/* @__PURE__ */ (0,
|
|
1350
|
-
/* @__PURE__ */ (0,
|
|
1380
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: ServerForm_default.field, children: [
|
|
1381
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: ServerForm_default.label, children: t("formTimeout") }),
|
|
1382
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.Input, { className: ServerForm_default.fieldInput, value: value.timeoutMs, disabled: busy, placeholder: t("phTimeout"), "data-role": "form-timeout", onChange: (event) => patch({ timeoutMs: event.target.value }) }),
|
|
1383
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("small", { className: ServerForm_default.hint, children: t("formTimeoutHint") })
|
|
1351
1384
|
] }),
|
|
1352
|
-
value.transport === "streamable-http" ? /* @__PURE__ */ (0,
|
|
1353
|
-
/* @__PURE__ */ (0,
|
|
1385
|
+
value.transport === "streamable-http" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: ServerForm_default.field, children: [
|
|
1386
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: ServerForm_default.checkWrap, "data-role": "form-oauth", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1354
1387
|
import_dsh_client_ui_primitives3.Checkbox,
|
|
1355
1388
|
{
|
|
1356
1389
|
checked: value.oauth,
|
|
@@ -1360,17 +1393,17 @@ function ServerForm(props) {
|
|
|
1360
1393
|
onChange: (next) => patch({ oauth: next })
|
|
1361
1394
|
}
|
|
1362
1395
|
) }),
|
|
1363
|
-
/* @__PURE__ */ (0,
|
|
1364
|
-
value.oauth && props.onOAuth !== void 0 ? /* @__PURE__ */ (0,
|
|
1365
|
-
props.oauthUrl === void 0 || props.oauthUrl === null ? null : /* @__PURE__ */ (0,
|
|
1396
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("small", { className: ServerForm_default.hint, children: t("formOAuthHint") }),
|
|
1397
|
+
value.oauth && props.onOAuth !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "outline", className: ServerForm_default.secondary, disabled: busy, "data-role": "form-authorize", onClick: () => props.onOAuth?.(value), children: t("formAuthorize") }) }) : null,
|
|
1398
|
+
props.oauthUrl === void 0 || props.oauthUrl === null ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("small", { className: ServerForm_default.hint, children: [
|
|
1366
1399
|
t("formAuthorizeHint"),
|
|
1367
1400
|
" ",
|
|
1368
|
-
/* @__PURE__ */ (0,
|
|
1401
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: props.oauthUrl, target: "_blank", rel: "noreferrer", children: props.oauthUrl })
|
|
1369
1402
|
] })
|
|
1370
1403
|
] }) : null,
|
|
1371
|
-
props.testResult === void 0 || props.testResult === null ? null : /* @__PURE__ */ (0,
|
|
1372
|
-
/* @__PURE__ */ (0,
|
|
1373
|
-
/* @__PURE__ */ (0,
|
|
1404
|
+
props.testResult === void 0 || props.testResult === null ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: ServerForm_default.testResult, "data-ok": String(props.testResult.ok), "data-role": "test-result", children: props.testResult.ok ? t("formTestOk", { count: String(props.testResult.tools.length) }) : t("formTestFail", { message: props.testResult.message ?? "" }) }),
|
|
1405
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: ServerForm_default.actions, "data-role": "form-actions", children: [
|
|
1406
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1374
1407
|
"span",
|
|
1375
1408
|
{
|
|
1376
1409
|
className: ServerForm_default.problem,
|
|
@@ -1382,10 +1415,10 @@ function ServerForm(props) {
|
|
|
1382
1415
|
children: problemText
|
|
1383
1416
|
}
|
|
1384
1417
|
),
|
|
1385
|
-
/* @__PURE__ */ (0,
|
|
1386
|
-
/* @__PURE__ */ (0,
|
|
1387
|
-
/* @__PURE__ */ (0,
|
|
1388
|
-
/* @__PURE__ */ (0,
|
|
1418
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: ServerForm_default.actionButtons, children: [
|
|
1419
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "outline", disabled: busy, "data-role": "test", onClick: () => props.onTest(value), children: busy ? t("formTesting") : t("formTest") }),
|
|
1420
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.Button, { type: "submit", variant: "primary", disabled: busy, "data-role": "save", children: t("formSave") }),
|
|
1421
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", disabled: busy, "data-role": "cancel", onClick: props.onCancel, children: t("formCancel") })
|
|
1389
1422
|
] })
|
|
1390
1423
|
] })
|
|
1391
1424
|
]
|
|
@@ -1398,9 +1431,9 @@ function RowEditor(props) {
|
|
|
1398
1431
|
rows[index] = { ...rows[index], ...part };
|
|
1399
1432
|
props.onChange(rows);
|
|
1400
1433
|
};
|
|
1401
|
-
return /* @__PURE__ */ (0,
|
|
1402
|
-
rows.map((row, index) => /* @__PURE__ */ (0,
|
|
1403
|
-
/* @__PURE__ */ (0,
|
|
1434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: ServerForm_default.rows, "data-role": "header-rows", children: [
|
|
1435
|
+
rows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: ServerForm_default.rowLine, "data-role": "header-row", children: [
|
|
1436
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1404
1437
|
import_dsh_client_ui_primitives3.Input,
|
|
1405
1438
|
{
|
|
1406
1439
|
className: ServerForm_default.keyInput,
|
|
@@ -1411,7 +1444,7 @@ function RowEditor(props) {
|
|
|
1411
1444
|
onChange: (event) => update(index, { name: event.target.value })
|
|
1412
1445
|
}
|
|
1413
1446
|
),
|
|
1414
|
-
/* @__PURE__ */ (0,
|
|
1447
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1415
1448
|
import_dsh_client_ui_primitives3.Input,
|
|
1416
1449
|
{
|
|
1417
1450
|
className: ServerForm_default.valueInput,
|
|
@@ -1422,9 +1455,9 @@ function RowEditor(props) {
|
|
|
1422
1455
|
onChange: (event) => update(index, { value: event.target.value })
|
|
1423
1456
|
}
|
|
1424
1457
|
),
|
|
1425
|
-
/* @__PURE__ */ (0,
|
|
1458
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", size: "sm", className: ServerForm_default.remove, disabled: props.busy, "data-role": "header-remove", onClick: () => props.onChange(rows.filter((_, i) => i !== index)), children: "\xD7" })
|
|
1426
1459
|
] }, `header-${index}`)),
|
|
1427
|
-
/* @__PURE__ */ (0,
|
|
1460
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1428
1461
|
import_dsh_client_ui_primitives3.Button,
|
|
1429
1462
|
{
|
|
1430
1463
|
variant: "outline",
|
|
@@ -1487,12 +1520,12 @@ var ServerCard_default = { "card": "dsh-mcp-ops-ServerCard-card", "row": "dsh-mc
|
|
|
1487
1520
|
var ToolSelector_default = { "list": "dsh-mcp-ops-ToolSelector-list", "item": "dsh-mcp-ops-ToolSelector-item", "label": "dsh-mcp-ops-ToolSelector-label", "text": "dsh-mcp-ops-ToolSelector-text", "name": "dsh-mcp-ops-ToolSelector-name", "description": "dsh-mcp-ops-ToolSelector-description", "note": "dsh-mcp-ops-ToolSelector-note" };
|
|
1488
1521
|
|
|
1489
1522
|
// src/client/sections/ToolSelector.tsx
|
|
1490
|
-
var
|
|
1523
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1491
1524
|
function ToolSelector(props) {
|
|
1492
1525
|
const { t, tools, busy, pending } = props;
|
|
1493
|
-
if (tools.length === 0) return /* @__PURE__ */ (0,
|
|
1494
|
-
return /* @__PURE__ */ (0,
|
|
1495
|
-
/* @__PURE__ */ (0,
|
|
1526
|
+
if (tools.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: ToolSelector_default.note, children: t("toolsNone") });
|
|
1527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: ToolSelector_default.list, "data-role": "tool-selector", children: tools.map((tool) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("li", { className: ToolSelector_default.item, "data-tool": tool.name, "data-enabled": String(tool.enabled), "data-hot": String(tool.hot), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: ToolSelector_default.label, children: [
|
|
1528
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1496
1529
|
"input",
|
|
1497
1530
|
{
|
|
1498
1531
|
type: "checkbox",
|
|
@@ -1502,16 +1535,16 @@ function ToolSelector(props) {
|
|
|
1502
1535
|
onChange: () => props.onToggle(tool.name, !tool.enabled)
|
|
1503
1536
|
}
|
|
1504
1537
|
),
|
|
1505
|
-
/* @__PURE__ */ (0,
|
|
1506
|
-
/* @__PURE__ */ (0,
|
|
1507
|
-
tool.description.trim() === "" ? null : /* @__PURE__ */ (0,
|
|
1538
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: ToolSelector_default.text, children: [
|
|
1539
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("b", { className: ToolSelector_default.name, "data-role": "tool-name", "data-tool-name": tool.name, title: tool.name, children: tool.tool }),
|
|
1540
|
+
tool.description.trim() === "" ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: ToolSelector_default.description, "data-role": "tool-description", title: tool.description, children: tool.description })
|
|
1508
1541
|
] })
|
|
1509
1542
|
] }) }, tool.name)) });
|
|
1510
1543
|
}
|
|
1511
1544
|
|
|
1512
1545
|
// src/client/sections/ServerCard.tsx
|
|
1513
1546
|
var import_dsh_client_ui_primitives4 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1514
|
-
var
|
|
1547
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1515
1548
|
function badgeTone(server) {
|
|
1516
1549
|
if (!server.enabled) return "neutral";
|
|
1517
1550
|
switch (server.status.phase) {
|
|
@@ -1555,7 +1588,7 @@ function ServerCard(props) {
|
|
|
1555
1588
|
detail: problems.map((entry) => entry.detail === void 0 ? entry.code : `${entry.code}(${entry.detail})`).join(", ")
|
|
1556
1589
|
})]
|
|
1557
1590
|
].join(" \xB7 ");
|
|
1558
|
-
return /* @__PURE__ */ (0,
|
|
1591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1559
1592
|
"section",
|
|
1560
1593
|
{
|
|
1561
1594
|
className: ServerCard_default.card,
|
|
@@ -1566,34 +1599,34 @@ function ServerCard(props) {
|
|
|
1566
1599
|
"data-phase": server.status.phase,
|
|
1567
1600
|
"data-enabled": String(server.enabled),
|
|
1568
1601
|
children: [
|
|
1569
|
-
/* @__PURE__ */ (0,
|
|
1570
|
-
/* @__PURE__ */ (0,
|
|
1571
|
-
/* @__PURE__ */ (0,
|
|
1572
|
-
/* @__PURE__ */ (0,
|
|
1573
|
-
server.capabilities.adopted ? /* @__PURE__ */ (0,
|
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: ServerCard_default.row, children: [
|
|
1603
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: ServerCard_default.identity, children: [
|
|
1604
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: ServerCard_default.name, children: server.serverName }),
|
|
1605
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.Tag, { tone: badgeTone(server), className: ServerCard_default.badge, children: t(badge) }),
|
|
1606
|
+
server.capabilities.adopted ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.Tag, { tone: "info", className: ServerCard_default.badge, children: t("adoptedBadge") }) : null,
|
|
1574
1607
|
server.occupiedByComposition && !composition ? (
|
|
1575
1608
|
// `Tag` 只接受 tone/className/children,`title` 得由外层承载(否则属性不会落到 DOM 上)。
|
|
1576
|
-
/* @__PURE__ */ (0,
|
|
1609
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { title: t("occupied"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.Tag, { tone: "warning", className: ServerCard_default.badge, children: t("occupied") }) })
|
|
1577
1610
|
) : null,
|
|
1578
|
-
marker === void 0 ? null : /* @__PURE__ */ (0,
|
|
1611
|
+
marker === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: ServerCard_default.errorMark, "data-role": "card-diagnostics", title: marker, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.StateDot, { state: "warning", size: 10 }) })
|
|
1579
1612
|
] }),
|
|
1580
|
-
/* @__PURE__ */ (0,
|
|
1581
|
-
server.capabilities.adoptable ? /* @__PURE__ */ (0,
|
|
1582
|
-
server.capabilities.adopted ? /* @__PURE__ */ (0,
|
|
1583
|
-
!composition ? /* @__PURE__ */ (0,
|
|
1584
|
-
/* @__PURE__ */ (0,
|
|
1585
|
-
server.status.tools.length > 0 ? /* @__PURE__ */ (0,
|
|
1586
|
-
server.writable ? /* @__PURE__ */ (0,
|
|
1613
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: ServerCard_default.actions, children: [
|
|
1614
|
+
server.capabilities.adoptable ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "outline", size: "sm", disabled: busy, "data-action": "adopt", onClick: () => props.actions.onAdopt(server), children: t("adopt") }) : null,
|
|
1615
|
+
server.capabilities.adopted ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "outline", size: "sm", disabled: busy, "data-action": "release", onClick: () => props.actions.onRelease(server), children: t("release") }) : null,
|
|
1616
|
+
!composition ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "outline", size: "sm", disabled: busy, "data-action": "toggle", onClick: () => props.actions.onToggleEnabled(server), children: server.enabled ? t("disable") : t("enable") }) : null,
|
|
1617
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "outline", size: "sm", disabled: busy, title: t("refreshHint"), "data-action": "refresh", onClick: () => props.actions.onRefresh(server), children: busy ? t("refreshing") : t("refresh") }),
|
|
1618
|
+
server.status.tools.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "outline", size: "sm", disabled: busy, "data-action": "expand", onClick: () => props.actions.onToggleExpand(server.serverName), children: props.expanded ? t("collapseTools") : t("expandTools") }) : null,
|
|
1619
|
+
server.writable ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "outline", size: "sm", disabled: busy, "data-action": "edit", onClick: () => props.actions.onEdit(server), children: t("edit") }) : null
|
|
1587
1620
|
] })
|
|
1588
1621
|
] }),
|
|
1589
|
-
/* @__PURE__ */ (0,
|
|
1590
|
-
/* @__PURE__ */ (0,
|
|
1591
|
-
/* @__PURE__ */ (0,
|
|
1592
|
-
/* @__PURE__ */ (0,
|
|
1593
|
-
/* @__PURE__ */ (0,
|
|
1594
|
-
/* @__PURE__ */ (0,
|
|
1622
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: ServerCard_default.meta, children: [
|
|
1623
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: server.transport }),
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "aria-hidden": "true", children: "\xB7" }),
|
|
1625
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "data-role": "card-tools", children: t("cardTools", { count: String(server.status.tools.length) }) }),
|
|
1626
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "aria-hidden": "true", children: "\xB7" }),
|
|
1627
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "data-role": "card-env", children: t("cardEnv", { count: String(server.env.length) }) })
|
|
1595
1628
|
] }),
|
|
1596
|
-
props.expanded ? /* @__PURE__ */ (0,
|
|
1629
|
+
props.expanded ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1597
1630
|
ToolSelector,
|
|
1598
1631
|
{
|
|
1599
1632
|
t,
|
|
@@ -1609,7 +1642,7 @@ function ServerCard(props) {
|
|
|
1609
1642
|
}
|
|
1610
1643
|
|
|
1611
1644
|
// src/client/sections/ServerList.tsx
|
|
1612
|
-
var
|
|
1645
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1613
1646
|
function ServerList(props) {
|
|
1614
1647
|
const { t, servers, busy } = props;
|
|
1615
1648
|
const file = props.sources.find((source) => source.kind === "dsh-home");
|
|
@@ -1617,14 +1650,14 @@ function ServerList(props) {
|
|
|
1617
1650
|
path: file.path,
|
|
1618
1651
|
reason: t(file.parseError !== void 0 ? "readonlyParseError" : "readonlyNotWritable")
|
|
1619
1652
|
});
|
|
1620
|
-
return /* @__PURE__ */ (0,
|
|
1621
|
-
/* @__PURE__ */ (0,
|
|
1622
|
-
/* @__PURE__ */ (0,
|
|
1623
|
-
/* @__PURE__ */ (0,
|
|
1653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1654
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("header", { className: ServerList_default.head, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: ServerList_default.headActions, children: [
|
|
1655
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_dsh_client_ui_primitives5.Button, { variant: "ghost", disabled: busy, title: t("refreshListHint"), "data-role": "refresh-list", onClick: props.onRefreshList, children: busy ? t("refreshing") : t("refreshList") }),
|
|
1656
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_dsh_client_ui_primitives5.Button, { variant: "primary", disabled: busy, "data-role": "new", onClick: props.onAdd, children: t("addServer") })
|
|
1624
1657
|
] }) }),
|
|
1625
|
-
fileNotice === null ? null : /* @__PURE__ */ (0,
|
|
1658
|
+
fileNotice === null ? null : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: ServerList_default.fileNotice, "data-role": "file-notice", children: fileNotice }),
|
|
1626
1659
|
props.notice,
|
|
1627
|
-
props.loading ? /* @__PURE__ */ (0,
|
|
1660
|
+
props.loading ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: ServerList_default.note, children: t("loading") }) : servers.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: ServerList_default.note, children: t("empty") }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: ServerList_default.cards, children: servers.map((server) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1628
1661
|
ServerCard,
|
|
1629
1662
|
{
|
|
1630
1663
|
t,
|
|
@@ -1641,7 +1674,7 @@ function ServerList(props) {
|
|
|
1641
1674
|
}
|
|
1642
1675
|
|
|
1643
1676
|
// src/client/McpOpsSection.tsx
|
|
1644
|
-
var
|
|
1677
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1645
1678
|
var TABS = [
|
|
1646
1679
|
{ id: "servers", label: "tabServers" },
|
|
1647
1680
|
{ id: "env", label: "tabEnv" },
|
|
@@ -1850,8 +1883,8 @@ function McpOpsSection(props) {
|
|
|
1850
1883
|
onRelease: (server) => askRelease(server),
|
|
1851
1884
|
onToggleTool: toggleTool
|
|
1852
1885
|
};
|
|
1853
|
-
return /* @__PURE__ */ (0,
|
|
1854
|
-
/* @__PURE__ */ (0,
|
|
1886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("section", { className: McpOpsSection_default.panel, "data-plugin": "dsh-mcp-ops", "data-tab": tab, children: [
|
|
1887
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1855
1888
|
import_dsh_client_ui_primitives6.SegmentedTabs,
|
|
1856
1889
|
{
|
|
1857
1890
|
items: TABS.map(({ id, label }) => ({
|
|
@@ -1866,7 +1899,7 @@ function McpOpsSection(props) {
|
|
|
1866
1899
|
className: McpOpsSection_default.tabs
|
|
1867
1900
|
}
|
|
1868
1901
|
),
|
|
1869
|
-
tab === "servers" ? /* @__PURE__ */ (0,
|
|
1902
|
+
tab === "servers" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: McpOpsSection_default.tabPanel, role: "tabpanel", id: panelId("servers"), "data-panel": "servers", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1870
1903
|
ServerList,
|
|
1871
1904
|
{
|
|
1872
1905
|
t,
|
|
@@ -1886,16 +1919,16 @@ function McpOpsSection(props) {
|
|
|
1886
1919
|
setFormError(null);
|
|
1887
1920
|
},
|
|
1888
1921
|
onRefreshList: () => void load(true),
|
|
1889
|
-
notice: /* @__PURE__ */ (0,
|
|
1890
|
-
error !== null ? /* @__PURE__ */ (0,
|
|
1922
|
+
notice: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1923
|
+
error !== null ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: McpOpsSection_default.error, role: "alert", children: [
|
|
1891
1924
|
t("errorTitle"),
|
|
1892
1925
|
"\uFF1A",
|
|
1893
1926
|
error
|
|
1894
1927
|
] }) : null,
|
|
1895
|
-
note === null ? null : /* @__PURE__ */ (0,
|
|
1928
|
+
note === null ? null : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: McpOpsSection_default.saved, children: note })
|
|
1896
1929
|
] })
|
|
1897
1930
|
}
|
|
1898
|
-
) }) : tab === "env" ? /* @__PURE__ */ (0,
|
|
1931
|
+
) }) : tab === "env" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: McpOpsSection_default.tabPanel, role: "tabpanel", id: panelId("env"), "data-panel": "env", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1899
1932
|
EnvPanel,
|
|
1900
1933
|
{
|
|
1901
1934
|
t,
|
|
@@ -1906,8 +1939,8 @@ function McpOpsSection(props) {
|
|
|
1906
1939
|
await run(async () => await propsRef.current.envInject(enabled), t("saved"));
|
|
1907
1940
|
}
|
|
1908
1941
|
}
|
|
1909
|
-
) }) : /* @__PURE__ */ (0,
|
|
1910
|
-
editing === null ? null : /* @__PURE__ */ (0,
|
|
1942
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: McpOpsSection_default.tabPanel, role: "tabpanel", id: panelId("mode"), "data-panel": "mode", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(InjectionMode, { t, mode: tools?.mode ?? "search", busy, onChange: changeMode }) }),
|
|
1943
|
+
editing === null ? null : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1911
1944
|
import_dsh_client_ui_primitives6.Modal,
|
|
1912
1945
|
{
|
|
1913
1946
|
open: true,
|
|
@@ -1915,7 +1948,7 @@ function McpOpsSection(props) {
|
|
|
1915
1948
|
title: editing.serverName === "" ? t("formNew") : t("formEdit"),
|
|
1916
1949
|
onClose: closeForm,
|
|
1917
1950
|
className: McpOpsSection_default.dialog,
|
|
1918
|
-
children: /* @__PURE__ */ (0,
|
|
1951
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: McpOpsSection_default.modal, "data-plugin": "dsh-mcp-ops", "data-role": "form-modal", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1919
1952
|
ServerForm,
|
|
1920
1953
|
{
|
|
1921
1954
|
t,
|
|
@@ -1934,7 +1967,7 @@ function McpOpsSection(props) {
|
|
|
1934
1967
|
) })
|
|
1935
1968
|
}
|
|
1936
1969
|
),
|
|
1937
|
-
confirm === null ? null : /* @__PURE__ */ (0,
|
|
1970
|
+
confirm === null ? null : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1938
1971
|
ConfirmDialog,
|
|
1939
1972
|
{
|
|
1940
1973
|
t,
|
|
@@ -1990,6 +2023,11 @@ async function activate(ctx) {
|
|
|
1990
2023
|
await ctx.remote.$mount(remote_contribution_default);
|
|
1991
2024
|
ctx.effect(() => ctx.locale.register(NS, { zh, en }), "dsh-mcp-ops: dictionaries");
|
|
1992
2025
|
const t = ctx.locale.bind(NS);
|
|
2026
|
+
ctx.slots.inject("settings.section.icon", () => ctx.slots.register({
|
|
2027
|
+
name: "settings.section.icon",
|
|
2028
|
+
id: "mcp-ops",
|
|
2029
|
+
order: 26
|
|
2030
|
+
}, McpNavIcon));
|
|
1993
2031
|
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
1994
2032
|
name: "settings.section",
|
|
1995
2033
|
id: "mcp-ops",
|