@epam/ai-dial-chat-hooks 1.4.0-dev.12 → 1.4.0-dev.122
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/api-error/map-api-error.d.ts +10 -0
- package/api-error/map-api-error.d.ts.map +1 -0
- package/api-error/map-api-error.js +11 -0
- package/attachment/useAttachmentAction/useAttachmentAction.d.ts +1 -1
- package/attachment/useAttachmentAction/useAttachmentAction.d.ts.map +1 -1
- package/attachment/useAttachmentAction/useAttachmentAction.js +35 -44
- package/catalog/create-publish-api.d.ts +22 -1
- package/catalog/create-publish-api.d.ts.map +1 -1
- package/catalog/create-publish-api.js +20 -1
- package/catalog/entity-details.d.ts +5 -2
- package/catalog/entity-details.d.ts.map +1 -1
- package/catalog/map-entity-details-to-catalog.d.ts +4 -0
- package/catalog/map-entity-details-to-catalog.d.ts.map +1 -1
- package/catalog/map-entity-details-to-catalog.js +15 -13
- package/catalog/publish-dependency-icons.d.ts +22 -0
- package/catalog/publish-dependency-icons.d.ts.map +1 -0
- package/catalog/publish-dependency-icons.js +11 -0
- package/catalog/publish-target-taken.d.ts +31 -0
- package/catalog/publish-target-taken.d.ts.map +1 -0
- package/catalog/publish-target-taken.js +14 -0
- package/catalog/publish.d.ts +15 -2
- package/catalog/publish.d.ts.map +1 -1
- package/catalog/publish.js +15 -4
- package/catalog/resource-name-conflict.d.ts.map +1 -1
- package/catalog/resource-name-conflict.js +19 -22
- package/catalog/resource-save-adapter.d.ts +7 -2
- package/catalog/resource-save-adapter.d.ts.map +1 -1
- package/catalog/resource-save-adapters.d.ts +32 -7
- package/catalog/resource-save-adapters.d.ts.map +1 -1
- package/catalog/resource-save-adapters.js +47 -41
- package/catalog/resource-save.d.ts +17 -9
- package/catalog/resource-save.d.ts.map +1 -1
- package/catalog/resource-save.js +34 -25
- package/catalog/save-destination-root.d.ts +12 -0
- package/catalog/save-destination-root.d.ts.map +1 -0
- package/catalog/save-destination-root.js +6 -0
- package/catalog/use-publish-dependencies.d.ts +19 -0
- package/catalog/use-publish-dependencies.d.ts.map +1 -0
- package/catalog/use-publish-dependencies.js +25 -0
- package/catalog/use-publish-target-guard.d.ts +45 -0
- package/catalog/use-publish-target-guard.d.ts.map +1 -0
- package/catalog/use-publish-target-guard.js +18 -0
- package/catalog/usePublishFolders/usePublishFolders.d.ts +8 -2
- package/catalog/usePublishFolders/usePublishFolders.d.ts.map +1 -1
- package/catalog/usePublishFolders/usePublishFolders.js +29 -29
- package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts +7 -3
- package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts.map +1 -1
- package/catalog/useResourceSavePanel/useResourceSavePanel.js +107 -97
- package/catalog/useVersionHistory/useVersionHistory.d.ts +38 -0
- package/catalog/useVersionHistory/useVersionHistory.d.ts.map +1 -0
- package/catalog/useVersionHistory/useVersionHistory.js +49 -0
- package/catalog/useVersionHistory/useVersionHistorySection.d.ts +30 -0
- package/catalog/useVersionHistory/useVersionHistorySection.d.ts.map +1 -0
- package/catalog/useVersionHistory/useVersionHistorySection.js +31 -0
- package/catalog/version-history.d.ts +42 -0
- package/catalog/version-history.d.ts.map +1 -0
- package/catalog/version-history.js +27 -0
- package/catalog.js +39 -31
- package/conversation/announcement-message.d.ts +12 -0
- package/conversation/announcement-message.d.ts.map +1 -1
- package/conversation/announcement-message.js +16 -10
- package/conversation/conversation-list.d.ts +7 -1
- package/conversation/conversation-list.d.ts.map +1 -1
- package/conversation/conversation-list.js +11 -2
- package/conversation/conversation-transfer/zip-export.d.ts +1 -1
- package/conversation/conversation-transfer/zip-export.d.ts.map +1 -1
- package/conversation/conversation-transfer/zip-export.js +7 -8
- package/conversation/conversation-transfer/zip-import.d.ts.map +1 -1
- package/conversation/conversation-transfer/zip-import.js +8 -9
- package/conversation/useConversationExport/useConversationExport.d.ts.map +1 -1
- package/conversation/useConversationExport/useConversationExport.js +3 -1
- package/conversation/useConversationStream/generation-resume.d.ts.map +1 -1
- package/conversation/useConversationStream/generation-resume.js +119 -96
- package/conversation.js +44 -44
- package/entry-points/catalog.d.ts +7 -0
- package/entry-points/catalog.d.ts.map +1 -1
- package/entry-points/file-manager.d.ts +1 -0
- package/entry-points/file-manager.d.ts.map +1 -1
- package/entry-points/project.d.ts +5 -0
- package/entry-points/project.d.ts.map +1 -1
- package/entry-points/scheduled-tasks.d.ts +2 -0
- package/entry-points/scheduled-tasks.d.ts.map +1 -1
- package/entry-points/usage-limits.d.ts +1 -0
- package/entry-points/usage-limits.d.ts.map +1 -1
- package/entry-points/utils.d.ts +7 -0
- package/entry-points/utils.d.ts.map +1 -1
- package/file-manager.js +33 -32
- package/files/annotation.d.ts +3 -3
- package/files/annotation.d.ts.map +1 -1
- package/files/annotation.js +12 -11
- package/files/attachment-canvas.d.ts +1 -1
- package/files/attachment-canvas.d.ts.map +1 -1
- package/files/attachment-canvas.js +135 -135
- package/files/attachment-type-labels.d.ts +3 -0
- package/files/attachment-type-labels.d.ts.map +1 -0
- package/files/attachment-type-labels.js +12 -0
- package/files/attachment-types.d.ts +0 -2
- package/files/attachment-types.d.ts.map +1 -1
- package/files/attachment-types.js +7 -14
- package/files/dial-file.d.ts +18 -0
- package/files/dial-file.d.ts.map +1 -1
- package/files/dial-file.js +30 -5
- package/index.d.ts +23 -0
- package/index.d.ts.map +1 -1
- package/index.js +266 -244
- package/org-units/models.d.ts +11 -0
- package/org-units/models.d.ts.map +1 -0
- package/org-units/org-unit-guards.d.ts +64 -0
- package/org-units/org-unit-guards.d.ts.map +1 -0
- package/org-units/org-unit-guards.js +28 -0
- package/org-units/types.d.ts +14 -0
- package/org-units/types.d.ts.map +1 -0
- package/org-units/types.js +6 -0
- package/org-units/useFolderGuards/useFolderGuards.d.ts +31 -0
- package/org-units/useFolderGuards/useFolderGuards.d.ts.map +1 -0
- package/org-units/useFolderGuards/useFolderGuards.js +50 -0
- package/org-units/useOrgUnits/useOrgUnits.d.ts +34 -0
- package/org-units/useOrgUnits/useOrgUnits.d.ts.map +1 -0
- package/org-units/useOrgUnits/useOrgUnits.js +54 -0
- package/package.json +19 -19
- package/project/project-sharing-client.d.ts +8 -0
- package/project/project-sharing-client.d.ts.map +1 -0
- package/project/project-sharing-client.js +11 -0
- package/project/project-sharing.d.ts +28 -0
- package/project/project-sharing.d.ts.map +1 -0
- package/project/project-sharing.js +22 -0
- package/project/use-pinned-project-chats.d.ts +4 -2
- package/project/use-pinned-project-chats.d.ts.map +1 -1
- package/project/use-pinned-project-chats.js +152 -96
- package/project/use-project-conversations.d.ts.map +1 -1
- package/project/use-project-conversations.js +2 -2
- package/project/use-project-remove-from-list.d.ts +30 -0
- package/project/use-project-remove-from-list.d.ts.map +1 -0
- package/project/use-project-remove-from-list.js +39 -0
- package/project/use-project-revoke-access.d.ts +15 -0
- package/project/use-project-revoke-access.d.ts.map +1 -0
- package/project/use-project-revoke-access.js +32 -0
- package/project/use-project-share-recipients.d.ts +7 -0
- package/project/use-project-share-recipients.d.ts.map +1 -0
- package/project/use-project-share-recipients.js +36 -0
- package/project/use-projects.d.ts +1 -0
- package/project/use-projects.d.ts.map +1 -1
- package/project/use-projects.js +2 -1
- package/project.js +7 -2
- package/scheduled-task/scheduled-task-description.d.ts +19 -13
- package/scheduled-task/scheduled-task-description.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-description.js +39 -55
- package/scheduled-task/scheduled-task-display.d.ts +20 -6
- package/scheduled-task/scheduled-task-display.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-display.js +39 -43
- package/scheduled-task/scheduled-task-next-occurrence.d.ts +9 -5
- package/scheduled-task/scheduled-task-next-occurrence.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-next-occurrence.js +16 -16
- package/scheduled-task/scheduled-task-time-format.d.ts +34 -0
- package/scheduled-task/scheduled-task-time-format.d.ts.map +1 -0
- package/scheduled-task/scheduled-task-time-format.js +33 -0
- package/scheduled-task/scheduled-task-trigger.d.ts +6 -4
- package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-trigger.js +92 -115
- package/scheduled-tasks.js +15 -13
- package/shared/timezones.d.ts +30 -0
- package/shared/timezones.d.ts.map +1 -0
- package/shared/timezones.js +102 -0
- package/skill/skill-archive.d.ts.map +1 -1
- package/skill/skill-archive.js +6 -7
- package/skill/skill.d.ts +2 -2
- package/skill/skill.d.ts.map +1 -1
- package/skill/skill.js +33 -34
- package/skill/useSkillEditorLoad.js +1 -1
- package/skill/useSkillEditorSubmit.d.ts +4 -1
- package/skill/useSkillEditorSubmit.d.ts.map +1 -1
- package/skill/useSkillEditorSubmit.js +125 -121
- package/usage/map-usage-data-to-dashboard.d.ts +22 -1
- package/usage/map-usage-data-to-dashboard.d.ts.map +1 -1
- package/usage/map-usage-data-to-dashboard.js +33 -2
- package/usage/spending-limits-mode.d.ts +37 -0
- package/usage/spending-limits-mode.d.ts.map +1 -0
- package/usage/spending-limits-mode.js +15 -0
- package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts +6 -2
- package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts.map +1 -1
- package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts +4 -1
- package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts.map +1 -1
- package/usage/useUsageLimitBanner/useUsageLimitBanner.js +55 -47
- package/usage-limits.js +6 -5
- package/usage.js +3 -3
- package/utils.js +27 -21
- package/shared/cron-day-of-month.d.ts +0 -21
- package/shared/cron-day-of-month.d.ts.map +0 -1
- package/shared/cron-day-of-month.js +0 -13
|
@@ -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 {
|
|
4
|
-
import {
|
|
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
|
|
6
|
+
var o = /* @__PURE__ */ new Set([
|
|
8
7
|
"hour",
|
|
9
8
|
"minute",
|
|
10
9
|
"day_of_week",
|
|
11
10
|
"day"
|
|
12
|
-
]),
|
|
13
|
-
if (e.repeat ===
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
|
36
|
-
},
|
|
37
|
-
let
|
|
38
|
-
return t
|
|
39
|
-
},
|
|
40
|
-
let t = e.repeat ===
|
|
41
|
-
fields:
|
|
42
|
-
...e.startDate ? { startDate:
|
|
43
|
-
...e.endDate ? { endDate:
|
|
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
|
-
},
|
|
54
|
-
...
|
|
43
|
+
}, y = (e) => ({
|
|
44
|
+
...v(e),
|
|
55
45
|
skillUrls: [...new Set(e.skillUrls ?? [])]
|
|
56
|
-
}),
|
|
57
|
-
let n = new
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
60
|
+
isCustom: !0,
|
|
61
|
+
time: s,
|
|
62
|
+
daysOfWeek: p(u)
|
|
101
63
|
};
|
|
102
|
-
|
|
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:
|
|
108
|
-
if (
|
|
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
|
|
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 (
|
|
95
|
+
if (o) return {
|
|
120
96
|
ok: !0,
|
|
121
97
|
values: {
|
|
122
|
-
...
|
|
123
|
-
repeat:
|
|
124
|
-
runAt:
|
|
125
|
-
time:
|
|
98
|
+
...l,
|
|
99
|
+
repeat: r.OneTime,
|
|
100
|
+
runAt: b(i, c),
|
|
101
|
+
time: m
|
|
126
102
|
}
|
|
127
103
|
};
|
|
128
|
-
if (!
|
|
104
|
+
if (!a) return {
|
|
129
105
|
ok: !1,
|
|
130
106
|
reason: t.UnsupportedTriggerType
|
|
131
107
|
};
|
|
132
|
-
let
|
|
133
|
-
if (!
|
|
108
|
+
let u = S(a.fields);
|
|
109
|
+
if (!u.ok) return {
|
|
134
110
|
ok: !1,
|
|
135
111
|
reason: t.UnsupportedCronShape
|
|
136
112
|
};
|
|
137
|
-
|
|
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
|
-
...
|
|
141
|
-
repeat:
|
|
142
|
-
time:
|
|
143
|
-
minute:
|
|
144
|
-
...
|
|
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 (
|
|
127
|
+
if (u.isCustom) return {
|
|
149
128
|
ok: !0,
|
|
150
129
|
values: {
|
|
151
|
-
...
|
|
152
|
-
repeat:
|
|
153
|
-
time:
|
|
154
|
-
daysOfWeek:
|
|
155
|
-
...
|
|
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
|
|
160
|
-
return
|
|
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
|
-
...
|
|
164
|
-
repeat:
|
|
165
|
-
time:
|
|
166
|
-
...
|
|
167
|
-
...
|
|
168
|
-
...
|
|
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 {
|
|
151
|
+
export { v as mapFormValuesToCreateBody, y as mapFormValuesToUpdateBody, C as mapScheduledTaskDtoToFormValues };
|
package/scheduled-tasks.js
CHANGED
|
@@ -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 {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
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 { SCHEDULED_TASK_WALL_DATE_TIME_PATTERN as c, ScheduledTaskWeekdayStyle as l, formatScheduledTaskClockTime as u, formatScheduledTaskInstant as d, formatScheduledTaskRunDate as f, formatScheduledTaskRunTime as p, formatScheduledTaskWeekday as m, formatScheduledTaskWeekdays as h, formatZonedDateTime as g } from "./scheduled-task/scheduled-task-time-format.js";
|
|
5
|
+
import { ScheduledTaskDeleteErrorKind as _, classifyScheduledTaskDeleteError as v, formatScheduledTaskRunDuration as y, formatScheduledTaskRunTimestamp as b, formatScheduledTaskScheduleLabel as x, formatScheduledTaskTriggerTime as S, selectScheduledTaskErrorMessage as C, toScheduledTaskItem as w, toScheduledTaskItems as T, toScheduledTaskRunItem as E, toScheduledTaskRunItems as D } from "./scheduled-task/scheduled-task-display.js";
|
|
6
|
+
import { mapFormValuesToCreateBody as O, mapFormValuesToUpdateBody as k, mapScheduledTaskDtoToFormValues as A } from "./scheduled-task/scheduled-task-trigger.js";
|
|
7
|
+
import { prepareScheduledTaskCreateBody as j, prepareScheduledTaskUpdateBody as M } from "./scheduled-task/scheduled-task-preparation.js";
|
|
8
|
+
import { createScheduledTasksApiClient as N } from "./scheduled-task/scheduled-tasks-api-client.js";
|
|
9
|
+
import { useScheduledTasks as P } from "./scheduled-task/use-scheduled-tasks.js";
|
|
10
|
+
import { mergeRunsById as F, useScheduledTaskRuns as I } from "./scheduled-task/use-scheduled-task-runs.js";
|
|
11
|
+
import { ScheduledTaskRunStatusFeedback as L, mergeScheduledTaskRuns as R, useStartScheduledTask as z } from "./scheduled-task/useStartScheduledTask.js";
|
|
12
|
+
import { getNextCronOccurrence as B, hasScheduledTaskWindowEnded as V } from "./scheduled-task/scheduled-task-next-occurrence.js";
|
|
13
|
+
import { checkScheduledTaskAuthSessionError as H } from "./scheduled-task/check-scheduled-task-auth-session-error.js";
|
|
14
|
+
import { useScheduledTaskSkillDisplayNames as U } from "./scheduled-task/useScheduledTaskSkillDisplayNames/useScheduledTaskSkillDisplayNames.js";
|
|
15
|
+
import { ActiveScheduledTaskDetailState as W, ActiveScheduledTaskStatus as G, resolveActiveScheduledTask as K } from "./scheduled-task/active-scheduled-task.js";
|
|
16
|
+
import { useActiveScheduledTaskDetails as q } from "./scheduled-task/useActiveScheduledTaskDetails.js";
|
|
17
|
+
export { W as ActiveScheduledTaskDetailState, G as ActiveScheduledTaskStatus, c as SCHEDULED_TASK_WALL_DATE_TIME_PATTERN, _ as ScheduledTaskDeleteErrorKind, L as ScheduledTaskRunStatusFeedback, t as ScheduledTaskTriggerDescriptionKind, l as ScheduledTaskWeekdayStyle, r as UTC_TIMEZONE_ID, e as UnsupportedTriggerReason, H as checkScheduledTaskAuthSessionError, v as classifyScheduledTaskDeleteError, N as createScheduledTasksApiClient, n as describeScheduledTaskTrigger, i as findTimezoneOption, u as formatScheduledTaskClockTime, d as formatScheduledTaskInstant, f as formatScheduledTaskRunDate, y as formatScheduledTaskRunDuration, p as formatScheduledTaskRunTime, b as formatScheduledTaskRunTimestamp, x as formatScheduledTaskScheduleLabel, S as formatScheduledTaskTriggerTime, m as formatScheduledTaskWeekday, h as formatScheduledTaskWeekdays, g as formatZonedDateTime, B as getNextCronOccurrence, a as getTimezoneOptions, V as hasScheduledTaskWindowEnded, o as isKnownTimezone, s as isSameTimezone, O as mapFormValuesToCreateBody, k as mapFormValuesToUpdateBody, A as mapScheduledTaskDtoToFormValues, F as mergeRunsById, R as mergeScheduledTaskRuns, j as prepareScheduledTaskCreateBody, M as prepareScheduledTaskUpdateBody, K as resolveActiveScheduledTask, C as selectScheduledTaskErrorMessage, w as toScheduledTaskItem, T as toScheduledTaskItems, E as toScheduledTaskRunItem, D as toScheduledTaskRunItems, q as useActiveScheduledTaskDetails, I as useScheduledTaskRuns, U as useScheduledTaskSkillDisplayNames, P as useScheduledTasks, z 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;
|
|
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"}
|
package/skill/skill-archive.js
CHANGED
|
@@ -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
|
|
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
|
-
}),
|
|
9
|
-
let i =
|
|
10
|
-
return Object.entries(
|
|
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
|
|
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 {
|
|
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.
|
|
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. */
|
package/skill/skill.d.ts.map
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../src/skill/skill.ts"],"names":[],"mappings":"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"}
|
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 {
|
|
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
|
|
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
|
-
|
|
10
|
-
]),
|
|
11
|
-
if (e === "" || e.startsWith("/") ||
|
|
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) =>
|
|
14
|
-
},
|
|
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
|
-
}({}),
|
|
15
|
+
}({}), C = {
|
|
17
16
|
name: n,
|
|
18
17
|
description: e,
|
|
19
18
|
instructions: t
|
|
20
|
-
},
|
|
19
|
+
}, w = (e) => {
|
|
21
20
|
let t = {};
|
|
22
|
-
for (let n of Object.keys(
|
|
23
|
-
let r =
|
|
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
|
-
},
|
|
26
|
+
}, T = ({ name: e, description: t, instructions: n }) => `---\n${s({
|
|
28
27
|
name: e,
|
|
29
28
|
description: t
|
|
30
|
-
}).trimEnd()}\n---\n\n${n}`,
|
|
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${
|
|
37
|
-
},
|
|
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 || !
|
|
40
|
-
},
|
|
41
|
-
let t =
|
|
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:
|
|
44
|
+
frontmatter: o(n) ?? {},
|
|
46
45
|
instructions: r.replace(/^\r?\n/, "")
|
|
47
46
|
};
|
|
48
|
-
},
|
|
49
|
-
let t =
|
|
50
|
-
if (
|
|
51
|
-
let
|
|
52
|
-
for (let [e,
|
|
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(
|
|
55
|
-
files:
|
|
56
|
-
folders:
|
|
53
|
+
manifestText: new TextDecoder().decode(r),
|
|
54
|
+
files: i,
|
|
55
|
+
folders: a
|
|
57
56
|
};
|
|
58
|
-
},
|
|
57
|
+
}, M = (e) => {
|
|
59
58
|
let t = e.lastIndexOf("/");
|
|
60
59
|
return t === -1 ? e : e.slice(t + 1);
|
|
61
|
-
},
|
|
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
|
-
}),
|
|
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}${
|
|
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) =>
|
|
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 {
|
|
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 };
|
|
@@ -13,7 +13,7 @@ var m = /* @__PURE__ */ function(e) {
|
|
|
13
13
|
let r = await e.downloadSkill(t, n), i = r.headers.get("etag");
|
|
14
14
|
if (!i) throw new g("Skill ETag is missing");
|
|
15
15
|
try {
|
|
16
|
-
let e = await r.arrayBuffer(), { manifestText: t, files: n, folders: a } = l(new Uint8Array(e));
|
|
16
|
+
let e = await r.arrayBuffer(), { manifestText: t, files: n, folders: a } = await l(new Uint8Array(e));
|
|
17
17
|
return {
|
|
18
18
|
etag: i,
|
|
19
19
|
manifestText: t,
|