@agents24/chat-react 0.5.6 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +11 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -6
- package/dist/index.js.map +1 -1
- package/dist/latest-thread-scroller.d.ts +2 -1
- package/dist/scaffold/components/chat/turn-outline.d.ts +1 -1
- package/dist/scaffold/index.cjs +144 -133
- package/dist/scaffold/index.cjs.map +1 -1
- package/dist/scaffold/index.js +154 -143
- package/dist/scaffold/index.js.map +1 -1
- package/dist/styles.css +12 -5
- package/dist/ui/agent-chat-message.d.ts +4 -0
- package/dist/ui/index.cjs +138 -52
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +137 -52
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
- package/scaffold/src/components/chat/chat-message.tsx +12 -2
- package/scaffold/src/components/chat/chat-shell.tsx +58 -30
- package/scaffold/src/components/chat/turn-outline.tsx +17 -59
- package/scaffold/src/components/ui/message-scroller.tsx +1 -1
- package/scaffold/src/components/ui/message.tsx +1 -1
- package/scaffold/src/components/ui/sidebar.tsx +1 -1
package/dist/scaffold/index.cjs
CHANGED
|
@@ -39,11 +39,12 @@ module.exports = __toCommonJS(src_exports);
|
|
|
39
39
|
|
|
40
40
|
// scaffold/src/app.tsx
|
|
41
41
|
var import_runtime3 = require("@agents24/chat-react/runtime");
|
|
42
|
-
var
|
|
42
|
+
var import_react2 = require("@agents24/react");
|
|
43
43
|
|
|
44
44
|
// scaffold/src/components/chat/chat-shell.tsx
|
|
45
45
|
var import_runtime2 = require("@agents24/chat-react/runtime");
|
|
46
46
|
var import_lucide_react12 = require("lucide-react");
|
|
47
|
+
var React8 = __toESM(require("react"), 1);
|
|
47
48
|
|
|
48
49
|
// scaffold/src/components/chat/chat-composer.tsx
|
|
49
50
|
var import_lucide_react3 = require("lucide-react");
|
|
@@ -1140,7 +1141,7 @@ function MessageFooter({ className, ...props }) {
|
|
|
1140
1141
|
{
|
|
1141
1142
|
"data-slot": "message-footer",
|
|
1142
1143
|
className: cn(
|
|
1143
|
-
"flex max-w-full min-w-0 items-center
|
|
1144
|
+
"flex max-w-full min-w-0 items-center pl-3.5 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end",
|
|
1144
1145
|
className
|
|
1145
1146
|
),
|
|
1146
1147
|
...props
|
|
@@ -1162,7 +1163,7 @@ function ChatMessage({
|
|
|
1162
1163
|
Timeline
|
|
1163
1164
|
}) {
|
|
1164
1165
|
const isUser = message.role === "user";
|
|
1165
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Message, { align: isUser ? "end" : "start", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(MessageContent, { children: [
|
|
1166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Message, { align: isUser ? "end" : "start", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(MessageContent, { className: isUser ? "gap-0" : void 0, children: [
|
|
1166
1167
|
isUser && message.attachments?.length ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1167
1168
|
import_ui3.ChatAttachmentRows,
|
|
1168
1169
|
{
|
|
@@ -1181,6 +1182,17 @@ function ChatMessage({
|
|
|
1181
1182
|
Timeline
|
|
1182
1183
|
}
|
|
1183
1184
|
) }) }),
|
|
1185
|
+
isUser && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ui3.AgentChatUserMessageActionRow, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1186
|
+
import_ui3.AgentChatDefaultActions,
|
|
1187
|
+
{
|
|
1188
|
+
handlers: {
|
|
1189
|
+
onCopy: (content) => {
|
|
1190
|
+
void navigator.clipboard.writeText(content).catch(() => void 0);
|
|
1191
|
+
}
|
|
1192
|
+
},
|
|
1193
|
+
message
|
|
1194
|
+
}
|
|
1195
|
+
) }),
|
|
1184
1196
|
!isUser && message.isFinal !== false && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MessageFooter, { className: "gap-1 opacity-70 transition-opacity group-hover/message:opacity-100", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1185
1197
|
import_ui3.AgentChatDefaultActions,
|
|
1186
1198
|
{
|
|
@@ -1583,7 +1595,7 @@ function Sidebar({
|
|
|
1583
1595
|
className: cn(
|
|
1584
1596
|
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",
|
|
1585
1597
|
// Adjust the padding for floating and inset variants.
|
|
1586
|
-
variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
|
|
1598
|
+
variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "border-border/50 group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
|
|
1587
1599
|
className
|
|
1588
1600
|
),
|
|
1589
1601
|
...props,
|
|
@@ -1982,20 +1994,60 @@ function ThreadSidebar({ activeThreadId, hasMore, identity, isLoading, isLoading
|
|
|
1982
1994
|
}
|
|
1983
1995
|
|
|
1984
1996
|
// scaffold/src/components/chat/turn-outline.tsx
|
|
1985
|
-
var
|
|
1997
|
+
var import_chat_react = require("@agents24/chat-react");
|
|
1998
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1999
|
+
function turnsFromMessages(messages) {
|
|
2000
|
+
return messages.reduce((turns, message) => {
|
|
2001
|
+
if (message.role === "user") {
|
|
2002
|
+
turns.push({
|
|
2003
|
+
id: message.id,
|
|
2004
|
+
label: message.content.trim() || `Turn ${turns.length + 1}`,
|
|
2005
|
+
messageIds: [message.id],
|
|
2006
|
+
responsePreview: ""
|
|
2007
|
+
});
|
|
2008
|
+
} else if (turns.length) {
|
|
2009
|
+
const turn = turns[turns.length - 1];
|
|
2010
|
+
turn.messageIds?.push(message.id);
|
|
2011
|
+
if (!turn.responsePreview) turn.responsePreview = message.content.trim();
|
|
2012
|
+
}
|
|
2013
|
+
return turns;
|
|
2014
|
+
}, []);
|
|
2015
|
+
}
|
|
2016
|
+
function TurnOutline({ messages }) {
|
|
2017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2018
|
+
import_chat_react.LatestThreadScroller.Outline,
|
|
2019
|
+
{
|
|
2020
|
+
items: turnsFromMessages(messages),
|
|
2021
|
+
minSideGutterForRail: 0,
|
|
2022
|
+
side: "left",
|
|
2023
|
+
verticalOffset: "3.5rem"
|
|
2024
|
+
}
|
|
2025
|
+
);
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
// scaffold/src/components/chat/timeline-loading.ts
|
|
2029
|
+
function isScaffoldTimelineLoading({
|
|
2030
|
+
activeRunId,
|
|
2031
|
+
message,
|
|
2032
|
+
runState,
|
|
2033
|
+
streamingMessageId
|
|
2034
|
+
}) {
|
|
2035
|
+
if (runState !== "streaming" && runState !== "reconnecting") return false;
|
|
2036
|
+
return message.id === streamingMessageId || Boolean(message.runId && message.runId === activeRunId);
|
|
2037
|
+
}
|
|
1986
2038
|
|
|
1987
2039
|
// scaffold/src/components/ui/message-scroller.tsx
|
|
1988
2040
|
var import_message_scroller = require("@shadcn/react/message-scroller");
|
|
1989
2041
|
var import_lucide_react11 = require("lucide-react");
|
|
1990
|
-
var
|
|
2042
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1991
2043
|
function MessageScrollerProvider(props) {
|
|
1992
|
-
return /* @__PURE__ */ (0,
|
|
2044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_message_scroller.MessageScroller.Provider, { ...props });
|
|
1993
2045
|
}
|
|
1994
2046
|
function MessageScroller({
|
|
1995
2047
|
className,
|
|
1996
2048
|
...props
|
|
1997
2049
|
}) {
|
|
1998
|
-
return /* @__PURE__ */ (0,
|
|
2050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1999
2051
|
import_message_scroller.MessageScroller.Root,
|
|
2000
2052
|
{
|
|
2001
2053
|
"data-slot": "message-scroller",
|
|
@@ -2011,7 +2063,7 @@ function MessageScrollerViewport({
|
|
|
2011
2063
|
className,
|
|
2012
2064
|
...props
|
|
2013
2065
|
}) {
|
|
2014
|
-
return /* @__PURE__ */ (0,
|
|
2066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2015
2067
|
import_message_scroller.MessageScroller.Viewport,
|
|
2016
2068
|
{
|
|
2017
2069
|
"data-slot": "message-scroller-viewport",
|
|
@@ -2027,11 +2079,11 @@ function MessageScrollerContent({
|
|
|
2027
2079
|
className,
|
|
2028
2080
|
...props
|
|
2029
2081
|
}) {
|
|
2030
|
-
return /* @__PURE__ */ (0,
|
|
2082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2031
2083
|
import_message_scroller.MessageScroller.Content,
|
|
2032
2084
|
{
|
|
2033
2085
|
"data-slot": "message-scroller-content",
|
|
2034
|
-
className: cn("flex h-max min-h-full flex-col gap-
|
|
2086
|
+
className: cn("flex h-max min-h-full flex-col gap-3", className),
|
|
2035
2087
|
...props
|
|
2036
2088
|
}
|
|
2037
2089
|
);
|
|
@@ -2041,7 +2093,7 @@ function MessageScrollerItem({
|
|
|
2041
2093
|
scrollAnchor = false,
|
|
2042
2094
|
...props
|
|
2043
2095
|
}) {
|
|
2044
|
-
return /* @__PURE__ */ (0,
|
|
2096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2045
2097
|
import_message_scroller.MessageScroller.Item,
|
|
2046
2098
|
{
|
|
2047
2099
|
"data-slot": "message-scroller-item",
|
|
@@ -2063,7 +2115,7 @@ function MessageScrollerButton({
|
|
|
2063
2115
|
size = "icon-sm",
|
|
2064
2116
|
...props
|
|
2065
2117
|
}) {
|
|
2066
|
-
return /* @__PURE__ */ (0,
|
|
2118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2067
2119
|
import_message_scroller.MessageScroller.Button,
|
|
2068
2120
|
{
|
|
2069
2121
|
"data-slot": "message-scroller-button",
|
|
@@ -2075,86 +2127,19 @@ function MessageScrollerButton({
|
|
|
2075
2127
|
"absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180",
|
|
2076
2128
|
className
|
|
2077
2129
|
),
|
|
2078
|
-
render: render ?? /* @__PURE__ */ (0,
|
|
2130
|
+
render: render ?? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { variant, size }),
|
|
2079
2131
|
...props,
|
|
2080
|
-
children: children ?? /* @__PURE__ */ (0,
|
|
2081
|
-
/* @__PURE__ */ (0,
|
|
2132
|
+
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
2133
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2082
2134
|
import_lucide_react11.ArrowDownIcon,
|
|
2083
2135
|
{}
|
|
2084
2136
|
),
|
|
2085
|
-
/* @__PURE__ */ (0,
|
|
2137
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "sr-only", children: direction === "end" ? "Scroll to end" : "Scroll to start" })
|
|
2086
2138
|
] })
|
|
2087
2139
|
}
|
|
2088
2140
|
);
|
|
2089
2141
|
}
|
|
2090
2142
|
|
|
2091
|
-
// scaffold/src/components/chat/turn-outline.tsx
|
|
2092
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2093
|
-
function turnsFromMessages(messages) {
|
|
2094
|
-
return messages.reduce((turns, message) => {
|
|
2095
|
-
if (message.role === "user") {
|
|
2096
|
-
turns.push({ id: message.id, label: message.content.trim() || `Turn ${turns.length + 1}`, messageIds: [message.id], response: "" });
|
|
2097
|
-
} else if (turns.length) {
|
|
2098
|
-
const turn = turns[turns.length - 1];
|
|
2099
|
-
turn.messageIds.push(message.id);
|
|
2100
|
-
if (!turn.response) turn.response = message.content.trim();
|
|
2101
|
-
}
|
|
2102
|
-
return turns;
|
|
2103
|
-
}, []);
|
|
2104
|
-
}
|
|
2105
|
-
function TurnOutline({ messages }) {
|
|
2106
|
-
const turns = turnsFromMessages(messages);
|
|
2107
|
-
const { scrollToMessage } = (0, import_message_scroller.useMessageScroller)();
|
|
2108
|
-
const { currentAnchorId, visibleMessageIds } = (0, import_message_scroller.useMessageScrollerVisibility)();
|
|
2109
|
-
const visible = new Set(visibleMessageIds);
|
|
2110
|
-
const [hoveredIndex, setHoveredIndex] = (0, import_react2.useState)(null);
|
|
2111
|
-
const focusIndex = hoveredIndex ?? -1;
|
|
2112
|
-
if (turns.length < 2) return null;
|
|
2113
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("nav", { "aria-label": "Transcript outline", className: "pointer-events-none absolute end-2 top-1/2 z-20 hidden max-h-72 w-14 -translate-y-1/2 md:block xl:end-5", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "pointer-events-auto flex flex-col items-end gap-0.5 py-2", children: turns.map((turn, index) => {
|
|
2114
|
-
const active = turn.messageIds.some((id) => visible.has(id) || currentAnchorId === id);
|
|
2115
|
-
const distance = focusIndex >= 0 ? Math.abs(index - focusIndex) : Number.POSITIVE_INFINITY;
|
|
2116
|
-
const barWidth = focusIndex < 0 ? 12 : distance === 0 ? 50 : distance === 1 ? 36 : distance === 2 ? 23 : 10;
|
|
2117
|
-
const barOpacity = focusIndex < 0 ? active ? 1 : 0.4 : distance === 0 ? 1 : distance === 1 ? 0.78 : distance === 2 ? 0.58 : 0.36;
|
|
2118
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Tooltip, { children: [
|
|
2119
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2120
|
-
"button",
|
|
2121
|
-
{
|
|
2122
|
-
type: "button",
|
|
2123
|
-
"aria-label": `Jump to ${turn.label}`,
|
|
2124
|
-
className: "group relative flex h-2 w-14 items-center justify-end outline-none after:pointer-events-auto after:absolute after:-inset-y-0.5 after:inset-x-0 after:content-['']",
|
|
2125
|
-
onBlur: () => setHoveredIndex(null),
|
|
2126
|
-
onFocus: () => setHoveredIndex(index),
|
|
2127
|
-
onMouseEnter: () => setHoveredIndex(index),
|
|
2128
|
-
onMouseLeave: () => setHoveredIndex(null),
|
|
2129
|
-
onClick: () => scrollToMessage(turn.id, { align: "start", behavior: "smooth" }),
|
|
2130
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2131
|
-
"span",
|
|
2132
|
-
{
|
|
2133
|
-
className: cn("h-0.5 rounded-full bg-muted-foreground/40 transition-[width,background-color,opacity] duration-150 ease-out group-hover:bg-foreground group-focus-visible:bg-foreground", active && "bg-foreground"),
|
|
2134
|
-
style: { opacity: barOpacity, width: barWidth }
|
|
2135
|
-
}
|
|
2136
|
-
)
|
|
2137
|
-
}
|
|
2138
|
-
) }),
|
|
2139
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(TooltipContent, { side: "left", className: "w-64 flex-col items-stretch gap-0 overflow-hidden p-3", children: [
|
|
2140
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "line-clamp-2 max-w-full wrap-break-word text-sm font-medium", children: turn.label }),
|
|
2141
|
-
turn.response && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "mt-1 line-clamp-2 max-w-full wrap-break-word text-xs opacity-70", children: turn.response })
|
|
2142
|
-
] })
|
|
2143
|
-
] }, turn.id);
|
|
2144
|
-
}) }) });
|
|
2145
|
-
}
|
|
2146
|
-
|
|
2147
|
-
// scaffold/src/components/chat/timeline-loading.ts
|
|
2148
|
-
function isScaffoldTimelineLoading({
|
|
2149
|
-
activeRunId,
|
|
2150
|
-
message,
|
|
2151
|
-
runState,
|
|
2152
|
-
streamingMessageId
|
|
2153
|
-
}) {
|
|
2154
|
-
if (runState !== "streaming" && runState !== "reconnecting") return false;
|
|
2155
|
-
return message.id === streamingMessageId || Boolean(message.runId && message.runId === activeRunId);
|
|
2156
|
-
}
|
|
2157
|
-
|
|
2158
2143
|
// scaffold/src/components/chat/chat-shell.tsx
|
|
2159
2144
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2160
2145
|
var LOADING_INPUT_CONTRACT = {
|
|
@@ -2211,6 +2196,19 @@ function ChatShell({
|
|
|
2211
2196
|
const activeTitle = controller.threads.find((thread) => thread.id === controller.activeThreadId)?.title;
|
|
2212
2197
|
const hasBlockingError = Boolean(runtime.fatalError && controller.messages.length === 0);
|
|
2213
2198
|
const isEmptyState = controller.activeThreadId === null && controller.messages.length === 0 && !hasBlockingError;
|
|
2199
|
+
const composerOverlayRef = React8.useRef(null);
|
|
2200
|
+
const [composerOverlayHeight, setComposerOverlayHeight] = React8.useState(192);
|
|
2201
|
+
React8.useEffect(() => {
|
|
2202
|
+
const overlay = composerOverlayRef.current;
|
|
2203
|
+
if (!overlay || isEmptyState) return;
|
|
2204
|
+
const updateHeight = () => {
|
|
2205
|
+
setComposerOverlayHeight(Math.ceil(overlay.getBoundingClientRect().height));
|
|
2206
|
+
};
|
|
2207
|
+
updateHeight();
|
|
2208
|
+
const resizeObserver = new ResizeObserver(updateHeight);
|
|
2209
|
+
resizeObserver.observe(overlay);
|
|
2210
|
+
return () => resizeObserver.disconnect();
|
|
2211
|
+
}, [isEmptyState]);
|
|
2214
2212
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2215
2213
|
SidebarProvider,
|
|
2216
2214
|
{
|
|
@@ -2238,7 +2236,7 @@ function ChatShell({
|
|
|
2238
2236
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2239
2237
|
"header",
|
|
2240
2238
|
{
|
|
2241
|
-
className: "flex h-12 shrink-0 items-center gap-2 border-b border-border/
|
|
2239
|
+
className: "flex h-12 shrink-0 items-center gap-2 border-b border-border/50 px-3 sm:px-4",
|
|
2242
2240
|
"data-agents24-chat-header": "",
|
|
2243
2241
|
children: [
|
|
2244
2242
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CollapsedHeaderActions, { onNew: runtime.newThread }),
|
|
@@ -2289,18 +2287,19 @@ function ChatShell({
|
|
|
2289
2287
|
})
|
|
2290
2288
|
}
|
|
2291
2289
|
)
|
|
2292
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime25.
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2290
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2291
|
+
MessageScrollerProvider,
|
|
2292
|
+
{
|
|
2293
|
+
autoScroll: true,
|
|
2294
|
+
defaultScrollPosition: "last-anchor",
|
|
2295
|
+
scrollPreviousItemPeek: 64,
|
|
2296
|
+
children: [
|
|
2297
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(MessageScroller, { className: "relative min-h-0 flex-1", children: [
|
|
2300
2298
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MessageScrollerViewport, { preserveScrollOnPrepend: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2301
2299
|
MessageScrollerContent,
|
|
2302
2300
|
{
|
|
2303
|
-
className: "mx-auto w-full max-w-3xl gap-
|
|
2301
|
+
className: "mx-auto w-full max-w-3xl gap-3 px-4 pt-8 pb-0 sm:px-6 sm:pt-12",
|
|
2302
|
+
style: { paddingBottom: composerOverlayHeight + 72 },
|
|
2304
2303
|
children: [
|
|
2305
2304
|
controller.hasOlderTurns && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Button, { className: "self-center", variant: "ghost", size: "sm", disabled: controller.isLoadingOlder, onClick: () => {
|
|
2306
2305
|
void controller.loadOlder().catch(() => void 0);
|
|
@@ -2348,44 +2347,56 @@ function ChatShell({
|
|
|
2348
2347
|
]
|
|
2349
2348
|
}
|
|
2350
2349
|
) }),
|
|
2351
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TurnOutline, { messages: controller.messages })
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2350
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TurnOutline, { messages: controller.messages })
|
|
2351
|
+
] }),
|
|
2352
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2353
|
+
"div",
|
|
2354
|
+
{
|
|
2355
|
+
ref: composerOverlayRef,
|
|
2356
|
+
className: "pointer-events-none absolute inset-x-0 bottom-0 z-30 overflow-visible pt-10",
|
|
2357
|
+
style: {
|
|
2358
|
+
background: "linear-gradient(to bottom, transparent 0%, color-mix(in oklch, var(--background) 85%, transparent) 45%, var(--background) 65%, var(--background) 100%)"
|
|
2359
|
+
},
|
|
2360
|
+
children: [
|
|
2361
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "pointer-events-auto absolute inset-x-0 top-0 flex -translate-y-full justify-center pb-3", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MessageScrollerButton, { className: "!relative !inset-auto !translate-x-0 rtl:!translate-x-0" }) }),
|
|
2362
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "pointer-events-auto", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2363
|
+
ChatComposer,
|
|
2364
|
+
{
|
|
2365
|
+
inputContract: runtime.inputContract || LOADING_INPUT_CONTRACT,
|
|
2366
|
+
contextWindow: runtime.contextWindow,
|
|
2367
|
+
disabled: runtime.isBootstrapping || runtime.isChangingAgent || hasBlockingError || isUploading,
|
|
2368
|
+
focusKey: controller.activeThreadId,
|
|
2369
|
+
isCancelling,
|
|
2370
|
+
isRunning,
|
|
2371
|
+
agentId: runtime.agentId,
|
|
2372
|
+
agents: runtime.agents,
|
|
2373
|
+
onAgentChange: (agentId) => {
|
|
2374
|
+
void runtime.changeAgent(agentId);
|
|
2375
|
+
},
|
|
2376
|
+
onStop: () => {
|
|
2377
|
+
void controller.cancelRun().catch(() => void 0);
|
|
2378
|
+
},
|
|
2379
|
+
modelId: runtime.modelId,
|
|
2380
|
+
models: runtime.models,
|
|
2381
|
+
onModelChange: runtime.changeModel,
|
|
2382
|
+
onSubmit: (text, files) => runtime.submit({
|
|
2383
|
+
text,
|
|
2384
|
+
files: files.map((file) => ({
|
|
2385
|
+
data: file.source,
|
|
2386
|
+
mediaType: file.mediaType,
|
|
2387
|
+
name: file.filename
|
|
2388
|
+
})),
|
|
2389
|
+
attachments: files
|
|
2390
|
+
}),
|
|
2391
|
+
utilityRow: "below"
|
|
2392
|
+
}
|
|
2393
|
+
) })
|
|
2394
|
+
]
|
|
2395
|
+
}
|
|
2396
|
+
)
|
|
2397
|
+
]
|
|
2398
|
+
}
|
|
2399
|
+
) })
|
|
2389
2400
|
]
|
|
2390
2401
|
}
|
|
2391
2402
|
)
|
|
@@ -2414,7 +2425,7 @@ function RuntimeChat({
|
|
|
2414
2425
|
}
|
|
2415
2426
|
function App(props) {
|
|
2416
2427
|
const identity = props.identity || GUEST_CHAT_IDENTITY;
|
|
2417
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react2.Agents24Provider, { client: props.client, createAbortController: createBrowserAbortController, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RuntimeChat, { ...props }, identity.state) });
|
|
2418
2429
|
}
|
|
2419
2430
|
|
|
2420
2431
|
// scaffold/src/index.tsx
|