dsh-mcp-panel 0.6.13 → 0.6.15

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/{README.es.md → README-es.md} +13 -7
  3. package/{README.hi.md → README-hi.md} +13 -7
  4. package/{README.pt.md → README-pt.md} +13 -7
  5. package/{README.zh.md → README-zh.md} +13 -7
  6. package/README.md +13 -7
  7. package/cordis.patch.yml +5 -0
  8. package/docs/optimization-plan-v2.zh.md +7 -5
  9. package/docs/upstream-proposal.md +9 -0
  10. package/lib/client.js +192 -65
  11. package/lib/client.js.map +1 -1
  12. package/lib/index.js +103 -18
  13. package/lib/typert.host.js +31 -60
  14. package/lib/types/client/McpPanelTab.d.ts.map +1 -1
  15. package/lib/types/client/locales.d.ts +14 -0
  16. package/lib/types/client/locales.d.ts.map +1 -1
  17. package/lib/types/client/remote.d.ts +56 -179
  18. package/lib/types/client/remote.d.ts.map +1 -1
  19. package/lib/types/command.d.ts.map +1 -1
  20. package/lib/types/config.d.ts +8 -0
  21. package/lib/types/config.d.ts.map +1 -1
  22. package/lib/types/index.d.ts +1 -1
  23. package/lib/types/index.d.ts.map +1 -1
  24. package/lib/types/patch.d.ts +7 -6
  25. package/lib/types/patch.d.ts.map +1 -1
  26. package/lib/types/service.d.ts +20 -0
  27. package/lib/types/service.d.ts.map +1 -1
  28. package/lib/types/trial.d.ts +8 -0
  29. package/lib/types/trial.d.ts.map +1 -1
  30. package/lib/types/typert.host.d.ts +56 -179
  31. package/lib/types/typert.host.d.ts.map +1 -1
  32. package/lib/types/upstream.d.ts +27 -20
  33. package/lib/types/upstream.d.ts.map +1 -1
  34. package/lib/types/wire.d.ts +113 -359
  35. package/lib/types/wire.d.ts.map +1 -1
  36. package/package.json +24 -23
  37. package/src/client/McpPanelTab.tsx +79 -0
  38. package/src/client/locales.ts +20 -4
  39. package/src/client/styles.ts +18 -0
  40. package/src/command.ts +8 -4
  41. package/src/config.ts +20 -0
  42. package/src/index.ts +3 -1
  43. package/src/patch.ts +17 -9
  44. package/src/probe.ts +1 -1
  45. package/src/service.ts +83 -4
  46. package/src/trial.ts +32 -6
  47. package/src/upstream.ts +27 -20
  48. package/src/wire.ts +33 -61
  49. package/src/write.ts +6 -0
package/lib/client.js CHANGED
@@ -732,6 +732,40 @@ window.__ModuleLoader__.load({
732
732
  //#endregion
733
733
  //#region src/client/McpPanelTab.tsx
734
734
  /** The MCP management console tab: server cards, CRUD editor, trial console, capabilities, probes. */
735
+ /** Pretty-print one result JSON; unparseable (truncated) text renders raw. */
736
+ function prettyResultJson(json) {
737
+ try {
738
+ return JSON.stringify(JSON.parse(json), null, 2);
739
+ } catch {
740
+ return json;
741
+ }
742
+ }
743
+ /** Render one resources-browse outcome (loading / error / done). */
744
+ function resourceBrowseBlock(state, t) {
745
+ if (state === void 0) return null;
746
+ if (state.kind === "loading") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
747
+ className: "dmcp-status",
748
+ children: t("trialRunning")
749
+ });
750
+ if (state.kind === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
751
+ className: "dmcp-error-text",
752
+ role: "alert",
753
+ children: state.message
754
+ });
755
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
756
+ className: "dmcp-trial-result",
757
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
758
+ className: "dmcp-trial-meta",
759
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("trialDuration").replace("{ms}", String(state.result.durationMs)) }), state.result.truncated ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
760
+ className: "dmcp-warn-text",
761
+ children: t("trialTruncated")
762
+ }) : null]
763
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
764
+ className: "dmcp-fragment dmcp-trial-json",
765
+ children: prettyResultJson(state.result.resultJson)
766
+ })]
767
+ });
768
+ }
735
769
  /** Localized label for one server badge code. */
