@epam/ai-dial-chat-hooks 1.2.0-dev.3 → 1.2.0-dev.303

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 (104) hide show
  1. package/api-error/api-error.js +7 -4
  2. package/attachment/useAttachmentValidation/useAttachmentValidation.js +26 -19
  3. package/attachments.d.ts +10 -4
  4. package/catalog/catalog-derivations.js +1 -1
  5. package/catalog/deployment-id.js +8 -2
  6. package/catalog/map-deployment-limits-to-catalog.js +16 -24
  7. package/catalog/map-deployment-limits-to-input.js +81 -9
  8. package/catalog/map-deployment-to-catalog-item.js +34 -34
  9. package/catalog/map-entity-details-to-catalog.js +7 -0
  10. package/catalog/map-skill-to-catalog-item.js +55 -48
  11. package/catalog/publish.js +6 -5
  12. package/catalog/useApplicationCredentials/useApplicationCredentials.js +39 -0
  13. package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.js +122 -101
  14. package/catalog/usePublishFolders/usePublishFolders.js +1 -1
  15. package/catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js +39 -39
  16. package/catalog/useSkillItemDetails.js +19 -17
  17. package/catalog.d.ts +159 -35
  18. package/catalog.js +23 -22
  19. package/conversation/announcement-message.js +16 -5
  20. package/conversation/conversation-transfer/export-conversation.js +24 -16
  21. package/conversation/conversation-transfer/import-conversation.js +80 -31
  22. package/conversation/conversation-transfer/queue.js +8 -5
  23. package/conversation/create-chat-stream-api.js +85 -49
  24. package/conversation/message-utils.js +44 -2
  25. package/conversation/stage.js +27 -0
  26. package/conversation/useActiveConversationSync/useActiveConversationSync.js +7 -8
  27. package/conversation/useAttachmentUpload/useAttachmentUpload.js +12 -5
  28. package/conversation/useConversationExport/useConversationExport.js +9 -9
  29. package/conversation/useConversationHandlers/message-utils.js +8 -5
  30. package/conversation/useConversationHandlers/useConversationHandlers.js +187 -177
  31. package/conversation/useConversationImport/useConversationImport.js +123 -121
  32. package/conversation/useConversationPanelItems/useConversationPanelItems.js +50 -32
  33. package/conversation/useConversationScroll/useConversationScroll.js +68 -64
  34. package/conversation/useConversationStream/apply-chunk.js +1 -1
  35. package/conversation/useConversationStream/frame-scheduler.js +39 -0
  36. package/conversation/useConversationStream/generation-resume.js +122 -64
  37. package/conversation/useConversationStream/useConversationStream.js +279 -116
  38. package/conversation/useMessageSelectionReply/useMessageSelectionReply.js +189 -0
  39. package/conversation/useTranscribeAudio/transcription-retry.js +5 -4
  40. package/conversation-overlay.d.ts +7 -0
  41. package/conversation-overlay.js +2 -0
  42. package/conversation-sources/useConversationSources/useConversationSources.js +31 -24
  43. package/conversation-sources.d.ts +1 -1
  44. package/conversation-transfer.d.ts +2 -1
  45. package/conversation.d.ts +328 -25
  46. package/conversation.js +32 -30
  47. package/file-manager-canvas.d.ts +418 -0
  48. package/file-manager-canvas.js +2 -0
  49. package/file-manager.d.ts +155 -359
  50. package/file-manager.js +25 -24
  51. package/files/attachment-canvas.js +116 -55
  52. package/files/attachment-types.js +14 -13
  53. package/files/dial-file-manager-copy-move.util.js +9 -8
  54. package/files/dial-file-manager-mapping.util.js +2 -1
  55. package/files/dial-file-manager-path.util.js +24 -2
  56. package/files/dial-file-manager.model.js +23 -19
  57. package/files/dial-file-manager.types.js +3 -3
  58. package/files/file-manager-variant.js +1 -1
  59. package/files/resolve-dial-file-api-path.js +11 -12
  60. package/files/useDialFileListing/useDialFileListing.js +140 -127
  61. package/files/useDialFileManager/useDialFileManager.js +139 -135
  62. package/files/useDialFileManagerSections/useDialFileManagerSections.js +155 -0
  63. package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +20 -19
  64. package/files/useDialFileMutations/useDialFileMutations.js +65 -60
  65. package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +117 -110
  66. package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +48 -0
  67. package/index.d.ts +1281 -136
  68. package/index.js +136 -122
  69. package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +7 -5
  70. package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +1 -1
  71. package/mcp-apps/useMcpAppTools/useMcpAppTools.js +1 -1
  72. package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +25 -23
  73. package/mcp-apps.d.ts +8 -6
  74. package/oauth/toolset-id.js +5 -3
  75. package/oauth/useToolsetLogin/useToolsetLogin.js +8 -8
  76. package/oauth.d.ts +32 -0
  77. package/oauth.js +9 -9
  78. package/package.json +38 -23
  79. package/scheduled-task/scheduled-task-description.js +81 -0
  80. package/scheduled-task/scheduled-task-preparation.js +24 -0
  81. package/scheduled-task/scheduled-task-trigger.js +74 -71
  82. package/scheduled-task/scheduled-tasks-api-client.js +19 -0
  83. package/scheduled-task/use-scheduled-task-runs.js +194 -0
  84. package/scheduled-task/use-scheduled-tasks.js +93 -0
  85. package/scheduled-tasks.d.ts +197 -3
  86. package/scheduled-tasks.js +7 -2
  87. package/shared/application-schema.js +5 -2
  88. package/shared/cron-day-of-month.js +13 -0
  89. package/skill/skill-archive.js +19 -0
  90. package/skill/skill-types.js +8 -7
  91. package/skill/skill.js +53 -27
  92. package/skill/useSkillArchiveImport/useSkillArchiveImport.js +79 -0
  93. package/skill/useSkillEditorLoad.js +65 -59
  94. package/skill/useSkillEditorSubmit.js +108 -84
  95. package/skill/useSkillFileActions.js +70 -58
  96. package/skill-editor.d.ts +160 -8
  97. package/skill-editor.js +9 -8
  98. package/usage/map-usage-data-to-dashboard.js +66 -0
  99. package/usage/map-user-usage-to-model-limits.js +202 -0
  100. package/usage.d.ts +125 -0
  101. package/usage.js +3 -0
  102. package/usePageFileDrag/usePageFileDrag.js +3 -3
  103. package/utils.d.ts +26 -6
  104. package/utils.js +10 -10
