@assistant-ui/react 0.15.8 → 0.15.10
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/LICENSE +21 -0
- package/dist/client/ExternalThread.d.ts +3 -1
- package/dist/client/ExternalThread.d.ts.map +1 -1
- package/dist/client/ExternalThread.js +556 -363
- package/dist/client/ExternalThread.js.map +1 -1
- package/dist/legacy-runtime/cloud/auiV0.d.ts +1 -0
- package/dist/legacy-runtime/cloud/auiV0.d.ts.map +1 -1
- package/dist/legacy-runtime/cloud/auiV0.js +2 -1
- package/dist/legacy-runtime/cloud/auiV0.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js +2 -0
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
- package/dist/unstable/useLiveCompletionAdapter.js +32 -7
- package/dist/unstable/useLiveCompletionAdapter.js.map +1 -1
- package/dist/utils/useToolArgsFieldStatus.d.ts +2 -2
- package/package.json +14 -16
- package/src/client/ExternalThread.ts +175 -10
- package/src/legacy-runtime/cloud/auiV0.ts +8 -1
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransport.spec.md +1 -0
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.test.tsx +79 -0
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.ts +2 -0
- package/src/tests/external-thread-feedback.test.tsx +204 -0
- package/src/tests/external-thread-parity.test.tsx +29 -0
- package/src/tests/external-thread-speech.test.tsx +328 -0
- package/src/unstable/useLiveCompletionAdapter.test.tsx +90 -0
- package/src/unstable/useLiveCompletionAdapter.ts +32 -7
|
@@ -16,8 +16,8 @@ const derivePartStatus = (message, partIndex, part) => {
|
|
|
16
16
|
return toMessagePartStatus(message, partIndex, part);
|
|
17
17
|
};
|
|
18
18
|
const useMessageClient = (t0) => {
|
|
19
|
-
const $ = c(
|
|
20
|
-
const { message, index, parentId, onEdit, onReload, queue, branches, onRespondToToolApproval, onAddToolResult, onResumeToolCall, attachmentAdapter } = t0;
|
|
19
|
+
const $ = c(73);
|
|
20
|
+
const { message, index, parentId, onEdit, onReload, queue, branches, onRespondToToolApproval, onAddToolResult, onResumeToolCall, attachmentAdapter, submittedFeedback, onSubmitFeedback, speech, onSpeak, onStopSpeaking } = t0;
|
|
21
21
|
const [isCopied, setIsCopied] = useState(false);
|
|
22
22
|
const [isHovering, setIsHovering] = useState(false);
|
|
23
23
|
const [isEditing, setIsEditing] = useState(false);
|
|
@@ -52,39 +52,42 @@ const useMessageClient = (t0) => {
|
|
|
52
52
|
} else t3 = $[8];
|
|
53
53
|
const attachmentClients = useClientLookup(t3);
|
|
54
54
|
let t4;
|
|
55
|
-
if ($[9]
|
|
55
|
+
if ($[9] !== onEdit) {
|
|
56
56
|
t4 = () => {
|
|
57
|
+
if (!onEdit) throw new Error("Runtime does not support editing.");
|
|
57
58
|
setIsEditing(true);
|
|
58
59
|
};
|
|
59
|
-
$[9] =
|
|
60
|
-
|
|
60
|
+
$[9] = onEdit;
|
|
61
|
+
$[10] = t4;
|
|
62
|
+
} else t4 = $[10];
|
|
61
63
|
const handleBeginEdit = t4;
|
|
62
64
|
let t5;
|
|
63
|
-
if ($[
|
|
65
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
64
66
|
t5 = () => {
|
|
65
67
|
setIsEditing(false);
|
|
66
68
|
};
|
|
67
|
-
$[
|
|
68
|
-
} else t5 = $[
|
|
69
|
+
$[11] = t5;
|
|
70
|
+
} else t5 = $[11];
|
|
69
71
|
const handleCancelEdit = t5;
|
|
70
72
|
let t6;
|
|
71
|
-
if ($[
|
|
73
|
+
if ($[12] !== message.id || $[13] !== onEdit || $[14] !== parentId) {
|
|
72
74
|
t6 = (msg) => {
|
|
73
|
-
onEdit
|
|
75
|
+
if (!onEdit) throw new Error("Runtime does not support editing.");
|
|
76
|
+
onEdit({
|
|
74
77
|
...msg,
|
|
75
78
|
parentId,
|
|
76
79
|
sourceId: message.id
|
|
77
80
|
});
|
|
78
81
|
setIsEditing(false);
|
|
79
82
|
};
|
|
80
|
-
$[
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
84
|
-
} else t6 = $[
|
|
83
|
+
$[12] = message.id;
|
|
84
|
+
$[13] = onEdit;
|
|
85
|
+
$[14] = parentId;
|
|
86
|
+
$[15] = t6;
|
|
87
|
+
} else t6 = $[15];
|
|
85
88
|
const handleSendEdit = t6;
|
|
86
89
|
let t7;
|
|
87
|
-
if ($[
|
|
90
|
+
if ($[16] !== attachmentAdapter || $[17] !== handleBeginEdit || $[18] !== handleSendEdit || $[19] !== isEditing || $[20] !== message || $[21] !== queue) {
|
|
88
91
|
t7 = ComposerClientResource({
|
|
89
92
|
type: "edit",
|
|
90
93
|
isEditing,
|
|
@@ -96,152 +99,171 @@ const useMessageClient = (t0) => {
|
|
|
96
99
|
queue,
|
|
97
100
|
attachmentAdapter
|
|
98
101
|
});
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
|
|
102
|
+
$[16] = attachmentAdapter;
|
|
103
|
+
$[17] = handleBeginEdit;
|
|
104
|
+
$[18] = handleSendEdit;
|
|
105
|
+
$[19] = isEditing;
|
|
106
|
+
$[20] = message;
|
|
107
|
+
$[21] = queue;
|
|
108
|
+
$[22] = t7;
|
|
109
|
+
} else t7 = $[22];
|
|
106
110
|
const composerClient = useClientResource(t7);
|
|
107
111
|
let branchIds;
|
|
108
112
|
let t8;
|
|
109
|
-
if ($[
|
|
113
|
+
if ($[23] !== branches || $[24] !== message.id) {
|
|
110
114
|
branchIds = branches?.getBranches(message.id) ?? EMPTY_BRANCH_IDS;
|
|
111
115
|
t8 = branchIds.indexOf(message.id);
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
+
$[23] = branches;
|
|
117
|
+
$[24] = message.id;
|
|
118
|
+
$[25] = branchIds;
|
|
119
|
+
$[26] = t8;
|
|
116
120
|
} else {
|
|
117
|
-
branchIds = $[
|
|
118
|
-
t8 = $[
|
|
121
|
+
branchIds = $[25];
|
|
122
|
+
t8 = $[26];
|
|
119
123
|
}
|
|
120
124
|
const branchIndex = t8;
|
|
121
125
|
const branchNumber = branchIndex === -1 ? 1 : branchIndex + 1;
|
|
122
126
|
const branchCount = branchIndex === -1 ? 1 : branchIds.length;
|
|
123
127
|
let t9;
|
|
124
|
-
if ($[
|
|
125
|
-
t9 = message.
|
|
126
|
-
$[25] = message.attachments;
|
|
127
|
-
$[26] = t9;
|
|
128
|
-
} else t9 = $[26];
|
|
129
|
-
let t10;
|
|
130
|
-
if ($[27] !== branchCount || $[28] !== branchNumber || $[29] !== composerClient.state || $[30] !== index || $[31] !== isCopied || $[32] !== isHovering || $[33] !== message || $[34] !== parentId || $[35] !== partClients.state || $[36] !== t9) {
|
|
131
|
-
t10 = {
|
|
128
|
+
if ($[27] !== message || $[28] !== submittedFeedback) {
|
|
129
|
+
t9 = submittedFeedback && message.role === "assistant" ? {
|
|
132
130
|
...message,
|
|
133
|
-
|
|
131
|
+
metadata: {
|
|
132
|
+
...message.metadata,
|
|
133
|
+
submittedFeedback: { type: submittedFeedback }
|
|
134
|
+
}
|
|
135
|
+
} : message;
|
|
136
|
+
$[27] = message;
|
|
137
|
+
$[28] = submittedFeedback;
|
|
138
|
+
$[29] = t9;
|
|
139
|
+
} else t9 = $[29];
|
|
140
|
+
const messageWithFeedback = t9;
|
|
141
|
+
let t10;
|
|
142
|
+
if ($[30] !== message.attachments) {
|
|
143
|
+
t10 = message.attachments ?? [];
|
|
144
|
+
$[30] = message.attachments;
|
|
145
|
+
$[31] = t10;
|
|
146
|
+
} else t10 = $[31];
|
|
147
|
+
let t11;
|
|
148
|
+
if ($[32] !== branchCount || $[33] !== branchNumber || $[34] !== composerClient.state || $[35] !== index || $[36] !== isCopied || $[37] !== isHovering || $[38] !== messageWithFeedback || $[39] !== parentId || $[40] !== partClients.state || $[41] !== speech || $[42] !== t10) {
|
|
149
|
+
t11 = {
|
|
150
|
+
...messageWithFeedback,
|
|
151
|
+
attachments: t10,
|
|
134
152
|
parentId,
|
|
135
153
|
isLast: false,
|
|
136
154
|
branchNumber,
|
|
137
155
|
branchCount,
|
|
138
|
-
speech
|
|
156
|
+
speech,
|
|
139
157
|
parts: partClients.state,
|
|
140
158
|
isCopied,
|
|
141
159
|
isHovering,
|
|
142
160
|
index,
|
|
143
161
|
composer: composerClient.state
|
|
144
162
|
};
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if ($[38] !== state) {
|
|
160
|
-
t11 = () => state;
|
|
161
|
-
$[38] = state;
|
|
162
|
-
$[39] = t11;
|
|
163
|
-
} else t11 = $[39];
|
|
163
|
+
$[32] = branchCount;
|
|
164
|
+
$[33] = branchNumber;
|
|
165
|
+
$[34] = composerClient.state;
|
|
166
|
+
$[35] = index;
|
|
167
|
+
$[36] = isCopied;
|
|
168
|
+
$[37] = isHovering;
|
|
169
|
+
$[38] = messageWithFeedback;
|
|
170
|
+
$[39] = parentId;
|
|
171
|
+
$[40] = partClients.state;
|
|
172
|
+
$[41] = speech;
|
|
173
|
+
$[42] = t10;
|
|
174
|
+
$[43] = t11;
|
|
175
|
+
} else t11 = $[43];
|
|
176
|
+
const state = t11;
|
|
164
177
|
let t12;
|
|
165
|
-
if ($[
|
|
166
|
-
t12 = () =>
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
} else t12 = $[
|
|
178
|
+
if ($[44] !== state) {
|
|
179
|
+
t12 = () => state;
|
|
180
|
+
$[44] = state;
|
|
181
|
+
$[45] = t12;
|
|
182
|
+
} else t12 = $[45];
|
|
170
183
|
let t13;
|
|
171
|
-
if ($[
|
|
172
|
-
t13 = () =>
|
|
184
|
+
if ($[46] !== composerClient.methods) {
|
|
185
|
+
t13 = () => composerClient.methods;
|
|
186
|
+
$[46] = composerClient.methods;
|
|
187
|
+
$[47] = t13;
|
|
188
|
+
} else t13 = $[47];
|
|
189
|
+
let t14;
|
|
190
|
+
if ($[48] !== onReload) {
|
|
191
|
+
t14 = () => {
|
|
173
192
|
onReload?.();
|
|
174
193
|
};
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
} else
|
|
178
|
-
let
|
|
179
|
-
if ($[
|
|
180
|
-
|
|
181
|
-
const { position, branchId } =
|
|
194
|
+
$[48] = onReload;
|
|
195
|
+
$[49] = t14;
|
|
196
|
+
} else t14 = $[49];
|
|
197
|
+
let t15;
|
|
198
|
+
if ($[50] !== branchIds || $[51] !== branchIndex || $[52] !== branches || $[53] !== message.id) {
|
|
199
|
+
t15 = (t16) => {
|
|
200
|
+
const { position, branchId } = t16;
|
|
182
201
|
if (!branches) return;
|
|
183
202
|
const target = branchId ?? (branchIndex === -1 ? void 0 : position === "previous" ? branchIds[branchIndex - 1] : position === "next" ? branchIds[branchIndex + 1] : void 0);
|
|
184
203
|
if (target !== void 0 && target !== message.id) branches.switchToBranch(target);
|
|
185
204
|
};
|
|
186
|
-
$[
|
|
187
|
-
$[
|
|
188
|
-
$[
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
} else
|
|
192
|
-
let t15;
|
|
193
|
-
if ($[49] !== message) {
|
|
194
|
-
t15 = () => getThreadMessageText(message);
|
|
195
|
-
$[49] = message;
|
|
196
|
-
$[50] = t15;
|
|
197
|
-
} else t15 = $[50];
|
|
205
|
+
$[50] = branchIds;
|
|
206
|
+
$[51] = branchIndex;
|
|
207
|
+
$[52] = branches;
|
|
208
|
+
$[53] = message.id;
|
|
209
|
+
$[54] = t15;
|
|
210
|
+
} else t15 = $[54];
|
|
198
211
|
let t16;
|
|
199
|
-
if ($[
|
|
200
|
-
t16 = (
|
|
212
|
+
if ($[55] !== message) {
|
|
213
|
+
t16 = () => getThreadMessageText(message);
|
|
214
|
+
$[55] = message;
|
|
215
|
+
$[56] = t16;
|
|
216
|
+
} else t16 = $[56];
|
|
217
|
+
let t17;
|
|
218
|
+
if ($[57] !== partClients || $[58] !== state) {
|
|
219
|
+
t17 = (selector) => {
|
|
201
220
|
if ("index" in selector) return partClients.get(selector);
|
|
202
221
|
const partIndex = state.parts.findIndex((p) => p.type === "tool-call" && p.toolCallId === selector.toolCallId);
|
|
203
222
|
return partClients.get({ index: partIndex });
|
|
204
223
|
};
|
|
205
|
-
$[
|
|
206
|
-
$[
|
|
207
|
-
$[
|
|
208
|
-
} else
|
|
209
|
-
let
|
|
210
|
-
if ($[
|
|
211
|
-
|
|
224
|
+
$[57] = partClients;
|
|
225
|
+
$[58] = state;
|
|
226
|
+
$[59] = t17;
|
|
227
|
+
} else t17 = $[59];
|
|
228
|
+
let t18;
|
|
229
|
+
if ($[60] !== attachmentClients) {
|
|
230
|
+
t18 = (selector_0) => {
|
|
212
231
|
if ("id" in selector_0) return attachmentClients.get({ key: selector_0.id });
|
|
213
232
|
return attachmentClients.get(selector_0);
|
|
214
233
|
};
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
} else
|
|
218
|
-
let
|
|
219
|
-
if ($[
|
|
220
|
-
|
|
221
|
-
getState:
|
|
222
|
-
composer:
|
|
234
|
+
$[60] = attachmentClients;
|
|
235
|
+
$[61] = t18;
|
|
236
|
+
} else t18 = $[61];
|
|
237
|
+
let t19;
|
|
238
|
+
if ($[62] !== onSpeak || $[63] !== onStopSpeaking || $[64] !== onSubmitFeedback || $[65] !== t12 || $[66] !== t13 || $[67] !== t14 || $[68] !== t15 || $[69] !== t16 || $[70] !== t17 || $[71] !== t18) {
|
|
239
|
+
t19 = {
|
|
240
|
+
getState: t12,
|
|
241
|
+
composer: t13,
|
|
223
242
|
delete: _temp3,
|
|
224
|
-
reload:
|
|
225
|
-
speak:
|
|
226
|
-
stopSpeaking:
|
|
227
|
-
submitFeedback:
|
|
228
|
-
switchToBranch:
|
|
229
|
-
getCopyText:
|
|
230
|
-
part:
|
|
231
|
-
attachment:
|
|
243
|
+
reload: t14,
|
|
244
|
+
speak: onSpeak,
|
|
245
|
+
stopSpeaking: onStopSpeaking,
|
|
246
|
+
submitFeedback: onSubmitFeedback,
|
|
247
|
+
switchToBranch: t15,
|
|
248
|
+
getCopyText: t16,
|
|
249
|
+
part: t17,
|
|
250
|
+
attachment: t18,
|
|
232
251
|
setIsCopied,
|
|
233
252
|
setIsHovering
|
|
234
253
|
};
|
|
235
|
-
$[
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
|
|
244
|
-
|
|
254
|
+
$[62] = onSpeak;
|
|
255
|
+
$[63] = onStopSpeaking;
|
|
256
|
+
$[64] = onSubmitFeedback;
|
|
257
|
+
$[65] = t12;
|
|
258
|
+
$[66] = t13;
|
|
259
|
+
$[67] = t14;
|
|
260
|
+
$[68] = t15;
|
|
261
|
+
$[69] = t16;
|
|
262
|
+
$[70] = t17;
|
|
263
|
+
$[71] = t18;
|
|
264
|
+
$[72] = t19;
|
|
265
|
+
} else t19 = $[72];
|
|
266
|
+
return t19;
|
|
245
267
|
};
|
|
246
268
|
const MessageClient = resource(useMessageClient);
|
|
247
269
|
const usePartResource = (t0) => {
|
|
@@ -402,7 +424,7 @@ const useComposerClientResource = (t0) => {
|
|
|
402
424
|
if ($[2] !== message || $[3] !== setAttachments || $[4] !== setRole || $[5] !== setText) {
|
|
403
425
|
t4 = () => {
|
|
404
426
|
if (message) {
|
|
405
|
-
const messageText = message.content.filter(
|
|
427
|
+
const messageText = message.content.filter(_temp4).map(_temp5).join("\n\n");
|
|
406
428
|
setText(messageText);
|
|
407
429
|
setRole(message.role);
|
|
408
430
|
setAttachments(message.attachments ?? []);
|
|
@@ -457,7 +479,7 @@ const useComposerClientResource = (t0) => {
|
|
|
457
479
|
if ($[19] !== attachmentAdapter) {
|
|
458
480
|
t8 = async (removed) => {
|
|
459
481
|
if (!attachmentAdapter) return;
|
|
460
|
-
await Promise.all(removed.filter(
|
|
482
|
+
await Promise.all(removed.filter(_temp6).map((a_1) => attachmentAdapter.remove(a_1)));
|
|
461
483
|
};
|
|
462
484
|
$[19] = attachmentAdapter;
|
|
463
485
|
$[20] = t8;
|
|
@@ -723,8 +745,8 @@ const useComposerClientResource = (t0) => {
|
|
|
723
745
|
send: t19,
|
|
724
746
|
cancel: onCancel,
|
|
725
747
|
beginEdit: t20,
|
|
726
|
-
startDictation:
|
|
727
|
-
stopDictation:
|
|
748
|
+
startDictation: _temp7,
|
|
749
|
+
stopDictation: _temp8,
|
|
728
750
|
setQuote,
|
|
729
751
|
queueItem: t21
|
|
730
752
|
};
|
|
@@ -746,6 +768,57 @@ const useComposerClientResource = (t0) => {
|
|
|
746
768
|
return t22;
|
|
747
769
|
};
|
|
748
770
|
const ComposerClientResource = resource(useComposerClientResource);
|
|
771
|
+
const createSpeechController = (notify) => {
|
|
772
|
+
let session;
|
|
773
|
+
const clear = () => {
|
|
774
|
+
if (!session) return;
|
|
775
|
+
session.cancel();
|
|
776
|
+
session = void 0;
|
|
777
|
+
notify(void 0);
|
|
778
|
+
};
|
|
779
|
+
return {
|
|
780
|
+
speak: (adapter, message) => {
|
|
781
|
+
clear();
|
|
782
|
+
const utterance = adapter.speak(getThreadMessageText(message));
|
|
783
|
+
let unsub;
|
|
784
|
+
unsub = utterance.subscribe(() => {
|
|
785
|
+
if (utterance.status.type === "ended") {
|
|
786
|
+
unsub?.();
|
|
787
|
+
session = void 0;
|
|
788
|
+
notify(void 0);
|
|
789
|
+
} else notify({
|
|
790
|
+
messageId: message.id,
|
|
791
|
+
status: utterance.status
|
|
792
|
+
});
|
|
793
|
+
});
|
|
794
|
+
if (utterance.status.type === "ended") {
|
|
795
|
+
unsub();
|
|
796
|
+
notify(void 0);
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
session = {
|
|
800
|
+
messageId: message.id,
|
|
801
|
+
cancel: () => {
|
|
802
|
+
unsub();
|
|
803
|
+
utterance.cancel();
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
notify({
|
|
807
|
+
messageId: message.id,
|
|
808
|
+
status: utterance.status
|
|
809
|
+
});
|
|
810
|
+
},
|
|
811
|
+
stop: () => {
|
|
812
|
+
if (!session) throw new Error("No message is being spoken");
|
|
813
|
+
clear();
|
|
814
|
+
},
|
|
815
|
+
stopMessage: (messageId) => {
|
|
816
|
+
if (session?.messageId !== messageId) throw new Error("Message is not being spoken");
|
|
817
|
+
clear();
|
|
818
|
+
},
|
|
819
|
+
dispose: clear
|
|
820
|
+
};
|
|
821
|
+
};
|
|
749
822
|
const dedupeMessagesById = (messages) => {
|
|
750
823
|
const seenIds = /* @__PURE__ */ new Set();
|
|
751
824
|
const deduped = [];
|
|
@@ -761,8 +834,8 @@ const dedupeMessagesById = (messages) => {
|
|
|
761
834
|
return deduped.length === messages.length ? messages : deduped.reverse();
|
|
762
835
|
};
|
|
763
836
|
const useExternalThread = (t0) => {
|
|
764
|
-
const $ = c(
|
|
765
|
-
const { messages: messagesProp, isRunning: t1, isLoading: t2, state: threadState, extras, isSendDisabled: t3, onNew, onEdit, onReload, onStartRun, onCancel, onResume, onAddToolResult, onResumeToolCall, onLoadExternalState, attachmentAdapter, queue, branches, onRespondToToolApproval } = t0;
|
|
837
|
+
const $ = c(106);
|
|
838
|
+
const { messages: messagesProp, isRunning: t1, isLoading: t2, state: threadState, extras, isSendDisabled: t3, onNew, onEdit, onReload, onStartRun, onCancel, onResume, onAddToolResult, onResumeToolCall, onLoadExternalState, attachmentAdapter, feedbackAdapter, speechAdapter, queue, branches, onRespondToToolApproval } = t0;
|
|
766
839
|
const isRunning = t1 === void 0 ? false : t1;
|
|
767
840
|
const isLoading = t2 === void 0 ? false : t2;
|
|
768
841
|
const isSendDisabled = t3 === void 0 ? false : t3;
|
|
@@ -774,98 +847,216 @@ const useExternalThread = (t0) => {
|
|
|
774
847
|
} else t4 = $[1];
|
|
775
848
|
const messages = t4;
|
|
776
849
|
let t5;
|
|
777
|
-
if ($[2]
|
|
778
|
-
t5 =
|
|
779
|
-
|
|
850
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
851
|
+
t5 = {};
|
|
852
|
+
$[2] = t5;
|
|
853
|
+
} else t5 = $[2];
|
|
854
|
+
const [submittedFeedback, setSubmittedFeedback] = useState(t5);
|
|
855
|
+
let t6;
|
|
856
|
+
if ($[3] !== submittedFeedback) {
|
|
857
|
+
t6 = (msg) => {
|
|
858
|
+
const entry = submittedFeedback[msg.id];
|
|
859
|
+
return entry && msg.metadata.submittedFeedback?.type === entry.external ? entry.type : void 0;
|
|
860
|
+
};
|
|
861
|
+
$[3] = submittedFeedback;
|
|
862
|
+
$[4] = t6;
|
|
863
|
+
} else t6 = $[4];
|
|
864
|
+
const feedbackFor = t6;
|
|
865
|
+
let t7;
|
|
866
|
+
let t8;
|
|
867
|
+
if ($[5] !== messages) {
|
|
868
|
+
t7 = () => {
|
|
869
|
+
setSubmittedFeedback((prev) => {
|
|
870
|
+
const live = Object.entries(prev).filter((t9) => {
|
|
871
|
+
const [id, entry_0] = t9;
|
|
872
|
+
const msg_0 = messages.find((m) => m.id === id);
|
|
873
|
+
return !!msg_0 && msg_0.metadata.submittedFeedback?.type === entry_0.external;
|
|
874
|
+
});
|
|
875
|
+
return live.length === Object.keys(prev).length ? prev : Object.fromEntries(live);
|
|
876
|
+
});
|
|
877
|
+
};
|
|
878
|
+
t8 = [messages];
|
|
879
|
+
$[5] = messages;
|
|
880
|
+
$[6] = t7;
|
|
881
|
+
$[7] = t8;
|
|
882
|
+
} else {
|
|
883
|
+
t7 = $[6];
|
|
884
|
+
t8 = $[7];
|
|
885
|
+
}
|
|
886
|
+
useEffect(t7, t8);
|
|
887
|
+
let t9;
|
|
888
|
+
if ($[8] !== feedbackAdapter) {
|
|
889
|
+
t9 = (message, t10) => {
|
|
890
|
+
const { type } = t10;
|
|
891
|
+
if (!feedbackAdapter) throw new Error("Feedback adapter not configured");
|
|
892
|
+
feedbackAdapter.submit({
|
|
893
|
+
message,
|
|
894
|
+
type
|
|
895
|
+
});
|
|
896
|
+
if (message.role === "assistant") setSubmittedFeedback((prev_0) => ({
|
|
897
|
+
...prev_0,
|
|
898
|
+
[message.id]: {
|
|
899
|
+
type,
|
|
900
|
+
external: message.metadata.submittedFeedback?.type
|
|
901
|
+
}
|
|
902
|
+
}));
|
|
903
|
+
};
|
|
904
|
+
$[8] = feedbackAdapter;
|
|
905
|
+
$[9] = t9;
|
|
906
|
+
} else t9 = $[9];
|
|
907
|
+
const handleSubmitFeedback = t9;
|
|
908
|
+
const [speechState, setSpeech] = useState(void 0);
|
|
909
|
+
let t10;
|
|
910
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
911
|
+
t10 = () => createSpeechController(setSpeech);
|
|
912
|
+
$[10] = t10;
|
|
913
|
+
} else t10 = $[10];
|
|
914
|
+
const [speechController] = useState(t10);
|
|
915
|
+
const hasSpeechAdapter = !!speechAdapter;
|
|
916
|
+
const speech = hasSpeechAdapter ? speechState : void 0;
|
|
917
|
+
let t11;
|
|
918
|
+
let t12;
|
|
919
|
+
if ($[11] !== hasSpeechAdapter || $[12] !== speechController) {
|
|
920
|
+
t11 = () => {
|
|
921
|
+
if (!hasSpeechAdapter) speechController.dispose();
|
|
922
|
+
};
|
|
923
|
+
t12 = [hasSpeechAdapter, speechController];
|
|
924
|
+
$[11] = hasSpeechAdapter;
|
|
925
|
+
$[12] = speechController;
|
|
926
|
+
$[13] = t11;
|
|
927
|
+
$[14] = t12;
|
|
928
|
+
} else {
|
|
929
|
+
t11 = $[13];
|
|
930
|
+
t12 = $[14];
|
|
931
|
+
}
|
|
932
|
+
useEffect(t11, t12);
|
|
933
|
+
let t13;
|
|
934
|
+
let t14;
|
|
935
|
+
if ($[15] !== speechController) {
|
|
936
|
+
t13 = () => () => speechController.dispose();
|
|
937
|
+
t14 = [speechController];
|
|
938
|
+
$[15] = speechController;
|
|
939
|
+
$[16] = t13;
|
|
940
|
+
$[17] = t14;
|
|
941
|
+
} else {
|
|
942
|
+
t13 = $[16];
|
|
943
|
+
t14 = $[17];
|
|
944
|
+
}
|
|
945
|
+
useEffect(t13, t14);
|
|
946
|
+
let t15;
|
|
947
|
+
if ($[18] !== speechAdapter || $[19] !== speechController) {
|
|
948
|
+
t15 = (message_0) => {
|
|
949
|
+
if (!speechAdapter) throw new Error("Speech adapter not configured");
|
|
950
|
+
speechController.speak(speechAdapter, message_0);
|
|
951
|
+
};
|
|
952
|
+
$[18] = speechAdapter;
|
|
953
|
+
$[19] = speechController;
|
|
954
|
+
$[20] = t15;
|
|
955
|
+
} else t15 = $[20];
|
|
956
|
+
const handleSpeak = t15;
|
|
957
|
+
let t16;
|
|
958
|
+
if ($[21] !== messages || $[22] !== onReload) {
|
|
959
|
+
t16 = (messageId) => {
|
|
960
|
+
const messageIndex = messages.findIndex((m_0) => m_0.id === messageId);
|
|
780
961
|
if (messageIndex === -1) return;
|
|
781
962
|
const parentId = messageIndex > 0 ? messages[messageIndex - 1].id : null;
|
|
782
963
|
onReload?.(parentId);
|
|
783
964
|
};
|
|
784
|
-
$[
|
|
785
|
-
$[
|
|
786
|
-
$[
|
|
787
|
-
} else
|
|
788
|
-
const handleReload =
|
|
789
|
-
let
|
|
790
|
-
if ($[
|
|
791
|
-
|
|
965
|
+
$[21] = messages;
|
|
966
|
+
$[22] = onReload;
|
|
967
|
+
$[23] = t16;
|
|
968
|
+
} else t16 = $[23];
|
|
969
|
+
const handleReload = t16;
|
|
970
|
+
let t17;
|
|
971
|
+
if ($[24] !== attachmentAdapter || $[25] !== branches || $[26] !== feedbackFor || $[27] !== handleReload || $[28] !== handleSpeak || $[29] !== handleSubmitFeedback || $[30] !== messages || $[31] !== onAddToolResult || $[32] !== onEdit || $[33] !== onRespondToToolApproval || $[34] !== onResumeToolCall || $[35] !== queue || $[36] !== speech || $[37] !== speechController) {
|
|
972
|
+
t17 = messages.map((msg_1, index) => {
|
|
792
973
|
const props = {
|
|
793
|
-
message:
|
|
974
|
+
message: msg_1,
|
|
794
975
|
index,
|
|
795
976
|
parentId: index > 0 ? messages[index - 1].id : null,
|
|
796
|
-
onReload: () => handleReload(
|
|
977
|
+
onReload: () => handleReload(msg_1.id),
|
|
797
978
|
queue,
|
|
798
979
|
branches,
|
|
799
980
|
onRespondToToolApproval,
|
|
800
981
|
onAddToolResult,
|
|
801
982
|
onResumeToolCall,
|
|
802
|
-
attachmentAdapter
|
|
983
|
+
attachmentAdapter,
|
|
984
|
+
submittedFeedback: feedbackFor(msg_1),
|
|
985
|
+
onSubmitFeedback: (feedback) => handleSubmitFeedback(msg_1, feedback),
|
|
986
|
+
speech: speech?.messageId === msg_1.id ? speech : void 0,
|
|
987
|
+
onSpeak: () => handleSpeak(msg_1),
|
|
988
|
+
onStopSpeaking: () => speechController.stopMessage(msg_1.id)
|
|
803
989
|
};
|
|
804
990
|
if (onEdit) props.onEdit = onEdit;
|
|
805
|
-
return withKey(
|
|
991
|
+
return withKey(msg_1.id, MessageClient(props));
|
|
806
992
|
});
|
|
807
|
-
$[
|
|
808
|
-
$[
|
|
809
|
-
$[
|
|
810
|
-
$[
|
|
811
|
-
$[
|
|
812
|
-
$[
|
|
813
|
-
$[
|
|
814
|
-
$[
|
|
815
|
-
$[
|
|
816
|
-
$[
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
993
|
+
$[24] = attachmentAdapter;
|
|
994
|
+
$[25] = branches;
|
|
995
|
+
$[26] = feedbackFor;
|
|
996
|
+
$[27] = handleReload;
|
|
997
|
+
$[28] = handleSpeak;
|
|
998
|
+
$[29] = handleSubmitFeedback;
|
|
999
|
+
$[30] = messages;
|
|
1000
|
+
$[31] = onAddToolResult;
|
|
1001
|
+
$[32] = onEdit;
|
|
1002
|
+
$[33] = onRespondToToolApproval;
|
|
1003
|
+
$[34] = onResumeToolCall;
|
|
1004
|
+
$[35] = queue;
|
|
1005
|
+
$[36] = speech;
|
|
1006
|
+
$[37] = speechController;
|
|
1007
|
+
$[38] = t17;
|
|
1008
|
+
} else t17 = $[38];
|
|
1009
|
+
const messageClients = useClientLookup(t17);
|
|
1010
|
+
let t18;
|
|
1011
|
+
if ($[39] !== onCancel) {
|
|
1012
|
+
t18 = () => {
|
|
822
1013
|
onCancel?.();
|
|
823
1014
|
};
|
|
824
|
-
$[
|
|
825
|
-
$[
|
|
826
|
-
} else
|
|
827
|
-
const handleCancelRun =
|
|
828
|
-
let
|
|
829
|
-
if ($[
|
|
830
|
-
|
|
1015
|
+
$[39] = onCancel;
|
|
1016
|
+
$[40] = t18;
|
|
1017
|
+
} else t18 = $[40];
|
|
1018
|
+
const handleCancelRun = t18;
|
|
1019
|
+
let t19;
|
|
1020
|
+
if ($[41] !== messages || $[42] !== onNew) {
|
|
1021
|
+
t19 = (message_1) => {
|
|
831
1022
|
onNew?.({
|
|
832
|
-
...
|
|
1023
|
+
...message_1,
|
|
833
1024
|
parentId: messages.at(-1)?.id ?? null
|
|
834
1025
|
});
|
|
835
1026
|
};
|
|
836
|
-
$[
|
|
837
|
-
$[
|
|
838
|
-
$[
|
|
839
|
-
} else
|
|
840
|
-
const handleSendNew =
|
|
841
|
-
let
|
|
842
|
-
if ($[
|
|
843
|
-
|
|
844
|
-
$[
|
|
845
|
-
$[
|
|
846
|
-
} else
|
|
847
|
-
const headId =
|
|
848
|
-
let
|
|
849
|
-
if ($[
|
|
850
|
-
|
|
1027
|
+
$[41] = messages;
|
|
1028
|
+
$[42] = onNew;
|
|
1029
|
+
$[43] = t19;
|
|
1030
|
+
} else t19 = $[43];
|
|
1031
|
+
const handleSendNew = t19;
|
|
1032
|
+
let t20;
|
|
1033
|
+
if ($[44] !== messages) {
|
|
1034
|
+
t20 = messages.at(-1)?.id ?? null;
|
|
1035
|
+
$[44] = messages;
|
|
1036
|
+
$[45] = t20;
|
|
1037
|
+
} else t20 = $[45];
|
|
1038
|
+
const headId = t20;
|
|
1039
|
+
let t21;
|
|
1040
|
+
if ($[46] !== headId || $[47] !== queue) {
|
|
1041
|
+
t21 = queue && {
|
|
851
1042
|
...queue,
|
|
852
|
-
enqueue: (
|
|
853
|
-
...
|
|
854
|
-
parentId:
|
|
1043
|
+
enqueue: (message_2) => queue.enqueue({
|
|
1044
|
+
...message_2,
|
|
1045
|
+
parentId: message_2.parentId ?? headId
|
|
855
1046
|
}),
|
|
856
|
-
steer: (
|
|
857
|
-
...
|
|
858
|
-
parentId:
|
|
1047
|
+
steer: (message_3) => queue.steer({
|
|
1048
|
+
...message_3,
|
|
1049
|
+
parentId: message_3.parentId ?? headId
|
|
859
1050
|
})
|
|
860
1051
|
};
|
|
861
|
-
$[
|
|
862
|
-
$[
|
|
863
|
-
$[
|
|
864
|
-
} else
|
|
865
|
-
const composerQueue =
|
|
866
|
-
let
|
|
867
|
-
if ($[
|
|
868
|
-
|
|
1052
|
+
$[46] = headId;
|
|
1053
|
+
$[47] = queue;
|
|
1054
|
+
$[48] = t21;
|
|
1055
|
+
} else t21 = $[48];
|
|
1056
|
+
const composerQueue = t21;
|
|
1057
|
+
let t22;
|
|
1058
|
+
if ($[49] !== attachmentAdapter || $[50] !== composerQueue || $[51] !== handleCancelRun || $[52] !== handleSendNew || $[53] !== isRunning || $[54] !== isSendDisabled) {
|
|
1059
|
+
t22 = ComposerClientResource({
|
|
869
1060
|
type: "thread",
|
|
870
1061
|
isEditing: true,
|
|
871
1062
|
canCancel: isRunning,
|
|
@@ -875,39 +1066,41 @@ const useExternalThread = (t0) => {
|
|
|
875
1066
|
queue: composerQueue,
|
|
876
1067
|
attachmentAdapter
|
|
877
1068
|
});
|
|
878
|
-
$[
|
|
879
|
-
$[
|
|
880
|
-
$[
|
|
881
|
-
$[
|
|
882
|
-
$[
|
|
883
|
-
$[
|
|
884
|
-
$[
|
|
885
|
-
} else
|
|
886
|
-
const composerClient = useClientResource(
|
|
1069
|
+
$[49] = attachmentAdapter;
|
|
1070
|
+
$[50] = composerQueue;
|
|
1071
|
+
$[51] = handleCancelRun;
|
|
1072
|
+
$[52] = handleSendNew;
|
|
1073
|
+
$[53] = isRunning;
|
|
1074
|
+
$[54] = isSendDisabled;
|
|
1075
|
+
$[55] = t22;
|
|
1076
|
+
} else t22 = $[55];
|
|
1077
|
+
const composerClient = useClientResource(t22);
|
|
887
1078
|
const hasQueue = !!queue;
|
|
888
1079
|
const hasBranches = !!branches;
|
|
889
1080
|
const hasEdit = !!onEdit;
|
|
890
1081
|
const hasReload = !!onReload;
|
|
891
1082
|
const hasAttachments = !!attachmentAdapter;
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
1083
|
+
const hasFeedback = !!feedbackAdapter;
|
|
1084
|
+
const hasSpeech = !!speechAdapter;
|
|
1085
|
+
let t23;
|
|
1086
|
+
if ($[56] !== messageClients.state) {
|
|
1087
|
+
t23 = messageClients.state.map(_temp9);
|
|
1088
|
+
$[56] = messageClients.state;
|
|
1089
|
+
$[57] = t23;
|
|
1090
|
+
} else t23 = $[57];
|
|
1091
|
+
const messageStates = t23;
|
|
1092
|
+
const t24 = messages.length === 0;
|
|
1093
|
+
let t25;
|
|
1094
|
+
if ($[58] !== hasAttachments || $[59] !== hasBranches || $[60] !== hasEdit || $[61] !== hasFeedback || $[62] !== hasQueue || $[63] !== hasReload || $[64] !== hasSpeech || $[65] !== isRunning) {
|
|
1095
|
+
t25 = {
|
|
903
1096
|
edit: hasEdit,
|
|
904
1097
|
delete: false,
|
|
905
1098
|
reload: hasReload,
|
|
906
1099
|
refetchThread: false,
|
|
907
1100
|
cancel: isRunning,
|
|
908
|
-
speech:
|
|
1101
|
+
speech: hasSpeech,
|
|
909
1102
|
attachments: hasAttachments,
|
|
910
|
-
feedback:
|
|
1103
|
+
feedback: hasFeedback,
|
|
911
1104
|
voice: false,
|
|
912
1105
|
switchToBranch: hasBranches,
|
|
913
1106
|
switchBranchDuringRun: false,
|
|
@@ -915,68 +1108,71 @@ const useExternalThread = (t0) => {
|
|
|
915
1108
|
dictation: false,
|
|
916
1109
|
queue: hasQueue
|
|
917
1110
|
};
|
|
918
|
-
$[
|
|
919
|
-
$[
|
|
920
|
-
$[
|
|
921
|
-
$[
|
|
922
|
-
$[
|
|
923
|
-
$[
|
|
924
|
-
$[
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
1111
|
+
$[58] = hasAttachments;
|
|
1112
|
+
$[59] = hasBranches;
|
|
1113
|
+
$[60] = hasEdit;
|
|
1114
|
+
$[61] = hasFeedback;
|
|
1115
|
+
$[62] = hasQueue;
|
|
1116
|
+
$[63] = hasReload;
|
|
1117
|
+
$[64] = hasSpeech;
|
|
1118
|
+
$[65] = isRunning;
|
|
1119
|
+
$[66] = t25;
|
|
1120
|
+
} else t25 = $[66];
|
|
1121
|
+
let t26;
|
|
1122
|
+
if ($[67] !== threadState) {
|
|
1123
|
+
t26 = threadState ?? {};
|
|
1124
|
+
$[67] = threadState;
|
|
1125
|
+
$[68] = t26;
|
|
1126
|
+
} else t26 = $[68];
|
|
1127
|
+
let t27;
|
|
1128
|
+
if ($[69] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1129
|
+
t27 = [];
|
|
1130
|
+
$[69] = t27;
|
|
1131
|
+
} else t27 = $[69];
|
|
1132
|
+
let t28;
|
|
1133
|
+
if ($[70] !== composerClient.state || $[71] !== extras || $[72] !== isLoading || $[73] !== isRunning || $[74] !== messageStates || $[75] !== speech || $[76] !== t24 || $[77] !== t25 || $[78] !== t26) {
|
|
1134
|
+
t28 = {
|
|
1135
|
+
isEmpty: t24,
|
|
941
1136
|
isDisabled: false,
|
|
942
1137
|
isLoading,
|
|
943
1138
|
isRunning,
|
|
944
|
-
capabilities:
|
|
1139
|
+
capabilities: t25,
|
|
945
1140
|
messages: messageStates,
|
|
946
|
-
state:
|
|
947
|
-
suggestions:
|
|
1141
|
+
state: t26,
|
|
1142
|
+
suggestions: t27,
|
|
948
1143
|
extras,
|
|
949
|
-
speech
|
|
1144
|
+
speech,
|
|
950
1145
|
voice: void 0,
|
|
951
1146
|
composer: composerClient.state
|
|
952
1147
|
};
|
|
953
|
-
$[
|
|
954
|
-
$[
|
|
955
|
-
$[
|
|
956
|
-
$[
|
|
957
|
-
$[
|
|
958
|
-
$[
|
|
959
|
-
$[
|
|
960
|
-
$[
|
|
961
|
-
$[
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
$[
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
$[
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1148
|
+
$[70] = composerClient.state;
|
|
1149
|
+
$[71] = extras;
|
|
1150
|
+
$[72] = isLoading;
|
|
1151
|
+
$[73] = isRunning;
|
|
1152
|
+
$[74] = messageStates;
|
|
1153
|
+
$[75] = speech;
|
|
1154
|
+
$[76] = t24;
|
|
1155
|
+
$[77] = t25;
|
|
1156
|
+
$[78] = t26;
|
|
1157
|
+
$[79] = t28;
|
|
1158
|
+
} else t28 = $[79];
|
|
1159
|
+
const state = t28;
|
|
1160
|
+
let t29;
|
|
1161
|
+
if ($[80] !== state) {
|
|
1162
|
+
t29 = () => state;
|
|
1163
|
+
$[80] = state;
|
|
1164
|
+
$[81] = t29;
|
|
1165
|
+
} else t29 = $[81];
|
|
1166
|
+
let t30;
|
|
1167
|
+
if ($[82] !== composerClient.methods) {
|
|
1168
|
+
t30 = () => composerClient.methods;
|
|
1169
|
+
$[82] = composerClient.methods;
|
|
1170
|
+
$[83] = t30;
|
|
1171
|
+
} else t30 = $[83];
|
|
1172
|
+
let t31;
|
|
1173
|
+
if ($[84] !== messages || $[85] !== onNew || $[86] !== queue) {
|
|
1174
|
+
t31 = (message_4) => {
|
|
1175
|
+
const appendMessage = typeof message_4 === "string" ? {
|
|
980
1176
|
createdAt: /* @__PURE__ */ new Date(),
|
|
981
1177
|
parentId: messages.at(-1)?.id ?? null,
|
|
982
1178
|
sourceId: null,
|
|
@@ -984,99 +1180,100 @@ const useExternalThread = (t0) => {
|
|
|
984
1180
|
role: "user",
|
|
985
1181
|
content: [{
|
|
986
1182
|
type: "text",
|
|
987
|
-
text:
|
|
1183
|
+
text: message_4
|
|
988
1184
|
}],
|
|
989
1185
|
attachments: [],
|
|
990
1186
|
metadata: { custom: {} }
|
|
991
1187
|
} : {
|
|
992
|
-
createdAt:
|
|
993
|
-
parentId:
|
|
994
|
-
sourceId:
|
|
995
|
-
role:
|
|
996
|
-
content:
|
|
997
|
-
attachments:
|
|
998
|
-
metadata:
|
|
999
|
-
runConfig:
|
|
1000
|
-
startRun:
|
|
1188
|
+
createdAt: message_4.createdAt ?? /* @__PURE__ */ new Date(),
|
|
1189
|
+
parentId: message_4.parentId ?? messages.at(-1)?.id ?? null,
|
|
1190
|
+
sourceId: message_4.sourceId ?? null,
|
|
1191
|
+
role: message_4.role ?? "user",
|
|
1192
|
+
content: message_4.content,
|
|
1193
|
+
attachments: message_4.attachments ?? [],
|
|
1194
|
+
metadata: message_4.metadata ?? { custom: {} },
|
|
1195
|
+
runConfig: message_4.runConfig ?? {},
|
|
1196
|
+
startRun: message_4.startRun
|
|
1001
1197
|
};
|
|
1002
1198
|
if (queue) queue.enqueue(appendMessage);
|
|
1003
1199
|
else onNew?.(appendMessage);
|
|
1004
1200
|
};
|
|
1005
|
-
$[
|
|
1006
|
-
$[
|
|
1007
|
-
$[
|
|
1008
|
-
$[
|
|
1009
|
-
} else
|
|
1010
|
-
let
|
|
1011
|
-
if ($[
|
|
1012
|
-
|
|
1201
|
+
$[84] = messages;
|
|
1202
|
+
$[85] = onNew;
|
|
1203
|
+
$[86] = queue;
|
|
1204
|
+
$[87] = t31;
|
|
1205
|
+
} else t31 = $[87];
|
|
1206
|
+
let t32;
|
|
1207
|
+
if ($[88] !== onStartRun) {
|
|
1208
|
+
t32 = () => {
|
|
1013
1209
|
onStartRun?.();
|
|
1014
1210
|
};
|
|
1015
|
-
$[
|
|
1016
|
-
$[
|
|
1017
|
-
} else
|
|
1018
|
-
let
|
|
1019
|
-
if ($[
|
|
1020
|
-
|
|
1211
|
+
$[88] = onStartRun;
|
|
1212
|
+
$[89] = t32;
|
|
1213
|
+
} else t32 = $[89];
|
|
1214
|
+
let t33;
|
|
1215
|
+
if ($[90] !== onResume) {
|
|
1216
|
+
t33 = () => {
|
|
1021
1217
|
if (!onResume) throw new Error("Runtime does not support resuming runs (onResume is not set).");
|
|
1022
1218
|
onResume();
|
|
1023
1219
|
};
|
|
1024
|
-
$[
|
|
1025
|
-
$[
|
|
1026
|
-
} else
|
|
1027
|
-
let
|
|
1028
|
-
if ($[
|
|
1029
|
-
|
|
1220
|
+
$[90] = onResume;
|
|
1221
|
+
$[91] = t33;
|
|
1222
|
+
} else t33 = $[91];
|
|
1223
|
+
let t34;
|
|
1224
|
+
if ($[92] !== onLoadExternalState) {
|
|
1225
|
+
t34 = (state_0) => {
|
|
1030
1226
|
if (!onLoadExternalState) throw new Error("Runtime does not support importing external states (onLoadExternalState is not set).");
|
|
1031
1227
|
onLoadExternalState(state_0);
|
|
1032
1228
|
};
|
|
1033
|
-
$[
|
|
1034
|
-
$[
|
|
1035
|
-
} else
|
|
1036
|
-
let
|
|
1037
|
-
if ($[
|
|
1038
|
-
|
|
1229
|
+
$[92] = onLoadExternalState;
|
|
1230
|
+
$[93] = t34;
|
|
1231
|
+
} else t34 = $[93];
|
|
1232
|
+
let t35;
|
|
1233
|
+
if ($[94] !== messageClients) {
|
|
1234
|
+
t35 = (selector) => {
|
|
1039
1235
|
if ("id" in selector) return messageClients.get({ key: selector.id });
|
|
1040
1236
|
return messageClients.get(selector);
|
|
1041
1237
|
};
|
|
1042
|
-
$[
|
|
1043
|
-
$[
|
|
1044
|
-
} else
|
|
1045
|
-
let
|
|
1046
|
-
if ($[
|
|
1047
|
-
|
|
1048
|
-
getState:
|
|
1049
|
-
composer:
|
|
1050
|
-
append:
|
|
1051
|
-
deleteMessage:
|
|
1052
|
-
startRun:
|
|
1053
|
-
resumeRun:
|
|
1238
|
+
$[94] = messageClients;
|
|
1239
|
+
$[95] = t35;
|
|
1240
|
+
} else t35 = $[95];
|
|
1241
|
+
let t36;
|
|
1242
|
+
if ($[96] !== handleCancelRun || $[97] !== speechController.stop || $[98] !== t29 || $[99] !== t30 || $[100] !== t31 || $[101] !== t32 || $[102] !== t33 || $[103] !== t34 || $[104] !== t35) {
|
|
1243
|
+
t36 = {
|
|
1244
|
+
getState: t29,
|
|
1245
|
+
composer: t30,
|
|
1246
|
+
append: t31,
|
|
1247
|
+
deleteMessage: _temp0,
|
|
1248
|
+
startRun: t32,
|
|
1249
|
+
resumeRun: t33,
|
|
1054
1250
|
cancelRun: handleCancelRun,
|
|
1055
|
-
importExternalState:
|
|
1056
|
-
getModelContext:
|
|
1057
|
-
export:
|
|
1058
|
-
import:
|
|
1059
|
-
reset:
|
|
1060
|
-
message:
|
|
1061
|
-
stopSpeaking:
|
|
1062
|
-
connectVoice:
|
|
1063
|
-
disconnectVoice:
|
|
1064
|
-
getVoiceVolume:
|
|
1065
|
-
subscribeVoiceVolume:
|
|
1066
|
-
muteVoice:
|
|
1067
|
-
unmuteVoice:
|
|
1251
|
+
importExternalState: t34,
|
|
1252
|
+
getModelContext: _temp1,
|
|
1253
|
+
export: _temp10,
|
|
1254
|
+
import: _temp11,
|
|
1255
|
+
reset: _temp12,
|
|
1256
|
+
message: t35,
|
|
1257
|
+
stopSpeaking: speechController.stop,
|
|
1258
|
+
connectVoice: _temp13,
|
|
1259
|
+
disconnectVoice: _temp14,
|
|
1260
|
+
getVoiceVolume: _temp15,
|
|
1261
|
+
subscribeVoiceVolume: _temp17,
|
|
1262
|
+
muteVoice: _temp18,
|
|
1263
|
+
unmuteVoice: _temp19
|
|
1068
1264
|
};
|
|
1069
|
-
$[
|
|
1070
|
-
$[
|
|
1071
|
-
$[
|
|
1072
|
-
$[
|
|
1073
|
-
$[
|
|
1074
|
-
$[
|
|
1075
|
-
$[
|
|
1076
|
-
$[
|
|
1077
|
-
$[
|
|
1078
|
-
|
|
1079
|
-
|
|
1265
|
+
$[96] = handleCancelRun;
|
|
1266
|
+
$[97] = speechController.stop;
|
|
1267
|
+
$[98] = t29;
|
|
1268
|
+
$[99] = t30;
|
|
1269
|
+
$[100] = t31;
|
|
1270
|
+
$[101] = t32;
|
|
1271
|
+
$[102] = t33;
|
|
1272
|
+
$[103] = t34;
|
|
1273
|
+
$[104] = t35;
|
|
1274
|
+
$[105] = t36;
|
|
1275
|
+
} else t36 = $[105];
|
|
1276
|
+
return t36;
|
|
1080
1277
|
};
|
|
1081
1278
|
const ExternalThread = resource(useExternalThread);
|
|
1082
1279
|
attachTransformScopes(useExternalThread, (scopes, parent) => {
|
|
@@ -1113,50 +1310,46 @@ function _temp2(attachment) {
|
|
|
1113
1310
|
}));
|
|
1114
1311
|
}
|
|
1115
1312
|
function _temp3() {}
|
|
1116
|
-
function _temp4() {
|
|
1117
|
-
function _temp5() {}
|
|
1118
|
-
function _temp6() {}
|
|
1119
|
-
function _temp7(part) {
|
|
1313
|
+
function _temp4(part) {
|
|
1120
1314
|
return part.type === "text";
|
|
1121
1315
|
}
|
|
1122
|
-
function
|
|
1316
|
+
function _temp5(part_0) {
|
|
1123
1317
|
return "text" in part_0 ? part_0.text : "";
|
|
1124
1318
|
}
|
|
1125
|
-
function
|
|
1319
|
+
function _temp6(a_0) {
|
|
1126
1320
|
return a_0.status.type !== "complete";
|
|
1127
1321
|
}
|
|
1128
|
-
function
|
|
1129
|
-
function
|
|
1130
|
-
function
|
|
1322
|
+
function _temp7() {}
|
|
1323
|
+
function _temp8() {}
|
|
1324
|
+
function _temp9(s, idx, arr) {
|
|
1131
1325
|
return {
|
|
1132
1326
|
...s,
|
|
1133
1327
|
isLast: idx === arr.length - 1
|
|
1134
1328
|
};
|
|
1135
1329
|
}
|
|
1136
|
-
function
|
|
1137
|
-
function
|
|
1330
|
+
function _temp0() {}
|
|
1331
|
+
function _temp1() {
|
|
1138
1332
|
return {
|
|
1139
1333
|
tools: {},
|
|
1140
1334
|
config: {}
|
|
1141
1335
|
};
|
|
1142
1336
|
}
|
|
1143
|
-
function
|
|
1337
|
+
function _temp10() {
|
|
1144
1338
|
return { messages: [] };
|
|
1145
1339
|
}
|
|
1340
|
+
function _temp11() {}
|
|
1341
|
+
function _temp12() {}
|
|
1342
|
+
function _temp13() {}
|
|
1146
1343
|
function _temp14() {}
|
|
1147
|
-
function _temp15() {
|
|
1148
|
-
function _temp16() {}
|
|
1149
|
-
function _temp17() {}
|
|
1150
|
-
function _temp18() {}
|
|
1151
|
-
function _temp19() {
|
|
1344
|
+
function _temp15() {
|
|
1152
1345
|
return 0;
|
|
1153
1346
|
}
|
|
1154
|
-
function
|
|
1155
|
-
function
|
|
1156
|
-
return
|
|
1347
|
+
function _temp16() {}
|
|
1348
|
+
function _temp17() {
|
|
1349
|
+
return _temp16;
|
|
1157
1350
|
}
|
|
1158
|
-
function
|
|
1159
|
-
function
|
|
1351
|
+
function _temp18() {}
|
|
1352
|
+
function _temp19() {}
|
|
1160
1353
|
//#endregion
|
|
1161
1354
|
export { ExternalThread };
|
|
1162
1355
|
|