@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,195 +1,227 @@
|
|
|
1
1
|
import { safeDecodeURI as e } from "../../shared/string-utils.js";
|
|
2
|
-
import { DEFAULT_GENERATION_CONFLICT_MESSAGE as t, DEFAULT_GENERATION_PERSISTENCE_ERROR_MESSAGE as n, GenerationConflictError as r, GenerationPersistenceError as i,
|
|
3
|
-
import { getConversationPath as
|
|
4
|
-
import { applyChunkToMessages as
|
|
5
|
-
import { restoreBufferedMessage as
|
|
6
|
-
import { createResumeIfAwaitingGeneration as
|
|
7
|
-
import { generateUUID as
|
|
8
|
-
import { useCallback as
|
|
9
|
-
import { SendCompletionDtoModeEnum as
|
|
2
|
+
import { DEFAULT_GENERATION_CONFLICT_MESSAGE as t, DEFAULT_GENERATION_PERSISTENCE_ERROR_MESSAGE as n, GenerationConflictError as r, GenerationPersistenceError as i, StreamInterruptedError as a, StreamUpstreamError as o } from "../create-chat-stream-api.js";
|
|
3
|
+
import { getConversationPath as s } from "./conversation-path.js";
|
|
4
|
+
import { applyChunkToMessages as c } from "./apply-chunk.js";
|
|
5
|
+
import { restoreBufferedMessage as l } from "./buffered-generation.js";
|
|
6
|
+
import { createResumeIfAwaitingGeneration as u, fetchConversationForRecovery as d, hasGeneratedPayload as f, isAwaitingGenerationResume as p } from "./generation-resume.js";
|
|
7
|
+
import { MessageRole as m, generateUUID as h } from "@epam/ai-dial-chat-shared";
|
|
8
|
+
import { useCallback as g, useEffect as _, useMemo as v, useRef as y, useState as b } from "react";
|
|
9
|
+
import { SendCompletionDtoModeEnum as x } from "@epam/ai-dial-chat-api-client";
|
|
10
10
|
//#region src/conversation/useConversationStream/useConversationStream.ts
|
|
11
|
-
var
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}, [
|
|
16
|
-
let [
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
var S = 2e4, ee = (e, t, n) => e instanceof i ? n : e instanceof r ? t : e instanceof o ? e.message : "", C = ({ conversationId: r, state: { setConversation: o, conversationRef: C }, transport: w, generation: { startGeneration: T, completeGeneration: E }, channel: D, overlay: O, onStopError: k, generationConflictMessage: A = t, generationPersistenceErrorMessage: j = n, onStreamError: M }) => {
|
|
12
|
+
let N = y(M);
|
|
13
|
+
_(() => {
|
|
14
|
+
N.current = M;
|
|
15
|
+
}, [M]);
|
|
16
|
+
let [P, F] = b(() => /* @__PURE__ */ new Set()), [I, L] = b(null), R = y(null), z = y(null), B = y(/* @__PURE__ */ new Set()), V = y(/* @__PURE__ */ new Map()), H = y(/* @__PURE__ */ new Set()), U = y(/* @__PURE__ */ new Map()), W = y(r);
|
|
17
|
+
_(() => {
|
|
18
|
+
W.current = r;
|
|
19
19
|
}, [r]);
|
|
20
|
-
let
|
|
21
|
-
|
|
20
|
+
let G = g((e) => s(W.current ?? "") === e, []), K = g((e) => {
|
|
21
|
+
F((t) => {
|
|
22
22
|
if (t.has(e)) return t;
|
|
23
23
|
let n = new Set(t);
|
|
24
24
|
return n.add(e), n;
|
|
25
25
|
});
|
|
26
|
-
}, []),
|
|
27
|
-
|
|
26
|
+
}, []), q = g((e) => {
|
|
27
|
+
F((t) => {
|
|
28
28
|
if (!t.has(e)) return t;
|
|
29
29
|
let n = new Set(t);
|
|
30
30
|
return n.delete(e), n;
|
|
31
31
|
});
|
|
32
|
-
}, []),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
}, []), J = v(() => u({
|
|
33
|
+
transport: w,
|
|
34
|
+
setConversation: o,
|
|
35
|
+
conversationRef: C,
|
|
36
|
+
resumingPathsRef: B,
|
|
37
|
+
bufferedGenerationsRef: V,
|
|
38
|
+
addStreamingPath: K,
|
|
39
|
+
removeStreamingPath: q,
|
|
40
|
+
isPathDisplayed: G,
|
|
41
|
+
generationPersistenceErrorMessage: j
|
|
42
|
+
}), [
|
|
43
|
+
K,
|
|
44
|
+
q,
|
|
45
|
+
G,
|
|
46
|
+
w,
|
|
47
|
+
j
|
|
48
|
+
]), Y = g((t, n, r, u, g, _, v = x.Append) => {
|
|
49
|
+
let y = _ ?? h(), b = s(t);
|
|
50
|
+
B.current.delete(b), R.current = y, z.current = b, U.current.set(b, y), L(b);
|
|
51
|
+
let k;
|
|
52
|
+
v === x.Regenerate ? k = r : v === x.Edit && (k = r - 1);
|
|
53
|
+
let M = () => U.current.get(b) !== y, P = T(b, y), F = C.current?.messages[r];
|
|
54
|
+
F ? V.current.set(b, {
|
|
55
|
+
generationId: y,
|
|
40
56
|
messageIndex: r,
|
|
41
|
-
message:
|
|
42
|
-
}) :
|
|
43
|
-
let
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
57
|
+
message: F
|
|
58
|
+
}) : V.current.delete(b), K(b), O?.notifyGenerationStart?.(), D?.ensureConnected();
|
|
59
|
+
let I = () => {
|
|
60
|
+
M() || q(b), R.current === y && (R.current = null, z.current = null, L(null)), E(b, y), D?.notifyGenerationSettled?.();
|
|
61
|
+
}, W = () => {
|
|
62
|
+
if (M()) return;
|
|
63
|
+
let e = V.current.get(b);
|
|
64
|
+
!e || e.generationId !== y || (e.message = {
|
|
47
65
|
...e.message,
|
|
48
|
-
streamErrorMessage:
|
|
49
|
-
},
|
|
50
|
-
if (!t ||
|
|
51
|
-
let n =
|
|
52
|
-
return
|
|
66
|
+
streamErrorMessage: j
|
|
67
|
+
}, N.current?.(new i()), G(b) && o((t) => {
|
|
68
|
+
if (!t || M() || !G(b)) return t;
|
|
69
|
+
let n = l(t, e);
|
|
70
|
+
return C.current = n, n;
|
|
53
71
|
}));
|
|
54
|
-
},
|
|
55
|
-
signal:
|
|
72
|
+
}, Y = {
|
|
73
|
+
signal: P.signal,
|
|
56
74
|
onChunk: (e) => {
|
|
57
|
-
if (
|
|
58
|
-
let t =
|
|
59
|
-
if (t?.generationId ===
|
|
60
|
-
let n =
|
|
75
|
+
if (R.current !== y) return;
|
|
76
|
+
let t = V.current.get(b);
|
|
77
|
+
if (t?.generationId === y) {
|
|
78
|
+
let n = c([t.message], 0, e);
|
|
61
79
|
n && (t.message = n[0]);
|
|
62
80
|
}
|
|
63
|
-
|
|
81
|
+
G(b) && o((t) => {
|
|
64
82
|
if (!t) return t;
|
|
65
|
-
let n =
|
|
66
|
-
if (n?.generationId ===
|
|
83
|
+
let n = V.current.get(b), i;
|
|
84
|
+
if (n?.generationId === y) i = l(t, n);
|
|
67
85
|
else {
|
|
68
|
-
let n =
|
|
86
|
+
let n = c(t.messages, r, e);
|
|
69
87
|
if (!n) return t;
|
|
70
88
|
i = {
|
|
71
89
|
...t,
|
|
72
90
|
messages: n
|
|
73
91
|
};
|
|
74
92
|
}
|
|
75
|
-
return
|
|
93
|
+
return C.current = i, i;
|
|
76
94
|
});
|
|
77
95
|
},
|
|
78
96
|
onComplete: async () => {
|
|
79
|
-
let n =
|
|
80
|
-
if (
|
|
81
|
-
if (!
|
|
82
|
-
r &&
|
|
97
|
+
let n = V.current.get(b), r = n?.generationId === y ? n : void 0;
|
|
98
|
+
if (I(), H.current.has(y) ? H.current.delete(y) : M() || O?.notifyGenerationEnd?.(), !M()) {
|
|
99
|
+
if (!G(b)) {
|
|
100
|
+
r && V.current.delete(b);
|
|
83
101
|
return;
|
|
84
102
|
}
|
|
85
103
|
try {
|
|
86
|
-
let n = await
|
|
87
|
-
if (
|
|
88
|
-
if (!
|
|
89
|
-
r &&
|
|
104
|
+
let n = await w.getConversation(e(t));
|
|
105
|
+
if (M()) return;
|
|
106
|
+
if (!G(b)) {
|
|
107
|
+
r && V.current.delete(b);
|
|
90
108
|
return;
|
|
91
109
|
}
|
|
92
|
-
if (r && r.messageIndex === n.messages.length - 1 &&
|
|
93
|
-
|
|
110
|
+
if (r && r.messageIndex === n.messages.length - 1 && p(n) && f(r.message)) {
|
|
111
|
+
W();
|
|
94
112
|
return;
|
|
95
113
|
}
|
|
96
|
-
r &&
|
|
114
|
+
r && V.current.delete(b), o(n), C.current = n;
|
|
97
115
|
} catch {
|
|
98
|
-
|
|
116
|
+
M() || W();
|
|
99
117
|
}
|
|
100
118
|
}
|
|
101
119
|
},
|
|
102
120
|
onError: (e) => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
if (N.current?.(e), e instanceof a && !M()) {
|
|
122
|
+
Q(e);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
X(e);
|
|
126
|
+
}
|
|
127
|
+
}, X = (e) => {
|
|
128
|
+
let t = V.current.get(b), n = t?.generationId === y ? t : void 0;
|
|
129
|
+
if (n && (e instanceof i ? n.message = {
|
|
130
|
+
...n.message,
|
|
131
|
+
streamErrorMessage: j
|
|
132
|
+
} : V.current.delete(b)), I(), M() || !G(b)) return;
|
|
133
|
+
let a = ee(e, A, j);
|
|
134
|
+
o((e) => {
|
|
135
|
+
if (!e || M() || !G(b)) return e;
|
|
136
|
+
let t = n?.generationId === y ? l(e, n) : e, i = {
|
|
137
|
+
...t,
|
|
138
|
+
messages: t.messages.map((e, t) => t === r ? {
|
|
139
|
+
...e,
|
|
140
|
+
streamErrorMessage: a
|
|
141
|
+
} : e)
|
|
142
|
+
};
|
|
143
|
+
return C.current = i, i;
|
|
144
|
+
});
|
|
145
|
+
}, Z = () => {
|
|
146
|
+
I(), H.current.has(y) ? H.current.delete(y) : M() || O?.notifyGenerationEnd?.();
|
|
147
|
+
}, Q = async (n) => {
|
|
148
|
+
B.current.add(b);
|
|
149
|
+
let i = await d(() => w.getConversation(e(t)), M);
|
|
150
|
+
if (M()) {
|
|
151
|
+
I();
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
let a = i?.messages[i.messages.length - 1], s = i != null && i.messages.length - 1 === r && a?.role === m.Assistant;
|
|
155
|
+
if (!i || !s) {
|
|
156
|
+
B.current.delete(b), X(n);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
let c = V.current.get(b), l = c?.generationId === y ? c : void 0;
|
|
160
|
+
if (p(i)) {
|
|
161
|
+
J(t, i, {
|
|
162
|
+
seedMessage: l?.message,
|
|
163
|
+
skipDedupe: !0,
|
|
164
|
+
onSettled: Z
|
|
120
165
|
});
|
|
166
|
+
return;
|
|
121
167
|
}
|
|
168
|
+
B.current.delete(b), l && V.current.delete(b), G(b) && (o(i), C.current = i), Z();
|
|
122
169
|
};
|
|
123
170
|
(async () => {
|
|
124
171
|
try {
|
|
125
|
-
let e =
|
|
126
|
-
if (
|
|
127
|
-
|
|
172
|
+
let e = D?.channelId ?? await D?.waitForChannel(S) ?? void 0, t = H.current.has(y);
|
|
173
|
+
if (P.signal.aborted || M() || t) {
|
|
174
|
+
V.current.get(b)?.generationId === y && V.current.delete(b), M() || q(b), R.current === y && (R.current = null, z.current = null, L(null)), E(b, y), D?.notifyGenerationSettled?.(), t ? H.current.delete(y) : M() || O?.notifyGenerationEnd?.();
|
|
128
175
|
return;
|
|
129
176
|
}
|
|
130
|
-
|
|
177
|
+
w.streamCompletion(b, n, u, Y, g, y, v, k, e);
|
|
131
178
|
} catch (e) {
|
|
132
|
-
|
|
179
|
+
Y.onError(e instanceof Error ? e : Error(String(e)));
|
|
133
180
|
}
|
|
134
181
|
})();
|
|
135
182
|
}, [
|
|
136
|
-
|
|
137
|
-
w,
|
|
138
|
-
W,
|
|
139
|
-
G,
|
|
140
|
-
U,
|
|
141
|
-
T?.channelId,
|
|
142
|
-
T?.ensureConnected,
|
|
143
|
-
T?.waitForChannel,
|
|
144
|
-
T?.notifyGenerationSettled,
|
|
183
|
+
T,
|
|
145
184
|
E,
|
|
146
|
-
|
|
185
|
+
K,
|
|
186
|
+
q,
|
|
187
|
+
G,
|
|
188
|
+
D?.channelId,
|
|
189
|
+
D?.ensureConnected,
|
|
190
|
+
D?.waitForChannel,
|
|
191
|
+
D?.notifyGenerationSettled,
|
|
147
192
|
O,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
let e =
|
|
193
|
+
w,
|
|
194
|
+
J,
|
|
195
|
+
A,
|
|
196
|
+
j
|
|
197
|
+
]), X = g((e, t) => {
|
|
198
|
+
let n = s(e), r = V.current.get(n);
|
|
199
|
+
return r ? l(t, r) : t;
|
|
200
|
+
}, []), Z = g(() => {
|
|
201
|
+
let e = R.current;
|
|
154
202
|
if (!e || !r) return;
|
|
155
|
-
let t =
|
|
156
|
-
|
|
203
|
+
let t = s(r);
|
|
204
|
+
z.current === t && (H.current.add(e), O?.notifyStopGenerating?.(), w.stopCompletion({
|
|
157
205
|
generationId: e,
|
|
158
206
|
path: t
|
|
159
207
|
}).catch((e) => {
|
|
160
208
|
let t = e instanceof Error ? e : Error(String(e));
|
|
161
|
-
|
|
209
|
+
k?.(t);
|
|
162
210
|
}));
|
|
163
211
|
}, [
|
|
164
212
|
r,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
]),
|
|
169
|
-
transport: S,
|
|
170
|
-
setConversation: a,
|
|
171
|
-
conversationRef: x,
|
|
172
|
-
resumingPathsRef: R,
|
|
173
|
-
bufferedGenerationsRef: z,
|
|
174
|
-
addStreamingPath: W,
|
|
175
|
-
removeStreamingPath: G,
|
|
176
|
-
isPathDisplayed: U,
|
|
177
|
-
generationPersistenceErrorMessage: k
|
|
178
|
-
}), [
|
|
179
|
-
W,
|
|
180
|
-
G,
|
|
181
|
-
U,
|
|
182
|
-
S,
|
|
183
|
-
k
|
|
184
|
-
]), X = r != null && M.has(o(r)), Z = r == null ? null : o(r);
|
|
213
|
+
k,
|
|
214
|
+
O,
|
|
215
|
+
w
|
|
216
|
+
]), Q = g((e, t) => J(e, t), [J]), te = r != null && P.has(s(r)), $ = r == null ? null : s(r);
|
|
185
217
|
return {
|
|
186
|
-
startStream:
|
|
187
|
-
handleStop:
|
|
188
|
-
resumeIfAwaitingGeneration:
|
|
189
|
-
restoreBufferedGeneration:
|
|
190
|
-
isStreaming:
|
|
191
|
-
canStopStreaming:
|
|
218
|
+
startStream: Y,
|
|
219
|
+
handleStop: Z,
|
|
220
|
+
resumeIfAwaitingGeneration: Q,
|
|
221
|
+
restoreBufferedGeneration: X,
|
|
222
|
+
isStreaming: te,
|
|
223
|
+
canStopStreaming: $ != null && I === $
|
|
192
224
|
};
|
|
193
225
|
};
|
|
194
226
|
//#endregion
|
|
195
|
-
export {
|
|
227
|
+
export { C as useConversationStream };
|
package/conversation.d.ts
CHANGED
|
@@ -347,6 +347,12 @@ export declare interface CreateChatStreamApiDeps {
|
|
|
347
347
|
getTimezone?: () => string | undefined;
|
|
348
348
|
/** `fetch` implementation to issue requests through. Defaults to the global `fetch`. */
|
|
349
349
|
fetchImpl?: typeof fetch;
|
|
350
|
+
/**
|
|
351
|
+
* How long an open completion stream may go without receiving a byte
|
|
352
|
+
* (keepalive comments included) before it is reported as a
|
|
353
|
+
* {@link StreamInterruptedError}. Defaults to {@link DEFAULT_STREAM_IDLE_TIMEOUT_MS}.
|
|
354
|
+
*/
|
|
355
|
+
idleTimeoutMs?: number;
|
|
350
356
|
}
|
|
351
357
|
|
|
352
358
|
/**
|
|
@@ -364,6 +370,8 @@ export declare const DEFAULT_GENERATION_CONFLICT_MESSAGE = "A response is alread
|
|
|
364
370
|
/** Safe fallback for hosts that do not supply a translated persistence warning. */
|
|
365
371
|
export declare const DEFAULT_GENERATION_PERSISTENCE_ERROR_MESSAGE = "The response could not be saved. It is still shown here, but may be lost if you reload or leave this page. Copy it before continuing.";
|
|
366
372
|
|
|
373
|
+
export declare const DEFAULT_STREAM_IDLE_TIMEOUT_MS = 45000;
|
|
374
|
+
|
|
367
375
|
/**
|
|
368
376
|
* Derives the row-action visibility state for a single conversation item.
|
|
369
377
|
*
|
|
@@ -784,6 +792,18 @@ export declare interface StreamCompletionOptions {
|
|
|
784
792
|
signal: AbortSignal;
|
|
785
793
|
}
|
|
786
794
|
|
|
795
|
+
/**
|
|
796
|
+
* Reported through `onError` when the network connection carrying a
|
|
797
|
+
* completion stream is lost (a rejected `fetch`, or a read that fails after a
|
|
798
|
+
* 2xx response) or goes silent past the idle timeout — what a laptop sleep or
|
|
799
|
+
* a phone lock mid-generation produces. The backend-owned generation may
|
|
800
|
+
* still be running, so the caller can recover it rather than treat the
|
|
801
|
+
* response as failed. `cause` holds the original error, when there is one.
|
|
802
|
+
*/
|
|
803
|
+
export declare class StreamInterruptedError extends Error {
|
|
804
|
+
constructor(cause?: unknown);
|
|
805
|
+
}
|
|
806
|
+
|
|
787
807
|
/**
|
|
788
808
|
* Reported through `onError` when DIAL Core itself signals a failure with an
|
|
789
809
|
* in-band `{ error: { message } }` SSE chunk. Its `message` is upstream text
|
package/conversation.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { buildAnnouncementSignature as e, hasAnnouncementContent as t, hasStructuredAnnouncement as n, sanitizeAnnouncementHtml as r, sanitizeAnnouncementMessageHtml as i } from "./conversation/announcement-message.js";
|
|
2
|
-
import { DEFAULT_GENERATION_CONFLICT_MESSAGE as a, DEFAULT_GENERATION_PERSISTENCE_ERROR_MESSAGE as o,
|
|
3
|
-
import { shouldWatchForDisplayNameUpdate as
|
|
4
|
-
import { formatAppVersion as
|
|
5
|
-
import { getModelIdFromConversationId as
|
|
6
|
-
import { getTimeOfDayGreeting as
|
|
7
|
-
import { createDeploymentChangedMessage as
|
|
8
|
-
import { getLastDeploymentId as
|
|
9
|
-
import { getQuickAppConversationStarters as
|
|
10
|
-
import { mapStages as
|
|
11
|
-
import { getStarterPopulateText as
|
|
12
|
-
import { deriveConversationRowActionState as
|
|
13
|
-
import { useActiveConversationSync as
|
|
14
|
-
import { useAsyncConfirmDialog as
|
|
15
|
-
import { useConversationLookupMaps as
|
|
16
|
-
import { getConversationSource as
|
|
17
|
-
import { useImportFilePicker as
|
|
18
|
-
import { useMessageSelectionReply as
|
|
19
|
-
import { useAttachmentUpload as
|
|
20
|
-
import { AudioTranscriptionError as
|
|
21
|
-
import { useTranscribeAudio as
|
|
22
|
-
import { attachmentToDto as
|
|
23
|
-
import { createMessagePair as
|
|
24
|
-
import { hasActiveToolConfig as
|
|
25
|
-
import { getStarterConversationText as
|
|
26
|
-
import { getConversationPath as
|
|
27
|
-
import { useConversationHandlers as
|
|
28
|
-
import { applyChunkToMessages as
|
|
29
|
-
import { isAwaitingGenerationResume as
|
|
30
|
-
import { useConversationStream as
|
|
31
|
-
import { useChatSettingsFormConfig as
|
|
32
|
-
import { useToolsMenu as
|
|
33
|
-
export {
|
|
2
|
+
import { DEFAULT_GENERATION_CONFLICT_MESSAGE as a, DEFAULT_GENERATION_PERSISTENCE_ERROR_MESSAGE as o, DEFAULT_STREAM_IDLE_TIMEOUT_MS as s, GenerationConflictError as c, GenerationPersistenceError as l, StreamInterruptedError as u, StreamUpstreamError as d, createChatStreamApi as f } from "./conversation/create-chat-stream-api.js";
|
|
3
|
+
import { shouldWatchForDisplayNameUpdate as p } from "./conversation/display-name-watch.js";
|
|
4
|
+
import { formatAppVersion as m, sanitizeFooterHtml as h } from "./conversation/footer-message.js";
|
|
5
|
+
import { getModelIdFromConversationId as g } from "./conversation/get-model-id-from-conversation-id.js";
|
|
6
|
+
import { getTimeOfDayGreeting as _ } from "./conversation/greeting.js";
|
|
7
|
+
import { createDeploymentChangedMessage as v } from "./conversation/message-factory.js";
|
|
8
|
+
import { getLastDeploymentId as y, getLastUserMessageToolConfiguration as b, isMessageStreaming as x, messageHasStages as S, normalizeResponseFormat as C } from "./conversation/message-utils.js";
|
|
9
|
+
import { getQuickAppConversationStarters as w } from "./conversation/quick-app-conversation-starters.js";
|
|
10
|
+
import { mapStages as T, toStage as E } from "./conversation/stage.js";
|
|
11
|
+
import { getStarterPopulateText as D, getStartersFromSchema as O } from "./conversation/starter-option.js";
|
|
12
|
+
import { deriveConversationRowActionState as k } from "./conversation/deriveConversationRowActionState/deriveConversationRowActionState.js";
|
|
13
|
+
import { useActiveConversationSync as A } from "./conversation/useActiveConversationSync/useActiveConversationSync.js";
|
|
14
|
+
import { useAsyncConfirmDialog as j } from "./conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.js";
|
|
15
|
+
import { useConversationLookupMaps as M } from "./conversation/useConversationLookupMaps/useConversationLookupMaps.js";
|
|
16
|
+
import { getConversationSource as N, useConversationPanelItems as P } from "./conversation/useConversationPanelItems/useConversationPanelItems.js";
|
|
17
|
+
import { useImportFilePicker as F } from "./conversation/useImportFilePicker/useImportFilePicker.js";
|
|
18
|
+
import { useMessageSelectionReply as I } from "./conversation/useMessageSelectionReply/useMessageSelectionReply.js";
|
|
19
|
+
import { useAttachmentUpload as L } from "./conversation/useAttachmentUpload/useAttachmentUpload.js";
|
|
20
|
+
import { AudioTranscriptionError as R, AudioTranscriptionErrorReason as z } from "./conversation/useTranscribeAudio/audio-transcription-error.js";
|
|
21
|
+
import { useTranscribeAudio as B } from "./conversation/useTranscribeAudio/useTranscribeAudio.js";
|
|
22
|
+
import { attachmentToDto as V, attachmentsToDtos as H } from "./conversation/useConversationHandlers/attachment-to-dto.js";
|
|
23
|
+
import { createMessagePair as U } from "./conversation/useConversationHandlers/message-factory.js";
|
|
24
|
+
import { hasActiveToolConfig as W, isAnswerIncomplete as G, isMessageChanged as K, shouldRerunGenerationOnEdit as q } from "./conversation/useConversationHandlers/message-utils.js";
|
|
25
|
+
import { getStarterConversationText as J, getStarterDisplayText as Y, getStarterSubmitText as X } from "./conversation/useConversationHandlers/starter-option.js";
|
|
26
|
+
import { getConversationPath as Z } from "./conversation/useConversationStream/conversation-path.js";
|
|
27
|
+
import { useConversationHandlers as Q } from "./conversation/useConversationHandlers/useConversationHandlers.js";
|
|
28
|
+
import { applyChunkToMessages as $, mergeStages as ee } from "./conversation/useConversationStream/apply-chunk.js";
|
|
29
|
+
import { isAwaitingGenerationResume as te } from "./conversation/useConversationStream/generation-resume.js";
|
|
30
|
+
import { useConversationStream as ne } from "./conversation/useConversationStream/useConversationStream.js";
|
|
31
|
+
import { useChatSettingsFormConfig as re } from "./useChatSettingsFormConfig/useChatSettingsFormConfig.js";
|
|
32
|
+
import { useToolsMenu as ie } from "./useToolsMenu/useToolsMenu.js";
|
|
33
|
+
export { R as AudioTranscriptionError, z as AudioTranscriptionErrorReason, a as DEFAULT_GENERATION_CONFLICT_MESSAGE, o as DEFAULT_GENERATION_PERSISTENCE_ERROR_MESSAGE, s as DEFAULT_STREAM_IDLE_TIMEOUT_MS, c as GenerationConflictError, l as GenerationPersistenceError, u as StreamInterruptedError, d as StreamUpstreamError, $ as applyChunkToMessages, V as attachmentToDto, H as attachmentsToDtos, e as buildAnnouncementSignature, f as createChatStreamApi, v as createDeploymentChangedMessage, U as createMessagePair, k as deriveConversationRowActionState, m as formatAppVersion, Z as getConversationPath, N as getConversationSource, y as getLastDeploymentId, b as getLastUserMessageToolConfiguration, g as getModelIdFromConversationId, w as getQuickAppConversationStarters, J as getStarterConversationText, Y as getStarterDisplayText, D as getStarterPopulateText, X as getStarterSubmitText, O as getStartersFromSchema, _ as getTimeOfDayGreeting, W as hasActiveToolConfig, t as hasAnnouncementContent, n as hasStructuredAnnouncement, G as isAnswerIncomplete, te as isAwaitingGenerationResume, K as isMessageChanged, x as isMessageStreaming, T as mapStages, ee as mergeStages, S as messageHasStages, C as normalizeResponseFormat, r as sanitizeAnnouncementHtml, i as sanitizeAnnouncementMessageHtml, h as sanitizeFooterHtml, q as shouldRerunGenerationOnEdit, p as shouldWatchForDisplayNameUpdate, E as toStage, A as useActiveConversationSync, j as useAsyncConfirmDialog, L as useAttachmentUpload, re as useChatSettingsFormConfig, Q as useConversationHandlers, M as useConversationLookupMaps, P as useConversationPanelItems, ne as useConversationStream, F as useImportFilePicker, I as useMessageSelectionReply, ie as useToolsMenu, B as useTranscribeAudio };
|
package/file-manager.d.ts
CHANGED
|
@@ -365,8 +365,6 @@ export declare type FileNameValidationError = {
|
|
|
365
365
|
} | {
|
|
366
366
|
reason: FileNameValidationErrorReason.DuplicateName;
|
|
367
367
|
existingName: string;
|
|
368
|
-
} | {
|
|
369
|
-
reason: FileNameValidationErrorReason.LeadingDot;
|
|
370
368
|
};
|
|
371
369
|
|
|
372
370
|
/**
|
|
@@ -379,8 +377,7 @@ export declare enum FileNameValidationErrorReason {
|
|
|
379
377
|
ForbiddenSymbols = "forbiddenSymbols",
|
|
380
378
|
ReservedName = "reservedName",
|
|
381
379
|
TooLong = "tooLong",
|
|
382
|
-
DuplicateName = "duplicateName"
|
|
383
|
-
LeadingDot = "leadingDot"
|
|
380
|
+
DuplicateName = "duplicateName"
|
|
384
381
|
}
|
|
385
382
|
|
|
386
383
|
/**
|
|
@@ -397,7 +394,10 @@ export declare enum FileOperationKind {
|
|
|
397
394
|
FileCopied = "fileCopied",
|
|
398
395
|
FilesCopied = "filesCopied",
|
|
399
396
|
FileMoved = "fileMoved",
|
|
400
|
-
FilesMoved = "filesMoved"
|
|
397
|
+
FilesMoved = "filesMoved",
|
|
398
|
+
/** A copy whose every item landed in its own source folder (Duplicate). */
|
|
399
|
+
FileDuplicated = "fileDuplicated",
|
|
400
|
+
FilesDuplicated = "filesDuplicated"
|
|
401
401
|
}
|
|
402
402
|
|
|
403
403
|
/**
|
|
@@ -412,13 +412,15 @@ export declare interface FileOperationSuccessEvent {
|
|
|
412
412
|
name?: string;
|
|
413
413
|
/** Number of items the operation covered, when applicable. */
|
|
414
414
|
count?: number;
|
|
415
|
-
/**
|
|
415
|
+
/**
|
|
416
|
+
* Destination folder as a slash-joined virtual path starting at the root
|
|
417
|
+
* label (e.g. `My files/reports`), for copy/move/duplicate operations.
|
|
418
|
+
*/
|
|
416
419
|
destinationFolderName?: string;
|
|
417
420
|
/**
|
|
418
|
-
* Whether the affected item is a folder rather than a file.
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
* "File renamed").
|
|
421
|
+
* Whether the affected item is a folder rather than a file. Set for rename,
|
|
422
|
+
* copy, move, and duplicate events; on a multi-item event it describes the
|
|
423
|
+
* first successfully affected item (the one `name` refers to).
|
|
422
424
|
*/
|
|
423
425
|
isFolder?: boolean;
|
|
424
426
|
}
|
|
@@ -662,7 +664,7 @@ export declare const splitFileNameExtension: (fileName: string) => {
|
|
|
662
664
|
|
|
663
665
|
export declare const trimFileNameToByteLimit: (name: string, limit?: number) => string;
|
|
664
666
|
|
|
665
|
-
export declare const updateEntry: (prev: FileUploadBatchState | null,
|
|
667
|
+
export declare const updateEntry: (prev: FileUploadBatchState | null, id: string, patch: FileUploadStatus | Partial<Pick<FileUploadEntry, "status" | "percent">>) => FileUploadBatchState | null;
|
|
666
668
|
|
|
667
669
|
/** Max number of files uploaded concurrently within a single upload batch. */
|
|
668
670
|
export declare const UPLOAD_CONCURRENCY = 3;
|
|
@@ -857,7 +859,9 @@ export declare interface UseDialFileManagerResult {
|
|
|
857
859
|
uploadBatchState: FileUploadBatchState | null;
|
|
858
860
|
/** Upload: abort all in-flight and queued uploads. */
|
|
859
861
|
cancelUpload: () => void;
|
|
860
|
-
/** Upload:
|
|
862
|
+
/** Upload: abort one queued or in-flight upload by its entry id. */
|
|
863
|
+
cancelUploadFile: (id: string) => void;
|
|
864
|
+
/** Upload: empty the upload queue. */
|
|
861
865
|
clearUploadBatch: () => void;
|
|
862
866
|
/** Folder creation: called when user confirms a new folder name. */
|
|
863
867
|
onCreateFolder: (file: DialUploadFileItem, folderPath: string, fileId: string) => Promise<void>;
|
|
@@ -924,7 +928,7 @@ export declare interface UseDialFileManagerResult {
|
|
|
924
928
|
/**
|
|
925
929
|
* True while any mutating file-manager operation is in flight: the OR of
|
|
926
930
|
* `isCreatingFolder`, `isDownloading`, `isDeleting`, `isRenaming`, `isCopying`,
|
|
927
|
-
* `isMoving`, `isUnsharing`, `isRemovingAccess`, and
|
|
931
|
+
* `isMoving`, `isUnsharing`, `isRemovingAccess`, and any upload still queued or running.
|
|
928
932
|
*
|
|
929
933
|
* Deliberately excludes three flags, each already fully contained by its own
|
|
930
934
|
* scoped loading UI:
|
|
@@ -1070,10 +1074,11 @@ export declare interface UseDialFileSharingResult {
|
|
|
1070
1074
|
|
|
1071
1075
|
/**
|
|
1072
1076
|
* Manages upload batches (single-file and ZIP-archive extraction), including
|
|
1073
|
-
* concurrency-limited progress tracking and abort.
|
|
1074
|
-
*
|
|
1075
|
-
* `
|
|
1076
|
-
* cache
|
|
1077
|
+
* concurrency-limited progress tracking and per-file abort. A batch started
|
|
1078
|
+
* while another is on screen is appended to it, and settled entries stay in
|
|
1079
|
+
* `uploadBatchState` until `clearUploadBatch`. Invalidates the shared listing
|
|
1080
|
+
* cache for the destination folder through `invalidateFolders`/`bumpRetry`
|
|
1081
|
+
* after a batch settles — it never holds its own copy of the cache.
|
|
1077
1082
|
*/
|
|
1078
1083
|
export declare const useDialFileUploadBatch: ({ filesApi, bucket, rootLabel, activeTab, cache, sharedRootMetaRef, invalidateFolders, bumpRetry, onNotification, }: UseDialFileUploadBatchOptions) => UseDialFileUploadBatchResult;
|
|
1079
1084
|
|
|
@@ -1106,6 +1111,7 @@ export declare interface UseDialFileUploadBatchResult {
|
|
|
1106
1111
|
onValidateUpload: (files: DialUploadFileItem[], existingFiles: DialFile[], destinationFolder: string) => Promise<FileUploadValidationResult>;
|
|
1107
1112
|
uploadBatchState: FileUploadBatchState | null;
|
|
1108
1113
|
cancelUpload: () => void;
|
|
1114
|
+
cancelUploadFile: (id: string) => void;
|
|
1109
1115
|
clearUploadBatch: () => void;
|
|
1110
1116
|
}
|
|
1111
1117
|
|
|
@@ -50,7 +50,7 @@ var o = (t) => {
|
|
|
50
50
|
return o.some((e) => e.name.toLowerCase() === n.name.toLowerCase()) || o.push(s), a.set(t, o), a;
|
|
51
51
|
}, u = (e, t, n) => {
|
|
52
52
|
if (!e) return e;
|
|
53
|
-
let r = typeof n == "string" ? { status: n } : n, i = e.files.map((e
|
|
53
|
+
let r = typeof n == "string" ? { status: n } : n, i = e.files.map((e) => e.id === t ? {
|
|
54
54
|
...e,
|
|
55
55
|
...r
|
|
56
56
|
} : e);
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
var e = /* @__PURE__ */ function(e) {
|
|
3
3
|
return e.FolderLoadFailed = "folderLoadFailed", e.MetadataLoadFailed = "metadataLoadFailed", e.FolderCreateFailed = "folderCreateFailed", e.DownloadFileFailed = "downloadFileFailed", e.DownloadFilesFailed = "downloadFilesFailed", e.FilesDeleted = "filesDeleted", e.FilesDeletePartiallyFailed = "filesDeletePartiallyFailed", e.DeleteFailed = "deleteFailed", e.RenameFailed = "renameFailed", e.RenamePartiallyFailed = "renamePartiallyFailed", e.MoveFailed = "moveFailed", e.MovePartiallyFailed = "movePartiallyFailed", e.CopyFailed = "copyFailed", e.CopyPartiallyFailed = "copyPartiallyFailed", e.UnshareFailed = "unshareFailed", e.RemoveAccessFailed = "removeAccessFailed", e.UploadFailed = "uploadFailed", e.UploadCompleted = "uploadCompleted", e.UploadArchiveFailed = "uploadArchiveFailed", e.UploadArchivePartiallyFailed = "uploadArchivePartiallyFailed", e.UploadArchiveRequestFailed = "uploadArchiveRequestFailed", e;
|
|
4
4
|
}({}), t = /* @__PURE__ */ function(e) {
|
|
5
|
-
return e.Empty = "empty", e.ForbiddenSymbols = "forbiddenSymbols", e.ReservedName = "reservedName", e.TooLong = "tooLong", e.DuplicateName = "duplicateName", e
|
|
5
|
+
return e.Empty = "empty", e.ForbiddenSymbols = "forbiddenSymbols", e.ReservedName = "reservedName", e.TooLong = "tooLong", e.DuplicateName = "duplicateName", e;
|
|
6
6
|
}({}), n = /* @__PURE__ */ function(e) {
|
|
7
|
-
return e.FolderCreated = "folderCreated", e.FileRenamed = "fileRenamed", e.FileDownloaded = "fileDownloaded", e.FilesDownloaded = "filesDownloaded", e.FileCopied = "fileCopied", e.FilesCopied = "filesCopied", e.FileMoved = "fileMoved", e.FilesMoved = "filesMoved", e;
|
|
7
|
+
return e.FolderCreated = "folderCreated", e.FileRenamed = "fileRenamed", e.FileDownloaded = "fileDownloaded", e.FilesDownloaded = "filesDownloaded", e.FileCopied = "fileCopied", e.FilesCopied = "filesCopied", e.FileMoved = "fileMoved", e.FilesMoved = "filesMoved", e.FileDuplicated = "fileDuplicated", e.FilesDuplicated = "filesDuplicated", e;
|
|
8
8
|
}({});
|
|
9
9
|
//#endregion
|
|
10
10
|
export { e as FileManagerNotificationReason, t as FileNameValidationErrorReason, n as FileOperationKind };
|