@assistant-ui/react 0.15.4 → 0.15.7
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/client/ExternalThread.d.ts.map +1 -1
- package/dist/client/ExternalThread.js +384 -368
- package/dist/client/ExternalThread.js.map +1 -1
- package/dist/context/providers/MessageProvider.js +15 -34
- package/dist/context/providers/MessageProvider.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts +6 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/legacy-runtime/AssistantRuntimeProvider.js +10 -8
- package/dist/legacy-runtime/AssistantRuntimeProvider.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/runManager.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/runManager.js +8 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/runManager.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts +5 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts.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 +44 -3
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarExportMarkdown.js +1 -1
- package/dist/primitives/actionBar/ActionBarExportMarkdown.js.map +1 -1
- package/dist/primitives/attachment/AttachmentThumb.d.ts.map +1 -1
- package/dist/primitives/attachment/AttachmentThumb.js +17 -14
- package/dist/primitives/attachment/AttachmentThumb.js.map +1 -1
- package/dist/primitives/composer/ComposerAttachmentDropzone.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAttachmentDropzone.js +64 -50
- package/dist/primitives/composer/ComposerAttachmentDropzone.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +1 -0
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/queueItem/QueueItemText.d.ts.map +1 -1
- package/dist/primitives/queueItem/QueueItemText.js +10 -4
- package/dist/primitives/queueItem/QueueItemText.js.map +1 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.d.ts.map +1 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js +5 -4
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js.map +1 -1
- package/dist/utils/createActionButton.js +1 -1
- package/dist/utils/createActionButton.js.map +1 -1
- package/dist/utils/useToolArgsFieldStatus.d.ts +2 -2
- package/package.json +16 -14
- package/src/client/ExternalThread.ts +30 -17
- package/src/context/providers/MessageProvider.tsx +8 -6
- package/src/index.ts +5 -1
- package/src/legacy-runtime/AssistantRuntimeProvider.tsx +13 -3
- package/src/legacy-runtime/runtime-cores/assistant-transport/runManager.ts +14 -1
- package/src/legacy-runtime/runtime-cores/assistant-transport/transport-scheduling.test.ts +38 -0
- package/src/legacy-runtime/runtime-cores/assistant-transport/types.ts +5 -1
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransport.spec.md +7 -0
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.test.tsx +290 -0
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.ts +62 -1
- package/src/primitives/actionBar/ActionBarExportMarkdown.tsx +1 -1
- package/src/primitives/attachment/AttachmentThumb.test.tsx +70 -0
- package/src/primitives/attachment/AttachmentThumb.tsx +8 -4
- package/src/primitives/composer/ComposerAttachmentDropzone.test.tsx +103 -3
- package/src/primitives/composer/ComposerAttachmentDropzone.tsx +18 -3
- package/src/primitives/composer/ComposerInput.test.tsx +53 -2
- package/src/primitives/composer/ComposerInput.tsx +3 -0
- package/src/primitives/queueItem/QueueItemText.tsx +8 -2
- package/src/primitives/selectionToolbar/SelectionToolbarRoot.test.tsx +74 -0
- package/src/primitives/selectionToolbar/SelectionToolbarRoot.tsx +3 -3
- package/src/tests/external-thread-parity.test.tsx +52 -4
- package/src/tests/local-runtime-queue.test.tsx +199 -6
- package/src/utils/createActionButton.test.tsx +18 -0
- package/src/utils/createActionButton.tsx +1 -1
- package/LICENSE +0 -21
|
@@ -16,7 +16,7 @@ const derivePartStatus = (message, partIndex, part) => {
|
|
|
16
16
|
return toMessagePartStatus(message, partIndex, part);
|
|
17
17
|
};
|
|
18
18
|
const useMessageClient = (t0) => {
|
|
19
|
-
const $ = c(
|
|
19
|
+
const $ = c(64);
|
|
20
20
|
const { message, index, parentId, onEdit, onReload, queue, branches, onRespondToToolApproval, onAddToolResult, onResumeToolCall, attachmentAdapter } = t0;
|
|
21
21
|
const [isCopied, setIsCopied] = useState(false);
|
|
22
22
|
const [isHovering, setIsHovering] = useState(false);
|
|
@@ -68,9 +68,8 @@ const useMessageClient = (t0) => {
|
|
|
68
68
|
} else t5 = $[10];
|
|
69
69
|
const handleCancelEdit = t5;
|
|
70
70
|
let t6;
|
|
71
|
-
if ($[11] !== message.id || $[12] !== onEdit || $[13] !== parentId
|
|
71
|
+
if ($[11] !== message.id || $[12] !== onEdit || $[13] !== parentId) {
|
|
72
72
|
t6 = (msg) => {
|
|
73
|
-
queue?.clear("edit");
|
|
74
73
|
onEdit?.({
|
|
75
74
|
...msg,
|
|
76
75
|
parentId,
|
|
@@ -81,12 +80,11 @@ const useMessageClient = (t0) => {
|
|
|
81
80
|
$[11] = message.id;
|
|
82
81
|
$[12] = onEdit;
|
|
83
82
|
$[13] = parentId;
|
|
84
|
-
$[14] =
|
|
85
|
-
|
|
86
|
-
} else t6 = $[15];
|
|
83
|
+
$[14] = t6;
|
|
84
|
+
} else t6 = $[14];
|
|
87
85
|
const handleSendEdit = t6;
|
|
88
86
|
let t7;
|
|
89
|
-
if ($[
|
|
87
|
+
if ($[15] !== attachmentAdapter || $[16] !== handleSendEdit || $[17] !== isEditing || $[18] !== message || $[19] !== queue) {
|
|
90
88
|
t7 = ComposerClientResource({
|
|
91
89
|
type: "edit",
|
|
92
90
|
isEditing,
|
|
@@ -98,38 +96,38 @@ const useMessageClient = (t0) => {
|
|
|
98
96
|
queue,
|
|
99
97
|
attachmentAdapter
|
|
100
98
|
});
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
} else t7 = $[
|
|
99
|
+
$[15] = attachmentAdapter;
|
|
100
|
+
$[16] = handleSendEdit;
|
|
101
|
+
$[17] = isEditing;
|
|
102
|
+
$[18] = message;
|
|
103
|
+
$[19] = queue;
|
|
104
|
+
$[20] = t7;
|
|
105
|
+
} else t7 = $[20];
|
|
108
106
|
const composerClient = useClientResource(t7);
|
|
109
107
|
let branchIds;
|
|
110
108
|
let t8;
|
|
111
|
-
if ($[
|
|
109
|
+
if ($[21] !== branches || $[22] !== message.id) {
|
|
112
110
|
branchIds = branches?.getBranches(message.id) ?? EMPTY_BRANCH_IDS;
|
|
113
111
|
t8 = branchIds.indexOf(message.id);
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
112
|
+
$[21] = branches;
|
|
113
|
+
$[22] = message.id;
|
|
114
|
+
$[23] = branchIds;
|
|
115
|
+
$[24] = t8;
|
|
118
116
|
} else {
|
|
119
|
-
branchIds = $[
|
|
120
|
-
t8 = $[
|
|
117
|
+
branchIds = $[23];
|
|
118
|
+
t8 = $[24];
|
|
121
119
|
}
|
|
122
120
|
const branchIndex = t8;
|
|
123
121
|
const branchNumber = branchIndex === -1 ? 1 : branchIndex + 1;
|
|
124
122
|
const branchCount = branchIndex === -1 ? 1 : branchIds.length;
|
|
125
123
|
let t9;
|
|
126
|
-
if ($[
|
|
124
|
+
if ($[25] !== message.attachments) {
|
|
127
125
|
t9 = message.attachments ?? [];
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
} else t9 = $[
|
|
126
|
+
$[25] = message.attachments;
|
|
127
|
+
$[26] = t9;
|
|
128
|
+
} else t9 = $[26];
|
|
131
129
|
let t10;
|
|
132
|
-
if ($[
|
|
130
|
+
if ($[27] !== branchCount || $[28] !== branchNumber || $[29] !== composerClient.state || $[30] !== index || $[31] !== isCopied || $[32] !== isHovering || $[33] !== message || $[34] !== parentId || $[35] !== partClients.state || $[36] !== t9) {
|
|
133
131
|
t10 = {
|
|
134
132
|
...message,
|
|
135
133
|
attachments: t9,
|
|
@@ -144,81 +142,81 @@ const useMessageClient = (t0) => {
|
|
|
144
142
|
index,
|
|
145
143
|
composer: composerClient.state
|
|
146
144
|
};
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
} else t10 = $[
|
|
145
|
+
$[27] = branchCount;
|
|
146
|
+
$[28] = branchNumber;
|
|
147
|
+
$[29] = composerClient.state;
|
|
148
|
+
$[30] = index;
|
|
149
|
+
$[31] = isCopied;
|
|
150
|
+
$[32] = isHovering;
|
|
151
|
+
$[33] = message;
|
|
152
|
+
$[34] = parentId;
|
|
153
|
+
$[35] = partClients.state;
|
|
154
|
+
$[36] = t9;
|
|
155
|
+
$[37] = t10;
|
|
156
|
+
} else t10 = $[37];
|
|
159
157
|
const state = t10;
|
|
160
158
|
let t11;
|
|
161
|
-
if ($[
|
|
159
|
+
if ($[38] !== state) {
|
|
162
160
|
t11 = () => state;
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
} else t11 = $[
|
|
161
|
+
$[38] = state;
|
|
162
|
+
$[39] = t11;
|
|
163
|
+
} else t11 = $[39];
|
|
166
164
|
let t12;
|
|
167
|
-
if ($[
|
|
165
|
+
if ($[40] !== composerClient.methods) {
|
|
168
166
|
t12 = () => composerClient.methods;
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
} else t12 = $[
|
|
167
|
+
$[40] = composerClient.methods;
|
|
168
|
+
$[41] = t12;
|
|
169
|
+
} else t12 = $[41];
|
|
172
170
|
let t13;
|
|
173
|
-
if ($[
|
|
171
|
+
if ($[42] !== onReload) {
|
|
174
172
|
t13 = () => {
|
|
175
173
|
onReload?.();
|
|
176
174
|
};
|
|
177
|
-
$[
|
|
178
|
-
$[
|
|
179
|
-
} else t13 = $[
|
|
175
|
+
$[42] = onReload;
|
|
176
|
+
$[43] = t13;
|
|
177
|
+
} else t13 = $[43];
|
|
180
178
|
let t14;
|
|
181
|
-
if ($[
|
|
179
|
+
if ($[44] !== branchIds || $[45] !== branchIndex || $[46] !== branches || $[47] !== message.id) {
|
|
182
180
|
t14 = (t15) => {
|
|
183
181
|
const { position, branchId } = t15;
|
|
184
182
|
if (!branches) return;
|
|
185
183
|
const target = branchId ?? (branchIndex === -1 ? void 0 : position === "previous" ? branchIds[branchIndex - 1] : position === "next" ? branchIds[branchIndex + 1] : void 0);
|
|
186
184
|
if (target !== void 0 && target !== message.id) branches.switchToBranch(target);
|
|
187
185
|
};
|
|
188
|
-
$[
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
} else t14 = $[
|
|
186
|
+
$[44] = branchIds;
|
|
187
|
+
$[45] = branchIndex;
|
|
188
|
+
$[46] = branches;
|
|
189
|
+
$[47] = message.id;
|
|
190
|
+
$[48] = t14;
|
|
191
|
+
} else t14 = $[48];
|
|
194
192
|
let t15;
|
|
195
|
-
if ($[
|
|
193
|
+
if ($[49] !== message) {
|
|
196
194
|
t15 = () => getThreadMessageText(message);
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
} else t15 = $[
|
|
195
|
+
$[49] = message;
|
|
196
|
+
$[50] = t15;
|
|
197
|
+
} else t15 = $[50];
|
|
200
198
|
let t16;
|
|
201
|
-
if ($[
|
|
199
|
+
if ($[51] !== partClients || $[52] !== state) {
|
|
202
200
|
t16 = (selector) => {
|
|
203
201
|
if ("index" in selector) return partClients.get(selector);
|
|
204
202
|
const partIndex = state.parts.findIndex((p) => p.type === "tool-call" && p.toolCallId === selector.toolCallId);
|
|
205
203
|
return partClients.get({ index: partIndex });
|
|
206
204
|
};
|
|
207
|
-
$[
|
|
208
|
-
$[
|
|
209
|
-
$[
|
|
210
|
-
} else t16 = $[
|
|
205
|
+
$[51] = partClients;
|
|
206
|
+
$[52] = state;
|
|
207
|
+
$[53] = t16;
|
|
208
|
+
} else t16 = $[53];
|
|
211
209
|
let t17;
|
|
212
|
-
if ($[
|
|
210
|
+
if ($[54] !== attachmentClients) {
|
|
213
211
|
t17 = (selector_0) => {
|
|
214
212
|
if ("id" in selector_0) return attachmentClients.get({ key: selector_0.id });
|
|
215
213
|
return attachmentClients.get(selector_0);
|
|
216
214
|
};
|
|
217
|
-
$[
|
|
218
|
-
$[
|
|
219
|
-
} else t17 = $[
|
|
215
|
+
$[54] = attachmentClients;
|
|
216
|
+
$[55] = t17;
|
|
217
|
+
} else t17 = $[55];
|
|
220
218
|
let t18;
|
|
221
|
-
if ($[
|
|
219
|
+
if ($[56] !== t11 || $[57] !== t12 || $[58] !== t13 || $[59] !== t14 || $[60] !== t15 || $[61] !== t16 || $[62] !== t17) {
|
|
222
220
|
t18 = {
|
|
223
221
|
getState: t11,
|
|
224
222
|
composer: t12,
|
|
@@ -234,15 +232,15 @@ const useMessageClient = (t0) => {
|
|
|
234
232
|
setIsCopied,
|
|
235
233
|
setIsHovering
|
|
236
234
|
};
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
} else t18 = $[
|
|
235
|
+
$[56] = t11;
|
|
236
|
+
$[57] = t12;
|
|
237
|
+
$[58] = t13;
|
|
238
|
+
$[59] = t14;
|
|
239
|
+
$[60] = t15;
|
|
240
|
+
$[61] = t16;
|
|
241
|
+
$[62] = t17;
|
|
242
|
+
$[63] = t18;
|
|
243
|
+
} else t18 = $[63];
|
|
246
244
|
return t18;
|
|
247
245
|
};
|
|
248
246
|
const MessageClient = resource(useMessageClient);
|
|
@@ -340,10 +338,14 @@ const useAttachmentResource = ({ attachment, onRemove }) => {
|
|
|
340
338
|
};
|
|
341
339
|
};
|
|
342
340
|
const AttachmentResource = resource(useAttachmentResource);
|
|
343
|
-
const useQueueItemClient = ({ item,
|
|
341
|
+
const useQueueItemClient = ({ item, onMove, onRemove }) => {
|
|
344
342
|
return {
|
|
345
343
|
getState: () => item,
|
|
346
|
-
steer:
|
|
344
|
+
steer: () => onMove({
|
|
345
|
+
lane: "steer",
|
|
346
|
+
insertAfter: null
|
|
347
|
+
}),
|
|
348
|
+
move: onMove,
|
|
347
349
|
remove: onRemove
|
|
348
350
|
};
|
|
349
351
|
};
|
|
@@ -378,7 +380,7 @@ const useLiveState = (initial) => {
|
|
|
378
380
|
return t1;
|
|
379
381
|
};
|
|
380
382
|
const useComposerClientResource = (t0) => {
|
|
381
|
-
const $ = c(
|
|
383
|
+
const $ = c(100);
|
|
382
384
|
const { type, isEditing, canCancel, isSendDisabled: t1, onCancel, onBeginEdit, onSend, message, queue, attachmentAdapter } = t0;
|
|
383
385
|
const isSendDisabled = t1 === void 0 ? false : t1;
|
|
384
386
|
const [text, setText, textRef] = useLiveState("");
|
|
@@ -476,77 +478,85 @@ const useComposerClientResource = (t0) => {
|
|
|
476
478
|
$[22] = t9;
|
|
477
479
|
} else t9 = $[22];
|
|
478
480
|
const upsertAttachment = t9;
|
|
479
|
-
const
|
|
481
|
+
const steerItems = queue?.steerItems ?? EMPTY_QUEUE_ITEMS;
|
|
482
|
+
const laneItems = queue?.items ?? EMPTY_QUEUE_ITEMS;
|
|
480
483
|
let t10;
|
|
481
|
-
if ($[23] !==
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
item,
|
|
486
|
-
onSteer: () => queue?.steer(item.id),
|
|
487
|
-
onRemove: () => queue?.remove(item.id)
|
|
488
|
-
}));
|
|
489
|
-
$[26] = queue;
|
|
490
|
-
$[27] = t11;
|
|
491
|
-
} else t11 = $[27];
|
|
492
|
-
t10 = queueItems.map(t11);
|
|
493
|
-
$[23] = queue;
|
|
494
|
-
$[24] = queueItems;
|
|
484
|
+
if ($[23] !== laneItems || $[24] !== steerItems) {
|
|
485
|
+
t10 = steerItems.length === 0 ? laneItems : laneItems.length === 0 ? steerItems : [...steerItems, ...laneItems];
|
|
486
|
+
$[23] = laneItems;
|
|
487
|
+
$[24] = steerItems;
|
|
495
488
|
$[25] = t10;
|
|
496
489
|
} else t10 = $[25];
|
|
497
|
-
const
|
|
498
|
-
attachmentAdapter?.accept;
|
|
490
|
+
const queueItems = t10;
|
|
499
491
|
let t11;
|
|
500
|
-
if ($[
|
|
501
|
-
|
|
502
|
-
$[
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
isEmpty
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
492
|
+
if ($[26] !== queue || $[27] !== queueItems) {
|
|
493
|
+
let t12;
|
|
494
|
+
if ($[29] !== queue) {
|
|
495
|
+
t12 = (item) => withKey(item.id, QueueItemClient({
|
|
496
|
+
item,
|
|
497
|
+
onMove: (placement) => queue?.move(item.id, placement),
|
|
498
|
+
onRemove: () => queue?.remove(item.id)
|
|
499
|
+
}));
|
|
500
|
+
$[29] = queue;
|
|
501
|
+
$[30] = t12;
|
|
502
|
+
} else t12 = $[30];
|
|
503
|
+
t11 = queueItems.map(t12);
|
|
504
|
+
$[26] = queue;
|
|
505
|
+
$[27] = queueItems;
|
|
506
|
+
$[28] = t11;
|
|
507
|
+
} else t11 = $[28];
|
|
508
|
+
const queueItemClients = useClientLookup(t11);
|
|
509
|
+
let t12;
|
|
510
|
+
if ($[31] !== attachmentAdapter?.accept || $[32] !== attachmentClients.state || $[33] !== attachments.length || $[34] !== canCancel || $[35] !== isEditing || $[36] !== isSendDisabled || $[37] !== queueItems || $[38] !== quote || $[39] !== role || $[40] !== runConfig || $[41] !== text || $[42] !== type) {
|
|
511
|
+
t12 = () => {
|
|
512
|
+
const isEmpty = !text.trim() && !attachments.length;
|
|
513
|
+
return {
|
|
514
|
+
text,
|
|
515
|
+
role,
|
|
516
|
+
attachments: attachmentClients.state,
|
|
517
|
+
runConfig,
|
|
518
|
+
isEditing,
|
|
519
|
+
canCancel,
|
|
520
|
+
canSend: isEditing && !isEmpty && !isSendDisabled,
|
|
521
|
+
attachmentAccept: attachmentAdapter?.accept ?? "*",
|
|
522
|
+
isEmpty,
|
|
523
|
+
type,
|
|
524
|
+
dictation: void 0,
|
|
525
|
+
quote,
|
|
526
|
+
queue: queueItems
|
|
527
|
+
};
|
|
525
528
|
};
|
|
526
|
-
$[31] =
|
|
527
|
-
$[32] =
|
|
528
|
-
$[33] =
|
|
529
|
-
$[34] =
|
|
530
|
-
$[35] =
|
|
531
|
-
$[36] =
|
|
532
|
-
$[37] =
|
|
533
|
-
$[38] =
|
|
534
|
-
$[39] =
|
|
535
|
-
$[40] =
|
|
529
|
+
$[31] = attachmentAdapter?.accept;
|
|
530
|
+
$[32] = attachmentClients.state;
|
|
531
|
+
$[33] = attachments.length;
|
|
532
|
+
$[34] = canCancel;
|
|
533
|
+
$[35] = isEditing;
|
|
534
|
+
$[36] = isSendDisabled;
|
|
535
|
+
$[37] = queueItems;
|
|
536
|
+
$[38] = quote;
|
|
537
|
+
$[39] = role;
|
|
538
|
+
$[40] = runConfig;
|
|
536
539
|
$[41] = text;
|
|
537
540
|
$[42] = type;
|
|
538
|
-
$[43] =
|
|
539
|
-
} else
|
|
540
|
-
|
|
541
|
+
$[43] = t12;
|
|
542
|
+
} else t12 = $[43];
|
|
543
|
+
attachmentAdapter?.accept;
|
|
544
|
+
let t13;
|
|
545
|
+
if ($[44] !== t12) {
|
|
546
|
+
t13 = t12();
|
|
547
|
+
$[44] = t12;
|
|
548
|
+
$[45] = t13;
|
|
549
|
+
} else t13 = $[45];
|
|
550
|
+
const state = t13;
|
|
551
|
+
let t14;
|
|
552
|
+
if ($[46] !== state) {
|
|
553
|
+
t14 = () => state;
|
|
554
|
+
$[46] = state;
|
|
555
|
+
$[47] = t14;
|
|
556
|
+
} else t14 = $[47];
|
|
541
557
|
let t15;
|
|
542
|
-
if ($[
|
|
543
|
-
t15 = () =>
|
|
544
|
-
$[44] = state;
|
|
545
|
-
$[45] = t15;
|
|
546
|
-
} else t15 = $[45];
|
|
547
|
-
let t16;
|
|
548
|
-
if ($[46] !== attachmentAdapter || $[47] !== setAttachments || $[48] !== upsertAttachment) {
|
|
549
|
-
t16 = async (fileOrAttachment) => {
|
|
558
|
+
if ($[48] !== attachmentAdapter || $[49] !== setAttachments || $[50] !== upsertAttachment) {
|
|
559
|
+
t15 = async (fileOrAttachment) => {
|
|
550
560
|
if (attachmentAdapter) {
|
|
551
561
|
const file = isCreateAttachment(fileOrAttachment) ? {
|
|
552
562
|
name: fileOrAttachment.name,
|
|
@@ -581,35 +591,35 @@ const useComposerClientResource = (t0) => {
|
|
|
581
591
|
setAttachments((prev_2) => [...prev_2, newAttachment_0]);
|
|
582
592
|
}
|
|
583
593
|
};
|
|
584
|
-
$[
|
|
585
|
-
$[
|
|
586
|
-
$[
|
|
587
|
-
$[
|
|
588
|
-
} else
|
|
589
|
-
let
|
|
590
|
-
if ($[
|
|
591
|
-
|
|
594
|
+
$[48] = attachmentAdapter;
|
|
595
|
+
$[49] = setAttachments;
|
|
596
|
+
$[50] = upsertAttachment;
|
|
597
|
+
$[51] = t15;
|
|
598
|
+
} else t15 = $[51];
|
|
599
|
+
let t16;
|
|
600
|
+
if ($[52] !== attachmentsRef || $[53] !== removePendingAttachments || $[54] !== setAttachments) {
|
|
601
|
+
t16 = async () => {
|
|
592
602
|
const removed_0 = attachmentsRef.current;
|
|
593
603
|
setAttachments([]);
|
|
594
604
|
await removePendingAttachments(removed_0);
|
|
595
605
|
};
|
|
596
|
-
$[
|
|
597
|
-
$[
|
|
598
|
-
$[
|
|
599
|
-
$[
|
|
600
|
-
} else
|
|
601
|
-
let
|
|
602
|
-
if ($[
|
|
603
|
-
|
|
606
|
+
$[52] = attachmentsRef;
|
|
607
|
+
$[53] = removePendingAttachments;
|
|
608
|
+
$[54] = setAttachments;
|
|
609
|
+
$[55] = t16;
|
|
610
|
+
} else t16 = $[55];
|
|
611
|
+
let t17;
|
|
612
|
+
if ($[56] !== attachmentClients) {
|
|
613
|
+
t17 = (selector) => {
|
|
604
614
|
if ("id" in selector) return attachmentClients.get({ key: selector.id });
|
|
605
615
|
return attachmentClients.get(selector);
|
|
606
616
|
};
|
|
607
|
-
$[
|
|
608
|
-
$[
|
|
609
|
-
} else
|
|
610
|
-
let
|
|
611
|
-
if ($[
|
|
612
|
-
|
|
617
|
+
$[56] = attachmentClients;
|
|
618
|
+
$[57] = t17;
|
|
619
|
+
} else t17 = $[57];
|
|
620
|
+
let t18;
|
|
621
|
+
if ($[58] !== attachmentsRef || $[59] !== removePendingAttachments || $[60] !== setAttachments || $[61] !== setQuote || $[62] !== setRole || $[63] !== setRunConfig || $[64] !== setText) {
|
|
622
|
+
t18 = async () => {
|
|
613
623
|
const removed_1 = attachmentsRef.current;
|
|
614
624
|
setText("");
|
|
615
625
|
setRole("user");
|
|
@@ -618,18 +628,18 @@ const useComposerClientResource = (t0) => {
|
|
|
618
628
|
setQuote(void 0);
|
|
619
629
|
await removePendingAttachments(removed_1);
|
|
620
630
|
};
|
|
621
|
-
$[
|
|
622
|
-
$[
|
|
623
|
-
$[
|
|
624
|
-
$[
|
|
625
|
-
$[
|
|
626
|
-
$[
|
|
627
|
-
$[
|
|
628
|
-
$[
|
|
629
|
-
} else
|
|
630
|
-
let
|
|
631
|
-
if ($[
|
|
632
|
-
|
|
631
|
+
$[58] = attachmentsRef;
|
|
632
|
+
$[59] = removePendingAttachments;
|
|
633
|
+
$[60] = setAttachments;
|
|
634
|
+
$[61] = setQuote;
|
|
635
|
+
$[62] = setRole;
|
|
636
|
+
$[63] = setRunConfig;
|
|
637
|
+
$[64] = setText;
|
|
638
|
+
$[65] = t18;
|
|
639
|
+
} else t18 = $[65];
|
|
640
|
+
let t19;
|
|
641
|
+
if ($[66] !== attachmentAdapter || $[67] !== attachmentsRef || $[68] !== canCancel || $[69] !== isEditing || $[70] !== isSendDisabled || $[71] !== onSend || $[72] !== queue || $[73] !== quoteRef || $[74] !== roleRef || $[75] !== runConfigRef || $[76] !== setAttachments || $[77] !== setQuote || $[78] !== setText || $[79] !== textRef || $[80] !== type) {
|
|
642
|
+
t19 = (opts) => {
|
|
633
643
|
const currentQuote = quoteRef.current;
|
|
634
644
|
const currentText = textRef.current;
|
|
635
645
|
const currentAttachments = attachmentsRef.current;
|
|
@@ -653,7 +663,8 @@ const useComposerClientResource = (t0) => {
|
|
|
653
663
|
startRun: opts?.startRun,
|
|
654
664
|
metadata: { custom: { ...currentQuote ? { quote: currentQuote } : {} } }
|
|
655
665
|
};
|
|
656
|
-
if (queue
|
|
666
|
+
if (queue && type === "thread") if (opts?.steer ?? canCancel) queue.steer(composedMessage);
|
|
667
|
+
else queue.enqueue(composedMessage);
|
|
657
668
|
else onSend?.(composedMessage);
|
|
658
669
|
};
|
|
659
670
|
if (attachmentAdapter && currentAttachments.length > 0) Promise.all(currentAttachments.map((attachment_1) => attachment_1.status.type === "complete" ? attachment_1 : attachmentAdapter.send(attachment_1))).then(dispatch, (error) => {
|
|
@@ -664,70 +675,75 @@ const useComposerClientResource = (t0) => {
|
|
|
664
675
|
});
|
|
665
676
|
else dispatch(currentAttachments);
|
|
666
677
|
};
|
|
667
|
-
$[
|
|
668
|
-
$[
|
|
669
|
-
$[
|
|
670
|
-
$[
|
|
671
|
-
$[
|
|
672
|
-
$[
|
|
673
|
-
$[
|
|
674
|
-
$[
|
|
675
|
-
$[
|
|
676
|
-
$[
|
|
677
|
-
$[
|
|
678
|
-
$[
|
|
679
|
-
$[
|
|
680
|
-
$[
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
678
|
+
$[66] = attachmentAdapter;
|
|
679
|
+
$[67] = attachmentsRef;
|
|
680
|
+
$[68] = canCancel;
|
|
681
|
+
$[69] = isEditing;
|
|
682
|
+
$[70] = isSendDisabled;
|
|
683
|
+
$[71] = onSend;
|
|
684
|
+
$[72] = queue;
|
|
685
|
+
$[73] = quoteRef;
|
|
686
|
+
$[74] = roleRef;
|
|
687
|
+
$[75] = runConfigRef;
|
|
688
|
+
$[76] = setAttachments;
|
|
689
|
+
$[77] = setQuote;
|
|
690
|
+
$[78] = setText;
|
|
691
|
+
$[79] = textRef;
|
|
692
|
+
$[80] = type;
|
|
693
|
+
$[81] = t19;
|
|
694
|
+
} else t19 = $[81];
|
|
695
|
+
let t20;
|
|
696
|
+
if ($[82] !== onBeginEdit) {
|
|
697
|
+
t20 = () => {
|
|
685
698
|
onBeginEdit?.();
|
|
686
699
|
};
|
|
687
|
-
$[
|
|
688
|
-
$[
|
|
689
|
-
} else
|
|
700
|
+
$[82] = onBeginEdit;
|
|
701
|
+
$[83] = t20;
|
|
702
|
+
} else t20 = $[83];
|
|
703
|
+
let t21;
|
|
704
|
+
if ($[84] !== queueItemClients) {
|
|
705
|
+
t21 = (selector_0) => {
|
|
706
|
+
if ("id" in selector_0) return queueItemClients.get({ key: selector_0.id });
|
|
707
|
+
return queueItemClients.get(selector_0);
|
|
708
|
+
};
|
|
709
|
+
$[84] = queueItemClients;
|
|
710
|
+
$[85] = t21;
|
|
711
|
+
} else t21 = $[85];
|
|
690
712
|
let t22;
|
|
691
|
-
if ($[
|
|
692
|
-
t22 =
|
|
693
|
-
|
|
694
|
-
$[81] = t22;
|
|
695
|
-
} else t22 = $[81];
|
|
696
|
-
let t23;
|
|
697
|
-
if ($[82] !== onCancel || $[83] !== setQuote || $[84] !== setRole || $[85] !== setRunConfig || $[86] !== setText || $[87] !== t15 || $[88] !== t16 || $[89] !== t17 || $[90] !== t18 || $[91] !== t19 || $[92] !== t20 || $[93] !== t21 || $[94] !== t22) {
|
|
698
|
-
t23 = {
|
|
699
|
-
getState: t15,
|
|
713
|
+
if ($[86] !== onCancel || $[87] !== setQuote || $[88] !== setRole || $[89] !== setRunConfig || $[90] !== setText || $[91] !== t14 || $[92] !== t15 || $[93] !== t16 || $[94] !== t17 || $[95] !== t18 || $[96] !== t19 || $[97] !== t20 || $[98] !== t21) {
|
|
714
|
+
t22 = {
|
|
715
|
+
getState: t14,
|
|
700
716
|
setText,
|
|
701
717
|
setRole,
|
|
702
718
|
setRunConfig,
|
|
703
|
-
addAttachment:
|
|
704
|
-
clearAttachments:
|
|
705
|
-
attachment:
|
|
706
|
-
reset:
|
|
707
|
-
send:
|
|
719
|
+
addAttachment: t15,
|
|
720
|
+
clearAttachments: t16,
|
|
721
|
+
attachment: t17,
|
|
722
|
+
reset: t18,
|
|
723
|
+
send: t19,
|
|
708
724
|
cancel: onCancel,
|
|
709
|
-
beginEdit:
|
|
725
|
+
beginEdit: t20,
|
|
710
726
|
startDictation: _temp0,
|
|
711
727
|
stopDictation: _temp1,
|
|
712
728
|
setQuote,
|
|
713
|
-
queueItem:
|
|
729
|
+
queueItem: t21
|
|
714
730
|
};
|
|
715
|
-
$[
|
|
716
|
-
$[
|
|
717
|
-
$[
|
|
718
|
-
$[
|
|
719
|
-
$[
|
|
720
|
-
$[
|
|
721
|
-
$[
|
|
722
|
-
$[
|
|
723
|
-
$[
|
|
724
|
-
$[
|
|
725
|
-
$[
|
|
726
|
-
$[
|
|
727
|
-
$[
|
|
728
|
-
$[
|
|
729
|
-
} else
|
|
730
|
-
return
|
|
731
|
+
$[86] = onCancel;
|
|
732
|
+
$[87] = setQuote;
|
|
733
|
+
$[88] = setRole;
|
|
734
|
+
$[89] = setRunConfig;
|
|
735
|
+
$[90] = setText;
|
|
736
|
+
$[91] = t14;
|
|
737
|
+
$[92] = t15;
|
|
738
|
+
$[93] = t16;
|
|
739
|
+
$[94] = t17;
|
|
740
|
+
$[95] = t18;
|
|
741
|
+
$[96] = t19;
|
|
742
|
+
$[97] = t20;
|
|
743
|
+
$[98] = t21;
|
|
744
|
+
$[99] = t22;
|
|
745
|
+
} else t22 = $[99];
|
|
746
|
+
return t22;
|
|
731
747
|
};
|
|
732
748
|
const ComposerClientResource = resource(useComposerClientResource);
|
|
733
749
|
const dedupeMessagesById = (messages) => {
|
|
@@ -745,7 +761,7 @@ const dedupeMessagesById = (messages) => {
|
|
|
745
761
|
return deduped.length === messages.length ? messages : deduped.reverse();
|
|
746
762
|
};
|
|
747
763
|
const useExternalThread = (t0) => {
|
|
748
|
-
const $ = c(
|
|
764
|
+
const $ = c(78);
|
|
749
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;
|
|
750
766
|
const isRunning = t1 === void 0 ? false : t1;
|
|
751
767
|
const isLoading = t2 === void 0 ? false : t2;
|
|
@@ -758,22 +774,20 @@ const useExternalThread = (t0) => {
|
|
|
758
774
|
} else t4 = $[1];
|
|
759
775
|
const messages = t4;
|
|
760
776
|
let t5;
|
|
761
|
-
if ($[2] !== messages || $[3] !== onReload
|
|
777
|
+
if ($[2] !== messages || $[3] !== onReload) {
|
|
762
778
|
t5 = (messageId) => {
|
|
763
779
|
const messageIndex = messages.findIndex((m) => m.id === messageId);
|
|
764
780
|
if (messageIndex === -1) return;
|
|
765
781
|
const parentId = messageIndex > 0 ? messages[messageIndex - 1].id : null;
|
|
766
|
-
queue?.clear("reload");
|
|
767
782
|
onReload?.(parentId);
|
|
768
783
|
};
|
|
769
784
|
$[2] = messages;
|
|
770
785
|
$[3] = onReload;
|
|
771
|
-
$[4] =
|
|
772
|
-
|
|
773
|
-
} else t5 = $[5];
|
|
786
|
+
$[4] = t5;
|
|
787
|
+
} else t5 = $[4];
|
|
774
788
|
const handleReload = t5;
|
|
775
789
|
let t6;
|
|
776
|
-
if ($[
|
|
790
|
+
if ($[5] !== attachmentAdapter || $[6] !== branches || $[7] !== handleReload || $[8] !== messages || $[9] !== onAddToolResult || $[10] !== onEdit || $[11] !== onRespondToToolApproval || $[12] !== onResumeToolCall || $[13] !== queue) {
|
|
777
791
|
t6 = messages.map((msg, index) => {
|
|
778
792
|
const props = {
|
|
779
793
|
message: msg,
|
|
@@ -790,65 +804,67 @@ const useExternalThread = (t0) => {
|
|
|
790
804
|
if (onEdit) props.onEdit = onEdit;
|
|
791
805
|
return withKey(msg.id, MessageClient(props));
|
|
792
806
|
});
|
|
793
|
-
$[
|
|
794
|
-
$[
|
|
795
|
-
$[
|
|
796
|
-
$[
|
|
797
|
-
$[
|
|
798
|
-
$[
|
|
799
|
-
$[
|
|
800
|
-
$[
|
|
801
|
-
$[
|
|
802
|
-
$[
|
|
803
|
-
} else t6 = $[
|
|
807
|
+
$[5] = attachmentAdapter;
|
|
808
|
+
$[6] = branches;
|
|
809
|
+
$[7] = handleReload;
|
|
810
|
+
$[8] = messages;
|
|
811
|
+
$[9] = onAddToolResult;
|
|
812
|
+
$[10] = onEdit;
|
|
813
|
+
$[11] = onRespondToToolApproval;
|
|
814
|
+
$[12] = onResumeToolCall;
|
|
815
|
+
$[13] = queue;
|
|
816
|
+
$[14] = t6;
|
|
817
|
+
} else t6 = $[14];
|
|
804
818
|
const messageClients = useClientLookup(t6);
|
|
805
819
|
let t7;
|
|
806
|
-
if ($[
|
|
820
|
+
if ($[15] !== onCancel) {
|
|
807
821
|
t7 = () => {
|
|
808
|
-
queue?.clear("cancel-run");
|
|
809
822
|
onCancel?.();
|
|
810
823
|
};
|
|
811
|
-
$[
|
|
812
|
-
$[
|
|
813
|
-
|
|
814
|
-
} else t7 = $[18];
|
|
824
|
+
$[15] = onCancel;
|
|
825
|
+
$[16] = t7;
|
|
826
|
+
} else t7 = $[16];
|
|
815
827
|
const handleCancelRun = t7;
|
|
816
828
|
let t8;
|
|
817
|
-
if ($[
|
|
829
|
+
if ($[17] !== messages || $[18] !== onNew) {
|
|
818
830
|
t8 = (message) => {
|
|
819
831
|
onNew?.({
|
|
820
832
|
...message,
|
|
821
833
|
parentId: messages.at(-1)?.id ?? null
|
|
822
834
|
});
|
|
823
835
|
};
|
|
824
|
-
$[
|
|
825
|
-
$[
|
|
826
|
-
$[
|
|
827
|
-
} else t8 = $[
|
|
836
|
+
$[17] = messages;
|
|
837
|
+
$[18] = onNew;
|
|
838
|
+
$[19] = t8;
|
|
839
|
+
} else t8 = $[19];
|
|
828
840
|
const handleSendNew = t8;
|
|
829
841
|
let t9;
|
|
830
|
-
if ($[
|
|
842
|
+
if ($[20] !== messages) {
|
|
831
843
|
t9 = messages.at(-1)?.id ?? null;
|
|
832
|
-
$[
|
|
833
|
-
$[
|
|
834
|
-
} else t9 = $[
|
|
844
|
+
$[20] = messages;
|
|
845
|
+
$[21] = t9;
|
|
846
|
+
} else t9 = $[21];
|
|
835
847
|
const headId = t9;
|
|
836
848
|
let t10;
|
|
837
|
-
if ($[
|
|
849
|
+
if ($[22] !== headId || $[23] !== queue) {
|
|
838
850
|
t10 = queue && {
|
|
839
851
|
...queue,
|
|
840
|
-
enqueue: (message_0
|
|
852
|
+
enqueue: (message_0) => queue.enqueue({
|
|
841
853
|
...message_0,
|
|
842
854
|
parentId: message_0.parentId ?? headId
|
|
843
|
-
},
|
|
855
|
+
}),
|
|
856
|
+
steer: (message_1) => queue.steer({
|
|
857
|
+
...message_1,
|
|
858
|
+
parentId: message_1.parentId ?? headId
|
|
859
|
+
})
|
|
844
860
|
};
|
|
845
|
-
$[
|
|
846
|
-
$[
|
|
847
|
-
$[
|
|
848
|
-
} else t10 = $[
|
|
861
|
+
$[22] = headId;
|
|
862
|
+
$[23] = queue;
|
|
863
|
+
$[24] = t10;
|
|
864
|
+
} else t10 = $[24];
|
|
849
865
|
const composerQueue = t10;
|
|
850
866
|
let t11;
|
|
851
|
-
if ($[
|
|
867
|
+
if ($[25] !== attachmentAdapter || $[26] !== composerQueue || $[27] !== handleCancelRun || $[28] !== handleSendNew || $[29] !== isRunning || $[30] !== isSendDisabled) {
|
|
852
868
|
t11 = ComposerClientResource({
|
|
853
869
|
type: "thread",
|
|
854
870
|
isEditing: true,
|
|
@@ -859,14 +875,14 @@ const useExternalThread = (t0) => {
|
|
|
859
875
|
queue: composerQueue,
|
|
860
876
|
attachmentAdapter
|
|
861
877
|
});
|
|
862
|
-
$[
|
|
863
|
-
$[
|
|
864
|
-
$[
|
|
865
|
-
$[
|
|
866
|
-
$[
|
|
867
|
-
$[
|
|
868
|
-
$[
|
|
869
|
-
} else t11 = $[
|
|
878
|
+
$[25] = attachmentAdapter;
|
|
879
|
+
$[26] = composerQueue;
|
|
880
|
+
$[27] = handleCancelRun;
|
|
881
|
+
$[28] = handleSendNew;
|
|
882
|
+
$[29] = isRunning;
|
|
883
|
+
$[30] = isSendDisabled;
|
|
884
|
+
$[31] = t11;
|
|
885
|
+
} else t11 = $[31];
|
|
870
886
|
const composerClient = useClientResource(t11);
|
|
871
887
|
const hasQueue = !!queue;
|
|
872
888
|
const hasBranches = !!branches;
|
|
@@ -874,15 +890,15 @@ const useExternalThread = (t0) => {
|
|
|
874
890
|
const hasReload = !!onReload;
|
|
875
891
|
const hasAttachments = !!attachmentAdapter;
|
|
876
892
|
let t12;
|
|
877
|
-
if ($[
|
|
893
|
+
if ($[32] !== messageClients.state) {
|
|
878
894
|
t12 = messageClients.state.map(_temp10);
|
|
879
|
-
$[
|
|
880
|
-
$[
|
|
881
|
-
} else t12 = $[
|
|
895
|
+
$[32] = messageClients.state;
|
|
896
|
+
$[33] = t12;
|
|
897
|
+
} else t12 = $[33];
|
|
882
898
|
const messageStates = t12;
|
|
883
899
|
const t13 = messages.length === 0;
|
|
884
900
|
let t14;
|
|
885
|
-
if ($[
|
|
901
|
+
if ($[34] !== hasAttachments || $[35] !== hasBranches || $[36] !== hasEdit || $[37] !== hasQueue || $[38] !== hasReload || $[39] !== isRunning) {
|
|
886
902
|
t14 = {
|
|
887
903
|
edit: hasEdit,
|
|
888
904
|
delete: false,
|
|
@@ -899,27 +915,27 @@ const useExternalThread = (t0) => {
|
|
|
899
915
|
dictation: false,
|
|
900
916
|
queue: hasQueue
|
|
901
917
|
};
|
|
902
|
-
$[
|
|
903
|
-
$[
|
|
904
|
-
$[
|
|
905
|
-
$[
|
|
906
|
-
$[
|
|
907
|
-
$[
|
|
908
|
-
$[
|
|
909
|
-
} else t14 = $[
|
|
918
|
+
$[34] = hasAttachments;
|
|
919
|
+
$[35] = hasBranches;
|
|
920
|
+
$[36] = hasEdit;
|
|
921
|
+
$[37] = hasQueue;
|
|
922
|
+
$[38] = hasReload;
|
|
923
|
+
$[39] = isRunning;
|
|
924
|
+
$[40] = t14;
|
|
925
|
+
} else t14 = $[40];
|
|
910
926
|
let t15;
|
|
911
|
-
if ($[
|
|
927
|
+
if ($[41] !== threadState) {
|
|
912
928
|
t15 = threadState ?? {};
|
|
913
|
-
$[
|
|
914
|
-
$[
|
|
915
|
-
} else t15 = $[
|
|
929
|
+
$[41] = threadState;
|
|
930
|
+
$[42] = t15;
|
|
931
|
+
} else t15 = $[42];
|
|
916
932
|
let t16;
|
|
917
|
-
if ($[
|
|
933
|
+
if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
|
|
918
934
|
t16 = [];
|
|
919
|
-
$[
|
|
920
|
-
} else t16 = $[
|
|
935
|
+
$[43] = t16;
|
|
936
|
+
} else t16 = $[43];
|
|
921
937
|
let t17;
|
|
922
|
-
if ($[
|
|
938
|
+
if ($[44] !== composerClient.state || $[45] !== extras || $[46] !== isLoading || $[47] !== isRunning || $[48] !== messageStates || $[49] !== t13 || $[50] !== t14 || $[51] !== t15) {
|
|
923
939
|
t17 = {
|
|
924
940
|
isEmpty: t13,
|
|
925
941
|
isDisabled: false,
|
|
@@ -934,33 +950,33 @@ const useExternalThread = (t0) => {
|
|
|
934
950
|
voice: void 0,
|
|
935
951
|
composer: composerClient.state
|
|
936
952
|
};
|
|
937
|
-
$[
|
|
938
|
-
$[
|
|
939
|
-
$[
|
|
940
|
-
$[
|
|
941
|
-
$[
|
|
942
|
-
$[
|
|
943
|
-
$[
|
|
944
|
-
$[
|
|
945
|
-
$[
|
|
946
|
-
} else t17 = $[
|
|
953
|
+
$[44] = composerClient.state;
|
|
954
|
+
$[45] = extras;
|
|
955
|
+
$[46] = isLoading;
|
|
956
|
+
$[47] = isRunning;
|
|
957
|
+
$[48] = messageStates;
|
|
958
|
+
$[49] = t13;
|
|
959
|
+
$[50] = t14;
|
|
960
|
+
$[51] = t15;
|
|
961
|
+
$[52] = t17;
|
|
962
|
+
} else t17 = $[52];
|
|
947
963
|
const state = t17;
|
|
948
964
|
let t18;
|
|
949
|
-
if ($[
|
|
965
|
+
if ($[53] !== state) {
|
|
950
966
|
t18 = () => state;
|
|
951
|
-
$[
|
|
952
|
-
$[
|
|
953
|
-
} else t18 = $[
|
|
967
|
+
$[53] = state;
|
|
968
|
+
$[54] = t18;
|
|
969
|
+
} else t18 = $[54];
|
|
954
970
|
let t19;
|
|
955
|
-
if ($[
|
|
971
|
+
if ($[55] !== composerClient.methods) {
|
|
956
972
|
t19 = () => composerClient.methods;
|
|
957
|
-
$[
|
|
958
|
-
$[
|
|
959
|
-
} else t19 = $[
|
|
973
|
+
$[55] = composerClient.methods;
|
|
974
|
+
$[56] = t19;
|
|
975
|
+
} else t19 = $[56];
|
|
960
976
|
let t20;
|
|
961
|
-
if ($[
|
|
962
|
-
t20 = (
|
|
963
|
-
const appendMessage = typeof
|
|
977
|
+
if ($[57] !== messages || $[58] !== onNew || $[59] !== queue) {
|
|
978
|
+
t20 = (message_2) => {
|
|
979
|
+
const appendMessage = typeof message_2 === "string" ? {
|
|
964
980
|
createdAt: /* @__PURE__ */ new Date(),
|
|
965
981
|
parentId: messages.at(-1)?.id ?? null,
|
|
966
982
|
sourceId: null,
|
|
@@ -968,66 +984,66 @@ const useExternalThread = (t0) => {
|
|
|
968
984
|
role: "user",
|
|
969
985
|
content: [{
|
|
970
986
|
type: "text",
|
|
971
|
-
text:
|
|
987
|
+
text: message_2
|
|
972
988
|
}],
|
|
973
989
|
attachments: [],
|
|
974
990
|
metadata: { custom: {} }
|
|
975
991
|
} : {
|
|
976
|
-
createdAt:
|
|
977
|
-
parentId:
|
|
978
|
-
sourceId:
|
|
979
|
-
role:
|
|
980
|
-
content:
|
|
981
|
-
attachments:
|
|
982
|
-
metadata:
|
|
983
|
-
runConfig:
|
|
984
|
-
startRun:
|
|
992
|
+
createdAt: message_2.createdAt ?? /* @__PURE__ */ new Date(),
|
|
993
|
+
parentId: message_2.parentId ?? messages.at(-1)?.id ?? null,
|
|
994
|
+
sourceId: message_2.sourceId ?? null,
|
|
995
|
+
role: message_2.role ?? "user",
|
|
996
|
+
content: message_2.content,
|
|
997
|
+
attachments: message_2.attachments ?? [],
|
|
998
|
+
metadata: message_2.metadata ?? { custom: {} },
|
|
999
|
+
runConfig: message_2.runConfig ?? {},
|
|
1000
|
+
startRun: message_2.startRun
|
|
985
1001
|
};
|
|
986
|
-
if (queue) queue.enqueue(appendMessage
|
|
1002
|
+
if (queue) queue.enqueue(appendMessage);
|
|
987
1003
|
else onNew?.(appendMessage);
|
|
988
1004
|
};
|
|
989
|
-
$[
|
|
990
|
-
$[
|
|
991
|
-
$[
|
|
992
|
-
$[
|
|
993
|
-
} else t20 = $[
|
|
1005
|
+
$[57] = messages;
|
|
1006
|
+
$[58] = onNew;
|
|
1007
|
+
$[59] = queue;
|
|
1008
|
+
$[60] = t20;
|
|
1009
|
+
} else t20 = $[60];
|
|
994
1010
|
let t21;
|
|
995
|
-
if ($[
|
|
1011
|
+
if ($[61] !== onStartRun) {
|
|
996
1012
|
t21 = () => {
|
|
997
1013
|
onStartRun?.();
|
|
998
1014
|
};
|
|
999
|
-
$[
|
|
1000
|
-
$[
|
|
1001
|
-
} else t21 = $[
|
|
1015
|
+
$[61] = onStartRun;
|
|
1016
|
+
$[62] = t21;
|
|
1017
|
+
} else t21 = $[62];
|
|
1002
1018
|
let t22;
|
|
1003
|
-
if ($[
|
|
1019
|
+
if ($[63] !== onResume) {
|
|
1004
1020
|
t22 = () => {
|
|
1005
1021
|
if (!onResume) throw new Error("Runtime does not support resuming runs (onResume is not set).");
|
|
1006
1022
|
onResume();
|
|
1007
1023
|
};
|
|
1008
|
-
$[
|
|
1009
|
-
$[
|
|
1010
|
-
} else t22 = $[
|
|
1024
|
+
$[63] = onResume;
|
|
1025
|
+
$[64] = t22;
|
|
1026
|
+
} else t22 = $[64];
|
|
1011
1027
|
let t23;
|
|
1012
|
-
if ($[
|
|
1028
|
+
if ($[65] !== onLoadExternalState) {
|
|
1013
1029
|
t23 = (state_0) => {
|
|
1014
1030
|
if (!onLoadExternalState) throw new Error("Runtime does not support importing external states (onLoadExternalState is not set).");
|
|
1015
1031
|
onLoadExternalState(state_0);
|
|
1016
1032
|
};
|
|
1017
|
-
$[
|
|
1018
|
-
$[
|
|
1019
|
-
} else t23 = $[
|
|
1033
|
+
$[65] = onLoadExternalState;
|
|
1034
|
+
$[66] = t23;
|
|
1035
|
+
} else t23 = $[66];
|
|
1020
1036
|
let t24;
|
|
1021
|
-
if ($[
|
|
1037
|
+
if ($[67] !== messageClients) {
|
|
1022
1038
|
t24 = (selector) => {
|
|
1023
1039
|
if ("id" in selector) return messageClients.get({ key: selector.id });
|
|
1024
1040
|
return messageClients.get(selector);
|
|
1025
1041
|
};
|
|
1026
|
-
$[
|
|
1027
|
-
$[
|
|
1028
|
-
} else t24 = $[
|
|
1042
|
+
$[67] = messageClients;
|
|
1043
|
+
$[68] = t24;
|
|
1044
|
+
} else t24 = $[68];
|
|
1029
1045
|
let t25;
|
|
1030
|
-
if ($[
|
|
1046
|
+
if ($[69] !== handleCancelRun || $[70] !== t18 || $[71] !== t19 || $[72] !== t20 || $[73] !== t21 || $[74] !== t22 || $[75] !== t23 || $[76] !== t24) {
|
|
1031
1047
|
t25 = {
|
|
1032
1048
|
getState: t18,
|
|
1033
1049
|
composer: t19,
|
|
@@ -1050,16 +1066,16 @@ const useExternalThread = (t0) => {
|
|
|
1050
1066
|
muteVoice: _temp22,
|
|
1051
1067
|
unmuteVoice: _temp23
|
|
1052
1068
|
};
|
|
1053
|
-
$[
|
|
1054
|
-
$[
|
|
1055
|
-
$[
|
|
1056
|
-
$[
|
|
1057
|
-
$[
|
|
1058
|
-
$[
|
|
1059
|
-
$[
|
|
1060
|
-
$[
|
|
1061
|
-
$[
|
|
1062
|
-
} else t25 = $[
|
|
1069
|
+
$[69] = handleCancelRun;
|
|
1070
|
+
$[70] = t18;
|
|
1071
|
+
$[71] = t19;
|
|
1072
|
+
$[72] = t20;
|
|
1073
|
+
$[73] = t21;
|
|
1074
|
+
$[74] = t22;
|
|
1075
|
+
$[75] = t23;
|
|
1076
|
+
$[76] = t24;
|
|
1077
|
+
$[77] = t25;
|
|
1078
|
+
} else t25 = $[77];
|
|
1063
1079
|
return t25;
|
|
1064
1080
|
};
|
|
1065
1081
|
const ExternalThread = resource(useExternalThread);
|