@epam/ai-dial-chat-hooks 1.4.0-dev.78 → 1.4.0-dev.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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.4.0-dev.78",
4
+ "version": "1.4.0-dev.81",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -131,7 +131,7 @@
131
131
  }
132
132
  },
133
133
  "dependencies": {
134
- "@epam/ai-dial-chat-api-client": "1.4.0-dev.78",
134
+ "@epam/ai-dial-chat-api-client": "1.4.0-dev.81",
135
135
  "dompurify": "3.4.17",
136
136
  "fflate": "^0.8.3",
137
137
  "lru-cache": "^10.4.3",
@@ -140,23 +140,23 @@
140
140
  },
141
141
  "peerDependencies": {
142
142
  "react": "^19.2.8",
143
- "@epam/ai-dial-attachment-canvas": "1.4.0-dev.78",
144
- "@epam/ai-dial-attachment-input": "1.4.0-dev.78",
145
- "@epam/ai-dial-catalog": "1.4.0-dev.78",
146
- "@epam/ai-dial-chat-overlay": "1.4.0-dev.78",
147
- "@epam/ai-dial-chat-shared": "1.4.0-dev.78",
148
- "@epam/ai-dial-conversation-input": "1.4.0-dev.78",
149
- "@epam/ai-dial-mcp-apps": "1.4.0-dev.78",
150
- "@epam/ai-dial-projects": "1.4.0-dev.78",
151
- "@epam/ai-dial-publish-panel": "1.4.0-dev.78",
152
- "@epam/ai-dial-quotations": "1.4.0-dev.78",
143
+ "@epam/ai-dial-attachment-canvas": "1.4.0-dev.81",
144
+ "@epam/ai-dial-attachment-input": "1.4.0-dev.81",
145
+ "@epam/ai-dial-catalog": "1.4.0-dev.81",
146
+ "@epam/ai-dial-chat-overlay": "1.4.0-dev.81",
147
+ "@epam/ai-dial-chat-shared": "1.4.0-dev.81",
148
+ "@epam/ai-dial-conversation-input": "1.4.0-dev.81",
149
+ "@epam/ai-dial-mcp-apps": "1.4.0-dev.81",
150
+ "@epam/ai-dial-projects": "1.4.0-dev.81",
151
+ "@epam/ai-dial-publish-panel": "1.4.0-dev.81",
152
+ "@epam/ai-dial-quotations": "1.4.0-dev.81",
153
153
  "@epam/ai-dial-react-file-manager": "^0.4.2",
154
- "@epam/ai-dial-scheduled-tasks": "1.4.0-dev.78",
155
- "@epam/ai-dial-share": "1.4.0-dev.78",
156
- "@epam/ai-dial-skill-editor": "1.4.0-dev.78",
157
- "@epam/ai-dial-source-panel": "1.4.0-dev.78",
154
+ "@epam/ai-dial-scheduled-tasks": "1.4.0-dev.81",
155
+ "@epam/ai-dial-share": "1.4.0-dev.81",
156
+ "@epam/ai-dial-skill-editor": "1.4.0-dev.81",
157
+ "@epam/ai-dial-source-panel": "1.4.0-dev.81",
158
158
  "@epam/ai-dial-ui-kit": "^0.16.0",
159
- "@epam/ai-dial-usage-dashboard": "1.4.0-dev.78",
159
+ "@epam/ai-dial-usage-dashboard": "1.4.0-dev.81",
160
160
  "@modelcontextprotocol/sdk": "^1.32.2",
161
161
  "@epam/pdf-highlighter-kit": "^0.0.22"
162
162
  },
@@ -10,31 +10,37 @@ export declare enum ScheduledTaskTriggerDescriptionKind {
10
10
  Custom = "custom",
11
11
  Invalid = "invalid"
12
12
  }
13
+ /** What a trigger does, in the wall time of the task's own zone. */
13
14
  export interface ScheduledTaskTriggerDescription {
15
+ /** Which schedule shape the trigger is. */
14
16
  kind: ScheduledTaskTriggerDescriptionKind;
17
+ /** `HH:mm` of a daily, weekly or monthly run, or the two-digit minute of an hourly one. */
15
18
  time?: string;
19
+ /** First weekday of a `Weekly` description, `0` (Monday) to `6` (Sunday). */
16
20
  dayOfWeek?: string;
17
- /** Every display-timezone weekday of a `Weekly` description, Monday first; `dayOfWeek` is its first entry. */
21
+ /** Every weekday of a `Weekly` description, Monday first; `dayOfWeek` is its first entry. */
18
22
  daysOfWeek?: string[];
23
+ /** Day of the month of a `Monthly` description. */
19
24
  dayOfMonth?: string;
25
+ /** Minutes between runs of an `EveryNMinutes` description. */
20
26
  intervalMinutes?: number;
21
- date?: Date;
27
+ /** Local `YYYY-MM-DDTHH:mm` of a `OneTime` description, in the task's zone. */
28
+ dateTime?: string;
29
+ /** Raw cron fields of a `Custom` description. */
22
30
  expression?: string;
23
- sourceTimezone: 'utc';
31
+ /** IANA zone the times above are wall time in. */
32
+ timezone: string;
24
33
  }