736
770
  function badgeLabel(badge, t) {
737
771
  switch (badge) {
@@ -780,6 +814,36 @@ window.__ModuleLoader__.load({
780
814
  const [editor, setEditor] = (0, react.useState)(null);
781
815
  const [removeArm, setRemoveArm] = (0, react.useState)(null);
782
816
  const [removeError, setRemoveError] = (0, react.useState)(null);
817
+ const [resourceUri, setResourceUri] = (0, react.useState)({});
818
+ const [resourceState, setResourceState] = (0, react.useState)({});
819
+ /** Browse one server's resources through the OFFICIAL shared tools. */
820
+ const runResource = (serverName, toolName, argsJson) => {
821
+ setResourceState((current) => ({
822
+ ...current,
823
+ [serverName]: { kind: "loading" }
824
+ }));
825
+ Promise.resolve().then(() => callTool(JSON.stringify({
826
+ serverName,
827
+ toolName,
828
+ argsJson
829
+ }))).then((outcome) => {
830
+ setResourceState((current) => ({
831
+ ...current,
832
+ [serverName]: {
833
+ kind: "done",
834
+ result: outcome
835
+ }
836
+ }));
837
+ }, (failure) => {
838
+ setResourceState((current) => ({
839
+ ...current,
840
+ [serverName]: {
841
+ kind: "error",
842
+ message: failure instanceof Error ? failure.message : String(failure)
843
+ }
844
+ }));
845
+ });
846
+ };
783
847
  const reload = () => {
784
848
  setRequest((value) => value + 1);
785
849
  };
@@ -1122,7 +1186,67 @@ window.__ModuleLoader__.load({
1122
1186
  className: "dmcp-tool-description",
1123
1187
  children: tool.description
1124
1188
  }) : null] }, tool.name))
1125
- })] })
1189
+ })] }),
1190
+ model.capabilities.resources.available && row.view.entryId !== "" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1191
+ className: "dmcp-resources",
1192
+ children: [
1193
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1194
+ className: "dmcp-health-title",
1195
+ children: [
1196
+ t("resources"),
1197
+ " ",
1198
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1199
+ className: "dmcp-tool-description",
1200
+ children: t("resourceHint")
1201
+ })
1202
+ ]
1203
+ }),
1204
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1205
+ className: "dmcp-editor-actions",
1206
+ children: [
1207
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1208
+ type: "button",
1209
+ className: "dmcp-action",
1210
+ onClick: () => {
1211
+ runResource(row.view.serverName, "list_mcp_resources", "{}");
1212
+ },
1213
+ children: t("resourceList")
1214
+ }),
1215
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1216
+ type: "button",
1217
+ className: "dmcp-action",
1218
+ onClick: () => {
1219
+ runResource(row.view.serverName, "list_mcp_resource_templates", "{}");
1220
+ },
1221
+ children: t("resourceTemplates")
1222
+ }),
1223
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1224
+ type: "text",
1225
+ className: "dmcp-resource-uri",
1226
+ value: resourceUri[row.view.serverName] ?? "",
1227
+ placeholder: t("resourceUri"),
1228
+ "aria-label": t("resourceUri"),
1229
+ onChange: (event) => {
1230
+ setResourceUri((current) => ({
1231
+ ...current,
1232
+ [row.view.serverName]: event.currentTarget.value
1233
+ }));
1234
+ }
1235
+ }),
1236
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1237
+ type: "button",
1238
+ className: "dmcp-action",
1239
+ disabled: (resourceUri[row.view.serverName] ?? "").trim() === "",
1240
+ onClick: () => {
1241
+ runResource(row.view.serverName, "read_mcp_resource", JSON.stringify({ uri: (resourceUri[row.view.serverName] ?? "").trim() }));
1242
+ },
1243
+ children: t("resourceRead")
1244
+ })
1245
+ ]
1246
+ }),
1247
+ resourceBrowseBlock(resourceState[row.view.serverName], t)
1248
+ ]
1249
+ }) : null
1126
1250
  ]
