@trops/dash-core 0.1.394 → 0.1.395

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -2987,7 +2987,7 @@ var Layout = function Layout(_ref) {
2987
2987
  });
2988
2988
  };
2989
2989
 
2990
- var _excluded$6 = ["id", "children", "direction", "className", "scrollable", "width", "height", "space", "grow", "debug", "onClick", "padding", "prefix"];
2990
+ var _excluded$7 = ["id", "children", "direction", "className", "scrollable", "width", "height", "space", "grow", "debug", "onClick", "padding", "prefix"];
2991
2991
  var LayoutContainer = function LayoutContainer(_ref) {
2992
2992
  var id = _ref.id,
2993
2993
  children = _ref.children,
@@ -3013,7 +3013,7 @@ var LayoutContainer = function LayoutContainer(_ref) {
3013
3013
  padding = _ref$padding === void 0 ? "" : _ref$padding,
3014
3014
  _ref$prefix = _ref.prefix,
3015
3015
  prefix = _ref$prefix === void 0 ? "layout-container" : _ref$prefix,
3016
- props = _objectWithoutProperties(_ref, _excluded$6);
3016
+ props = _objectWithoutProperties(_ref, _excluded$7);
3017
3017
  var containerId = "uuid" in props ? props["uuid"] : getUUID(id, prefix);
3018
3018
 
3019
3019
  // get the styles
@@ -12994,7 +12994,7 @@ var PanelEditItem = function PanelEditItem(_ref) {
12994
12994
  });
12995
12995
  };
12996
12996
 