34
+ /** Options of {@link describeScheduledTaskTrigger}. */
25
35
  export interface ScheduledTaskTriggerDescriptionOptions {
26
- /** Display timezone; defaults to UTC for backwards compatibility. */
27
- timeZone?: string;
28
- /** Date whose timezone offset is used. Defaults to now (the existing UTC-storage policy). */
29
- referenceDate?: Date;
36
+ /** IANA zone the trigger is evaluated in. Defaults to UTC, which is what a task saved without a zone runs in. */
37
+ timezone?: string;
30
38
  }
31
39
  /**
32
40
  * Describes the complete trigger without requiring unrelated task metadata.
33
- * Unsupported constraints remain Custom, with the full source expression.
34
- * Calendar-month shifts crossing month boundaries or days 29–31 remain
35
- * Custom because a shifted monthly day is not equivalent around short months.
36
- * The one exception is `day: 'last'` one day behind local time, which is
37
- * exactly the local 1st.
41
+ * Times are the stored wall time in the task's zone; nothing is converted to
42
+ * the viewer's zone. Unsupported constraints remain Custom, with the full
43
+ * source expression.
38
44
  */
39
- export declare const describeScheduledTaskTrigger: (trigger: ScheduleTriggerDto, { timeZone, referenceDate, }?: ScheduledTaskTriggerDescriptionOptions) => ScheduledTaskTriggerDescription;
45
+ export declare const describeScheduledTaskTrigger: (trigger: ScheduleTriggerDto, { timezone }?: ScheduledTaskTriggerDescriptionOptions) => ScheduledTaskTriggerDescription;
40
46
  //# sourceMappingURL=scheduled-task-description.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scheduled-task-description.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-description.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGxE,8DAA8D;AAC9D,oBAAY,mCAAmC;IAC7C,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,aAAa,kBAAkB;IAC/B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE,mCAAmC,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8GAA8G;IAC9G,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,KAAK,CAAC;CACvB;AAED,MAAM,WAAW,sCAAsC;IACrD,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6FAA6F;IAC7F,aAAa,CAAC,EAAE,IAAI,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,GACvC,SAAS,kBAAkB,EAC3B,+BAGG,sCAA2C,KAC7C,+BAuKF,CAAC"}
1
+ {"version":3,"file":"scheduled-task-description.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-description.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AASxE,8DAA8D;AAC9D,oBAAY,mCAAmC;IAC7C,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,aAAa,kBAAkB;IAC/B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED,oEAAoE;AACpE,MAAM,WAAW,+BAA+B;IAC9C,2CAA2C;IAC3C,IAAI,EAAE,mCAAmC,CAAC;IAC1C,2FAA2F;IAC3F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,uDAAuD;AACvD,MAAM,WAAW,sCAAsC;IACrD,iHAAiH;IACjH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,GACvC,SAAS,kBAAkB,EAC3B,eAAsB,sCAA2C,KAChE,+BAwHF,CAAC"}
@@ -1,21 +1,22 @@
1
- import { CRON_LAST_DAY_OF_MONTH as e } from "../shared/cron-day-of-month.js";
1
+ import { padTwoDigits as e } from "../shared/formatting.js";
2
+ import { instantToZonedDateTime as t, isAbsoluteInstant as n } from "@epam/ai-dial-scheduled-tasks";
2
3
  //#region src/scheduled-task/scheduled-task-description.ts