@@ -0,0 +1,194 @@
1
+ import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
2
+ import { ScheduledTaskRunDtoStatusEnum as i } from "@epam/ai-dial-chat-api-client";
3
+ //#region src/scheduled-task/use-scheduled-task-runs.ts
4
+ var a = 15e3, o = 20, s = 5e3, c = 2147483647, l = (e, t) => {
5
+ if (e <= c) {
6
+ let n = setTimeout(t, Math.max(e, 0));
7
+ return () => clearTimeout(n);
8
+ }
9
+ let n, r = setTimeout(() => {
10
+ n = l(e - c, t);
11
+ }, c);
12
+ return n = () => clearTimeout(r), () => n();
13
+ }, u = (e, t) => {
14
+ let n = new Map(t.map((e) => [e.id, e])), r = new Set(e.map((e) => e.id)), i = e.map((e) => n.get(e.id) ?? e);
15
+ return [...t.filter((e) => !r.has(e.id)), ...i];
16
+ }, d = (e, t) => {
17
+ if (e.length !== t.length) return !0;
18
+ let n = new Map(e.map((e) => [e.id, e]));
19
+ return t.some((e) => {
20
+ let t = n.get(e.id);
21
+ return !t || JSON.stringify(t) !== JSON.stringify(e);
22
+ });
23
+ }, f = (c, { scheduleId: f, enabled: p = !0, pageSize: m = 10, nextRunTime: h }) => {
24
+ let [g, _] = r([]), [v, y] = r(p), [b, x] = r(!1), [S, C] = r(null), [w, T] = r(null), [E, D] = r(!1), [O, k] = r(0), A = n(0), j = n(0), M = n(!1), N = n(null), P = n(g), F = n(v), I = n(b), L = n(null), R = n(0), z = n(null), B = n(!1);
25
+ P.current = g, F.current = v, I.current = b;
26
+ let V = g.some((e) => e.status === i.InProgress);
27
+ t(() => {
28
+ let e = ++A.current, t = new AbortController();
29
+ N.current?.abort(), N.current = null, L.current?.abort(), L.current = null, M.current = !1, R.current = 0, z.current = null, B.current = !1, x(!1), C(null), T(null), _([]), D(!1), j.current = 0;
30
+ let n = () => {
31
+ ++A.current, t.abort(), N.current?.abort(), N.current = null, L.current?.abort(), L.current = null;
32
+ };
33
+ return !p || !f ? (y(!1), _([]), D(!1), n) : ((async () => {
34
+ y(!0);
35
+ try {
36
+ let n = await c.listScheduledTaskRuns({
37
+ scheduleId: f,
38
+ limit: m,
39
+ offset: 0,
40
+ signal: t.signal
41
+ });
42
+ if (A.current !== e) return;
43
+ _(n.items), j.current = n.items.length, D(n.next != null || (n.count == null ? n.items.length === m : n.items.length < n.count));
44
+ } catch (t) {
45
+ A.current === e && C(t instanceof Error ? t : /* @__PURE__ */ Error("Failed to load scheduled task runs"));
46
+ } finally {
47
+ A.current === e && y(!1);
48
+ }
49
+ })(), n);
50
+ }, [
51
+ c,
52
+ p,
53
+ m,
54
+ O,
55
+ f
56
+ ]);
57
+ let H = e(() => {
58
+ if (!p || !f || !E || v || M.current) return;
59
+ M.current = !0;
60
+ let e = new AbortController();
61
+ N.current = e;
62
+ let t = A.current, n = j.current;
63
+ (async () => {
64
+ x(!0), T(null);
65
+ try {
66
+ let r = await c.listScheduledTaskRuns({
67
+ scheduleId: f,
68
+ limit: m,
69
+ offset: n,
70
+ signal: e.signal
71
+ });
72
+ if (A.current !== t) return;
73
+ _((e) => {
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))];
76
+ }), j.current = n + r.items.length, D(r.next != null || (r.count == null ? r.items.length === m : n + r.items.length < r.count));
77
+ } catch (e) {
78
+ A.current === t && T(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load more scheduled task runs"));
79
+ } finally {
80
+ A.current === t && (x(!1), M.current = !1, N.current = null);
81
+ }
82
+ })();
83
+ }, [
84
+ c,
85
+ p,
86
+ E,
87
+ v,
88
+ m,
89
+ f
90
+ ]), U = e(async () => {
91
+ if (F.current || I.current) return "skipped";
92
+ let e = A.current, t = new AbortController();
93
+ L.current?.abort(), L.current = t;
94
+ try {
95
+ let n = await c.listScheduledTaskRuns({
96
+ scheduleId: f,
97
+ limit: m,
98
+ offset: 0,
99
+ signal: t.signal
100
+ });
101
+ if (A.current !== e || F.current || I.current) return "skipped";
102
+ let r = P.current, i = u(r, n.items), a = d(r, i);
103
+ return a && (P.current = i, _(i)), a ? "changed" : "unchanged";
104
+ } catch {
105
+ return "error";
106
+ } finally {
107
+ L.current === t && (L.current = null);
108
+ }
109
+ }, [
110
+ c,
111
+ f,
112
+ m
113
+ ]), W = e(() => {
114
+ if (document.visibilityState !== "visible") {
115
+ B.current = !0;
116
+ return;
117
+ }
118
+ U();
119
+ }, [U]);
120
+ return t(() => {
121
+ if (!p || !f || !V) return;
122
+ R.current = 0;
123
+ let e = setInterval(() => {
124
+ if (document.visibilityState !== "visible") {
125
+ B.current = !0;
126
+ return;
127
+ }
128
+ (async () => {
129
+ let t = await U();
130
+ if (t === "changed") {
131
+ R.current = 0;
132
+ return;
133
+ }
134
+ (t === "unchanged" || t === "error") && (R.current += 1, R.current >= o && e !== null && (clearInterval(e), e = null));
135
+ })();
136
+ }, a);
137
+ return () => {
138
+ e !== null && clearInterval(e);
139
+ };
140
+ }, [
141
+ p,
142
+ f,
143
+ V,
144
+ U
145
+ ]), t(() => {
146
+ if (!p || !f || !h) return;
147
+ let e = new Date(h).getTime();
148
+ if (!(Number.isNaN(e) || e <= Date.now())) return l(e - Date.now() + s, () => {
149
+ z.current = h, W();
150
+ });
151
+ }, [
152
+ p,
153
+ f,
154
+ h,
155
+ W
156
+ ]), t(() => {
157
+ if (!p || !f) return;
158
+ let e = () => {
159
+ document.visibilityState !== "visible" || !B.current || (async () => {
160
+ await U() !== "skipped" && (B.current = !1);
161
+ })();
162
+ };
163
+ return document.addEventListener("visibilitychange", e), () => {
164
+ document.removeEventListener("visibilitychange", e);
165
+ };
166
+ }, [
167
+ p,
168
+ f,
169
+ U
170
+ ]), t(() => {
171
+ if (!p || !f || !h || v || b) return;
172
+ let e = new Date(h).getTime();
173
+ Number.isNaN(e) || e > Date.now() || z.current !== h && (z.current = h, W());
174
+ }, [
175
+ p,
176
+ f,
177
+ h,
178
+ v,
179
+ b,
180
+ W
181
+ ]), {
182
+ items: g,
183
+ isLoading: v,
184
+ isLoadingMore: b,
185
+ initialError: S,
186
+ loadMoreError: w,
187
+ hasMore: E,
188
+ loadMore: H,
189
+ retryLoadMore: H,
190
+ refetch: e(() => k((e) => e + 1), [])
191
+ };
192
+ };
193
+ //#endregion
194
+ export { u as mergeRunsById, f as useScheduledTaskRuns };
@@ -0,0 +1,93 @@
1
+ import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
2
+ //#region src/scheduled-task/use-scheduled-tasks.ts
3
+ var i = (i, { enabled: a = !0, pageSize: o = 20, debounceMs: s = 300, initialSearch: c = "", initialSort: l = "first_to_run" } = {}) => {
4
+ let [u, d] = r([]), [f, p] = r(c), [m, h] = r(l), [g, _] = r(a), [v, y] = r(!1), [b, x] = r(null), [S, C] = r(null), [w, T] = r(!1), [E, D] = r(0), O = n(0), k = n(0), A = n(!1), j = n(null), [M, N] = r(c);
5
+ t(() => {
6
+ let e = setTimeout(() => N(f), s);
7
+ return () => clearTimeout(e);
8
+ }, [s, f]), t(() => {
9
+ let e = ++O.current, t = new AbortController();
10
+ j.current?.abort(), j.current = null, A.current = !1, y(!1), x(null), C(null), d([]), T(!1), k.current = 0;
11
+ let n = () => {
12
+ ++O.current, t.abort(), j.current?.abort(), j.current = null;
13
+ };
14
+ return a ? ((async () => {
15
+ _(!0);
16
+ try {
17
+ let n = await i.listScheduledTasks({
18
+ limit: o,
19
+ offset: 0,
20
+ search: M,
21
+ sort: m,
22
+ signal: t.signal
23
+ });
24
+ if (O.current !== e) return;
25
+ d(n.items), k.current = n.items.length, T(n.next != null);
26
+ } catch (t) {
27
+ O.current === e && x(t instanceof Error ? t : /* @__PURE__ */ Error("Failed to load scheduled tasks"));
28
+ } finally {
29
+ O.current === e && _(!1);
30
+ }
31
+ })(), n) : (_(!1), d([]), T(!1), n);
32
+ }, [
33
+ i,
34
+ M,
35
+ a,
36
+ o,
37
+ E,
38
+ m
39
+ ]);
40
+ let P = e(() => {
41
+ if (!a || !w || g || A.current) return;
42
+ A.current = !0;
43
+ let e = new AbortController();
44
+ j.current = e;
45
+ let t = O.current, n = k.current;
46
+ (async () => {
47
+ y(!0), C(null);
48
+ try {
49
+ let r = await i.listScheduledTasks({
50
+ limit: o,
51
+ offset: n,
52
+ signal: e.signal,
53
+ search: M,
54
+ sort: m
55
+ });
56
+ if (O.current !== t) return;
57
+ d((e) => {
58
+ let t = new Set(e.map(({ id: e }) => e));
59
+ return [...e, ...r.items.filter(({ id: e }) => t.has(e) ? !1 : (t.add(e), !0))];
60
+ }), k.current = n + r.items.length, T(r.next != null);
61
+ } catch (e) {
62
+ O.current === t && C(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load more scheduled tasks"));
63
+ } finally {
64
+ O.current === t && (y(!1), A.current = !1, j.current = null);
65
+ }
66
+ })();
67
+ }, [
68
+ i,
69
+ M,
70
+ a,
71
+ w,
72
+ g,
73
+ o,
74
+ m
75
+ ]);
76
+ return {
77
+ items: u,
78
+ searchQuery: f,
79
+ setSearchQuery: p,
80
+ sortKey: m,
81
+ setSortKey: h,
82
+ isLoading: g,
83
+ isLoadingMore: v,
84
+ initialError: b,
85
+ loadMoreError: S,
86
+ hasMore: w,
87
+ loadMore: P,
88
+ retryLoadMore: P,
89
+ refetch: e(() => D((e) => e + 1), [])
90
+ };
91
+ };
92
+ //#endregion
93
+ export { i as useScheduledTasks };
@@ -1,8 +1,35 @@
1
+ import { CreatedScheduledTaskDto } from '@epam/ai-dial-chat-api-client';
1
2
  import { CreateScheduledTaskBodyDto } from '@epam/ai-dial-chat-api-client';
3
+ import { Dispatch } from 'react';
4
+ import { ListScheduledTaskRunsResponseDto } from '@epam/ai-dial-chat-api-client';
5
+ import { ListScheduledTasksResponseDto } from '@epam/ai-dial-chat-api-client';
6
+ import { ListScheduledTasksSortEnum } from '@epam/ai-dial-chat-api-client';
2
7
  import { ScheduledTaskCreateFormValues } from '@epam/ai-dial-scheduled-tasks';
3
8
  import { ScheduledTaskDto } from '@epam/ai-dial-chat-api-client';
9
+ import { ScheduledTaskRunDto } from '@epam/ai-dial-chat-api-client';
10
+ import { ScheduledTaskValidationErrors } from '../../libs/scheduled-tasks/validation';
11
+ import { ScheduledTaskValidationOptions } from '../../libs/scheduled-tasks/validation';
12
+ import { ScheduleTriggerDto } from '@epam/ai-dial-chat-api-client';
13
+ import { SetStateAction } from 'react';
14
+ import { UpdatedScheduledTaskDto } from '@epam/ai-dial-chat-api-client';
4
15
  import { UpdateScheduledTaskBodyDto } from '@epam/ai-dial-chat-api-client';
5
16
 
17
+ /**
18
+ * Composes scheduler operations over an already configured generated client.
19
+ * Authentication, base URL, CSRF, and retries remain host responsibilities.
20
+ */
21
+ export declare const createScheduledTasksApiClient: (client: ScheduledTasksConfiguredClient) => ScheduledTasksApiClient;
22
+
23
+ /**
24
+ * Describes the complete trigger without requiring unrelated task metadata.
25
+ * Unsupported constraints remain Custom, with the full source expression.
26
+ * Calendar-month shifts crossing month boundaries or days 29–31 remain
27
+ * Custom because a shifted monthly day is not equivalent around short months.
28
+ * The one exception is `day: 'last'` one day behind local time, which is
29
+ * exactly the local 1st.
30
+ */
31
+ export declare const describeScheduledTaskTrigger: (trigger: ScheduleTriggerDto, { timeZone, referenceDate, }?: ScheduledTaskTriggerDescriptionOptions) => ScheduledTaskTriggerDescription;
32
+
6
33
  /**
7
34
  * Maps validated create-form values to the `POST /api/v1/scheduled-tasks`
8
35
  * request body, building `trigger.date` for a one-shot schedule or
@@ -13,9 +40,8 @@ import { UpdateScheduledTaskBodyDto } from '@epam/ai-dial-chat-api-client';
13
40
  export declare const mapFormValuesToCreateBody: (values: ScheduledTaskCreateFormValues) => CreateScheduledTaskBodyDto;
14
41
 
15
42
  /**
16
- * Maps validated edit-form values to the `PUT /api/v1/scheduled-tasks/:scheduleId`
17
- * request body. `UpdateScheduledTaskBodyDto` has the same shape as
18
- * `CreateScheduledTaskBodyDto`, so this reuses the same trigger-building logic.
43
+ * Maps a complete, validated edit draft to an update body. An unset skill
44
+ * emits null to remove the saved reference; hydrate from detail before editing.
19
45
  */
20
46
  export declare const mapFormValuesToUpdateBody: (values: ScheduledTaskCreateFormValues) => UpdateScheduledTaskBodyDto;
21
47
 
@@ -29,6 +55,24 @@ export declare const mapFormValuesToUpdateBody: (values: ScheduledTaskCreateForm
29
55
  */
30
56
  export declare const mapScheduledTaskDtoToFormValues: (dto: ScheduledTaskDto) => ScheduledTaskDtoMappingResult;
31
57
 
58
+ /**
59
+ * Merges a freshly-fetched page 0 into the currently-loaded run list: an
60
+ * already-known id is replaced in place at its existing array position, an
61
+ * unseen id is prepended (upstream order is `created_at desc`, so it is the
62
+ * newest), and an id absent from `incoming` is left untouched — a background
63
+ * refresh never removes a loaded run.
64
+ */
65
+ export declare const mergeRunsById: (current: ScheduledTaskRunDto[], incoming: ScheduledTaskRunDto[]) => ScheduledTaskRunDto[];
66
+
67
+ /**
68
+ * Validates form values before creating a request body. Hosts translate the
69
+ * returned field codes and must not issue a write when `ok` is false.
70
+ */
71
+ export declare const prepareScheduledTaskCreateBody: (values: ScheduledTaskCreateFormValues, options: ScheduledTaskValidationOptions) => ScheduledTaskPreparationResult<CreateScheduledTaskBodyDto>;
72
+
73
+ /** Validates form values before preparing an update request body. */
74
+ export declare const prepareScheduledTaskUpdateBody: (values: ScheduledTaskCreateFormValues, options: ScheduledTaskValidationOptions) => ScheduledTaskPreparationResult<UpdateScheduledTaskBodyDto>;
75
+
32
76
  /** Result of mapping a scheduled task DTO back to editable form values. */
33
77
  export declare type ScheduledTaskDtoMappingResult = {
34
78
  ok: true;
@@ -38,6 +82,106 @@ export declare type ScheduledTaskDtoMappingResult = {
38
82
  reason: UnsupportedTriggerReason;
39
83
  };
40
84
 
85
+ /** A checked request preparation result that never serializes invalid values. */
86
+ export declare type ScheduledTaskPreparationResult<TBody> = {
87
+ ok: true;
88
+ body: TBody;
89
+ } | {
90
+ ok: false;
91
+ errors: ScheduledTaskValidationErrors;
92
+ };
93
+
94
+ export declare interface ScheduledTaskRunsListRequest {
95
+ scheduleId: string;
96
+ limit?: number;
97
+ offset?: number;
98
+ signal?: AbortSignal;
99
+ }
100
+
101
+ export declare interface ScheduledTasksApiClient {
102
+ listScheduledTasks: (request?: ScheduledTasksListRequest) => Promise<ListScheduledTasksResponseDto>;
103
+ listScheduledTaskRuns: (request: ScheduledTaskRunsListRequest) => Promise<ListScheduledTaskRunsResponseDto>;
104
+ createScheduledTask: (body: CreateScheduledTaskBodyDto) => Promise<CreatedScheduledTaskDto>;
105
+ getScheduledTask: (scheduleId: string) => Promise<ScheduledTaskDto>;
106
+ updateScheduledTask: (scheduleId: string, body: UpdateScheduledTaskBodyDto) => Promise<UpdatedScheduledTaskDto>;
107
+ pauseScheduledTask: (scheduleId: string) => Promise<ScheduledTaskDto>;
108
+ resumeScheduledTask: (scheduleId: string) => Promise<ScheduledTaskDto>;
109
+ deleteScheduledTask: (scheduleId: string) => Promise<void>;
110
+ }
111
+
112
+ /** Narrow configured generated-client surface required by scheduler hooks. */
113
+ export declare interface ScheduledTasksConfiguredClient {
114
+ listScheduledTasks: (request: {
115
+ limit?: number;
116
+ offset?: number;
117
+ search?: string;
118
+ sort?: ListScheduledTasksSortEnum;
119
+ }, options?: RequestInit) => Promise<ListScheduledTasksResponseDto>;
120
+ listScheduledTaskRuns: (request: {
121
+ scheduleId: string;
122
+ limit?: number;
123
+ offset?: number;
124
+ }, options?: RequestInit) => Promise<ListScheduledTaskRunsResponseDto>;
125
+ createScheduledTask: (request: {
126
+ createScheduledTaskBodyDto: CreateScheduledTaskBodyDto;
127
+ }) => Promise<CreatedScheduledTaskDto>;
128
+ getScheduledTask: (request: {
129
+ scheduleId: string;
130
+ }) => Promise<ScheduledTaskDto>;
131
+ updateScheduledTask: (request: {
132
+ scheduleId: string;
133
+ updateScheduledTaskBodyDto: UpdateScheduledTaskBodyDto;
134
+ }) => Promise<UpdatedScheduledTaskDto>;
135
+ pauseScheduledTask: (request: {
136
+ scheduleId: string;
137
+ }) => Promise<ScheduledTaskDto>;
138
+ resumeScheduledTask: (request: {
139
+ scheduleId: string;
140
+ }) => Promise<ScheduledTaskDto>;
141
+ deleteScheduledTask: (request: {
142
+ scheduleId: string;
143
+ }) => Promise<void>;
144
+ }
145
+
146
+ /** App-agnostic request options accepted by the scheduler facade. */
147
+ export declare interface ScheduledTasksListRequest {
148
+ limit?: number;
149
+ offset?: number;
150
+ search?: string;
151
+ sort?: ListScheduledTasksSortEnum;
152
+ signal?: AbortSignal;
153
+ }
154
+
155
+ export declare interface ScheduledTaskTriggerDescription {
156
+ kind: ScheduledTaskTriggerDescriptionKind;
157
+ time?: string;
158
+ dayOfWeek?: string;
159
+ dayOfMonth?: string;
160
+ intervalMinutes?: number;
161
+ date?: Date;
162
+ expression?: string;
163
+ sourceTimezone: 'utc';
164
+ }
165
+
166
+ /** Display categories are independent of task editability. */
167
+ export declare enum ScheduledTaskTriggerDescriptionKind {
168
+ OneTime = "oneTime",
169
+ Hourly = "hourly",
170
+ EveryNMinutes = "everyNMinutes",
171
+ Daily = "daily",
172
+ Weekly = "weekly",
173
+ Monthly = "monthly",
174
+ Custom = "custom",
175
+ Invalid = "invalid"
176
+ }
177
+
178
+ export declare interface ScheduledTaskTriggerDescriptionOptions {
179
+ /** Display timezone; defaults to UTC for backwards compatibility. */
180
+ timeZone?: string;
181
+ /** Date whose timezone offset is used. Defaults to now (the existing UTC-storage policy). */
182
+ referenceDate?: Date;
183
+ }
184
+
41
185
  /** Why a scheduled task DTO could not be mapped back to editable form values. */
42
186
  export declare enum UnsupportedTriggerReason {
43
187
  /** `trigger.cron.fields` uses a shape (extra keys, or both `day_of_week` and `day`) the editor's schedule controls cannot represent. */
@@ -48,4 +192,54 @@ export declare enum UnsupportedTriggerReason {
48
192
  MissingRequiredFields = "missingRequiredFields"
49
193
  }
50
194
 
195
+ /** Shared, cancellation-safe pagination and background refresh for one schedule's run history. */
196
+ export declare const useScheduledTaskRuns: (client: ScheduledTasksApiClient, { scheduleId, enabled, pageSize, nextRunTime, }: UseScheduledTaskRunsOptions) => {
197
+ items: ScheduledTaskRunDto[];
198
+ isLoading: boolean;
199
+ isLoadingMore: boolean;
200
+ initialError: Error | null;
201
+ loadMoreError: Error | null;
202
+ hasMore: boolean;
203
+ loadMore: () => void;
204
+ retryLoadMore: () => void;
205
+ refetch: () => void;
206
+ };
207
+
208
+ export declare interface UseScheduledTaskRunsOptions {
209
+ scheduleId: string;
210
+ enabled?: boolean;
211
+ pageSize?: number;
212
+ /**
213
+ * The task's next scheduled run time (ISO string), when known. Drives the
214
+ * one-shot background refresh described on {@link useScheduledTaskRuns}.
215
+ * The caller already holds the task DTO — this hook never fetches it.
216
+ */
217
+ nextRunTime?: string | null;
218
+ }
219
+
220
+ /** Shared scheduler-list lifecycle with generation-scoped stale-response guards. */
221
+ export declare const useScheduledTasks: (client: ScheduledTasksApiClient, { enabled, pageSize, debounceMs, initialSearch, initialSort, }?: UseScheduledTasksOptions) => {
222
+ items: ScheduledTaskDto[];
223
+ searchQuery: string;
224
+ setSearchQuery: Dispatch<SetStateAction<string>>;
225
+ sortKey: "firstToRun" | "lastToRun" | "newest" | "nameAZ";
226
+ setSortKey: Dispatch<SetStateAction<"firstToRun" | "lastToRun" | "newest" | "nameAZ">>;
227
+ isLoading: boolean;
228
+ isLoadingMore: boolean;
229
+ initialError: Error | null;
230
+ loadMoreError: Error | null;
231
+ hasMore: boolean;
232
+ loadMore: () => void;
233
+ retryLoadMore: () => void;
234
+ refetch: () => void;
235
+ };
236
+
237
+ export declare interface UseScheduledTasksOptions {
238
+ enabled?: boolean;
239
+ pageSize?: number;
240
+ debounceMs?: number;
241
+ initialSearch?: string;
242
+ initialSort?: ListScheduledTasksSortEnum;
243
+ }
244
+
51
245
  export { }
@@ -1,3 +1,8 @@
1
1
  import { UnsupportedTriggerReason as e } from "./scheduled-task/scheduled-task-mapping.js";
2
- import { mapFormValuesToCreateBody as t, mapFormValuesToUpdateBody as n, mapScheduledTaskDtoToFormValues as r } from "./scheduled-task/scheduled-task-trigger.js";
3
- export { e as UnsupportedTriggerReason, t as mapFormValuesToCreateBody, n as mapFormValuesToUpdateBody, r as mapScheduledTaskDtoToFormValues };
2
+ import { ScheduledTaskTriggerDescriptionKind as t, describeScheduledTaskTrigger as n } from "./scheduled-task/scheduled-task-description.js";
3
+ import { mapFormValuesToCreateBody as r, mapFormValuesToUpdateBody as i, mapScheduledTaskDtoToFormValues as a } from "./scheduled-task/scheduled-task-trigger.js";
4
+ import { prepareScheduledTaskCreateBody as o, prepareScheduledTaskUpdateBody as s } from "./scheduled-task/scheduled-task-preparation.js";
5
+ import { createScheduledTasksApiClient as c } from "./scheduled-task/scheduled-tasks-api-client.js";
6
+ import { useScheduledTasks as l } from "./scheduled-task/use-scheduled-tasks.js";
7
+ import { mergeRunsById as u, useScheduledTaskRuns as d } from "./scheduled-task/use-scheduled-task-runs.js";
8
+ export { t as ScheduledTaskTriggerDescriptionKind, e as UnsupportedTriggerReason, c as createScheduledTasksApiClient, n as describeScheduledTaskTrigger, r as mapFormValuesToCreateBody, i as mapFormValuesToUpdateBody, a as mapScheduledTaskDtoToFormValues, u as mergeRunsById, o as prepareScheduledTaskCreateBody, s as prepareScheduledTaskUpdateBody, d as useScheduledTaskRuns, l as useScheduledTasks };
@@ -1,4 +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");
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 = (e) => {
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));
5
+ };
3
6
  //#endregion
4
- export { t as isCustomAppSchema, n as isQuickAppSchema };
7
+ export { r as getRunnerSchemas, t as isCustomAppSchema, n as isQuickAppSchema };
@@ -0,0 +1,13 @@
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);
11
+ };
12
+ //#endregion
13
+ export { e as CRON_LAST_DAY_OF_MONTH, r as getUtcDayShift, a as toLocalDayOfMonth, i as toUtcCronDayOfMonth };
@@ -0,0 +1,19 @@
1
+ import { SKILL_FOLDER_MARKER as e, nameFromPath as t } from "./skill.js";
2
+ import { inferMimeTypeFromPath as n } from "@epam/ai-dial-chat-shared";
3
+ import { unzipSync as r } from "fflate";
4
+ //#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) => {
6
+ let r = new FileReader();
7
+ 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]) => {
11
+ let i = e.replace(/\\/g, "/");
12
+ return o(i) ? [] : [{
13
+ path: i,
14
+ file: new File([r], t(i), { type: n(i) ?? "" })
15
+ }];
16
+ });
17
+ };
18
+ //#endregion
19
+ export { c as extractSkillArchive };
@@ -1,15 +1,16 @@
1
+ import { PUBLIC_BUCKET as e } from "@epam/ai-dial-chat-shared";
1
2
  //#region src/skill/skill-types.ts
