@epam/ai-dial-chat-hooks 1.2.0-dev.164 → 1.2.0-dev.173
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/catalog/map-entity-details-to-catalog.js +7 -0
- package/catalog.d.ts +2 -0
- package/conversation/create-chat-stream-api.js +63 -36
- package/conversation/useConversationStream/generation-resume.js +80 -51
- package/conversation/useConversationStream/useConversationStream.js +162 -130
- package/conversation.d.ts +20 -0
- package/conversation.js +32 -32
- package/file-manager.d.ts +23 -17
- package/files/dial-file-manager-mapping.util.js +1 -1
- package/files/dial-file-manager.types.js +2 -2
- package/files/useDialFileManager/useDialFileManager.js +130 -128
- package/files/useDialFileMutations/useDialFileMutations.js +33 -32
- package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +117 -110
- package/index.d.ts +83 -21
- package/index.js +124 -124
- package/package.json +17 -17
- package/scheduled-task/use-scheduled-task-runs.js +162 -50
- package/scheduled-tasks.d.ts +17 -2
- package/scheduled-tasks.js +2 -2
- package/skill/skill-archive.js +19 -0
- package/skill/skill.js +41 -29
- package/skill/useSkillEditorSubmit.js +98 -92
- package/skill/useSkillFileActions.js +70 -58
- package/skill-editor.d.ts +21 -2
- package/skill-editor.js +9 -9
|
@@ -1,153 +1,159 @@
|
|
|
1
1
|
import { getApiErrorDetails as e, getApiErrorStatus as t } from "../api-error/api-error.js";
|
|
2
|
-
import {
|
|
3
|
-
import { useCallback as
|
|
4
|
-
import { NotificationVariant as
|
|
2
|
+
import { SKILL_TEXT_FIELD_MAX_LENGTHS as n, buildSkillFilesPayload as r, buildSkillManifestForSubmit as i, getSkillFieldLengthViolations as a, isValidSkillRelativePath as o, normalizeSkillName as s, startsWithFrontmatterBlock as c } from "./skill.js";
|
|
3
|
+
import { useCallback as l, useRef as u, useState as d } from "react";
|
|
4
|
+
import { NotificationVariant as f } from "@epam/ai-dial-ui-kit";
|
|
5
5
|
//#region src/skill/useSkillEditorSubmit.ts
|
|
6
|
-
var
|
|
6
|
+
var p = (e, t) => JSON.stringify({
|
|
7
7
|
values: e,
|
|
8
8
|
files: [...t].sort((e, t) => e.path.localeCompare(t.path))
|
|
9
|
-
}),
|
|
10
|
-
let [
|
|
9
|
+
}), m = ({ bucket: m, isEditMode: h, files: g, filesContentRef: _, frontmatterRef: v, loadedPathRef: y, etagRef: b, returnUrl: x, getCreateReturnUrl: S, refetchSkills: C, client: w, messages: T, onNavigate: E, onNotify: D }) => {
|
|
10
|
+
let [O, k] = d({}), [A, j] = d(), [M, N] = d(!1), [P, F] = d(), [I, L] = d("idle"), R = u(null), z = u(null), B = l(async (n) => {
|
|
11
11
|
switch (t(n)) {
|
|
12
12
|
case 409:
|
|
13
|
-
|
|
13
|
+
k({ name: T.nameConflict });
|
|
14
14
|
return;
|
|
15
15
|
case 412:
|
|
16
|
-
|
|
16
|
+
k({ name: T.nameConflict });
|
|
17
17
|
return;
|
|
18
18
|
case 413:
|
|
19
|
-
|
|
19
|
+
j(T.archiveTooLarge);
|
|
20
20
|
return;
|
|
21
21
|
case 503:
|
|
22
|
-
|
|
22
|
+
j(T.serviceUnavailable), N(!0);
|
|
23
23
|
return;
|
|
24
24
|
case 400: {
|
|
25
25
|
let { message: t } = await e(n);
|
|
26
|
-
|
|
26
|
+
j(t ?? T.pathInvalid);
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
default: {
|
|
30
30
|
let { traceId: t } = await e(n);
|
|
31
|
-
|
|
32
|
-
variant:
|
|
33
|
-
message:
|
|
31
|
+
j(T.saveError), D({
|
|
32
|
+
variant: f.Error,
|
|
33
|
+
message: T.saveError,
|
|
34
34
|
requestId: t
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
}, [
|
|
39
|
-
let t =
|
|
40
|
-
if (!t || !
|
|
41
|
-
|
|
38
|
+
}, [T, D]), V = l(async (e) => {
|
|
39
|
+
let t = s(e.name);
|
|
40
|
+
if (!t || !o(t)) {
|
|
41
|
+
k({ name: T.nameInvalid });
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
let
|
|
45
|
-
c ? {skillManifest:
|
|
46
|
-
fingerprint:
|
|
47
|
-
bucket:
|
|
44
|
+
let n = p(e, g), a = R.current, c = a != null && a.fingerprint === n, l = t, u, d, h;
|
|
45
|
+
c ? {skillManifest: u, filePaths: d, files: h} = a : (u = i(v.current, t, e.description, e.instructions), {filePaths: d, files: h} = r(g, _.current)), L("submitting"), R.current = {
|
|
46
|
+
fingerprint: n,
|
|
47
|
+
bucket: m,
|
|
48
48
|
path: l,
|
|
49
|
-
skillManifest:
|
|
50
|
-
filePaths:
|
|
51
|
-
files:
|
|
49
|
+
skillManifest: u,
|
|
50
|
+
filePaths: d,
|
|
51
|
+
files: h
|
|
52
52
|
};
|
|
53
53
|
try {
|
|
54
|
-
await
|
|
55
|
-
variant:
|
|
56
|
-
title:
|
|
57
|
-
message:
|
|
58
|
-
}),
|
|
54
|
+
await w.createSkill(m, l, u, d, h), await C(), L("success"), D({
|
|
55
|
+
variant: f.Success,
|
|
56
|
+
title: T.saveSuccessTitle,
|
|
57
|
+
message: T.createSuccess(t)
|
|
58
|
+
}), E(S?.(l) ?? x);
|
|
59
59
|
} catch (e) {
|
|
60
|
-
|
|
60
|
+
L("failure"), await B(e);
|
|
61
61
|
}
|
|
62
62
|
}, [
|
|
63
|
-
f,
|
|
64
63
|
m,
|
|
65
|
-
h,
|
|
66
64
|
g,
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
_,
|
|
66
|
+
v,
|
|
69
67
|
T,
|
|
70
68
|
w,
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
D,
|
|
70
|
+
E,
|
|
73
71
|
x,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
S,
|
|
73
|
+
C,
|
|
74
|
+
B
|
|
75
|
+
]), H = l(async (e) => {
|
|
76
|
+
let n = y.current, a = b.current;
|
|
77
|
+
if (!n || !a) {
|
|
78
|
+
j(T.saveError);
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
|
-
let o =
|
|
82
|
-
|
|
81
|
+
let o = i(v.current, e.name, e.description, e.instructions), { filePaths: s, files: c } = r(g, _.current);
|
|
82
|
+
L("submitting");
|
|
83
83
|
try {
|
|
84
|
-
|
|
85
|
-
variant:
|
|
86
|
-
title:
|
|
87
|
-
message:
|
|
88
|
-
}),
|
|
84
|
+
b.current = (await w.updateSkill(m, n, o, s, c, a)).etag ?? a, await C(), L("success"), D({
|
|
85
|
+
variant: f.Success,
|
|
86
|
+
title: T.updateSuccessTitle,
|
|
87
|
+
message: T.updateSuccess(e.name)
|
|
88
|
+
}), E(x);
|
|
89
89
|
} catch (e) {
|
|
90
|
-
if (
|
|
91
|
-
|
|
90
|
+
if (L("failure"), t(e) === 412) {
|
|
91
|
+
F({ message: T.conflictMessage });
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
-
await
|
|
94
|
+
await B(e);
|
|
95
95
|
}
|
|
96
96
|
}, [
|
|
97
|
-
f,
|
|
98
97
|
m,
|
|
99
|
-
h,
|
|
100
98
|
g,
|
|
101
99
|
_,
|
|
102
100
|
v,
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
y,
|
|
102
|
+
b,
|
|
105
103
|
T,
|
|
106
104
|
w,
|
|
107
|
-
|
|
105
|
+
D,
|
|
106
|
+
E,
|
|
108
107
|
x,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
108
|
+
C,
|
|
109
|
+
B
|
|
110
|
+
]), U = l((e) => {
|
|
111
|
+
let t = c(e.instructions), r = a(e);
|
|
112
|
+
k((e) => {
|
|
113
|
+
let i = { ...e };
|
|
114
|
+
for (let e of Object.keys(n)) {
|
|
115
|
+
let t = T.tooLong(n[e]);
|
|
116
|
+
r[e] ? i[e] = t : i[e] === t && delete i[e];
|
|
117
|
+
}
|
|
118
|
+
if (!r.instructions) {
|
|
119
|
+
let e = i.instructions === T.instructionsFrontmatter;
|
|
120
|
+
t && !e ? i.instructions = T.instructionsFrontmatter : !t && e && delete i.instructions;
|
|
121
|
+
}
|
|
122
|
+
return Object.keys(i).length === Object.keys(e).length && Object.keys(i).every((t) => i[t] === e[t]) ? e : i;
|
|
120
123
|
});
|
|
121
|
-
}, [
|
|
122
|
-
if (
|
|
124
|
+
}, [T]), W = l(async (e) => {
|
|
125
|
+
if (I === "submitting" || !m) return;
|
|
123
126
|
let t = {};
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
e.name.trim() || (t.name = T.required), e.description.trim() || (t.description = T.required), e.instructions.trim() ? c(e.instructions) && (t.instructions = T.instructionsFrontmatter) : t.instructions = T.required;
|
|
128
|
+
let r = a(e);
|
|
129
|
+
for (let e of Object.keys(r)) t[e] ??= T.tooLong(n[e]);
|
|
130
|
+
if (Object.keys(t).length > 0) {
|
|
131
|
+
k(t);
|
|
126
132
|
return;
|
|
127
133
|
}
|
|
128
|
-
|
|
134
|
+
k({}), j(void 0), N(!1), F(void 0), z.current = e, h ? await H(e) : await V(e);
|
|
129
135
|
}, [
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
I,
|
|
137
|
+
m,
|
|
138
|
+
T,
|
|
139
|
+
h,
|
|
140
|
+
H,
|
|
141
|
+
V
|
|
136
142
|
]);
|
|
137
143
|
return {
|
|
138
|
-
phase:
|
|
139
|
-
errors:
|
|
140
|
-
submitError:
|
|
141
|
-
isSubmitErrorRetryable:
|
|
142
|
-
retrySubmit:
|
|
143
|
-
let e =
|
|
144
|
-
e != null &&
|
|
145
|
-
}, [
|
|
146
|
-
conflict:
|
|
147
|
-
clearConflict: () =>
|
|
148
|
-
handleSubmit:
|
|
149
|
-
handleValuesChange:
|
|
144
|
+
phase: I,
|
|
145
|
+
errors: O,
|
|
146
|
+
submitError: A,
|
|
147
|
+
isSubmitErrorRetryable: M,
|
|
148
|
+
retrySubmit: l(() => {
|
|
149
|
+
let e = z.current;
|
|
150
|
+
e != null && W(e);
|
|
151
|
+
}, [W]),
|
|
152
|
+
conflict: P,
|
|
153
|
+
clearConflict: () => F(void 0),
|
|
154
|
+
handleSubmit: W,
|
|
155
|
+
handleValuesChange: U
|
|
150
156
|
};
|
|
151
157
|
};
|
|
152
158
|
//#endregion
|
|
153
|
-
export {
|
|
159
|
+
export { m as useSkillEditorSubmit };
|
|
@@ -1,99 +1,111 @@
|
|
|
1
|
-
import { SKILL_MANIFEST_FILE as e, buildSkillManifest as t, buildSkillManifestFromFrontmatter as n,
|
|
2
|
-
import { validateSkillFileBatch as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { SKILL_MANIFEST_FILE as e, buildSkillManifest as t, buildSkillManifestFromFrontmatter as n, isValidSkillRelativePath as r, nameFromPath as i } from "./skill.js";
|
|
2
|
+
import { validateSkillFileBatch as a } from "./skill-file-batch-validation.js";
|
|
3
|
+
import { extractSkillArchive as o } from "./skill-archive.js";
|
|
4
|
+
import { getUtf8ByteLength as s } from "@epam/ai-dial-chat-shared";
|
|
5
|
+
import { useCallback as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
6
|
+
import { SkillFileNodeKind as f } from "@epam/ai-dial-skill-editor";
|
|
6
7
|
//#region src/skill/useSkillFileActions.ts
|
|
7
|
-
var
|
|
8
|
-
let [
|
|
9
|
-
let e =
|
|
10
|
-
for (let t of e) r +=
|
|
8
|
+
var p = "probe", m = ({ files: m, setFiles: h, filesContentRef: g, frontmatterRef: _, loadedValues: v, setLoadedValues: y, isEditMode: b, isDirty: x, setSelectedPath: S, messages: C, pickFromFileSystem: w }) => {
|
|
9
|
+
let [T, E] = d(!1), D = u(null), O = c(() => {
|
|
10
|
+
let e = m.filter((e) => e.kind === f.File).map((e) => e.path), r = 0;
|
|
11
|
+
for (let t of e) r += g.current.get(t)?.bytes.length ?? 0;
|
|
11
12
|
let i = {
|
|
12
|
-
name:
|
|
13
|
-
description:
|
|
14
|
-
instructions:
|
|
15
|
-
},
|
|
13
|
+
name: v?.name ?? "",
|
|
14
|
+
description: v?.description ?? "",
|
|
15
|
+
instructions: v?.instructions ?? ""
|
|
16
|
+
}, a = b ? n(_.current, i.name, i.description, i.instructions) : t(i);
|
|
16
17
|
return {
|
|
17
18
|
existingPaths: e,
|
|
18
19
|
existingTotalBytes: r,
|
|
19
|
-
manifestByteLength: a
|
|
20
|
-
messages:
|
|
20
|
+
manifestByteLength: s(a),
|
|
21
|
+
messages: C
|
|
21
22
|
};
|
|
22
23
|
}, [
|
|
23
|
-
d,
|
|
24
|
-
p,
|
|
25
|
-
_,
|
|
26
24
|
m,
|
|
27
|
-
|
|
28
|
-
b
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
g,
|
|
26
|
+
b,
|
|
27
|
+
_,
|
|
28
|
+
v,
|
|
29
|
+
C
|
|
30
|
+
]), k = c(() => new Promise((e) => {
|
|
31
|
+
D.current = e, E(!0);
|
|
32
|
+
}), []), A = c((e) => {
|
|
33
|
+
E(!1), D.current?.(e), D.current = null;
|
|
33
34
|
}, []);
|
|
34
35
|
return {
|
|
35
|
-
fileActions:
|
|
36
|
+
fileActions: l(() => ({
|
|
36
37
|
validateBatch: async (e) => {
|
|
37
|
-
let { results: t, batchErrors: n } = await
|
|
38
|
+
let { results: t, batchErrors: n } = await a(e, O());
|
|
38
39
|
return {
|
|
39
40
|
results: t,
|
|
40
41
|
batchErrors: n
|
|
41
42
|
};
|
|
42
43
|
},
|
|
43
44
|
commitBatch: async (e) => {
|
|
44
|
-
let { results: t, batchErrors: n, manifestCandidate:
|
|
45
|
-
if (t.some((e) => e.error !== void 0) || n.length > 0) return { error: n[0]?.message ??
|
|
46
|
-
if (
|
|
47
|
-
if (
|
|
48
|
-
if ((
|
|
45
|
+
let { results: t, batchErrors: n, manifestCandidate: r } = await a(e, O());
|
|
46
|
+
if (t.some((e) => e.error !== void 0) || n.length > 0) return { error: n[0]?.message ?? C.saveError };
|
|
47
|
+
if (r) {
|
|
48
|
+
if (b && r.name !== (v?.name ?? "")) return { error: C.manifestNameMismatch };
|
|
49
|
+
if ((b || x) && !await k()) return { error: C.manifestImportDeclined };
|
|
49
50
|
}
|
|
50
51
|
try {
|
|
51
|
-
let t = e.filter((e) => e.id !==
|
|
52
|
+
let t = e.filter((e) => e.id !== r?.candidateId), n = await Promise.all(t.map(async (e) => ({
|
|
52
53
|
path: e.path,
|
|
53
54
|
bytes: new Uint8Array(await e.file.arrayBuffer()),
|
|
54
55
|
mimeType: e.file.type || void 0
|
|
55
56
|
})));
|
|
56
|
-
for (let e of n)
|
|
57
|
+
for (let e of n) g.current.set(e.path, {
|
|
57
58
|
bytes: e.bytes,
|
|
58
59
|
mimeType: e.mimeType
|
|
59
60
|
});
|
|
60
|
-
return n.length > 0 &&
|
|
61
|
+
return n.length > 0 && h((e) => [...e, ...n.map((e) => ({
|
|
61
62
|
path: e.path,
|
|
62
|
-
name:
|
|
63
|
-
kind:
|
|
64
|
-
}))]),
|
|
65
|
-
...
|
|
66
|
-
...
|
|
67
|
-
} :
|
|
68
|
-
name:
|
|
69
|
-
description:
|
|
70
|
-
instructions:
|
|
63
|
+
name: i(e.path),
|
|
64
|
+
kind: f.File
|
|
65
|
+
}))]), r && (_.current = b ? {
|
|
66
|
+
..._.current,
|
|
67
|
+
...r.frontmatter
|
|
68
|
+
} : r.frontmatter, y({
|
|
69
|
+
name: b ? v?.name ?? r.name : r.name,
|
|
70
|
+
description: r.description,
|
|
71
|
+
instructions: r.instructions
|
|
71
72
|
})), {};
|
|
72
73
|
} catch (e) {
|
|
73
74
|
return { error: e instanceof Error ? e.message : String(e) };
|
|
74
75
|
}
|
|
75
76
|
},
|
|
76
77
|
onRemoveNode: (t) => {
|
|
77
|
-
|
|
78
|
-
for (let e of [...
|
|
79
|
-
|
|
80
|
-
}
|
|
78
|
+
h((e) => e.filter((e) => e.path !== t && !e.path.startsWith(`${t}/`)));
|
|
79
|
+
for (let e of [...g.current.keys()]) (e === t || e.startsWith(`${t}/`)) && g.current.delete(e);
|
|
80
|
+
S((n) => n === t || n.startsWith(`${t}/`) ? e : n);
|
|
81
|
+
},
|
|
82
|
+
onCreateFolder: (e) => {
|
|
83
|
+
h((t) => t.some((t) => t.path === e) ? t : [...t, {
|
|
84
|
+
path: e,
|
|
85
|
+
name: i(e),
|
|
86
|
+
kind: f.Folder
|
|
87
|
+
}]);
|
|
88
|
+
},
|
|
89
|
+
validateFolderPath: (e) => r(`${e}/${p}`) ? void 0 : C.pathInvalid,
|
|
90
|
+
extractArchive: o,
|
|
91
|
+
pickFromFileSystem: w
|
|
81
92
|
}), [
|
|
82
|
-
|
|
83
|
-
|
|
93
|
+
O,
|
|
94
|
+
b,
|
|
95
|
+
x,
|
|
84
96
|
v,
|
|
85
|
-
|
|
86
|
-
T,
|
|
87
|
-
p,
|
|
88
|
-
m,
|
|
89
|
-
f,
|
|
97
|
+
k,
|
|
90
98
|
g,
|
|
99
|
+
_,
|
|
100
|
+
h,
|
|
91
101
|
y,
|
|
92
|
-
|
|
102
|
+
S,
|
|
103
|
+
C,
|
|
104
|
+
w
|
|
93
105
|
]),
|
|
94
|
-
pendingManifestImport:
|
|
95
|
-
resolveManifestImport:
|
|
106
|
+
pendingManifestImport: T,
|
|
107
|
+
resolveManifestImport: A
|
|
96
108
|
};
|
|
97
109
|
};
|
|
98
110
|
//#endregion
|
|
99
|
-
export {
|
|
111
|
+
export { m as useSkillFileActions };
|
package/skill-editor.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { SkillEditorFileActions } from '@epam/ai-dial-skill-editor';
|
|
|
7
7
|
import { SkillEditorValues } from '@epam/ai-dial-skill-editor';
|
|
8
8
|
import { SkillFileBatchError } from '@epam/ai-dial-skill-editor';
|
|
9
9
|
import { SkillFileListResponseDto } from '@epam/ai-dial-chat-api-client';
|
|
10
|
+
import { SkillFileSourceEntry } from '@epam/ai-dial-skill-editor';
|
|
10
11
|
import { SkillFileTreeNode } from '@epam/ai-dial-skill-editor';
|
|
11
12
|
import { SkillFileUploadCandidate } from '@epam/ai-dial-skill-editor';
|
|
12
13
|
import { SkillFileValidationResult } from '@epam/ai-dial-skill-editor';
|
|
@@ -50,6 +51,9 @@ export declare const buildSkillManifestFromFrontmatter: (baseFrontmatter: Record
|
|
|
50
51
|
*/
|
|
51
52
|
export declare const classifySkillArchiveImportError: (status: number | undefined) => SkillArchiveImportErrorKind;
|
|
52
53
|
|
|
54
|
+
/** Returns the limit each over-long skill field exceeds, keyed by field; fields within their limit are omitted. */
|
|
55
|
+
export declare const getSkillFieldLengthViolations: (values: Record<SkillTextField, string>) => Partial<Record<SkillTextField, number>>;
|
|
56
|
+
|
|
53
57
|
/**
|
|
54
58
|
* Client-side mirror of the backend's `isValidSkillRelativePath`
|
|
55
59
|
* (`apps/chat-api/src/skills/utils/skill-path.util.ts`), used only for
|
|
@@ -105,6 +109,9 @@ export declare const SKILL_FILE_UPLOAD_MAX_BYTES = 1048576;
|
|
|
105
109
|
/** Root manifest filename required at the top of every skill archive (mirrors `SKILL_MANIFEST_FILE` in `apps/chat-api/src/skills/utils/skill-path.util.ts`). */
|
|
106
110
|
export declare const SKILL_MANIFEST_FILE = "SKILL.md";
|
|
107
111
|
|
|
112
|
+
/** Length limit of each skill editor text field. */
|
|
113
|
+
export declare const SKILL_TEXT_FIELD_MAX_LENGTHS: Record<SkillTextField, number>;
|
|
114
|
+
|
|
108
115
|
/**
|
|
109
116
|
* Client-side mirror of the backend's default `SKILL_UPLOAD_MAX_FILES`
|
|
110
117
|
* (`apps/chat-api/src/config/environment.config.ts`), used only for
|
|
@@ -192,6 +199,8 @@ export declare interface SkillEditorSubmitClient {
|
|
|
192
199
|
export declare interface SkillEditorSubmitMessages {
|
|
193
200
|
/** Shown when a required field is empty. */
|
|
194
201
|
required: string;
|
|
202
|
+
/** Shown when a name, description or instructions value exceeds its length limit, given that limit. */
|
|
203
|
+
tooLong: (maxLength: number) => string;
|
|
195
204
|
/**
|
|
196
205
|
* Shown when the Instructions value opens with its own YAML frontmatter
|
|
197
206
|
* block — pasting a whole `SKILL.md` in there would otherwise produce a
|
|
@@ -363,6 +372,9 @@ export declare interface SkillManifestValues {
|
|
|
363
372
|
instructions: string;
|
|
364
373
|
}
|
|
365
374
|
|
|
375
|
+
/** Skill editor text fields with a length limit. */
|
|
376
|
+
export declare type SkillTextField = 'name' | 'description' | 'instructions';
|
|
377
|
+
|
|
366
378
|
/**
|
|
367
379
|
* Answers one question: would appending this text after the fence that
|
|
368
380
|
* `buildSkillManifest` writes produce a *second* frontmatter block?
|
|
@@ -559,10 +571,11 @@ export declare interface UseSkillEditorSubmitResult {
|
|
|
559
571
|
/**
|
|
560
572
|
* Owns the Skill Editor's batch file upload workflow: validating a staged
|
|
561
573
|
* batch, committing it atomically (supporting files plus an optional
|
|
562
|
-
* `SKILL.md` manifest import, with a confirmation gate),
|
|
574
|
+
* `SKILL.md` manifest import, with a confirmation gate), creating empty
|
|
575
|
+
* folders, expanding `.zip` archives for staging, and removing
|
|
563
576
|
* already-committed nodes.
|
|
564
577
|
*/
|
|
565
|
-
export declare const useSkillFileActions: ({ files, setFiles, filesContentRef, frontmatterRef, loadedValues, setLoadedValues, isEditMode, isDirty, setSelectedPath, messages, }: UseSkillFileActionsParams) => UseSkillFileActionsResult;
|
|
578
|
+
export declare const useSkillFileActions: ({ files, setFiles, filesContentRef, frontmatterRef, loadedValues, setLoadedValues, isEditMode, isDirty, setSelectedPath, messages, pickFromFileSystem, }: UseSkillFileActionsParams) => UseSkillFileActionsResult;
|
|
566
579
|
|
|
567
580
|
/** Parameters accepted by {@link useSkillFileActions}. */
|
|
568
581
|
export declare interface UseSkillFileActionsParams {
|
|
@@ -586,6 +599,12 @@ export declare interface UseSkillFileActionsParams {
|
|
|
586
599
|
setSelectedPath: Dispatch<SetStateAction<string>>;
|
|
587
600
|
/** Localized messages, resolved by the host. */
|
|
588
601
|
messages: SkillFileActionsMessages;
|
|
602
|
+
/**
|
|
603
|
+
* Opens the host's file-system picker; passed through unchanged as
|
|
604
|
+
* `fileActions.pickFromFileSystem`. Omit to hide the editor's "Open DIAL
|
|
605
|
+
* file system" entry.
|
|
606
|
+
*/
|
|
607
|
+
pickFromFileSystem?: () => Promise<SkillFileSourceEntry[] | undefined>;
|
|
589
608
|
}
|
|
590
609
|
|
|
591
610
|
/** Return value of {@link useSkillFileActions}. */
|
package/skill-editor.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { SKILL_FILE_UPLOAD_MAX_BYTES as e, SKILL_MANIFEST_FILE as t,
|
|
2
|
-
import { parseSkillManifestDocument as
|
|
3
|
-
import { validateSkillFileBatch as
|
|
4
|
-
import { skillFileToAttachment as
|
|
5
|
-
import { SkillEditorLoadState as
|
|
6
|
-
import { useSkillEditorSubmit as
|
|
7
|
-
import { useSkillFileActions as
|
|
8
|
-
import { SkillArchiveImportErrorKind as
|
|
9
|
-
export { e as SKILL_FILE_UPLOAD_MAX_BYTES, t as SKILL_MANIFEST_FILE, n as
|
|
1
|
+
import { SKILL_FILE_UPLOAD_MAX_BYTES as e, SKILL_MANIFEST_FILE as t, SKILL_TEXT_FIELD_MAX_LENGTHS as n, SKILL_UPLOAD_MAX_FILES as r, SKILL_UPLOAD_MAX_TOTAL_BYTES as i, buildSkillFilesPayload as a, buildSkillManifest as o, buildSkillManifestForSubmit as s, buildSkillManifestFromFrontmatter as c, getSkillFieldLengthViolations as l, isValidSkillRelativePath as u, nameFromPath as d, normalizeSkillName as f, parseSkillManifest as p, skillFileBytesToBlob as m, startsWithFrontmatterBlock as h, unpackSkillArchive as g } from "./skill/skill.js";
|
|
2
|
+
import { parseSkillManifestDocument as _ } from "./skill/skill-manifest.js";
|
|
3
|
+
import { validateSkillFileBatch as v } from "./skill/skill-file-batch-validation.js";
|
|
4
|
+
import { skillFileToAttachment as y } from "./skill/skill-file-preview.js";
|
|
5
|
+
import { SkillEditorLoadState as b, useSkillEditorLoad as x } from "./skill/useSkillEditorLoad.js";
|
|
6
|
+
import { useSkillEditorSubmit as S } from "./skill/useSkillEditorSubmit.js";
|
|
7
|
+
import { useSkillFileActions as C } from "./skill/useSkillFileActions.js";
|
|
8
|
+
import { SkillArchiveImportErrorKind as w, SkillArchiveImportStatus as T, SkillArchiveSelectionRejectionReason as E, classifySkillArchiveImportError as D, useSkillArchiveImport as O } from "./skill/useSkillArchiveImport/useSkillArchiveImport.js";
|
|
9
|
+
export { e as SKILL_FILE_UPLOAD_MAX_BYTES, t as SKILL_MANIFEST_FILE, n as SKILL_TEXT_FIELD_MAX_LENGTHS, r as SKILL_UPLOAD_MAX_FILES, i as SKILL_UPLOAD_MAX_TOTAL_BYTES, w as SkillArchiveImportErrorKind, T as SkillArchiveImportStatus, E as SkillArchiveSelectionRejectionReason, b as SkillEditorLoadState, a as buildSkillFilesPayload, o as buildSkillManifest, s as buildSkillManifestForSubmit, c as buildSkillManifestFromFrontmatter, D as classifySkillArchiveImportError, l as getSkillFieldLengthViolations, u as isValidSkillRelativePath, d as nameFromPath, f as normalizeSkillName, p as parseSkillManifest, _ as parseSkillManifestDocument, m as skillFileBytesToBlob, y as skillFileToAttachment, h as startsWithFrontmatterBlock, g as unpackSkillArchive, O as useSkillArchiveImport, x as useSkillEditorLoad, S as useSkillEditorSubmit, C as useSkillFileActions, v as validateSkillFileBatch };
|