3
- var t = /* @__PURE__ */ function(e) {
4
+ var r = 16, i = /* @__PURE__ */ function(e) {
4
5
  return e.OneTime = "oneTime", e.Hourly = "hourly", e.EveryNMinutes = "everyNMinutes", e.Daily = "daily", e.Weekly = "weekly", e.Monthly = "monthly", e.Custom = "custom", e.Invalid = "invalid", e;
5
- }({}), n = (t, { timeZone: n = "UTC", referenceDate: r = /* @__PURE__ */ new Date() } = {}) => {
6
- let i = (e, t = {}) => ({
6
+ }({}), a = (i, { timezone: a = "UTC" } = {}) => {
7
+ let o = (e, t = {}) => ({
7
8
  kind: e,
8
- sourceTimezone: "utc",
9
+ timezone: a,
9
10
  ...t
10
11
  });
11
- if (t.date && t.cron) return i("invalid");
12
- if (t.date) {
13
- let e = new Date(t.date);
14
- return Number.isNaN(e.getTime()) ? i("invalid") : i("oneTime", { date: e });
12
+ if (i.date && i.cron) return o("invalid");
13
+ if (i.date) {
14
+ let e = n(i.date) ? t(i.date, a) : i.date.slice(0, r);
15
+ return e && !Number.isNaN(Date.parse(`${e}Z`)) ? o("oneTime", { dateTime: e }) : o("invalid");
15
16
  }
16
- let a = t.cron?.fields;
17
- if (!a || Object.keys(a).length === 0) return i("invalid");
18
- let o = () => i("custom", { expression: JSON.stringify(a) }), s = {
17
+ let s = i.cron?.fields;
18
+ if (!s || Object.keys(s).length === 0) return o("invalid");
19
+ let c = () => o("custom", { expression: JSON.stringify(s) }), l = {
19
20
  hour: [0, 23],
20
21
  minute: [0, 59],
21
22
  day: [1, 31],
@@ -23,19 +24,19 @@ var t = /* @__PURE__ */ function(e) {
23
24
  month: [1, 12],
24
25
  second: [0, 59]
25
26
  };
26
- for (let [e, t] of Object.entries(a)) {
27
+ for (let [e, t] of Object.entries(s)) {
27
28
  if (t == null) continue;
28
- if (!t.trim()) return i("invalid");
29
- let n = s[e];
30
- if (n && /^-?\d+$/.test(t) && (Number(t) < n[0] || Number(t) > n[1])) return i("invalid");
29
+ if (!t.trim()) return o("invalid");
30
+ let n = l[e];
31
+ if (n && /^-?\d+$/.test(t) && (Number(t) < n[0] || Number(t) > n[1])) return o("invalid");
31
32
  if (e === "second" && t !== "0" || ![
32
33
  "hour",
33
34
  "minute",
34
35
  "day",
35
36
  "day_of_week"
36
- ].includes(e) && t !== "*" && (e !== "second" || t !== "0")) return o();
37
+ ].includes(e) && t !== "*" && (e !== "second" || t !== "0")) return c();
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 = [
39
+ let u = s.hour, d = s.minute, f = s.day === "*" ? void 0 : s.day, p = s.day_of_week === "*" ? void 0 : s.day_of_week, m = [
39
40
  "monday",
40
41
  "tuesday",
41
42
  "wednesday",
@@ -43,48 +44,31 @@ var t = /* @__PURE__ */ function(e) {
43
44
  "friday",
44
45
  "saturday",
45
46
  "sunday"
46
- ], m = (f?.split(",") ?? []).map((e) => {
47
- let t = p.findIndex((t) => t === e.toLowerCase() || t.slice(0, 3) === e.toLowerCase());
47
+ ], h = (p?.split(",") ?? []).map((e) => {
48
+ let t = m.findIndex((t) => t === e.toLowerCase() || t.slice(0, 3) === e.toLowerCase());
48
49
  return t >= 0 ? String(t) : e;
49
- }), h = m[0];
50
- if (u && h || u && !d && !/^\d+$/.test(u) || m.some((e) => !/^[0-6]$/.test(e)) || new Set(m).size !== m.length) return o();
51
- let g = c == null || c === "*", _ = l?.match(/^\*\/(\d+)$/);
52
- if (g && _ && !u && !h) {
53
- let e = Number(_[1]);
54
- return e > 0 && e <= 59 ? i("everyNMinutes", { intervalMinutes: e }) : i("invalid");
50
+ }), g = h[0];
51
+ if (f && g || f && !/^\d+$/.test(f) || h.some((e) => !/^[0-6]$/.test(e)) || new Set(h).size !== h.length) return c();
52
+ let _ = u == null || u === "*", v = d?.match(/^\*\/(\d+)$/);
53
+ if (_ && v && !f && !g) {
54
+ let e = Number(v[1]);
55
+ return e > 0 && e <= 59 ? o("everyNMinutes", { intervalMinutes: e }) : o("invalid");
55
56
  }
56
- if (!l || !/^\d+$/.test(l) || !g && !/^\d+$/.test(c) || g && (u || h)) return o();
57
- let v = new Date(r);
58
- if (Number.isNaN(v.getTime())) return i("invalid");
59
- if (v.setUTCHours(g ? 0 : Number(c), Number(l), 0, 0), h) {
60
- let e = (Number(h) + 1) % 7;
61
- v.setUTCDate(v.getUTCDate() + (e - v.getUTCDay() + 7) % 7);
62
- }
63
- let y = new Intl.DateTimeFormat("en-GB", {
64
- timeZone: n,
65
- hourCycle: "h23",
66
- year: "numeric",
67
- month: "2-digit",
68
- day: "2-digit",
69
- hour: "2-digit",
70
- minute: "2-digit"
71
- }).formatToParts(v), b = (e) => y.find((t) => t.type === e)?.value ?? "", x = new Date(Date.UTC(Number(b("year")), Number(b("month")) - 1, Number(b("day")))), S = Date.UTC(v.getUTCFullYear(), v.getUTCMonth(), v.getUTCDate()), C = Math.round((x.getTime() - S) / 864e5), w = b("hour") + ":" + b("minute");
72
- if (g) return i("hourly", { time: b("minute") });
73
- if (h) {
74
- let e = m.map((e) => String((Number(e) + C + 7) % 7)).sort((e, t) => Number(e) - Number(t));
75
- return i("weekly", {
76
- time: w,
57
+ if (!d || !/^\d+$/.test(d) || !_ && !/^\d+$/.test(u) || _ && (f || g)) return c();
58
+ if (_) return o("hourly", { time: e(Number(d)) });
59
+ let y = `${e(Number(u))}:${e(Number(d))}`;
60
+ if (g) {
61
+ let e = [...h].sort((e, t) => Number(e) - Number(t));
62
+ return o("weekly", {
63
+ time: y,
77
64
  dayOfWeek: e[0],
78
65
  daysOfWeek: e
79
66
  });
80
67
  }
81
- return d ? C === 1 ? i("monthly", {
82
- time: w,
83
- dayOfMonth: "1"
84
- }) : o() : u ? C === 0 || Number(u) <= 28 && Number(u) + C >= 1 && Number(u) + C <= 28 ? i("monthly", {
85
- time: w,
86
- dayOfMonth: String(Number(u) + C)
87
- }) : o() : i("daily", { time: w });
68
+ return f ? o("monthly", {
69
+ time: y,
70
+ dayOfMonth: String(Number(f))
71
+ }) : o("daily", { time: y });
88
72
  };
89
73
  //#endregion
90
- export { t as ScheduledTaskTriggerDescriptionKind, n as describeScheduledTaskTrigger };
74
+ export { i as ScheduledTaskTriggerDescriptionKind, a as describeScheduledTaskTrigger };
@@ -19,6 +19,8 @@ export interface ScheduledTaskScheduleLabels {
19
19
  invalid: string;
20
20
  /** Label for a recurring trigger no other shape describes. */
21
21
  recurringFallback: string;
22
+ /** Appends the task's zone to a schedule label, e.g. "Daily at 09:00 (Asia/Tokyo)". Omit to never show the zone. */
23
+ withTimezone?: (label: string, timezone: string) => string;
22
24
  }
23
25
  /** Host-translated duration units for a run. */
24
26
  export interface ScheduledTaskRunDurationLabels {
@@ -38,12 +40,12 @@ export interface ScheduledTaskRunTimestampLabels {
38
40
  /** A run that started on the short date `date` at `time`. */
39
41
  dateAt: (date: string, time: string) => string;
40
42
  }
41
- /** Locale and timezone used to format a schedule label. */
43
+ /** Locale and viewer zone used to format a schedule label. */
42
44
  export interface ScheduledTaskScheduleLabelOptions {
43
45
  /** BCP 47 locale for dates and weekday names. Defaults to the runtime default. */
44
46
  locale?: string;
45
- /** IANA timezone the schedule is shown in. Defaults to the browser's resolved timezone. */
46
- timeZone?: string;
47
+ /** The viewer's IANA zone; a task in a different zone gets its zone appended to the label. Defaults to the browser's resolved zone. */
48
+ browserTimezone?: string;
47
49
  }
48
50
  /** Inputs for formatting a run's start time. */
49
51
  export interface ScheduledTaskRunTimestampOptions {
@@ -85,8 +87,20 @@ export declare enum ScheduledTaskDeleteErrorKind {
85
87
  /** Any other failure. */
86
88
  Generic = "generic"
87
89
  }
88
- /** Returns the schedule label for a task's trigger, shown in `timeZone`. */
89
- export declare const formatScheduledTaskScheduleLabel: (task: ScheduledTaskDto, labels: ScheduledTaskScheduleLabels, { locale, timeZone, }?: ScheduledTaskScheduleLabelOptions) => string;
90
+ /** Formats a zone-local `YYYY-MM-DDTHH:mm` as a medium date and short time without converting it to another zone. */
91
+ export declare const formatZonedDateTime: (dateTime: string, locale?: string) => string;
92
+ /**
93
+ * Formats a stored trigger datetime — a zone-local wall time, or an absolute
94
+ * instant written by an older client — as the wall time it shows in the
95
+ * task's own zone. Returns the raw value when it is not a date.
96
+ */
97
+ export declare const formatScheduledTaskTriggerTime: (value: string, timezone: string, locale?: string) => string;
98
+ /**
99
+ * Returns the schedule label for a task's trigger in the task's own zone: the
100
+ * stored wall time is shown as is, and the zone is appended when it differs
101
+ * from the viewer's.
102
+ */
103
+ export declare const formatScheduledTaskScheduleLabel: (task: ScheduledTaskDto, labels: ScheduledTaskScheduleLabels, { locale, browserTimezone, }?: ScheduledTaskScheduleLabelOptions) => string;
90
104
  /** Maps a scheduled-task DTO to the scheduled-tasks lib's card item. */
91
105
  export declare const toScheduledTaskItem: (task: ScheduledTaskDto, labels: ScheduledTaskScheduleLabels, options?: ScheduledTaskScheduleLabelOptions) => ScheduledTaskItem;
92
106
  /** Maps scheduled-task DTOs to card items, preserving order. */
@@ -1 +1 @@
1
- {"version":3,"file":"scheduled-task-display.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-display.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAC1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAM9D,mGAAmG;AACnG,MAAM,WAAW,2BAA2B;IAC1C,6CAA6C;IAC7C,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACjC,mCAAmC;IACnC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACzC,+CAA+C;IAC/C,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACrC,uCAAuC;IACvC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAClC,gGAAgG;IAChG,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,qDAAqD;IACrD,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,gDAAgD;AAChD,MA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gBX,CAAC;AAEF,yGAAyG;AACzG,eAAO,MAAM,+BAA+B,GAC1C,WAAW,MAAM,EACjB,iBAAiB,MAAM,GAAG,IAAI,GAAG,SAAS,EAC1C,QAAQ,+BAA+B,EACvC,mCAIG,gCAAqC,KACvC,MAmBF,CAAC;AAgBF,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,GACjC,KAAK,mBAAmB,EACxB,wFAOG,2BAA2B,KAC7B,oBAyBF,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,uBAAuB,GAClC,MAAM,mBAAmB,EAAE,EAC3B,SAAS,2BAA2B,KACnC,oBAAoB,EACkC,CAAC;AAE1D,4EAA4E;AAC5E,eAAO,MAAM,gCAAgC,GAC3C,QAAQ,MAAM,GAAG,SAAS,KACzB,4BAKF,CAAC;AAEF,qGAAqG;AACrG,eAAO,MAAM,+BAA+B,GAC1C,SAAS,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,iBAAiB,CAAC,EAC1D,oCAAoC,0BAA0B,KAC7D,MAIF,CAAC"}
@@ -1,69 +1,74 @@
1
1
  import { ScheduledTaskTriggerDescriptionKind as e, describeScheduledTaskTrigger as t } from "./scheduled-task-description.js";
2
- import { ScheduledTaskErrorCode as n, ScheduledTaskRunDtoStatusEnum as r } from "@epam/ai-dial-chat-api-client";
3
- import { ScheduledTaskRunStatus as i } from "@epam/ai-dial-scheduled-tasks";
2
+ import { isSameTimezone as n } from "../shared/timezones.js";
3
+ import { ScheduledTaskErrorCode as r, ScheduledTaskRunDtoStatusEnum as i } from "@epam/ai-dial-chat-api-client";
4
+ import { ScheduledTaskRunStatus as a, instantToZonedDateTime as o, isAbsoluteInstant as s } from "@epam/ai-dial-scheduled-tasks";
4
5
  //#region src/scheduled-task/scheduled-task-display.ts
5
- var a = /* @__PURE__ */ function(e) {
6
+ var c = /* @__PURE__ */ function(e) {
6
7
  return e.NotFound = "notFound", e.Retryable = "retryable", e.Generic = "generic", e;
7
- }({}), o = 60, s = 3600, c = (e, t) => new Intl.DateTimeFormat(t, {
8
+ }({}), l = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/, u = 60, d = 3600, f = (e, t) => new Intl.DateTimeFormat(t, {
8
9
  weekday: "long",
9
10
  timeZone: "UTC"
10
- }).format(new Date(Date.UTC(2023, 0, 2 + Number(e)))), l = (e, t) => new Intl.ListFormat(t, { type: "conjunction" }).format(e.map((e) => c(e, t))), u = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), d = (n, r, { locale: i, timeZone: a = Intl.DateTimeFormat().resolvedOptions().timeZone } = {}) => {
11
- let o = t(n.trigger, { timeZone: a }), s = o.time ?? "";
12
- switch (o.kind) {
13
- case e.OneTime: return r.onceAt(new Intl.DateTimeFormat(i, {
14
- dateStyle: "medium",
15
- timeStyle: "short"
16
- }).format(o.date));
17
- case e.EveryNMinutes: return r.everyNMinutes(o.intervalMinutes ?? 0);
18
- case e.Hourly: return r.hourlyAt(s);
19
- case e.Daily: return r.dailyAt(s);
20
- case e.Weekly: return r.weeklyAt(l(o.daysOfWeek ?? [o.dayOfWeek ?? ""], i), s);
21
- case e.Monthly: return r.monthlyAt(o.dayOfMonth ?? "", s);
22
- case e.Invalid: return r.invalid;
23
- default: return r.recurringFallback;
11
+ }).format(new Date(Date.UTC(2023, 0, 2 + Number(e)))), p = (e, t) => new Intl.ListFormat(t, { type: "conjunction" }).format(e.map((e) => f(e, t))), m = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), h = (e, t) => new Intl.DateTimeFormat(t, {
12
+ dateStyle: "medium",
13
+ timeStyle: "short",
14
+ timeZone: "UTC"
15
+ }).format(/* @__PURE__ */ new Date(`${e}:00Z`)), g = (e, t, n) => {
16
+ let r = s(e) ? o(e, t) : e.slice(0, 16);
17
+ return !r || !l.test(r) ? e : h(r, n);
18
+ }, _ = (r, i, { locale: a, browserTimezone: o = Intl.DateTimeFormat().resolvedOptions().timeZone } = {}) => {
19
+ let s = r.timezone || "UTC", c = t(r.trigger, { timezone: s }), l = c.time ?? "", u = (e) => i.withTimezone && !n(s, o) ? i.withTimezone(e, s) : e;
20
+ switch (c.kind) {
21
+ case e.OneTime: return u(i.onceAt(h(c.dateTime ?? "", a)));
22
+ case e.EveryNMinutes: return i.everyNMinutes(c.intervalMinutes ?? 0);
23
+ case e.Hourly: return u(i.hourlyAt(l));
24
+ case e.Daily: return u(i.dailyAt(l));
25
+ case e.Weekly: return u(i.weeklyAt(p(c.daysOfWeek ?? [c.dayOfWeek ?? ""], a), l));
26
+ case e.Monthly: return u(i.monthlyAt(c.dayOfMonth ?? "", l));
27
+ case e.Invalid: return i.invalid;
28
+ default: return i.recurringFallback;
24
29
  }
25
- }, f = (e, t, n) => ({
30
+ }, v = (e, t, n) => ({
26
31
  id: e.id,
27
32
  displayName: e.displayName,
28
33
  descriptionPreview: e.description,
29
- scheduleLabel: d(e, t, n),
34
+ scheduleLabel: _(e, t, n),
30
35
  isActive: e.isActive,
31
36
  isCompleted: e.isCompleted
32
- }), p = (e, t, n) => e.map((e) => f(e, t, n)), m = (e, t) => {
37
+ }), y = (e, t, n) => e.map((e) => v(e, t, n)), b = (e, t) => {
33
38
  if (e == null) return;
34
39
  let n = [
35
- [Math.floor(e / s), t.hours],
36
- [Math.floor(e % s / o), t.minutes],
37
- [e % o, t.seconds]
40
+ [Math.floor(e / d), t.hours],
41
+ [Math.floor(e % d / u), t.minutes],
42
+ [e % u, t.seconds]
38
43
  ].filter(([e]) => e > 0).map(([e, t]) => t(e));
39
44
  return t.suffix(n.length ? n.join(" ") : t.seconds(0));
40
- }, h = (e, t, n, { durationLabels: r, locale: i, now: a = /* @__PURE__ */ new Date() } = {}) => {
41
- let o = new Date(e), s = new Intl.DateTimeFormat(i, { timeStyle: "short" }).format(o), c = u(o, a) ? n.todayAt(s) : n.dateAt(new Intl.DateTimeFormat(i, {
45
+ }, x = (e, t, n, { durationLabels: r, locale: i, now: a = /* @__PURE__ */ new Date() } = {}) => {
46
+ let o = new Date(e), s = new Intl.DateTimeFormat(i, { timeStyle: "short" }).format(o), c = m(o, a) ? n.todayAt(s) : n.dateAt(new Intl.DateTimeFormat(i, {
42
47
  month: "short",
43
48
  day: "numeric"
44
- }).format(o), s), l = r ? m(t, r) : void 0;
49
+ }).format(o), s), l = r ? b(t, r) : void 0;
45
50
  return l ? `${c} ${l}` : c;
46
- }, g = (e) => {
51
+ }, S = (e) => {
47
52
  switch (e) {
48
- case r.Success: return i.Success;
49
- case r.Error: return i.Error;
50
- case r.InProgress: return i.InProgress;
51
- default: return i.Missed;
53
+ case i.Success: return a.Success;
54
+ case i.Error: return a.Error;
55
+ case i.InProgress: return a.InProgress;
56
+ default: return a.Missed;
52
57
  }
53
- }, _ = (e, { timestampLabels: t, durationLabels: n, conversations: r, conversationIdsMatch: i, locale: a, now: o }) => {
58
+ }, C = (e, { timestampLabels: t, durationLabels: n, conversations: r, conversationIdsMatch: i, locale: a, now: o }) => {
54
59
  let { conversationId: s } = e, c = s ? r.find((e) => i(e.id, s)) : void 0;
55
60
  return {
56
61
  id: e.id,
57
- status: g(e.status),
58
- timestampLabel: h(e.startTime, void 0, t, {
62
+ status: S(e.status),
63
+ timestampLabel: x(e.startTime, void 0, t, {
59
64
  locale: a,
60
65
  now: o
61
66
  }),
62
- durationLabel: m(e.durationSeconds, n),
67
+ durationLabel: b(e.durationSeconds, n),
63
68
  conversationId: s,
64
69
  isUnread: c?.isUnread === !0,
65
70
  errorText: e.errorText
66
71
  };
67
- }, v = (e, t) => e.map((e) => _(e, t)), y = (e) => e === 404 || e === 409 ? "notFound" : e === 502 ? "retryable" : "generic", b = (e, { adminConsentRequired: t, fallback: r }) => e.code === n.ScheduledTaskAdminConsentRequired ? t : e.upstreamMessage?.trim() || r;
72
+ }, w = (e, t) => e.map((e) => C(e, t)), T = (e) => e === 404 || e === 409 ? "notFound" : e === 502 ? "retryable" : "generic", E = (e, { adminConsentRequired: t, fallback: n }) => e.code === r.ScheduledTaskAdminConsentRequired ? t : e.upstreamMessage?.trim() || n;
68
73
  //#endregion
69
- export { a as ScheduledTaskDeleteErrorKind, y as classifyScheduledTaskDeleteError, m as formatScheduledTaskRunDuration, h as formatScheduledTaskRunTimestamp, d as formatScheduledTaskScheduleLabel, b as selectScheduledTaskErrorMessage, f as toScheduledTaskItem, p as toScheduledTaskItems, _ as toScheduledTaskRunItem, v as toScheduledTaskRunItems };
74
+ export { c as ScheduledTaskDeleteErrorKind, T as classifyScheduledTaskDeleteError, b as formatScheduledTaskRunDuration, x as formatScheduledTaskRunTimestamp, _ as formatScheduledTaskScheduleLabel, g as formatScheduledTaskTriggerTime, h as formatZonedDateTime, E as selectScheduledTaskErrorMessage, v as toScheduledTaskItem, y as toScheduledTaskItems, C as toScheduledTaskRunItem, w as toScheduledTaskRunItems };
@@ -1,9 +1,11 @@
1
1
  import { ScheduleCronDto } from '@epam/ai-dial-chat-api-client';
2
2
  /**
3
- * Returns the next UTC time at which a cron trigger with a fixed
4
- * `hour`/`minute` fires, honouring its `day_of_week` (a weekday or a comma
5
- * list of weekdays) or `day` (Monthly) constraint. Returns `undefined` when
6
- * the fields are not plain values this helper can evaluate.
3
+ * Returns the next local `YYYY-MM-DDTHH:mm` at which a cron trigger with a
4
+ * fixed `hour`/`minute` fires in `timezone`, honouring its `day_of_week` (a
5
+ * weekday or a comma list of weekdays) or `day` (Monthly) constraint. Cron
6
+ * fields are wall time in the task's zone, so the answer is wall time too.
7
+ * Returns `undefined` when the fields are not plain values this helper can
8
+ * evaluate or the zone is unknown.
7
9
  */
8
- export declare const getNextCronOccurrence: (cron: ScheduleCronDto, from?: Date) => Date | undefined;
10
+ export declare const getNextCronOccurrence: (cron: ScheduleCronDto, timezone: string, from?: Date) => string | undefined;
9
11
  //# sourceMappingURL=scheduled-task-next-occurrence.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scheduled-task-next-occurrence.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-next-occurrence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AA6BrE;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,MAAM,eAAe,EACrB,OAAM,IAAiB,KACtB,IAAI,GAAG,SA4BT,CAAC"}
1
+ {"version":3,"file":"scheduled-task-next-occurrence.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-next-occurrence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AA8BrE;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,GAChC,MAAM,eAAe,EACrB,UAAU,MAAM,EAChB,OAAM,IAAiB,KACtB,MAAM,GAAG,SAmCX,CAAC"}
@@ -1,20 +1,20 @@
1
+ import { padTwoDigits as e } from "../shared/formatting.js";
2
+ import { getZonedNow as t } from "@epam/ai-dial-scheduled-tasks";
1
3
  //#region src/scheduled-task/scheduled-task-next-occurrence.ts
2
- var e = "last", t = /^\d+$/, n = (t, n, r) => {
3
- if (n != null) return n.split(",").some((e) => (Number(e) + 1) % 7 === t.getUTCDay());
4
- if (r === e) {
5
- let e = new Date(t);
6
- return e.setUTCDate(t.getUTCDate() + 1), e.getUTCDate() === 1;
4
+ var n = "last", r = 366, i = /^\d+$/, a = 864e5, o = (e, t, r) => t == null ? r === n ? new Date(e.getTime() + a).getUTCDate() === 1 : r == null || Number(r) === e.getUTCDate() : t.split(",").some((t) => (Number(t) + 1) % 7 === e.getUTCDay()), s = (s, c, l = /* @__PURE__ */ new Date()) => {
5
+ let { hour: u, minute: d, day_of_week: f, day: p } = s.fields;
6
+ if (!u || !d || !i.test(u) || !i.test(d) || f != null && !/^[0-6](?:,[0-6])*$/.test(f) || p != null && p !== n && !i.test(p)) return;
7
+ let m;
8
+ try {
9
+ m = t(l, c).dateTime;
10
+ } catch {
11
+ return;
7
12
  }
8
- return r == null || Number(r) === t.getUTCDate();
9
- }, r = (r, i = /* @__PURE__ */ new Date()) => {
10
- let { hour: a, minute: o, day_of_week: s, day: c } = r.fields;
11
- if (!a || !o || !t.test(a) || !t.test(o) || s != null && !/^[0-6](?:,[0-6])*$/.test(s) || c != null && c !== e && !t.test(c)) return;
12
- let l = new Date(i);
13
- l.setUTCHours(Number(a), Number(o), 0, 0);
14
- for (let e = 0; e <= 366; e++) {
15
- if (l > i && n(l, s, c)) return l;
16
- l.setUTCDate(l.getUTCDate() + 1);
13
+ let h = `${e(Number(u))}:${e(Number(d))}`, g = Date.parse(`${m.slice(0, 10)}T00:00:00Z`);
14
+ for (let e = 0; e <= r; e++) {
15
+ let t = new Date(g + e * a), n = `${t.toISOString().slice(0, 10)}T${h}`;
16
+ if (n > m && o(t, f, p)) return n;
17
17
  }
18
18
  };
19
19
  //#endregion
20
- export { r as getNextCronOccurrence };
20
+ export { s as getNextCronOccurrence };
@@ -3,15 +3,17 @@ import { ScheduledTaskCreateFormValues } from '@epam/ai-dial-scheduled-tasks';
3
3
  import { ScheduledTaskDtoMappingResult } from './scheduled-task-mapping';
4
4
  /**
5
5
  * Maps validated create-form values to the `POST /api/v1/scheduled-tasks`
6
- * request body, building `trigger.date` for a one-shot schedule or
7
- * `trigger.cron.fields` for a recurring one. Assumes the caller has already
8
- * validated required fields (name, model, prompt, and the active schedule
9
- * section's fields) — this function does not re-validate.
6
+ * request body: `trigger.date` for a one-shot schedule or `trigger.cron` for a
7
+ * recurring one, both in wall time, plus the `timezone` they are read in.
8
+ * Assumes the caller has already validated required fields (name, model,
9
+ * prompt, and the active schedule section's fields) — this function does not
10
+ * re-validate.
10
11
  */
11
12
  export declare const mapFormValuesToCreateBody: (values: ScheduledTaskCreateFormValues) => CreateScheduledTaskBodyDto;
12
13
  /**
13
14
  * Maps a complete, validated edit draft to an update body. An unset skill
14
15
  * emits null to remove the saved reference; hydrate from detail before editing.
16
+ * The zone is always present, because the scheduler resets an omitted one to UTC.
15
17
  */
16
18
  export declare const mapFormValuesToUpdateBody: (values: ScheduledTaskCreateFormValues) => UpdateScheduledTaskBodyDto;
17
19
  /**
@@ -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"}