@epam/ai-dial-chat-hooks 1.4.0-dev.12 → 1.4.0-dev.126

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 (190) hide show
  1. package/api-error/map-api-error.d.ts +10 -0
  2. package/api-error/map-api-error.d.ts.map +1 -0
  3. package/api-error/map-api-error.js +11 -0
  4. package/attachment/useAttachmentAction/useAttachmentAction.d.ts +1 -1
  5. package/attachment/useAttachmentAction/useAttachmentAction.d.ts.map +1 -1
  6. package/attachment/useAttachmentAction/useAttachmentAction.js +35 -44
  7. package/catalog/create-publish-api.d.ts +28 -1
  8. package/catalog/create-publish-api.d.ts.map +1 -1
  9. package/catalog/create-publish-api.js +21 -1
  10. package/catalog/entity-details.d.ts +5 -2
  11. package/catalog/entity-details.d.ts.map +1 -1
  12. package/catalog/map-entity-details-to-catalog.d.ts +4 -0
  13. package/catalog/map-entity-details-to-catalog.d.ts.map +1 -1
  14. package/catalog/map-entity-details-to-catalog.js +15 -13
  15. package/catalog/publish-dependency-icons.d.ts +22 -0
  16. package/catalog/publish-dependency-icons.d.ts.map +1 -0
  17. package/catalog/publish-dependency-icons.js +11 -0
  18. package/catalog/publish-target-taken.d.ts +31 -0
  19. package/catalog/publish-target-taken.d.ts.map +1 -0
  20. package/catalog/publish-target-taken.js +14 -0
  21. package/catalog/publish.d.ts +15 -2
  22. package/catalog/publish.d.ts.map +1 -1
  23. package/catalog/publish.js +15 -4
  24. package/catalog/resource-name-conflict.d.ts.map +1 -1
  25. package/catalog/resource-name-conflict.js +19 -22
  26. package/catalog/resource-save-adapter.d.ts +7 -2
  27. package/catalog/resource-save-adapter.d.ts.map +1 -1
  28. package/catalog/resource-save-adapters.d.ts +32 -7
  29. package/catalog/resource-save-adapters.d.ts.map +1 -1
  30. package/catalog/resource-save-adapters.js +47 -41
  31. package/catalog/resource-save.d.ts +17 -9
  32. package/catalog/resource-save.d.ts.map +1 -1
  33. package/catalog/resource-save.js +34 -25
  34. package/catalog/save-destination-root.d.ts +12 -0
  35. package/catalog/save-destination-root.d.ts.map +1 -0
  36. package/catalog/save-destination-root.js +6 -0
  37. package/catalog/use-publish-dependencies.d.ts +19 -0
  38. package/catalog/use-publish-dependencies.d.ts.map +1 -0
  39. package/catalog/use-publish-dependencies.js +25 -0
  40. package/catalog/use-publish-target-guard.d.ts +45 -0
  41. package/catalog/use-publish-target-guard.d.ts.map +1 -0
  42. package/catalog/use-publish-target-guard.js +18 -0
  43. package/catalog/usePublishFolders/usePublishFolders.d.ts +8 -2
  44. package/catalog/usePublishFolders/usePublishFolders.d.ts.map +1 -1
  45. package/catalog/usePublishFolders/usePublishFolders.js +29 -29
  46. package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts +27 -6
  47. package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts.map +1 -1
  48. package/catalog/useResourceSavePanel/useResourceSavePanel.js +184 -118
  49. package/catalog/useVersionHistory/useVersionHistory.d.ts +38 -0
  50. package/catalog/useVersionHistory/useVersionHistory.d.ts.map +1 -0
  51. package/catalog/useVersionHistory/useVersionHistory.js +49 -0
  52. package/catalog/useVersionHistory/useVersionHistorySection.d.ts +30 -0
  53. package/catalog/useVersionHistory/useVersionHistorySection.d.ts.map +1 -0
  54. package/catalog/useVersionHistory/useVersionHistorySection.js +31 -0
  55. package/catalog/version-history.d.ts +42 -0
  56. package/catalog/version-history.d.ts.map +1 -0
  57. package/catalog/version-history.js +27 -0
  58. package/catalog.js +39 -31
  59. package/conversation/announcement-message.d.ts +12 -0
  60. package/conversation/announcement-message.d.ts.map +1 -1
  61. package/conversation/announcement-message.js +16 -10
  62. package/conversation/conversation-list.d.ts +7 -1
  63. package/conversation/conversation-list.d.ts.map +1 -1
  64. package/conversation/conversation-list.js +11 -2
  65. package/conversation/conversation-transfer/zip-export.d.ts +1 -1
  66. package/conversation/conversation-transfer/zip-export.d.ts.map +1 -1
  67. package/conversation/conversation-transfer/zip-export.js +7 -8
  68. package/conversation/conversation-transfer/zip-import.d.ts.map +1 -1
  69. package/conversation/conversation-transfer/zip-import.js +8 -9
  70. package/conversation/useConversationExport/useConversationExport.d.ts.map +1 -1
  71. package/conversation/useConversationExport/useConversationExport.js +3 -1
  72. package/conversation/useConversationStream/generation-resume.d.ts.map +1 -1
  73. package/conversation/useConversationStream/generation-resume.js +119 -96
  74. package/conversation.js +44 -44
  75. package/entry-points/catalog.d.ts +7 -0
  76. package/entry-points/catalog.d.ts.map +1 -1
  77. package/entry-points/file-manager.d.ts +1 -0
  78. package/entry-points/file-manager.d.ts.map +1 -1
  79. package/entry-points/project.d.ts +5 -0
  80. package/entry-points/project.d.ts.map +1 -1
  81. package/entry-points/scheduled-tasks.d.ts +2 -0
  82. package/entry-points/scheduled-tasks.d.ts.map +1 -1
  83. package/entry-points/usage-limits.d.ts +1 -0
  84. package/entry-points/usage-limits.d.ts.map +1 -1
  85. package/entry-points/utils.d.ts +7 -0
  86. package/entry-points/utils.d.ts.map +1 -1
  87. package/file-manager.js +33 -32
  88. package/files/annotation.d.ts +3 -3
  89. package/files/annotation.d.ts.map +1 -1
  90. package/files/annotation.js +12 -11
  91. package/files/attachment-canvas.d.ts +1 -1
  92. package/files/attachment-canvas.d.ts.map +1 -1
  93. package/files/attachment-canvas.js +135 -135
  94. package/files/attachment-type-labels.d.ts +3 -0
  95. package/files/attachment-type-labels.d.ts.map +1 -0
  96. package/files/attachment-type-labels.js +12 -0
  97. package/files/attachment-types.d.ts +0 -2
  98. package/files/attachment-types.d.ts.map +1 -1
  99. package/files/attachment-types.js +7 -14
  100. package/files/dial-file.d.ts +24 -0
  101. package/files/dial-file.d.ts.map +1 -1
  102. package/files/dial-file.js +35 -5
  103. package/index.d.ts +23 -0
  104. package/index.d.ts.map +1 -1
  105. package/index.js +266 -244
  106. package/org-units/models.d.ts +11 -0
  107. package/org-units/models.d.ts.map +1 -0
  108. package/org-units/org-unit-guards.d.ts +98 -0
  109. package/org-units/org-unit-guards.d.ts.map +1 -0
  110. package/org-units/org-unit-guards.js +41 -0
  111. package/org-units/types.d.ts +14 -0
  112. package/org-units/types.d.ts.map +1 -0
  113. package/org-units/types.js +6 -0
  114. package/org-units/useFolderGuards/useFolderGuards.d.ts +31 -0
  115. package/org-units/useFolderGuards/useFolderGuards.d.ts.map +1 -0
  116. package/org-units/useFolderGuards/useFolderGuards.js +50 -0
  117. package/org-units/useOrgUnits/useOrgUnits.d.ts +34 -0
  118. package/org-units/useOrgUnits/useOrgUnits.d.ts.map +1 -0
  119. package/org-units/useOrgUnits/useOrgUnits.js +54 -0
  120. package/package.json +19 -19
  121. package/project/project-conversation-data-source.js +4 -4
  122. package/project/project-sharing-client.d.ts +8 -0
  123. package/project/project-sharing-client.d.ts.map +1 -0
  124. package/project/project-sharing-client.js +11 -0
  125. package/project/project-sharing.d.ts +28 -0
  126. package/project/project-sharing.d.ts.map +1 -0
  127. package/project/project-sharing.js +22 -0
  128. package/project/use-pinned-project-chats.d.ts +4 -2
  129. package/project/use-pinned-project-chats.d.ts.map +1 -1
  130. package/project/use-pinned-project-chats.js +152 -96
  131. package/project/use-project-conversations.d.ts.map +1 -1
  132. package/project/use-project-conversations.js +2 -2
  133. package/project/use-project-remove-from-list.d.ts +30 -0
  134. package/project/use-project-remove-from-list.d.ts.map +1 -0
  135. package/project/use-project-remove-from-list.js +39 -0
  136. package/project/use-project-revoke-access.d.ts +15 -0
  137. package/project/use-project-revoke-access.d.ts.map +1 -0
  138. package/project/use-project-revoke-access.js +32 -0
  139. package/project/use-project-share-recipients.d.ts +7 -0
  140. package/project/use-project-share-recipients.d.ts.map +1 -0
  141. package/project/use-project-share-recipients.js +36 -0
  142. package/project/use-projects.d.ts +1 -0
  143. package/project/use-projects.d.ts.map +1 -1
  144. package/project/use-projects.js +2 -1
  145. package/project.js +7 -2
  146. package/scheduled-task/scheduled-task-description.d.ts +19 -13
  147. package/scheduled-task/scheduled-task-description.d.ts.map +1 -1
  148. package/scheduled-task/scheduled-task-description.js +39 -55
  149. package/scheduled-task/scheduled-task-display.d.ts +67 -6
  150. package/scheduled-task/scheduled-task-display.d.ts.map +1 -1
  151. package/scheduled-task/scheduled-task-display.js +55 -43
  152. package/scheduled-task/scheduled-task-next-occurrence.d.ts +9 -5
  153. package/scheduled-task/scheduled-task-next-occurrence.d.ts.map +1 -1
  154. package/scheduled-task/scheduled-task-next-occurrence.js +16 -16
  155. package/scheduled-task/scheduled-task-time-format.d.ts +36 -0
  156. package/scheduled-task/scheduled-task-time-format.d.ts.map +1 -0
  157. package/scheduled-task/scheduled-task-time-format.js +34 -0
  158. package/scheduled-task/scheduled-task-trigger.d.ts +6 -4
  159. package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
  160. package/scheduled-task/scheduled-task-trigger.js +92 -115
  161. package/scheduled-tasks.js +15 -13
  162. package/shared/timezones.d.ts +30 -0
  163. package/shared/timezones.d.ts.map +1 -0
  164. package/shared/timezones.js +102 -0
  165. package/skill/skill-archive.d.ts.map +1 -1
  166. package/skill/skill-archive.js +6 -7
  167. package/skill/skill.d.ts +2 -2
  168. package/skill/skill.d.ts.map +1 -1
  169. package/skill/skill.js +33 -34
  170. package/skill/useSkillEditorLoad.js +1 -1
  171. package/skill/useSkillEditorSubmit.d.ts +4 -1
  172. package/skill/useSkillEditorSubmit.d.ts.map +1 -1
  173. package/skill/useSkillEditorSubmit.js +125 -121
  174. package/usage/map-usage-data-to-dashboard.d.ts +22 -1
  175. package/usage/map-usage-data-to-dashboard.d.ts.map +1 -1
  176. package/usage/map-usage-data-to-dashboard.js +33 -2
  177. package/usage/spending-limits-mode.d.ts +37 -0
  178. package/usage/spending-limits-mode.d.ts.map +1 -0
  179. package/usage/spending-limits-mode.js +15 -0
  180. package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts +6 -2
  181. package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts.map +1 -1
  182. package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts +4 -1
  183. package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts.map +1 -1
  184. package/usage/useUsageLimitBanner/useUsageLimitBanner.js +55 -47
  185. package/usage-limits.js +6 -5
  186. package/usage.js +3 -3
  187. package/utils.js +28 -22
  188. package/shared/cron-day-of-month.d.ts +0 -21
  189. package/shared/cron-day-of-month.d.ts.map +0 -1
  190. package/shared/cron-day-of-month.js +0 -13
