@assistant-ui/react 0.15.4 → 0.15.6

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.
Files changed (64) hide show
  1. package/dist/client/ExternalThread.d.ts.map +1 -1
  2. package/dist/client/ExternalThread.js +384 -368
  3. package/dist/client/ExternalThread.js.map +1 -1
  4. package/dist/context/providers/MessageProvider.js +15 -34
  5. package/dist/context/providers/MessageProvider.js.map +1 -1
  6. package/dist/index.d.ts +3 -3
  7. package/dist/index.js +2 -2
  8. package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts +6 -1
  9. package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts.map +1 -1
  10. package/dist/legacy-runtime/AssistantRuntimeProvider.js +10 -8
  11. package/dist/legacy-runtime/AssistantRuntimeProvider.js.map +1 -1
  12. package/dist/legacy-runtime/runtime-cores/assistant-transport/runManager.d.ts.map +1 -1
  13. package/dist/legacy-runtime/runtime-cores/assistant-transport/runManager.js +8 -1
  14. package/dist/legacy-runtime/runtime-cores/assistant-transport/runManager.js.map +1 -1
  15. package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts +5 -1
  16. package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts.map +1 -1
  17. package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -1
  18. package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js +44 -3
  19. package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
  20. package/dist/primitives/actionBar/ActionBarExportMarkdown.js +1 -1
  21. package/dist/primitives/actionBar/ActionBarExportMarkdown.js.map +1 -1
  22. package/dist/primitives/attachment/AttachmentThumb.d.ts.map +1 -1
  23. package/dist/primitives/attachment/AttachmentThumb.js +17 -14
  24. package/dist/primitives/attachment/AttachmentThumb.js.map +1 -1
  25. package/dist/primitives/composer/ComposerAttachmentDropzone.d.ts.map +1 -1
  26. package/dist/primitives/composer/ComposerAttachmentDropzone.js +64 -50
  27. package/dist/primitives/composer/ComposerAttachmentDropzone.js.map +1 -1
  28. package/dist/primitives/composer/ComposerInput.js +1 -0
  29. package/dist/primitives/composer/ComposerInput.js.map +1 -1
  30. package/dist/primitives/queueItem/QueueItemText.d.ts.map +1 -1
  31. package/dist/primitives/queueItem/QueueItemText.js +10 -4
  32. package/dist/primitives/queueItem/QueueItemText.js.map +1 -1
  33. package/dist/primitives/selectionToolbar/SelectionToolbarRoot.d.ts.map +1 -1
  34. package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js +5 -4
  35. package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js.map +1 -1
  36. package/dist/utils/createActionButton.js +1 -1
  37. package/dist/utils/createActionButton.js.map +1 -1
  38. package/dist/utils/useToolArgsFieldStatus.d.ts +2 -2
  39. package/package.json +16 -14
  40. package/src/client/ExternalThread.ts +30 -17
  41. package/src/context/providers/MessageProvider.tsx +8 -6
  42. package/src/index.ts +5 -1
  43. package/src/legacy-runtime/AssistantRuntimeProvider.tsx +13 -3
  44. package/src/legacy-runtime/runtime-cores/assistant-transport/runManager.ts +14 -1
  45. package/src/legacy-runtime/runtime-cores/assistant-transport/transport-scheduling.test.ts +38 -0
  46. package/src/legacy-runtime/runtime-cores/assistant-transport/types.ts +5 -1
  47. package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransport.spec.md +7 -0
  48. package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.test.tsx +290 -0
  49. package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.ts +62 -1
  50. package/src/primitives/actionBar/ActionBarExportMarkdown.tsx +1 -1
  51. package/src/primitives/attachment/AttachmentThumb.test.tsx +70 -0
  52. package/src/primitives/attachment/AttachmentThumb.tsx +8 -4
  53. package/src/primitives/composer/ComposerAttachmentDropzone.test.tsx +103 -3
  54. package/src/primitives/composer/ComposerAttachmentDropzone.tsx +18 -3
  55. package/src/primitives/composer/ComposerInput.test.tsx +53 -2
  56. package/src/primitives/composer/ComposerInput.tsx +3 -0
  57. package/src/primitives/queueItem/QueueItemText.tsx +8 -2
  58. package/src/primitives/selectionToolbar/SelectionToolbarRoot.test.tsx +74 -0
  59. package/src/primitives/selectionToolbar/SelectionToolbarRoot.tsx +3 -3
  60. package/src/tests/external-thread-parity.test.tsx +52 -4
  61. package/src/tests/local-runtime-queue.test.tsx +199 -6
  62. package/src/utils/createActionButton.test.tsx +18 -0
  63. package/src/utils/createActionButton.tsx +1 -1
  64. 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(65);
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 || $[14] !== queue) {
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] = queue;
85
- $[15] = t6;
86
- } else t6 = $[15];
83
+ $[14] = t6;
84
+ } else t6 = $[14];
87
85
  const handleSendEdit = t6;
