@epam/ai-dial-chat-hooks 1.2.8 → 1.2.9

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 (62) hide show
  1. package/api-error/api-error.js +2 -2
  2. package/api-transport/create-unauthorized-middleware.js +4 -1
  3. package/attachment/useAttachmentAction/useAttachmentAction.js +5 -8
  4. package/catalog/map-entity-details-to-catalog.js +1 -1
  5. package/catalog/map-skill-to-catalog-item.js +1 -5
  6. package/catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.js +1 -1
  7. package/catalog/usePublishFolders/usePublishFolders.js +1 -1
  8. package/catalog/useSkillItemDetails.js +3 -3
  9. package/conversation/conversation-transfer/import-conversation.js +7 -8
  10. package/conversation/conversation-transfer/progress.js +1 -1
  11. package/conversation/conversation-transfer/zip-export.js +1 -7
  12. package/conversation/conversation-transfer/zip-import.js +1 -1
  13. package/conversation/create-chat-stream-api.js +1 -5
  14. package/conversation/useAttachmentUpload/useAttachmentUpload.js +4 -1
  15. package/conversation/useConversationExport/useConversationExport.js +11 -12
  16. package/conversation/useConversationHandlers/message-utils.js +2 -2
  17. package/conversation/useConversationHandlers/useConversationHandlers.js +2 -2
  18. package/conversation/useConversationImport/useConversationImport.js +24 -24
  19. package/conversation/useConversationScroll/useConversationScroll.js +2 -6
  20. package/conversation/useConversationStream/conversation-path.js +2 -2
  21. package/conversation/useConversationStream/frame-scheduler.js +17 -17
  22. package/conversation/useConversationStream/generation-resume.js +11 -21
  23. package/conversation/useConversationStream/useConversationStream.js +39 -60
  24. package/conversation/useMessageSelectionReply/useMessageSelectionReply.js +4 -10
  25. package/conversation-overlay.js +1 -2
  26. package/conversation-sources.js +1 -2
  27. package/file-manager-canvas.js +1 -2
  28. package/files/attachment-types.js +1 -1
  29. package/files/create-upload-file-with-progress.js +5 -12
  30. package/files/dial-file-manager-mapping.util.js +3 -3
  31. package/files/dial-file-to-attachment.js +3 -3
  32. package/files/source-content.js +1 -1
  33. package/files/useDialFileListing/useDialFileListing.js +45 -58
  34. package/files/useDialFileManagerSections/useDialFileManagerSections.js +53 -69
  35. package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +1 -1
  36. package/files/useDialFileMetadata/useDialFileMetadata.js +3 -3
  37. package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +1 -1
  38. package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +2 -2
  39. package/mcp-apps/useMcpAppTools/useMcpAppTools.js +3 -6
  40. package/oauth/authorize-url.js +1 -1
  41. package/oauth/handshake.js +3 -10
  42. package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.js +2 -5
  43. package/oauth/useToolsetLogin/useToolsetLogin.js +2 -1
  44. package/package.json +16 -16
  45. package/scheduled-task/scheduled-task-description.js +1 -1
  46. package/scheduled-task/scheduled-task-trigger.js +1 -1
  47. package/scheduled-task/use-scheduled-task-runs.js +6 -18
  48. package/scheduled-task/use-scheduled-tasks.js +1 -1
  49. package/scroll-anchoring.js +1 -2
  50. package/shared/application-schema.js +3 -3
  51. package/shared/cron-day-of-month.js +10 -10
  52. package/shared/locale.js +2 -2
  53. package/skill/skill-file-batch-validation.js +18 -17
  54. package/skill/skill-types.js +1 -1
  55. package/skill/skill.js +12 -15
  56. package/skill/useSkillArchiveImport/useSkillArchiveImport.js +1 -7
  57. package/skill/useSkillEditorSubmit.js +1 -5
  58. package/skills-state.js +1 -2
  59. package/source-content.js +1 -2
  60. package/usage/useUsageLimitBanner/useUsageLimitBanner.js +1 -1
  61. package/usage/useUsageLimitBannerDismissal/useUsageLimitBannerDismissal.js +1 -1
  62. package/usePageFileDrag/usePageFileDrag.js +3 -3
@@ -24,7 +24,7 @@ var f = ({ fileManagerOptions: f, bucket: p, forbiddenSymbolsRegExp: m, tabLabel
24
24
  forbiddenSymbolsRegExp: m
25
25
  }), [j, M] = c(A.sectionTab);