2
- var e = /* @__PURE__ */ function(e) {
3
+ var t = /* @__PURE__ */ function(e) {
3
4
  return e.Personal = "personal", e.SharedWithMe = "sharedWithMe", e.Public = "public", e;
4
- }({}), t = "public", n = "skills/", r = 256 * 1024, i = 1e3, a = 10, o = (e) => {
5
- if (!e.startsWith(n)) return null;
6
- let t = e.slice(7), r = t.indexOf("/");
7
- if (r <= 0) return null;
8
- let i = t.slice(0, r), a = t.slice(r + 1);
5
+ }({}), n = e, r = "skills/", i = 256 * 1024, a = 1e3, o = 10, s = (e) => {
6
+ if (!e.startsWith(r)) return null;
7
+ let t = e.slice(7), n = t.indexOf("/");
8
+ if (n <= 0) return null;
9
+ let i = t.slice(0, n), a = t.slice(n + 1);
9
10
  return i === "" || a === "" ? null : {
10
11
  bucket: i,
11
12
  path: a
12
13
  };
13
14
  };
14
15
  //#endregion
15
- export { t as PUBLIC_SKILL_BUCKET, a as SKILL_LISTING_MAX_PAGES, i as SKILL_LISTING_PAGE_SIZE, r as SKILL_MANIFEST_MAX_BYTES, e as SkillSource, o as parseSkillResourceUrl };
16
+ export { n as PUBLIC_SKILL_BUCKET, o as SKILL_LISTING_MAX_PAGES, a as SKILL_LISTING_PAGE_SIZE, i as SKILL_MANIFEST_MAX_BYTES, t as SkillSource, s as parseSkillResourceUrl };