@@ -1 +1 @@
1
- {"version":3,"file":"scheduled-task-trigger.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,gBAAgB,EAEhB,0BAA0B,EAC3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,6BAA6B,EAE9B,MAAM,+BAA+B,CAAC;AAWvC,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,0BAA0B,CAAC;AAgIlC;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACpC,QAAQ,6BAA6B,KACpC,0BAsCF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,GACpC,QAAQ,6BAA6B,KACpC,0BAGD,CAAC;AAoJH;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,GAC1C,KAAK,gBAAgB,KACpB,6BA8GF,CAAC"}
1
+ {"version":3,"file":"scheduled-task-trigger.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,gBAAgB,EAEhB,0BAA0B,EAC3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAIL,KAAK,6BAA6B,EACnC,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,0BAA0B,CAAC;AAuFlC;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GACpC,QAAQ,6BAA6B,KACpC,0BAuCF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GACpC,QAAQ,6BAA6B,KACpC,0BAGD,CAAC;AA4HH;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,GAC1C,KAAK,gBAAgB,KACpB,6BA4HF,CAAC"}
@@ -1,174 +1,151 @@
1
1
  import { padTwoDigits as e } from "../shared/formatting.js";
2
2
  import { UnsupportedTriggerReason as t } from "./scheduled-task-mapping.js";
3
- import { getUtcDayShift as n, toLocalDayOfMonth as r, toUtcCronDayOfMonth as i } from "../shared/cron-day-of-month.js";
4
- import { apSchedulerDayToJsDay as a, jsDayToApSchedulerDay as o } from "../shared/cron-weekday.js";
5
- import { ScheduledTaskRepeat as s } from "@epam/ai-dial-scheduled-tasks";
3
+ import { isKnownTimezone as n } from "../shared/timezones.js";
4
+ import { ScheduledTaskRepeat as r, instantToZonedDateTime as i, isAbsoluteInstant as a } from "@epam/ai-dial-scheduled-tasks";
6
5
  //#region src/scheduled-task/scheduled-task-trigger.ts
