@agents24/chat-react 0.5.16 → 0.5.17
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/compatibility.json +8 -8
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/latest-thread-scroller.d.ts +5 -0
- package/dist/runtime/index.cjs +6 -1
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.js +6 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/use-agent-chat-runtime.d.ts +1 -0
- package/dist/scaffold/components/chat/chat-composer.d.ts +6 -1
- package/dist/scaffold/components/chat/chat-message.d.ts +2 -1
- package/dist/scaffold/index.cjs +185 -286
- package/dist/scaffold/index.cjs.map +1 -1
- package/dist/scaffold/index.js +190 -291
- package/dist/scaffold/index.js.map +1 -1
- package/dist/styles.css +34 -1
- package/dist/types.d.ts +1 -1
- package/dist/ui/agent-chat-actions.d.ts +4 -1
- package/dist/ui/agent-chat-composer.d.ts +9 -1
- package/dist/ui/agent-chat-queue.d.ts +12 -0
- package/dist/ui/composer-attachments.d.ts +5 -1
- package/dist/ui/composer-interactions.d.ts +17 -0
- package/dist/ui/index.cjs +531 -331
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +516 -322
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/tool-sessions.d.ts +4 -1
- package/package.json +3 -3
- package/scaffold/src/components/chat/chat-composer.tsx +25 -26
- package/scaffold/src/components/chat/chat-message.tsx +7 -2
- package/scaffold/src/components/chat/chat-shell.tsx +52 -69
- package/dist/scaffold/components/ui/message-scroller.d.ts +0 -10
- package/scaffold/src/components/ui/message-scroller.tsx +0 -129
package/dist/scaffold/index.cjs
CHANGED
|
@@ -43,7 +43,8 @@ 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
|
-
var
|
|
46
|
+
var import_ui4 = require("@agents24/chat-react/ui");
|
|
47
|
+
var import_lucide_react11 = require("lucide-react");
|
|
47
48
|
var React8 = __toESM(require("react"), 1);
|
|
48
49
|
|
|
49
50
|
// scaffold/src/components/chat/chat-composer.tsx
|
|
@@ -518,6 +519,7 @@ function ChatComposer({
|
|
|
518
519
|
onAgentChange,
|
|
519
520
|
onStop,
|
|
520
521
|
onSubmit,
|
|
522
|
+
restoredDraft,
|
|
521
523
|
utilityRow = "inline"
|
|
522
524
|
}) {
|
|
523
525
|
const [text, setText] = React2.useState("");
|
|
@@ -539,11 +541,18 @@ function ChatComposer({
|
|
|
539
541
|
(0, import_ui.revokeAgentChatComposerFiles)(filesRef.current);
|
|
540
542
|
(0, import_ui.revokeAgentChatComposerFiles)(inFlightFilesRef.current);
|
|
541
543
|
}, []);
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
544
|
+
const focusComposer = (0, import_ui.useChatComposerFocus)({
|
|
545
|
+
textareaRef,
|
|
546
|
+
disabled: Boolean(disabled),
|
|
547
|
+
focusKey,
|
|
548
|
+
restoredDraft,
|
|
549
|
+
onRestore: (draft) => {
|
|
550
|
+
draftRevisionRef.current += 1;
|
|
551
|
+
(0, import_ui.revokeAgentChatComposerFiles)(filesRef.current);
|
|
552
|
+
setText(draft.text);
|
|
553
|
+
setFiles(draft.files);
|
|
554
|
+
}
|
|
555
|
+
});
|
|
547
556
|
const addRecording = React2.useCallback((file) => {
|
|
548
557
|
draftRevisionRef.current += 1;
|
|
549
558
|
setFiles((current) => [...current, (0, import_ui.createAgentChatComposerFile)(file)]);
|
|
@@ -553,8 +562,9 @@ function ChatComposer({
|
|
|
553
562
|
const validationError = (0, import_runtime.validateAgentChatSubmission)(
|
|
554
563
|
inputContract,
|
|
555
564
|
text,
|
|
556
|
-
files.map((file) => ({ data: file.source, mediaType: file.mediaType }))
|
|
565
|
+
files.map((file) => ({ data: file.source || new Uint8Array(), mediaType: file.mediaType }))
|
|
557
566
|
);
|
|
567
|
+
const action = (0, import_ui.chatComposerAction)({ hasDraft: Boolean(text.trim() || files.length), isRunning, isCancelling });
|
|
558
568
|
const selectedAgent = agents.find((item) => item.id === agentId);
|
|
559
569
|
const selectedModel = models.find((item) => item.id === modelId);
|
|
560
570
|
const modelSelector = models.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-fit max-w-40", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Select, { disabled: disabled || isRunning, onValueChange: onModelChange, value: modelId || void 0, children: [
|
|
@@ -595,7 +605,7 @@ function ChatComposer({
|
|
|
595
605
|
const hasContextWindow = Number.isFinite(Number(contextWindow?.max_tokens)) && Number(contextWindow?.max_tokens) > 0;
|
|
596
606
|
const showUtilityRow = utilityRow === "below";
|
|
597
607
|
const submit = async () => {
|
|
598
|
-
if (disabled ||
|
|
608
|
+
if (disabled || submittingRef.current || validationError) return;
|
|
599
609
|
const value = text;
|
|
600
610
|
const selectedFiles = files;
|
|
601
611
|
const clearedRevision = draftRevisionRef.current + 1;
|
|
@@ -604,7 +614,7 @@ function ChatComposer({
|
|
|
604
614
|
inFlightFilesRef.current = selectedFiles;
|
|
605
615
|
setText("");
|
|
606
616
|
setFiles([]);
|
|
607
|
-
|
|
617
|
+
focusComposer();
|
|
608
618
|
try {
|
|
609
619
|
await onSubmit(value, selectedFiles);
|
|
610
620
|
(0, import_ui.revokeAgentChatComposerFiles)(selectedFiles);
|
|
@@ -626,7 +636,7 @@ function ChatComposer({
|
|
|
626
636
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
627
637
|
"div",
|
|
628
638
|
{
|
|
629
|
-
className: "
|
|
639
|
+
className: "relative z-10 w-full pb-[max(1rem,env(safe-area-inset-bottom))]",
|
|
630
640
|
"data-agents24-chat-composer": "",
|
|
631
641
|
children: [
|
|
632
642
|
allowAttachments && files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mb-2 min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
@@ -675,7 +685,7 @@ function ChatComposer({
|
|
|
675
685
|
}
|
|
676
686
|
}
|
|
677
687
|
),
|
|
678
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "agents24-composer-attach flex min-w-0 items-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { className: "bg-muted/50 text-muted-foreground hover:bg-muted hover:text-foreground", variant: "ghost", size: "icon", "aria-label": "Attach files", disabled
|
|
688
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "agents24-composer-attach flex min-w-0 items-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { className: "bg-muted/50 text-muted-foreground hover:bg-muted hover:text-foreground", variant: "ghost", size: "icon", "aria-label": "Attach files", disabled, onClick: () => inputRef.current?.click(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "aria-hidden": true, children: "+" }) }) })
|
|
679
689
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "aria-hidden": "true", className: "agents24-composer-attach" }),
|
|
680
690
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
681
691
|
Textarea,
|
|
@@ -719,7 +729,7 @@ function ChatComposer({
|
|
|
719
729
|
children: recorder.isRecording ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.Square, { className: "fill-current" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.Mic, {})
|
|
720
730
|
}
|
|
721
731
|
) : null,
|
|
722
|
-
|
|
732
|
+
action === "stop" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
723
733
|
Button,
|
|
724
734
|
{
|
|
725
735
|
size: "icon",
|
|
@@ -729,9 +739,9 @@ function ChatComposer({
|
|
|
729
739
|
children: isCancelling ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.LoaderCircle, { className: "animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.Square, { className: "fill-current" })
|
|
730
740
|
}
|
|
731
741
|
) : validationError ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Tooltip, { children: [
|
|
732
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { tabIndex: 0, "aria-label": validationError, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "icon", "aria-label": "Send message", disabled: true, onClick: () => void submit(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ArrowUp, {}) }) }) }),
|
|
742
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { tabIndex: 0, "aria-label": validationError, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "icon", "aria-label": isRunning ? "Queue message" : "Send message", disabled: true, onClick: () => void submit(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ArrowUp, {}) }) }) }),
|
|
733
743
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipContent, { children: validationError })
|
|
734
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "icon", "aria-label": "Send message", disabled, onClick: () => void submit(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ArrowUp, {}) })
|
|
744
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "icon", "aria-label": isRunning ? "Queue message" : "Send message", disabled, onClick: () => void submit(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ArrowUp, {}) })
|
|
735
745
|
] })
|
|
736
746
|
]
|
|
737
747
|
}
|
|
@@ -1152,6 +1162,7 @@ function MessageFooter({ className, ...props }) {
|
|
|
1152
1162
|
// scaffold/src/components/chat/chat-message.tsx
|
|
1153
1163
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1154
1164
|
function ChatMessage({
|
|
1165
|
+
animateCompletion,
|
|
1155
1166
|
allowFeedback,
|
|
1156
1167
|
getHitlActionState,
|
|
1157
1168
|
isLoading,
|
|
@@ -1163,6 +1174,8 @@ function ChatMessage({
|
|
|
1163
1174
|
Timeline
|
|
1164
1175
|
}) {
|
|
1165
1176
|
const isUser = message.role === "user";
|
|
1177
|
+
const showCompletionActions = !isUser && message.isFinal !== false && !isLoading;
|
|
1178
|
+
const animateCompletionActions = (0, import_ui3.useCompletionActionEntrance)(showCompletionActions, message.runId, animateCompletion);
|
|
1166
1179
|
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: [
|
|
1167
1180
|
isUser && message.attachments?.length ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1168
1181
|
import_ui3.ChatAttachmentRows,
|
|
@@ -1193,9 +1206,10 @@ function ChatMessage({
|
|
|
1193
1206
|
message
|
|
1194
1207
|
}
|
|
1195
1208
|
) }),
|
|
1196
|
-
|
|
1209
|
+
showCompletionActions && /* @__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)(
|
|
1197
1210
|
import_ui3.AgentChatDefaultActions,
|
|
1198
1211
|
{
|
|
1212
|
+
animateCompletion: animateCompletionActions,
|
|
1199
1213
|
handlers: {
|
|
1200
1214
|
feedback: message.feedback,
|
|
1201
1215
|
onCopy: (content) => {
|
|
@@ -2036,112 +2050,9 @@ function isScaffoldTimelineLoading({
|
|
|
2036
2050
|
return message.id === streamingMessageId || Boolean(message.runId && message.runId === activeRunId);
|
|
2037
2051
|
}
|
|
2038
2052
|
|
|
2039
|
-
// scaffold/src/components/ui/message-scroller.tsx
|
|
2040
|
-
var import_message_scroller = require("@shadcn/react/message-scroller");
|
|
2041
|
-
var import_lucide_react11 = require("lucide-react");
|
|
2042
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2043
|
-
function MessageScrollerProvider(props) {
|
|
2044
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_message_scroller.MessageScroller.Provider, { ...props });
|
|
2045
|
-
}
|
|
2046
|
-
function MessageScroller({
|
|
2047
|
-
className,
|
|
2048
|
-
...props
|
|
2049
|
-
}) {
|
|
2050
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2051
|
-
import_message_scroller.MessageScroller.Root,
|
|
2052
|
-
{
|
|
2053
|
-
"data-slot": "message-scroller",
|
|
2054
|
-
className: cn(
|
|
2055
|
-
"group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden",
|
|
2056
|
-
className
|
|
2057
|
-
),
|
|
2058
|
-
...props
|
|
2059
|
-
}
|
|
2060
|
-
);
|
|
2061
|
-
}
|
|
2062
|
-
function MessageScrollerViewport({
|
|
2063
|
-
className,
|
|
2064
|
-
...props
|
|
2065
|
-
}) {
|
|
2066
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2067
|
-
import_message_scroller.MessageScroller.Viewport,
|
|
2068
|
-
{
|
|
2069
|
-
"data-slot": "message-scroller-viewport",
|
|
2070
|
-
className: cn(
|
|
2071
|
-
"size-full min-h-0 min-w-0 scroll-fade-b overflow-y-auto overscroll-contain contain-content [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
2072
|
-
className
|
|
2073
|
-
),
|
|
2074
|
-
...props
|
|
2075
|
-
}
|
|
2076
|
-
);
|
|
2077
|
-
}
|
|
2078
|
-
function MessageScrollerContent({
|
|
2079
|
-
className,
|
|
2080
|
-
...props
|
|
2081
|
-
}) {
|
|
2082
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2083
|
-
import_message_scroller.MessageScroller.Content,
|
|
2084
|
-
{
|
|
2085
|
-
"data-slot": "message-scroller-content",
|
|
2086
|
-
className: cn("flex h-max min-h-full flex-col gap-3", className),
|
|
2087
|
-
...props
|
|
2088
|
-
}
|
|
2089
|
-
);
|
|
2090
|
-
}
|
|
2091
|
-
function MessageScrollerItem({
|
|
2092
|
-
className,
|
|
2093
|
-
scrollAnchor = false,
|
|
2094
|
-
...props
|
|
2095
|
-
}) {
|
|
2096
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2097
|
-
import_message_scroller.MessageScroller.Item,
|
|
2098
|
-
{
|
|
2099
|
-
"data-slot": "message-scroller-item",
|
|
2100
|
-
scrollAnchor,
|
|
2101
|
-
className: cn(
|
|
2102
|
-
"min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]",
|
|
2103
|
-
className
|
|
2104
|
-
),
|
|
2105
|
-
...props
|
|
2106
|
-
}
|
|
2107
|
-
);
|
|
2108
|
-
}
|
|
2109
|
-
function MessageScrollerButton({
|
|
2110
|
-
direction = "end",
|
|
2111
|
-
className,
|
|
2112
|
-
children,
|
|
2113
|
-
render,
|
|
2114
|
-
variant = "secondary",
|
|
2115
|
-
size = "icon-sm",
|
|
2116
|
-
...props
|
|
2117
|
-
}) {
|
|
2118
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2119
|
-
import_message_scroller.MessageScroller.Button,
|
|
2120
|
-
{
|
|
2121
|
-
"data-slot": "message-scroller-button",
|
|
2122
|
-
"data-direction": direction,
|
|
2123
|
-
"data-variant": variant,
|
|
2124
|
-
"data-size": size,
|
|
2125
|
-
direction,
|
|
2126
|
-
className: cn(
|
|
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",
|
|
2128
|
-
className
|
|
2129
|
-
),
|
|
2130
|
-
render: render ?? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { variant, size }),
|
|
2131
|
-
...props,
|
|
2132
|
-
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
2133
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2134
|
-
import_lucide_react11.ArrowDownIcon,
|
|
2135
|
-
{}
|
|
2136
|
-
),
|
|
2137
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "sr-only", children: direction === "end" ? "Scroll to end" : "Scroll to start" })
|
|
2138
|
-
] })
|
|
2139
|
-
}
|
|
2140
|
-
);
|
|
2141
|
-
}
|
|
2142
|
-
|
|
2143
2053
|
// scaffold/src/components/chat/chat-shell.tsx
|
|
2144
|
-
var
|
|
2054
|
+
var import_chat_react2 = require("@agents24/chat-react");
|
|
2055
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2145
2056
|
var LOADING_INPUT_CONTRACT = {
|
|
2146
2057
|
version: "agents24.runtime-inputs.v2",
|
|
2147
2058
|
modalities: {
|
|
@@ -2154,31 +2065,31 @@ var LOADING_INPUT_CONTRACT = {
|
|
|
2154
2065
|
retention: { mode: "thread_lifetime" }
|
|
2155
2066
|
};
|
|
2156
2067
|
function PersistentSidebarTrigger() {
|
|
2157
|
-
return /* @__PURE__ */ (0,
|
|
2068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "pointer-events-none fixed start-3 top-0 z-[60] flex h-12 items-center", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SidebarTrigger, { className: "pointer-events-auto [&_svg]:size-[18px]" }) });
|
|
2158
2069
|
}
|
|
2159
2070
|
function CollapsedHeaderActions({ onNew }) {
|
|
2160
2071
|
const { isMobile, openMobile, state } = useSidebar();
|
|
2161
2072
|
const sidebarVisible = isMobile ? openMobile : state === "expanded";
|
|
2162
2073
|
if (sidebarVisible) return null;
|
|
2163
|
-
return /* @__PURE__ */ (0,
|
|
2164
|
-
/* @__PURE__ */ (0,
|
|
2165
|
-
/* @__PURE__ */ (0,
|
|
2074
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
2075
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "h-8 w-17 shrink-0", "aria-hidden": "true" }),
|
|
2076
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "pointer-events-none fixed start-12 top-0 z-[60] flex h-12 items-center", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { className: "pointer-events-auto", variant: "ghost", size: "icon-sm", "aria-label": "New chat", onClick: onNew, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.SquarePen, {}) }) })
|
|
2166
2077
|
] });
|
|
2167
2078
|
}
|
|
2168
2079
|
function OperationErrorNotice({ runtime }) {
|
|
2169
2080
|
const error = runtime.operationError || runtime.backgroundError;
|
|
2170
2081
|
if (!error) return null;
|
|
2171
|
-
return /* @__PURE__ */ (0,
|
|
2172
|
-
/* @__PURE__ */ (0,
|
|
2173
|
-
/* @__PURE__ */ (0,
|
|
2174
|
-
/* @__PURE__ */ (0,
|
|
2082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "pointer-events-none absolute inset-x-0 top-3 z-40 flex justify-center px-4", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "pointer-events-auto flex max-w-lg items-start gap-2 rounded-lg border border-destructive/20 bg-background px-3 py-2 text-sm shadow-md", role: "alert", children: [
|
|
2083
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.CircleAlert, { className: "mt-0.5 size-4 shrink-0 text-destructive" }),
|
|
2084
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "min-w-0 flex-1 wrap-break-word", children: (0, import_runtime2.agentChatRuntimeErrorMessage)(error) || "The chat could not complete that action." }),
|
|
2085
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2175
2086
|
Button,
|
|
2176
2087
|
{
|
|
2177
2088
|
"aria-label": "Dismiss error",
|
|
2178
2089
|
onClick: runtime.operationError ? runtime.clearOperationError : runtime.controller.clearBackgroundError,
|
|
2179
2090
|
size: "icon-xs",
|
|
2180
2091
|
variant: "ghost",
|
|
2181
|
-
children: /* @__PURE__ */ (0,
|
|
2092
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.X, {})
|
|
2182
2093
|
}
|
|
2183
2094
|
)
|
|
2184
2095
|
] }) });
|
|
@@ -2190,15 +2101,27 @@ function ChatShell({
|
|
|
2190
2101
|
sidebar
|
|
2191
2102
|
}) {
|
|
2192
2103
|
const { controller } = runtime;
|
|
2104
|
+
const isUploading = controller.runState === "uploading";
|
|
2193
2105
|
const isRunning = controller.runState === "streaming" || controller.runState === "reconnecting" || controller.runState === "paused" || controller.runState === "cancelling";
|
|
2194
|
-
const isUploading = controller.runState === "uploading" || runtime.isUploading;
|
|
2195
2106
|
const isCancelling = controller.runState === "cancelling";
|
|
2107
|
+
const wasLiveRun = (0, import_ui4.useLiveCompletionRuns)(controller.activeRunId, isRunning);
|
|
2196
2108
|
const activeTitle = controller.threads.find((thread) => thread.id === controller.activeThreadId)?.title;
|
|
2197
2109
|
const hasBlockingError = Boolean(runtime.fatalError && controller.messages.length === 0);
|
|
2198
2110
|
const isEmptyState = controller.activeThreadId === null && controller.messages.length === 0 && !hasBlockingError;
|
|
2111
|
+
const latestAnchorId = (0, import_chat_react2.latestThreadAnchorId)(controller.messages);
|
|
2199
2112
|
const composerOverlayRef = React8.useRef(null);
|
|
2200
2113
|
const [composerOverlayHeight, setComposerOverlayHeight] = React8.useState(192);
|
|
2201
|
-
React8.
|
|
2114
|
+
const [restoredDraft, setRestoredDraft] = React8.useState(null);
|
|
2115
|
+
const draftRevisionRef = React8.useRef(0);
|
|
2116
|
+
const retractForEdit = React8.useCallback(async (message) => {
|
|
2117
|
+
const draft = await controller.retractPendingMessage(message);
|
|
2118
|
+
setRestoredDraft({
|
|
2119
|
+
revision: ++draftRevisionRef.current,
|
|
2120
|
+
text: draft.text,
|
|
2121
|
+
files: (0, import_ui4.queuedMessageComposerFiles)(draft)
|
|
2122
|
+
});
|
|
2123
|
+
}, [controller]);
|
|
2124
|
+
React8.useLayoutEffect(() => {
|
|
2202
2125
|
const overlay = composerOverlayRef.current;
|
|
2203
2126
|
if (!overlay || isEmptyState) return;
|
|
2204
2127
|
const updateHeight = () => {
|
|
@@ -2209,15 +2132,15 @@ function ChatShell({
|
|
|
2209
2132
|
resizeObserver.observe(overlay);
|
|
2210
2133
|
return () => resizeObserver.disconnect();
|
|
2211
2134
|
}, [isEmptyState]);
|
|
2212
|
-
return /* @__PURE__ */ (0,
|
|
2135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2213
2136
|
SidebarProvider,
|
|
2214
2137
|
{
|
|
2215
2138
|
className: "h-svh min-h-0 overflow-hidden",
|
|
2216
2139
|
"data-agents24-chat": "",
|
|
2217
2140
|
"data-agents24-chat-layout": "",
|
|
2218
2141
|
children: [
|
|
2219
|
-
/* @__PURE__ */ (0,
|
|
2220
|
-
sidebar || /* @__PURE__ */ (0,
|
|
2142
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PersistentSidebarTrigger, {}),
|
|
2143
|
+
sidebar || /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2221
2144
|
ThreadSidebar,
|
|
2222
2145
|
{
|
|
2223
2146
|
activeThreadId: controller.activeThreadId,
|
|
@@ -2232,171 +2155,147 @@ function ChatShell({
|
|
|
2232
2155
|
onOpen: runtime.openThread
|
|
2233
2156
|
}
|
|
2234
2157
|
),
|
|
2235
|
-
/* @__PURE__ */ (0,
|
|
2236
|
-
/* @__PURE__ */ (0,
|
|
2158
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(SidebarInset, { className: "h-svh min-h-0 overflow-hidden bg-background", children: [
|
|
2159
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2237
2160
|
"header",
|
|
2238
2161
|
{
|
|
2239
2162
|
className: "flex h-12 shrink-0 items-center gap-2 border-b border-border/50 px-3 sm:px-4",
|
|
2240
2163
|
"data-agents24-chat-header": "",
|
|
2241
2164
|
children: [
|
|
2242
|
-
/* @__PURE__ */ (0,
|
|
2243
|
-
/* @__PURE__ */ (0,
|
|
2244
|
-
/* @__PURE__ */ (0,
|
|
2165
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CollapsedHeaderActions, { onNew: runtime.newThread }),
|
|
2166
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h1", { className: "truncate text-sm font-medium", children: String(activeTitle || "New chat") }) }),
|
|
2167
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ThemeMenu, {})
|
|
2245
2168
|
]
|
|
2246
2169
|
}
|
|
2247
2170
|
),
|
|
2248
|
-
/* @__PURE__ */ (0,
|
|
2171
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2249
2172
|
"section",
|
|
2250
2173
|
{
|
|
2251
2174
|
"aria-label": "Conversation",
|
|
2252
2175
|
className: "relative flex min-h-0 flex-1 flex-col overflow-hidden",
|
|
2253
2176
|
"data-agents24-chat-transcript": "",
|
|
2254
2177
|
children: [
|
|
2255
|
-
/* @__PURE__ */ (0,
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2178
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(OperationErrorNotice, { runtime }),
|
|
2179
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_chat_react2.LatestThreadScroller.Provider, { autoScroll: true, defaultScrollPosition: "last-anchor", scrollPreviousItemPeek: 64, children: [
|
|
2180
|
+
!isEmptyState && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_chat_react2.LatestThreadScroller.Root, { className: "relative min-h-0 flex-1", children: [
|
|
2181
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_chat_react2.LatestThreadScroller.Viewport, { preserveScrollOnPrepend: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2182
|
+
import_chat_react2.LatestThreadScroller.Content,
|
|
2183
|
+
{
|
|
2184
|
+
className: "mx-auto w-full max-w-3xl gap-3 px-4 pt-8 pb-0 sm:px-6 sm:pt-12",
|
|
2185
|
+
style: { paddingBottom: composerOverlayHeight + 72 },
|
|
2186
|
+
children: [
|
|
2187
|
+
controller.hasOlderTurns && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Button, { className: "self-center", variant: "ghost", size: "sm", disabled: controller.isLoadingOlder, onClick: () => {
|
|
2188
|
+
void controller.loadOlder().catch(() => void 0);
|
|
2189
|
+
}, children: [
|
|
2190
|
+
controller.isLoadingOlder && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.LoaderCircle, { className: "animate-spin" }),
|
|
2191
|
+
" Load earlier messages"
|
|
2192
|
+
] }),
|
|
2193
|
+
runtime.isBootstrapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { "aria-label": "Loading conversation", className: "flex flex-1 items-center justify-center py-24 text-muted-foreground", role: "status", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.LoaderCircle, { className: "size-4 animate-spin" }) }),
|
|
2194
|
+
hasBlockingError && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-1 flex-col items-center justify-center gap-3 py-24 text-center", children: [
|
|
2195
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.CircleAlert, { className: "size-5 text-destructive" }),
|
|
2196
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
|
|
2197
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { className: "font-medium", children: "Couldn\u2019t connect" }),
|
|
2198
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "mt-1 max-w-md text-sm text-muted-foreground", children: runtime.errorMessage })
|
|
2199
|
+
] }),
|
|
2200
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { variant: "outline", onClick: () => void runtime.retryBootstrap(), children: "Try again" })
|
|
2201
|
+
] }),
|
|
2202
|
+
controller.messages.map((message) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2203
|
+
import_chat_react2.LatestThreadScroller.Item,
|
|
2204
|
+
{
|
|
2205
|
+
messageId: message.id,
|
|
2206
|
+
scrollAnchor: isRunning && message.id === latestAnchorId,
|
|
2207
|
+
className: "overflow-visible [content-visibility:visible]",
|
|
2208
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2209
|
+
ChatMessage,
|
|
2210
|
+
{
|
|
2211
|
+
animateCompletion: wasLiveRun(message.runId),
|
|
2212
|
+
allowFeedback: runtime.allowFeedback,
|
|
2213
|
+
getHitlActionState: runtime.getHitlActionState,
|
|
2214
|
+
isLoading: isScaffoldTimelineLoading({
|
|
2215
|
+
activeRunId: controller.activeRunId,
|
|
2216
|
+
message,
|
|
2217
|
+
runState: controller.runState,
|
|
2218
|
+
streamingMessageId: controller.streamingMessageId
|
|
2219
|
+
}),
|
|
2220
|
+
message,
|
|
2221
|
+
onHitlAction: runtime.onHitlAction,
|
|
2222
|
+
onRegenerate: () => controller.regenerate(message),
|
|
2223
|
+
onSetFeedback: (input) => controller.setFeedback(message, input),
|
|
2224
|
+
resolveAttachmentContent: runtime.resolveAttachmentContent,
|
|
2225
|
+
Timeline: components?.Timeline
|
|
2226
|
+
}
|
|
2227
|
+
)
|
|
2228
|
+
},
|
|
2229
|
+
message.id
|
|
2230
|
+
))
|
|
2231
|
+
]
|
|
2232
|
+
}
|
|
2233
|
+
) }),
|
|
2234
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TurnOutline, { messages: controller.messages })
|
|
2235
|
+
] }),
|
|
2236
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2237
|
+
"div",
|
|
2260
2238
|
{
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
forceExpanded: true,
|
|
2266
|
-
isCancelling,
|
|
2267
|
-
isRunning,
|
|
2268
|
-
agentId: runtime.agentId,
|
|
2269
|
-
agents: runtime.agents,
|
|
2270
|
-
onAgentChange: (agentId) => {
|
|
2271
|
-
void runtime.changeAgent(agentId);
|
|
2272
|
-
},
|
|
2273
|
-
onStop: () => {
|
|
2274
|
-
void controller.cancelRun().catch(() => void 0);
|
|
2239
|
+
ref: composerOverlayRef,
|
|
2240
|
+
className: isEmptyState ? "pointer-events-none absolute inset-0 z-30 flex flex-col justify-center overflow-visible pb-20" : "pointer-events-none absolute inset-x-0 bottom-0 z-30 overflow-visible pt-10",
|
|
2241
|
+
style: isEmptyState ? void 0 : {
|
|
2242
|
+
background: "linear-gradient(to bottom, transparent 0%, color-mix(in oklch, var(--background) 85%, transparent) 45%, var(--background) 65%, var(--background) 100%)"
|
|
2275
2243
|
},
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2244
|
+
children: [
|
|
2245
|
+
isEmptyState ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "mx-auto mb-8 w-full max-w-3xl px-4 text-center sm:px-6", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { className: "text-3xl font-semibold tracking-tight sm:text-4xl", children: "Ready when you are." }) }) : /* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.jsx)(import_chat_react2.LatestThreadScroller.Button, { className: "!relative !inset-auto !translate-x-0 rtl:!translate-x-0" }) }),
|
|
2246
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "pointer-events-auto mx-auto w-full max-w-3xl px-4 sm:px-6", children: [
|
|
2247
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2248
|
+
import_ui4.AgentChatQueue,
|
|
2249
|
+
{
|
|
2250
|
+
pending: controller.pendingMessages,
|
|
2251
|
+
queue: controller.messageQueue,
|
|
2252
|
+
canSteer: controller.runState === "streaming",
|
|
2253
|
+
onSteer: controller.steerPendingMessage,
|
|
2254
|
+
onRemove: controller.removePendingMessage,
|
|
2255
|
+
onEdit: retractForEdit,
|
|
2256
|
+
onResume: controller.resumeQueue
|
|
2257
|
+
}
|
|
2258
|
+
),
|
|
2259
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2260
|
+
ChatComposer,
|
|
2261
|
+
{
|
|
2262
|
+
restoredDraft,
|
|
2263
|
+
inputContract: runtime.inputContract || LOADING_INPUT_CONTRACT,
|
|
2264
|
+
contextWindow: runtime.contextWindow,
|
|
2265
|
+
disabled: runtime.isBootstrapping || runtime.isChangingAgent || isUploading || hasBlockingError,
|
|
2266
|
+
focusKey: controller.activeThreadId,
|
|
2267
|
+
forceExpanded: isEmptyState,
|
|
2268
|
+
isCancelling,
|
|
2269
|
+
isRunning,
|
|
2270
|
+
agentId: runtime.agentId,
|
|
2271
|
+
agents: runtime.agents,
|
|
2272
|
+
onAgentChange: (agentId) => {
|
|
2273
|
+
void runtime.changeAgent(agentId);
|
|
2274
|
+
},
|
|
2275
|
+
onStop: () => {
|
|
2276
|
+
void controller.cancelRun().catch(() => void 0);
|
|
2277
|
+
},
|
|
2278
|
+
modelId: runtime.modelId,
|
|
2279
|
+
models: runtime.models,
|
|
2280
|
+
onModelChange: runtime.changeModel,
|
|
2281
|
+
onSubmit: (text, files) => runtime.submit({
|
|
2282
|
+
text,
|
|
2283
|
+
files: files.filter((file) => file.source).map((file) => ({
|
|
2284
|
+
data: file.source,
|
|
2285
|
+
mediaType: file.mediaType,
|
|
2286
|
+
name: file.filename
|
|
2287
|
+
})),
|
|
2288
|
+
attachmentIds: files.flatMap((file) => file.persistedAttachmentId ? [file.persistedAttachmentId] : []),
|
|
2289
|
+
attachments: files
|
|
2290
|
+
}),
|
|
2291
|
+
utilityRow: isEmptyState ? "inline" : "below"
|
|
2292
|
+
}
|
|
2293
|
+
)
|
|
2294
|
+
] })
|
|
2295
|
+
]
|
|
2288
2296
|
}
|
|
2289
2297
|
)
|
|
2290
|
-
] })
|
|
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: [
|
|
2298
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MessageScrollerViewport, { preserveScrollOnPrepend: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2299
|
-
MessageScrollerContent,
|
|
2300
|
-
{
|
|
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 },
|
|
2303
|
-
children: [
|
|
2304
|
-
controller.hasOlderTurns && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Button, { className: "self-center", variant: "ghost", size: "sm", disabled: controller.isLoadingOlder, onClick: () => {
|
|
2305
|
-
void controller.loadOlder().catch(() => void 0);
|
|
2306
|
-
}, children: [
|
|
2307
|
-
controller.isLoadingOlder && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.LoaderCircle, { className: "animate-spin" }),
|
|
2308
|
-
" Load earlier messages"
|
|
2309
|
-
] }),
|
|
2310
|
-
runtime.isBootstrapping && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { "aria-label": "Loading conversation", className: "flex flex-1 items-center justify-center py-24 text-muted-foreground", role: "status", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.LoaderCircle, { className: "size-4 animate-spin" }) }),
|
|
2311
|
-
hasBlockingError && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-1 flex-col items-center justify-center gap-3 py-24 text-center", children: [
|
|
2312
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.CircleAlert, { className: "size-5 text-destructive" }),
|
|
2313
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
|
|
2314
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h2", { className: "font-medium", children: "Couldn\u2019t connect" }),
|
|
2315
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "mt-1 max-w-md text-sm text-muted-foreground", children: runtime.errorMessage })
|
|
2316
|
-
] }),
|
|
2317
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { variant: "outline", onClick: () => void runtime.retryBootstrap(), children: "Try again" })
|
|
2318
|
-
] }),
|
|
2319
|
-
controller.messages.map((message) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2320
|
-
MessageScrollerItem,
|
|
2321
|
-
{
|
|
2322
|
-
messageId: message.id,
|
|
2323
|
-
scrollAnchor: message.role === "user",
|
|
2324
|
-
className: "overflow-visible [content-visibility:visible]",
|
|
2325
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2326
|
-
ChatMessage,
|
|
2327
|
-
{
|
|
2328
|
-
allowFeedback: runtime.allowFeedback,
|
|
2329
|
-
getHitlActionState: runtime.getHitlActionState,
|
|
2330
|
-
isLoading: isScaffoldTimelineLoading({
|
|
2331
|
-
activeRunId: controller.activeRunId,
|
|
2332
|
-
message,
|
|
2333
|
-
runState: controller.runState,
|
|
2334
|
-
streamingMessageId: controller.streamingMessageId
|
|
2335
|
-
}),
|
|
2336
|
-
message,
|
|
2337
|
-
onHitlAction: runtime.onHitlAction,
|
|
2338
|
-
onRegenerate: () => controller.regenerate(message),
|
|
2339
|
-
onSetFeedback: (input) => controller.setFeedback(message, input),
|
|
2340
|
-
resolveAttachmentContent: runtime.resolveAttachmentContent,
|
|
2341
|
-
Timeline: components?.Timeline
|
|
2342
|
-
}
|
|
2343
|
-
)
|
|
2344
|
-
},
|
|
2345
|
-
message.id
|
|
2346
|
-
))
|
|
2347
|
-
]
|
|
2348
|
-
}
|
|
2349
|
-
) }),
|
|
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
|
-
) })
|
|
2298
|
+
] })
|
|
2400
2299
|
]
|
|
2401
2300
|
}
|
|
2402
2301
|
)
|
|
@@ -2410,7 +2309,7 @@ function ChatShell({
|
|
|
2410
2309
|
var GUEST_CHAT_IDENTITY = { state: "guest" };
|
|
2411
2310
|
|
|
2412
2311
|
// scaffold/src/app.tsx
|
|
2413
|
-
var
|
|
2312
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2414
2313
|
var createBrowserAbortController = () => new AbortController();
|
|
2415
2314
|
function RuntimeChat({
|
|
2416
2315
|
components,
|
|
@@ -2421,17 +2320,17 @@ function RuntimeChat({
|
|
|
2421
2320
|
...props,
|
|
2422
2321
|
mcpRedirectUri: props.mcpRedirectUri || (typeof window === "undefined" ? void 0 : window.location.href)
|
|
2423
2322
|
});
|
|
2424
|
-
return /* @__PURE__ */ (0,
|
|
2323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChatShell, { components, identity, runtime, sidebar: props.sidebar });
|
|
2425
2324
|
}
|
|
2426
2325
|
function App(props) {
|
|
2427
2326
|
const identity = props.identity || GUEST_CHAT_IDENTITY;
|
|
2428
|
-
return /* @__PURE__ */ (0,
|
|
2327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react2.Agents24Provider, { client: props.client, createAbortController: createBrowserAbortController, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RuntimeChat, { ...props }, identity.state) });
|
|
2429
2328
|
}
|
|
2430
2329
|
|
|
2431
2330
|
// scaffold/src/index.tsx
|
|
2432
|
-
var
|
|
2331
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2433
2332
|
function Agents24ChatScaffold({ appearanceController, theme, ...props }) {
|
|
2434
|
-
return /* @__PURE__ */ (0,
|
|
2333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ThemeProvider, { controller: appearanceController, theme, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(App, { ...props }) }) });
|
|
2435
2334
|
}
|
|
2436
2335
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2437
2336
|
0 && (module.exports = {
|