12997
- var _excluded$5 = ["rows", "cols"];
12997
+ var _excluded$6 = ["rows", "cols"];
12998
12998
  function _createForOfIteratorHelper$l(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$l(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
12999
12999
  function _unsupportedIterableToArray$l(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$l(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$l(r, a) : void 0; } }
13000
13000
  function _arrayLikeToArray$l(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
@@ -13167,7 +13167,7 @@ function GridEditor(_ref) {
13167
13167
  function resequenceGridKeys(grid) {
13168
13168
  var rows = grid.rows,
13169
13169
  cols = grid.cols,
13170
- cells = _objectWithoutProperties(grid, _excluded$5);
13170
+ cells = _objectWithoutProperties(grid, _excluded$6);
13171
13171
  var newGrid = {
13172
13172
  rows: rows,
13173
13173
  cols: cols
@@ -23498,7 +23498,7 @@ var WidgetProviderWrapper = function WidgetProviderWrapper(_ref2) {
23498
23498
  return children;
23499
23499
  };
23500
23500
 
23501
- var _excluded$4 = ["uuid", "children", "version", "direction", "scrollable", "className", "width", "height", "space", "grow", "publishEvent", "api", "requiredProviders", "selectedProviders", "onProviderSelect"];
23501
+ var _excluded$5 = ["uuid", "children", "version", "direction", "scrollable", "className", "width", "height", "space", "grow", "publishEvent", "api", "requiredProviders", "selectedProviders", "onProviderSelect"];
23502
23502
  function _callSuper$3(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$3() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
23503
23503
  function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function _isNativeReflectConstruct() { return !!t; })(); }
23504
23504
  var WidgetErrorBoundary$1 = /*#__PURE__*/function (_Component) {
@@ -23596,7 +23596,7 @@ var Widget = function Widget(_ref) {
23596
23596
  selectedProviders = _ref$selectedProvider === void 0 ? {} : _ref$selectedProvider,
23597
23597
  _ref$onProviderSelect = _ref.onProviderSelect,
23598
23598
  onProviderSelect = _ref$onProviderSelect === void 0 ? null : _ref$onProviderSelect;
23599
- _objectWithoutProperties(_ref, _excluded$4);
23599
+ _objectWithoutProperties(_ref, _excluded$5);
23600
23600
  var uuidString = getUUID(uuid);
23601
23601
  return /*#__PURE__*/jsx(LayoutContainer, {
23602
23602
  uuid: uuid,
@@ -24479,12 +24479,12 @@ var WidgetFactory = {
24479
24479
  }
24480
24480
  };
24481
24481
 
24482
- var _excluded$3 = ["title", "description", "icon"];
24482
+ var _excluded$4 = ["title", "description", "icon"];
24483
24483
  var ExternalWidget = function ExternalWidget(_ref) {
24484
24484
  var title = _ref.title,
24485
24485
  description = _ref.description,
24486
24486
  icon = _ref.icon;
24487
- _objectWithoutProperties(_ref, _excluded$3);
24487
+ _objectWithoutProperties(_ref, _excluded$4);
24488
24488
  return /*#__PURE__*/jsxs("div", {
24489
24489
  className: "flex flex-col h-full justify-center items-center w-full gap-2 p-4 text-center",
24490
24490
  children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
@@ -33254,7 +33254,7 @@ var ThemePane = function ThemePane(_ref) {
33254
33254
  });
33255
33255
  };
33256
33256
 
33257
- var _excluded$2 = ["colorFromTheme", "colorName", "shade", "variant", "colorType", "colorLevelName", "selected", "onClick", "onMouseOver", "width", "height"];
33257
+ var _excluded$3 = ["colorFromTheme", "colorName", "shade", "variant", "colorType", "colorLevelName", "selected", "onClick", "onMouseOver", "width", "height"];
33258
33258
  function ownKeys$u(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
33259
33259
  function _objectSpread$u(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$u(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$u(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
33260
33260
  var ColorTile = function ColorTile(_ref) {
@@ -33280,7 +33280,7 @@ var ColorTile = function ColorTile(_ref) {
33280
33280
  width = _ref$width === void 0 ? "w-full" : _ref$width,
33281
33281
  _ref$height = _ref.height,
33282
33282
  height = _ref$height === void 0 ? "h-10" : _ref$height,
33283
- rest = _objectWithoutProperties(_ref, _excluded$2);
33283
+ rest = _objectWithoutProperties(_ref, _excluded$3);
33284
33284
  var c = ColorModel(_objectSpread$u({
33285
33285
  colorFromTheme: colorFromTheme,
33286
33286
  colorName: colorName,
@@ -36268,7 +36268,7 @@ var NonColorPickerPane = function NonColorPickerPane(_ref) {
36268
36268
  });
36269
36269
  };
36270
36270
 
36271
- var _excluded$1 = ["children"];
36271
+ var _excluded$2 = ["children"];
36272
36272
  function ownKeys$q(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
36273
36273
  function _objectSpread$q(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$q(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$q(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
36274
36274
  var COLOR_PROPERTIES = new Set(["backgroundColor", "textColor", "borderColor", "hoverBackgroundColor", "hoverTextColor", "hoverBorderColor", "focusRingColor", "focusBorderColor", "activeBackgroundColor", "activeTextColor", "placeholderTextColor"]);
@@ -37014,7 +37014,7 @@ var PanelTheme = function PanelTheme(_ref) {
37014
37014
  }
37015
37015
  var _comp$props = comp.props,
37016
37016
  childContent = _comp$props.children,
37017
- restProps = _objectWithoutProperties(_comp$props, _excluded$1);
37017
+ restProps = _objectWithoutProperties(_comp$props, _excluded$2);
37018
37018
  var renderedComponent = childContent !== undefined ? /*#__PURE__*/jsx(comp.Component, _objectSpread$q(_objectSpread$q({}, restProps), {}, {
37019
37019
  children: childContent
37020
37020
  })) : /*#__PURE__*/jsx(comp.Component, _objectSpread$q({}, restProps));
@@ -42074,8 +42074,116 @@ var ProviderDetail = function ProviderDetail(_ref) {
42074
42074
  });
42075
42075
  };
42076
42076
 
42077
+ var _excluded$1 = ["transport", "command", "args", "envMapping", "url", "headerTemplate", "headers"];
42077
42078
  function ownKeys$k(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
42078
42079
  function _objectSpread$k(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$k(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$k(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
42080
+ var DirectoryListField = function DirectoryListField(_ref) {
42081
+ var field = _ref.field,
42082
+ value = _ref.value,
42083
+ onChange = _ref.onChange,
42084
+ errorText = _ref.errorText;
42085
+ var initialRows = useMemo(function () {
42086
+ var parsed = (value || "").split(",").map(function (p) {
42087
+ return p.trim();
42088
+ });
42089
+ var nonEmpty = parsed.filter(Boolean);
42090
+ return nonEmpty.length === 0 ? [""] : nonEmpty;
42091
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
42092
+
42093
+ var _useState = useState(initialRows),
42094
+ _useState2 = _slicedToArray(_useState, 2),
42095
+ rows = _useState2[0],
42096
+ setRows = _useState2[1];
42097
+ var updateRows = function updateRows(next) {
42098
+ setRows(next);
42099
+ onChange(next.map(function (p) {
42100
+ return p.trim();
42101
+ }).filter(Boolean).join(","));
42102
+ };
42103
+ return /*#__PURE__*/jsxs("div", {
42104
+ className: "flex flex-col gap-2",
42105
+ children: [/*#__PURE__*/jsx(FormLabel, {
42106
+ label: field.displayName,
42107
+ required: field.required
42108
+ }), field.instructions && /*#__PURE__*/jsx("p", {
42109
+ className: "text-xs opacity-50",
42110
+ children: field.instructions
42111
+ }), /*#__PURE__*/jsxs("div", {
42112
+ className: "flex flex-col gap-2",
42113
+ children: [rows.map(function (rowValue, idx) {
42114
+ return /*#__PURE__*/jsxs("div", {
42115
+ className: "flex gap-2 items-center",
42116
+ children: [/*#__PURE__*/jsx("div", {
42117
+ className: "flex-1",
42118
+ children: /*#__PURE__*/jsx(InputText, {
42119
+ type: "text",
42120
+ value: rowValue,
42121
+ onChange: function onChange(v) {
42122
+ var next = _toConsumableArray(rows);
42123
+ next[idx] = v;
42124
+ updateRows(next);
42125
+ },
42126
+ placeholder: "/Users/you/some/folder"
42127
+ })
42128
+ }), /*#__PURE__*/jsx("button", {
42129
+ type: "button",
42130
+ onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
42131
+ var picked, next;
42132
+ return _regeneratorRuntime.wrap(function (_context) {
42133
+ while (1) switch (_context.prev = _context.next) {
42134
+ case 0:
42135
+ _context.next = 1;
42136
+ return window.mainApi.dialog.chooseFile(false, []);
42137
+ case 1:
42138
+ picked = _context.sent;
42139
+ if (picked) {
42140
+ next = _toConsumableArray(rows);
42141
+ next[idx] = picked;
42142
+ updateRows(next);
42143
+ }
42144
+ case 2:
42145
+ case "end":
42146
+ return _context.stop();
42147
+ }
42148
+ }, _callee);
42149
+ })),
42150
+ className: "px-3 py-1.5 text-sm rounded bg-white/10 hover:bg-white/20 transition-colors whitespace-nowrap",
42151
+ children: "Choose folder\u2026"
42152
+ }), rows.length > 1 && /*#__PURE__*/jsx("button", {
42153
+ type: "button",
42154
+ onClick: function onClick() {
42155
+ var next = rows.filter(function (_, i) {
42156
+ return i !== idx;
42157
+ });
42158
+ updateRows(next.length ? next : [""]);
42159
+ },
42160
+ className: "px-2 py-1.5 text-sm rounded bg-white/5 hover:bg-red-500/20 text-red-300 transition-colors",
42161
+ "aria-label": "Remove path",
42162
+ children: /*#__PURE__*/jsx(FontAwesomeIcon, {
42163
+ icon: "xmark",
42164
+ className: "text-xs"
42165
+ })
42166
+ })]
42167
+ }, idx);
42168
+ }), /*#__PURE__*/jsxs("button", {
42169
+ type: "button",
42170
+ onClick: function onClick() {
42171
+ return setRows([].concat(_toConsumableArray(rows), [""]));
42172
+ },
42173
+ className: "text-sm text-blue-400 hover:text-blue-300 transition-colors flex items-center gap-1 self-start",
42174
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
42175
+ icon: "plus",
42176
+ className: "text-xs"
42177
+ }), /*#__PURE__*/jsx("span", {
42178
+ children: "Add directory"
42179
+ })]
42180
+ })]
42181
+ }), errorText && /*#__PURE__*/jsx("p", {
42182
+ className: "text-sm text-red-400",
42183
+ children: errorText
42184
+ })]
42185
+ });
42186
+ };
42079
42187
  var rowIdCounter = 0;
42080
42188
  var nextRowId = function nextRowId() {
42081
42189
  return "row_".concat(++rowIdCounter);
@@ -42083,13 +42191,28 @@ var nextRowId = function nextRowId() {
42083
42191
 
42084
42192
  /**
42085
42193
  * Build an mcpConfig object from the current form state.
42194
+ *
42195
+ * `baseConfig` is the existing mcpConfig this save is derived from (either a
42196
+ * catalog entry's config or the saved provider's current config). Fields the
42197
+ * form doesn't render (argsMapping, staticEnv, tokenRefresh, etc.) are copied
42198
+ * through so editing a provider never drops them.
42086
42199
  */
42087
- function buildMcpConfig(transport, _ref) {
42088
- var command = _ref.command,
42089
- args = _ref.args,
42090
- envMappingRows = _ref.envMappingRows,
42091
- url = _ref.url,
42092
- headerRows = _ref.headerRows;
42200
+ function buildMcpConfig(transport, _ref3) {
42201
+ var command = _ref3.command,
42202
+ args = _ref3.args,
42203
+ envMappingRows = _ref3.envMappingRows,
42204
+ url = _ref3.url,
42205
+ headerRows = _ref3.headerRows;
42206
+ var baseConfig = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
42207
+ // Everything on baseConfig that the form doesn't own gets preserved.
42208
+ baseConfig.transport;
42209
+ baseConfig.command;
42210
+ baseConfig.args;
42211
+ baseConfig.envMapping;
42212
+ baseConfig.url;
42213
+ baseConfig.headerTemplate;
42214
+ baseConfig.headers;
42215
+ var passThrough = _objectWithoutProperties(baseConfig, _excluded$1);
42093
42216
  if (transport === "stdio") {
42094
42217
  var envMapping = {};
42095
42218
  envMappingRows.forEach(function (row) {
@@ -42099,12 +42222,12 @@ function buildMcpConfig(transport, _ref) {
42099
42222
  envMapping[env] = cred;
42100
42223
  }
42101
42224
  });
42102
- return {
42225
+ return _objectSpread$k(_objectSpread$k({}, passThrough), {}, {
42103
42226
  transport: "stdio",
42104
42227
  command: command.trim(),
42105
42228
  args: args.trim().split(/\s+/).filter(Boolean),
42106
42229
  envMapping: envMapping
42107
- };
42230
+ });
42108
42231
  }
42109
42232
 
42110
42233
  // streamable_http
@@ -42116,10 +42239,10 @@ function buildMcpConfig(transport, _ref) {
42116
42239
  headerTemplate[name] = value;
42117
42240
  }
42118
42241
  });
42119
- var config = {
42242
+ var config = _objectSpread$k(_objectSpread$k({}, passThrough), {}, {
42120
42243
  transport: "streamable_http",
42121
42244
  url: url.trim()
42122
- };
42245
+ });
42123
42246
  if (Object.keys(headerTemplate).length > 0) {
42124
42247
  config.headerTemplate = headerTemplate;
42125
42248
  }
@@ -42144,127 +42267,132 @@ function buildMcpConfig(transport, _ref) {
42144
42267
  * @param {string} initialUrl - Pre-populated URL (edit mode)
42145
42268
  * @param {Array} initialHeaderRows - Pre-populated header rows (edit mode)
42146
42269
  * @param {object} initialCredentials - Pre-populated credential values (edit mode)
42270
+ * @param {object} initialMcpConfig - The full saved/catalog mcpConfig. Fields
42271
+ * the form does NOT own (argsMapping, staticEnv, tokenRefresh, etc.) are
42272
+ * preserved verbatim on save so editing never silently drops them.
42147
42273
  */
42148
- var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
42274
+ var CustomMcpServerForm = function CustomMcpServerForm(_ref4) {
42149
42275
  var _testResult$tools;
42150
- var onSave = _ref2.onSave,
42151
- onBack = _ref2.onBack,
42152
- _ref2$isEditMode = _ref2.isEditMode,
42153
- isEditMode = _ref2$isEditMode === void 0 ? false : _ref2$isEditMode,
42154
- _ref2$initialName = _ref2.initialName,
42155
- initialName = _ref2$initialName === void 0 ? "" : _ref2$initialName,
42156
- _ref2$initialProvider = _ref2.initialProviderType,
42157
- initialProviderType = _ref2$initialProvider === void 0 ? "custom" : _ref2$initialProvider,
42158
- _ref2$initialCredenti = _ref2.initialCredentialSchema,
42159
- initialCredentialSchema = _ref2$initialCredenti === void 0 ? {} : _ref2$initialCredenti,
42160
- _ref2$initialTranspor = _ref2.initialTransport,
42161
- initialTransport = _ref2$initialTranspor === void 0 ? "stdio" : _ref2$initialTranspor,
42162
- _ref2$initialCommand = _ref2.initialCommand,
42163
- initialCommand = _ref2$initialCommand === void 0 ? "" : _ref2$initialCommand,
42164
- _ref2$initialArgs = _ref2.initialArgs,
42165
- initialArgs = _ref2$initialArgs === void 0 ? "" : _ref2$initialArgs,
42166
- _ref2$initialEnvMappi = _ref2.initialEnvMappingRows,
42167
- initialEnvMappingRows = _ref2$initialEnvMappi === void 0 ? [] : _ref2$initialEnvMappi,
42168
- _ref2$initialUrl = _ref2.initialUrl,
42169
- initialUrl = _ref2$initialUrl === void 0 ? "" : _ref2$initialUrl,
42170
- _ref2$initialHeaderRo = _ref2.initialHeaderRows,
42171
- initialHeaderRows = _ref2$initialHeaderRo === void 0 ? [] : _ref2$initialHeaderRo,
42172
- _ref2$initialCredenti2 = _ref2.initialCredentials,
42173
- initialCredentials = _ref2$initialCredenti2 === void 0 ? {} : _ref2$initialCredenti2,
42174
- _ref2$initialAllowedT = _ref2.initialAllowedTools,
42175
- initialAllowedTools = _ref2$initialAllowedT === void 0 ? null : _ref2$initialAllowedT,
42176
- _ref2$initialAuthComm = _ref2.initialAuthCommand,
42177
- initialAuthCommand = _ref2$initialAuthComm === void 0 ? null : _ref2$initialAuthComm;
42276
+ var onSave = _ref4.onSave,
42277
+ onBack = _ref4.onBack,
42278
+ _ref4$isEditMode = _ref4.isEditMode,
42279
+ isEditMode = _ref4$isEditMode === void 0 ? false : _ref4$isEditMode,
42280
+ _ref4$initialName = _ref4.initialName,
42281
+ initialName = _ref4$initialName === void 0 ? "" : _ref4$initialName,
42282
+ _ref4$initialProvider = _ref4.initialProviderType,
42283
+ initialProviderType = _ref4$initialProvider === void 0 ? "custom" : _ref4$initialProvider,
42284
+ _ref4$initialCredenti = _ref4.initialCredentialSchema,
42285
+ initialCredentialSchema = _ref4$initialCredenti === void 0 ? {} : _ref4$initialCredenti,
42286
+ _ref4$initialTranspor = _ref4.initialTransport,
42287
+ initialTransport = _ref4$initialTranspor === void 0 ? "stdio" : _ref4$initialTranspor,
42288
+ _ref4$initialCommand = _ref4.initialCommand,
42289
+ initialCommand = _ref4$initialCommand === void 0 ? "" : _ref4$initialCommand,
42290
+ _ref4$initialArgs = _ref4.initialArgs,
42291
+ initialArgs = _ref4$initialArgs === void 0 ? "" : _ref4$initialArgs,
42292
+ _ref4$initialEnvMappi = _ref4.initialEnvMappingRows,
42293
+ initialEnvMappingRows = _ref4$initialEnvMappi === void 0 ? [] : _ref4$initialEnvMappi,
42294
+ _ref4$initialUrl = _ref4.initialUrl,
42295
+ initialUrl = _ref4$initialUrl === void 0 ? "" : _ref4$initialUrl,
42296
+ _ref4$initialHeaderRo = _ref4.initialHeaderRows,
42297
+ initialHeaderRows = _ref4$initialHeaderRo === void 0 ? [] : _ref4$initialHeaderRo,
42298
+ _ref4$initialCredenti2 = _ref4.initialCredentials,
42299
+ initialCredentials = _ref4$initialCredenti2 === void 0 ? {} : _ref4$initialCredenti2,
42300
+ _ref4$initialAllowedT = _ref4.initialAllowedTools,
42301
+ initialAllowedTools = _ref4$initialAllowedT === void 0 ? null : _ref4$initialAllowedT,
42302
+ _ref4$initialAuthComm = _ref4.initialAuthCommand,
42303
+ initialAuthCommand = _ref4$initialAuthComm === void 0 ? null : _ref4$initialAuthComm,
42304
+ _ref4$initialMcpConfi = _ref4.initialMcpConfig,
42305
+ initialMcpConfig = _ref4$initialMcpConfi === void 0 ? null : _ref4$initialMcpConfi;
42178
42306
  var appContext = useContext(AppContext);
42179
42307
  var dashApi = appContext === null || appContext === void 0 ? void 0 : appContext.dashApi;
42180
42308
 
42181
42309
  // Transport selection
42182
- var _useState = useState(initialTransport),
42183
- _useState2 = _slicedToArray(_useState, 2),
42184
- transport = _useState2[0],
42185
- setTransport = _useState2[1];
42310
+ var _useState3 = useState(initialTransport),
42311
+ _useState4 = _slicedToArray(_useState3, 2),
42312
+ transport = _useState4[0],
42313
+ setTransport = _useState4[1];
42186
42314
 
42187
42315
  // Common
42188
- var _useState3 = useState(initialName),
42189
- _useState4 = _slicedToArray(_useState3, 2),
42190
- providerName = _useState4[0],
42191
- setProviderName = _useState4[1];
42192
- var _useState5 = useState(initialCredentials),
42316
+ var _useState5 = useState(initialName),
42193
42317
  _useState6 = _slicedToArray(_useState5, 2),
42194
- credentialData = _useState6[0],
42195
- setCredentialData = _useState6[1];
42196
- var _useState7 = useState({}),
42318
+ providerName = _useState6[0],
42319
+ setProviderName = _useState6[1];
42320
+ var _useState7 = useState(initialCredentials),
42197
42321
  _useState8 = _slicedToArray(_useState7, 2),
42198
- formErrors = _useState8[0],
42199
- setFormErrors = _useState8[1];
42200
- var _useState9 = useState(false),
42322
+ credentialData = _useState8[0],
42323
+ setCredentialData = _useState8[1];
42324
+ var _useState9 = useState({}),
42201
42325
  _useState0 = _slicedToArray(_useState9, 2),
42202
- isTesting = _useState0[0],
42203
- setIsTesting = _useState0[1];
42204
- var _useState1 = useState(null),
42326
+ formErrors = _useState0[0],
42327
+ setFormErrors = _useState0[1];
42328
+ var _useState1 = useState(false),
42205
42329
  _useState10 = _slicedToArray(_useState1, 2),
42206
- testResult = _useState10[0],
42207
- setTestResult = _useState10[1];
42330
+ isTesting = _useState10[0],
42331
+ setIsTesting = _useState10[1];
42332
+ var _useState11 = useState(null),
42333
+ _useState12 = _slicedToArray(_useState11, 2),
42334
+ testResult = _useState12[0],
42335
+ setTestResult = _useState12[1];
42208
42336
 
42209
42337
  // stdio fields
42210
- var _useState11 = useState(initialCommand),
42211
- _useState12 = _slicedToArray(_useState11, 2),
42212
- command = _useState12[0],
42213
- setCommand = _useState12[1];
42214
- var _useState13 = useState(initialArgs),
42338
+ var _useState13 = useState(initialCommand),
42215
42339
  _useState14 = _slicedToArray(_useState13, 2),
42216
- args = _useState14[0],
42217
- setArgs = _useState14[1];
42218
- var _useState15 = useState(initialEnvMappingRows),
42340
+ command = _useState14[0],
42341
+ setCommand = _useState14[1];
42342
+ var _useState15 = useState(initialArgs),
42219
42343
  _useState16 = _slicedToArray(_useState15, 2),
42220
- envMappingRows = _useState16[0],
42221
- setEnvMappingRows = _useState16[1];
42344
+ args = _useState16[0],
42345
+ setArgs = _useState16[1];
42346
+ var _useState17 = useState(initialEnvMappingRows),
42347
+ _useState18 = _slicedToArray(_useState17, 2),
42348
+ envMappingRows = _useState18[0],
42349
+ setEnvMappingRows = _useState18[1];
42222
42350
 
42223
42351
  // HTTP fields
42224
- var _useState17 = useState(initialUrl),
42225
- _useState18 = _slicedToArray(_useState17, 2),
42226
- url = _useState18[0],
42227
- setUrl = _useState18[1];
42228
- var _useState19 = useState(initialHeaderRows),
42352
+ var _useState19 = useState(initialUrl),
42229
42353
  _useState20 = _slicedToArray(_useState19, 2),
42230
- headerRows = _useState20[0],
42231
- setHeaderRows = _useState20[1];
42354
+ url = _useState20[0],
42355
+ setUrl = _useState20[1];
42356
+ var _useState21 = useState(initialHeaderRows),
42357
+ _useState22 = _slicedToArray(_useState21, 2),
42358
+ headerRows = _useState22[0],
42359
+ setHeaderRows = _useState22[1];
42232
42360
 
42233
42361
  // Tool selection state
42234
- var _useState21 = useState(initialAllowedTools),
42235
- _useState22 = _slicedToArray(_useState21, 2),
42236
- selectedTools = _useState22[0],
42237
- setSelectedTools = _useState22[1];
42362
+ var _useState23 = useState(initialAllowedTools),
42363
+ _useState24 = _slicedToArray(_useState23, 2),
42364
+ selectedTools = _useState24[0],
42365
+ setSelectedTools = _useState24[1];
42238
42366
 
42239
42367
  // Wizard step state
42240
- var _useState23 = useState(0),
42241
- _useState24 = _slicedToArray(_useState23, 2),
42242
- wizardStep = _useState24[0],
42243
- setWizardStep = _useState24[1];
42368
+ var _useState25 = useState(0),
42369
+ _useState26 = _slicedToArray(_useState25, 2),
42370
+ wizardStep = _useState26[0],
42371
+ setWizardStep = _useState26[1];
42244
42372
 
42245
42373
  // Auth state
42246
- var _useState25 = useState(false),
42247
- _useState26 = _slicedToArray(_useState25, 2),
42248
- isAuthorizing = _useState26[0],
42249
- setIsAuthorizing = _useState26[1];
42250
- var _useState27 = useState(null),
42374
+ var _useState27 = useState(false),
42251
42375
  _useState28 = _slicedToArray(_useState27, 2),
42252
- authResult = _useState28[0],
42253
- setAuthResult = _useState28[1];
42376
+ isAuthorizing = _useState28[0],
42377
+ setIsAuthorizing = _useState28[1];
42378
+ var _useState29 = useState(null),
42379
+ _useState30 = _slicedToArray(_useState29, 2),
42380
+ authResult = _useState30[0],
42381
+ setAuthResult = _useState30[1];
42254
42382
 
42255
42383
  // JSON editor state
42256
- var _useState29 = useState("form"),
42257
- _useState30 = _slicedToArray(_useState29, 2),
42258
- viewMode = _useState30[0],
42259
- setViewMode = _useState30[1]; // "form" | "json"
42260
- var _useState31 = useState(""),
42384
+ var _useState31 = useState("form"),
42261
42385
  _useState32 = _slicedToArray(_useState31, 2),
42262
- jsonText = _useState32[0],
42263
- setJsonText = _useState32[1];
42264
- var _useState33 = useState(null),
42386
+ viewMode = _useState32[0],
42387
+ setViewMode = _useState32[1]; // "form" | "json"
42388
+ var _useState33 = useState(""),
42265
42389
  _useState34 = _slicedToArray(_useState33, 2),
42266
- jsonError = _useState34[0],
42267
- setJsonError = _useState34[1];
42390
+ jsonText = _useState34[0],
42391
+ setJsonText = _useState34[1];
42392
+ var _useState35 = useState(null),
42393
+ _useState36 = _slicedToArray(_useState35, 2),
42394
+ jsonError = _useState36[0],
42395
+ setJsonError = _useState36[1];
42268
42396
 
42269
42397
  // Clear credential data when transport changes (derived fields change entirely)
42270
42398
  // Only in create mode — in edit mode the initial transport is set correctly
@@ -42297,7 +42425,9 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
42297
42425
  setWizardStep(newStep);
42298
42426
  };
42299
42427
 
42300
- // Build mcpConfig from current state
42428
+ // Build mcpConfig from current state. Pass the initial mcpConfig so fields
42429
+ // the form doesn't manage (argsMapping, staticEnv, tokenRefresh, etc.) are
42430
+ // preserved on save instead of being silently dropped.
42301
42431
  var mcpConfig = useMemo(function () {
42302
42432
  return buildMcpConfig(transport, {
42303
42433
  command: command,
@@ -42305,8 +42435,8 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
42305
42435
  envMappingRows: envMappingRows,
42306
42436
  url: url,
42307
42437
  headerRows: headerRows
42308
- });
42309
- }, [transport, command, args, envMappingRows, url, headerRows]);
42438
+ }, initialMcpConfig || {});
42439
+ }, [transport, command, args, envMappingRows, url, headerRows, initialMcpConfig]);
42310
42440
 
42311
42441
  // Invalidate test result when config changes after a test
42312
42442
  var mcpConfigRef = useRef(mcpConfig);
@@ -42435,9 +42565,23 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
42435
42565
  }
42436
42566
  }
42437
42567
  formFields.forEach(function (field) {
42438
- var _credentialData$field;
42439
- if (field.required && !((_credentialData$field = credentialData[field.key]) !== null && _credentialData$field !== void 0 && _credentialData$field.trim())) {
42568
+ var raw = credentialData[field.key];
42569
+ if (field.required && !(raw !== null && raw !== void 0 && raw.trim())) {
42440
42570
  errors[field.key] = "".concat(field.displayName, " is required");
42571
+ return;
42572
+ }
42573
+ // directory-list: every non-empty entry must be an absolute path.
42574
+ // `~` is not expanded by child_process.spawn, so the MCP filesystem
42575
+ // server would never match a real path against a tilde prefix.
42576
+ if (field.type === "directory-list" && raw !== null && raw !== void 0 && raw.trim()) {
42577
+ var bad = raw.split(",").map(function (p) {
42578
+ return p.trim();
42579
+ }).filter(Boolean).find(function (p) {
42580
+ return !p.startsWith("/");
42581
+ });
42582
+ if (bad) {
42583
+ errors[field.key] = "\"".concat(bad, "\" must be an absolute path (no `~`, use /Users/you/...)");
42584
+ }
42441
42585
  }
42442
42586
  });
42443
42587
  setFormErrors(errors);
@@ -42535,7 +42679,7 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
42535
42679
  envMappingRows: result.envMappingRows,
42536
42680
  url: result.url,
42537
42681
  headerRows: result.headerRows
42538
- });
42682
+ }, initialMcpConfig || {});
42539
42683
  onSave(name, initialProviderType, result.credentialData, config, selectedTools);
42540
42684
  return;
42541
42685
  }
@@ -42890,6 +43034,23 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
42890
43034
  children: "Values for the fields referenced in your configuration above"
42891
43035
  })]
42892
43036
  }), formFields.map(function (field) {
43037
+ // directory-list: repeating rows with an absolute-path
43038
+ // input + directory picker. Local state inside the
43039
+ // component so adding an empty row doesn't get
43040
+ // immediately stripped by the filter on write.
43041
+ if (field.type === "directory-list") {
43042
+ return /*#__PURE__*/jsx(DirectoryListField, {
43043
+ field: field,
43044
+ value: credentialData[field.key] || "",
43045
+ onChange: function onChange(v) {
43046
+ return handleCredentialChange(field.key, v);
43047
+ },
43048
+ errorText: formErrors[field.key]
43049
+ }, field.key);
43050
+ }
43051
+
43052
+ // Default: single text/password input with optional
43053
+ // "Browse" button for file-type credentials.
42893
43054
  return /*#__PURE__*/jsxs("div", {
42894
43055
  className: "flex flex-col gap-2",
42895
43056
  children: [/*#__PURE__*/jsx(FormLabel, {
@@ -42908,21 +43069,21 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
42908
43069
  placeholder: field.type === "file" ? "Select a file..." : "Enter ".concat(field.displayName.toLowerCase())
42909
43070
  })
42910
43071
  }), field.type === "file" && /*#__PURE__*/jsx("button", {
42911
- onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
43072
+ onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
42912
43073
  var filepath;
42913
- return _regeneratorRuntime.wrap(function (_context) {
42914
- while (1) switch (_context.prev = _context.next) {
43074
+ return _regeneratorRuntime.wrap(function (_context2) {
43075
+ while (1) switch (_context2.prev = _context2.next) {
42915
43076
  case 0:
42916
- _context.next = 1;
43077
+ _context2.next = 1;
42917
43078
  return window.mainApi.dialog.chooseFile(true, ["json"]);
42918
43079
  case 1:
42919
- filepath = _context.sent;
43080
+ filepath = _context2.sent;
42920
43081
  if (filepath) handleCredentialChange(field.key, filepath);
42921
43082
  case 2:
42922
43083
  case "end":
42923
- return _context.stop();
43084
+ return _context2.stop();
42924
43085
  }
42925
- }, _callee);
43086
+ }, _callee2);
42926
43087
  })),
42927
43088
  className: "px-3 py-1.5 text-sm rounded bg-white/10 hover:bg-white/20 transition-colors",
42928
43089
  children: "Browse"
@@ -44486,6 +44647,23 @@ var ProvidersSection = function ProvidersSection(_ref) {
44486
44647
  setIsEditingMcp(false);
44487
44648
  resetForm();
44488
44649
  refreshProviders && refreshProviders();
44650
+
44651
+ // Bounce the running MCP subprocess so the edit takes effect without
44652
+ // requiring the user to fully quit and relaunch the app. stopServer
44653
+ // is a no-op if nothing was running; we always start after stopping
44654
+ // so a disconnected provider still picks up the new config on next
44655
+ // tool call. Errors are logged but don't block the save UX.
44656
+ var bounceName = originalName || providerName;
44657
+ if (bounceName) {
44658
+ dashApi.mcpStopServer(bounceName, function () {}, function (e, err) {
44659
+ return (void 0);
44660
+ });
44661
+ }
44662
+ dashApi.mcpStartServer(providerName, mcpConfig, mcpCredentials, function (event, result) {
44663
+ if (result !== null && result !== void 0 && result.error) ;
44664
+ }, function (e, err) {
44665
+ return (void 0);
44666
+ });
44489
44667
  }, function (e, err) {
44490
44668
  return (void 0);
44491
44669
  });
@@ -44731,6 +44909,7 @@ var ProvidersSection = function ProvidersSection(_ref) {
44731
44909
  initialCredentials: selectedProvider.credentials || {},
44732
44910
  initialAllowedTools: selectedProvider.allowedTools || null,
44733
44911
  initialAuthCommand: (editCatalogEntry === null || editCatalogEntry === void 0 ? void 0 : editCatalogEntry.authCommand) || null,
44912
+ initialMcpConfig: mc,
44734
44913
  onSave: handleMcpEditSave,
44735
44914
  onBack: function onBack() {
44736
44915
  return setIsEditingMcp(false);