7
- var c = /* @__PURE__ */ new Set([
6
+ var o = /* @__PURE__ */ new Set([
8
7
  "hour",
9
8
  "minute",
10
9
  "day_of_week",
11
10
  "day"
12
- ]), l = /^[0-6]$/, u = (e) => [...e].sort((e, t) => Number(e) - Number(t)), d = "09:00", f = (e) => {
13
- if (e.repeat === s.Hourly) {
14
- let t = /* @__PURE__ */ new Date();
15
- return t.setHours(0, Number(e.minute), 0, 0), {
16
- hour: "*",
17
- minute: String(t.getUTCMinutes())
18
- };
19
- }
20
- let [t, r] = e.time.split(":"), c = Number(t), l = Number(r), d = /* @__PURE__ */ new Date();
21
- d.setHours(c, l, 0, 0);
22
- let f = e.repeat === s.Weekly && !!e.dayOfWeek, p = e.repeat === s.Custom ? u(e.daysOfWeek ?? []) : [], m = e.repeat === s.Monthly && !!e.dayOfMonth, h = f ? e.dayOfWeek : p[0];
23
- if (h !== void 0) {
24
- let e = (a(Number(h)) - d.getDay() + 7) % 7;
25
- d.setDate(d.getDate() + e);
26
- }
27
- let g = {
28
- hour: String(d.getUTCHours()),
29
- minute: String(d.getUTCMinutes())
11
+ ]), s = "UTC", c = /^[0-6]$/, l = /^\d+$/, u = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})(?::(\d{2}))?/, d = 10, f = 16, p = (e) => [...e].sort((e, t) => Number(e) - Number(t)), m = "09:00", h = (e) => {
12
+ if (e.repeat === r.Hourly) return {
13
+ hour: "*",
14
+ minute: String(Number(e.minute))
30
15
  };
31
- if (f && (g.day_of_week = String(o(d.getUTCDay()))), m && (g.day = i(Number(e.dayOfMonth), n(d))), p.length) {
32
- let e = n(d);
33
- g.day_of_week = u(p.map((t) => String((Number(t) + e + 7) % 7))).join(",");
16
+ let [t, n] = e.time.split(":"), i = {
17
+ hour: String(Number(t)),
18
+ minute: String(Number(n))
19
+ };
20
+ if (e.repeat === r.Weekly && e.dayOfWeek && (i.day_of_week = e.dayOfWeek), e.repeat === r.Monthly && e.dayOfMonth && (i.day = String(Number(e.dayOfMonth))), e.repeat === r.Custom) {
21
+ let t = p(e.daysOfWeek ?? []);
22
+ t.length && (i.day_of_week = t.join(","));
34
23
  }
35
- return g;
36
- }, p = (e, t) => {
37
- let [n, r, i] = e.split("-").map(Number), a = new Date(n, r - 1, i);
38
- return t === "start" ? a.setHours(0, 0, 0, 0) : a.setHours(23, 59, 59, 999), a.toISOString();
39
- }, m = (e) => {
40
- let t = e.repeat === s.OneTime ? { date: new Date(e.runAt ?? "").toISOString() } : { cron: {
41
- fields: f(e),
42
- ...e.startDate ? { startDate: p(e.startDate, "start") } : {},
43
- ...e.endDate ? { endDate: p(e.endDate, "end") } : {}
24
+ return i;
25
+ }, g = (e, t) => t === "start" ? `${e}T00:00:00.000` : `${e}T23:59:59.999`, _ = (e) => {
26
+ let t = u.exec(e);
27
+ return t ? `${t[1]}:${t[2] ?? "00"}` : e;
28
+ }, v = (e) => {
29
+ let t = e.repeat === r.OneTime ? { date: _(e.runAt ?? "") } : { cron: {
30
+ fields: h(e),
31
+ ...e.startDate ? { startDate: g(e.startDate, "start") } : {},
32
+ ...e.endDate ? { endDate: g(e.endDate, "end") } : {}
44
33
  } }, n = e.description?.trim();
45
34
  return {
46
35
  displayName: e.displayName.trim(),
47
36
  trigger: t,
37
+ timezone: e.timezone,
48
38
  model: e.modelId,
49
39
  prompt: e.prompt.trim(),
50
40
  ...e.skillUrls?.length ? { skillUrls: [...new Set(e.skillUrls)] } : {},
51
41
  ...n ? { description: n } : {}
52
42
  };
53
- }, h = (e) => ({
54
- ...m(e),
43
+ }, y = (e) => ({
44
+ ...v(e),
55
45
  skillUrls: [...new Set(e.skillUrls ?? [])]
56
- }), g = (t) => {
57
- let n = new Date(t);
58
- return `${n.getFullYear()}-${e(n.getMonth() + 1)}-${e(n.getDate())}T${e(n.getHours())}:${e(n.getMinutes())}`;
59
- }, _ = (t) => {
60
- let n = new Date(t);
61
- return `${n.getFullYear()}-${e(n.getMonth() + 1)}-${e(n.getDate())}`;
62
- }, v = (t) => {
63
- let i = new Set(Object.entries(t).filter(([, e]) => e != null).map(([e]) => e)), s = [...i].filter((e) => !c.has(e)), d = i.has("day_of_week"), f = i.has("day");
64
- if (s.length > 0 || d && f || !i.has("hour") || !i.has("minute")) return { ok: !1 };
65
- if (t.hour === "*" && /^\d+$/.test(String(t.minute)) && !d && !f) {
66
- let e = /* @__PURE__ */ new Date();
67
- return e.setUTCHours(0, Number(t.minute), 0, 0), {
68
- ok: !0,
69
- isHourly: !0,
70
- minute: String(e.getMinutes())
71
- };
72
- }
73
- let p = Number(t.hour), m = Number(t.minute);
74
- if (Number.isNaN(p) || Number.isNaN(m)) return { ok: !1 };
75
- let h = /* @__PURE__ */ new Date();
76
- h.setUTCHours(p, m, 0, 0);
77
- let g = d ? String(t.day_of_week).split(",") : [];
78
- if (g.some((e) => !l.test(e)) || new Set(g).size !== g.length) return { ok: !1 };
79
- if (g.length) {
80
- let e = (a(Number(g[0])) - h.getUTCDay() + 7) % 7;
81
- h.setUTCDate(h.getUTCDate() + e);
82
- }
83
- let _ = `${e(h.getHours())}:${e(h.getMinutes())}`;
84
- if (g.length > 1) {
85
- let e = n(h);
86
- return {
87
- ok: !0,
88
- isHourly: !1,
89
- isCustom: !0,
90
- time: _,
91
- daysOfWeek: u(g.map((t) => String((Number(t) - e + 7) % 7)))
92
- };
93
- }
94
- let v = f ? r(String(t.day), n(h)) : void 0;
95
- return f && !v ? { ok: !1 } : {
46
+ }), b = (e, t) => a(e) ? i(e, t) ?? e.slice(0, f) : e.slice(0, f), x = (e, t) => b(e, t).slice(0, d), S = (t) => {
47
+ let n = new Set(Object.entries(t).filter(([, e]) => e != null).map(([e]) => e)), r = [...n].filter((e) => !o.has(e)), i = n.has("day_of_week"), a = n.has("day");
48
+ if (r.length > 0 || i && a || !n.has("hour") || !n.has("minute")) return { ok: !1 };
49
+ if (t.hour === "*" && l.test(String(t.minute)) && !i && !a) return {
50
+ ok: !0,
51
+ isHourly: !0,
52
+ minute: String(Number(t.minute))
53
+ };
54
+ if (!l.test(String(t.hour)) || !l.test(String(t.minute))) return { ok: !1 };
55
+ let s = `${e(Number(t.hour))}:${e(Number(t.minute))}`, u = i ? String(t.day_of_week).split(",") : [];
56
+ if (u.some((e) => !c.test(e)) || new Set(u).size !== u.length) return { ok: !1 };
57
+ if (u.length > 1) return {
96
58
  ok: !0,
97
59
  isHourly: !1,
98
- time: _,
99
- ...d ? { dayOfWeek: String(o(h.getDay())) } : {},
100
- ...v ? { dayOfMonth: v } : {}
60
+ isCustom: !0,
61
+ time: s,
62
+ daysOfWeek: p(u)
101
63
  };
102
- }, y = (e) => {
64
+ let d = a ? String(t.day) : void 0;
65
+ return d !== void 0 && (!l.test(d) || Number(d) < 1 || Number(d) > 31) ? { ok: !1 } : {
66
+ ok: !0,
67
+ isHourly: !1,
68
+ time: s,
69
+ ...u.length ? { dayOfWeek: u[0] } : {},
70
+ ...d ? { dayOfMonth: String(Number(d)) } : {}
71
+ };
72
+ }, C = (e) => {
103
73
  if (!e.model || typeof e.prompt != "string" || !e.prompt.trim() && !e.skillUrls?.length) return {
104
74
  ok: !1,
105
75
  reason: t.MissingRequiredFields
106
76
  };
107
- let { date: n, cron: r } = e.trigger, i = !!n;
108
- if (i === !!r) return {
77
+ let { date: i, cron: a } = e.trigger, o = !!i;
78
+ if (o === !!a) return {
109
79
  ok: !1,
110
80
  reason: t.UnsupportedTriggerType
111
81
  };
112
- let a = {
82
+ let c = e.timezone || s;
83
+ if (!n(c)) return {
84
+ ok: !1,
85
+ reason: t.UnsupportedTriggerType
86
+ };
87
+ let l = {
113
88
  displayName: e.displayName,
114
89
  modelId: e.model,
115
90
  prompt: e.prompt,
116
91
  skillUrls: [...new Set(e.skillUrls ?? [])],
92
+ timezone: c,
117
93
  ...e.description ? { description: e.description } : {}
118
94
  };
119
- if (i) return {
95
+ if (o) return {
120
96
  ok: !0,
121
97
  values: {
122
- ...a,
123
- repeat: s.OneTime,
124
- runAt: g(n),
125
- time: d
98
+ ...l,
99
+ repeat: r.OneTime,
100
+ runAt: b(i, c),
101
+ time: m
126
102
  }
127
103
  };
128
- if (!r) return {
104
+ if (!a) return {
129
105
  ok: !1,
130
106
  reason: t.UnsupportedTriggerType
131
107
  };
132
- let o = v(r.fields);
133
- if (!o.ok) return {
108
+ let u = S(a.fields);
109
+ if (!u.ok) return {
134
110
  ok: !1,
135
111
  reason: t.UnsupportedCronShape
136
112
  };
137
- if (o.isHourly) return {
113
+ let d = {
114
+ ...a.startDate ? { startDate: x(a.startDate, c) } : {},
115
+ ...a.endDate ? { endDate: x(a.endDate, c) } : {}
116
+ };
117
+ if (u.isHourly) return {
138
118
  ok: !0,
139
119
  values: {
140
- ...a,
141
- repeat: s.Hourly,
142
- time: d,
143
- minute: o.minute,
144
- ...r.startDate ? { startDate: _(r.startDate) } : {},
145
- ...r.endDate ? { endDate: _(r.endDate) } : {}
120
+ ...l,
121
+ repeat: r.Hourly,
122
+ time: m,
123
+ minute: u.minute,
124
+ ...d
146
125
  }
147
126
  };
148
- if (o.isCustom) return {
127
+ if (u.isCustom) return {
149
128
  ok: !0,
150
129
  values: {
151
- ...a,
152
- repeat: s.Custom,
153
- time: o.time,
154
- daysOfWeek: o.daysOfWeek,
155
- ...r.startDate ? { startDate: _(r.startDate) } : {},
156
- ...r.endDate ? { endDate: _(r.endDate) } : {}
130
+ ...l,
131
+ repeat: r.Custom,
132
+ time: u.time,
133
+ daysOfWeek: u.daysOfWeek,
134
+ ...d
157
135
  }
158
136
  };
159
- let c = s.Daily;
160
- return o.dayOfWeek ? c = s.Weekly : o.dayOfMonth && (c = s.Monthly), {
137
+ let f = r.Daily;
138
+ return u.dayOfWeek ? f = r.Weekly : u.dayOfMonth && (f = r.Monthly), {
161
139
  ok: !0,
162
140
  values: {
163
- ...a,
164
- repeat: c,
165
- time: o.time,
166
- ...o.dayOfWeek ? { dayOfWeek: o.dayOfWeek } : {},
167
- ...o.dayOfMonth ? { dayOfMonth: o.dayOfMonth } : {},
168
- ...r.startDate ? { startDate: _(r.startDate) } : {},
169
- ...r.endDate ? { endDate: _(r.endDate) } : {}
141
+ ...l,
142
+ repeat: f,
143
+ time: u.time,
144
+ ...u.dayOfWeek ? { dayOfWeek: u.dayOfWeek } : {},
145
+ ...u.dayOfMonth ? { dayOfMonth: u.dayOfMonth } : {},
146
+ ...d
170
147
  }
171
148
  };
172
149
  };
173
150
  //#endregion
174
- export { m as mapFormValuesToCreateBody, h as mapFormValuesToUpdateBody, y as mapScheduledTaskDtoToFormValues };
151
+ export { v as mapFormValuesToCreateBody, y as mapFormValuesToUpdateBody, C as mapScheduledTaskDtoToFormValues };
@@ -1,15 +1,17 @@
1
1
  import { UnsupportedTriggerReason as e } from "./scheduled-task/scheduled-task-mapping.js";
2
2
  import { ScheduledTaskTriggerDescriptionKind as t, describeScheduledTaskTrigger as n } from "./scheduled-task/scheduled-task-description.js";
3
- import { ScheduledTaskDeleteErrorKind as r, classifyScheduledTaskDeleteError as i, formatScheduledTaskRunDuration as a, formatScheduledTaskRunTimestamp as o, formatScheduledTaskScheduleLabel as s, selectScheduledTaskErrorMessage as c, toScheduledTaskItem as l, toScheduledTaskItems as u, toScheduledTaskRunItem as d, toScheduledTaskRunItems as f } from "./scheduled-task/scheduled-task-display.js";
4
- import { mapFormValuesToCreateBody as p, mapFormValuesToUpdateBody as m, mapScheduledTaskDtoToFormValues as h } from "./scheduled-task/scheduled-task-trigger.js";
5
- import { prepareScheduledTaskCreateBody as g, prepareScheduledTaskUpdateBody as _ } from "./scheduled-task/scheduled-task-preparation.js";
6
- import { createScheduledTasksApiClient as v } from "./scheduled-task/scheduled-tasks-api-client.js";
7
- import { useScheduledTasks as y } from "./scheduled-task/use-scheduled-tasks.js";
8
- import { mergeRunsById as b, useScheduledTaskRuns as x } from "./scheduled-task/use-scheduled-task-runs.js";
9
- import { ScheduledTaskRunStatusFeedback as S, mergeScheduledTaskRuns as C, useStartScheduledTask as w } from "./scheduled-task/useStartScheduledTask.js";
10
- import { getNextCronOccurrence as T } from "./scheduled-task/scheduled-task-next-occurrence.js";
11
- import { checkScheduledTaskAuthSessionError as E } from "./scheduled-task/check-scheduled-task-auth-session-error.js";
12
- import { useScheduledTaskSkillDisplayNames as D } from "./scheduled-task/useScheduledTaskSkillDisplayNames/useScheduledTaskSkillDisplayNames.js";
13
- import { ActiveScheduledTaskDetailState as O, ActiveScheduledTaskStatus as k, resolveActiveScheduledTask as A } from "./scheduled-task/active-scheduled-task.js";
14
- import { useActiveScheduledTaskDetails as j } from "./scheduled-task/useActiveScheduledTaskDetails.js";
15
- export { O as ActiveScheduledTaskDetailState, k as ActiveScheduledTaskStatus, r as ScheduledTaskDeleteErrorKind, S as ScheduledTaskRunStatusFeedback, t as ScheduledTaskTriggerDescriptionKind, e as UnsupportedTriggerReason, E as checkScheduledTaskAuthSessionError, i as classifyScheduledTaskDeleteError, v as createScheduledTasksApiClient, n as describeScheduledTaskTrigger, a as formatScheduledTaskRunDuration, o as formatScheduledTaskRunTimestamp, s as formatScheduledTaskScheduleLabel, T as getNextCronOccurrence, p as mapFormValuesToCreateBody, m as mapFormValuesToUpdateBody, h as mapScheduledTaskDtoToFormValues, b as mergeRunsById, C as mergeScheduledTaskRuns, g as prepareScheduledTaskCreateBody, _ as prepareScheduledTaskUpdateBody, A as resolveActiveScheduledTask, c as selectScheduledTaskErrorMessage, l as toScheduledTaskItem, u as toScheduledTaskItems, d as toScheduledTaskRunItem, f as toScheduledTaskRunItems, j as useActiveScheduledTaskDetails, x as useScheduledTaskRuns, D as useScheduledTaskSkillDisplayNames, y as useScheduledTasks, w as useStartScheduledTask };
3
+ import { UTC_TIMEZONE_ID as r, findTimezoneOption as i, getTimezoneOptions as a, isKnownTimezone as o, isSameTimezone as s } from "./shared/timezones.js";
4
+ import { getNextCronOccurrence as c, hasScheduledTaskWindowEnded as l } from "./scheduled-task/scheduled-task-next-occurrence.js";
5
+ import { SCHEDULED_TASK_WALL_DATE_TIME_PATTERN as u, ScheduledTaskWeekdayStyle as d, formatScheduledTaskClockTime as f, formatScheduledTaskInstant as p, formatScheduledTaskRunDate as m, formatScheduledTaskRunTime as h, formatScheduledTaskWeekday as g, formatScheduledTaskWeekdays as _, formatZonedDateTime as v } from "./scheduled-task/scheduled-task-time-format.js";
6
+ import { ScheduledTaskActivationBlock as y, ScheduledTaskDeleteErrorKind as b, classifyScheduledTaskDeleteError as x, formatScheduledTaskActiveWindow as S, formatScheduledTaskNextRunTime as C, formatScheduledTaskRunDuration as w, formatScheduledTaskRunTimestamp as T, formatScheduledTaskScheduleLabel as E, formatScheduledTaskTriggerTime as D, getScheduledTaskActivationBlock as O, selectScheduledTaskErrorMessage as k, toScheduledTaskItem as A, toScheduledTaskItems as j, toScheduledTaskRunItem as M, toScheduledTaskRunItems as N } from "./scheduled-task/scheduled-task-display.js";
7
+ import { mapFormValuesToCreateBody as P, mapFormValuesToUpdateBody as F, mapScheduledTaskDtoToFormValues as I } from "./scheduled-task/scheduled-task-trigger.js";
8
+ import { prepareScheduledTaskCreateBody as L, prepareScheduledTaskUpdateBody as R } from "./scheduled-task/scheduled-task-preparation.js";
9
+ import { createScheduledTasksApiClient as z } from "./scheduled-task/scheduled-tasks-api-client.js";
10
+ import { useScheduledTasks as B } from "./scheduled-task/use-scheduled-tasks.js";
11
+ import { mergeRunsById as V, useScheduledTaskRuns as H } from "./scheduled-task/use-scheduled-task-runs.js";
12
+ import { ScheduledTaskRunStatusFeedback as U, mergeScheduledTaskRuns as W, useStartScheduledTask as G } from "./scheduled-task/useStartScheduledTask.js";
13
+ import { checkScheduledTaskAuthSessionError as K } from "./scheduled-task/check-scheduled-task-auth-session-error.js";
14
+ import { useScheduledTaskSkillDisplayNames as q } from "./scheduled-task/useScheduledTaskSkillDisplayNames/useScheduledTaskSkillDisplayNames.js";
15
+ import { ActiveScheduledTaskDetailState as J, ActiveScheduledTaskStatus as Y, resolveActiveScheduledTask as X } from "./scheduled-task/active-scheduled-task.js";
16
+ import { useActiveScheduledTaskDetails as Z } from "./scheduled-task/useActiveScheduledTaskDetails.js";
17
+ export { J as ActiveScheduledTaskDetailState, Y as ActiveScheduledTaskStatus, u as SCHEDULED_TASK_WALL_DATE_TIME_PATTERN, y as ScheduledTaskActivationBlock, b as ScheduledTaskDeleteErrorKind, U as ScheduledTaskRunStatusFeedback, t as ScheduledTaskTriggerDescriptionKind, d as ScheduledTaskWeekdayStyle, r as UTC_TIMEZONE_ID, e as UnsupportedTriggerReason, K as checkScheduledTaskAuthSessionError, x as classifyScheduledTaskDeleteError, z as createScheduledTasksApiClient, n as describeScheduledTaskTrigger, i as findTimezoneOption, S as formatScheduledTaskActiveWindow, f as formatScheduledTaskClockTime, p as formatScheduledTaskInstant, C as formatScheduledTaskNextRunTime, m as formatScheduledTaskRunDate, w as formatScheduledTaskRunDuration, h as formatScheduledTaskRunTime, T as formatScheduledTaskRunTimestamp, E as formatScheduledTaskScheduleLabel, D as formatScheduledTaskTriggerTime, g as formatScheduledTaskWeekday, _ as formatScheduledTaskWeekdays, v as formatZonedDateTime, c as getNextCronOccurrence, O as getScheduledTaskActivationBlock, a as getTimezoneOptions, l as hasScheduledTaskWindowEnded, o as isKnownTimezone, s as isSameTimezone, P as mapFormValuesToCreateBody, F as mapFormValuesToUpdateBody, I as mapScheduledTaskDtoToFormValues, V as mergeRunsById, W as mergeScheduledTaskRuns, L as prepareScheduledTaskCreateBody, R as prepareScheduledTaskUpdateBody, X as resolveActiveScheduledTask, k as selectScheduledTaskErrorMessage, A as toScheduledTaskItem, j as toScheduledTaskItems, M as toScheduledTaskRunItem, N as toScheduledTaskRunItems, Z as useActiveScheduledTaskDetails, H as useScheduledTaskRuns, q as useScheduledTaskSkillDisplayNames, B as useScheduledTasks, G as useStartScheduledTask };
@@ -0,0 +1,30 @@
1
+ import { ScheduledTaskTimezoneOption } from '@epam/ai-dial-scheduled-tasks';
2
+ /** Zone every task falls back to and the one engines may leave out of their supported list. */
3
+ export declare const UTC_TIMEZONE_ID = "UTC";
4
+ /** Options of {@link getTimezoneOptions}. */
5
+ export interface GetTimezoneOptionsParams {
6
+ /** Moment the offsets and the current abbreviation are read at. Defaults to now. */
7
+ now?: Date;
8
+ /** BCP 47 locale the abbreviations are written in. Defaults to the platform default. */
9
+ locale?: string;
10
+ }
11
+ /** True when the identifier looks like an IANA id and `Intl` can format in it; an unknown name, an offset such as `+02:00` or an empty string is not a zone. */
12
+ export declare const isKnownTimezone: (timezone: string) => boolean;
13
+ /** True when both identifiers name the same zone once legacy names are resolved (`Europe/Kiev` and `Europe/Kyiv`). */
14
+ export declare const isSameTimezone: (a: string, b: string) => boolean;
15
+ /**
16
+ * Returns every selectable IANA zone as a picker row, sorted by UTC offset and
17
+ * then by identifier. Offsets and the abbreviation are read at `now`; the
18
+ * abbreviation falls back to English (`CET`) where the locale gives none. Search
19
+ * terms also carry the January and July abbreviations and the long names
20
+ * (`Central European Time`), so `CEST` or a region name is found in any month;
21
+ * they are computed when a row's `searchTerms` is first read.
22
+ */
23
+ export declare const getTimezoneOptions: ({ now, locale, }?: GetTimezoneOptionsParams) => ScheduledTaskTimezoneOption[];
24
+ /**
25
+ * Finds the option naming the same zone as `timezone`: an exact id match, else
26
+ * the option for its canonical form, so a browser reporting `Asia/Calcutta`
27
+ * still lands on the listed `Asia/Kolkata` row. Returns `undefined` when none.
28
+ */
29
+ export declare const findTimezoneOption: (options: readonly ScheduledTaskTimezoneOption[], timezone: string | undefined) => ScheduledTaskTimezoneOption | undefined;
30
+ //# sourceMappingURL=timezones.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timezones.d.ts","sourceRoot":"","sources":["../../src/shared/timezones.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAEjF,+FAA+F;AAC/F,eAAO,MAAM,eAAe,QAAQ,CAAC;AA6BrC,6CAA6C;AAC7C,MAAM,WAAW,wBAAwB;IACvC,oFAAoF;IACpF,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,wFAAwF;IACxF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA2DD,gKAAgK;AAChK,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,KAAG,OACc,CAAC;AAoBlE,sHAAsH;AACtH,eAAO,MAAM,cAAc,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,OACR,CAAC;AAiG/C;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAAI,mBAGhC,wBAA6B,KAAG,2BAA2B,EAyC7D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAC7B,SAAS,SAAS,2BAA2B,EAAE,EAC/C,UAAU,MAAM,GAAG,SAAS,KAC3B,2BAA2B,GAAG,SAMhC,CAAC"}
@@ -0,0 +1,102 @@
1
+ //#region src/shared/timezones.ts
2
+ var e = "UTC", t = {
3
+ "Africa/Asmera": "Africa/Asmara",
4
+ "America/Buenos_Aires": "America/Argentina/Buenos_Aires",
5
+ "America/Godthab": "America/Nuuk",
6
+ "America/Indianapolis": "America/Indiana/Indianapolis",
7
+ "America/Louisville": "America/Kentucky/Louisville",
8
+ "Asia/Calcutta": "Asia/Kolkata",
9
+ "Asia/Katmandu": "Asia/Kathmandu",
10
+ "Asia/Rangoon": "Asia/Yangon",
11
+ "Asia/Saigon": "Asia/Ho_Chi_Minh",
12
+ "Atlantic/Faeroe": "Atlantic/Faroe",
13
+ "Europe/Kiev": "Europe/Kyiv",
14
+ "Pacific/Enderbury": "Pacific/Kanton",
15
+ "Pacific/Ponape": "Pacific/Pohnpei",
16
+ "Pacific/Truk": "Pacific/Chuuk"
17
+ }, n = /^GMT(?:([+-])(\d{1,2})(?::(\d{2}))?)?$/, r = /^[A-Za-z]{2,6}$/, i = 60, a = (e, t, n, r) => {
18
+ try {
19
+ return new Intl.DateTimeFormat(r ?? "en-US", {
20
+ timeZone: e,
21
+ timeZoneName: t
22
+ }).formatToParts(n).find((e) => e.type === "timeZoneName")?.value.replace("−", "-");
23
+ } catch {
24
+ return;
25
+ }
26
+ }, o = (e) => {
27
+ let t = n.exec(e ?? "");
28
+ return t?.[1] ? (t[1] === "-" ? -1 : 1) * (Number(t[2]) * i + Number(t[3] ?? 0)) : 0;
29
+ }, s = (e) => String(e).padStart(2, "0"), c = (e) => {
30
+ let t = e < 0 ? "-" : "+", n = Math.abs(e);
31
+ return `GMT${t}${s(Math.floor(n / i))}:${s(n % i)}`;
32
+ }, l = () => {
33
+ let e = [];
34
+ try {
35
+ e = Intl.supportedValuesOf("timeZone");
36
+ } catch {
37
+ e = [];
38
+ }
39
+ return e.includes("UTC") ? e : [...e, "UTC"];
40
+ }, u = (e) => {
41
+ try {
42
+ return new Intl.DateTimeFormat("en-US", { timeZone: e }), !0;
43
+ } catch {
44
+ return !1;
45
+ }
46
+ }, d = /^[A-Za-z][A-Za-z0-9_+\-/]*$/, f = (e) => d.test(e) && u(e), p = (e) => {
47
+ let n = t[e];
48
+ return n && u(n) ? n : e;
49
+ }, m = (e) => {
50
+ try {
51
+ return p(new Intl.DateTimeFormat("en-US", { timeZone: e }).resolvedOptions().timeZone || e);
52
+ } catch {
53
+ return e;
54
+ }
55
+ }, h = (e, t) => e === t || p(e) === p(t), g = (e) => [...new Set(e.map(m))], _ = ["en-GB", "en-US"], v = (e) => [.../* @__PURE__ */ new Set([e, ..._])], y = (e, t, n) => {
56
+ for (let i of v(n)) {
57
+ let n = a(e, "short", t, i);
58
+ if (n && r.test(n) && n.toUpperCase() !== "GMT") return n;
59
+ }
60
+ }, b = (e, t, n) => t.flatMap((t) => v(n).map((n) => a(e, "short", t, n))).filter((e) => !!e && r.test(e) && e.toUpperCase() !== "GMT"), x = (e, t, n) => {
61
+ let r = [.../* @__PURE__ */ new Set([n, "en-US"])];
62
+ return t.flatMap((t) => r.flatMap((n) => ["long", "longGeneric"].map((r) => a(e, r, t, n)))).filter((e) => !!e && !e.startsWith("GMT"));
63
+ }, S = (e, t, n) => {
64
+ let r = t < 0 ? "-" : "+", a = Math.abs(t), o = Math.floor(a / i), l = a % i, u = [
65
+ c(t),
66
+ `${r}${s(o)}:${s(l)}`,
67
+ `${r}${o}:${s(l)}`,
68
+ `${r}${s(o)}`,
69
+ `${r}${o}`,
70
+ e,
71
+ e.replace(/[_/]/g, " "),
72
+ ...n
73
+ ];
74
+ return [...new Set(u.filter((e) => !!e).map((e) => e.toLowerCase()))];
75
+ }, C = ({ now: e = /* @__PURE__ */ new Date(), locale: t } = {}) => {
76
+ let n = e.getUTCFullYear(), r = new Date(Date.UTC(n, 0, 15, 12)), i = new Date(Date.UTC(n, 6, 15, 12));
77
+ return g(l()).map((n) => {
78
+ let s = o(a(n, "longOffset", e, "en-US")), l = y(n, e, t), u = l?.toUpperCase() === n.toUpperCase() ? void 0 : l, d = {
79
+ id: n,
80
+ offsetLabel: c(s),
81
+ offsetMinutes: s,
82
+ ...u ? { abbreviation: u } : {},
83
+ searchTerms: []
84
+ }, f;
85
+ return Object.defineProperty(d, "searchTerms", {
86
+ enumerable: !0,
87
+ get: () => (f ??= S(n, s, [...b(n, [
88
+ e,
89
+ r,
90
+ i
91
+ ], t), ...x(n, [r, i], t)]), f)
92
+ }), d;
93
+ }).sort((e, t) => e.offsetMinutes === t.offsetMinutes ? e.id === t.id ? 0 : e.id < t.id ? -1 : 1 : e.offsetMinutes - t.offsetMinutes);
94
+ }, w = (e, t) => {
95
+ if (!t) return;
96
+ let n = e.find((e) => e.id === t);
97
+ if (n) return n;
98
+ let r = m(t);
99
+ return e.find((e) => e.id === r);
100
+ };
101
+ //#endregion
102
+ export { e as UTC_TIMEZONE_ID, w as findTimezoneOption, C as getTimezoneOptions, f as isKnownTimezone, h as isSameTimezone };
@@ -1 +1 @@
1
- {"version":3,"file":"skill-archive.d.ts","sourceRoot":"","sources":["../../src/skill/skill-archive.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AA2BvE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,IAAI,KACZ,OAAO,CAAC,oBAAoB,EAAE,CAmBhC,CAAC"}
1
+ {"version":3,"file":"skill-archive.d.ts","sourceRoot":"","sources":["../../src/skill/skill-archive.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AA0BvE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,IAAI,KACZ,OAAO,CAAC,oBAAoB,EAAE,CAsBhC,CAAC"}
@@ -1,19 +1,18 @@
1
1
  import { SKILL_FOLDER_MARKER as e, nameFromPath as t } from "./skill.js";
2
2
  import { inferMimeTypeFromPath as n } from "@epam/ai-dial-chat-shared";
3
- import { unzipSync as r } from "fflate";
4
3
  //#region src/skill/skill-archive.ts
5
- var i = "__MACOSX/", a = ".DS_Store", o = (n) => n.endsWith("/") || n.startsWith(i) || t(n) === a || t(n) === e, s = (e) => new Promise((t, n) => {
4
+ var r = "__MACOSX/", i = ".DS_Store", a = (n) => n.endsWith("/") || n.startsWith(r) || t(n) === i || t(n) === e, o = (e) => new Promise((t, n) => {
6
5
  let r = new FileReader();
7
6
  r.onload = () => t(new Uint8Array(r.result)), r.onerror = () => n(r.error), r.readAsArrayBuffer(e);
8
- }), c = async (e) => {
9
- let i = r(await s(e));
10
- return Object.entries(i).flatMap(([e, r]) => {
7
+ }), s = async (e) => {
8
+ let r = await o(e), { unzipSync: i } = await import("fflate"), s = i(r);
9
+ return Object.entries(s).flatMap(([e, r]) => {
11
10
  let i = e.replace(/\\/g, "/");
12
- return o(i) ? [] : [{
11
+ return a(i) ? [] : [{
13
12
  path: i,
14
13
  file: new File([r], t(i), { type: n(i) ?? "" })
15
14
  }];
16
15
  });
17
16
  };
18
17
  //#endregion
19
- export { c as extractSkillArchive };
18
+ export { s as extractSkillArchive };
package/skill/skill.d.ts CHANGED
@@ -130,10 +130,10 @@ export interface UnpackedSkillArchive {
130
130
  * Unpacks a whole-skill ZIP (as downloaded from `GET /api/v1/skills/download`
131
131
  * — DIAL Core's whole-resource `GET` is the one place this contract still
132
132
  * uses a ZIP, per `openspec/changes/archive/2026-10-05-persist-skill-empty-folders/design.md`) into its manifest text, every other entry's
133
- * bytes, and the folders its empty-folder markers stand for. Throws if the
133
+ * bytes, and the folders its empty-folder markers stand for. Rejects if the
134
134
  * archive has no root `SKILL.md` entry.
135
135
  */
136
- export declare const unpackSkillArchive: (bytes: Uint8Array) => UnpackedSkillArchive;
136
+ export declare const unpackSkillArchive: (bytes: Uint8Array) => Promise<UnpackedSkillArchive>;
137
137
  /** Returns a skill relative path's final segment (its display name in the file tree). */
138
138
  export declare const nameFromPath: (path: string) => string;
139
139
  /** Wraps raw bytes in a `Blob`, copying them so the source buffer can be reused. */
@@ -1 +1 @@
1
- {"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../src/skill/skill.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,gKAAgK;AAChK,eAAO,MAAM,mBA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AAoB,GAAI,OAAO,UAAU,KAAG,IACtB,CAAC;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,GACtC,aAAa,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,MAAM,MAAM,EACZ,aAAa,MAAM,EACnB,cAAc,MAAM,KACnB,MAQ0D,CAAC;AAE9D,+FAA+F;AAC/F,MAAM,WAAW,iBAAiB;IAChC,wDAAwD;IACxD,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,2DAA2D;IAC3D,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GACjC,OAAO,iBAAiB,EAAE,EAC1B,cAAc,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,KAC1C,iBAsBF,CAAC"}
package/skill/skill.js CHANGED
@@ -1,73 +1,72 @@
1
1
  import { ENTITY_DESCRIPTION_MAX_LENGTH as e, ENTITY_INSTRUCTIONS_MAX_LENGTH as t, ENTITY_NAME_MAX_LENGTH as n, HIDDEN_FILE as r, exceedsMaxLength as i } from "@epam/ai-dial-chat-shared";
2
2
  import { SkillFileNodeKind as a } from "@epam/ai-dial-skill-editor";
3
- import { unzipSync as o } from "fflate";
4
- import { parse as s, stringify as c } from "yaml";
3
+ import { parse as o, stringify as s } from "yaml";
5
4
  //#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), _ = /* @__PURE__ */ new Set([
5
+ var c = "SKILL.md", l = 1048576, u = 16777216, d = 100, f = r, p = `/${f}`, m = (e) => e.endsWith(p) && e.length > p.length, h = (e) => e.slice(0, -p.length), g = /* @__PURE__ */ new Set([
7
6
  ".dial-resource",
8
7
  ".dial-folder",
9
- p
10
- ]), v = /* @__PURE__ */ new Set(["files", "v"]), y = /^[a-zA-Z]:/, b = /[\x00-\x1f]/, x = (e) => {
11
- if (e === "" || e.startsWith("/") || y.test(e) || e.includes("\\") || b.test(e)) return !1;
8
+ f
9
+ ]), _ = /* @__PURE__ */ new Set(["files", "v"]), v = /^[a-zA-Z]:/, y = /[\x00-\x1f]/, b = (e) => {
10
+ if (e === "" || e.startsWith("/") || v.test(e) || e.includes("\\") || y.test(e)) return !1;
12
11
  let t = e.split("/");
13
- return !(t.some((e) => e === "" || e === "." || e === "..") || t.some((e) => _.has(e)) || v.has(t[0]));
14
- }, S = (e) => e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-/, "").replace(/-$/, ""), C = /* @__PURE__ */ function(e) {
12
+ return !(t.some((e) => e === "" || e === "." || e === "..") || t.some((e) => g.has(e)) || _.has(t[0]));
13
+ }, x = (e) => e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-/, "").replace(/-$/, ""), S = /* @__PURE__ */ function(e) {
15
14
  return e.Name = "name", e.Description = "description", e.Instructions = "instructions", e;
16
- }({}), w = {
15
+ }({}), C = {
17
16
  name: n,
18
17
  description: e,
19
18
  instructions: t
20
- }, T = (e) => {
19
+ }, w = (e) => {
21
20
  let t = {};
22
- for (let n of Object.keys(w)) {
23
- let r = w[n];
21
+ for (let n of Object.keys(C)) {
22
+ let r = C[n];
24
23
  i(e[n].trim(), r) && (t[n] = r);
25
24
  }
26
25
  return t;
27
- }, E = ({ name: e, description: t, instructions: n }) => `---\n${c({
26
+ }, T = ({ name: e, description: t, instructions: n }) => `---\n${s({
28
27
  name: e,
29
28
  description: t
30
- }).trimEnd()}\n---\n\n${n}`, D = (e, t, n, r) => {
29
+ }).trimEnd()}\n---\n\n${n}`, E = (e, t, n, r) => {
31
30
  let i = {
32
31
  ...e,
33
32
  name: t,
34
33
  description: n
35
34
  };
36
- return `---\n${c(i).trimEnd()}\n---\n\n${r}`;
37
- }, O = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/, k = /^---[ \t]*$/, A = (e) => {
35
+ return `---\n${s(i).trimEnd()}\n---\n\n${r}`;
36
+ }, D = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/, O = /^---[ \t]*$/, k = (e) => {
38
37
  let t = e.replace(/^\uFEFF/, "").replace(/\r\n/g, "\n").split("\n"), n = t.findIndex((e) => e.trim() !== "");
39
- return n === -1 || !k.test(t[n]) ? !1 : t.some((e, t) => t > n && k.test(e));
40
- }, j = (e) => {
41
- let t = O.exec(e);
38
+ return n === -1 || !O.test(t[n]) ? !1 : t.some((e, t) => t > n && O.test(e));
39
+ }, A = (e) => {
40
+ let t = D.exec(e);
42
41
  if (!t) throw Error("SKILL.md is missing its YAML frontmatter block");
43
42
  let [, n, r] = t;
44
43
  return {
45
- frontmatter: s(n) ?? {},
44
+ frontmatter: o(n) ?? {},
46
45
  instructions: r.replace(/^\r?\n/, "")
47
46
  };
48
- }, M = (e) => {
49
- let t = o(e), n = t[l];
50
- if (n == null) throw Error(`Skill archive is missing a root ${l} file`);
51
- let r = /* @__PURE__ */ new Map(), i = [];
52
- 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));
47
+ }, j = async (e) => {
48
+ let { unzipSync: t } = await import("fflate"), n = t(e), r = n[c];
49
+ if (r == null) throw Error(`Skill archive is missing a root ${c} file`);
50
+ let i = /* @__PURE__ */ new Map(), a = [];
51
+ for (let [e, t] of Object.entries(n)) e === "SKILL.md" || e.endsWith("/") || (m(e) ? a.push(h(e)) : e !== f && i.set(e, t));
53
52
  return {
54
- manifestText: new TextDecoder().decode(n),
55
- files: r,
56
- folders: i
53
+ manifestText: new TextDecoder().decode(r),
54
+ files: i,
55
+ folders: a
57
56
  };
58
- }, N = (e) => {
57
+ }, M = (e) => {
59
58
  let t = e.lastIndexOf("/");
60
59
  return t === -1 ? e : e.slice(t + 1);
61
- }, P = (e) => new Blob([new Uint8Array(e)]), F = (e, t, n, r) => Object.keys(e).length > 0 ? D(e, t, n, r) : E({
60
+ }, N = (e) => new Blob([new Uint8Array(e)]), P = (e, t, n, r) => Object.keys(e).length > 0 ? E(e, t, n, r) : T({
62
61
  name: t,
63
62
  description: n,
64
63
  instructions: r
65
- }), I = (e, t) => {
66
- 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}`);
64
+ }), F = (e, t) => {
65
+ 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}${p}`);
67
66
  return {
68
67
  filePaths: [...n.map((e) => e.path), ...r],
69
- files: [...n.map((e) => P(t.get(e.path)?.bytes ?? /* @__PURE__ */ new Uint8Array())), ...r.map(() => new Blob([]))]
68
+ files: [...n.map((e) => N(t.get(e.path)?.bytes ?? /* @__PURE__ */ new Uint8Array())), ...r.map(() => new Blob([]))]
70
69
  };
71
70
  };
72
71
  //#endregion
73
- export { u as SKILL_FILE_UPLOAD_MAX_BYTES, p as SKILL_FOLDER_MARKER, l as SKILL_MANIFEST_FILE, w as SKILL_TEXT_FIELD_MAX_LENGTHS, f as SKILL_UPLOAD_MAX_FILES, d as SKILL_UPLOAD_MAX_TOTAL_BYTES, C as SkillTextField, I as buildSkillFilesPayload, E as buildSkillManifest, F as buildSkillManifestForSubmit, D as buildSkillManifestFromFrontmatter, T as getSkillFieldLengthViolations, h as isSkillFolderMarkerPath, x as isValidSkillRelativePath, N as nameFromPath, S as normalizeSkillName, j as parseSkillManifest, P as skillFileBytesToBlob, g as skillFolderMarkerParent, A as startsWithFrontmatterBlock, M as unpackSkillArchive };
72
+ export { l as SKILL_FILE_UPLOAD_MAX_BYTES, f as SKILL_FOLDER_MARKER, c as SKILL_MANIFEST_FILE, C as SKILL_TEXT_FIELD_MAX_LENGTHS, d as SKILL_UPLOAD_MAX_FILES, u as SKILL_UPLOAD_MAX_TOTAL_BYTES, S as SkillTextField, F as buildSkillFilesPayload, T as buildSkillManifest, P as buildSkillManifestForSubmit, E as buildSkillManifestFromFrontmatter, w as getSkillFieldLengthViolations, m as isSkillFolderMarkerPath, b as isValidSkillRelativePath, M as nameFromPath, x as normalizeSkillName, A as parseSkillManifest, N as skillFileBytesToBlob, h as skillFolderMarkerParent, k as startsWithFrontmatterBlock, j as unpackSkillArchive };