26
26
  j !== A.sectionTab && (M(A.sectionTab), E(/* @__PURE__ */ new Set()));
27
- let N = o((e) => v == null || v.length === 0 ? !0 : l(e, v), [v]);
27
+ let N = o((e) => v == null || v.length === 0 || l(e, v), [v]);
28
28
  return {
29
29
  controller: A,
30
30
  activeTab: x,
@@ -34,7 +34,7 @@ var f = ({ fileManagerOptions: f, bucket: p, forbiddenSymbolsRegExp: m, tabLabel
34
34
  onSelectedPathsChange: D,
35
35
  isRowSelectable: o((e) => {
36
36
  let t = e.data;
37
- return t == null || a(t.path) ? !1 : t.nodeType === u.FOLDER ? b : t.nodeType === u.ITEM ? !(t.contentType != null && !N(t.contentType) || y != null && t.contentLength != null && t.contentLength > y) : !1;
37
+ return t == null || a(t.path) ? !1 : t.nodeType === u.FOLDER ? b : t.nodeType === u.ITEM && !(t.contentType != null && !N(t.contentType) || y != null && t.contentLength != null && t.contentLength > y);
38
38
  }, [
39
39
  b,
40
40
  N,
@@ -4,18 +4,15 @@ import { collectToolCallNames as i } from "@epam/ai-dial-mcp-apps";
4
4
  var a = (a, o, s, c) => {
5
5
  let [l, u] = r([]), [d, f] = r([]), p = n(/* @__PURE__ */ new Set());
6
6
  e(() => {
7
- if (p.current = /* @__PURE__ */ new Set(), f([]), o?.features?.mcp !== !0) {
8
- u([]);
9
- return;
10
- }
11
- if (o.type !== "toolset" && o.type !== "application") {
7
+ if (p.current = /* @__PURE__ */ new Set(), f([]), o?.features?.mcp !== !0 || o.type !== "toolset" && o.type !== "application") {
12
8
  u([]);
13
9
  return;
14
10
  }
15
11
  let e = o.id, t = o.type;
16
12
  (async () => {
17
13
  try {
18
- u((await a.listAppTools(e, t)).map(({ resourceUri: n, toolName: r }) => ({
14
+ let n = await a.listAppTools(e, t);
15
+ u(n.map(({ resourceUri: n, toolName: r }) => ({
19
16
  toolsetId: e,
20
17
  resourceUri: n,
21
18
  toolName: r,
@@ -1,5 +1,5 @@
1
1
  //#region src/oauth/authorize-url.ts
2
- var e = (e) => `${window.location.origin}${e}`, t = new Set(["http:", "https:"]), n = (e, n, r) => {
2
+ var e = (e) => `${window.location.origin}${e}`, t = /* @__PURE__ */ new Set(["http:", "https:"]), n = (e, n, r) => {
3
3
  if (!e.authorizationEndpoint?.trim() || !e.clientId?.trim()) return null;
4
4
  try {
5
5
  let i = new URL(e.authorizationEndpoint.trim());
@@ -1,6 +1,6 @@
1
1
  import { ToolsetOAuthCallbackQuery as e, ToolsetOAuthChannelControlType as t, ToolsetOAuthFailureReason as n, ToolsetOAuthResultType as r } from "./types.js";
2
2
  //#region src/oauth/handshake.ts
3
- var i = "toolset-oauth-", a = (e) => `${i}${e}`, o = 300 * 1e3, s = 500, c = (e) => {
3
+ var i = "toolset-oauth-", a = (e) => `${i}${e}`, o = 3e5, s = 500, c = (e) => {
4
4
  switch (e) {
5
5
  case n.MissingCode:
6
6
  case n.MissingRedirectState:
@@ -38,11 +38,7 @@ var i = "toolset-oauth-", a = (e) => `${i}${e}`, o = 300 * 1e3, s = 500, c = (e)
38
38
  return null;
39
39
  }, b = () => {
40
40
  let e = y();
41
- if (e != null) {
42
- v(e);
43
- return;
44
- }
45
- n.closed && _({ type: r.Cancelled });
41
+ e == null ? n.closed && _({ type: r.Cancelled }) : v(e);
46
42
  };
47
43
  try {
48
44
  s = new BroadcastChannel(a(i)), s.onmessage = (e) => {
@@ -52,10 +48,7 @@ var i = "toolset-oauth-", a = (e) => `${i}${e}`, o = 300 * 1e3, s = 500, c = (e)
52
48
  window.addEventListener("focus", b);
53
49
  let x = setInterval(() => {
54
50
  let e = y();
55
- if (e != null) {
56
- v(e);
57
- return;
58
- }
51
+ e != null && v(e);
59
52
  }, m), S = setTimeout(() => {
60
53
  n.close(), _({ type: r.Cancelled });
61
54
  }, p), C = y();
@@ -16,11 +16,8 @@ var u = 500, d = (e) => typeof e == "object" && !!e && "type" in e && e.type ===
16
16
  } catch {}
17
17
  }, m = (e, t) => {
18
18
  let r = new URL(window.location.pathname, window.location.origin);
19
- if (r.searchParams.set(n.Result, t.type), t.type === a.Failure && r.searchParams.set(n.FailureReason, t.reason), p(r), !e) {
20
- window.close();
21
- return;
22
- }
23
- try {
19
+ if (r.searchParams.set(n.Result, t.type), t.type === a.Failure && r.searchParams.set(n.FailureReason, t.reason), p(r), !e) window.close();
20
+ else try {
24
21
  let n = new BroadcastChannel(o(e));
25
22
  n.postMessage(t);
26
23
  let r = setInterval(() => {
@@ -40,7 +40,8 @@ var f = /* @__PURE__ */ function(e) {
40
40
  }), { type: "success" };
41
41
  if (S.type === i.Failure) return { type: "failure" };
42
42
  try {
43
- if (a((await h(p)).authSettings, m) === t.SignedIn) return o({
43
+ let e = await h(p);
44
+ if (a(e.authSettings, m) === t.SignedIn) return o({
44
45
  toolsetId: p,
45
46
  credentialsLevel: m
46
47
  }), { type: "success" };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-chat-hooks",
3
3
  "description": "Framework-level React hooks extracted from AI DIAL Chat for building custom chat interfaces",
4
- "version": "1.2.8",
4
+ "version": "1.2.9",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -116,7 +116,7 @@
116
116
  }
117
117
  },
118
118
  "dependencies": {
119
- "@epam/ai-dial-chat-api-client": "1.2.8",
119
+ "@epam/ai-dial-chat-api-client": "1.2.9",
120
120
  "dompurify": "3.4.16",
121
121
  "fflate": "^0.8.3",
122
122
  "lru-cache": "^10.4.3",
@@ -125,22 +125,22 @@
125
125
  },
126
126
  "peerDependencies": {
127
127
  "react": "^19.2.8",
128
- "@epam/ai-dial-attachment-canvas": "1.2.8",
129
- "@epam/ai-dial-attachment-input": "1.2.8",
130
- "@epam/ai-dial-catalog": "1.2.8",
131
- "@epam/ai-dial-chat-overlay": "1.2.8",
132
- "@epam/ai-dial-chat-shared": "1.2.8",
133
- "@epam/ai-dial-conversation-input": "1.2.8",
134
- "@epam/ai-dial-mcp-apps": "1.2.8",
135
- "@epam/ai-dial-publish-panel": "1.2.8",
136
- "@epam/ai-dial-quotations": "1.2.8",
128
+ "@epam/ai-dial-attachment-canvas": "1.2.9",
129
+ "@epam/ai-dial-attachment-input": "1.2.9",
130
+ "@epam/ai-dial-catalog": "1.2.9",
131
+ "@epam/ai-dial-chat-overlay": "1.2.9",
132
+ "@epam/ai-dial-chat-shared": "1.2.9",
133
+ "@epam/ai-dial-conversation-input": "1.2.9",
134
+ "@epam/ai-dial-mcp-apps": "1.2.9",
135
+ "@epam/ai-dial-publish-panel": "1.2.9",
136
+ "@epam/ai-dial-quotations": "1.2.9",
137
137
  "@epam/ai-dial-react-file-manager": "^0.3.5",
138
- "@epam/ai-dial-scheduled-tasks": "1.2.8",
139
- "@epam/ai-dial-share": "1.2.8",
140
- "@epam/ai-dial-skill-editor": "1.2.8",
141
- "@epam/ai-dial-source-panel": "1.2.8",
138
+ "@epam/ai-dial-scheduled-tasks": "1.2.9",
139
+ "@epam/ai-dial-share": "1.2.9",
140
+ "@epam/ai-dial-skill-editor": "1.2.9",
141
+ "@epam/ai-dial-source-panel": "1.2.9",
142
142
  "@epam/ai-dial-ui-kit": "^0.15.4",
143
- "@epam/ai-dial-usage-dashboard": "1.2.8",
143
+ "@epam/ai-dial-usage-dashboard": "1.2.9",
144
144
  "@modelcontextprotocol/sdk": "^1.32.1",
145
145
  "@epam/pdf-highlighter-kit": "^0.0.19",
146
146
  "@mcp-ui/client": "^7.1.1"
@@ -33,7 +33,7 @@ var t = /* @__PURE__ */ function(e) {
33
33
  "minute",
34
34
  "day",
35
35
  "day_of_week"
36
- ].includes(e) && t !== "*" && !(e === "second" && t === "0")) return o();
36
+ ].includes(e) && t !== "*" && (e !== "second" || t !== "0")) return o();
37
37
  }
38
38
  let c = a.hour, l = a.minute, u = a.day === "*" ? void 0 : a.day, d = u === e, f = a.day_of_week === "*" ? void 0 : a.day_of_week, p = f ? [
39
39
  "monday",
@@ -4,7 +4,7 @@ import { getUtcDayShift as n, toLocalDayOfMonth as r, toUtcCronDayOfMonth as i }
4
4
  import { apSchedulerDayToJsDay as a, jsDayToApSchedulerDay as o } from "../shared/cron-weekday.js";
5
5
  import { ScheduledTaskRepeat as s } from "@epam/ai-dial-scheduled-tasks";
6
6
  //#region src/scheduled-task/scheduled-task-trigger.ts
7
- var c = new Set([
7
+ var c = /* @__PURE__ */ new Set([
8
8
  "hour",
9
9
  "minute",
10
10
  "day_of_week",
@@ -72,7 +72,7 @@ var a = 15e3, o = 48, s = 5e3, c = 2147483647, l = (e, t) => {
72
72
  if (j.current !== t) return;
73
73
  v((e) => {
74
74
  let t = new Set(e.map(({ id: e }) => e));
75
- return [...e, ...r.items.filter(({ id: e }) => t.has(e) ? !1 : (t.add(e), !0))];
75
+ return [...e, ...r.items.filter(({ id: e }) => !t.has(e) && (t.add(e), !0))];
76
76
  }), M.current = n + r.items.length, O(r.next != null || (r.count == null ? r.items.length === m : n + r.items.length < r.count));
77
77
  } catch (e) {
78
78
  j.current === t && E(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load more scheduled task runs"));
@@ -111,28 +111,16 @@ var a = 15e3, o = 48, s = 5e3, c = 2147483647, l = (e, t) => {
111
111
  f,
112
112
  m
113
113
  ]), G = e(() => {
114
- if (document.visibilityState !== "visible") {
115
- V.current = !0;
116
- return;
117
- }
118
- W();
114
+ document.visibilityState === "visible" ? W() : V.current = !0;
119
115
  }, [W]);
120
116
  return t(() => {
121
117
  if (!p || !f || !H) return;
122
118
  z.current = 0;
123
119
  let e = setInterval(() => {
124
- if (document.visibilityState !== "visible") {
125
- V.current = !0;
126
- return;
127
- }
128
- (async () => {
120
+ document.visibilityState === "visible" ? (async () => {
129
121
  let t = await W();
130
- if (t === "changed") {
131
- z.current = 0;
132
- return;
133
- }
134
- (t === "unchanged" || t === "error") && (z.current += 1, z.current >= o && e !== null && (clearInterval(e), e = null));
135
- })();
122
+ t === "changed" ? z.current = 0 : (t === "unchanged" || t === "error") && (z.current += 1, z.current >= o && e !== null && (clearInterval(e), e = null));
123
+ })() : V.current = !0;
136
124
  }, a);
137
125
  return () => {
138
126
  e !== null && clearInterval(e);
@@ -156,7 +144,7 @@ var a = 15e3, o = 48, s = 5e3, c = 2147483647, l = (e, t) => {
156
144
  ]), t(() => {
157
145
  if (!p || !f) return;
158
146
  let e = () => {
159
- document.visibilityState !== "visible" || !V.current || (async () => {
147
+ document.visibilityState === "visible" && V.current && (async () => {
160
148
  await W() !== "skipped" && (V.current = !1);
161
149
  })();
162
150
  };
@@ -59,7 +59,7 @@ var i = (i, { enabled: a = !0, pageSize: o = 20, debounceMs: s = 300, initialSea
59
59
  if (k.current !== t) return;
60
60
  f((e) => {
61
61
  let t = new Set(e.map(({ id: e }) => e));
62
- return [...e, ...r.items.filter(({ id: e }) => t.has(e) ? !1 : (t.add(e), !0))];
62
+ return [...e, ...r.items.filter(({ id: e }) => !t.has(e) && (t.add(e), !0))];
63
63
  }), A.current = n + r.items.length, E(r.next != null);
64
64
  } catch (e) {
65
65
  k.current === t && w(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load more scheduled tasks"));
@@ -1,2 +1 @@
1
- import { useConversationScroll as e } from "./conversation/useConversationScroll/useConversationScroll.js";
2
- export { e as useConversationScroll };
1
+ export { useConversationScroll } from "./conversation/useConversationScroll/useConversationScroll.js";
@@ -1,7 +1,7 @@
1
1
  //#region src/shared/application-schema.ts
2
- var e = "custom_app", t = (t) => !!t && t.id === e, n = (e) => !!e && (!!e.id?.endsWith("quickapps2") || e.displayName === "Quick app 2.0"), r = "mindmap", i = (e) => e?.toLocaleLowerCase().replace(/[^a-z0-9]/g, "") ?? "", a = (e) => !!e && (i(e.id).includes(r) || i(e.displayName).includes(r)), o = (e) => {
2
+ var e = (e) => !!e && e.id === "custom_app", t = (e) => !!e && (!!e.id?.endsWith("quickapps2") || e.displayName === "Quick app 2.0"), n = "mindmap", r = (e) => e?.toLocaleLowerCase().replace(/[^a-z0-9]/g, "") ?? "", i = (e) => !!e && (r(e.id).includes(n) || r(e.displayName).includes(n)), a = (t) => {
3
3
  let n = /* @__PURE__ */ new Set();
4
- return e.filter((e) => !e.id || t(e) || n.has(e.id) ? !1 : (n.add(e.id), !0));
4
+ return t.filter((t) => !t.id || e(t) || n.has(t.id) ? !1 : (n.add(t.id), !0));
5
5
  };
6
6
  //#endregion
7
- export { o as getRunnerSchemas, t as isCustomAppSchema, a as isMindMapSchema, n as isQuickAppSchema };
7
+ export { a as getRunnerSchemas, e as isCustomAppSchema, i as isMindMapSchema, t as isQuickAppSchema };
@@ -1,13 +1,13 @@
1
1
  //#region src/shared/cron-day-of-month.ts
2
- var e = "last", t = 31, n = 864e5, r = (e) => Math.round((Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate()) - Date.UTC(e.getFullYear(), e.getMonth(), e.getDate())) / n), i = (n, r) => {
3
- let i = n + r;
4
- return i < 1 ? e : i > t ? "1" : String(i);
5
- }, a = (e, n) => {
6
- if (e === "last") return n === -1 ? "1" : void 0;
7
- let r = Number(e);
8
- if (!/^\d+$/.test(e) || r < 1 || r > t) return;
9
- let i = r - n;
10
- return i < 1 ? String(t) : i > t ? "1" : String(i);
2
+ var e = "last", t = (e) => Math.round((Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate()) - Date.UTC(e.getFullYear(), e.getMonth(), e.getDate())) / 864e5), n = (t, n) => {
3
+ let r = t + n;
4
+ return r < 1 ? e : r > 31 ? "1" : String(r);
5
+ }, r = (e, t) => {
6
+ if (e === "last") return t === -1 ? "1" : void 0;
7
+ let n = Number(e);
8
+ if (!/^\d+$/.test(e) || n < 1 || n > 31) return;
9
+ let r = n - t;
10
+ return r < 1 ? "31" : r > 31 ? "1" : String(r);
11
11
  };
12
12
  //#endregion
13
- export { e as CRON_LAST_DAY_OF_MONTH, r as getUtcDayShift, a as toLocalDayOfMonth, i as toUtcCronDayOfMonth };
13
+ export { e as CRON_LAST_DAY_OF_MONTH, t as getUtcDayShift, r as toLocalDayOfMonth, n as toUtcCronDayOfMonth };
package/shared/locale.js CHANGED
@@ -6,14 +6,14 @@ var e = (e) => e.split("-")[0].toLowerCase(), t = (t, n, r) => {
6
6
  return t[n] ?? t[i] ?? t[r] ?? Object.values(t).find((e) => e !== void 0) ?? "";
7
7
  }, n = (t, n) => `${t} [${e(n).toUpperCase()}]`, r = (e, t) => {
8
8
  let n = /* @__PURE__ */ new Map();
9
- for (let r of e) !r.language || r.language === t || !r.name && !r.description || n.set(r.language, {
9
+ for (let r of e) r.language && r.language !== t && (r.name || r.description) && n.set(r.language, {
10
10
  language: r.language,
11
11
  name: r.name || void 0,
12
12
  description: r.description || void 0
13
13
  });
14
14
  return n.size > 0 ? Array.from(n.values()) : void 0;
15
15
  }, i = (e, t, n) => {
16
- let r = typeof e == "object" ? e : {}, i = typeof t == "object" ? t : {}, a = new Set([...Object.keys(r), ...Object.keys(i)]);
16
+ let r = typeof e == "object" ? e : {}, i = typeof t == "object" ? t : {}, a = /* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(i)]);
17
17
  a.delete(n);
18
18
  let o = 0;
19
19
  return Array.from(a, (e) => ({
@@ -9,24 +9,25 @@ var o = async (o, s) => {
9
9
  for (let s of o) {
10
10
  let { id: o, file: c, path: l } = s, u, p = i.SupportingFile;
11
11
  if (l.toLowerCase() === "skill.md" && l !== "SKILL.md") u = d.manifestCasingInvalid;
12
- else if (l === "SKILL.md") if (p = i.Manifest, b += 1, c.size > 1048576) u = d.fileTooLarge(r(e));
13
- else try {
14
- let e = await c.text();
15
- if (e.includes("�")) u = d.manifestInvalidUtf8;
16
- else {
17
- let { frontmatter: t, instructions: r } = n(e), i = typeof t.name == "string" ? t.name : "", a = typeof t.description == "string" ? t.description : "";
18
- !i.trim() || !a.trim() ? u = d.manifestInvalidFrontmatter : b === 1 && (v = {
19
- candidateId: o,
20
- name: i,
21
- description: a,
22
- frontmatter: t,
23
- instructions: r
24
- }, y = c.size);
12
+ else if (l === "SKILL.md") {
13
+ if (p = i.Manifest, b += 1, c.size > 1048576) u = d.fileTooLarge(r(e));
14
+ else try {
15
+ let e = await c.text();
16
+ if (e.includes("�")) u = d.manifestInvalidUtf8;
17
+ else {
18
+ let { frontmatter: t, instructions: r } = n(e), i = typeof t.name == "string" ? t.name : "", a = typeof t.description == "string" ? t.description : "";
19
+ !i.trim() || !a.trim() ? u = d.manifestInvalidFrontmatter : b === 1 && (v = {
20
+ candidateId: o,
21
+ name: i,
22
+ description: a,
23
+ frontmatter: t,
24
+ instructions: r
25
+ }, y = c.size);
26
+ }
27
+ } catch {
28
+ u = d.manifestInvalidFrontmatter;
25
29
  }
26
- } catch {
27
- u = d.manifestInvalidFrontmatter;
28
- }
29
- else l ? t(l) ? m.has(l) || (h.get(l) ?? 0) > 1 ? u = d.pathDuplicate : c.size > 1048576 && (u = d.fileTooLarge(r(e))) : u = d.pathInvalid : u = d.required;
30
+ } else l ? t(l) ? m.has(l) || (h.get(l) ?? 0) > 1 ? u = d.pathDuplicate : c.size > 1048576 && (u = d.fileTooLarge(r(e))) : u = d.pathInvalid : u = d.required;
30
31
  !u && p === i.SupportingFile && (_.add(l), g += c.size), f.push({
31
32
  candidateId: o,
32
33
  status: u ? a.Invalid : a.Valid,
@@ -2,7 +2,7 @@ import { PUBLIC_BUCKET as e } from "@epam/ai-dial-chat-shared";
2
2
  //#region src/skill/skill-types.ts
3
3
  var t = /* @__PURE__ */ function(e) {
4
4
  return e.Personal = "personal", e.SharedWithMe = "sharedWithMe", e.Public = "public", e;
5
- }({}), n = e, r = "skills/", i = 256 * 1024, a = 1e3, o = 10, s = (e) => {
5
+ }({}), n = e, r = "skills/", i = 262144, a = 1e3, o = 10, s = (e) => {
6
6
  if (!e.startsWith(r)) return null;
7
7
  let t = e.slice(7), n = t.indexOf("/");
8
8
  if (n <= 0) return null;
package/skill/skill.js CHANGED
@@ -3,11 +3,11 @@ import { SkillFileNodeKind as a } from "@epam/ai-dial-skill-editor";
3
3
  import { unzipSync as o } from "fflate";
4
4
  import { parse as s, stringify as c } from "yaml";
5
5
  //#region src/skill/skill.ts
6
- var l = "SKILL.md", u = 1048576, d = 16777216, f = 100, p = r, m = `/${p}`, h = (e) => e.endsWith(m) && e.length > m.length, g = (e) => e.slice(0, -m.length), _ = new Set([
6
+ var l = "SKILL.md", u = 1048576, d = 16777216, f = 100, p = r, m = `/${p}`, h = (e) => e.endsWith(m) && e.length > m.length, g = (e) => e.slice(0, -m.length), _ = /* @__PURE__ */ new Set([
7
7
  ".dial-resource",
8
8
  ".dial-folder",
9
9
  p
10
- ]), v = new Set(["files", "v"]), y = /^[a-zA-Z]:/, b = /[\x00-\x1f]/, x = (e) => {
10
+ ]), v = /* @__PURE__ */ new Set(["files", "v"]), y = /^[a-zA-Z]:/, b = /[\x00-\x1f]/, x = (e) => {
11
11
  if (e === "" || e.startsWith("/") || y.test(e) || e.includes("\\") || b.test(e)) return !1;
12
12
  let t = e.split("/");
13
13
  return !(t.some((e) => e === "" || e === "." || e === "..") || t.some((e) => _.has(e)) || v.has(t[0]));
@@ -25,11 +25,14 @@ var l = "SKILL.md", u = 1048576, d = 16777216, f = 100, p = r, m = `/${p}`, h =
25
25
  }, T = ({ name: e, description: t, instructions: n }) => `---\n${c({
26
26
  name: e,
27
27
  description: t
28
- }).trimEnd()}\n---\n\n${n}`, E = (e, t, n, r) => `---\n${c({
29
- ...e,
30
- name: t,
31
- description: n
32
- }).trimEnd()}\n---\n\n${r}`, D = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/, O = /^---[ \t]*$/, k = (e) => {
28
+ }).trimEnd()}\n---\n\n${n}`, E = (e, t, n, r) => {
29
+ let i = {
30
+ ...e,
31
+ name: t,
32
+ description: n
33
+ };
34
+ return `---\n${c(i).trimEnd()}\n---\n\n${r}`;
35
+ }, D = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/, O = /^---[ \t]*$/, k = (e) => {
33
36
  let t = e.replace(/^\uFEFF/, "").replace(/\r\n/g, "\n").split("\n"), n = t.findIndex((e) => e.trim() !== "");
34
37
  return n === -1 || !O.test(t[n]) ? !1 : t.some((e, t) => t > n && O.test(e));
35
38
  }, A = (e) => {
@@ -44,13 +47,7 @@ var l = "SKILL.md", u = 1048576, d = 16777216, f = 100, p = r, m = `/${p}`, h =
44
47
  let t = o(e), n = t[l];
45
48
  if (n == null) throw Error(`Skill archive is missing a root ${l} file`);
46
49
  let r = /* @__PURE__ */ new Map(), i = [];
47
- for (let [e, n] of Object.entries(t)) if (!(e === "SKILL.md" || e.endsWith("/"))) {
48
- if (h(e)) {
49
- i.push(g(e));
50
- continue;
51
- }
52
- e !== p && r.set(e, n);
53
- }
50
+ for (let [e, n] of Object.entries(t)) e === "SKILL.md" || e.endsWith("/") || (h(e) ? i.push(g(e)) : e !== p && r.set(e, n));
54
51
  return {
55
52
  manifestText: new TextDecoder().decode(n),
56
53
  files: r,
@@ -67,7 +64,7 @@ var l = "SKILL.md", u = 1048576, d = 16777216, f = 100, p = r, m = `/${p}`, h =
67
64
  let n = e.filter((e) => e.kind === a.File), r = e.filter((t) => t.kind === a.Folder && !e.some((e) => e.path.startsWith(`${t.path}/`))).map((e) => `${e.path}${m}`);
68
65
  return {
69
66
  filePaths: [...n.map((e) => e.path), ...r],
70
- files: [...n.map((e) => N(t.get(e.path)?.bytes ?? new Uint8Array())), ...r.map(() => new Blob([]))]
67
+ files: [...n.map((e) => N(t.get(e.path)?.bytes ?? /* @__PURE__ */ new Uint8Array())), ...r.map(() => new Blob([]))]
71
68
  };
72
69
  };
73
70
  //#endregion
@@ -51,13 +51,7 @@ var a = "SKILL.md", o = /* @__PURE__ */ function(e) {
51
51
  b.current || (h("error"), y(void 0), _("unsupportedFilename"));
52
52
  }, []), T = t((e) => {
53
53
  let t = e[0];
54
- if (!(!t || b.current)) {
55
- if (u(t.name, d)) {
56
- w();
57
- return;
58
- }
59
- _(void 0), x(t);
60
- }
54
+ t && !b.current && (u(t.name, d) ? w() : (_(void 0), x(t)));
61
55
  }, [
62
56
  d,
63
57
  w,
@@ -127,11 +127,7 @@ var p = (e, t) => JSON.stringify({
127
127
  e.name.trim() || (t.name = T.required), e.description.trim() || (t.description = T.required), e.instructions.trim() ? c(e.instructions) && (t.instructions = T.instructionsFrontmatter) : t.instructions = T.required;
128
128
  let r = a(e);
129
129
  for (let e of Object.keys(r)) t[e] ??= T.tooLong(n[e]);
130
- if (Object.keys(t).length > 0) {
131
- k(t);
132
- return;
133
- }
134
- k({}), j(void 0), N(!1), F(void 0), z.current = e, h ? await H(e) : await V(e);
130
+ Object.keys(t).length > 0 ? k(t) : (k({}), j(void 0), N(!1), F(void 0), z.current = e, h ? await H(e) : await V(e));
135
131
  }, [
136
132
  I,
137
133
  m,
package/skills-state.js CHANGED
@@ -1,2 +1 @@
1
- import { useSkillsState as e } from "./skill/useSkillsState/useSkillsState.js";
2
- export { e as useSkillsState };
1
+ export { useSkillsState } from "./skill/useSkillsState/useSkillsState.js";
package/source-content.js CHANGED
@@ -1,2 +1 @@
1
- import { getUrlFileName as e, isExternalSourcePreviewable as t, resolveExternalSourceContentType as n } from "./files/source-content.js";
2
- export { e as getUrlFileName, t as isExternalSourcePreviewable, n as resolveExternalSourceContentType };
1
+ export { getUrlFileName, isExternalSourcePreviewable, resolveExternalSourceContentType } from "./files/source-content.js";
@@ -34,7 +34,7 @@ var l = {
34
34
  refresh: _
35
35
  });
36
36
  let b = s(() => t(h, f), [h, f]), x = s(() => {
37
- if (!(b == null || !e)) return {
37
+ if (b != null && e) return {
38
38
  dismissalKey: `${e}:${b.period}:${b.severity}`,
39
39
  limitText: m(u[b.severity][b.period], { percent: b.usedPercent }),
40
40
  reset: n(b.resetsAt, b.period, p, m)
@@ -9,7 +9,7 @@ var n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = (e) => {
9
9
  return {
10
10
  isDismissed: e((e) => r.has(e), [r]),
11
11
  dismiss: e((e) => {
12
- n.has(e) || i(new Set([...n, e]));
12
+ n.has(e) || i(/* @__PURE__ */ new Set([...n, e]));
13
13
  }, [])
14
14
  };
15
15
  }, c = () => {
@@ -10,13 +10,13 @@ var a = (a = !0, o = !0) => {
10
10
  }, [l]);
11
11
  return t(() => {
12
12
  let e = (e) => !!e.dataTransfer?.types.includes("Files"), t = (t) => {
13
- !p.current || !e(t) || (d.current += 1, c(!0));
13
+ p.current && e(t) && (d.current += 1, c(!0));
14
14
  }, n = (t) => {
15
- !p.current || !e(t) || (--d.current, d.current <= 0 && (d.current = 0, c(!1)));
15
+ p.current && e(t) && (--d.current, d.current <= 0 && (d.current = 0, c(!1)));
16
16
  }, r = (t) => {
17
17
  e(t) && (t.preventDefault(), p.current);
18
18
  }, i = (t) => {
19
- if (!(!e(t) || !p.current) && (t.preventDefault(), d.current = 0, c(!1), f.current)) {
19
+ if (e(t) && p.current && (t.preventDefault(), d.current = 0, c(!1), f.current)) {
20
20
  let e = Array.from(t.dataTransfer?.files ?? []);
21
21
  e.length > 0 && u((t) => [...t, ...e]);
22
22
  }