@epam/ai-dial-toolset-editor 1.2.0-rc.1 → 1.3.0-dev.6

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.
@@ -7,9 +7,7 @@ export declare enum ToolsetTransportType {
7
7
  /** Server-sent events MCP transport. */
8
8
  Sse = "SSE"
9
9
  }
10
- /** Default display name seeded into a new toolset form. */
11
- export declare const DEFAULT_TOOLSET_NAME = "New toolset";
12
- /** Default display version seeded into a new toolset form. */
10
+ /** Default display version seeded into a new toolset form; the shared deployment default. */
13
11
  export declare const DEFAULT_TOOLSET_VERSION = "1.0.0";
14
12
  /** Metadata checks for a toolset: the version must be SemVer 2.0.0, as DIAL Admin requires. */
15
13
  export declare const TOOLSET_METADATA_VALIDATION_OPTIONS: DeploymentCreationFormValidationOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"toolsets.d.ts","sourceRoot":"","sources":["../../src/constants/toolsets.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,uCAAuC,EAC7C,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,oBAAY,oBAAoB;IAC9B,qCAAqC;IACrC,IAAI,SAAS;IACb,wCAAwC;IACxC,GAAG,QAAQ;CACZ;AAED,2DAA2D;AAC3D,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAElD,8DAA8D;AAC9D,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAE/C,+FAA+F;AAC/F,eAAO,MAAM,mCAAmC,EAAE,uCACE,CAAC;AAErD,kGAAkG;AAClG,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,gBAAgB,EAAE,UAAU,CAIhE,CAAC"}