1127
1251
  }) : null]
1128
1252
  }, row.view.serverName);
@@ -1338,7 +1462,7 @@ window.__ModuleLoader__.load({
1338
1462
  addServer: "添加服务器",
1339
1463
  editServer: "编辑",
1340
1464
  removeServer: "删除(停用)",
1341
- removeConfirm: "删除 = 追加 `set disabled: true` 操作(patch 词汇表没有 remove)。行保留在文件中,可随时重新启用。",
1465
+ removeConfirm: "删除 = 追加 `- id:` + `disabled: true` 覆盖操作(patch 词汇表没有 remove)。行保留在文件中,可随时重新启用。",
1342
1466
  editorTitleAdd: "添加 MCP 服务器",
1343
1467
  editorTitleEdit: "编辑 {name}",
1344
1468
  fieldServerName: "serverName(命名空间)",
@@ -1391,7 +1515,14 @@ window.__ModuleLoader__.load({
1391
1515
  capabilities: "能力一览",
1392
1516
  capResources: "Resources",
1393
1517
  capPrompts: "Prompts",
1394
- capPending: "待官方支持——官方 client 尚未桥接该能力(Tools 是当前唯一桥接的 MCP 能力)。"
1518
+ capPending: "待官方支持——官方 client 尚未桥接该能力(prompt 模板与资源订阅仍待上游)。",
1519
+ resources: "资源(只读浏览)",
1520
+ resourceHint: "经官方 list_mcp_resources / list_mcp_resource_templates / read_mcp_resource 工具只读浏览;结果只显示在本页,不会进入模型上下文。",
1521
+ resourceList: "列出",
1522
+ resourceTemplates: "模板",
1523
+ resourceRead: "读取",
1524
+ resourceUri: "资源 URI",
1525
+ resourceEmpty: "没有返回资源条目(或该服务器未提供资源)。"
1395
1526
  };
1396
1527
  /** English dictionary checked against the Chinese key set. */
1397
1528
  const en = {
@@ -1465,7 +1596,7 @@ window.__ModuleLoader__.load({
1465
1596
  addServer: "Add server",
1466
1597
  editServer: "Edit",
1467
1598
  removeServer: "Remove (disable)",
1468
- removeConfirm: "Removal = appending a `set disabled: true` operation (the patch vocabulary has no remove). The row stays in the file and can be re-enabled anytime.",
1599
+ removeConfirm: "Removal = appending an `- id:` + `disabled: true` override operation (the patch vocabulary has no remove). The row stays in the file and can be re-enabled anytime.",
1469
1600
  editorTitleAdd: "Add MCP server",
1470
1601
  editorTitleEdit: "Edit {name}",
1471
1602
  fieldServerName: "serverName (namespace)",
@@ -1518,7 +1649,14 @@ window.__ModuleLoader__.load({
1518
1649
  capabilities: "Capabilities",
1519
1650
  capResources: "Resources",
1520
1651
  capPrompts: "Prompts",
1521
- capPending: "Pending upstream support — the official client does not bridge this capability yet (tools are the only bridged MCP capability today)."
1652
+ capPending: "Pending upstream support — the official client does not bridge this capability yet (prompt templates and resource subscriptions remain deferred).",
1653
+ resources: "Resources (read-only browse)",
1654
+ resourceHint: "Read-only browse through the official list_mcp_resources / list_mcp_resource_templates / read_mcp_resource tools; results are shown only here and never enter model context.",
1655
+ resourceList: "List",
1656
+ resourceTemplates: "Templates",
1657
+ resourceRead: "Read",
1658
+ resourceUri: "Resource URI",
1659
+ resourceEmpty: "No resource entries returned (or this server exposes none)."
1522
1660
  };
1523
1661
  //#endregion
1524
1662
  //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/util.js
@@ -6707,6 +6845,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6707
6845
  }))
6708
6846
  });
6709
6847
  /**
6848
+ * Dual-shape strict Typert codec, compatible with BOTH published codec
6849
+ * generations: every published harness line (through `0.1.6-alpha.1`) reads
6850
+ * `codec.schema` (a zod v4 instance), while current master reads
6851
+ * `codec.create()` (a schema factory). Carrying both fields keeps the same
6852
+ * built bundle working on either loader; each loader ignores the field it
6853
+ * does not read.
6854
+ *
6855
+ * @param typeSymbol - generated type identity for diagnostics.
6856
+ * @param schema - the zod v4 schema that validates the boundary value.
6857
+ */
6858
+ function strictCodec(typeSymbol, schema) {
6859
+ return {
6860
+ mode: "strict",
6861
+ typeSymbol,
6862
+ schema,
6863
+ create: () => schema
6864
+ };
6865
+ }
6866
+ /**
6710
6867
  * The `mcpPanel/status` invocation descriptor, shared verbatim by the host
6711
6868
  * `TYPERT` manifest (`src/typert.host.ts`) and the client
6712
6869
  * `TypertRemoteContribution` (`src/client/remote.ts`). Hand-written in the
@@ -6720,11 +6877,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6720
6877
  method: "status",
6721
6878
  invocation: Object.freeze({ kind: "direct" }),
6722
6879
  parameters: Object.freeze([]),
6723
- result: Object.freeze({
6724
- mode: "strict",
6725
- typeSymbol: "dsh-mcp-panel/types#McpPanelSnapshot",
6726
- schema: MCP_PANEL_SNAPSHOT_SCHEMA
6727
- }),
6880
+ result: Object.freeze(strictCodec("dsh-mcp-panel/types#McpPanelSnapshot", MCP_PANEL_SNAPSHOT_SCHEMA)),
6728
6881
  sourceLocation: Object.freeze({
6729
6882
  file: "src/wire.ts",
6730
6883
  line: 1,
@@ -6750,17 +6903,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6750
6903
  name: "serverName",
6751
6904
  wire: "serverName",
6752
6905
  source: "json",
6753
- codec: Object.freeze({
6754
- mode: "strict",
6755
- typeSymbol: "dsh-mcp-panel/types#ProbeRequestServerName",
6756
- schema: string()
6757
- })
6906
+ codec: strictCodec("dsh-mcp-panel/types#ProbeRequestServerName", string())
6758
6907
  })]),
6759
- result: Object.freeze({
6760
- mode: "strict",
6761
- typeSymbol: "dsh-mcp-panel/types#ProbeStarted",
6762
- schema: PROBE_STARTED_SCHEMA
6763
- }),
6908
+ result: strictCodec("dsh-mcp-panel/types#ProbeStarted", PROBE_STARTED_SCHEMA),
6764
6909
  sourceLocation: Object.freeze({
6765
6910
  file: "src/wire.ts",
6766
6911
  line: 1,
@@ -6784,17 +6929,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6784
6929
  name: "opJson",
6785
6930
  wire: "opJson",
6786
6931
  source: "json",
6787
- codec: Object.freeze({
6788
- mode: "strict",
6789
- typeSymbol: "dsh-mcp-panel/types#PatchOpJson",
6790
- schema: string()
6791
- })
6932
+ codec: strictCodec("dsh-mcp-panel/types#PatchOpJson", string())
6792
6933
  })]),
6793
- result: Object.freeze({
6794
- mode: "strict",
6795
- typeSymbol: "dsh-mcp-panel/types#PatchPreview",
6796
- schema: PATCH_PREVIEW_SCHEMA
6797
- }),
6934
+ result: strictCodec("dsh-mcp-panel/types#PatchPreview", PATCH_PREVIEW_SCHEMA),
6798
6935
  sourceLocation: Object.freeze({
6799
6936
  file: "src/wire.ts",
6800
6937
  line: 1,
@@ -6822,39 +6959,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6822
6959
  name: "opJson",
6823
6960
  wire: "opJson",
6824
6961
  source: "json",
6825
- codec: Object.freeze({
6826
- mode: "strict",
6827
- typeSymbol: "dsh-mcp-panel/types#PatchOpJson",
6828
- schema: string()
6829
- })
6962
+ codec: strictCodec("dsh-mcp-panel/types#PatchOpJson", string())
6830
6963
  }),
6831
6964
  Object.freeze({
6832
6965
  name: "confirmed",
6833
6966
  wire: "confirmed",
6834
6967
  source: "json",
6835
- codec: Object.freeze({
6836
- mode: "strict",
6837
- typeSymbol: "dsh-mcp-panel/types#PatchWriteConfirmed",
6838
- schema: boolean()
6839
- })
6968
+ codec: strictCodec("dsh-mcp-panel/types#PatchWriteConfirmed", boolean())
6840
6969
  }),
6841
6970
  Object.freeze({
6842
6971
  name: "sessionId",
6843
6972
  wire: "sessionId",
6844
6973
  source: "json",
6845
- codec: Object.freeze({
6846
- mode: "strict",
6847
- typeSymbol: "dsh-mcp-panel/types#PatchWriteSessionId",
6848
- schema: string()
6849
- }),
6974
+ codec: strictCodec("dsh-mcp-panel/types#PatchWriteSessionId", string()),
6850
6975
  acceptsUndefined: true
6851
6976
  })
6852
6977
  ]),
6853
- result: Object.freeze({
6854
- mode: "strict",
6855
- typeSymbol: "dsh-mcp-panel/types#PatchWriteResult",
6856
- schema: PATCH_WRITE_RESULT_SCHEMA
6857
- }),
6978
+ result: strictCodec("dsh-mcp-panel/types#PatchWriteResult", PATCH_WRITE_RESULT_SCHEMA),
6858
6979
  sourceLocation: Object.freeze({
6859
6980
  file: "src/wire.ts",
6860
6981
  line: 1,
@@ -6880,27 +7001,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6880
7001
  name: "requestJson",
6881
7002
  wire: "requestJson",
6882
7003
  source: "json",
6883
- codec: Object.freeze({
6884
- mode: "strict",
6885
- typeSymbol: "dsh-mcp-panel/types#TrialRequestJson",
6886
- schema: string()
6887
- })
7004
+ codec: strictCodec("dsh-mcp-panel/types#TrialRequestJson", string())
6888
7005
  }), Object.freeze({
6889
7006
  name: "sessionId",
6890
7007
  wire: "sessionId",
6891
7008
  source: "json",
6892
- codec: Object.freeze({
6893
- mode: "strict",
6894
- typeSymbol: "dsh-mcp-panel/types#TrialSessionId",
6895
- schema: string()
6896
- }),
7009
+ codec: strictCodec("dsh-mcp-panel/types#TrialSessionId", string()),
6897
7010
  acceptsUndefined: true
6898
7011
  })]),
6899
- result: Object.freeze({
6900
- mode: "strict",
6901
- typeSymbol: "dsh-mcp-panel/types#McpTrialResultWire",
6902
- schema: MCP_TRIAL_RESULT_SCHEMA
6903
- }),
7012
+ result: strictCodec("dsh-mcp-panel/types#McpTrialResultWire", MCP_TRIAL_RESULT_SCHEMA),
6904
7013
  sourceLocation: Object.freeze({
6905
7014
  file: "src/wire.ts",
6906
7015
  line: 1,
@@ -7394,6 +7503,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7394
7503
  gap: 8px;
7395
7504
  flex-wrap: wrap;
7396
7505
  }
7506
+ [data-dsh-mcp-panel] .dmcp-resources {
7507
+ display: flex;
7508
+ flex-direction: column;
7509
+ gap: 8px;
7510
+ margin-top: 12px;
7511
+ padding-top: 10px;
7512
+ border-top: 1px solid var(--dmcp-border, rgba(127, 127, 127, 0.25));
7513
+ }
7514
+ [data-dsh-mcp-panel] .dmcp-resources .dmcp-editor-actions {
7515
+ flex-wrap: wrap;
7516
+ }
7517
+ [data-dsh-mcp-panel] .dmcp-resource-uri {
7518
+ flex: 1 1 220px;
7519
+ min-width: 160px;
7520
+ padding: 4px 6px;
7521
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
7522
+ font-size: 0.85em;
7523
+ }
7397
7524
  `;
7398
7525
  //#endregion
7399
7526
  //#region src/client/index.ts