@burdenoff/fe-libs 2026.1005.4 → 2026.1006.2
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/dist/connections/ConnectionDialogPanel.d.ts.map +1 -1
- package/dist/connections/ConnectionDialogPanel.js +133 -126
- package/dist/connections/ConnectionFormTab.d.ts +2 -1
- package/dist/connections/ConnectionFormTab.d.ts.map +1 -1
- package/dist/connections/ConnectionFormTab.js +43 -42
- package/dist/connections/CredentialStorageSelector.d.ts +3 -1
- package/dist/connections/CredentialStorageSelector.d.ts.map +1 -1
- package/dist/connections/CredentialStorageSelector.js +73 -64
- package/dist/connections/connectionFlow.d.ts +4 -1
- package/dist/connections/connectionFlow.d.ts.map +1 -1
- package/dist/connections/connectionFlow.js +50 -18
- package/dist/connections/types.d.ts +3 -1
- package/dist/connections/types.d.ts.map +1 -1
- package/dist/shared/assistant/index.d.ts +3 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/speech/createSpeechEngine.d.ts.map +1 -1
- package/dist/shared/assistant/speech/createSpeechEngine.js +38 -37
- package/dist/shared/assistant/speech/notifyCancellationSpeechEngine.d.ts +4 -0
- package/dist/shared/assistant/speech/notifyCancellationSpeechEngine.d.ts.map +1 -0
- package/dist/shared/assistant/speech/notifyCancellationSpeechEngine.js +38 -0
- package/dist/shared/assistant/ui/WorkflowAssistantPanel.d.ts +14 -0
- package/dist/shared/assistant/ui/WorkflowAssistantPanel.d.ts.map +1 -0
- package/dist/shared/assistant/ui/WorkflowAssistantPanel.js +425 -0
- package/dist/shared/assistant/workflowApi.d.ts +100 -0
- package/dist/shared/assistant/workflowApi.d.ts.map +1 -0
- package/dist/shared/assistant/workflowApi.js +206 -0
- package/dist/shared-assistant.js +202 -199
- package/package.json +1 -1
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
import { useVoiceInput as e } from "../voice/useVoiceInput.js";
|
|
2
|
+
import { getSpeechEngine as t, subscribeSpeechEngine as n } from "../speech/createSpeechEngine.js";
|
|
3
|
+
import { chunkForSpeech as r, toSpeakableText as i } from "../voice/speakableText.js";
|
|
4
|
+
import { AssistantWorkflowClient as a, isWorkflowAssistantAdmissionRefusal as o } from "../workflowApi.js";
|
|
5
|
+
import { useCallback as s, useEffect as c, useRef as l, useState as u, useSyncExternalStore as ee } from "react";
|
|
6
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
7
|
+
//#region src/shared/assistant/ui/WorkflowAssistantPanel.tsx
|
|
8
|
+
function p(e) {
|
|
9
|
+
let t = e.target.kind === "botmanor" ? e.target.agentId : e.target.courseId;
|
|
10
|
+
return /* @__PURE__ */ d(m, { ...e }, `${e.context.workspaceId}:${e.ownerId}:${e.target.kind}:${t}`);
|
|
11
|
+
}
|
|
12
|
+
function m({ target: p, context: m, ownerId: h, title: g = "AI assistant", description: _, client: te, voiceLanguage: ne }) {
|
|
13
|
+
let v = l(te ?? new a()), y = l(crypto.randomUUID()), re = l({
|
|
14
|
+
target: p,
|
|
15
|
+
context: m,
|
|
16
|
+
ownerId: h
|
|
17
|
+
}), b = l(null), [x, S] = u(!0), [C, w] = u(!1), T = l(null), E = l(!1), D = l(!1), [O, k] = u(!1), [A, j] = u([]), [M, N] = u(""), [ie, P] = u(null), [F, I] = u(!1), [L, R] = u(null), [z, B] = u(!1), [V, H] = u(null), [U, W] = u(null), G = s((e) => {
|
|
18
|
+
if (P(null), I(!!e?.turns.length), !e) {
|
|
19
|
+
y.current = crypto.randomUUID(), j([]), H(null);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
y.current = e.clientConversationId;
|
|
23
|
+
let t = e.turns.map((t) => ({
|
|
24
|
+
input: {
|
|
25
|
+
clientTurnId: t.receipt.clientTurnId,
|
|
26
|
+
clientConversationId: e.clientConversationId,
|
|
27
|
+
message: t.message
|
|
28
|
+
},
|
|
29
|
+
receipt: t.receipt
|
|
30
|
+
}));
|
|
31
|
+
e.pending && t.push({
|
|
32
|
+
input: e.pending,
|
|
33
|
+
receipt: null
|
|
34
|
+
}), j(t), H(e.pending), e.pending && W("A saved turn is pending. Recover it to check the answer.");
|
|
35
|
+
}, []), K = s(async (e, t, n = null) => {
|
|
36
|
+
let r = new AbortController();
|
|
37
|
+
b.current?.abort(), b.current = r, S(!0), w(!1), W(null);
|
|
38
|
+
try {
|
|
39
|
+
let i = await v.current.conversation(e, {
|
|
40
|
+
...t,
|
|
41
|
+
signal: r.signal
|
|
42
|
+
}, n);
|
|
43
|
+
if (n !== null && i === null) throw Error("Conversation unavailable");
|
|
44
|
+
r.signal.aborted || G(i);
|
|
45
|
+
} catch {
|
|
46
|
+
r.signal.aborted || (w(!0), W("Your conversation is unavailable. Reload it before sending another question."));
|
|
47
|
+
} finally {
|
|
48
|
+
b.current === r && !r.signal.aborted && S(!1);
|
|
49
|
+
}
|
|
50
|
+
}, [G]);
|
|
51
|
+
c(() => {
|
|
52
|
+
let e = re.current;
|
|
53
|
+
return e.context.workspaceId && e.ownerId ? K(e.target, e.context) : S(!1), () => b.current?.abort();
|
|
54
|
+
}, [K]);
|
|
55
|
+
let q = async (e = null) => {
|
|
56
|
+
if (E.current || D.current || x || V || $.isActive) return;
|
|
57
|
+
let t = new AbortController();
|
|
58
|
+
b.current?.abort(), b.current = t, S(!0);
|
|
59
|
+
try {
|
|
60
|
+
let n = await v.current.conversations(p, {
|
|
61
|
+
...m,
|
|
62
|
+
signal: t.signal
|
|
63
|
+
}, e);
|
|
64
|
+
t.signal.aborted || R((t) => ({
|
|
65
|
+
nodes: e && t ? [...t.nodes, ...n.nodes.filter((e) => !t.nodes.some((t) => t.clientConversationId === e.clientConversationId))].slice(-100) : n.nodes,
|
|
66
|
+
nextCursor: n.nextCursor
|
|
67
|
+
}));
|
|
68
|
+
} catch {
|
|
69
|
+
t.signal.aborted || W("Conversation history is unavailable. Try loading it again.");
|
|
70
|
+
} finally {
|
|
71
|
+
!t.signal.aborted && b.current === t && S(!1);
|
|
72
|
+
}
|
|
73
|
+
}, ae = async () => {
|
|
74
|
+
if (E.current || D.current || x || V || $.isActive || !F || A.length >= 200) return;
|
|
75
|
+
let e = new AbortController();
|
|
76
|
+
b.current?.abort(), b.current = e;
|
|
77
|
+
let t = y.current;
|
|
78
|
+
S(!0);
|
|
79
|
+
try {
|
|
80
|
+
let n = await v.current.messages(p, {
|
|
81
|
+
...m,
|
|
82
|
+
signal: e.signal
|
|
83
|
+
}, t, ie);
|
|
84
|
+
!e.signal.aborted && t === y.current && (j((e) => [...n.turns.filter((t) => !e.some((e) => e.input.clientTurnId === t.receipt.clientTurnId)).map((e) => ({
|
|
85
|
+
input: {
|
|
86
|
+
clientTurnId: e.receipt.clientTurnId,
|
|
87
|
+
clientConversationId: t,
|
|
88
|
+
message: e.message
|
|
89
|
+
},
|
|
90
|
+
receipt: e.receipt
|
|
91
|
+
})), ...e]), P(n.nextCursor), I(n.nextCursor !== null));
|
|
92
|
+
} catch {
|
|
93
|
+
e.signal.aborted || W("Older messages are unavailable. Try loading them again.");
|
|
94
|
+
} finally {
|
|
95
|
+
!e.signal.aborted && b.current === e && S(!1);
|
|
96
|
+
}
|
|
97
|
+
}, J = l(null), Y = ee(n, t, t), X = l(!1), Z = l(0), [oe, Q] = u(!1), $ = e({
|
|
98
|
+
language: ne,
|
|
99
|
+
onFinalize: (e) => N((t) => `${t}${t.trim() ? " " : ""}${e}`.slice(0, 8192))
|
|
100
|
+
});
|
|
101
|
+
c(() => () => {
|
|
102
|
+
X.current && (Z.current += 1, X.current = !1, Y.cancel());
|
|
103
|
+
}, [Y]);
|
|
104
|
+
let se = (e) => {
|
|
105
|
+
if ($.isActive) return;
|
|
106
|
+
let t = ++Z.current;
|
|
107
|
+
X.current = !0, Q(!0), Y.speak(r(i(e)), {
|
|
108
|
+
voice: null,
|
|
109
|
+
lang: $.language
|
|
110
|
+
}, {
|
|
111
|
+
onEnd: () => {
|
|
112
|
+
t === Z.current && (X.current = !1, Q(!1));
|
|
113
|
+
},
|
|
114
|
+
onError: (e) => {
|
|
115
|
+
t === Z.current && (X.current = !1, Q(!1), e !== "cancelled" && W("Audio playback is unavailable. You can read the answer above."));
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}, ce = () => {
|
|
119
|
+
X.current && Y.cancel(), $.toggle();
|
|
120
|
+
};
|
|
121
|
+
c(() => () => T.current?.abort(), []), c(() => {
|
|
122
|
+
J.current?.scrollTo({
|
|
123
|
+
top: J.current.scrollHeight,
|
|
124
|
+
behavior: "smooth"
|
|
125
|
+
});
|
|
126
|
+
}, [A, z]);
|
|
127
|
+
let le = (e, t) => {
|
|
128
|
+
j((n) => n.map((n) => n.input.clientTurnId === e.clientTurnId ? {
|
|
129
|
+
...n,
|
|
130
|
+
receipt: t
|
|
131
|
+
} : n));
|
|
132
|
+
}, ue = async (e, t = !1) => {
|
|
133
|
+
if (E.current || D.current || !m.workspaceId || !h) return;
|
|
134
|
+
E.current = !0, B(!0), W(null), H(e);
|
|
135
|
+
let n = new AbortController();
|
|
136
|
+
T.current = n;
|
|
137
|
+
let r = {
|
|
138
|
+
...m,
|
|
139
|
+
signal: n.signal
|
|
140
|
+
}, i = !0;
|
|
141
|
+
try {
|
|
142
|
+
let a = t ? await v.current.read(p, e.clientTurnId, r) : null;
|
|
143
|
+
(!a || a.status === "READY") && await v.current.start(p, e, r), i = !1;
|
|
144
|
+
let o = await v.current.wait(p, e.clientTurnId, r, { onProgress: (t) => {
|
|
145
|
+
n.signal.aborted || le(e, t);
|
|
146
|
+
} });
|
|
147
|
+
if (n.signal.aborted) return;
|
|
148
|
+
o.kind === "completed" ? H(null) : o.kind === "terminal" ? (H(null), W(o.receipt.status === "UNKNOWN" ? "This turn could not be confirmed. It will not be generated again automatically." : o.receipt.status === "CANCELLED" ? "This turn was cancelled." : "The assistant could not complete this turn.")) : W("Your answer is still pending. Recover this turn to check it again.");
|
|
149
|
+
} catch (e) {
|
|
150
|
+
n.signal.aborted || (i && o(e) ? (H(null), W("The assistant could not accept this question. Check your access, available quota or assistant configuration.")) : W("The connection was interrupted. Recover this turn using the same request."));
|
|
151
|
+
} finally {
|
|
152
|
+
T.current === n && (T.current = null, E.current = !1, B(!1));
|
|
153
|
+
}
|
|
154
|
+
}, de = () => {
|
|
155
|
+
if (x || C || !M.trim() || E.current || D.current || $.isActive || V || M.length > 8192) return;
|
|
156
|
+
X.current && Y.cancel();
|
|
157
|
+
let e = {
|
|
158
|
+
clientTurnId: crypto.randomUUID(),
|
|
159
|
+
clientConversationId: y.current,
|
|
160
|
+
message: M.trim()
|
|
161
|
+
};
|
|
162
|
+
j((t) => [...t, {
|
|
163
|
+
input: e,
|
|
164
|
+
receipt: null
|
|
165
|
+
}]), N(""), ue(e);
|
|
166
|
+
}, fe = async () => {
|
|
167
|
+
let e = V;
|
|
168
|
+
if (!(!e || D.current)) {
|
|
169
|
+
D.current = !0, k(!0), T.current?.abort();
|
|
170
|
+
try {
|
|
171
|
+
await v.current.cancel(e.clientTurnId, m) ? (j((t) => t.map((t) => t.input.clientTurnId === e.clientTurnId && t.receipt ? {
|
|
172
|
+
...t,
|
|
173
|
+
receipt: {
|
|
174
|
+
...t.receipt,
|
|
175
|
+
status: "CANCELLED",
|
|
176
|
+
partialMessage: null,
|
|
177
|
+
result: null
|
|
178
|
+
}
|
|
179
|
+
} : t)), H(null), W("This turn was cancelled.")) : W("Cancellation could not be confirmed. Recover the saved turn to check its result.");
|
|
180
|
+
} catch {
|
|
181
|
+
W("Cancellation could not be confirmed. Recover the saved turn to check its result.");
|
|
182
|
+
} finally {
|
|
183
|
+
D.current = !1, k(!1);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
return /* @__PURE__ */ f("section", {
|
|
188
|
+
"aria-label": g,
|
|
189
|
+
className: "flex flex-col overflow-hidden rounded-xl border border-border-seam bg-bg-surface",
|
|
190
|
+
children: [
|
|
191
|
+
/* @__PURE__ */ f("header", {
|
|
192
|
+
className: "border-b border-border-seam px-4 py-3",
|
|
193
|
+
children: [
|
|
194
|
+
/* @__PURE__ */ d("h2", {
|
|
195
|
+
className: "text-sm font-semibold text-text-primary",
|
|
196
|
+
children: g
|
|
197
|
+
}),
|
|
198
|
+
_ && /* @__PURE__ */ d("p", {
|
|
199
|
+
className: "text-xs text-text-secondary",
|
|
200
|
+
children: _
|
|
201
|
+
}),
|
|
202
|
+
/* @__PURE__ */ f("div", {
|
|
203
|
+
className: "mt-2 flex flex-wrap gap-2",
|
|
204
|
+
children: [/* @__PURE__ */ d("button", {
|
|
205
|
+
type: "button",
|
|
206
|
+
disabled: x || z || O || !!V || $.isActive || !m.workspaceId || !h,
|
|
207
|
+
onClick: () => {
|
|
208
|
+
b.current?.abort(), X.current && Y.cancel(), G(null), N(""), W(null), w(!1), R(null);
|
|
209
|
+
},
|
|
210
|
+
className: "rounded-lg border border-border-seam px-2 py-1 text-xs",
|
|
211
|
+
children: "New chat"
|
|
212
|
+
}), /* @__PURE__ */ d("button", {
|
|
213
|
+
type: "button",
|
|
214
|
+
disabled: x || z || O || !!V || $.isActive || !m.workspaceId || !h,
|
|
215
|
+
onClick: () => void q(),
|
|
216
|
+
className: "rounded-lg border border-border-seam px-2 py-1 text-xs",
|
|
217
|
+
children: "Saved conversations"
|
|
218
|
+
})]
|
|
219
|
+
}),
|
|
220
|
+
L && /* @__PURE__ */ f("nav", {
|
|
221
|
+
"aria-label": "Saved assistant conversations",
|
|
222
|
+
className: "mt-2 max-h-40 overflow-auto",
|
|
223
|
+
children: [
|
|
224
|
+
/* @__PURE__ */ d("ul", { children: L.nodes.map((e) => /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d("button", {
|
|
225
|
+
type: "button",
|
|
226
|
+
disabled: x || z || O || !!V || $.isActive,
|
|
227
|
+
"aria-current": e.clientConversationId === y.current ? "true" : void 0,
|
|
228
|
+
onClick: () => {
|
|
229
|
+
X.current && Y.cancel(), N(""), K(p, m, e.clientConversationId);
|
|
230
|
+
},
|
|
231
|
+
className: "rounded-lg px-2 py-1 text-xs",
|
|
232
|
+
children: new Date(e.createdAt).toLocaleString()
|
|
233
|
+
}) }, e.clientConversationId)) }),
|
|
234
|
+
L.nodes.length === 0 && /* @__PURE__ */ d("p", {
|
|
235
|
+
className: "text-xs",
|
|
236
|
+
children: "No saved conversations."
|
|
237
|
+
}),
|
|
238
|
+
L.nextCursor && /* @__PURE__ */ d("button", {
|
|
239
|
+
type: "button",
|
|
240
|
+
disabled: x || z || O || !!V || $.isActive,
|
|
241
|
+
onClick: () => void q(L.nextCursor),
|
|
242
|
+
className: "rounded-lg border border-border-seam px-2 py-1 text-xs",
|
|
243
|
+
children: "Load older conversations"
|
|
244
|
+
})
|
|
245
|
+
]
|
|
246
|
+
})
|
|
247
|
+
]
|
|
248
|
+
}),
|
|
249
|
+
/* @__PURE__ */ f("div", {
|
|
250
|
+
ref: J,
|
|
251
|
+
role: "log",
|
|
252
|
+
"aria-label": "Assistant conversation",
|
|
253
|
+
"aria-live": "polite",
|
|
254
|
+
className: "max-h-96 min-h-40 overflow-y-auto p-4",
|
|
255
|
+
children: [
|
|
256
|
+
x && /* @__PURE__ */ d("p", {
|
|
257
|
+
role: "status",
|
|
258
|
+
className: "text-sm text-text-secondary",
|
|
259
|
+
children: "Loading your conversation…"
|
|
260
|
+
}),
|
|
261
|
+
!x && A.length === 0 && /* @__PURE__ */ d("p", {
|
|
262
|
+
className: "text-sm text-text-secondary",
|
|
263
|
+
children: "Ask a question about the available content."
|
|
264
|
+
}),
|
|
265
|
+
F && A.length < 200 && /* @__PURE__ */ d("button", {
|
|
266
|
+
type: "button",
|
|
267
|
+
onClick: () => void ae(),
|
|
268
|
+
disabled: x || z || O || !!V || $.isActive,
|
|
269
|
+
className: "mb-4 text-sm underline",
|
|
270
|
+
children: "Load older messages"
|
|
271
|
+
}),
|
|
272
|
+
/* @__PURE__ */ d("ol", {
|
|
273
|
+
className: "space-y-4",
|
|
274
|
+
children: A.map((e) => /* @__PURE__ */ f("li", { children: [
|
|
275
|
+
/* @__PURE__ */ d("p", {
|
|
276
|
+
className: "text-xs font-semibold text-text-primary",
|
|
277
|
+
children: "You"
|
|
278
|
+
}),
|
|
279
|
+
/* @__PURE__ */ d("p", {
|
|
280
|
+
className: "whitespace-pre-wrap break-words text-sm text-text-secondary",
|
|
281
|
+
children: e.input.message
|
|
282
|
+
}),
|
|
283
|
+
e.receipt?.status === "RUNNING" && e.receipt.partialMessage && /* @__PURE__ */ f("div", {
|
|
284
|
+
className: "mt-3",
|
|
285
|
+
children: [/* @__PURE__ */ d("p", {
|
|
286
|
+
className: "text-xs text-text-secondary",
|
|
287
|
+
children: "Generating answer…"
|
|
288
|
+
}), /* @__PURE__ */ d("p", {
|
|
289
|
+
className: "whitespace-pre-wrap break-words text-sm text-text-secondary",
|
|
290
|
+
children: e.receipt.partialMessage
|
|
291
|
+
})]
|
|
292
|
+
}),
|
|
293
|
+
e.receipt?.status === "COMPLETED" && e.receipt.result && /* @__PURE__ */ f("div", {
|
|
294
|
+
className: "mt-3",
|
|
295
|
+
children: [
|
|
296
|
+
/* @__PURE__ */ d("p", {
|
|
297
|
+
className: "text-xs font-semibold text-text-primary",
|
|
298
|
+
children: g
|
|
299
|
+
}),
|
|
300
|
+
/* @__PURE__ */ d("p", {
|
|
301
|
+
className: "whitespace-pre-wrap break-words text-sm text-text-secondary",
|
|
302
|
+
children: e.receipt.result.message
|
|
303
|
+
}),
|
|
304
|
+
Y.isSupported() && /* @__PURE__ */ d("button", {
|
|
305
|
+
type: "button",
|
|
306
|
+
onClick: () => {
|
|
307
|
+
let t = e.receipt?.result;
|
|
308
|
+
t && se(t.message);
|
|
309
|
+
},
|
|
310
|
+
disabled: $.isActive,
|
|
311
|
+
className: "mt-2 rounded-lg border border-border-seam px-2 py-1 text-xs",
|
|
312
|
+
children: "Read answer aloud"
|
|
313
|
+
}),
|
|
314
|
+
e.receipt.result.sources.length > 0 && /* @__PURE__ */ d("ul", {
|
|
315
|
+
"aria-label": "Answer sources",
|
|
316
|
+
className: "mt-2 space-y-1 text-xs text-text-secondary",
|
|
317
|
+
children: e.receipt.result.sources.map((e) => /* @__PURE__ */ f("li", {
|
|
318
|
+
title: e.documentId,
|
|
319
|
+
children: [
|
|
320
|
+
"[",
|
|
321
|
+
e.reference,
|
|
322
|
+
"] Source ",
|
|
323
|
+
e.documentId
|
|
324
|
+
]
|
|
325
|
+
}, `${e.reference}:${e.chunkId}`))
|
|
326
|
+
})
|
|
327
|
+
]
|
|
328
|
+
})
|
|
329
|
+
] }, e.input.clientTurnId))
|
|
330
|
+
}),
|
|
331
|
+
z && /* @__PURE__ */ d("p", {
|
|
332
|
+
role: "status",
|
|
333
|
+
className: "mt-3 text-sm text-text-secondary",
|
|
334
|
+
children: "Preparing your answer…"
|
|
335
|
+
})
|
|
336
|
+
]
|
|
337
|
+
}),
|
|
338
|
+
/* @__PURE__ */ f("div", {
|
|
339
|
+
className: "border-t border-border-seam p-3",
|
|
340
|
+
children: [
|
|
341
|
+
$.interim && /* @__PURE__ */ d("p", {
|
|
342
|
+
role: "status",
|
|
343
|
+
className: "mb-2 text-sm text-text-secondary",
|
|
344
|
+
children: $.interim
|
|
345
|
+
}),
|
|
346
|
+
$.error && /* @__PURE__ */ d("p", {
|
|
347
|
+
role: "status",
|
|
348
|
+
className: "mb-2 text-sm text-text-secondary",
|
|
349
|
+
children: "Dictation is unavailable. You can type your question."
|
|
350
|
+
}),
|
|
351
|
+
U && /* @__PURE__ */ d("p", {
|
|
352
|
+
role: "status",
|
|
353
|
+
className: "mb-2 text-sm text-text-secondary",
|
|
354
|
+
children: U
|
|
355
|
+
}),
|
|
356
|
+
/* @__PURE__ */ d("label", {
|
|
357
|
+
className: "sr-only",
|
|
358
|
+
htmlFor: `assistant-question-${y.current}`,
|
|
359
|
+
children: "Question"
|
|
360
|
+
}),
|
|
361
|
+
/* @__PURE__ */ d("textarea", {
|
|
362
|
+
id: `assistant-question-${y.current}`,
|
|
363
|
+
value: M,
|
|
364
|
+
onChange: (e) => N(e.target.value),
|
|
365
|
+
onKeyDown: (e) => {
|
|
366
|
+
e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing && (e.preventDefault(), de());
|
|
367
|
+
},
|
|
368
|
+
maxLength: 8192,
|
|
369
|
+
rows: 2,
|
|
370
|
+
placeholder: "Ask a question…",
|
|
371
|
+
disabled: x || C || z || O || !!V || !m.workspaceId || !h,
|
|
372
|
+
className: "w-full rounded-lg border border-border-seam bg-bg-sunken p-2 text-sm text-text-primary"
|
|
373
|
+
}),
|
|
374
|
+
/* @__PURE__ */ f("div", {
|
|
375
|
+
className: "mt-2 flex flex-wrap justify-end gap-2",
|
|
376
|
+
children: [
|
|
377
|
+
$.isSupported && /* @__PURE__ */ d("button", {
|
|
378
|
+
type: "button",
|
|
379
|
+
onClick: ce,
|
|
380
|
+
disabled: x || C || z || O || !!V,
|
|
381
|
+
"aria-pressed": $.isActive,
|
|
382
|
+
className: "rounded-lg border border-border-seam px-3 py-2 text-sm",
|
|
383
|
+
children: $.isActive ? "Stop dictation" : "Dictate question"
|
|
384
|
+
}),
|
|
385
|
+
oe && /* @__PURE__ */ d("button", {
|
|
386
|
+
type: "button",
|
|
387
|
+
onClick: () => Y.cancel(),
|
|
388
|
+
className: "rounded-lg border border-border-seam px-3 py-2 text-sm",
|
|
389
|
+
children: "Stop audio"
|
|
390
|
+
}),
|
|
391
|
+
C && !x && /* @__PURE__ */ d("button", {
|
|
392
|
+
type: "button",
|
|
393
|
+
onClick: () => void K(p, m),
|
|
394
|
+
className: "rounded-lg border border-border-seam px-3 py-2 text-sm",
|
|
395
|
+
children: "Reload conversation"
|
|
396
|
+
}),
|
|
397
|
+
V && !z && !O && /* @__PURE__ */ d("button", {
|
|
398
|
+
type: "button",
|
|
399
|
+
onClick: () => void ue(V, !0),
|
|
400
|
+
className: "rounded-lg border border-border-seam px-3 py-2 text-sm",
|
|
401
|
+
children: "Recover turn"
|
|
402
|
+
}),
|
|
403
|
+
V && /* @__PURE__ */ d("button", {
|
|
404
|
+
type: "button",
|
|
405
|
+
onClick: () => void fe(),
|
|
406
|
+
disabled: O,
|
|
407
|
+
className: "rounded-lg border border-border-seam px-3 py-2 text-sm",
|
|
408
|
+
children: "Cancel turn"
|
|
409
|
+
}),
|
|
410
|
+
/* @__PURE__ */ d("button", {
|
|
411
|
+
type: "button",
|
|
412
|
+
onClick: de,
|
|
413
|
+
disabled: !M.trim() || $.isActive || O || x || C || z || !!V || !m.workspaceId || !h,
|
|
414
|
+
className: "rounded-lg bg-[var(--color-accent-soft)] px-3 py-2 text-sm disabled:opacity-50",
|
|
415
|
+
children: "Ask"
|
|
416
|
+
})
|
|
417
|
+
]
|
|
418
|
+
})
|
|
419
|
+
]
|
|
420
|
+
})
|
|
421
|
+
]
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
//#endregion
|
|
425
|
+
export { p as WorkflowAssistantPanel };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { executeAssistantGraphQLOnce } from './gatewayClient';
|
|
2
|
+
import { AssistantSandboxAuthContext } from './types';
|
|
3
|
+
/** Product configuration selects a server-owned assistant, never a model or workflow override. */
|
|
4
|
+
export type AssistantWorkflowTarget = {
|
|
5
|
+
kind: 'botmanor';
|
|
6
|
+
agentId: string;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'buildmyiq-course';
|
|
9
|
+
courseId: string;
|
|
10
|
+
};
|
|
11
|
+
export interface WorkflowAssistantTurnInput {
|
|
12
|
+
clientTurnId: string;
|
|
13
|
+
clientConversationId: string;
|
|
14
|
+
message: string;
|
|
15
|
+
}
|
|
16
|
+
export interface WorkflowAssistantReceipt {
|
|
17
|
+
partialMessage?: string | null;
|
|
18
|
+
id: string;
|
|
19
|
+
clientTurnId: string;
|
|
20
|
+
courseId: string | null;
|
|
21
|
+
status: 'READY' | 'RUNNING' | 'GENERATED' | 'COMPLETED' | 'FAILED' | 'CANCELLED' | 'UNKNOWN';
|
|
22
|
+
historyDelivered: boolean;
|
|
23
|
+
usageDelivered: boolean;
|
|
24
|
+
result: {
|
|
25
|
+
message: string;
|
|
26
|
+
model: string;
|
|
27
|
+
tokensUsed: number;
|
|
28
|
+
sources: {
|
|
29
|
+
reference: number;
|
|
30
|
+
chunkId: string;
|
|
31
|
+
documentId: string;
|
|
32
|
+
knowledgeBaseId: string;
|
|
33
|
+
}[];
|
|
34
|
+
} | null;
|
|
35
|
+
}
|
|
36
|
+
export interface WorkflowAssistantConversationPage {
|
|
37
|
+
nodes: Array<{
|
|
38
|
+
clientConversationId: string;
|
|
39
|
+
createdAt: string;
|
|
40
|
+
}>;
|
|
41
|
+
nextCursor: string | null;
|
|
42
|
+
}
|
|
43
|
+
export interface WorkflowAssistantConversation {
|
|
44
|
+
clientConversationId: string;
|
|
45
|
+
turns: Array<{
|
|
46
|
+
message: string;
|
|
47
|
+
receipt: WorkflowAssistantReceipt;
|
|
48
|
+
}>;
|
|
49
|
+
pending: WorkflowAssistantTurnInput | null;
|
|
50
|
+
}
|
|
51
|
+
export interface WorkflowAssistantRequestContext {
|
|
52
|
+
workspaceId: string;
|
|
53
|
+
authContext?: AssistantSandboxAuthContext;
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
}
|
|
56
|
+
export interface WorkflowAssistantRunHandle {
|
|
57
|
+
runId: string;
|
|
58
|
+
status: string;
|
|
59
|
+
workflowId: string;
|
|
60
|
+
workflowKey: string;
|
|
61
|
+
version: string;
|
|
62
|
+
triggerNodeId: string;
|
|
63
|
+
}
|
|
64
|
+
export type WorkflowAssistantWaitOutcome = {
|
|
65
|
+
kind: 'completed';
|
|
66
|
+
receipt: WorkflowAssistantReceipt;
|
|
67
|
+
} | {
|
|
68
|
+
kind: 'terminal';
|
|
69
|
+
receipt: WorkflowAssistantReceipt;
|
|
70
|
+
} | {
|
|
71
|
+
kind: 'pending';
|
|
72
|
+
receipt: WorkflowAssistantReceipt | null;
|
|
73
|
+
};
|
|
74
|
+
/** Only an authoritative admission refusal can release a blocked composer. */
|
|
75
|
+
export declare function isWorkflowAssistantAdmissionRefusal(error: unknown): boolean;
|
|
76
|
+
/** Shared authenticated gateway implementation. There is no sandbox or vendor fallback. */
|
|
77
|
+
export declare class AssistantWorkflowClient {
|
|
78
|
+
private readonly request;
|
|
79
|
+
constructor(request?: typeof executeAssistantGraphQLOnce);
|
|
80
|
+
/** Resolve an LMS route through its owner-filtered server endpoint. */
|
|
81
|
+
courseTargetForEnrollment(enrollmentId: string, context: WorkflowAssistantRequestContext): Promise<Extract<AssistantWorkflowTarget, {
|
|
82
|
+
kind: 'buildmyiq-course';
|
|
83
|
+
}>>;
|
|
84
|
+
start(target: AssistantWorkflowTarget, input: WorkflowAssistantTurnInput, context: WorkflowAssistantRequestContext): Promise<WorkflowAssistantRunHandle>;
|
|
85
|
+
read(target: AssistantWorkflowTarget, clientTurnId: string, context: WorkflowAssistantRequestContext, retryDelivery?: boolean): Promise<WorkflowAssistantReceipt | null>;
|
|
86
|
+
conversations(target: AssistantWorkflowTarget, context: WorkflowAssistantRequestContext, after?: string | null): Promise<WorkflowAssistantConversationPage>;
|
|
87
|
+
conversation(target: AssistantWorkflowTarget, context: WorkflowAssistantRequestContext, clientConversationId?: string | null): Promise<WorkflowAssistantConversation | null>;
|
|
88
|
+
messages(target: AssistantWorkflowTarget, context: WorkflowAssistantRequestContext, clientConversationId: string, before?: string | null): Promise<{
|
|
89
|
+
turns: WorkflowAssistantConversation['turns'];
|
|
90
|
+
nextCursor: string | null;
|
|
91
|
+
}>;
|
|
92
|
+
cancel(clientTurnId: string, context: WorkflowAssistantRequestContext): Promise<boolean>;
|
|
93
|
+
/** A client deadline leaves an admitted turn recoverable; it never regenerates it. */
|
|
94
|
+
wait(target: AssistantWorkflowTarget, clientTurnId: string, context: WorkflowAssistantRequestContext, options?: {
|
|
95
|
+
budgetMs?: number;
|
|
96
|
+
intervalMs?: number;
|
|
97
|
+
onProgress?: (receipt: WorkflowAssistantReceipt) => void;
|
|
98
|
+
}): Promise<WorkflowAssistantWaitOutcome>;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=workflowApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflowApi.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/workflowApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAE3D,kGAAkG;AAClG,MAAM,MAAM,uBAAuB,GAC/B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AACnD,MAAM,WAAW,0BAA0B;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB;AACD,MAAM,WAAW,wBAAwB;IACvC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;IAC7F,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE;YACP,SAAS,EAAE,MAAM,CAAC;YAClB,OAAO,EAAE,MAAM,CAAC;YAChB,UAAU,EAAE,MAAM,CAAC;YACnB,eAAe,EAAE,MAAM,CAAC;SACzB,EAAE,CAAC;KACL,GAAG,IAAI,CAAC;CACV;AACD,MAAM,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