1
+ {"version":3,"file":"toolsets.d.ts","sourceRoot":"","sources":["../../src/constants/toolsets.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,uCAAuC,EAC7C,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,oBAAY,oBAAoB;IAC9B,qCAAqC;IACrC,IAAI,SAAS;IACb,wCAAwC;IACxC,GAAG,QAAQ;CACZ;AAED,6FAA6F;AAC7F,eAAO,MAAM,uBAAuB,UAA6B,CAAC;AAElE,+FAA+F;AAC/F,eAAO,MAAM,mCAAmC,EAAE,uCACE,CAAC;AAErD,kGAAkG;AAClG,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,gBAAgB,EAAE,UAAU,CAIhE,CAAC"}
package/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export type { AuthSectionLabels } from './models/auth-section-props';
7
7
  export { ToolsetOAuthLoginStatus } from './models/toolset-oauth-login';
8
8
  export type { ToolsetOAuthLoginHandler, ToolsetOAuthLoginRequest, ToolsetOAuthLoginResult, } from './models/toolset-oauth-login';
9
9
  export type { DeploymentGeneralFormData, ToolsetAuthActions, ToolsetAuthFormData, ToolsetFormData, ToolsetFormErrors, ToolsetLoginRequest, ToolsetLogoutRequest, } from './models/toolset-form';
10
- export { AUTH_TYPE_ICONS, DEFAULT_TOOLSET_NAME, DEFAULT_TOOLSET_VERSION, ToolsetTransportType, } from './constants/toolsets';
11
- export { getDefaultToolsetForm, getStorageSafeUniqueToolsetName, isToolsetAuthValid, isToolsetFormValid, isValidEndpointUrl, normalizeReturnedEndpointUrl, } from './utils/toolsets';
10
+ export { AUTH_TYPE_ICONS, DEFAULT_TOOLSET_VERSION, ToolsetTransportType, } from './constants/toolsets';
11
+ export { getDefaultToolsetForm, isToolsetAuthValid, isToolsetFormValid, isValidEndpointUrl, normalizeReturnedEndpointUrl, } from './utils/toolsets';
12
12
  export { TOOLSET_EDITOR_CLASS } from './constants/public-class-names';
13
13
  //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,YAAY,EACV,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,6BAA6B,GAC9B,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,YAAY,EACV,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,qBAAqB,EACrB,+BAA+B,EAC/B,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,GAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,YAAY,EACV,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,6BAA6B,GAC9B,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,YAAY,EACV,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,GAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC"}
package/index.js CHANGED
@@ -1,83 +1,77 @@
1
- import { DeploymentCreationFieldErrorCode as e, EntityEditor as t, MetadataField as n, MetadataForm as r, SEMVER_VERSION_PATTERN as i, useMetadataForm as a, validateDeploymentCreationFields as o } from "@epam/ai-dial-builder-form";
2
- import { ToolsetAuthTypes as s, ToolsetCredentialsLevel as c, WithLogin as l, dialFileToAttachment as u, getApiErrorDetails as d } from "@epam/ai-dial-chat-hooks";
3
- import { CopyButton as f, ENTITY_DESCRIPTION_MAX_LENGTH as p, ENTITY_NAME_MAX_LENGTH as m, TAG_INPUT_TAG_CLASS_NAME as h, TextRefinementField as g, mergeClasses as _, useCodeCopy as v, useTextRefinement as y } from "@epam/ai-dial-chat-shared";
4
- import { memo as b, useCallback as x, useEffect as S, useMemo as C, useRef as ee, useState as w } from "react";
5
- import { IconBrandOauth as T, IconKey as te, IconLockOff as ne, IconLogin as E, IconLogout as re } from "@tabler/icons-react";
6
- import { jsx as D, jsxs as O } from "react/jsx-runtime";
7
- import { ConfirmationPopup as ie, ConfirmationPopupVariant as ae, DIAL_ICON_SIZE as k, DIAL_KIT_ICON_STROKE as A, Input as j, NeutralButton as M, PasswordInput as N, Radio as P, RadioGroup as F, SegmentedControl as I, Select as L, TagInput as oe } from "@epam/ai-dial-ui-kit";
1
+ import { DEFAULT_DEPLOYMENT_VERSION as e, DeploymentCreationFieldErrorCode as t, EntityEditor as n, MetadataField as r, MetadataForm as i, SEMVER_VERSION_PATTERN as a, useMetadataForm as o, validateDeploymentCreationFields as s } from "@epam/ai-dial-builder-form";
2
+ import { ToolsetAuthTypes as c, ToolsetCredentialsLevel as l, WithLogin as u, dialFileToAttachment as d, getApiErrorDetails as f } from "@epam/ai-dial-chat-hooks";
3
+ import { CopyButton as p, ENTITY_DESCRIPTION_MAX_LENGTH as m, ENTITY_NAME_MAX_LENGTH as h, TAG_INPUT_TAG_CLASS_NAME as g, TextRefinementField as _, mergeClasses as v, useCodeCopy as y, useTextRefinement as b } from "@epam/ai-dial-chat-shared";
4
+ import { memo as x, useCallback as S, useEffect as C, useMemo as w, useRef as T, useState as E } from "react";
5
+ import { IconBrandOauth as ee, IconKey as te, IconLockOff as D, IconLogin as ne, IconLogout as re } from "@tabler/icons-react";
6
+ import { jsx as O, jsxs as k } from "react/jsx-runtime";
7
+ import { ConfirmationPopup as ie, ConfirmationPopupVariant as ae, DIAL_ICON_SIZE as A, DIAL_KIT_ICON_STROKE as j, Input as M, NeutralButton as N, PasswordInput as P, Radio as F, RadioGroup as I, SegmentedControl as L, Select as oe, TagInput as R } from "@epam/ai-dial-ui-kit";
8
8
  //#region src/constants/public-class-names.ts
9
9
  var se = {
10
10
  metadataSection: "dial-toolset-editor-metadata-section",
11
11
  setupSection: "dial-toolset-editor-setup-section"
12
- }, R = /* @__PURE__ */ function(e) {
12
+ }, z = /* @__PURE__ */ function(e) {
13
13
  return e.Http = "HTTP", e.Sse = "SSE", e;
14
- }({}), z = "New toolset", B = "1.0.0", ce = { validateVersionPattern: i }, V = {
15
- [s.OAuth]: T,
16
- [s.ApiKey]: te,
17
- [s.None]: ne
18
- }, H = ({ defaultName: e = z, existingNames: t }) => {
19
- let n = new Set(t);
20
- if (!n.has(e)) return e;
21
- let r = 1;
22
- for (; n.has(`${e} ${r}`);) r += 1;
23
- return `${e} ${r}`;
14
+ }({}), B = e, ce = { validateVersionPattern: a }, V = {
15
+ [c.OAuth]: ee,
16
+ [c.ApiKey]: te,
17
+ [c.None]: D
24
18
  }, le = () => ({
25
- authenticationType: s.None,
26
- withLogin: l.WithoutLogin,
19
+ authenticationType: c.None,
20
+ withLogin: u.WithoutLogin,
27
21
  isLoggedIn: !1
28
- }), U = (e = []) => ({
29
- name: H({ existingNames: e }),
22
+ }), H = () => ({
23
+ name: "",
30
24
  version: B,
31
25
  iconUrl: "",
32
26
  description: "",
33
27
  topics: [],
34
28
  otherLocales: [],
35
29
  endpoint: "",
36
- protocol: R.Http,
30
+ protocol: z.Http,
37
31
  allowedTools: [],
38
32
  auth: le()
39
- }), W = (e) => {
33
+ }), U = (e) => {
40
34
  if (!/^https?:\/\//.test(e) || e.endsWith(".") || e.endsWith("//")) return !1;
41
35
  try {
42
36
  return !!new URL(e);
43
37
  } catch {
44
38
  return !1;
45
39
  }
46
- }, G = (e) => W(e.trim()), K = (e) => e.replace(/^(https?):\/([^/])/, "$1://$2"), q = (e) => {
40
+ }, W = (e) => U(e.trim()), G = (e) => e.replace(/^(https?):\/([^/])/, "$1://$2"), K = (e) => {
47
41
  let t = e?.trim() ?? "";
48
- if (!t || W(t)) return t;
42
+ if (!t || U(t)) return t;
49
43
  let n = [t];
50
44
  try {
51
45
  let e = decodeURIComponent(t);
52
46
  e !== t && n.push(e);
53
47
  } catch {}
54
48
  for (let e of n) {
55
- let t = K(e);
56
- if (W(t)) return t;
49
+ let t = G(e);
50
+ if (U(t)) return t;
57
51
  }
58
52
  return t;
59
- }, J = (e) => !e?.trim() || G(e), Y = (e, t = !1) => e.isLoggedIn ? !0 : e.authenticationType === s.ApiKey ? e.keyHeader?.trim() ? e.withLogin === l.WithoutLogin ? !0 : !!(e.keyHeader?.trim() && e.apiKey?.trim()) : !1 : e.authenticationType === s.OAuth && e.withLogin === l.WithConfig ? !!e.clientId?.trim() && (t || !!e.clientSecret?.trim()) && J(e.authorizationEndpoint) && J(e.tokenEndpoint) : !0, ue = (e, t = !1) => Object.keys(o(e, ce)).length === 0 && G(e.endpoint) && Y(e.auth, t), de = new Set([
53
+ }, q = (e) => !e?.trim() || W(e), J = (e, t = !1) => e.isLoggedIn ? !0 : e.authenticationType === c.ApiKey ? e.keyHeader?.trim() ? e.withLogin === u.WithoutLogin ? !0 : !!(e.keyHeader?.trim() && e.apiKey?.trim()) : !1 : e.authenticationType === c.OAuth && e.withLogin === u.WithConfig ? !!e.clientId?.trim() && (t || !!e.clientSecret?.trim()) && q(e.authorizationEndpoint) && q(e.tokenEndpoint) : !0, ue = (e, t = !1) => Object.keys(s(e, ce)).length === 0 && W(e.endpoint) && J(e.auth, t), Y = new Set([
60
54
  "name",
61
55
  "description",
62
56
  "iconUrl",
63
57
  "version",
64
58
  "topics",
65
59
  "otherLocales"
66
- ]), fe = (e) => ({
60
+ ]), de = (e) => ({
67
61
  name: e.name,
68
62
  description: e.description,
69
63
  iconUrl: e.iconUrl,
70
64
  version: e.version,
71
65
  topics: e.topics,
72
66
  otherLocales: e.otherLocales
73
- }), pe = (e) => {
67
+ }), fe = (e) => {
74
68
  let t = {}, n = {};
75
- for (let [r, i] of Object.entries(e)) (de.has(r) ? t : n)[r] = i;
69
+ for (let [r, i] of Object.entries(e)) (Y.has(r) ? t : n)[r] = i;
76
70
  return {
77
71
  metadata: t,
78
72
  setup: n
79
73
  };
80
- }, X = {
74
+ }, pe = {
81
75
  name: {
82
76
  label: "Name",
83
77
  placeholder: "Enter name"
@@ -116,27 +110,27 @@ var se = {
116
110
  saveLabel: "Save"
117
111
  },
118
112
  ariaLabel: "General"
119
- }, me = ({ form: e, errors: t, bucket: n, FileManagerModal: i, resolveIconUrl: a, allowedMimeTypes: o, maxFileSizeBytes: s, availableLocaleOptions: c, onChange: l, onNameBlur: d, onVersionBlur: f, renderDescription: p, labels: m }) => {
120
- let h = x((e) => {
113
+ }, me = ({ form: e, errors: t, bucket: n, FileManagerModal: r, resolveIconUrl: a, allowedMimeTypes: o, maxFileSizeBytes: s, availableLocaleOptions: c, onChange: l, onNameBlur: u, onVersionBlur: f, renderDescription: p, labels: m }) => {
114
+ let h = S((e) => {
121
115
  let [t] = e.files;
122
- return (t ? u(t, n, { resolvePreviewUrl: a }) : null)?.url;
116
+ return (t ? d(t, n, { resolvePreviewUrl: a }) : null)?.url;
123
117
  }, [n, a]);
124
- return /* @__PURE__ */ D(r, {
118
+ return /* @__PURE__ */ O(i, {
125
119
  values: e,
126
120
  errors: t,
127
121
  onChange: l,
128
- onNameBlur: d,
122
+ onNameBlur: u,
129
123
  onVersionBlur: f,
130
- avatarPicker: C(() => ({
124
+ avatarPicker: w(() => ({
131
125
  bucket: n,
132
- FileManagerModal: i,
126
+ FileManagerModal: r,
133
127
  resolveIconUrl: a,
134
128
  resolveAttachedIconUrl: h,
135
129
  allowedMimeTypes: o,
136
130
  maxFileSizeBytes: s
137
131
  }), [
138
132
  n,
139
- i,
133
+ r,
140
134
  a,
141
135
  h,
142
136
  o,
@@ -144,174 +138,174 @@ var se = {
144
138
  ]),
145
139
  availableLocaleOptions: c,
146
140
  renderDescription: p,
147
- labels: C(() => ({
148
- form: m?.form ?? X,
141
+ labels: w(() => ({
142
+ form: m?.form ?? pe,
149
143
  avatarPicker: m?.avatarPicker
150
144
  }), [m?.form, m?.avatarPicker])
151
145
  });
152
- }, Z = /* @__PURE__ */ function(e) {
146
+ }, X = /* @__PURE__ */ function(e) {
153
147
  return e.Success = "success", e.Cancelled = "cancelled", e.PopupBlocked = "popup-blocked", e.InvalidConfig = "invalid-config", e.Failed = "failed", e;
154
- }({}), Q = (e) => e === s.None ? l.WithoutLogin : l.WithLogin, he = (e, t) => e === s.None ? t?.typeNone ?? "Open access" : e === s.OAuth ? t?.typeOAuth ?? "OAuth" : t?.typeApiKey ?? "API Key", ge = ({ auth: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, endpoint: a, authActions: o, onOAuthLogin: u, onNotifySuccess: f, onNotifyError: p, onAuthChange: m, onEnsureSaved: g, labels: _ }) => {
155
- let [v, y] = w(!1), [b, x] = w(!1), S = e.isLoggedIn || n || v, C = G(a) && Y(e, i) && !S, ee = (t) => {
148
+ }({}), Z = (e) => e === c.None ? u.WithoutLogin : u.WithLogin, Q = (e, t) => e === c.None ? t?.typeNone ?? "Open access" : e === c.OAuth ? t?.typeOAuth ?? "OAuth" : t?.typeApiKey ?? "API Key", he = ({ auth: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, endpoint: a, authActions: o, onOAuthLogin: s, onNotifySuccess: d, onNotifyError: p, onAuthChange: m, onEnsureSaved: h, labels: _ }) => {
149
+ let [v, y] = E(!1), [b, x] = E(!1), S = e.isLoggedIn || n || v, C = W(a) && J(e, i) && !S, w = (t) => {
156
150
  S || t === e.authenticationType || m({
157
151
  authenticationType: t,
158
- withLogin: Q(t)
152
+ withLogin: Z(t)
159
153
  });
160
154
  }, T = (e) => {
161
155
  m({ withLogin: e });
162
- }, te = (e) => {
156
+ }, ee = (e) => {
163
157
  switch (e.auth != null && m(e.auth), e.status) {
164
- case Z.Success:
165
- m({ isLoggedIn: !0 }), f(_?.loginSuccessMessage ?? "Successfully logged in.");
158
+ case X.Success:
159
+ m({ isLoggedIn: !0 }), d(_?.loginSuccessMessage ?? "Successfully logged in.");
166
160
  return;
167
- case Z.PopupBlocked:
161
+ case X.PopupBlocked:
168
162
  p(_?.errorPopupBlocked ?? "The login popup was blocked by your browser. Please allow popups for this site and try again.");
169
163
  return;
170
- case Z.InvalidConfig:
164
+ case X.InvalidConfig:
171
165
  p(_?.errorOAuthConfigMissing ?? "The OAuth provider did not return a valid client configuration. Please check the endpoint or contact your administrator.");
172
166
  return;
173
- case Z.Failed:
167
+ case X.Failed:
174
168
  p(_?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", e.traceId);
175
169
  return;
176
- case Z.Cancelled: return;
170
+ case X.Cancelled: return;
177
171
  }
178
- }, ne = async () => {
172
+ }, te = async () => {
179
173
  if (!C) return;
180
- if (e.authenticationType === s.OAuth) {
174
+ if (e.authenticationType === c.OAuth) {
181
175
  y(!0);
182
176
  try {
183
- te(await u({
177
+ ee(await s({
184
178
  auth: e,
185
- ensureSaved: g
179
+ ensureSaved: h
186
180
  }));
187
181
  } finally {
188
182
  y(!1);
189
183
  }
190
184
  return;
191
185
  }
192
- let t = await g();
186
+ let t = await h();
193
187
  if (t) {
194
188
  y(!0);
195
189
  try {
196
190
  let n = {
197
191
  url: t,
198
- credentialsLevel: c.User,
192
+ credentialsLevel: l.User,
199
193
  authenticationType: e.authenticationType,
200
194
  apiKey: e.apiKey?.trim()
201
195
  };
202
- await o.login(t, n), m({ isLoggedIn: !0 }), f(_?.loginSuccessMessage ?? "Successfully logged in.");
196
+ await o.login(t, n), m({ isLoggedIn: !0 }), d(_?.loginSuccessMessage ?? "Successfully logged in.");
203
197
  } catch (e) {
204
- let { traceId: t } = await d(e);
198
+ let { traceId: t } = await f(e);
205
199
  p(_?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
206
200
  } finally {
207
201
  y(!1);
208
202
  }
209
203
  }
210
- }, F = async () => {
204
+ }, D = async () => {
211
205
  y(!0);
212
206
  try {
213
207
  let t = {
214
208
  url: r,
215
- credentialsLevel: c.User,
209
+ credentialsLevel: l.User,
216
210
  authenticationType: e.authenticationType
217
211
  };
218
- await o.logout(r, t), m({ isLoggedIn: !1 }), x(!1), f(_?.logoutSuccessMessage ?? "Successfully logged out.");
212
+ await o.logout(r, t), m({ isLoggedIn: !1 }), x(!1), d(_?.logoutSuccessMessage ?? "Successfully logged out.");
219
213
  } catch (e) {
220
- let { traceId: t } = await d(e);
214
+ let { traceId: t } = await f(e);
221
215
  p(_?.errorLogoutFailed ?? "Failed to log out. Please try again.", t);
222
216
  } finally {
223
217
  y(!1);
224
218
  }
225
- }, L = () => e.isLoggedIn ? /* @__PURE__ */ D("div", {
219
+ }, I = () => e.isLoggedIn ? /* @__PURE__ */ O("div", {
226
220
  className: "flex",
227
- children: /* @__PURE__ */ D(M, {
221
+ children: /* @__PURE__ */ O(N, {
228
222
  label: _?.logOutLabel ?? "Log out",
229
- iconBefore: /* @__PURE__ */ D(re, {
230
- size: k.MD,
231
- stroke: A
223
+ iconBefore: /* @__PURE__ */ O(re, {
224
+ size: A.MD,
225
+ stroke: j
232
226
  }),
233
227
  onClick: () => x(!0),
234
228
  disabled: n || v
235
229
  })
236
- }) : /* @__PURE__ */ D("div", {
230
+ }) : /* @__PURE__ */ O("div", {
237
231
  className: "flex",
238
- children: /* @__PURE__ */ D(M, {
232
+ children: /* @__PURE__ */ O(N, {
239
233
  label: _?.logInLabel ?? "Log in",
240
- iconBefore: /* @__PURE__ */ D(E, {
241
- size: k.MD,
242
- stroke: A
234
+ iconBefore: /* @__PURE__ */ O(ne, {
235
+ size: A.MD,
236
+ stroke: j
243
237
  }),
244
- onClick: ne,
238
+ onClick: te,
245
239
  disabled: !C
246
240
  })
247
241
  });
248
- return /* @__PURE__ */ O("section", {
242
+ return /* @__PURE__ */ k("section", {
249
243
  className: "flex flex-col gap-2",
250
244
  children: [
251
- /* @__PURE__ */ D("h3", {
245
+ /* @__PURE__ */ O("h3", {
252
246
  className: "dial-h3-text",
253
247
  children: _?.sectionTitle ?? "Authentication"
254
248
  }),
255
- /* @__PURE__ */ D(I, {
249
+ /* @__PURE__ */ O(L, {
256
250
  "aria-label": _?.sectionTitle ?? "Authentication",
257
251
  value: e.authenticationType,
258
- onChange: (e) => ee(e),
252
+ onChange: (e) => w(e),
259
253
  segmentClassName: "px-2",
260
254
  items: [
261
- s.None,
262
- s.OAuth,
263
- s.ApiKey
255
+ c.None,
256
+ c.OAuth,
257
+ c.ApiKey
264
258
  ].map((t) => {
265
259
  let n = V[t];
266
260
  return {
267
261
  value: t,
268
- label: /* @__PURE__ */ O("div", {
262
+ label: /* @__PURE__ */ k("div", {
269
263
  className: "flex items-center gap-2",
270
- children: [/* @__PURE__ */ D(n, {
264
+ children: [/* @__PURE__ */ O(n, {
271
265
  className: "shrink-0",
272
- size: k.SM,
273
- stroke: A,
266
+ size: A.SM,
267
+ stroke: j,
274
268
  "aria-hidden": !0
275
- }), /* @__PURE__ */ D("span", {
269
+ }), /* @__PURE__ */ O("span", {
276
270
  className: "sr-only desktop:not-sr-only",
277
- children: he(t, _)
271
+ children: Q(t, _)
278
272
  })]
279
273
  }),
280
274
  disabled: S && e.authenticationType !== t
281
275
  };
282
276
  })
283
277
  }),
284
- e.authenticationType === s.None && /* @__PURE__ */ D("p", {
278
+ e.authenticationType === c.None && /* @__PURE__ */ O("p", {
285
279
  className: "dial-small-text pt-2 text-secondary",
286
280
  children: _?.openAccessDescription ?? "Open endpoint, no credentials"
287
281
  }),
288
- e.authenticationType === s.OAuth && /* @__PURE__ */ O("div", {
282
+ e.authenticationType === c.OAuth && /* @__PURE__ */ k("div", {
289
283
  className: "flex flex-col gap-3 pt-2",
290
284
  children: [
291
- /* @__PURE__ */ O("div", {
285
+ /* @__PURE__ */ k("div", {
292
286
  className: "flex flex-col gap-2",
293
- children: [/* @__PURE__ */ D(P, {
287
+ children: [/* @__PURE__ */ O(F, {
294
288
  name: "oauth-login-mode",
295
289
  id: "oauth-with-login",
296
- value: l.WithLogin,
290
+ value: u.WithLogin,
297
291
  labelProps: { label: _?.withLoginOAuthLabel ?? "Standard login" },
298
- isSelected: e.withLogin === l.WithLogin,
292
+ isSelected: e.withLogin === u.WithLogin,
299
293
  disabled: S,
300
294
  onChange: T
301
- }), /* @__PURE__ */ D(P, {
295
+ }), /* @__PURE__ */ O(F, {
302
296
  name: "oauth-login-mode",
303
297
  id: "oauth-with-config",
304
- value: l.WithConfig,
298
+ value: u.WithConfig,
305
299
  labelProps: { label: _?.withConfigOAuthLabel ?? "Custom login" },
306
- isSelected: e.withLogin === l.WithConfig,
300
+ isSelected: e.withLogin === u.WithConfig,
307
301
  disabled: S,
308
302
  onChange: T
309
303
  })]
310
304
  }),
311
- e.withLogin === l.WithConfig && /* @__PURE__ */ O("div", {
305
+ e.withLogin === u.WithConfig && /* @__PURE__ */ k("div", {
312
306
  className: "flex flex-col gap-3",
313
307
  children: [
314
- /* @__PURE__ */ D(j, {
308
+ /* @__PURE__ */ O(M, {
315
309
  id: "toolset-client-id",
316
310
  value: e.clientId ?? "",
317
311
  onChange: (e) => m({ clientId: e ?? "" }),
@@ -324,7 +318,7 @@ var se = {
324
318
  invalid: !!t.clientId,
325
319
  disabled: S
326
320
  }),
327
- /* @__PURE__ */ D(N, {
321
+ /* @__PURE__ */ O(P, {
328
322
  id: "toolset-client-secret",
329
323
  value: e.clientSecret ?? "",
330
324
  onChange: (e) => m({ clientSecret: e ?? "" }),
@@ -339,7 +333,7 @@ var se = {
339
333
  invalid: !!t.clientSecret,
340
334
  disabled: S
341
335
  }),
342
- /* @__PURE__ */ D(j, {
336
+ /* @__PURE__ */ O(M, {
343
337
  id: "toolset-authorization-endpoint",
344
338
  value: e.authorizationEndpoint ?? "",
345
339
  onChange: (e) => m({ authorizationEndpoint: e ?? "" }),
@@ -349,7 +343,7 @@ var se = {
349
343
  invalid: !!t.authorizationEndpoint,
350
344
  disabled: S
351
345
  }),
352
- /* @__PURE__ */ D(j, {
346
+ /* @__PURE__ */ O(M, {
353
347
  id: "toolset-token-endpoint",
354
348
  value: e.tokenEndpoint ?? "",
355
349
  onChange: (e) => m({ tokenEndpoint: e ?? "" }),
@@ -359,46 +353,46 @@ var se = {
359
353
  invalid: !!t.tokenEndpoint,
360
354
  disabled: S
361
355
  }),
362
- /* @__PURE__ */ D(oe, {
356
+ /* @__PURE__ */ O(R, {
363
357
  id: "toolset-scopes",
364
358
  labelProps: { label: _?.scopesLabel ?? "Scopes" },
365
359
  placeholder: _?.scopesPlaceholder ?? "Enter scopes",
366
360
  value: e.scopes ?? [],
367
361
  onChange: (e) => m({ scopes: e }),
368
362
  disabled: S,
369
- tagClassName: h
363
+ tagClassName: g
370
364
  })
371
365
  ]
372
366
  }),
373
- L()
367
+ I()
374
368
  ]
375
369
  }),
376
- e.authenticationType === s.ApiKey && /* @__PURE__ */ O("div", {
370
+ e.authenticationType === c.ApiKey && /* @__PURE__ */ k("div", {
377
371
  className: "flex flex-col gap-3 pt-2",
378
372
  children: [
379
- /* @__PURE__ */ O("div", {
373
+ /* @__PURE__ */ k("div", {
380
374
  className: "flex flex-col gap-2",
381
- children: [/* @__PURE__ */ D(P, {
375
+ children: [/* @__PURE__ */ O(F, {
382
376
  name: "apikey-login-mode",
383
377
  id: "apikey-with-login",
384
- value: l.WithLogin,
378
+ value: u.WithLogin,
385
379
  labelProps: { label: _?.withLoginLabel ?? "With login" },
386
- isSelected: e.withLogin === l.WithLogin,
380
+ isSelected: e.withLogin === u.WithLogin,
387
381
  disabled: S,
388
382
  onChange: T
389
- }), /* @__PURE__ */ D(P, {
383
+ }), /* @__PURE__ */ O(F, {
390
384
  name: "apikey-login-mode",
391
385
  id: "apikey-without-login",
392
- value: l.WithoutLogin,
386
+ value: u.WithoutLogin,
393
387
  labelProps: { label: _?.withoutLoginLabel ?? "Without login" },
394
- isSelected: e.withLogin === l.WithoutLogin,
388
+ isSelected: e.withLogin === u.WithoutLogin,
395
389
  disabled: S,
396
390
  onChange: T
397
391
  })]
398
392
  }),
399
- /* @__PURE__ */ O("div", {
393
+ /* @__PURE__ */ k("div", {
400
394
  className: "flex flex-col gap-3",
401
- children: [/* @__PURE__ */ D(j, {
395
+ children: [/* @__PURE__ */ O(M, {
402
396
  id: "toolset-key-header",
403
397
  value: e.keyHeader ?? "",
404
398
  onChange: (e) => m({ keyHeader: e ?? "" }),
@@ -410,7 +404,7 @@ var se = {
410
404
  error: t.keyHeader || void 0,
411
405
  invalid: !!t.keyHeader,
412
406
  disabled: S
413
- }), e.withLogin === l.WithLogin && /* @__PURE__ */ D(N, {
407
+ }), e.withLogin === u.WithLogin && /* @__PURE__ */ O(P, {
414
408
  id: "toolset-api-key",
415
409
  value: e.apiKey ?? "",
416
410
  onChange: (e) => m({ apiKey: e ?? "" }),
@@ -426,10 +420,10 @@ var se = {
426
420
  disabled: S
427
421
  })]
428
422
  }),
429
- e.withLogin !== l.WithoutLogin && L()
423
+ e.withLogin !== u.WithoutLogin && I()
430
424
  ]
431
425
  }),
432
- b && /* @__PURE__ */ D(ie, {
426
+ b && /* @__PURE__ */ O(ie, {
433
427
  open: b,
434
428
  header: _?.logoutConfirmTitle ?? "Log out?",
435
429
  description: _?.logoutConfirmDescription ?? "Are you sure you want to log out? You will need to re-enter your credentials to use this toolset again.",
@@ -438,34 +432,34 @@ var se = {
438
432
  variant: ae.Danger,
439
433
  isLoading: v,
440
434
  disableConfirmButton: v,
441
- onConfirm: F,
435
+ onConfirm: D,
442
436
  onCancel: () => x(!1),
443
437
  onClose: () => x(!1)
444
438
  })
445
439
  ]
446
440
  });
447
- }, _e = b(({ url: e, className: t, labels: n }) => {
448
- let { isCopied: r, copy: i } = v(e), a = n?.copiedLabel ?? "Copied!";
449
- return /* @__PURE__ */ O("div", {
450
- className: _("flex flex-col gap-3", t),
441
+ }, ge = x(({ url: e, className: t, labels: n }) => {
442
+ let { isCopied: r, copy: i } = y(e), a = n?.copiedLabel ?? "Copied!";
443
+ return /* @__PURE__ */ k("div", {
444
+ className: v("flex flex-col gap-3", t),
451
445
  children: [
452
- /* @__PURE__ */ O("div", {
446
+ /* @__PURE__ */ k("div", {
453
447
  className: "flex flex-col gap-1",
454
- children: [/* @__PURE__ */ D("p", {
448
+ children: [/* @__PURE__ */ O("p", {
455
449
  className: "dial-body-semi-text text-start text-primary",
456
450
  children: n?.title ?? "Connect toolset"
457
- }), /* @__PURE__ */ D("p", {
451
+ }), /* @__PURE__ */ O("p", {
458
452
  className: "dial-small-text text-start text-secondary",
459
453
  children: n?.description ?? "Copy endpoint URL to easily integrate toolset into your workflows"
460
454
  })]
461
455
  }),
462
- /* @__PURE__ */ D("div", { children: /* @__PURE__ */ D(f, {
456
+ /* @__PURE__ */ O("div", { children: /* @__PURE__ */ O(p, {
463
457
  copiedLabel: a,
464
458
  copyLabel: n?.copyLabel ?? "Copy URL",
465
459
  isCopied: r,
466
460
  onClick: i
467
461
  }) }),
468
- /* @__PURE__ */ D("span", {
462
+ /* @__PURE__ */ O("span", {
469
463
  role: "status",
470
464
  "aria-live": "polite",
471
465
  className: "sr-only",
@@ -473,16 +467,16 @@ var se = {
473
467
  })
474
468
  ]
475
469
  });
476
- }), ve = ({ form: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, connectUrl: a, listToolNames: o, authActions: s, onOAuthLogin: c, onNotifySuccess: l, onNotifyError: u, onChange: d, onAuthChange: f, onEnsureSaved: p, labels: m }) => {
477
- let [g, _] = w(null), v = !!a && !!r, y = C(() => [{
478
- value: R.Http,
470
+ }), _e = ({ form: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, connectUrl: a, listToolNames: o, authActions: s, onOAuthLogin: c, onNotifySuccess: l, onNotifyError: u, onChange: d, onAuthChange: f, onEnsureSaved: p, labels: m }) => {
471
+ let [h, _] = E(null), v = !!a && !!r, y = w(() => [{
472
+ value: z.Http,
479
473
  label: "HTTP"
480
474
  }, {
481
- value: R.Sse,
475
+ value: z.Sse,
482
476
  label: "SSE"
483
477
  }], []);
484
- return S(() => {
485
- if (!r || !o || !Y(e.auth, i)) {
478
+ return C(() => {
479
+ if (!r || !o || !J(e.auth, i)) {
486
480
  _(null);
487
481
  return;
488
482
  }
@@ -503,10 +497,10 @@ var se = {
503
497
  e.auth,
504
498
  e.endpoint,
505
499
  o
506
- ]), /* @__PURE__ */ O("div", {
500
+ ]), /* @__PURE__ */ k("div", {
507
501
  className: "flex max-w-[1060px] flex-col gap-4",
508
502
  children: [
509
- /* @__PURE__ */ D(j, {
503
+ /* @__PURE__ */ O(M, {
510
504
  id: "toolset-endpoint",
511
505
  value: e.endpoint,
512
506
  onChange: (e) => d({ endpoint: e ?? "" }),
@@ -519,7 +513,7 @@ var se = {
519
513
  error: t.endpoint || void 0,
520
514
  invalid: !!t.endpoint
521
515
  }),
522
- /* @__PURE__ */ D(F, {
516
+ /* @__PURE__ */ O(I, {
523
517
  labelProps: {
524
518
  label: m?.protocolLabel ?? "Protocol",
525
519
  required: !0
@@ -531,28 +525,28 @@ var se = {
531
525
  d({ protocol: e });
532
526
  }
533
527
  }),
534
- g ? /* @__PURE__ */ D(L, {
528
+ h ? /* @__PURE__ */ O(oe, {
535
529
  id: "toolset-allowed-tools",
536
530
  multiple: !0,
537
531
  searchable: !0,
538
532
  selectAll: !0,
539
533
  labelProps: { label: m?.allowedToolsLabel ?? "Allowed tools" },
540
534
  placeholder: m?.allowedToolsSelectPlaceholder ?? "Select allowed tools",
541
- options: g.map((e) => ({
535
+ options: h.map((e) => ({
542
536
  value: e,
543
537
  label: e
544
538
  })),
545
539
  value: e.allowedTools,
546
540
  onChange: (e) => d({ allowedTools: e })
547
- }) : /* @__PURE__ */ D(oe, {
541
+ }) : /* @__PURE__ */ O(R, {
548
542
  id: "toolset-allowed-tools",
549
543
  labelProps: { label: m?.allowedToolsLabel ?? "Allowed tools" },
550
544
  placeholder: m?.allowedToolsPlaceholder ?? "Add tools, comma separated",
551
545
  value: e.allowedTools,
552
546
  onChange: (e) => d({ allowedTools: e }),
553
- tagClassName: h
547
+ tagClassName: g
554
548
  }),
555
- /* @__PURE__ */ D(ge, {
549
+ /* @__PURE__ */ O(he, {
556
550
  auth: e.auth,
557
551
  errors: t,
558
552
  isSaving: n,
@@ -567,58 +561,58 @@ var se = {
567
561
  onEnsureSaved: p,
568
562
  labels: m?.auth
569
563
  }),
570
- v && /* @__PURE__ */ D(_e, {
564
+ v && /* @__PURE__ */ O(ge, {
571
565
  url: a ?? "",
572
566
  labels: m?.connect,
573
567
  className: "border-t border-tertiary pt-4"
574
568
  })
575
569
  ]
576
570
  });
577
- }, ye = [
571
+ }, ve = [
578
572
  "keyHeader",
579
573
  "apiKey",
580
574
  "clientId",
581
575
  "clientSecret",
582
576
  "authorizationEndpoint",
583
577
  "tokenEndpoint"
584
- ], be = ["endpoint", ...ye], $ = new Set(be), xe = (e) => {
578
+ ], ye = ["endpoint", ...ve], be = new Set(ye), xe = (e) => {
585
579
  let t = {};
586
- for (let n of Object.keys(e)) $.has(n) && (t[n] = !0);
580
+ for (let n of Object.keys(e)) be.has(n) && (t[n] = !0);
587
581
  return t;
588
- }, Se = ({ initialForm: r, toolsetId: i, onPersist: o, onPostSaveLogin: c, onToolsetsChanged: u, onSaveSuccess: f, onSaveComplete: h, onBack: _, buildMcpUrl: v, listToolNames: b, authActions: T, onOAuthLogin: te, onNotifySuccess: ne, onNotifyError: E, bucket: re, FileManagerModal: O, resolveIconUrl: ie, allowedMimeTypes: ae, maxFileSizeBytes: k, availableLocaleOptions: A, onRefineDescription: j, labels: M }) => {
589
- let N = !!i, [P, F] = w(""), I = i || P, [L, oe] = w({
590
- initialForm: r,
582
+ }, $ = ({ initialForm: e, toolsetId: i, onPersist: a, onPostSaveLogin: s, onToolsetsChanged: l, onSaveSuccess: d, onSaveComplete: p, onBack: g, buildMcpUrl: v, listToolNames: y, authActions: x, onOAuthLogin: ee, onNotifySuccess: te, onNotifyError: D, bucket: ne, FileManagerModal: re, resolveIconUrl: k, allowedMimeTypes: ie, maxFileSizeBytes: ae, availableLocaleOptions: A, onRefineDescription: j, labels: M }) => {
583
+ let N = !!i, [P, F] = E(""), I = i || P, [L, oe] = E({
584
+ initialForm: e,
591
585
  key: 0
592
586
  });
593
- L.initialForm !== r && oe({
594
- initialForm: r,
587
+ L.initialForm !== e && oe({
588
+ initialForm: e,
595
589
  key: L.key + 1
596
590
  });
597
- let { values: R, setValues: z, markTouched: B, visibleErrorCodes: V, attemptSubmit: H } = a({
598
- initialValues: C(() => fe(r), [r]),
591
+ let { values: R, setValues: z, markTouched: B, visibleErrorCodes: V, attemptSubmit: le } = o({
592
+ initialValues: w(() => de(e), [e]),
599
593
  validationOptions: ce,
600
594
  reseedKey: L.key
601
- }), [le, U] = w(r), W = C(() => ({
602
- ...le,
595
+ }), [H, U] = E(e), G = w(() => ({
596
+ ...H,
603
597
  ...R
604
- }), [le, R]), [K, q] = w(!1), [J, Y] = w({}), [de, X] = w({}), Z = ee(null);
605
- S(() => {
606
- U(r), Z.current = r, Y({}), X({}), F("");
607
- }, [r]);
608
- let Q = x((e) => {
609
- let { metadata: t, setup: r } = pe(e);
610
- Object.keys(t).length > 0 && (z(t), "name" in t && B(n.Name), "version" in t && B(n.Version)), Object.keys(r).length !== 0 && (U((e) => ({
598
+ }), [H, R]), [K, q] = E(!1), [J, Y] = E({}), [pe, X] = E({}), Z = T(null);
599
+ C(() => {
600
+ U(e), Z.current = e, Y({}), X({}), F("");
601
+ }, [e]);
602
+ let Q = S((e) => {
603
+ let { metadata: t, setup: n } = fe(e);
604
+ Object.keys(t).length > 0 && (z(t), "name" in t && B(r.Name), "version" in t && B(r.Version)), Object.keys(n).length !== 0 && (U((e) => ({
611
605
  ...e,
612
- ...r
606
+ ...n
613
607
  })), X((e) => ({
614
608
  ...e,
615
- ...xe(r)
609
+ ...xe(n)
616
610
  })), Y((e) => {
617
611
  let t = { ...e };
618
- for (let e of Object.keys(r)) delete t[e];
612
+ for (let e of Object.keys(n)) delete t[e];
619
613
  return t;
620
614
  }));
621
- }, [z, B]), he = x((e) => {
615
+ }, [z, B]), he = S((e) => {
622
616
  U((t) => ({
623
617
  ...t,
624
618
  auth: {
@@ -630,68 +624,68 @@ var se = {
630
624
  ...xe(e)
631
625
  })), Y((t) => {
632
626
  let n = { ...t };
633
- if ("authenticationType" in e || "withLogin" in e || "isLoggedIn" in e) for (let e of ye) delete n[e];
627
+ if ("authenticationType" in e || "withLogin" in e || "isLoggedIn" in e) for (let e of ve) delete n[e];
634
628
  else for (let t of Object.keys(e)) delete n[t];
635
629
  return n;
636
- }), "isLoggedIn" in e && u();
637
- }, [u]), ge = x(async () => {
638
- if (I && Z.current != null && JSON.stringify(Z.current) === JSON.stringify(W)) return I;
630
+ }), "isLoggedIn" in e && l();
631
+ }, [l]), ge = S(async () => {
632
+ if (I && Z.current != null && JSON.stringify(Z.current) === JSON.stringify(G)) return I;
639
633
  q(!0);
640
634
  try {
641
- let e = await o(W, I);
642
- return e ? (I || F(e), Z.current = W, await u(), e) : null;
635
+ let e = await a(G, I);
636
+ return e ? (I || F(e), Z.current = G, await l(), e) : null;
643
637
  } catch {
644
638
  return null;
645
639
  } finally {
646
640
  q(!1);
647
641
  }
648
642
  }, [
649
- W,
643
+ G,
650
644
  I,
651
- o,
652
- u
653
- ]), _e = x(async () => await ge() ?? !1, [ge]), $ = x((e) => {
645
+ a,
646
+ l
647
+ ]), be = S(async () => await ge() ?? !1, [ge]), $ = S((e) => {
654
648
  let t = M?.validation, n = {};
655
- return e.endpoint.trim() ? G(e.endpoint) || (n.endpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL") : n.endpoint = t?.endpointRequired ?? "Endpoint is required", e.auth.isLoggedIn || (e.auth.authenticationType === s.ApiKey && (e.auth.keyHeader?.trim() || (n.keyHeader = t?.keyHeaderRequired ?? "Key name is required"), e.auth.withLogin === l.WithLogin && !e.auth.apiKey?.trim() && (n.apiKey = t?.apiKeyRequired ?? "API key is required")), e.auth.authenticationType === s.OAuth && e.auth.withLogin === l.WithConfig && (e.auth.clientId?.trim() || (n.clientId = t?.clientIdRequired ?? "Client ID is required"), !N && !e.auth.clientSecret?.trim() && (n.clientSecret = t?.clientSecretRequired ?? "Client secret is required"), e.auth.authorizationEndpoint?.trim() && !G(e.auth.authorizationEndpoint) && (n.authorizationEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL"), e.auth.tokenEndpoint?.trim() && !G(e.auth.tokenEndpoint) && (n.tokenEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL"))), n;
656
- }, [M, N]), Se = x(async () => {
657
- let e = H(), t = $(W);
649
+ return e.endpoint.trim() ? W(e.endpoint) || (n.endpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL") : n.endpoint = t?.endpointRequired ?? "Endpoint is required", e.auth.isLoggedIn || (e.auth.authenticationType === c.ApiKey && (e.auth.keyHeader?.trim() || (n.keyHeader = t?.keyHeaderRequired ?? "Key name is required"), e.auth.withLogin === u.WithLogin && !e.auth.apiKey?.trim() && (n.apiKey = t?.apiKeyRequired ?? "API key is required")), e.auth.authenticationType === c.OAuth && e.auth.withLogin === u.WithConfig && (e.auth.clientId?.trim() || (n.clientId = t?.clientIdRequired ?? "Client ID is required"), !N && !e.auth.clientSecret?.trim() && (n.clientSecret = t?.clientSecretRequired ?? "Client secret is required"), e.auth.authorizationEndpoint?.trim() && !W(e.auth.authorizationEndpoint) && (n.authorizationEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL"), e.auth.tokenEndpoint?.trim() && !W(e.auth.tokenEndpoint) && (n.tokenEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL"))), n;
650
+ }, [M, N]), Se = S(async () => {
651
+ let e = le(), t = $(G);
658
652
  if (!e || Object.keys(t).length > 0) {
659
653
  Y(t);
660
654
  return;
661
655
  }
662
656
  Y({}), q(!0);
663
657
  try {
664
- let e = await o(W, I);
658
+ let e = await a(G, I);
665
659
  if (!e) return;
666
- await u(), f(W);
660
+ await l(), d(G);
667
661
  try {
668
- await c(e, W.auth), h();
662
+ await s(e, G.auth), p();
669
663
  } catch (e) {
670
- let { traceId: t } = await d(e);
671
- E(M?.settings?.auth?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
664
+ let { traceId: t } = await f(e);
665
+ D(M?.settings?.auth?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
672
666
  }
673
667
  } catch {} finally {
674
668
  q(!1);
675
669
  }
676
670
  }, [
677
- H,
678
- W,
671
+ le,
672
+ G,
679
673
  $,
680
674
  I,
681
- o,
682
- u,
683
- f,
684
- h,
685
- c,
686
- E,
675
+ a,
676
+ l,
677
+ d,
678
+ p,
679
+ s,
680
+ D,
687
681
  M
688
- ]), Ce = y({
682
+ ]), Ce = b({
689
683
  value: R.description,
690
684
  onChange: (e) => Q({ description: e }),
691
685
  onRefine: j,
692
686
  disabled: K,
693
687
  resetKey: L.key
694
- }), we = j ? (e, t) => /* @__PURE__ */ D(g, {
688
+ }), we = j ? (e, t) => /* @__PURE__ */ O(_, {
695
689
  isEnabled: !0,
696
690
  fieldId: t,
697
691
  label: M?.general?.form?.description.label ?? "Description",
@@ -699,26 +693,26 @@ var se = {
699
693
  refinement: Ce,
700
694
  disabled: Ce.isPending || K,
701
695
  children: e
702
- }) : void 0, Te = C(() => !ue(W, N), [W, N]), Ee = C(() => {
703
- let t = M?.validation, n = $(W), r = { ...J };
704
- for (let e of be) {
705
- if (!de[e]) continue;
696
+ }) : void 0, Te = w(() => !ue(G, N), [G, N]), Ee = w(() => {
697
+ let e = M?.validation, n = $(G), r = { ...J };
698
+ for (let e of ye) {
699
+ if (!pe[e]) continue;
706
700
  let t = n[e];
707
701
  t ? r[e] = t : delete r[e];
708
702
  }
709
- return V.name === e.Required ? r.name = t?.nameRequired ?? "Name is required" : V.name === e.TooLong ? r.name = t?.nameTooLong ?? `Use ${m} characters or fewer.` : V.name === e.ControlCharacters && (r.name = t?.nameControlCharacters ?? "Remove line breaks, tabs and other control characters."), V.description === e.TooLong && (r.description = t?.descriptionTooLong ?? `Use ${p} characters or fewer.`), V.version === e.InvalidFormat && (r.version = t?.versionInvalid ?? "Version must follow semantic versioning (e.g., 1.0.0)"), r;
703
+ return V.name === t.Required ? r.name = e?.nameRequired ?? "Name is required" : V.name === t.TooLong ? r.name = e?.nameTooLong ?? `Use ${h} characters or fewer.` : V.name === t.ControlCharacters && (r.name = e?.nameControlCharacters ?? "Remove line breaks, tabs and other control characters."), V.description === t.TooLong && (r.description = e?.descriptionTooLong ?? `Use ${m} characters or fewer.`), V.version === t.InvalidFormat && (r.version = e?.versionInvalid ?? "Version must follow semantic versioning (e.g., 1.0.0)"), r;
710
704
  }, [
711
- de,
705
+ pe,
712
706
  J,
713
- W,
707
+ G,
714
708
  M,
715
709
  V,
716
710
  $
717
711
  ]), De = v && I ? v(I) : void 0;
718
- return /* @__PURE__ */ D(t, {
712
+ return /* @__PURE__ */ O(n, {
719
713
  title: N ? M?.layout?.editTitle ?? "Edit toolset" : M?.layout?.createTitle ?? "Create toolset",
720
- onBack: _,
721
- onCancel: _,
714
+ onBack: g,
715
+ onCancel: g,
722
716
  onSubmit: Se,
723
717
  submitLabel: N ? M?.layout?.saveLabel ?? "Save" : M?.layout?.createLabel ?? "Create",
724
718
  isSubmitting: K,
@@ -732,37 +726,37 @@ var se = {
732
726
  setupTitle: M?.layout?.setupSectionTitle ?? "Setup",
733
727
  cancelLabel: M?.layout?.cancelLabel ?? "Cancel"
734
728
  },
735
- metadata: /* @__PURE__ */ D(me, {
736
- form: W,
729
+ metadata: /* @__PURE__ */ O(me, {
730
+ form: G,
737
731
  errors: Ee,
738
- bucket: re,
739
- FileManagerModal: O,
740
- resolveIconUrl: ie,
741
- allowedMimeTypes: ae,
742
- maxFileSizeBytes: k,
732
+ bucket: ne,
733
+ FileManagerModal: re,
734
+ resolveIconUrl: k,
735
+ allowedMimeTypes: ie,
736
+ maxFileSizeBytes: ae,
743
737
  availableLocaleOptions: A,
744
738
  onChange: Q,
745
739
  renderDescription: we,
746
740
  labels: M?.general
747
741
  }),
748
- setup: /* @__PURE__ */ D(ve, {
749
- form: W,
742
+ setup: /* @__PURE__ */ O(_e, {
743
+ form: G,
750
744
  errors: Ee,
751
745
  isSaving: K,
752
746
  toolsetId: I,
753
747
  isEditMode: N,
754
748
  connectUrl: De,
755
- listToolNames: b,
756
- authActions: T,
757
- onOAuthLogin: te,
758
- onNotifySuccess: ne,
759
- onNotifyError: E,
749
+ listToolNames: y,
750
+ authActions: x,
751
+ onOAuthLogin: ee,
752
+ onNotifySuccess: te,
753
+ onNotifyError: D,
760
754
  onChange: Q,
761
755
  onAuthChange: he,
762
- onEnsureSaved: _e,
756
+ onEnsureSaved: be,
763
757
  labels: M?.settings
764
758
  })
765
759
  });
766
760
  };
767
761
  //#endregion
768
- export { V as AUTH_TYPE_ICONS, z as DEFAULT_TOOLSET_NAME, B as DEFAULT_TOOLSET_VERSION, me as GeneralForm, se as TOOLSET_EDITOR_CLASS, Se as ToolsetEditor, Z as ToolsetOAuthLoginStatus, R as ToolsetTransportType, U as getDefaultToolsetForm, H as getStorageSafeUniqueToolsetName, Y as isToolsetAuthValid, ue as isToolsetFormValid, G as isValidEndpointUrl, q as normalizeReturnedEndpointUrl };
762
+ export { V as AUTH_TYPE_ICONS, B as DEFAULT_TOOLSET_VERSION, me as GeneralForm, se as TOOLSET_EDITOR_CLASS, $ as ToolsetEditor, X as ToolsetOAuthLoginStatus, z as ToolsetTransportType, H as getDefaultToolsetForm, J as isToolsetAuthValid, ue as isToolsetFormValid, W as isValidEndpointUrl, K as normalizeReturnedEndpointUrl };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-toolset-editor",
3
3
  "description": "Host-agnostic form for authoring and editing a DIAL MCP toolset",
4
- "version": "1.2.0-rc.1",
4
+ "version": "1.3.0-dev.6",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -18,11 +18,11 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@tabler/icons-react": "^3.44.0",
21
- "@epam/ai-dial-builder-form": "1.2.0-rc.1"
21
+ "@epam/ai-dial-builder-form": "1.3.0-dev.6"
22
22
  },
23
23
  "peerDependencies": {
24
- "@epam/ai-dial-chat-hooks": "1.2.0-rc.1",
25
- "@epam/ai-dial-chat-shared": "1.2.0-rc.1",
24
+ "@epam/ai-dial-chat-hooks": "1.3.0-dev.6",
25
+ "@epam/ai-dial-chat-shared": "1.3.0-dev.6",
26
26
  "@epam/ai-dial-ui-kit": "^0.15.0",
27
27
  "react": "^19.2.8"
28
28
  },
@@ -1,17 +1,7 @@
1
1
  import { DeploymentCreationFormValues } from '../../../builder-form/src/index.ts';
2
2
  import { ToolsetAuthFormData, ToolsetFormData } from '../models/toolset-form';
3
- /**
4
- * Returns a storage-safe toolset name that does not collide with any existing
5
- * name, appending a numeric suffix when the default name is taken.
6
- */
7
- export declare const getStorageSafeUniqueToolsetName: ({ defaultName, existingNames, }: {
8
- /** Candidate name to make unique. Defaults to `DEFAULT_TOOLSET_NAME`. */
9
- defaultName?: string;
10
- /** Names already taken by the user's toolsets. */
11
- existingNames: string[];
12
- }) => string;
13
- /** Returns the form state a brand-new toolset editor opens with. */
14
- export declare const getDefaultToolsetForm: (existingNames?: string[]) => ToolsetFormData;
3
+ /** Returns the form state a brand-new toolset editor opens with: an empty name and the default version. */
4
+ export declare const getDefaultToolsetForm: () => ToolsetFormData;
15
5
  /** Validates a toolset endpoint URL (http(s), parseable, no trailing `.`/`//`). */
16
6
  export declare const isValidEndpointUrl: (value: string) => boolean;
17
7
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"toolsets.d.ts","sourceRoot":"","sources":["../../src/utils/toolsets.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,4BAA4B,CAAC;AAQpC,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,+BAA+B,GAAI,iCAG7C;IACD,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,KAAG,MAOH,CAAC;AAQF,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,GAChC,gBAAe,MAAM,EAAO,KAC3B,eAWD,CAAC;AAmBH,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,KAAG,OACR,CAAC;AAK5C;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,GAAI,QAAQ,MAAM,KAAG,MAkB7D,CAAC;AAKF;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAC7B,MAAM,mBAAmB,EACzB,oBAAkB,KACjB,OAmBF,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,kBAAkB,GAC7B,MAAM,eAAe,EACrB,oBAAkB,KACjB,OAKwC,CAAC;AAW5C,4DAA4D;AAC5D,eAAO,MAAM,mBAAmB,GAC9B,MAAM,eAAe,KACpB,4BAOD,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,GAChC,OAAO,OAAO,CAAC,eAAe,CAAC,KAC9B;IACD,QAAQ,EAAE,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAChD,KAAK,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CAWjC,CAAC"}
1
+ {"version":3,"file":"toolsets.d.ts","sourceRoot":"","sources":["../../src/utils/toolsets.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,4BAA4B,CAAC;AAOpC,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAQhC,2GAA2G;AAC3G,eAAO,MAAM,qBAAqB,QAAO,eAWvC,CAAC;AAmBH,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,KAAG,OACR,CAAC;AAK5C;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,GAAI,QAAQ,MAAM,KAAG,MAkB7D,CAAC;AAKF;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAC7B,MAAM,mBAAmB,EACzB,oBAAkB,KACjB,OAmBF,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,kBAAkB,GAC7B,MAAM,eAAe,EACrB,oBAAkB,KACjB,OAKwC,CAAC;AAW5C,4DAA4D;AAC5D,eAAO,MAAM,mBAAmB,GAC9B,MAAM,eAAe,KACpB,4BAOD,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,GAChC,OAAO,OAAO,CAAC,eAAe,CAAC,KAC9B;IACD,QAAQ,EAAE,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAChD,KAAK,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CAWjC,CAAC"}