88
86
  let t7;
89
- if ($[16] !== attachmentAdapter || $[17] !== handleSendEdit || $[18] !== isEditing || $[19] !== message || $[20] !== queue) {
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
- $[16] = attachmentAdapter;
102
- $[17] = handleSendEdit;
103
- $[18] = isEditing;
104
- $[19] = message;
105
- $[20] = queue;
106
- $[21] = t7;
107
- } else t7 = $[21];
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 ($[22] !== branches || $[23] !== message.id) {
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
- $[22] = branches;
115
- $[23] = message.id;
116
- $[24] = branchIds;
117
- $[25] = t8;
112
+ $[21] = branches;
113
+ $[22] = message.id;
114
+ $[23] = branchIds;
115
+ $[24] = t8;
118
116
  } else {
119
- branchIds = $[24];
120
- t8 = $[25];
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 ($[26] !== message.attachments) {
124
+ if ($[25] !== message.attachments) {
127
125
  t9 = message.attachments ?? [];
128
- $[26] = message.attachments;
129
- $[27] = t9;
130
- } else t9 = $[27];
126
+ $[25] = message.attachments;
127
+ $[26] = t9;
128
+ } else t9 = $[26];
131
129
  let t10;
132
- if ($[28] !== branchCount || $[29] !== branchNumber || $[30] !== composerClient.state || $[31] !== index || $[32] !== isCopied || $[33] !== isHovering || $[34] !== message || $[35] !== parentId || $[36] !== partClients.state || $[37] !== t9) {
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
- $[28] = branchCount;
148
- $[29] = branchNumber;
149
- $[30] = composerClient.state;
150
- $[31] = index;
151
- $[32] = isCopied;
152
- $[33] = isHovering;
153
- $[34] = message;
154
- $[35] = parentId;
155
- $[36] = partClients.state;
156
- $[37] = t9;
157
- $[38] = t10;
158
- } else t10 = $[38];
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 ($[39] !== state) {
159
+ if ($[38] !== state) {
162
160
  t11 = () => state;
163
- $[39] = state;
164
- $[40] = t11;
165
- } else t11 = $[40];
161
+ $[38] = state;
162
+ $[39] = t11;
163
+ } else t11 = $[39];
166
164
  let t12;
167
- if ($[41] !== composerClient.methods) {
165
+ if ($[40] !== composerClient.methods) {
168
166
  t12 = () => composerClient.methods;
169
- $[41] = composerClient.methods;
170
- $[42] = t12;
171
- } else t12 = $[42];
167
+ $[40] = composerClient.methods;
168
+ $[41] = t12;
169
+ } else t12 = $[41];
172
170
  let t13;
173
- if ($[43] !== onReload) {
171
+ if ($[42] !== onReload) {
174
172
  t13 = () => {
175
173
  onReload?.();
176
174
  };
177
- $[43] = onReload;
178
- $[44] = t13;
179
- } else t13 = $[44];
175
+ $[42] = onReload;
176
+ $[43] = t13;
177
+ } else t13 = $[43];
180
178
  let t14;
181
- if ($[45] !== branchIds || $[46] !== branchIndex || $[47] !== branches || $[48] !== message.id) {
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
- $[45] = branchIds;
189
- $[46] = branchIndex;
190
- $[47] = branches;
191
- $[48] = message.id;
192
- $[49] = t14;
193
- } else t14 = $[49];
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 ($[50] !== message) {
193
+ if ($[49] !== message) {
196
194
  t15 = () => getThreadMessageText(message);
197
- $[50] = message;
198
- $[51] = t15;
199
- } else t15 = $[51];
195
+ $[49] = message;
196
+ $[50] = t15;
197
+ } else t15 = $[50];
200
198
  let t16;
201
- if ($[52] !== partClients || $[53] !== state) {
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
- $[52] = partClients;
208
- $[53] = state;
209
- $[54] = t16;
210
- } else t16 = $[54];
205
+ $[51] = partClients;
206
+ $[52] = state;
207
+ $[53] = t16;
208
+ } else t16 = $[53];
211
209
  let t17;
