@assistant-ui/react 0.5.40 → 0.5.41
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +74 -16
- package/dist/index.d.ts +74 -16
- package/dist/index.js +291 -86
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +484 -279
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
@@ -204,7 +204,8 @@ var makeThreadActionStore = (runtimeStore) => {
|
|
204
204
|
startRun: (parentId) => runtimeStore.getState().startRun(parentId),
|
205
205
|
append: (message) => runtimeStore.getState().append(message),
|
206
206
|
cancelRun: () => runtimeStore.getState().cancelRun(),
|
207
|
-
addToolResult: (options) => runtimeStore.getState().addToolResult(options)
|
207
|
+
addToolResult: (options) => runtimeStore.getState().addToolResult(options),
|
208
|
+
speak: (messageId) => runtimeStore.getState().speak(messageId)
|
208
209
|
})
|
209
210
|
);
|
210
211
|
};
|
@@ -1057,31 +1058,77 @@ var EdgeChatAdapter = class {
|
|
1057
1058
|
var useEdgeRuntime = ({
|
1058
1059
|
initialMessages,
|
1059
1060
|
maxToolRoundtrips,
|
1061
|
+
adapters,
|
1060
1062
|
...options
|
1061
1063
|
}) => {
|
1062
1064
|
const [adapter] = useState3(() => new EdgeChatAdapter(options));
|
1063
|
-
return useLocalRuntime(adapter, {
|
1065
|
+
return useLocalRuntime(adapter, {
|
1066
|
+
initialMessages,
|
1067
|
+
maxToolRoundtrips,
|
1068
|
+
adapters
|
1069
|
+
});
|
1064
1070
|
};
|
1065
1071
|
|
1066
1072
|
// src/runtimes/local/shouldContinue.tsx
|
1067
1073
|
var shouldContinue = (result) => result.status?.type === "requires-action" && result.status.reason === "tool-calls" && result.content.every((c) => c.type !== "tool-call" || !!c.result);
|
1068
1074
|
|
1075
|
+
// src/utils/getThreadMessageText.tsx
|
1076
|
+
var getThreadMessageText = (message) => {
|
1077
|
+
const textParts = message.content.filter(
|
1078
|
+
(part) => part.type === "text"
|
1079
|
+
);
|
1080
|
+
return textParts.map((part) => part.text).join("\n\n");
|
1081
|
+
};
|
1082
|
+
|
1083
|
+
// src/runtimes/speech/WebSpeechSynthesisAdapter.ts
|
1084
|
+
var WebSpeechSynthesisAdapter = class {
|
1085
|
+
speak(message) {
|
1086
|
+
const text = getThreadMessageText(message);
|
1087
|
+
const utterance = new SpeechSynthesisUtterance(text);
|
1088
|
+
let ended = false;
|
1089
|
+
const endHandlers = /* @__PURE__ */ new Set();
|
1090
|
+
const handleEnd = () => {
|
1091
|
+
if (ended) return;
|
1092
|
+
ended = true;
|
1093
|
+
endHandlers.forEach((handler) => handler());
|
1094
|
+
};
|
1095
|
+
utterance.addEventListener("end", handleEnd);
|
1096
|
+
utterance.addEventListener("error", handleEnd);
|
1097
|
+
window.speechSynthesis.speak(utterance);
|
1098
|
+
return {
|
1099
|
+
stop: () => {
|
1100
|
+
window.speechSynthesis.cancel();
|
1101
|
+
handleEnd();
|
1102
|
+
},
|
1103
|
+
onEnd: (callback) => {
|
1104
|
+
if (ended) {
|
1105
|
+
let cancelled = false;
|
1106
|
+
queueMicrotask(() => {
|
1107
|
+
if (!cancelled) callback();
|
1108
|
+
});
|
1109
|
+
return () => {
|
1110
|
+
cancelled = true;
|
1111
|
+
};
|
1112
|
+
} else {
|
1113
|
+
endHandlers.add(callback);
|
1114
|
+
return () => {
|
1115
|
+
endHandlers.delete(callback);
|
1116
|
+
};
|
1117
|
+
}
|
1118
|
+
}
|
1119
|
+
};
|
1120
|
+
}
|
1121
|
+
};
|
1122
|
+
|
1069
1123
|
// src/runtimes/local/LocalThreadRuntime.tsx
|
1070
|
-
var CAPABILITIES = Object.freeze({
|
1071
|
-
switchToBranch: true,
|
1072
|
-
edit: true,
|
1073
|
-
reload: true,
|
1074
|
-
cancel: true,
|
1075
|
-
copy: true
|
1076
|
-
});
|
1077
1124
|
var LocalThreadRuntime = class {
|
1078
|
-
constructor(configProvider, adapter, options) {
|
1125
|
+
constructor(configProvider, adapter, { initialMessages, ...options }) {
|
1079
1126
|
this.configProvider = configProvider;
|
1080
1127
|
this.adapter = adapter;
|
1081
1128
|
this.options = options;
|
1082
|
-
if (
|
1129
|
+
if (initialMessages) {
|
1083
1130
|
let parentId = null;
|
1084
|
-
const messages = fromCoreMessages(
|
1131
|
+
const messages = fromCoreMessages(initialMessages);
|
1085
1132
|
for (const message of messages) {
|
1086
1133
|
this.repository.addOrUpdateMessage(parentId, message);
|
1087
1134
|
parentId = message.id;
|
@@ -1091,7 +1138,14 @@ var LocalThreadRuntime = class {
|
|
1091
1138
|
_subscriptions = /* @__PURE__ */ new Set();
|
1092
1139
|
abortController = null;
|
1093
1140
|
repository = new MessageRepository();
|
1094
|
-
capabilities =
|
1141
|
+
capabilities = {
|
1142
|
+
switchToBranch: true,
|
1143
|
+
edit: true,
|
1144
|
+
reload: true,
|
1145
|
+
cancel: true,
|
1146
|
+
unstable_copy: true,
|
1147
|
+
speak: false
|
1148
|
+
};
|
1095
1149
|
isDisabled = false;
|
1096
1150
|
get messages() {
|
1097
1151
|
return this.repository.getMessages();
|
@@ -1103,6 +1157,15 @@ var LocalThreadRuntime = class {
|
|
1103
1157
|
this.notifySubscribers();
|
1104
1158
|
}
|
1105
1159
|
};
|
1160
|
+
_options;
|
1161
|
+
set options({ initialMessages, ...options }) {
|
1162
|
+
this._options = options;
|
1163
|
+
const canSpeak = options.adapters?.speech !== void 0;
|
1164
|
+
if (this.capabilities.speak !== canSpeak) {
|
1165
|
+
this.capabilities.speak = canSpeak;
|
1166
|
+
this.notifySubscribers();
|
1167
|
+
}
|
1168
|
+
}
|
1106
1169
|
getBranches(messageId) {
|
1107
1170
|
return this.repository.getBranches(messageId);
|
1108
1171
|
}
|
@@ -1176,7 +1239,7 @@ var LocalThreadRuntime = class {
|
|
1176
1239
|
this.repository.addOrUpdateMessage(parentId, message);
|
1177
1240
|
this.notifySubscribers();
|
1178
1241
|
};
|
1179
|
-
const maxToolRoundtrips = this.
|
1242
|
+
const maxToolRoundtrips = this._options.maxToolRoundtrips ?? 1;
|
1180
1243
|
const toolRoundtrips = message.metadata?.roundtrips?.length ?? 0;
|
1181
1244
|
if (toolRoundtrips > maxToolRoundtrips) {
|
1182
1245
|
updateMessage({
|
@@ -1240,7 +1303,11 @@ var LocalThreadRuntime = class {
|
|
1240
1303
|
this._subscriptions.add(callback);
|
1241
1304
|
return () => this._subscriptions.delete(callback);
|
1242
1305
|
}
|
1243
|
-
addToolResult({
|
1306
|
+
addToolResult({
|
1307
|
+
messageId,
|
1308
|
+
toolCallId,
|
1309
|
+
result
|
1310
|
+
}) {
|
1244
1311
|
let { parentId, message } = this.repository.getMessage(messageId);
|
1245
1312
|
if (message.role !== "assistant")
|
1246
1313
|
throw new Error("Tried to add tool result to non-assistant message");
|
@@ -1267,6 +1334,11 @@ var LocalThreadRuntime = class {
|
|
1267
1334
|
this.performRoundtrip(parentId, message);
|
1268
1335
|
}
|
1269
1336
|
}
|
1337
|
+
speak(messageId) {
|
1338
|
+
const { message } = this.repository.getMessage(messageId);
|
1339
|
+
const adapter = new WebSpeechSynthesisAdapter();
|
1340
|
+
return adapter.speak(message);
|
1341
|
+
}
|
1270
1342
|
export() {
|
1271
1343
|
return this.repository.export();
|
1272
1344
|
}
|
@@ -1425,14 +1497,6 @@ var fromThreadMessageLike = (like, fallbackId, fallbackStatus) => {
|
|
1425
1497
|
}
|
1426
1498
|
};
|
1427
1499
|
|
1428
|
-
// src/utils/getThreadMessageText.tsx
|
1429
|
-
var getThreadMessageText = (message) => {
|
1430
|
-
const textParts = message.content.filter(
|
1431
|
-
(part) => part.type === "text"
|
1432
|
-
);
|
1433
|
-
return textParts.map((part) => part.text).join("\n\n");
|
1434
|
-
};
|
1435
|
-
|
1436
1500
|
// src/runtimes/external-store/ExternalStoreThreadRuntime.tsx
|
1437
1501
|
var hasUpcomingMessage = (isRunning, messages) => {
|
1438
1502
|
return isRunning && messages[messages.length - 1]?.role !== "assistant";
|
@@ -1446,7 +1510,8 @@ var ExternalStoreThreadRuntime = class {
|
|
1446
1510
|
edit: false,
|
1447
1511
|
reload: false,
|
1448
1512
|
cancel: false,
|
1449
|
-
|
1513
|
+
unstable_copy: false,
|
1514
|
+
speak: false
|
1450
1515
|
};
|
1451
1516
|
get capabilities() {
|
1452
1517
|
return this._capabilities;
|
@@ -1476,7 +1541,8 @@ var ExternalStoreThreadRuntime = class {
|
|
1476
1541
|
edit: this._store.onEdit !== void 0,
|
1477
1542
|
reload: this._store.onReload !== void 0,
|
1478
1543
|
cancel: this._store.onCancel !== void 0,
|
1479
|
-
|
1544
|
+
unstable_copy: this._store.unstable_capabilities?.copy !== null,
|
1545
|
+
speak: this._store.onSpeak !== void 0
|
1480
1546
|
};
|
1481
1547
|
if (oldStore) {
|
1482
1548
|
if (oldStore.convertMessage !== store.convertMessage) {
|
@@ -1573,6 +1639,17 @@ var ExternalStoreThreadRuntime = class {
|
|
1573
1639
|
this.updateMessages(messages);
|
1574
1640
|
}, 0);
|
1575
1641
|
}
|
1642
|
+
addToolResult(options) {
|
1643
|
+
if (!this._store.onAddToolResult)
|
1644
|
+
throw new Error("Runtime does not support tool results.");
|
1645
|
+
this._store.onAddToolResult(options);
|
1646
|
+
}
|
1647
|
+
speak(messageId) {
|
1648
|
+
if (!this._store.onSpeak)
|
1649
|
+
throw new Error("Runtime does not support speaking.");
|
1650
|
+
const { message } = this.repository.getMessage(messageId);
|
1651
|
+
return this._store.onSpeak(message);
|
1652
|
+
}
|
1576
1653
|
subscribe(callback) {
|
1577
1654
|
this._subscriptions.add(callback);
|
1578
1655
|
return () => this._subscriptions.delete(callback);
|
@@ -1582,11 +1659,6 @@ var ExternalStoreThreadRuntime = class {
|
|
1582
1659
|
messages.flatMap(getExternalStoreMessage).filter((m) => m != null)
|
1583
1660
|
);
|
1584
1661
|
};
|
1585
|
-
addToolResult(options) {
|
1586
|
-
if (!this._store.onAddToolResult)
|
1587
|
-
throw new Error("Runtime does not support tool results.");
|
1588
|
-
this._store.onAddToolResult(options);
|
1589
|
-
}
|
1590
1662
|
};
|
1591
1663
|
|
1592
1664
|
// src/runtimes/external-store/ExternalStoreRuntime.tsx
|
@@ -1977,8 +2049,8 @@ var useActionBarCopy = ({
|
|
1977
2049
|
const { useMessage, useMessageUtils, useEditComposer } = useMessageContext();
|
1978
2050
|
const hasCopyableContent = useCombinedStore(
|
1979
2051
|
[useMessage, useEditComposer],
|
1980
|
-
(
|
1981
|
-
return !c.isEditing &&
|
2052
|
+
({ message }, c) => {
|
2053
|
+
return !c.isEditing && (message.role !== "assistant" || message.status.type !== "running") && message.content.some((c2) => c2.type === "text" && c2.text.length > 0);
|
1982
2054
|
}
|
1983
2055
|
);
|
1984
2056
|
const callback = useCallback3(() => {
|
@@ -2030,6 +2102,38 @@ var useActionBarReload = () => {
|
|
2030
2102
|
return callback;
|
2031
2103
|
};
|
2032
2104
|
|
2105
|
+
// src/primitive-hooks/actionBar/useActionBarSpeak.tsx
|
2106
|
+
import { useCallback as useCallback6 } from "react";
|
2107
|
+
var useActionBarSpeak = () => {
|
2108
|
+
const { useThreadActions } = useThreadContext();
|
2109
|
+
const { useMessage, useEditComposer, useMessageUtils } = useMessageContext();
|
2110
|
+
const hasSpeakableContent = useCombinedStore(
|
2111
|
+
[useMessage, useEditComposer],
|
2112
|
+
({ message }, c) => {
|
2113
|
+
return !c.isEditing && (message.role !== "assistant" || message.status.type !== "running") && message.content.some((c2) => c2.type === "text" && c2.text.length > 0);
|
2114
|
+
}
|
2115
|
+
);
|
2116
|
+
const callback = useCallback6(async () => {
|
2117
|
+
const { message } = useMessage.getState();
|
2118
|
+
const utt = useThreadActions.getState().speak(message.id);
|
2119
|
+
useMessageUtils.getState().addUtterance(utt);
|
2120
|
+
}, [useThreadActions, useMessage, useMessageUtils]);
|
2121
|
+
if (!hasSpeakableContent) return null;
|
2122
|
+
return callback;
|
2123
|
+
};
|
2124
|
+
|
2125
|
+
// src/primitive-hooks/actionBar/useActionBarStopSpeaking.tsx
|
2126
|
+
import { useCallback as useCallback7 } from "react";
|
2127
|
+
var useActionBarStopSpeaking = () => {
|
2128
|
+
const { useMessageUtils } = useMessageContext();
|
2129
|
+
const isSpeaking = useMessageUtils((u) => u.isSpeaking);
|
2130
|
+
const callback = useCallback7(async () => {
|
2131
|
+
useMessageUtils.getState().stopSpeaking();
|
2132
|
+
}, [useMessageUtils]);
|
2133
|
+
if (!isSpeaking) return null;
|
2134
|
+
return callback;
|
2135
|
+
};
|
2136
|
+
|
2033
2137
|
// src/primitive-hooks/branchPicker/useBranchPickerCount.tsx
|
2034
2138
|
var useBranchPickerCount = () => {
|
2035
2139
|
const { useMessage } = useMessageContext();
|
@@ -2038,7 +2142,7 @@ var useBranchPickerCount = () => {
|
|
2038
2142
|
};
|
2039
2143
|
|
2040
2144
|
// src/primitive-hooks/branchPicker/useBranchPickerNext.tsx
|
2041
|
-
import { useCallback as
|
2145
|
+
import { useCallback as useCallback8 } from "react";
|
2042
2146
|
var useBranchPickerNext = () => {
|
2043
2147
|
const { useThreadActions } = useThreadContext();
|
2044
2148
|
const { useMessage, useEditComposer } = useMessageContext();
|
@@ -2046,7 +2150,7 @@ var useBranchPickerNext = () => {
|
|
2046
2150
|
[useMessage, useEditComposer],
|
2047
2151
|
(m, c) => c.isEditing || m.branches.indexOf(m.message.id) + 1 >= m.branches.length
|
2048
2152
|
);
|
2049
|
-
const callback =
|
2153
|
+
const callback = useCallback8(() => {
|
2050
2154
|
const { message, branches } = useMessage.getState();
|
2051
2155
|
useThreadActions.getState().switchToBranch(branches[branches.indexOf(message.id) + 1]);
|
2052
2156
|
}, [useThreadActions, useMessage]);
|
@@ -2062,7 +2166,7 @@ var useBranchPickerNumber = () => {
|
|
2062
2166
|
};
|
2063
2167
|
|
2064
2168
|
// src/primitive-hooks/branchPicker/useBranchPickerPrevious.tsx
|
2065
|
-
import { useCallback as
|
2169
|
+
import { useCallback as useCallback9 } from "react";
|
2066
2170
|
var useBranchPickerPrevious = () => {
|
2067
2171
|
const { useThreadActions } = useThreadContext();
|
2068
2172
|
const { useMessage, useEditComposer } = useMessageContext();
|
@@ -2070,7 +2174,7 @@ var useBranchPickerPrevious = () => {
|
|
2070
2174
|
[useMessage, useEditComposer],
|
2071
2175
|
(m, c) => c.isEditing || m.branches.indexOf(m.message.id) <= 0
|
2072
2176
|
);
|
2073
|
-
const callback =
|
2177
|
+
const callback = useCallback9(() => {
|
2074
2178
|
const { message, branches } = useMessage.getState();
|
2075
2179
|
useThreadActions.getState().switchToBranch(branches[branches.indexOf(message.id) - 1]);
|
2076
2180
|
}, [useThreadActions, useMessage]);
|
@@ -2079,11 +2183,11 @@ var useBranchPickerPrevious = () => {
|
|
2079
2183
|
};
|
2080
2184
|
|
2081
2185
|
// src/primitive-hooks/composer/useComposerCancel.tsx
|
2082
|
-
import { useCallback as
|
2186
|
+
import { useCallback as useCallback10 } from "react";
|
2083
2187
|
var useComposerCancel = () => {
|
2084
2188
|
const { useComposer } = useComposerContext();
|
2085
2189
|
const disabled = useComposer((c) => !c.canCancel);
|
2086
|
-
const callback =
|
2190
|
+
const callback = useCallback10(() => {
|
2087
2191
|
const { cancel } = useComposer.getState();
|
2088
2192
|
cancel();
|
2089
2193
|
}, [useComposer]);
|
@@ -2102,7 +2206,7 @@ var useComposerIf = (props) => {
|
|
2102
2206
|
};
|
2103
2207
|
|
2104
2208
|
// src/primitive-hooks/composer/useComposerSend.tsx
|
2105
|
-
import { useCallback as
|
2209
|
+
import { useCallback as useCallback11 } from "react";
|
2106
2210
|
var useComposerSend = () => {
|
2107
2211
|
const {
|
2108
2212
|
useThread,
|
@@ -2114,7 +2218,7 @@ var useComposerSend = () => {
|
|
2114
2218
|
[useThread, useComposer],
|
2115
2219
|
(t, c) => t.isRunning || !c.isEditing || c.text.length === 0
|
2116
2220
|
);
|
2117
|
-
const callback =
|
2221
|
+
const callback = useCallback11(() => {
|
2118
2222
|
const composerState = useComposer.getState();
|
2119
2223
|
if (!composerState.isEditing) return;
|
2120
2224
|
composerState.send();
|
@@ -2169,7 +2273,7 @@ var useMessageIf = (props) => {
|
|
2169
2273
|
const { useMessage, useMessageUtils } = useMessageContext();
|
2170
2274
|
return useCombinedStore(
|
2171
2275
|
[useMessage, useMessageUtils],
|
2172
|
-
({ message, branches, isLast }, { isCopied, isHovering }) => {
|
2276
|
+
({ message, branches, isLast }, { isCopied, isHovering, isSpeaking }) => {
|
2173
2277
|
if (props.hasBranches === true && branches.length < 2) return false;
|
2174
2278
|
if (props.user && message.role !== "user") return false;
|
2175
2279
|
if (props.assistant && message.role !== "assistant") return false;
|
@@ -2177,6 +2281,8 @@ var useMessageIf = (props) => {
|
|
2177
2281
|
if (props.lastOrHover === true && !isHovering && !isLast) return false;
|
2178
2282
|
if (props.copied === true && !isCopied) return false;
|
2179
2283
|
if (props.copied === false && isCopied) return false;
|
2284
|
+
if (props.speaking === true && !isSpeaking) return false;
|
2285
|
+
if (props.speaking === false && isSpeaking) return false;
|
2180
2286
|
return true;
|
2181
2287
|
}
|
2182
2288
|
);
|
@@ -2205,11 +2311,11 @@ var useThreadEmpty = () => {
|
|
2205
2311
|
};
|
2206
2312
|
|
2207
2313
|
// src/primitive-hooks/thread/useThreadScrollToBottom.tsx
|
2208
|
-
import { useCallback as
|
2314
|
+
import { useCallback as useCallback12 } from "react";
|
2209
2315
|
var useThreadScrollToBottom = () => {
|
2210
2316
|
const { useComposer, useViewport } = useThreadContext();
|
2211
2317
|
const isAtBottom = useViewport((s) => s.isAtBottom);
|
2212
|
-
const handleScrollToBottom =
|
2318
|
+
const handleScrollToBottom = useCallback12(() => {
|
2213
2319
|
useViewport.getState().scrollToBottom();
|
2214
2320
|
useComposer.getState().focus();
|
2215
2321
|
}, [useViewport, useComposer]);
|
@@ -2218,7 +2324,7 @@ var useThreadScrollToBottom = () => {
|
|
2218
2324
|
};
|
2219
2325
|
|
2220
2326
|
// src/primitive-hooks/thread/useThreadSuggestion.tsx
|
2221
|
-
import { useCallback as
|
2327
|
+
import { useCallback as useCallback13 } from "react";
|
2222
2328
|
var useThreadSuggestion = ({
|
2223
2329
|
prompt,
|
2224
2330
|
autoSend
|
@@ -2226,7 +2332,7 @@ var useThreadSuggestion = ({
|
|
2226
2332
|
const { useThread, useComposer } = useThreadContext();
|
2227
2333
|
const append = useAppendMessage();
|
2228
2334
|
const disabled = useThread((t) => t.isDisabled);
|
2229
|
-
const callback =
|
2335
|
+
const callback = useCallback13(() => {
|
2230
2336
|
const thread = useThread.getState();
|
2231
2337
|
const composer = useComposer.getState();
|
2232
2338
|
if (autoSend && !thread.isRunning) {
|
@@ -2246,7 +2352,9 @@ __export(actionBar_exports, {
|
|
2246
2352
|
Copy: () => ActionBarPrimitiveCopy,
|
2247
2353
|
Edit: () => ActionBarPrimitiveEdit,
|
2248
2354
|
Reload: () => ActionBarPrimitiveReload,
|
2249
|
-
Root: () => ActionBarPrimitiveRoot
|
2355
|
+
Root: () => ActionBarPrimitiveRoot,
|
2356
|
+
Speak: () => ActionBarPrimitiveSpeak,
|
2357
|
+
StopSpeaking: () => ActionBarPrimitiveStopSpeaking
|
2250
2358
|
});
|
2251
2359
|
|
2252
2360
|
// src/primitives/actionBar/ActionBarRoot.tsx
|
@@ -2348,6 +2456,40 @@ var ActionBarPrimitiveEdit = createActionButton(
|
|
2348
2456
|
useActionBarEdit
|
2349
2457
|
);
|
2350
2458
|
|
2459
|
+
// src/primitives/actionBar/ActionBarSpeak.tsx
|
2460
|
+
var ActionBarPrimitiveSpeak = createActionButton(
|
2461
|
+
"ActionBarPrimitive.Speak",
|
2462
|
+
useActionBarSpeak
|
2463
|
+
);
|
2464
|
+
|
2465
|
+
// src/primitives/actionBar/ActionBarStopSpeaking.tsx
|
2466
|
+
import { forwardRef as forwardRef7 } from "react";
|
2467
|
+
import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
|
2468
|
+
import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
|
2469
|
+
import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
|
2470
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
2471
|
+
var ActionBarPrimitiveStopSpeaking = forwardRef7((props, ref) => {
|
2472
|
+
const callback = useActionBarStopSpeaking();
|
2473
|
+
useEscapeKeydown((e) => {
|
2474
|
+
if (callback) {
|
2475
|
+
e.preventDefault();
|
2476
|
+
callback();
|
2477
|
+
}
|
2478
|
+
});
|
2479
|
+
return /* @__PURE__ */ jsx11(
|
2480
|
+
Primitive4.button,
|
2481
|
+
{
|
2482
|
+
type: "button",
|
2483
|
+
disabled: !callback,
|
2484
|
+
...props,
|
2485
|
+
ref,
|
2486
|
+
onClick: composeEventHandlers2(props.onClick, () => {
|
2487
|
+
callback?.();
|
2488
|
+
})
|
2489
|
+
}
|
2490
|
+
);
|
2491
|
+
});
|
2492
|
+
|
2351
2493
|
// src/primitives/assistantModal/index.ts
|
2352
2494
|
var assistantModal_exports = {};
|
2353
2495
|
__export(assistantModal_exports, {
|
@@ -2360,7 +2502,7 @@ __export(assistantModal_exports, {
|
|
2360
2502
|
// src/primitives/assistantModal/AssistantModalRoot.tsx
|
2361
2503
|
import { useState as useState9 } from "react";
|
2362
2504
|
import * as PopoverPrimitive2 from "@radix-ui/react-popover";
|
2363
|
-
import { composeEventHandlers as
|
2505
|
+
import { composeEventHandlers as composeEventHandlers3 } from "@radix-ui/primitive";
|
2364
2506
|
|
2365
2507
|
// src/utils/hooks/useOnComposerFocus.tsx
|
2366
2508
|
import { useCallbackRef as useCallbackRef2 } from "@radix-ui/react-use-callback-ref";
|
@@ -2380,7 +2522,7 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
2380
2522
|
var usePopoverScope = PopoverPrimitive.createPopoverScope();
|
2381
2523
|
|
2382
2524
|
// src/primitives/assistantModal/AssistantModalRoot.tsx
|
2383
|
-
import { jsx as
|
2525
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
2384
2526
|
var useAssistantModalOpenState = (defaultOpen = false) => {
|
2385
2527
|
const state = useState9(defaultOpen);
|
2386
2528
|
const [, setOpen] = state;
|
@@ -2398,12 +2540,12 @@ var AssistantModalPrimitiveRoot = ({
|
|
2398
2540
|
}) => {
|
2399
2541
|
const scope = usePopoverScope(__scopeAssistantModal);
|
2400
2542
|
const [modalOpen, setOpen] = useAssistantModalOpenState(defaultOpen);
|
2401
|
-
return /* @__PURE__ */
|
2543
|
+
return /* @__PURE__ */ jsx12(
|
2402
2544
|
PopoverPrimitive2.Root,
|
2403
2545
|
{
|
2404
2546
|
...scope,
|
2405
2547
|
open: open === void 0 ? modalOpen : open,
|
2406
|
-
onOpenChange:
|
2548
|
+
onOpenChange: composeEventHandlers3(onOpenChange, setOpen),
|
2407
2549
|
...rest
|
2408
2550
|
}
|
2409
2551
|
);
|
@@ -2411,26 +2553,26 @@ var AssistantModalPrimitiveRoot = ({
|
|
2411
2553
|
AssistantModalPrimitiveRoot.displayName = "AssistantModalPrimitive.Root";
|
2412
2554
|
|
2413
2555
|
// src/primitives/assistantModal/AssistantModalTrigger.tsx
|
2414
|
-
import { forwardRef as
|
2556
|
+
import { forwardRef as forwardRef8 } from "react";
|
2415
2557
|
import * as PopoverPrimitive3 from "@radix-ui/react-popover";
|
2416
|
-
import { jsx as
|
2417
|
-
var AssistantModalPrimitiveTrigger =
|
2558
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
2559
|
+
var AssistantModalPrimitiveTrigger = forwardRef8(
|
2418
2560
|
({
|
2419
2561
|
__scopeAssistantModal,
|
2420
2562
|
...rest
|
2421
2563
|
}, ref) => {
|
2422
2564
|
const scope = usePopoverScope(__scopeAssistantModal);
|
2423
|
-
return /* @__PURE__ */
|
2565
|
+
return /* @__PURE__ */ jsx13(PopoverPrimitive3.Trigger, { ...scope, ...rest, ref });
|
2424
2566
|
}
|
2425
2567
|
);
|
2426
2568
|
AssistantModalPrimitiveTrigger.displayName = "AssistantModalPrimitive.Trigger";
|
2427
2569
|
|
2428
2570
|
// src/primitives/assistantModal/AssistantModalContent.tsx
|
2429
|
-
import { forwardRef as
|
2571
|
+
import { forwardRef as forwardRef9 } from "react";
|
2430
2572
|
import * as PopoverPrimitive4 from "@radix-ui/react-popover";
|
2431
|
-
import { composeEventHandlers as
|
2432
|
-
import { jsx as
|
2433
|
-
var AssistantModalPrimitiveContent =
|
2573
|
+
import { composeEventHandlers as composeEventHandlers4 } from "@radix-ui/primitive";
|
2574
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
2575
|
+
var AssistantModalPrimitiveContent = forwardRef9(
|
2434
2576
|
({
|
2435
2577
|
__scopeAssistantModal,
|
2436
2578
|
side,
|
@@ -2440,7 +2582,7 @@ var AssistantModalPrimitiveContent = forwardRef8(
|
|
2440
2582
|
...props
|
2441
2583
|
}, forwardedRef) => {
|
2442
2584
|
const scope = usePopoverScope(__scopeAssistantModal);
|
2443
|
-
return /* @__PURE__ */
|
2585
|
+
return /* @__PURE__ */ jsx14(PopoverPrimitive4.Portal, { ...scope, children: /* @__PURE__ */ jsx14(
|
2444
2586
|
PopoverPrimitive4.Content,
|
2445
2587
|
{
|
2446
2588
|
...scope,
|
@@ -2448,7 +2590,7 @@ var AssistantModalPrimitiveContent = forwardRef8(
|
|
2448
2590
|
ref: forwardedRef,
|
2449
2591
|
side: side ?? "top",
|
2450
2592
|
align: align ?? "end",
|
2451
|
-
onInteractOutside:
|
2593
|
+
onInteractOutside: composeEventHandlers4(
|
2452
2594
|
onInteractOutside,
|
2453
2595
|
dissmissOnInteractOutside ? void 0 : (e) => e.preventDefault()
|
2454
2596
|
)
|
@@ -2459,16 +2601,16 @@ var AssistantModalPrimitiveContent = forwardRef8(
|
|
2459
2601
|
AssistantModalPrimitiveContent.displayName = "AssistantModalPrimitive.Content";
|
2460
2602
|
|
2461
2603
|
// src/primitives/assistantModal/AssistantModalAnchor.tsx
|
2462
|
-
import { forwardRef as
|
2604
|
+
import { forwardRef as forwardRef10 } from "react";
|
2463
2605
|
import * as PopoverPrimitive5 from "@radix-ui/react-popover";
|
2464
|
-
import { jsx as
|
2465
|
-
var AssistantModalPrimitiveAnchor =
|
2606
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
2607
|
+
var AssistantModalPrimitiveAnchor = forwardRef10(
|
2466
2608
|
({
|
2467
2609
|
__scopeAssistantModal,
|
2468
2610
|
...rest
|
2469
2611
|
}, ref) => {
|
2470
2612
|
const scope = usePopoverScope(__scopeAssistantModal);
|
2471
|
-
return /* @__PURE__ */
|
2613
|
+
return /* @__PURE__ */ jsx15(PopoverPrimitive5.Anchor, { ...scope, ...rest, ref });
|
2472
2614
|
}
|
2473
2615
|
);
|
2474
2616
|
AssistantModalPrimitiveAnchor.displayName = "AssistantModalPrimitive.Anchor";
|
@@ -2496,24 +2638,24 @@ var BranchPickerPrevious = createActionButton(
|
|
2496
2638
|
);
|
2497
2639
|
|
2498
2640
|
// src/primitives/branchPicker/BranchPickerCount.tsx
|
2499
|
-
import { Fragment, jsx as
|
2641
|
+
import { Fragment, jsx as jsx16 } from "react/jsx-runtime";
|
2500
2642
|
var BranchPickerPrimitiveCount = () => {
|
2501
2643
|
const branchCount = useBranchPickerCount();
|
2502
|
-
return /* @__PURE__ */
|
2644
|
+
return /* @__PURE__ */ jsx16(Fragment, { children: branchCount });
|
2503
2645
|
};
|
2504
2646
|
BranchPickerPrimitiveCount.displayName = "BranchPickerPrimitive.Count";
|
2505
2647
|
|
2506
2648
|
// src/primitives/branchPicker/BranchPickerNumber.tsx
|
2507
|
-
import { Fragment as Fragment2, jsx as
|
2649
|
+
import { Fragment as Fragment2, jsx as jsx17 } from "react/jsx-runtime";
|
2508
2650
|
var BranchPickerPrimitiveNumber = () => {
|
2509
2651
|
const branchNumber = useBranchPickerNumber();
|
2510
|
-
return /* @__PURE__ */
|
2652
|
+
return /* @__PURE__ */ jsx17(Fragment2, { children: branchNumber });
|
2511
2653
|
};
|
2512
2654
|
BranchPickerPrimitiveNumber.displayName = "BranchPickerPrimitive.Number";
|
2513
2655
|
|
2514
2656
|
// src/primitives/branchPicker/BranchPickerRoot.tsx
|
2515
|
-
import { Primitive as
|
2516
|
-
import { forwardRef as
|
2657
|
+
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
2658
|
+
import { forwardRef as forwardRef14 } from "react";
|
2517
2659
|
|
2518
2660
|
// src/primitives/message/index.ts
|
2519
2661
|
var message_exports = {};
|
@@ -2525,17 +2667,17 @@ __export(message_exports, {
|
|
2525
2667
|
});
|
2526
2668
|
|
2527
2669
|
// src/primitives/message/MessageRoot.tsx
|
2528
|
-
import { Primitive as
|
2670
|
+
import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
|
2529
2671
|
import {
|
2530
|
-
forwardRef as
|
2531
|
-
useCallback as
|
2672
|
+
forwardRef as forwardRef11,
|
2673
|
+
useCallback as useCallback15
|
2532
2674
|
} from "react";
|
2533
2675
|
|
2534
2676
|
// src/utils/hooks/useManagedRef.ts
|
2535
|
-
import { useCallback as
|
2677
|
+
import { useCallback as useCallback14, useRef as useRef3 } from "react";
|
2536
2678
|
var useManagedRef = (callback) => {
|
2537
2679
|
const cleanupRef = useRef3();
|
2538
|
-
const ref =
|
2680
|
+
const ref = useCallback14(
|
2539
2681
|
(el) => {
|
2540
2682
|
if (cleanupRef.current) {
|
2541
2683
|
cleanupRef.current();
|
@@ -2551,10 +2693,10 @@ var useManagedRef = (callback) => {
|
|
2551
2693
|
|
2552
2694
|
// src/primitives/message/MessageRoot.tsx
|
2553
2695
|
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
2554
|
-
import { jsx as
|
2696
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
2555
2697
|
var useIsHoveringRef = () => {
|
2556
2698
|
const { useMessageUtils } = useMessageContext();
|
2557
|
-
const callbackRef =
|
2699
|
+
const callbackRef = useCallback15(
|
2558
2700
|
(el) => {
|
2559
2701
|
const setIsHovering = useMessageUtils.getState().setIsHovering;
|
2560
2702
|
const handleMouseEnter = () => {
|
@@ -2575,10 +2717,10 @@ var useIsHoveringRef = () => {
|
|
2575
2717
|
);
|
2576
2718
|
return useManagedRef(callbackRef);
|
2577
2719
|
};
|
2578
|
-
var MessagePrimitiveRoot =
|
2720
|
+
var MessagePrimitiveRoot = forwardRef11(({ onMouseEnter, onMouseLeave, ...rest }, forwardRef30) => {
|
2579
2721
|
const isHoveringRef = useIsHoveringRef();
|
2580
|
-
const ref = useComposedRefs(
|
2581
|
-
return /* @__PURE__ */
|
2722
|
+
const ref = useComposedRefs(forwardRef30, isHoveringRef);
|
2723
|
+
return /* @__PURE__ */ jsx18(Primitive5.div, { ...rest, ref });
|
2582
2724
|
});
|
2583
2725
|
MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
|
2584
2726
|
|
@@ -2598,7 +2740,7 @@ import { memo as memo2 } from "react";
|
|
2598
2740
|
// src/context/providers/ContentPartProvider.tsx
|
2599
2741
|
import { useEffect as useEffect9, useState as useState10 } from "react";
|
2600
2742
|
import { create as create12 } from "zustand";
|
2601
|
-
import { jsx as
|
2743
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
2602
2744
|
var COMPLETE_STATUS = {
|
2603
2745
|
type: "complete"
|
2604
2746
|
};
|
@@ -2661,32 +2803,32 @@ var ContentPartProvider = ({
|
|
2661
2803
|
children
|
2662
2804
|
}) => {
|
2663
2805
|
const context = useContentPartContext2(partIndex);
|
2664
|
-
return /* @__PURE__ */
|
2806
|
+
return /* @__PURE__ */ jsx19(ContentPartContext.Provider, { value: context, children });
|
2665
2807
|
};
|
2666
2808
|
|
2667
2809
|
// src/primitives/contentPart/ContentPartText.tsx
|
2668
2810
|
import {
|
2669
|
-
forwardRef as
|
2811
|
+
forwardRef as forwardRef12
|
2670
2812
|
} from "react";
|
2671
|
-
import { jsx as
|
2672
|
-
var ContentPartPrimitiveText =
|
2813
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
2814
|
+
var ContentPartPrimitiveText = forwardRef12(({ smooth = true, component: Component = "span", ...rest }, forwardedRef) => {
|
2673
2815
|
const {
|
2674
2816
|
part: { text },
|
2675
2817
|
status
|
2676
2818
|
} = useSmooth(useContentPartText(), smooth);
|
2677
|
-
return /* @__PURE__ */
|
2819
|
+
return /* @__PURE__ */ jsx20(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
|
2678
2820
|
});
|
2679
2821
|
ContentPartPrimitiveText.displayName = "ContentPartPrimitive.Text";
|
2680
2822
|
|
2681
2823
|
// src/primitives/contentPart/ContentPartImage.tsx
|
2682
|
-
import { Primitive as
|
2683
|
-
import { forwardRef as
|
2684
|
-
import { jsx as
|
2685
|
-
var ContentPartPrimitiveImage =
|
2824
|
+
import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
|
2825
|
+
import { forwardRef as forwardRef13 } from "react";
|
2826
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
2827
|
+
var ContentPartPrimitiveImage = forwardRef13((props, forwardedRef) => {
|
2686
2828
|
const {
|
2687
2829
|
part: { image }
|
2688
2830
|
} = useContentPartImage();
|
2689
|
-
return /* @__PURE__ */
|
2831
|
+
return /* @__PURE__ */ jsx21(Primitive6.img, { src: image, ...props, ref: forwardedRef });
|
2690
2832
|
});
|
2691
2833
|
ContentPartPrimitiveImage.displayName = "ContentPartPrimitive.Image";
|
2692
2834
|
|
@@ -2708,20 +2850,20 @@ var ContentPartPrimitiveInProgress = ({ children }) => {
|
|
2708
2850
|
ContentPartPrimitiveInProgress.displayName = "ContentPartPrimitive.InProgress";
|
2709
2851
|
|
2710
2852
|
// src/primitives/message/MessageContent.tsx
|
2711
|
-
import { jsx as
|
2853
|
+
import { jsx as jsx22, jsxs as jsxs3 } from "react/jsx-runtime";
|
2712
2854
|
var defaultComponents = {
|
2713
2855
|
Text: () => /* @__PURE__ */ jsxs3("p", { style: { whiteSpace: "pre-line" }, children: [
|
2714
|
-
/* @__PURE__ */
|
2715
|
-
/* @__PURE__ */
|
2856
|
+
/* @__PURE__ */ jsx22(ContentPartPrimitiveText, {}),
|
2857
|
+
/* @__PURE__ */ jsx22(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ jsx22("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
|
2716
2858
|
] }),
|
2717
|
-
Image: () => /* @__PURE__ */
|
2718
|
-
UI: () => /* @__PURE__ */
|
2859
|
+
Image: () => /* @__PURE__ */ jsx22(ContentPartPrimitiveImage, {}),
|
2860
|
+
UI: () => /* @__PURE__ */ jsx22(ContentPartPrimitiveDisplay, {}),
|
2719
2861
|
tools: {
|
2720
2862
|
Fallback: (props) => {
|
2721
2863
|
const { useToolUIs } = useAssistantContext();
|
2722
2864
|
const Render = useToolUIs((s) => s.getToolUI(props.part.toolName));
|
2723
2865
|
if (!Render) return null;
|
2724
|
-
return /* @__PURE__ */
|
2866
|
+
return /* @__PURE__ */ jsx22(Render, { ...props });
|
2725
2867
|
}
|
2726
2868
|
}
|
2727
2869
|
};
|
@@ -2744,16 +2886,16 @@ var MessageContentPartComponent = ({
|
|
2744
2886
|
case "text":
|
2745
2887
|
if (status.type === "requires-action")
|
2746
2888
|
throw new Error("Encountered unexpected requires-action status");
|
2747
|
-
if (part === EMPTY_CONTENT) return /* @__PURE__ */
|
2748
|
-
return /* @__PURE__ */
|
2889
|
+
if (part === EMPTY_CONTENT) return /* @__PURE__ */ jsx22(Empty, { part, status });
|
2890
|
+
return /* @__PURE__ */ jsx22(Text2, { part, status });
|
2749
2891
|
case "image":
|
2750
2892
|
if (status.type === "requires-action")
|
2751
2893
|
throw new Error("Encountered unexpected requires-action status");
|
2752
|
-
return /* @__PURE__ */
|
2894
|
+
return /* @__PURE__ */ jsx22(Image2, { part, status });
|
2753
2895
|
case "ui":
|
2754
2896
|
if (status.type === "requires-action")
|
2755
2897
|
throw new Error("Encountered unexpected requires-action status");
|
2756
|
-
return /* @__PURE__ */
|
2898
|
+
return /* @__PURE__ */ jsx22(UI, { part, status });
|
2757
2899
|
case "tool-call": {
|
2758
2900
|
const Tool = by_name[part.toolName] || Fallback2;
|
2759
2901
|
const addResult = (result) => addToolResult({
|
@@ -2761,7 +2903,7 @@ var MessageContentPartComponent = ({
|
|
2761
2903
|
toolCallId: part.toolCallId,
|
2762
2904
|
result
|
2763
2905
|
});
|
2764
|
-
return /* @__PURE__ */
|
2906
|
+
return /* @__PURE__ */ jsx22(Tool, { part, status, addResult });
|
2765
2907
|
}
|
2766
2908
|
default:
|
2767
2909
|
const unhandledType = type;
|
@@ -2772,7 +2914,7 @@ var MessageContentPartImpl = ({
|
|
2772
2914
|
partIndex,
|
2773
2915
|
components
|
2774
2916
|
}) => {
|
2775
|
-
return /* @__PURE__ */
|
2917
|
+
return /* @__PURE__ */ jsx22(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx22(MessageContentPartComponent, { components }) });
|
2776
2918
|
};
|
2777
2919
|
var MessageContentPart = memo2(
|
2778
2920
|
MessageContentPartImpl,
|
@@ -2785,7 +2927,7 @@ var MessagePrimitiveContent = ({
|
|
2785
2927
|
const contentLength = useMessage((s) => s.message.content.length) || 1;
|
2786
2928
|
return new Array(contentLength).fill(null).map((_, idx) => {
|
2787
2929
|
const partIndex = idx;
|
2788
|
-
return /* @__PURE__ */
|
2930
|
+
return /* @__PURE__ */ jsx22(
|
2789
2931
|
MessageContentPart,
|
2790
2932
|
{
|
2791
2933
|
partIndex,
|
@@ -2804,9 +2946,9 @@ var MessagePrimitiveInProgress = () => {
|
|
2804
2946
|
MessagePrimitiveInProgress.displayName = "MessagePrimitive.InProgress";
|
2805
2947
|
|
2806
2948
|
// src/primitives/branchPicker/BranchPickerRoot.tsx
|
2807
|
-
import { jsx as
|
2808
|
-
var BranchPickerPrimitiveRoot =
|
2809
|
-
return /* @__PURE__ */
|
2949
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
2950
|
+
var BranchPickerPrimitiveRoot = forwardRef14(({ hideWhenSingleBranch, ...rest }, ref) => {
|
2951
|
+
return /* @__PURE__ */ jsx23(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx23(Primitive7.div, { ...rest, ref }) });
|
2810
2952
|
});
|
2811
2953
|
BranchPickerPrimitiveRoot.displayName = "BranchPickerPrimitive.Root";
|
2812
2954
|
|
@@ -2821,44 +2963,44 @@ __export(composer_exports, {
|
|
2821
2963
|
});
|
2822
2964
|
|
2823
2965
|
// src/primitives/composer/ComposerRoot.tsx
|
2824
|
-
import { composeEventHandlers as
|
2825
|
-
import { Primitive as
|
2966
|
+
import { composeEventHandlers as composeEventHandlers5 } from "@radix-ui/primitive";
|
2967
|
+
import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
|
2826
2968
|
import {
|
2827
|
-
forwardRef as
|
2969
|
+
forwardRef as forwardRef15
|
2828
2970
|
} from "react";
|
2829
|
-
import { jsx as
|
2830
|
-
var ComposerPrimitiveRoot =
|
2971
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
2972
|
+
var ComposerPrimitiveRoot = forwardRef15(({ onSubmit, ...rest }, forwardedRef) => {
|
2831
2973
|
const send = useComposerSend();
|
2832
2974
|
const handleSubmit = (e) => {
|
2833
2975
|
e.preventDefault();
|
2834
2976
|
if (!send) return;
|
2835
2977
|
send();
|
2836
2978
|
};
|
2837
|
-
return /* @__PURE__ */
|
2838
|
-
|
2979
|
+
return /* @__PURE__ */ jsx24(
|
2980
|
+
Primitive8.form,
|
2839
2981
|
{
|
2840
2982
|
...rest,
|
2841
2983
|
ref: forwardedRef,
|
2842
|
-
onSubmit:
|
2984
|
+
onSubmit: composeEventHandlers5(onSubmit, handleSubmit)
|
2843
2985
|
}
|
2844
2986
|
);
|
2845
2987
|
});
|
2846
2988
|
ComposerPrimitiveRoot.displayName = "ComposerPrimitive.Root";
|
2847
2989
|
|
2848
2990
|
// src/primitives/composer/ComposerInput.tsx
|
2849
|
-
import { composeEventHandlers as
|
2991
|
+
import { composeEventHandlers as composeEventHandlers6 } from "@radix-ui/primitive";
|
2850
2992
|
import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
|
2851
2993
|
import { Slot } from "@radix-ui/react-slot";
|
2852
2994
|
import {
|
2853
|
-
forwardRef as
|
2854
|
-
useCallback as
|
2995
|
+
forwardRef as forwardRef16,
|
2996
|
+
useCallback as useCallback16,
|
2855
2997
|
useEffect as useEffect10,
|
2856
2998
|
useRef as useRef4
|
2857
2999
|
} from "react";
|
2858
3000
|
import TextareaAutosize from "react-textarea-autosize";
|
2859
|
-
import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
|
2860
|
-
import { jsx as
|
2861
|
-
var ComposerPrimitiveInput =
|
3001
|
+
import { useEscapeKeydown as useEscapeKeydown2 } from "@radix-ui/react-use-escape-keydown";
|
3002
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
3003
|
+
var ComposerPrimitiveInput = forwardRef16(
|
2862
3004
|
({
|
2863
3005
|
autoFocus = false,
|
2864
3006
|
asChild,
|
@@ -2877,7 +3019,7 @@ var ComposerPrimitiveInput = forwardRef15(
|
|
2877
3019
|
const isDisabled = useThread((t) => t.isDisabled) ?? disabledProp ?? false;
|
2878
3020
|
const textareaRef = useRef4(null);
|
2879
3021
|
const ref = useComposedRefs2(forwardedRef, textareaRef);
|
2880
|
-
|
3022
|
+
useEscapeKeydown2((e) => {
|
2881
3023
|
const composer = useComposer.getState();
|
2882
3024
|
if (composer.canCancel) {
|
2883
3025
|
composer.cancel();
|
@@ -2896,7 +3038,7 @@ var ComposerPrimitiveInput = forwardRef15(
|
|
2896
3038
|
}
|
2897
3039
|
};
|
2898
3040
|
const autoFocusEnabled = autoFocus && !isDisabled;
|
2899
|
-
const focus =
|
3041
|
+
const focus = useCallback16(() => {
|
2900
3042
|
const textarea = textareaRef.current;
|
2901
3043
|
if (!textarea || !autoFocusEnabled) return;
|
2902
3044
|
textarea.focus({ preventScroll: true });
|
@@ -2911,7 +3053,7 @@ var ComposerPrimitiveInput = forwardRef15(
|
|
2911
3053
|
focus();
|
2912
3054
|
}
|
2913
3055
|
});
|
2914
|
-
return /* @__PURE__ */
|
3056
|
+
return /* @__PURE__ */ jsx25(
|
2915
3057
|
Component,
|
2916
3058
|
{
|
2917
3059
|
name: "input",
|
@@ -2919,12 +3061,12 @@ var ComposerPrimitiveInput = forwardRef15(
|
|
2919
3061
|
...rest,
|
2920
3062
|
ref,
|
2921
3063
|
disabled: isDisabled,
|
2922
|
-
onChange:
|
3064
|
+
onChange: composeEventHandlers6(onChange, (e) => {
|
2923
3065
|
const composerState = useComposer.getState();
|
2924
3066
|
if (!composerState.isEditing) return;
|
2925
3067
|
return composerState.setText(e.target.value);
|
2926
3068
|
}),
|
2927
|
-
onKeyDown:
|
3069
|
+
onKeyDown: composeEventHandlers6(onKeyDown, handleKeyPress)
|
2928
3070
|
}
|
2929
3071
|
);
|
2930
3072
|
}
|
@@ -2932,14 +3074,14 @@ var ComposerPrimitiveInput = forwardRef15(
|
|
2932
3074
|
ComposerPrimitiveInput.displayName = "ComposerPrimitive.Input";
|
2933
3075
|
|
2934
3076
|
// src/primitives/composer/ComposerSend.tsx
|
2935
|
-
import { forwardRef as
|
2936
|
-
import { Primitive as
|
2937
|
-
import { jsx as
|
2938
|
-
var ComposerPrimitiveSend =
|
3077
|
+
import { forwardRef as forwardRef17 } from "react";
|
3078
|
+
import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
|
3079
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
3080
|
+
var ComposerPrimitiveSend = forwardRef17(({ disabled, ...rest }, ref) => {
|
2939
3081
|
const { useComposer } = useComposerContext();
|
2940
3082
|
const hasValue = useComposer((c) => c.isEditing && c.text.length > 0);
|
2941
|
-
return /* @__PURE__ */
|
2942
|
-
|
3083
|
+
return /* @__PURE__ */ jsx26(
|
3084
|
+
Primitive9.button,
|
2943
3085
|
{
|
2944
3086
|
type: "submit",
|
2945
3087
|
...rest,
|
@@ -2988,11 +3130,11 @@ __export(thread_exports, {
|
|
2988
3130
|
});
|
2989
3131
|
|
2990
3132
|
// src/primitives/thread/ThreadRoot.tsx
|
2991
|
-
import { Primitive as
|
2992
|
-
import { forwardRef as
|
2993
|
-
import { jsx as
|
2994
|
-
var ThreadPrimitiveRoot =
|
2995
|
-
return /* @__PURE__ */
|
3133
|
+
import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
|
3134
|
+
import { forwardRef as forwardRef18 } from "react";
|
3135
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
3136
|
+
var ThreadPrimitiveRoot = forwardRef18((props, ref) => {
|
3137
|
+
return /* @__PURE__ */ jsx27(Primitive10.div, { ...props, ref });
|
2996
3138
|
});
|
2997
3139
|
ThreadPrimitiveRoot.displayName = "ThreadPrimitive.Root";
|
2998
3140
|
|
@@ -3017,8 +3159,8 @@ ThreadPrimitiveIf.displayName = "ThreadPrimitive.If";
|
|
3017
3159
|
|
3018
3160
|
// src/primitives/thread/ThreadViewport.tsx
|
3019
3161
|
import { useComposedRefs as useComposedRefs4 } from "@radix-ui/react-compose-refs";
|
3020
|
-
import { Primitive as
|
3021
|
-
import { forwardRef as
|
3162
|
+
import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
|
3163
|
+
import { forwardRef as forwardRef19 } from "react";
|
3022
3164
|
|
3023
3165
|
// src/primitive-hooks/thread/useThreadViewportAutoScroll.tsx
|
3024
3166
|
import { useComposedRefs as useComposedRefs3 } from "@radix-ui/react-compose-refs";
|
@@ -3026,10 +3168,10 @@ import { useRef as useRef5 } from "react";
|
|
3026
3168
|
|
3027
3169
|
// src/utils/hooks/useOnResizeContent.tsx
|
3028
3170
|
import { useCallbackRef as useCallbackRef3 } from "@radix-ui/react-use-callback-ref";
|
3029
|
-
import { useCallback as
|
3171
|
+
import { useCallback as useCallback17 } from "react";
|
3030
3172
|
var useOnResizeContent = (callback) => {
|
3031
3173
|
const callbackRef = useCallbackRef3(callback);
|
3032
|
-
const refCallback =
|
3174
|
+
const refCallback = useCallback17(
|
3033
3175
|
(el) => {
|
3034
3176
|
const resizeObserver = new ResizeObserver(() => {
|
3035
3177
|
callbackRef();
|
@@ -3129,13 +3271,13 @@ var useThreadViewportAutoScroll = ({
|
|
3129
3271
|
};
|
3130
3272
|
|
3131
3273
|
// src/primitives/thread/ThreadViewport.tsx
|
3132
|
-
import { jsx as
|
3133
|
-
var ThreadPrimitiveViewport =
|
3274
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
3275
|
+
var ThreadPrimitiveViewport = forwardRef19(({ autoScroll, onScroll, children, ...rest }, forwardedRef) => {
|
3134
3276
|
const autoScrollRef = useThreadViewportAutoScroll({
|
3135
3277
|
autoScroll
|
3136
3278
|
});
|
3137
3279
|
const ref = useComposedRefs4(forwardedRef, autoScrollRef);
|
3138
|
-
return /* @__PURE__ */
|
3280
|
+
return /* @__PURE__ */ jsx28(Primitive11.div, { ...rest, ref, children });
|
3139
3281
|
});
|
3140
3282
|
ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
|
3141
3283
|
|
@@ -3180,19 +3322,33 @@ var makeEditComposerStore = ({
|
|
3180
3322
|
|
3181
3323
|
// src/context/stores/MessageUtils.ts
|
3182
3324
|
import { create as create14 } from "zustand";
|
3183
|
-
var makeMessageUtilsStore = () => create14((set) =>
|
3184
|
-
|
3185
|
-
|
3186
|
-
|
3187
|
-
|
3188
|
-
|
3189
|
-
|
3190
|
-
|
3191
|
-
|
3192
|
-
})
|
3325
|
+
var makeMessageUtilsStore = () => create14((set) => {
|
3326
|
+
let utterance = null;
|
3327
|
+
return {
|
3328
|
+
isCopied: false,
|
3329
|
+
setIsCopied: (value) => {
|
3330
|
+
set({ isCopied: value });
|
3331
|
+
},
|
3332
|
+
isHovering: false,
|
3333
|
+
setIsHovering: (value) => {
|
3334
|
+
set({ isHovering: value });
|
3335
|
+
},
|
3336
|
+
isSpeaking: false,
|
3337
|
+
stopSpeaking: () => {
|
3338
|
+
utterance?.stop();
|
3339
|
+
},
|
3340
|
+
addUtterance: (utt) => {
|
3341
|
+
utterance = utt;
|
3342
|
+
set({ isSpeaking: true });
|
3343
|
+
utt.onEnd(() => {
|
3344
|
+
set({ isSpeaking: false });
|
3345
|
+
});
|
3346
|
+
}
|
3347
|
+
};
|
3348
|
+
});
|
3193
3349
|
|
3194
3350
|
// src/context/providers/MessageProvider.tsx
|
3195
|
-
import { jsx as
|
3351
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
3196
3352
|
var getIsLast = (messages, message) => {
|
3197
3353
|
return messages[messages.length - 1]?.id === message.id;
|
3198
3354
|
};
|
@@ -3276,11 +3432,11 @@ var MessageProvider = ({
|
|
3276
3432
|
children
|
3277
3433
|
}) => {
|
3278
3434
|
const context = useMessageContext2(messageIndex);
|
3279
|
-
return /* @__PURE__ */
|
3435
|
+
return /* @__PURE__ */ jsx29(MessageContext.Provider, { value: context, children });
|
3280
3436
|
};
|
3281
3437
|
|
3282
3438
|
// src/primitives/thread/ThreadMessages.tsx
|
3283
|
-
import { jsx as
|
3439
|
+
import { jsx as jsx30, jsxs as jsxs4 } from "react/jsx-runtime";
|
3284
3440
|
var DEFAULT_SYSTEM_MESSAGE = () => null;
|
3285
3441
|
var getComponents = (components) => {
|
3286
3442
|
return {
|
@@ -3297,11 +3453,11 @@ var ThreadMessageImpl = ({
|
|
3297
3453
|
const { UserMessage: UserMessage2, EditComposer: EditComposer2, AssistantMessage: AssistantMessage2, SystemMessage: SystemMessage2 } = getComponents(components);
|
3298
3454
|
return /* @__PURE__ */ jsxs4(MessageProvider, { messageIndex, children: [
|
3299
3455
|
/* @__PURE__ */ jsxs4(MessagePrimitiveIf, { user: true, children: [
|
3300
|
-
/* @__PURE__ */
|
3301
|
-
/* @__PURE__ */
|
3456
|
+
/* @__PURE__ */ jsx30(ComposerPrimitiveIf, { editing: false, children: /* @__PURE__ */ jsx30(UserMessage2, {}) }),
|
3457
|
+
/* @__PURE__ */ jsx30(ComposerPrimitiveIf, { editing: true, children: /* @__PURE__ */ jsx30(EditComposer2, {}) })
|
3302
3458
|
] }),
|
3303
|
-
/* @__PURE__ */
|
3304
|
-
/* @__PURE__ */
|
3459
|
+
/* @__PURE__ */ jsx30(MessagePrimitiveIf, { assistant: true, children: /* @__PURE__ */ jsx30(AssistantMessage2, {}) }),
|
3460
|
+
/* @__PURE__ */ jsx30(MessagePrimitiveIf, { system: true, children: /* @__PURE__ */ jsx30(SystemMessage2, {}) })
|
3305
3461
|
] });
|
3306
3462
|
};
|
3307
3463
|
var ThreadMessage = memo3(
|
@@ -3316,7 +3472,7 @@ var ThreadPrimitiveMessagesImpl = ({
|
|
3316
3472
|
if (messagesLength === 0) return null;
|
3317
3473
|
return new Array(messagesLength).fill(null).map((_, idx) => {
|
3318
3474
|
const messageIndex = idx;
|
3319
|
-
return /* @__PURE__ */
|
3475
|
+
return /* @__PURE__ */ jsx30(
|
3320
3476
|
ThreadMessage,
|
3321
3477
|
{
|
3322
3478
|
messageIndex,
|
@@ -3350,7 +3506,7 @@ import {
|
|
3350
3506
|
createContext as createContext6,
|
3351
3507
|
useContext as useContext6
|
3352
3508
|
} from "react";
|
3353
|
-
import { Fragment as Fragment3, jsx as
|
3509
|
+
import { Fragment as Fragment3, jsx as jsx31 } from "react/jsx-runtime";
|
3354
3510
|
var ThreadConfigContext = createContext6({});
|
3355
3511
|
var useThreadConfig = () => {
|
3356
3512
|
return useContext6(ThreadConfigContext);
|
@@ -3360,27 +3516,39 @@ var ThreadConfigProvider = ({
|
|
3360
3516
|
config
|
3361
3517
|
}) => {
|
3362
3518
|
const assistant = useAssistantContext({ optional: true });
|
3363
|
-
const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */
|
3519
|
+
const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx31(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx31(Fragment3, { children });
|
3364
3520
|
if (!config?.runtime) return configProvider;
|
3365
3521
|
if (assistant) {
|
3366
3522
|
throw new Error(
|
3367
3523
|
"You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
|
3368
3524
|
);
|
3369
3525
|
}
|
3370
|
-
return /* @__PURE__ */
|
3526
|
+
return /* @__PURE__ */ jsx31(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
|
3371
3527
|
};
|
3372
3528
|
ThreadConfigProvider.displayName = "ThreadConfigProvider";
|
3373
3529
|
|
3374
3530
|
// src/ui/assistant-action-bar.tsx
|
3375
|
-
import { forwardRef as
|
3376
|
-
import {
|
3377
|
-
|
3531
|
+
import { forwardRef as forwardRef20 } from "react";
|
3532
|
+
import {
|
3533
|
+
AudioLinesIcon,
|
3534
|
+
CheckIcon,
|
3535
|
+
CopyIcon,
|
3536
|
+
RefreshCwIcon,
|
3537
|
+
StopCircleIcon
|
3538
|
+
} from "lucide-react";
|
3539
|
+
import { Fragment as Fragment4, jsx as jsx32, jsxs as jsxs5 } from "react/jsx-runtime";
|
3378
3540
|
var useAllowCopy = () => {
|
3379
3541
|
const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();
|
3380
3542
|
const { useThread } = useThreadContext();
|
3381
|
-
const copySupported = useThread((t) => t.capabilities.
|
3543
|
+
const copySupported = useThread((t) => t.capabilities.unstable_copy);
|
3382
3544
|
return copySupported && allowCopy;
|
3383
3545
|
};
|
3546
|
+
var useAllowSpeak = () => {
|
3547
|
+
const { assistantMessage: { allowSpeak = true } = {} } = useThreadConfig();
|
3548
|
+
const { useThread } = useThreadContext();
|
3549
|
+
const speakSupported = useThread((t) => t.capabilities.speak);
|
3550
|
+
return speakSupported && allowSpeak;
|
3551
|
+
};
|
3384
3552
|
var useAllowReload = () => {
|
3385
3553
|
const { assistantMessage: { allowReload = true } = {} } = useThreadConfig();
|
3386
3554
|
const { useThread } = useThreadContext();
|
@@ -3398,8 +3566,9 @@ var AssistantActionBar = () => {
|
|
3398
3566
|
autohide: "not-last",
|
3399
3567
|
autohideFloat: "single-branch",
|
3400
3568
|
children: [
|
3401
|
-
/* @__PURE__ */
|
3402
|
-
/* @__PURE__ */
|
3569
|
+
/* @__PURE__ */ jsx32(AssistantActionBarSpeechControl, {}),
|
3570
|
+
/* @__PURE__ */ jsx32(AssistantActionBarCopy, {}),
|
3571
|
+
/* @__PURE__ */ jsx32(AssistantActionBarReload, {})
|
3403
3572
|
]
|
3404
3573
|
}
|
3405
3574
|
);
|
@@ -3409,21 +3578,51 @@ var AssistantActionBarRoot = withDefaults(actionBar_exports.Root, {
|
|
3409
3578
|
className: "aui-assistant-action-bar-root"
|
3410
3579
|
});
|
3411
3580
|
AssistantActionBarRoot.displayName = "AssistantActionBarRoot";
|
3412
|
-
var AssistantActionBarCopy =
|
3581
|
+
var AssistantActionBarCopy = forwardRef20((props, ref) => {
|
3413
3582
|
const {
|
3414
3583
|
strings: {
|
3415
|
-
assistantMessage: {
|
3584
|
+
assistantMessage: { copy: { tooltip = "Copy" } = {} } = {}
|
3416
3585
|
} = {}
|
3417
3586
|
} = useThreadConfig();
|
3418
3587
|
const allowCopy = useAllowCopy();
|
3419
3588
|
if (!allowCopy) return null;
|
3420
|
-
return /* @__PURE__ */
|
3421
|
-
/* @__PURE__ */
|
3422
|
-
/* @__PURE__ */
|
3589
|
+
return /* @__PURE__ */ jsx32(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
3590
|
+
/* @__PURE__ */ jsx32(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx32(CheckIcon, {}) }),
|
3591
|
+
/* @__PURE__ */ jsx32(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx32(CopyIcon, {}) })
|
3423
3592
|
] }) }) });
|
3424
3593
|
});
|
3425
3594
|
AssistantActionBarCopy.displayName = "AssistantActionBarCopy";
|
3426
|
-
var
|
3595
|
+
var AssistantActionBarSpeechControl = () => {
|
3596
|
+
return /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
3597
|
+
/* @__PURE__ */ jsx32(message_exports.If, { speaking: false, children: /* @__PURE__ */ jsx32(AssistantActionBarSpeak, {}) }),
|
3598
|
+
/* @__PURE__ */ jsx32(message_exports.If, { speaking: true, children: /* @__PURE__ */ jsx32(AssistantActionBarStopSpeaking, {}) })
|
3599
|
+
] });
|
3600
|
+
};
|
3601
|
+
var AssistantActionBarSpeak = forwardRef20((props, ref) => {
|
3602
|
+
const {
|
3603
|
+
strings: {
|
3604
|
+
assistantMessage: { speak: { tooltip = "Read aloud" } = {} } = {}
|
3605
|
+
} = {}
|
3606
|
+
} = useThreadConfig();
|
3607
|
+
const allowSpeak = useAllowSpeak();
|
3608
|
+
if (!allowSpeak) return null;
|
3609
|
+
return /* @__PURE__ */ jsx32(actionBar_exports.Speak, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx32(AudioLinesIcon, {}) }) });
|
3610
|
+
});
|
3611
|
+
AssistantActionBarSpeak.displayName = "AssistantActionBarSpeak";
|
3612
|
+
var AssistantActionBarStopSpeaking = forwardRef20((props, ref) => {
|
3613
|
+
const {
|
3614
|
+
strings: {
|
3615
|
+
assistantMessage: {
|
3616
|
+
speak: { stop: { tooltip: stopTooltip = "Stop" } = {} } = {}
|
3617
|
+
} = {}
|
3618
|
+
} = {}
|
3619
|
+
} = useThreadConfig();
|
3620
|
+
const allowSpeak = useAllowSpeak();
|
3621
|
+
if (!allowSpeak) return null;
|
3622
|
+
return /* @__PURE__ */ jsx32(actionBar_exports.StopSpeaking, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip: stopTooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx32(StopCircleIcon, {}) }) });
|
3623
|
+
});
|
3624
|
+
AssistantActionBarStopSpeaking.displayName = "AssistantActionBarStopSpeaking";
|
3625
|
+
var AssistantActionBarReload = forwardRef20((props, ref) => {
|
3427
3626
|
const {
|
3428
3627
|
strings: {
|
3429
3628
|
assistantMessage: { reload: { tooltip = "Refresh" } = {} } = {}
|
@@ -3431,13 +3630,16 @@ var AssistantActionBarReload = forwardRef19((props, ref) => {
|
|
3431
3630
|
} = useThreadConfig();
|
3432
3631
|
const allowReload = useAllowReload();
|
3433
3632
|
if (!allowReload) return null;
|
3434
|
-
return /* @__PURE__ */
|
3633
|
+
return /* @__PURE__ */ jsx32(actionBar_exports.Reload, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: /* @__PURE__ */ jsx32(RefreshCwIcon, {}) }) });
|
3435
3634
|
});
|
3436
3635
|
AssistantActionBarReload.displayName = "AssistantActionBarReload";
|
3437
3636
|
var exports = {
|
3438
3637
|
Root: AssistantActionBarRoot,
|
3439
3638
|
Reload: AssistantActionBarReload,
|
3440
|
-
Copy: AssistantActionBarCopy
|
3639
|
+
Copy: AssistantActionBarCopy,
|
3640
|
+
Speak: AssistantActionBarSpeak,
|
3641
|
+
StopSpeaking: AssistantActionBarStopSpeaking,
|
3642
|
+
SpeechControl: AssistantActionBarSpeechControl
|
3441
3643
|
};
|
3442
3644
|
var assistant_action_bar_default = Object.assign(
|
3443
3645
|
AssistantActionBar,
|
@@ -3445,12 +3647,12 @@ var assistant_action_bar_default = Object.assign(
|
|
3445
3647
|
);
|
3446
3648
|
|
3447
3649
|
// src/ui/assistant-message.tsx
|
3448
|
-
import { forwardRef as
|
3650
|
+
import { forwardRef as forwardRef22 } from "react";
|
3449
3651
|
|
3450
3652
|
// src/ui/branch-picker.tsx
|
3451
|
-
import { forwardRef as
|
3653
|
+
import { forwardRef as forwardRef21 } from "react";
|
3452
3654
|
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
3453
|
-
import { jsx as
|
3655
|
+
import { jsx as jsx33, jsxs as jsxs6 } from "react/jsx-runtime";
|
3454
3656
|
var useAllowBranchPicker = () => {
|
3455
3657
|
const { branchPicker: { allowBranchPicker = true } = {} } = useThreadConfig();
|
3456
3658
|
const { useThread } = useThreadContext();
|
@@ -3461,9 +3663,9 @@ var BranchPicker = () => {
|
|
3461
3663
|
const allowBranchPicker = useAllowBranchPicker();
|
3462
3664
|
if (!allowBranchPicker) return null;
|
3463
3665
|
return /* @__PURE__ */ jsxs6(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
|
3464
|
-
/* @__PURE__ */
|
3465
|
-
/* @__PURE__ */
|
3466
|
-
/* @__PURE__ */
|
3666
|
+
/* @__PURE__ */ jsx33(BranchPickerPrevious2, {}),
|
3667
|
+
/* @__PURE__ */ jsx33(BranchPickerState, {}),
|
3668
|
+
/* @__PURE__ */ jsx33(BranchPickerNext, {})
|
3467
3669
|
] });
|
3468
3670
|
};
|
3469
3671
|
BranchPicker.displayName = "BranchPicker";
|
@@ -3471,31 +3673,31 @@ var BranchPickerRoot = withDefaults(branchPicker_exports.Root, {
|
|
3471
3673
|
className: "aui-branch-picker-root"
|
3472
3674
|
});
|
3473
3675
|
BranchPickerRoot.displayName = "BranchPickerRoot";
|
3474
|
-
var BranchPickerPrevious2 =
|
3676
|
+
var BranchPickerPrevious2 = forwardRef21((props, ref) => {
|
3475
3677
|
const {
|
3476
3678
|
strings: {
|
3477
3679
|
branchPicker: { previous: { tooltip = "Previous" } = {} } = {}
|
3478
3680
|
} = {}
|
3479
3681
|
} = useThreadConfig();
|
3480
|
-
return /* @__PURE__ */
|
3682
|
+
return /* @__PURE__ */ jsx33(branchPicker_exports.Previous, { asChild: true, children: /* @__PURE__ */ jsx33(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx33(ChevronLeftIcon, {}) }) });
|
3481
3683
|
});
|
3482
3684
|
BranchPickerPrevious2.displayName = "BranchPickerPrevious";
|
3483
3685
|
var BranchPickerStateWrapper = withDefaults("span", {
|
3484
3686
|
className: "aui-branch-picker-state"
|
3485
3687
|
});
|
3486
|
-
var BranchPickerState =
|
3688
|
+
var BranchPickerState = forwardRef21((props, ref) => {
|
3487
3689
|
return /* @__PURE__ */ jsxs6(BranchPickerStateWrapper, { ...props, ref, children: [
|
3488
|
-
/* @__PURE__ */
|
3690
|
+
/* @__PURE__ */ jsx33(branchPicker_exports.Number, {}),
|
3489
3691
|
" / ",
|
3490
|
-
/* @__PURE__ */
|
3692
|
+
/* @__PURE__ */ jsx33(branchPicker_exports.Count, {})
|
3491
3693
|
] });
|
3492
3694
|
});
|
3493
3695
|
BranchPickerState.displayName = "BranchPickerState";
|
3494
|
-
var BranchPickerNext =
|
3696
|
+
var BranchPickerNext = forwardRef21((props, ref) => {
|
3495
3697
|
const {
|
3496
3698
|
strings: { branchPicker: { next: { tooltip = "Next" } = {} } = {} } = {}
|
3497
3699
|
} = useThreadConfig();
|
3498
|
-
return /* @__PURE__ */
|
3700
|
+
return /* @__PURE__ */ jsx33(branchPicker_exports.Next, { asChild: true, children: /* @__PURE__ */ jsx33(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx33(ChevronRightIcon, {}) }) });
|
3499
3701
|
});
|
3500
3702
|
BranchPickerNext.displayName = "BranchPickerNext";
|
3501
3703
|
var exports2 = {
|
@@ -3507,12 +3709,12 @@ var branch_picker_default = Object.assign(BranchPicker, exports2);
|
|
3507
3709
|
|
3508
3710
|
// src/ui/base/avatar.tsx
|
3509
3711
|
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
3510
|
-
import { jsx as
|
3712
|
+
import { jsx as jsx34, jsxs as jsxs7 } from "react/jsx-runtime";
|
3511
3713
|
var Avatar = ({ src, alt, fallback }) => {
|
3512
3714
|
if (src == null && fallback == null) return null;
|
3513
3715
|
return /* @__PURE__ */ jsxs7(AvatarRoot, { children: [
|
3514
|
-
src != null && /* @__PURE__ */
|
3515
|
-
fallback != null && /* @__PURE__ */
|
3716
|
+
src != null && /* @__PURE__ */ jsx34(AvatarImage, { src, alt }),
|
3717
|
+
fallback != null && /* @__PURE__ */ jsx34(AvatarFallback, { children: fallback })
|
3516
3718
|
] });
|
3517
3719
|
};
|
3518
3720
|
Avatar.displayName = "Avatar";
|
@@ -3531,10 +3733,10 @@ AvatarFallback.displayName = "AvatarFallback";
|
|
3531
3733
|
|
3532
3734
|
// src/ui/content-part.tsx
|
3533
3735
|
import classNames2 from "classnames";
|
3534
|
-
import { jsx as
|
3736
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
3535
3737
|
var Text = () => {
|
3536
3738
|
const status = useSmoothStatus();
|
3537
|
-
return /* @__PURE__ */
|
3739
|
+
return /* @__PURE__ */ jsx35(
|
3538
3740
|
contentPart_exports.Text,
|
3539
3741
|
{
|
3540
3742
|
className: classNames2(
|
@@ -3549,19 +3751,19 @@ var exports3 = { Text: withSmoothContextProvider(Text) };
|
|
3549
3751
|
var content_part_default = exports3;
|
3550
3752
|
|
3551
3753
|
// src/ui/assistant-message.tsx
|
3552
|
-
import { jsx as
|
3754
|
+
import { jsx as jsx36, jsxs as jsxs8 } from "react/jsx-runtime";
|
3553
3755
|
var AssistantMessage = () => {
|
3554
3756
|
return /* @__PURE__ */ jsxs8(AssistantMessageRoot, { children: [
|
3555
|
-
/* @__PURE__ */
|
3556
|
-
/* @__PURE__ */
|
3557
|
-
/* @__PURE__ */
|
3558
|
-
/* @__PURE__ */
|
3757
|
+
/* @__PURE__ */ jsx36(AssistantMessageAvatar, {}),
|
3758
|
+
/* @__PURE__ */ jsx36(AssistantMessageContent, {}),
|
3759
|
+
/* @__PURE__ */ jsx36(branch_picker_default, {}),
|
3760
|
+
/* @__PURE__ */ jsx36(assistant_action_bar_default, {})
|
3559
3761
|
] });
|
3560
3762
|
};
|
3561
3763
|
AssistantMessage.displayName = "AssistantMessage";
|
3562
3764
|
var AssistantMessageAvatar = () => {
|
3563
3765
|
const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
|
3564
|
-
return /* @__PURE__ */
|
3766
|
+
return /* @__PURE__ */ jsx36(Avatar, { ...avatar });
|
3565
3767
|
};
|
3566
3768
|
var AssistantMessageRoot = withDefaults(message_exports.Root, {
|
3567
3769
|
className: "aui-assistant-message-root"
|
@@ -3570,9 +3772,9 @@ AssistantMessageRoot.displayName = "AssistantMessageRoot";
|
|
3570
3772
|
var AssistantMessageContentWrapper = withDefaults("div", {
|
3571
3773
|
className: "aui-assistant-message-content"
|
3572
3774
|
});
|
3573
|
-
var AssistantMessageContent =
|
3775
|
+
var AssistantMessageContent = forwardRef22(({ components: componentsProp, ...rest }, ref) => {
|
3574
3776
|
const { assistantMessage: { components = {} } = {} } = useThreadConfig();
|
3575
|
-
return /* @__PURE__ */
|
3777
|
+
return /* @__PURE__ */ jsx36(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx36(
|
3576
3778
|
message_exports.Content,
|
3577
3779
|
{
|
3578
3780
|
components: {
|
@@ -3594,21 +3796,21 @@ var assistant_message_default = Object.assign(
|
|
3594
3796
|
);
|
3595
3797
|
|
3596
3798
|
// src/ui/assistant-modal.tsx
|
3597
|
-
import { forwardRef as
|
3799
|
+
import { forwardRef as forwardRef29 } from "react";
|
3598
3800
|
import { BotIcon, ChevronDownIcon } from "lucide-react";
|
3599
3801
|
|
3600
3802
|
// src/ui/thread.tsx
|
3601
|
-
import { forwardRef as
|
3803
|
+
import { forwardRef as forwardRef28 } from "react";
|
3602
3804
|
import { ArrowDownIcon } from "lucide-react";
|
3603
3805
|
|
3604
3806
|
// src/ui/composer.tsx
|
3605
|
-
import { forwardRef as
|
3807
|
+
import { forwardRef as forwardRef23 } from "react";
|
3606
3808
|
import { SendHorizontalIcon } from "lucide-react";
|
3607
3809
|
|
3608
3810
|
// src/ui/base/CircleStopIcon.tsx
|
3609
|
-
import { jsx as
|
3811
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
3610
3812
|
var CircleStopIcon = () => {
|
3611
|
-
return /* @__PURE__ */
|
3813
|
+
return /* @__PURE__ */ jsx37(
|
3612
3814
|
"svg",
|
3613
3815
|
{
|
3614
3816
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -3616,18 +3818,18 @@ var CircleStopIcon = () => {
|
|
3616
3818
|
fill: "currentColor",
|
3617
3819
|
width: "16",
|
3618
3820
|
height: "16",
|
3619
|
-
children: /* @__PURE__ */
|
3821
|
+
children: /* @__PURE__ */ jsx37("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
|
3620
3822
|
}
|
3621
3823
|
);
|
3622
3824
|
};
|
3623
3825
|
CircleStopIcon.displayName = "CircleStopIcon";
|
3624
3826
|
|
3625
3827
|
// src/ui/composer.tsx
|
3626
|
-
import { Fragment as Fragment5, jsx as
|
3828
|
+
import { Fragment as Fragment5, jsx as jsx38, jsxs as jsxs9 } from "react/jsx-runtime";
|
3627
3829
|
var Composer = () => {
|
3628
3830
|
return /* @__PURE__ */ jsxs9(ComposerRoot, { children: [
|
3629
|
-
/* @__PURE__ */
|
3630
|
-
/* @__PURE__ */
|
3831
|
+
/* @__PURE__ */ jsx38(ComposerInput, { autoFocus: true }),
|
3832
|
+
/* @__PURE__ */ jsx38(ComposerAction, {})
|
3631
3833
|
] });
|
3632
3834
|
};
|
3633
3835
|
Composer.displayName = "Composer";
|
@@ -3640,14 +3842,14 @@ var ComposerInputStyled = withDefaults(composer_exports.Input, {
|
|
3640
3842
|
autoFocus: true,
|
3641
3843
|
className: "aui-composer-input"
|
3642
3844
|
});
|
3643
|
-
var ComposerInput =
|
3845
|
+
var ComposerInput = forwardRef23(
|
3644
3846
|
(props, ref) => {
|
3645
3847
|
const {
|
3646
3848
|
strings: {
|
3647
3849
|
composer: { input: { placeholder = "Write a message..." } = {} } = {}
|
3648
3850
|
} = {}
|
3649
3851
|
} = useThreadConfig();
|
3650
|
-
return /* @__PURE__ */
|
3852
|
+
return /* @__PURE__ */ jsx38(ComposerInputStyled, { placeholder, ...props, ref });
|
3651
3853
|
}
|
3652
3854
|
);
|
3653
3855
|
ComposerInput.displayName = "ComposerInput";
|
@@ -3658,10 +3860,10 @@ var useAllowCancel = () => {
|
|
3658
3860
|
};
|
3659
3861
|
var ComposerAction = () => {
|
3660
3862
|
const allowCancel = useAllowCancel();
|
3661
|
-
if (!allowCancel) return /* @__PURE__ */
|
3863
|
+
if (!allowCancel) return /* @__PURE__ */ jsx38(ComposerSend, {});
|
3662
3864
|
return /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
3663
|
-
/* @__PURE__ */
|
3664
|
-
/* @__PURE__ */
|
3865
|
+
/* @__PURE__ */ jsx38(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx38(ComposerSend, {}) }),
|
3866
|
+
/* @__PURE__ */ jsx38(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx38(ComposerCancel, {}) })
|
3665
3867
|
] });
|
3666
3868
|
};
|
3667
3869
|
ComposerAction.displayName = "ComposerAction";
|
@@ -3669,22 +3871,22 @@ var ComposerSendButton = withDefaults(TooltipIconButton, {
|
|
3669
3871
|
variant: "default",
|
3670
3872
|
className: "aui-composer-send"
|
3671
3873
|
});
|
3672
|
-
var ComposerSend =
|
3874
|
+
var ComposerSend = forwardRef23((props, ref) => {
|
3673
3875
|
const {
|
3674
3876
|
strings: { composer: { send: { tooltip = "Send" } = {} } = {} } = {}
|
3675
3877
|
} = useThreadConfig();
|
3676
|
-
return /* @__PURE__ */
|
3878
|
+
return /* @__PURE__ */ jsx38(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx38(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx38(SendHorizontalIcon, {}) }) });
|
3677
3879
|
});
|
3678
3880
|
ComposerSend.displayName = "ComposerSend";
|
3679
3881
|
var ComposerCancelButton = withDefaults(TooltipIconButton, {
|
3680
3882
|
variant: "default",
|
3681
3883
|
className: "aui-composer-cancel"
|
3682
3884
|
});
|
3683
|
-
var ComposerCancel =
|
3885
|
+
var ComposerCancel = forwardRef23((props, ref) => {
|
3684
3886
|
const {
|
3685
3887
|
strings: { composer: { cancel: { tooltip = "Cancel" } = {} } = {} } = {}
|
3686
3888
|
} = useThreadConfig();
|
3687
|
-
return /* @__PURE__ */
|
3889
|
+
return /* @__PURE__ */ jsx38(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx38(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx38(CircleStopIcon, {}) }) });
|
3688
3890
|
});
|
3689
3891
|
ComposerCancel.displayName = "ComposerCancel";
|
3690
3892
|
var exports5 = {
|
@@ -3697,15 +3899,15 @@ var exports5 = {
|
|
3697
3899
|
var composer_default = Object.assign(Composer, exports5);
|
3698
3900
|
|
3699
3901
|
// src/ui/thread-welcome.tsx
|
3700
|
-
import { forwardRef as
|
3701
|
-
import { jsx as
|
3902
|
+
import { forwardRef as forwardRef24 } from "react";
|
3903
|
+
import { jsx as jsx39, jsxs as jsxs10 } from "react/jsx-runtime";
|
3702
3904
|
var ThreadWelcome = () => {
|
3703
3905
|
return /* @__PURE__ */ jsxs10(ThreadWelcomeRoot, { children: [
|
3704
3906
|
/* @__PURE__ */ jsxs10(ThreadWelcomeCenter, { children: [
|
3705
|
-
/* @__PURE__ */
|
3706
|
-
/* @__PURE__ */
|
3907
|
+
/* @__PURE__ */ jsx39(ThreadWelcomeAvatar, {}),
|
3908
|
+
/* @__PURE__ */ jsx39(ThreadWelcomeMessage, {})
|
3707
3909
|
] }),
|
3708
|
-
/* @__PURE__ */
|
3910
|
+
/* @__PURE__ */ jsx39(ThreadWelcomeSuggestions, {})
|
3709
3911
|
] });
|
3710
3912
|
};
|
3711
3913
|
ThreadWelcome.displayName = "ThreadWelcome";
|
@@ -3715,22 +3917,22 @@ var ThreadWelcomeRootStyled = withDefaults("div", {
|
|
3715
3917
|
var ThreadWelcomeCenter = withDefaults("div", {
|
3716
3918
|
className: "aui-thread-welcome-center"
|
3717
3919
|
});
|
3718
|
-
var ThreadWelcomeRoot =
|
3920
|
+
var ThreadWelcomeRoot = forwardRef24(
|
3719
3921
|
(props, ref) => {
|
3720
|
-
return /* @__PURE__ */
|
3922
|
+
return /* @__PURE__ */ jsx39(thread_exports.Empty, { children: /* @__PURE__ */ jsx39(ThreadWelcomeRootStyled, { ...props, ref }) });
|
3721
3923
|
}
|
3722
3924
|
);
|
3723
3925
|
ThreadWelcomeRoot.displayName = "ThreadWelcomeRoot";
|
3724
3926
|
var ThreadWelcomeAvatar = () => {
|
3725
3927
|
const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
|
3726
|
-
return /* @__PURE__ */
|
3928
|
+
return /* @__PURE__ */ jsx39(Avatar, { ...avatar });
|
3727
3929
|
};
|
3728
3930
|
var ThreadWelcomeMessageStyled = withDefaults("p", {
|
3729
3931
|
className: "aui-thread-welcome-message"
|
3730
3932
|
});
|
3731
|
-
var ThreadWelcomeMessage =
|
3933
|
+
var ThreadWelcomeMessage = forwardRef24(({ message: messageProp, ...rest }, ref) => {
|
3732
3934
|
const { welcome: { message = "How can I help you today?" } = {} } = useThreadConfig();
|
3733
|
-
return /* @__PURE__ */
|
3935
|
+
return /* @__PURE__ */ jsx39(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
|
3734
3936
|
});
|
3735
3937
|
ThreadWelcomeMessage.displayName = "ThreadWelcomeMessage";
|
3736
3938
|
var ThreadWelcomeSuggestionContainer = withDefaults("div", {
|
@@ -3742,21 +3944,21 @@ var ThreadWelcomeSuggestionStyled = withDefaults(thread_exports.Suggestion, {
|
|
3742
3944
|
var ThreadWelcomeSuggestion = ({
|
3743
3945
|
suggestion: { text, prompt }
|
3744
3946
|
}) => {
|
3745
|
-
return /* @__PURE__ */
|
3947
|
+
return /* @__PURE__ */ jsx39(
|
3746
3948
|
ThreadWelcomeSuggestionStyled,
|
3747
3949
|
{
|
3748
3950
|
prompt,
|
3749
3951
|
method: "replace",
|
3750
3952
|
autoSend: true,
|
3751
|
-
children: /* @__PURE__ */
|
3953
|
+
children: /* @__PURE__ */ jsx39("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
|
3752
3954
|
}
|
3753
3955
|
);
|
3754
3956
|
};
|
3755
3957
|
var ThreadWelcomeSuggestions = () => {
|
3756
3958
|
const { welcome: { suggestions } = {} } = useThreadConfig();
|
3757
|
-
return /* @__PURE__ */
|
3959
|
+
return /* @__PURE__ */ jsx39(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
|
3758
3960
|
const key = `${suggestion.prompt}-${idx}`;
|
3759
|
-
return /* @__PURE__ */
|
3961
|
+
return /* @__PURE__ */ jsx39(ThreadWelcomeSuggestion, { suggestion }, key);
|
3760
3962
|
}) });
|
3761
3963
|
};
|
3762
3964
|
ThreadWelcomeSuggestions.displayName = "ThreadWelcomeSuggestions";
|
@@ -3771,12 +3973,12 @@ var exports6 = {
|
|
3771
3973
|
var thread_welcome_default = Object.assign(ThreadWelcome, exports6);
|
3772
3974
|
|
3773
3975
|
// src/ui/user-message.tsx
|
3774
|
-
import { forwardRef as
|
3976
|
+
import { forwardRef as forwardRef26 } from "react";
|
3775
3977
|
|
3776
3978
|
// src/ui/user-action-bar.tsx
|
3777
|
-
import { forwardRef as
|
3979
|
+
import { forwardRef as forwardRef25 } from "react";
|
3778
3980
|
import { PencilIcon } from "lucide-react";
|
3779
|
-
import { jsx as
|
3981
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
3780
3982
|
var useAllowEdit = () => {
|
3781
3983
|
const { userMessage: { allowEdit = true } = {} } = useThreadConfig();
|
3782
3984
|
const { useThread } = useThreadContext();
|
@@ -3786,20 +3988,20 @@ var useAllowEdit = () => {
|
|
3786
3988
|
var UserActionBar = () => {
|
3787
3989
|
const allowEdit = useAllowEdit();
|
3788
3990
|
if (!allowEdit) return null;
|
3789
|
-
return /* @__PURE__ */
|
3991
|
+
return /* @__PURE__ */ jsx40(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx40(UserActionBarEdit, {}) });
|
3790
3992
|
};
|
3791
3993
|
UserActionBar.displayName = "UserActionBar";
|
3792
3994
|
var UserActionBarRoot = withDefaults(actionBar_exports.Root, {
|
3793
3995
|
className: "aui-user-action-bar-root"
|
3794
3996
|
});
|
3795
3997
|
UserActionBarRoot.displayName = "UserActionBarRoot";
|
3796
|
-
var UserActionBarEdit =
|
3998
|
+
var UserActionBarEdit = forwardRef25((props, ref) => {
|
3797
3999
|
const {
|
3798
4000
|
strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
|
3799
4001
|
} = useThreadConfig();
|
3800
4002
|
const allowEdit = useAllowEdit();
|
3801
4003
|
if (!allowEdit) return null;
|
3802
|
-
return /* @__PURE__ */
|
4004
|
+
return /* @__PURE__ */ jsx40(actionBar_exports.Edit, { asChild: true, children: /* @__PURE__ */ jsx40(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx40(PencilIcon, {}) }) });
|
3803
4005
|
});
|
3804
4006
|
UserActionBarEdit.displayName = "UserActionBarEdit";
|
3805
4007
|
var exports7 = {
|
@@ -3809,12 +4011,12 @@ var exports7 = {
|
|
3809
4011
|
var user_action_bar_default = Object.assign(UserActionBar, exports7);
|
3810
4012
|
|
3811
4013
|
// src/ui/user-message.tsx
|
3812
|
-
import { jsx as
|
4014
|
+
import { jsx as jsx41, jsxs as jsxs11 } from "react/jsx-runtime";
|
3813
4015
|
var UserMessage = () => {
|
3814
4016
|
return /* @__PURE__ */ jsxs11(UserMessageRoot, { children: [
|
3815
|
-
/* @__PURE__ */
|
3816
|
-
/* @__PURE__ */
|
3817
|
-
/* @__PURE__ */
|
4017
|
+
/* @__PURE__ */ jsx41(user_action_bar_default, {}),
|
4018
|
+
/* @__PURE__ */ jsx41(UserMessageContent, {}),
|
4019
|
+
/* @__PURE__ */ jsx41(branch_picker_default, {})
|
3818
4020
|
] });
|
3819
4021
|
};
|
3820
4022
|
UserMessage.displayName = "UserMessage";
|
@@ -3825,9 +4027,9 @@ UserMessageRoot.displayName = "UserMessageRoot";
|
|
3825
4027
|
var UserMessageContentWrapper = withDefaults("div", {
|
3826
4028
|
className: "aui-user-message-content"
|
3827
4029
|
});
|
3828
|
-
var UserMessageContent =
|
4030
|
+
var UserMessageContent = forwardRef26(
|
3829
4031
|
({ components, ...props }, ref) => {
|
3830
|
-
return /* @__PURE__ */
|
4032
|
+
return /* @__PURE__ */ jsx41(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx41(
|
3831
4033
|
message_exports.Content,
|
3832
4034
|
{
|
3833
4035
|
components: {
|
@@ -3846,14 +4048,14 @@ var exports8 = {
|
|
3846
4048
|
var user_message_default = Object.assign(UserMessage, exports8);
|
3847
4049
|
|
3848
4050
|
// src/ui/edit-composer.tsx
|
3849
|
-
import { forwardRef as
|
3850
|
-
import { jsx as
|
4051
|
+
import { forwardRef as forwardRef27 } from "react";
|
4052
|
+
import { jsx as jsx42, jsxs as jsxs12 } from "react/jsx-runtime";
|
3851
4053
|
var EditComposer = () => {
|
3852
4054
|
return /* @__PURE__ */ jsxs12(EditComposerRoot, { children: [
|
3853
|
-
/* @__PURE__ */
|
4055
|
+
/* @__PURE__ */ jsx42(EditComposerInput, {}),
|
3854
4056
|
/* @__PURE__ */ jsxs12(EditComposerFooter, { children: [
|
3855
|
-
/* @__PURE__ */
|
3856
|
-
/* @__PURE__ */
|
4057
|
+
/* @__PURE__ */ jsx42(EditComposerCancel, {}),
|
4058
|
+
/* @__PURE__ */ jsx42(EditComposerSend, {})
|
3857
4059
|
] })
|
3858
4060
|
] });
|
3859
4061
|
};
|
@@ -3870,23 +4072,23 @@ var EditComposerFooter = withDefaults("div", {
|
|
3870
4072
|
className: "aui-edit-composer-footer"
|
3871
4073
|
});
|
3872
4074
|
EditComposerFooter.displayName = "EditComposerFooter";
|
3873
|
-
var EditComposerCancel =
|
4075
|
+
var EditComposerCancel = forwardRef27(
|
3874
4076
|
(props, ref) => {
|
3875
4077
|
const {
|
3876
4078
|
strings: {
|
3877
4079
|
editComposer: { cancel: { label = "Cancel" } = {} } = {}
|
3878
4080
|
} = {}
|
3879
4081
|
} = useThreadConfig();
|
3880
|
-
return /* @__PURE__ */
|
4082
|
+
return /* @__PURE__ */ jsx42(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx42(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
|
3881
4083
|
}
|
3882
4084
|
);
|
3883
4085
|
EditComposerCancel.displayName = "EditComposerCancel";
|
3884
|
-
var EditComposerSend =
|
4086
|
+
var EditComposerSend = forwardRef27(
|
3885
4087
|
(props, ref) => {
|
3886
4088
|
const {
|
3887
4089
|
strings: { editComposer: { send: { label = "Send" } = {} } = {} } = {}
|
3888
4090
|
} = useThreadConfig();
|
3889
|
-
return /* @__PURE__ */
|
4091
|
+
return /* @__PURE__ */ jsx42(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx42(Button, { ...props, ref, children: props.children ?? label }) });
|
3890
4092
|
}
|
3891
4093
|
);
|
3892
4094
|
EditComposerSend.displayName = "EditComposerSend";
|
@@ -3900,23 +4102,23 @@ var exports9 = {
|
|
3900
4102
|
var edit_composer_default = Object.assign(EditComposer, exports9);
|
3901
4103
|
|
3902
4104
|
// src/ui/thread.tsx
|
3903
|
-
import { jsx as
|
4105
|
+
import { jsx as jsx43, jsxs as jsxs13 } from "react/jsx-runtime";
|
3904
4106
|
var Thread = (config) => {
|
3905
|
-
return /* @__PURE__ */
|
3906
|
-
/* @__PURE__ */
|
3907
|
-
/* @__PURE__ */
|
4107
|
+
return /* @__PURE__ */ jsx43(ThreadRoot, { config, children: /* @__PURE__ */ jsxs13(ThreadViewport, { children: [
|
4108
|
+
/* @__PURE__ */ jsx43(thread_welcome_default, {}),
|
4109
|
+
/* @__PURE__ */ jsx43(ThreadMessages, {}),
|
3908
4110
|
/* @__PURE__ */ jsxs13(ThreadViewportFooter, { children: [
|
3909
|
-
/* @__PURE__ */
|
3910
|
-
/* @__PURE__ */
|
4111
|
+
/* @__PURE__ */ jsx43(ThreadScrollToBottom, {}),
|
4112
|
+
/* @__PURE__ */ jsx43(composer_default, {})
|
3911
4113
|
] })
|
3912
4114
|
] }) });
|
3913
4115
|
};
|
3914
4116
|
var ThreadRootStyled = withDefaults(thread_exports.Root, {
|
3915
4117
|
className: "aui-root aui-thread-root"
|
3916
4118
|
});
|
3917
|
-
var ThreadRoot =
|
4119
|
+
var ThreadRoot = forwardRef28(
|
3918
4120
|
({ config, ...props }, ref) => {
|
3919
|
-
return /* @__PURE__ */
|
4121
|
+
return /* @__PURE__ */ jsx43(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx43(ThreadRootStyled, { ...props, ref }) });
|
3920
4122
|
}
|
3921
4123
|
);
|
3922
4124
|
ThreadRoot.displayName = "ThreadRoot";
|
@@ -3930,7 +4132,7 @@ var ThreadViewportFooter = withDefaults("div", {
|
|
3930
4132
|
ThreadViewportFooter.displayName = "ThreadViewportFooter";
|
3931
4133
|
var SystemMessage = () => null;
|
3932
4134
|
var ThreadMessages = ({ components, ...rest }) => {
|
3933
|
-
return /* @__PURE__ */
|
4135
|
+
return /* @__PURE__ */ jsx43(
|
3934
4136
|
thread_exports.Messages,
|
3935
4137
|
{
|
3936
4138
|
components: {
|
@@ -3948,13 +4150,13 @@ var ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {
|
|
3948
4150
|
variant: "outline",
|
3949
4151
|
className: "aui-thread-scroll-to-bottom"
|
3950
4152
|
});
|
3951
|
-
var ThreadScrollToBottom =
|
4153
|
+
var ThreadScrollToBottom = forwardRef28((props, ref) => {
|
3952
4154
|
const {
|
3953
4155
|
strings: {
|
3954
4156
|
thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {}
|
3955
4157
|
} = {}
|
3956
4158
|
} = useThreadConfig();
|
3957
|
-
return /* @__PURE__ */
|
4159
|
+
return /* @__PURE__ */ jsx43(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx43(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx43(ArrowDownIcon, {}) }) });
|
3958
4160
|
});
|
3959
4161
|
ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
|
3960
4162
|
var exports10 = {
|
@@ -3967,20 +4169,20 @@ var exports10 = {
|
|
3967
4169
|
var thread_default = Object.assign(Thread, exports10);
|
3968
4170
|
|
3969
4171
|
// src/ui/assistant-modal.tsx
|
3970
|
-
import { Fragment as Fragment6, jsx as
|
4172
|
+
import { Fragment as Fragment6, jsx as jsx44, jsxs as jsxs14 } from "react/jsx-runtime";
|
3971
4173
|
var AssistantModal = (config) => {
|
3972
4174
|
return /* @__PURE__ */ jsxs14(AssistantModalRoot, { config, children: [
|
3973
|
-
/* @__PURE__ */
|
3974
|
-
/* @__PURE__ */
|
4175
|
+
/* @__PURE__ */ jsx44(AssistantModalTrigger, {}),
|
4176
|
+
/* @__PURE__ */ jsx44(AssistantModalContent, { children: /* @__PURE__ */ jsx44(thread_default, {}) })
|
3975
4177
|
] });
|
3976
4178
|
};
|
3977
4179
|
AssistantModal.displayName = "AssistantModal";
|
3978
4180
|
var AssistantModalRoot = ({ config, ...props }) => {
|
3979
|
-
return /* @__PURE__ */
|
4181
|
+
return /* @__PURE__ */ jsx44(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx44(assistantModal_exports.Root, { ...props }) });
|
3980
4182
|
};
|
3981
4183
|
AssistantModalRoot.displayName = "AssistantModalRoot";
|
3982
|
-
var AssistantModalTrigger =
|
3983
|
-
return /* @__PURE__ */
|
4184
|
+
var AssistantModalTrigger = forwardRef29((props, ref) => {
|
4185
|
+
return /* @__PURE__ */ jsx44(AssistantModalAnchor, { children: /* @__PURE__ */ jsx44(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx44(AssistantModalButton, { ...props, ref }) }) });
|
3984
4186
|
});
|
3985
4187
|
AssistantModalTrigger.displayName = "AssistantModalTrigger";
|
3986
4188
|
var AssistantModalAnchor = withDefaults(assistantModal_exports.Anchor, {
|
@@ -3991,7 +4193,7 @@ var ModalButtonStyled = withDefaults(TooltipIconButton, {
|
|
3991
4193
|
variant: "default",
|
3992
4194
|
className: "aui-modal-button"
|
3993
4195
|
});
|
3994
|
-
var AssistantModalButton =
|
4196
|
+
var AssistantModalButton = forwardRef29(({ "data-state": state, ...rest }, ref) => {
|
3995
4197
|
const {
|
3996
4198
|
strings: {
|
3997
4199
|
assistantModal: {
|
@@ -4005,7 +4207,7 @@ var AssistantModalButton = forwardRef28(({ "data-state": state, ...rest }, ref)
|
|
4005
4207
|
} = {}
|
4006
4208
|
} = useThreadConfig();
|
4007
4209
|
const tooltip = state === "open" ? openTooltip : closedTooltip;
|
4008
|
-
return /* @__PURE__ */
|
4210
|
+
return /* @__PURE__ */ jsx44(
|
4009
4211
|
ModalButtonStyled,
|
4010
4212
|
{
|
4011
4213
|
side: "left",
|
@@ -4014,14 +4216,14 @@ var AssistantModalButton = forwardRef28(({ "data-state": state, ...rest }, ref)
|
|
4014
4216
|
...rest,
|
4015
4217
|
ref,
|
4016
4218
|
children: rest.children ?? /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
4017
|
-
/* @__PURE__ */
|
4219
|
+
/* @__PURE__ */ jsx44(
|
4018
4220
|
BotIcon,
|
4019
4221
|
{
|
4020
4222
|
"data-state": state,
|
4021
4223
|
className: "aui-modal-button-closed-icon"
|
4022
4224
|
}
|
4023
4225
|
),
|
4024
|
-
/* @__PURE__ */
|
4226
|
+
/* @__PURE__ */ jsx44(
|
4025
4227
|
ChevronDownIcon,
|
4026
4228
|
{
|
4027
4229
|
"data-state": state,
|
@@ -4070,6 +4272,7 @@ export {
|
|
4070
4272
|
thread_welcome_default as ThreadWelcome,
|
4071
4273
|
user_action_bar_default as UserActionBar,
|
4072
4274
|
user_message_default as UserMessage,
|
4275
|
+
WebSpeechSynthesisAdapter,
|
4073
4276
|
fromCoreMessage,
|
4074
4277
|
fromCoreMessages,
|
4075
4278
|
fromLanguageModelMessages,
|
@@ -4086,6 +4289,8 @@ export {
|
|
4086
4289
|
useActionBarCopy,
|
4087
4290
|
useActionBarEdit,
|
4088
4291
|
useActionBarReload,
|
4292
|
+
useActionBarSpeak,
|
4293
|
+
useActionBarStopSpeaking,
|
4089
4294
|
useAppendMessage,
|
4090
4295
|
useAssistantContext,
|
4091
4296
|
useAssistantInstructions,
|