@assistant-ui/react 0.15.4 → 0.15.5
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 +383 -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/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 +6 -6
- package/src/client/ExternalThread.ts +28 -16
- 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/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 +9 -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
|
@@ -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(99);
|
|
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) {
|
|
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) 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,74 @@ 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] = t19;
|
|
693
|
+
} else t19 = $[80];
|
|
694
|
+
let t20;
|
|
695
|
+
if ($[81] !== onBeginEdit) {
|
|
696
|
+
t20 = () => {
|
|
685
697
|
onBeginEdit?.();
|
|
686
698
|
};
|
|
687
|
-
$[
|
|
688
|
-
$[
|
|
689
|
-
} else
|
|
699
|
+
$[81] = onBeginEdit;
|
|
700
|
+
$[82] = t20;
|
|
701
|
+
} else t20 = $[82];
|
|
702
|
+
let t21;
|
|
703
|
+
if ($[83] !== queueItemClients) {
|
|
704
|
+
t21 = (selector_0) => {
|
|
705
|
+
if ("id" in selector_0) return queueItemClients.get({ key: selector_0.id });
|
|
706
|
+
return queueItemClients.get(selector_0);
|
|
707
|
+
};
|
|
708
|
+
$[83] = queueItemClients;
|
|
709
|
+
$[84] = t21;
|
|
710
|
+
} else t21 = $[84];
|
|
690
711
|
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,
|
|
712
|
+
if ($[85] !== onCancel || $[86] !== setQuote || $[87] !== setRole || $[88] !== setRunConfig || $[89] !== setText || $[90] !== t14 || $[91] !== t15 || $[92] !== t16 || $[93] !== t17 || $[94] !== t18 || $[95] !== t19 || $[96] !== t20 || $[97] !== t21) {
|
|
713
|
+
t22 = {
|
|
714
|
+
getState: t14,
|
|
700
715
|
setText,
|
|
701
716
|
setRole,
|
|
702
717
|
setRunConfig,
|
|
703
|
-
addAttachment:
|
|
704
|
-
clearAttachments:
|
|
705
|
-
attachment:
|
|
706
|
-
reset:
|
|
707
|
-
send:
|
|
718
|
+
addAttachment: t15,
|
|
719
|
+
clearAttachments: t16,
|
|
720
|
+
attachment: t17,
|
|
721
|
+
reset: t18,
|
|
722
|
+
send: t19,
|
|
708
723
|
cancel: onCancel,
|
|
709
|
-
beginEdit:
|
|
724
|
+
beginEdit: t20,
|
|
710
725
|
startDictation: _temp0,
|
|
711
726
|
stopDictation: _temp1,
|
|
712
727
|
setQuote,
|
|
713
|
-
queueItem:
|
|
728
|
+
queueItem: t21
|
|
714
729
|
};
|
|
715
|
-
$[
|
|
716
|
-
$[
|
|
717
|
-
$[
|
|
718
|
-
$[
|
|
719
|
-
$[
|
|
720
|
-
$[
|
|
721
|
-
$[
|
|
722
|
-
$[
|
|
723
|
-
$[
|
|
724
|
-
$[
|
|
725
|
-
$[
|
|
726
|
-
$[
|
|
727
|
-
$[
|
|
728
|
-
$[
|
|
729
|
-
} else
|
|
730
|
-
return
|
|
730
|
+
$[85] = onCancel;
|
|
731
|
+
$[86] = setQuote;
|
|
732
|
+
$[87] = setRole;
|
|
733
|
+
$[88] = setRunConfig;
|
|
734
|
+
$[89] = setText;
|
|
735
|
+
$[90] = t14;
|
|
736
|
+
$[91] = t15;
|
|
737
|
+
$[92] = t16;
|
|
738
|
+
$[93] = t17;
|
|
739
|
+
$[94] = t18;
|
|
740
|
+
$[95] = t19;
|
|
741
|
+
$[96] = t20;
|
|
742
|
+
$[97] = t21;
|
|
743
|
+
$[98] = t22;
|
|
744
|
+
} else t22 = $[98];
|
|
745
|
+
return t22;
|
|
731
746
|
};
|
|
732
747
|
const ComposerClientResource = resource(useComposerClientResource);
|
|
733
748
|
const dedupeMessagesById = (messages) => {
|
|
@@ -745,7 +760,7 @@ const dedupeMessagesById = (messages) => {
|
|
|
745
760
|
return deduped.length === messages.length ? messages : deduped.reverse();
|
|
746
761
|
};
|
|
747
762
|
const useExternalThread = (t0) => {
|
|
748
|
-
const $ = c(
|
|
763
|
+
const $ = c(78);
|
|
749
764
|
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
765
|
const isRunning = t1 === void 0 ? false : t1;
|
|
751
766
|
const isLoading = t2 === void 0 ? false : t2;
|
|
@@ -758,22 +773,20 @@ const useExternalThread = (t0) => {
|
|
|
758
773
|
} else t4 = $[1];
|
|
759
774
|
const messages = t4;
|
|
760
775
|
let t5;
|
|
761
|
-
if ($[2] !== messages || $[3] !== onReload
|
|
776
|
+
if ($[2] !== messages || $[3] !== onReload) {
|
|
762
777
|
t5 = (messageId) => {
|
|
763
778
|
const messageIndex = messages.findIndex((m) => m.id === messageId);
|
|
764
779
|
if (messageIndex === -1) return;
|
|
765
780
|
const parentId = messageIndex > 0 ? messages[messageIndex - 1].id : null;
|
|
766
|
-
queue?.clear("reload");
|
|
767
781
|
onReload?.(parentId);
|
|
768
782
|
};
|
|
769
783
|
$[2] = messages;
|
|
770
784
|
$[3] = onReload;
|
|
771
|
-
$[4] =
|
|
772
|
-
|
|
773
|
-
} else t5 = $[5];
|
|
785
|
+
$[4] = t5;
|
|
786
|
+
} else t5 = $[4];
|
|
774
787
|
const handleReload = t5;
|
|
775
788
|
let t6;
|
|
776
|
-
if ($[
|
|
789
|
+
if ($[5] !== attachmentAdapter || $[6] !== branches || $[7] !== handleReload || $[8] !== messages || $[9] !== onAddToolResult || $[10] !== onEdit || $[11] !== onRespondToToolApproval || $[12] !== onResumeToolCall || $[13] !== queue) {
|
|
777
790
|
t6 = messages.map((msg, index) => {
|
|
778
791
|
const props = {
|
|
779
792
|
message: msg,
|
|
@@ -790,65 +803,67 @@ const useExternalThread = (t0) => {
|
|
|
790
803
|
if (onEdit) props.onEdit = onEdit;
|
|
791
804
|
return withKey(msg.id, MessageClient(props));
|
|
792
805
|
});
|
|
793
|
-
$[
|
|
794
|
-
$[
|
|
795
|
-
$[
|
|
796
|
-
$[
|
|
797
|
-
$[
|
|
798
|
-
$[
|
|
799
|
-
$[
|
|
800
|
-
$[
|
|
801
|
-
$[
|
|
802
|
-
$[
|
|
803
|
-
} else t6 = $[
|
|
806
|
+
$[5] = attachmentAdapter;
|
|
807
|
+
$[6] = branches;
|
|
808
|
+
$[7] = handleReload;
|
|
809
|
+
$[8] = messages;
|
|
810
|
+
$[9] = onAddToolResult;
|
|
811
|
+
$[10] = onEdit;
|
|
812
|
+
$[11] = onRespondToToolApproval;
|
|
813
|
+
$[12] = onResumeToolCall;
|
|
814
|
+
$[13] = queue;
|
|
815
|
+
$[14] = t6;
|
|
816
|
+
} else t6 = $[14];
|
|
804
817
|
const messageClients = useClientLookup(t6);
|
|
805
818
|
let t7;
|
|
806
|
-
if ($[
|
|
819
|
+
if ($[15] !== onCancel) {
|
|
807
820
|
t7 = () => {
|
|
808
|
-
queue?.clear("cancel-run");
|
|
809
821
|
onCancel?.();
|
|
810
822
|
};
|
|
811
|
-
$[
|
|
812
|
-
$[
|
|
813
|
-
|
|
814
|
-
} else t7 = $[18];
|
|
823
|
+
$[15] = onCancel;
|
|
824
|
+
$[16] = t7;
|
|
825
|
+
} else t7 = $[16];
|
|
815
826
|
const handleCancelRun = t7;
|
|
816
827
|
let t8;
|
|
817
|
-
if ($[
|
|
828
|
+
if ($[17] !== messages || $[18] !== onNew) {
|
|
818
829
|
t8 = (message) => {
|
|
819
830
|
onNew?.({
|
|
820
831
|
...message,
|
|
821
832
|
parentId: messages.at(-1)?.id ?? null
|
|
822
833
|
});
|
|
823
834
|
};
|
|
824
|
-
$[
|
|
825
|
-
$[
|
|
826
|
-
$[
|
|
827
|
-
} else t8 = $[
|
|
835
|
+
$[17] = messages;
|
|
836
|
+
$[18] = onNew;
|
|
837
|
+
$[19] = t8;
|
|
838
|
+
} else t8 = $[19];
|
|
828
839
|
const handleSendNew = t8;
|
|
829
840
|
let t9;
|
|
830
|
-
if ($[
|
|
841
|
+
if ($[20] !== messages) {
|
|
831
842
|
t9 = messages.at(-1)?.id ?? null;
|
|
832
|
-
$[
|
|
833
|
-
$[
|
|
834
|
-
} else t9 = $[
|
|
843
|
+
$[20] = messages;
|
|
844
|
+
$[21] = t9;
|
|
845
|
+
} else t9 = $[21];
|
|
835
846
|
const headId = t9;
|
|
836
847
|
let t10;
|
|
837
|
-
if ($[
|
|
848
|
+
if ($[22] !== headId || $[23] !== queue) {
|
|
838
849
|
t10 = queue && {
|
|
839
850
|
...queue,
|
|
840
|
-
enqueue: (message_0
|
|
851
|
+
enqueue: (message_0) => queue.enqueue({
|
|
841
852
|
...message_0,
|
|
842
853
|
parentId: message_0.parentId ?? headId
|
|
843
|
-
},
|
|
854
|
+
}),
|
|
855
|
+
steer: (message_1) => queue.steer({
|
|
856
|
+
...message_1,
|
|
857
|
+
parentId: message_1.parentId ?? headId
|
|
858
|
+
})
|
|
844
859
|
};
|
|
845
|
-
$[
|
|
846
|
-
$[
|
|
847
|
-
$[
|
|
848
|
-
} else t10 = $[
|
|
860
|
+
$[22] = headId;
|
|
861
|
+
$[23] = queue;
|
|
862
|
+
$[24] = t10;
|
|
863
|
+
} else t10 = $[24];
|
|
849
864
|
const composerQueue = t10;
|
|
850
865
|
let t11;
|
|
851
|
-
if ($[
|
|
866
|
+
if ($[25] !== attachmentAdapter || $[26] !== composerQueue || $[27] !== handleCancelRun || $[28] !== handleSendNew || $[29] !== isRunning || $[30] !== isSendDisabled) {
|
|
852
867
|
t11 = ComposerClientResource({
|
|
853
868
|
type: "thread",
|
|
854
869
|
isEditing: true,
|
|
@@ -859,14 +874,14 @@ const useExternalThread = (t0) => {
|
|
|
859
874
|
queue: composerQueue,
|
|
860
875
|
attachmentAdapter
|
|
861
876
|
});
|
|
862
|
-
$[
|
|
863
|
-
$[
|
|
864
|
-
$[
|
|
865
|
-
$[
|
|
866
|
-
$[
|
|
867
|
-
$[
|
|
868
|
-
$[
|
|
869
|
-
} else t11 = $[
|
|
877
|
+
$[25] = attachmentAdapter;
|
|
878
|
+
$[26] = composerQueue;
|
|
879
|
+
$[27] = handleCancelRun;
|
|
880
|
+
$[28] = handleSendNew;
|
|
881
|
+
$[29] = isRunning;
|
|
882
|
+
$[30] = isSendDisabled;
|
|
883
|
+
$[31] = t11;
|
|
884
|
+
} else t11 = $[31];
|
|
870
885
|
const composerClient = useClientResource(t11);
|
|
871
886
|
const hasQueue = !!queue;
|
|
872
887
|
const hasBranches = !!branches;
|
|
@@ -874,15 +889,15 @@ const useExternalThread = (t0) => {
|
|
|
874
889
|
const hasReload = !!onReload;
|
|
875
890
|
const hasAttachments = !!attachmentAdapter;
|
|
876
891
|
let t12;
|
|
877
|
-
if ($[
|
|
892
|
+
if ($[32] !== messageClients.state) {
|
|
878
893
|
t12 = messageClients.state.map(_temp10);
|
|
879
|
-
$[
|
|
880
|
-
$[
|
|
881
|
-
} else t12 = $[
|
|
894
|
+
$[32] = messageClients.state;
|
|
895
|
+
$[33] = t12;
|
|
896
|
+
} else t12 = $[33];
|
|
882
897
|
const messageStates = t12;
|
|
883
898
|
const t13 = messages.length === 0;
|
|
884
899
|
let t14;
|
|
885
|
-
if ($[
|
|
900
|
+
if ($[34] !== hasAttachments || $[35] !== hasBranches || $[36] !== hasEdit || $[37] !== hasQueue || $[38] !== hasReload || $[39] !== isRunning) {
|
|
886
901
|
t14 = {
|
|
887
902
|
edit: hasEdit,
|
|
888
903
|
delete: false,
|
|
@@ -899,27 +914,27 @@ const useExternalThread = (t0) => {
|
|
|
899
914
|
dictation: false,
|
|
900
915
|
queue: hasQueue
|
|
901
916
|
};
|
|
902
|
-
$[
|
|
903
|
-
$[
|
|
904
|
-
$[
|
|
905
|
-
$[
|
|
906
|
-
$[
|
|
907
|
-
$[
|
|
908
|
-
$[
|
|
909
|
-
} else t14 = $[
|
|
917
|
+
$[34] = hasAttachments;
|
|
918
|
+
$[35] = hasBranches;
|
|
919
|
+
$[36] = hasEdit;
|
|
920
|
+
$[37] = hasQueue;
|
|
921
|
+
$[38] = hasReload;
|
|
922
|
+
$[39] = isRunning;
|
|
923
|
+
$[40] = t14;
|
|
924
|
+
} else t14 = $[40];
|
|
910
925
|
let t15;
|
|
911
|
-
if ($[
|
|
926
|
+
if ($[41] !== threadState) {
|
|
912
927
|
t15 = threadState ?? {};
|
|
913
|
-
$[
|
|
914
|
-
$[
|
|
915
|
-
} else t15 = $[
|
|
928
|
+
$[41] = threadState;
|
|
929
|
+
$[42] = t15;
|
|
930
|
+
} else t15 = $[42];
|
|
916
931
|
let t16;
|
|
917
|
-
if ($[
|
|
932
|
+
if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
|
|
918
933
|
t16 = [];
|
|
919
|
-
$[
|
|
920
|
-
} else t16 = $[
|
|
934
|
+
$[43] = t16;
|
|
935
|
+
} else t16 = $[43];
|
|
921
936
|
let t17;
|
|
922
|
-
if ($[
|
|
937
|
+
if ($[44] !== composerClient.state || $[45] !== extras || $[46] !== isLoading || $[47] !== isRunning || $[48] !== messageStates || $[49] !== t13 || $[50] !== t14 || $[51] !== t15) {
|
|
923
938
|
t17 = {
|
|
924
939
|
isEmpty: t13,
|
|
925
940
|
isDisabled: false,
|
|
@@ -934,33 +949,33 @@ const useExternalThread = (t0) => {
|
|
|
934
949
|
voice: void 0,
|
|
935
950
|
composer: composerClient.state
|
|
936
951
|
};
|
|
937
|
-
$[
|
|
938
|
-
$[
|
|
939
|
-
$[
|
|
940
|
-
$[
|
|
941
|
-
$[
|
|
942
|
-
$[
|
|
943
|
-
$[
|
|
944
|
-
$[
|
|
945
|
-
$[
|
|
946
|
-
} else t17 = $[
|
|
952
|
+
$[44] = composerClient.state;
|
|
953
|
+
$[45] = extras;
|
|
954
|
+
$[46] = isLoading;
|
|
955
|
+
$[47] = isRunning;
|
|
956
|
+
$[48] = messageStates;
|
|
957
|
+
$[49] = t13;
|
|
958
|
+
$[50] = t14;
|
|
959
|
+
$[51] = t15;
|
|
960
|
+
$[52] = t17;
|
|
961
|
+
} else t17 = $[52];
|
|
947
962
|
const state = t17;
|
|
948
963
|
let t18;
|
|
949
|
-
if ($[
|
|
964
|
+
if ($[53] !== state) {
|
|
950
965
|
t18 = () => state;
|
|
951
|
-
$[
|
|
952
|
-
$[
|
|
953
|
-
} else t18 = $[
|
|
966
|
+
$[53] = state;
|
|
967
|
+
$[54] = t18;
|
|
968
|
+
} else t18 = $[54];
|
|
954
969
|
let t19;
|
|
955
|
-
if ($[
|
|
970
|
+
if ($[55] !== composerClient.methods) {
|
|
956
971
|
t19 = () => composerClient.methods;
|
|
957
|
-
$[
|
|
958
|
-
$[
|
|
959
|
-
} else t19 = $[
|
|
972
|
+
$[55] = composerClient.methods;
|
|
973
|
+
$[56] = t19;
|
|
974
|
+
} else t19 = $[56];
|
|
960
975
|
let t20;
|
|
961
|
-
if ($[
|
|
962
|
-
t20 = (
|
|
963
|
-
const appendMessage = typeof
|
|
976
|
+
if ($[57] !== messages || $[58] !== onNew || $[59] !== queue) {
|
|
977
|
+
t20 = (message_2) => {
|
|
978
|
+
const appendMessage = typeof message_2 === "string" ? {
|
|
964
979
|
createdAt: /* @__PURE__ */ new Date(),
|
|
965
980
|
parentId: messages.at(-1)?.id ?? null,
|
|
966
981
|
sourceId: null,
|
|
@@ -968,66 +983,66 @@ const useExternalThread = (t0) => {
|
|
|
968
983
|
role: "user",
|
|
969
984
|
content: [{
|
|
970
985
|
type: "text",
|
|
971
|
-
text:
|
|
986
|
+
text: message_2
|
|
972
987
|
}],
|
|
973
988
|
attachments: [],
|
|
974
989
|
metadata: { custom: {} }
|
|
975
990
|
} : {
|
|
976
|
-
createdAt:
|
|
977
|
-
parentId:
|
|
978
|
-
sourceId:
|
|
979
|
-
role:
|
|
980
|
-
content:
|
|
981
|
-
attachments:
|
|
982
|
-
metadata:
|
|
983
|
-
runConfig:
|
|
984
|
-
startRun:
|
|
991
|
+
createdAt: message_2.createdAt ?? /* @__PURE__ */ new Date(),
|
|
992
|
+
parentId: message_2.parentId ?? messages.at(-1)?.id ?? null,
|
|
993
|
+
sourceId: message_2.sourceId ?? null,
|
|
994
|
+
role: message_2.role ?? "user",
|
|
995
|
+
content: message_2.content,
|
|
996
|
+
attachments: message_2.attachments ?? [],
|
|
997
|
+
metadata: message_2.metadata ?? { custom: {} },
|
|
998
|
+
runConfig: message_2.runConfig ?? {},
|
|
999
|
+
startRun: message_2.startRun
|
|
985
1000
|
};
|
|
986
|
-
if (queue) queue.enqueue(appendMessage
|
|
1001
|
+
if (queue) queue.enqueue(appendMessage);
|
|
987
1002
|
else onNew?.(appendMessage);
|
|
988
1003
|
};
|
|
989
|
-
$[
|
|
990
|
-
$[
|
|
991
|
-
$[
|
|
992
|
-
$[
|
|
993
|
-
} else t20 = $[
|
|
1004
|
+
$[57] = messages;
|
|
1005
|
+
$[58] = onNew;
|
|
1006
|
+
$[59] = queue;
|
|
1007
|
+
$[60] = t20;
|
|
1008
|
+
} else t20 = $[60];
|
|
994
1009
|
let t21;
|
|
995
|
-
if ($[
|
|
1010
|
+
if ($[61] !== onStartRun) {
|
|
996
1011
|
t21 = () => {
|
|
997
1012
|
onStartRun?.();
|
|
998
1013
|
};
|
|
999
|
-
$[
|
|
1000
|
-
$[
|
|
1001
|
-
} else t21 = $[
|
|
1014
|
+
$[61] = onStartRun;
|
|
1015
|
+
$[62] = t21;
|
|
1016
|
+
} else t21 = $[62];
|
|
1002
1017
|
let t22;
|
|
1003
|
-
if ($[
|
|
1018
|
+
if ($[63] !== onResume) {
|
|
1004
1019
|
t22 = () => {
|
|
1005
1020
|
if (!onResume) throw new Error("Runtime does not support resuming runs (onResume is not set).");
|
|
1006
1021
|
onResume();
|
|
1007
1022
|
};
|
|
1008
|
-
$[
|
|
1009
|
-
$[
|
|
1010
|
-
} else t22 = $[
|
|
1023
|
+
$[63] = onResume;
|
|
1024
|
+
$[64] = t22;
|
|
1025
|
+
} else t22 = $[64];
|
|
1011
1026
|
let t23;
|
|
1012
|
-
if ($[
|
|
1027
|
+
if ($[65] !== onLoadExternalState) {
|
|
1013
1028
|
t23 = (state_0) => {
|
|
1014
1029
|
if (!onLoadExternalState) throw new Error("Runtime does not support importing external states (onLoadExternalState is not set).");
|
|
1015
1030
|
onLoadExternalState(state_0);
|
|
1016
1031
|
};
|
|
1017
|
-
$[
|
|
1018
|
-
$[
|
|
1019
|
-
} else t23 = $[
|
|
1032
|
+
$[65] = onLoadExternalState;
|
|
1033
|
+
$[66] = t23;
|
|
1034
|
+
} else t23 = $[66];
|
|
1020
1035
|
let t24;
|
|
1021
|
-
if ($[
|
|
1036
|
+
if ($[67] !== messageClients) {
|
|
1022
1037
|
t24 = (selector) => {
|
|
1023
1038
|
if ("id" in selector) return messageClients.get({ key: selector.id });
|
|
1024
1039
|
return messageClients.get(selector);
|
|
1025
1040
|
};
|
|
1026
|
-
$[
|
|
1027
|
-
$[
|
|
1028
|
-
} else t24 = $[
|
|
1041
|
+
$[67] = messageClients;
|
|
1042
|
+
$[68] = t24;
|
|
1043
|
+
} else t24 = $[68];
|
|
1029
1044
|
let t25;
|
|
1030
|
-
if ($[
|
|
1045
|
+
if ($[69] !== handleCancelRun || $[70] !== t18 || $[71] !== t19 || $[72] !== t20 || $[73] !== t21 || $[74] !== t22 || $[75] !== t23 || $[76] !== t24) {
|
|
1031
1046
|
t25 = {
|
|
1032
1047
|
getState: t18,
|
|
1033
1048
|
composer: t19,
|
|
@@ -1050,16 +1065,16 @@ const useExternalThread = (t0) => {
|
|
|
1050
1065
|
muteVoice: _temp22,
|
|
1051
1066
|
unmuteVoice: _temp23
|
|
1052
1067
|
};
|
|
1053
|
-
$[
|
|
1054
|
-
$[
|
|
1055
|
-
$[
|
|
1056
|
-
$[
|
|
1057
|
-
$[
|
|
1058
|
-
$[
|
|
1059
|
-
$[
|
|
1060
|
-
$[
|
|
1061
|
-
$[
|
|
1062
|
-
} else t25 = $[
|
|
1068
|
+
$[69] = handleCancelRun;
|
|
1069
|
+
$[70] = t18;
|
|
1070
|
+
$[71] = t19;
|
|
1071
|
+
$[72] = t20;
|
|
1072
|
+
$[73] = t21;
|
|
1073
|
+
$[74] = t22;
|
|
1074
|
+
$[75] = t23;
|
|
1075
|
+
$[76] = t24;
|
|
1076
|
+
$[77] = t25;
|
|
1077
|
+
} else t25 = $[77];
|
|
1063
1078
|
return t25;
|
|
1064
1079
|
};
|
|
1065
1080
|
const ExternalThread = resource(useExternalThread);
|