212
- if ($[55] !== attachmentClients) {
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
- $[55] = attachmentClients;
218
- $[56] = t17;
219
- } else t17 = $[56];
215
+ $[54] = attachmentClients;
216
+ $[55] = t17;
217
+ } else t17 = $[55];
220
218
  let t18;
221
- if ($[57] !== t11 || $[58] !== t12 || $[59] !== t13 || $[60] !== t14 || $[61] !== t15 || $[62] !== t16 || $[63] !== t17) {
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
- $[57] = t11;
238
- $[58] = t12;
239
- $[59] = t13;
240
- $[60] = t14;
241
- $[61] = t15;
242
- $[62] = t16;
243
- $[63] = t17;
244
- $[64] = t18;
245
- } else t18 = $[64];
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, onSteer, onRemove }) => {
341
+ const useQueueItemClient = ({ item, onMove, onRemove }) => {
344
342
  return {
345
343
  getState: () => item,
346
- steer: onSteer,
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(96);
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 queueItems = queue?.items ?? EMPTY_QUEUE_ITEMS;
481
+ const steerItems = queue?.steerItems ?? EMPTY_QUEUE_ITEMS;
482
+ const laneItems = queue?.items ?? EMPTY_QUEUE_ITEMS;
480
483
  let t10;
481
- if ($[23] !== queue || $[24] !== queueItems) {
482
- let t11;
483
- if ($[26] !== queue) {
484
- t11 = (item) => withKey(item.id, QueueItemClient({
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 queueItemClients = useClientLookup(t10);
498
- attachmentAdapter?.accept;
490
+ const queueItems = t10;
499
491
  let t11;
500
- if ($[28] !== attachments.length || $[29] !== text) {
501
- t11 = !text.trim() && !attachments.length;
502
- $[28] = attachments.length;
503
- $[29] = text;
504
- $[30] = t11;
505
- } else t11 = $[30];
506
- const isEmpty = t11;
507
- const t12 = isEditing && !isEmpty && !isSendDisabled;
508
- const t13 = attachmentAdapter?.accept ?? "*";
509
- let t14;
510
- if ($[31] !== attachmentClients.state || $[32] !== canCancel || $[33] !== isEditing || $[34] !== isEmpty || $[35] !== queueItems || $[36] !== quote || $[37] !== role || $[38] !== runConfig || $[39] !== t12 || $[40] !== t13 || $[41] !== text || $[42] !== type) {
511
- t14 = {
512
- text,
513
- role,
514
- attachments: attachmentClients.state,
515
- runConfig,
516
- isEditing,
517
- canCancel,
518
- canSend: t12,
519
- attachmentAccept: t13,
520
- isEmpty,
521
- type,
522
- dictation: void 0,
523
- quote,
524
- queue: queueItems
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] = attachmentClients.state;
527
- $[32] = canCancel;
528
- $[33] = isEditing;
529
- $[34] = isEmpty;
530
- $[35] = queueItems;
531
- $[36] = quote;
532
- $[37] = role;
533
- $[38] = runConfig;
534
- $[39] = t12;
535
- $[40] = t13;
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] = t14;
539
- } else t14 = $[43];
540
- const state = t14;
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 ($[44] !== state) {
543
- t15 = () => state;
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
- $[46] = attachmentAdapter;
585
- $[47] = setAttachments;
586
- $[48] = upsertAttachment;
587
- $[49] = t16;
588
- } else t16 = $[49];
589
- let t17;
590
- if ($[50] !== attachmentsRef || $[51] !== removePendingAttachments || $[52] !== setAttachments) {
591
- t17 = async () => {
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
- $[50] = attachmentsRef;
597
- $[51] = removePendingAttachments;
598
- $[52] = setAttachments;
599
- $[53] = t17;
600
- } else t17 = $[53];
601
- let t18;
602
- if ($[54] !== attachmentClients) {
603
- t18 = (selector) => {
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
- $[54] = attachmentClients;
608
- $[55] = t18;
609
- } else t18 = $[55];
610
- let t19;
611
- if ($[56] !== attachmentsRef || $[57] !== removePendingAttachments || $[58] !== setAttachments || $[59] !== setQuote || $[60] !== setRole || $[61] !== setRunConfig || $[62] !== setText) {
612
- t19 = async () => {
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
- $[56] = attachmentsRef;
622
- $[57] = removePendingAttachments;
623
- $[58] = setAttachments;
624
- $[59] = setQuote;
625
- $[60] = setRole;
626
- $[61] = setRunConfig;
627
- $[62] = setText;
628
- $[63] = t19;
629
- } else t19 = $[63];
630
- let t20;
631
- if ($[64] !== attachmentAdapter || $[65] !== attachmentsRef || $[66] !== isEditing || $[67] !== isSendDisabled || $[68] !== onSend || $[69] !== queue || $[70] !== quoteRef || $[71] !== roleRef || $[72] !== runConfigRef || $[73] !== setAttachments || $[74] !== setQuote || $[75] !== setText || $[76] !== textRef) {
632
- t20 = (opts) => {
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) queue.enqueue(composedMessage, { steer: opts?.steer ?? false });
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
- $[64] = attachmentAdapter;
668
- $[65] = attachmentsRef;
669
- $[66] = isEditing;
670
- $[67] = isSendDisabled;
671
- $[68] = onSend;
672
- $[69] = queue;
673
- $[70] = quoteRef;
674
- $[71] = roleRef;
675
- $[72] = runConfigRef;
676
- $[73] = setAttachments;
677
- $[74] = setQuote;
678
- $[75] = setText;
679
- $[76] = textRef;
680
- $[77] = t20;
681
- } else t20 = $[77];
682
- let t21;
683
- if ($[78] !== onBeginEdit) {
684
- t21 = () => {
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
- $[78] = onBeginEdit;
688
- $[79] = t21;
689
- } else t21 = $[79];
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 ($[80] !== queueItemClients) {
692
- t22 = (selector_0) => queueItemClients.get(selector_0);
693
- $[80] = queueItemClients;
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: t16,
704
- clearAttachments: t17,
705
- attachment: t18,
706
- reset: t19,
707
- send: t20,
719
+ addAttachment: t15,
720
+ clearAttachments: t16,
721
+ attachment: t17,
722
+ reset: t18,
723
+ send: t19,
708
724
  cancel: onCancel,
709
- beginEdit: t21,
725
+ beginEdit: t20,
710
726
  startDictation: _temp0,
711
727
  stopDictation: _temp1,
712
728
  setQuote,
713
- queueItem: t22
729
+ queueItem: t21
714
730
  };
715
- $[82] = onCancel;
716
- $[83] = setQuote;
717
- $[84] = setRole;
718
- $[85] = setRunConfig;
719
- $[86] = setText;
720
- $[87] = t15;
721
- $[88] = t16;
722
- $[89] = t17;
723
- $[90] = t18;
724
- $[91] = t19;
725
- $[92] = t20;
726
- $[93] = t21;
727
- $[94] = t22;
728
- $[95] = t23;
729
- } else t23 = $[95];
730
- return t23;
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(80);
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 || $[4] !== queue) {
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] = queue;
772
- $[5] = t5;
773
- } else t5 = $[5];
786
+ $[4] = t5;
787
+ } else t5 = $[4];
774
788
  const handleReload = t5;
775
789
  let t6;
776
- if ($[6] !== attachmentAdapter || $[7] !== branches || $[8] !== handleReload || $[9] !== messages || $[10] !== onAddToolResult || $[11] !== onEdit || $[12] !== onRespondToToolApproval || $[13] !== onResumeToolCall || $[14] !== queue) {
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
- $[6] = attachmentAdapter;
794
- $[7] = branches;
795
- $[8] = handleReload;
796
- $[9] = messages;
797
- $[10] = onAddToolResult;
798
- $[11] = onEdit;
799
- $[12] = onRespondToToolApproval;
800
- $[13] = onResumeToolCall;
801
- $[14] = queue;
802
- $[15] = t6;
803
- } else t6 = $[15];
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 ($[16] !== onCancel || $[17] !== queue) {
820
+ if ($[15] !== onCancel) {
807
821
  t7 = () => {
808
- queue?.clear("cancel-run");
809
822
  onCancel?.();
810
823
  };
811
- $[16] = onCancel;
812
- $[17] = queue;
813
- $[18] = t7;
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 ($[19] !== messages || $[20] !== onNew) {
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
- $[19] = messages;
825
- $[20] = onNew;
826
- $[21] = t8;
827
- } else t8 = $[21];
836
+ $[17] = messages;
837
+ $[18] = onNew;
838
+ $[19] = t8;
839
+ } else t8 = $[19];
828
840
  const handleSendNew = t8;
829
841
  let t9;
830
- if ($[22] !== messages) {
842
+ if ($[20] !== messages) {
831
843
  t9 = messages.at(-1)?.id ?? null;
832
- $[22] = messages;
833
- $[23] = t9;
834
- } else t9 = $[23];
844
+ $[20] = messages;
845
+ $[21] = t9;
846
+ } else t9 = $[21];
835
847
  const headId = t9;
836
848
  let t10;
837
- if ($[24] !== headId || $[25] !== queue) {
849
+ if ($[22] !== headId || $[23] !== queue) {
838
850
  t10 = queue && {
839
851
  ...queue,
840
- enqueue: (message_0, options) => queue.enqueue({
852
+ enqueue: (message_0) => queue.enqueue({
841
853
  ...message_0,
842
854
  parentId: message_0.parentId ?? headId
843
- }, options)
855
+ }),
856
+ steer: (message_1) => queue.steer({
857
+ ...message_1,
858
+ parentId: message_1.parentId ?? headId
859
+ })
844
860
  };
845
- $[24] = headId;
846
- $[25] = queue;
847
- $[26] = t10;
848
- } else t10 = $[26];
861
+ $[22] = headId;
862
+ $[23] = queue;
863
+ $[24] = t10;
864
+ } else t10 = $[24];
849
865
  const composerQueue = t10;
850
866
  let t11;
851
- if ($[27] !== attachmentAdapter || $[28] !== composerQueue || $[29] !== handleCancelRun || $[30] !== handleSendNew || $[31] !== isRunning || $[32] !== isSendDisabled) {
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
- $[27] = attachmentAdapter;
863
- $[28] = composerQueue;
864
- $[29] = handleCancelRun;
865
- $[30] = handleSendNew;
866
- $[31] = isRunning;
867
- $[32] = isSendDisabled;
868
- $[33] = t11;
869
- } else t11 = $[33];
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 ($[34] !== messageClients.state) {
893
+ if ($[32] !== messageClients.state) {
878
894
  t12 = messageClients.state.map(_temp10);
879
- $[34] = messageClients.state;
880
- $[35] = t12;
881
- } else t12 = $[35];
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 ($[36] !== hasAttachments || $[37] !== hasBranches || $[38] !== hasEdit || $[39] !== hasQueue || $[40] !== hasReload || $[41] !== isRunning) {
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
- $[36] = hasAttachments;
903
- $[37] = hasBranches;
904
- $[38] = hasEdit;
905
- $[39] = hasQueue;
906
- $[40] = hasReload;
907
- $[41] = isRunning;
908
- $[42] = t14;
909
- } else t14 = $[42];
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 ($[43] !== threadState) {
927
+ if ($[41] !== threadState) {
912
928
  t15 = threadState ?? {};
913
- $[43] = threadState;
914
- $[44] = t15;
915
- } else t15 = $[44];
929
+ $[41] = threadState;
930
+ $[42] = t15;
931
+ } else t15 = $[42];
916
932
  let t16;
917
- if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
933
+ if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
918
934
  t16 = [];
919
- $[45] = t16;
920
- } else t16 = $[45];
935
+ $[43] = t16;
936
+ } else t16 = $[43];
921
937
  let t17;
922
- if ($[46] !== composerClient.state || $[47] !== extras || $[48] !== isLoading || $[49] !== isRunning || $[50] !== messageStates || $[51] !== t13 || $[52] !== t14 || $[53] !== t15) {
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
- $[46] = composerClient.state;
938
- $[47] = extras;
939
- $[48] = isLoading;
940
- $[49] = isRunning;
941
- $[50] = messageStates;
942
- $[51] = t13;
943
- $[52] = t14;
944
- $[53] = t15;
945
- $[54] = t17;
946
- } else t17 = $[54];
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 ($[55] !== state) {
965
+ if ($[53] !== state) {
950
966
  t18 = () => state;
951
- $[55] = state;
952
- $[56] = t18;
953
- } else t18 = $[56];
967
+ $[53] = state;
968
+ $[54] = t18;
969
+ } else t18 = $[54];
954
970
  let t19;
955
- if ($[57] !== composerClient.methods) {
971
+ if ($[55] !== composerClient.methods) {
956
972
  t19 = () => composerClient.methods;
957
- $[57] = composerClient.methods;
958
- $[58] = t19;
959
- } else t19 = $[58];
973
+ $[55] = composerClient.methods;
974
+ $[56] = t19;
975
+ } else t19 = $[56];
960
976
  let t20;
961
- if ($[59] !== messages || $[60] !== onNew || $[61] !== queue) {
962
- t20 = (message_1) => {
963
- const appendMessage = typeof message_1 === "string" ? {
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: message_1
987
+ text: message_2
972
988
  }],
973
989
  attachments: [],
974
990
  metadata: { custom: {} }
975
991
  } : {
976
- createdAt: message_1.createdAt ?? /* @__PURE__ */ new Date(),
977
- parentId: message_1.parentId ?? messages.at(-1)?.id ?? null,
978
- sourceId: message_1.sourceId ?? null,
979
- role: message_1.role ?? "user",
980
- content: message_1.content,
981
- attachments: message_1.attachments ?? [],
982
- metadata: message_1.metadata ?? { custom: {} },
983
- runConfig: message_1.runConfig ?? {},
984
- startRun: message_1.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, { steer: false });
1002
+ if (queue) queue.enqueue(appendMessage);
987
1003
  else onNew?.(appendMessage);
988
1004
  };
989
- $[59] = messages;
990
- $[60] = onNew;
991
- $[61] = queue;
992
- $[62] = t20;
993
- } else t20 = $[62];
1005
+ $[57] = messages;
1006
+ $[58] = onNew;
1007
+ $[59] = queue;
1008
+ $[60] = t20;
1009
+ } else t20 = $[60];
994
1010
  let t21;
995
- if ($[63] !== onStartRun) {
1011
+ if ($[61] !== onStartRun) {
996
1012
  t21 = () => {
997
1013
  onStartRun?.();
998
1014
  };
999
- $[63] = onStartRun;
1000
- $[64] = t21;
1001
- } else t21 = $[64];
1015
+ $[61] = onStartRun;
1016
+ $[62] = t21;
1017
+ } else t21 = $[62];
1002
1018
  let t22;
1003
- if ($[65] !== onResume) {
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
- $[65] = onResume;
1009
- $[66] = t22;
1010
- } else t22 = $[66];
1024
+ $[63] = onResume;
1025
+ $[64] = t22;
1026
+ } else t22 = $[64];
1011
1027
  let t23;
1012
- if ($[67] !== onLoadExternalState) {
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
- $[67] = onLoadExternalState;
1018
- $[68] = t23;
1019
- } else t23 = $[68];
1033
+ $[65] = onLoadExternalState;
1034
+ $[66] = t23;
1035
+ } else t23 = $[66];
1020
1036
  let t24;
1021
- if ($[69] !== messageClients) {
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
- $[69] = messageClients;
1027
- $[70] = t24;
1028
- } else t24 = $[70];
1042
+ $[67] = messageClients;
1043
+ $[68] = t24;
1044
+ } else t24 = $[68];
1029
1045
  let t25;
1030
- if ($[71] !== handleCancelRun || $[72] !== t18 || $[73] !== t19 || $[74] !== t20 || $[75] !== t21 || $[76] !== t22 || $[77] !== t23 || $[78] !== t24) {
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
- $[71] = handleCancelRun;
1054
- $[72] = t18;
1055
- $[73] = t19;
1056
- $[74] = t20;
1057
- $[75] = t21;
1058
- $[76] = t22;
1059
- $[77] = t23;
1060
- $[78] = t24;
1061
- $[79] = t25;
1062
- } else t25 = $[79];
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);