@surf-kit/agent 0.3.0 → 0.4.0
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/chat/index.cjs +131 -41
- package/dist/chat/index.cjs.map +1 -1
- package/dist/chat/index.d.cts +3 -2
- package/dist/chat/index.d.ts +3 -2
- package/dist/chat/index.js +132 -42
- package/dist/chat/index.js.map +1 -1
- package/dist/{chat-CGamM7Mz.d.cts → chat-BRY3xGg_.d.cts} +1 -1
- package/dist/{chat-BIIDOGrD.d.ts → chat-CcKc6OAR.d.ts} +1 -1
- package/dist/{hooks-CTeEqnBQ.d.ts → hooks-BLeiVk-x.d.ts} +3 -2
- package/dist/{hooks-B1NYoLLs.d.cts → hooks-CSGGLd7j.d.cts} +3 -2
- package/dist/hooks.cjs +41 -11
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +3 -3
- package/dist/hooks.d.ts +3 -3
- package/dist/hooks.js +41 -11
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +131 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +136 -46
- package/dist/index.js.map +1 -1
- package/dist/layouts/index.cjs +131 -41
- package/dist/layouts/index.cjs.map +1 -1
- package/dist/layouts/index.d.cts +1 -1
- package/dist/layouts/index.d.ts +1 -1
- package/dist/layouts/index.js +134 -44
- package/dist/layouts/index.js.map +1 -1
- package/dist/response/index.cjs +34 -3
- package/dist/response/index.cjs.map +1 -1
- package/dist/response/index.d.cts +1 -1
- package/dist/response/index.d.ts +1 -1
- package/dist/response/index.js +35 -4
- package/dist/response/index.js.map +1 -1
- package/dist/streaming/index.cjs +14 -3
- package/dist/streaming/index.cjs.map +1 -1
- package/dist/streaming/index.d.cts +2 -2
- package/dist/streaming/index.d.ts +2 -2
- package/dist/streaming/index.js +14 -3
- package/dist/streaming/index.js.map +1 -1
- package/dist/{streaming-x7umFHoP.d.cts → streaming-BHPXnwwo.d.cts} +3 -1
- package/dist/{streaming-Bx-ff2tt.d.ts → streaming-C6mbU7My.d.ts} +3 -1
- package/package.json +5 -4
package/dist/layouts/index.d.cts
CHANGED
package/dist/layouts/index.d.ts
CHANGED
package/dist/layouts/index.js
CHANGED
|
@@ -38,6 +38,8 @@ function reducer(state, action) {
|
|
|
38
38
|
return { ...state, streamPhase: action.phase };
|
|
39
39
|
case "STREAM_CONTENT":
|
|
40
40
|
return { ...state, streamingContent: state.streamingContent + action.content };
|
|
41
|
+
case "STREAM_CONTENT_RESET":
|
|
42
|
+
return { ...state, streamingContent: "" };
|
|
41
43
|
case "STREAM_AGENT":
|
|
42
44
|
return { ...state, streamingAgent: action.agent };
|
|
43
45
|
case "SEND_SUCCESS":
|
|
@@ -83,6 +85,7 @@ function useAgentChat(config) {
|
|
|
83
85
|
configRef.current = config;
|
|
84
86
|
const lastUserMessageRef = useRef(null);
|
|
85
87
|
const lastUserAttachmentsRef = useRef(void 0);
|
|
88
|
+
const abortControllerRef = useRef(null);
|
|
86
89
|
const sendMessage = useCallback(
|
|
87
90
|
async (content, attachments) => {
|
|
88
91
|
const { apiUrl, streamPath = "/chat/stream", headers: headersOrFn, timeout = 3e4, bodyExtra } = configRef.current;
|
|
@@ -98,7 +101,15 @@ function useAgentChat(config) {
|
|
|
98
101
|
};
|
|
99
102
|
dispatch({ type: "SEND_START", message: userMessage });
|
|
100
103
|
const controller = new AbortController();
|
|
104
|
+
abortControllerRef.current = controller;
|
|
101
105
|
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
106
|
+
const ctx = {
|
|
107
|
+
accumulatedContent: "",
|
|
108
|
+
agentResponse: null,
|
|
109
|
+
capturedAgent: null,
|
|
110
|
+
capturedConversationId: null,
|
|
111
|
+
hadStreamError: false
|
|
112
|
+
};
|
|
102
113
|
try {
|
|
103
114
|
const url = `${apiUrl}${streamPath}`;
|
|
104
115
|
const mergedHeaders = {
|
|
@@ -119,13 +130,6 @@ function useAgentChat(config) {
|
|
|
119
130
|
}));
|
|
120
131
|
}
|
|
121
132
|
const body = JSON.stringify(requestBody);
|
|
122
|
-
const ctx = {
|
|
123
|
-
accumulatedContent: "",
|
|
124
|
-
agentResponse: null,
|
|
125
|
-
capturedAgent: null,
|
|
126
|
-
capturedConversationId: null,
|
|
127
|
-
hadStreamError: false
|
|
128
|
-
};
|
|
129
133
|
const handleEvent = (event) => {
|
|
130
134
|
switch (event.type) {
|
|
131
135
|
case "agent":
|
|
@@ -139,6 +143,10 @@ function useAgentChat(config) {
|
|
|
139
143
|
ctx.accumulatedContent += event.content;
|
|
140
144
|
dispatch({ type: "STREAM_CONTENT", content: event.content });
|
|
141
145
|
break;
|
|
146
|
+
case "delta_reset":
|
|
147
|
+
ctx.accumulatedContent = "";
|
|
148
|
+
dispatch({ type: "STREAM_CONTENT_RESET" });
|
|
149
|
+
break;
|
|
142
150
|
case "done":
|
|
143
151
|
ctx.agentResponse = event.response;
|
|
144
152
|
ctx.capturedConversationId = event.conversation_id ?? null;
|
|
@@ -222,10 +230,26 @@ function useAgentChat(config) {
|
|
|
222
230
|
} catch (err) {
|
|
223
231
|
clearTimeout(timeoutId);
|
|
224
232
|
if (err.name === "AbortError") {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
233
|
+
if (ctx.accumulatedContent) {
|
|
234
|
+
const partialMessage = {
|
|
235
|
+
id: generateMessageId(),
|
|
236
|
+
role: "assistant",
|
|
237
|
+
content: ctx.accumulatedContent,
|
|
238
|
+
agent: ctx.capturedAgent ?? void 0,
|
|
239
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
240
|
+
};
|
|
241
|
+
dispatch({
|
|
242
|
+
type: "SEND_SUCCESS",
|
|
243
|
+
message: partialMessage,
|
|
244
|
+
streamingContent: ctx.accumulatedContent,
|
|
245
|
+
conversationId: ctx.capturedConversationId
|
|
246
|
+
});
|
|
247
|
+
} else {
|
|
248
|
+
dispatch({
|
|
249
|
+
type: "SEND_ERROR",
|
|
250
|
+
error: { code: "ABORTED", message: "Request stopped", retryable: true }
|
|
251
|
+
});
|
|
252
|
+
}
|
|
229
253
|
} else {
|
|
230
254
|
dispatch({
|
|
231
255
|
type: "SEND_ERROR",
|
|
@@ -236,6 +260,8 @@ function useAgentChat(config) {
|
|
|
236
260
|
}
|
|
237
261
|
});
|
|
238
262
|
}
|
|
263
|
+
} finally {
|
|
264
|
+
abortControllerRef.current = null;
|
|
239
265
|
}
|
|
240
266
|
},
|
|
241
267
|
[state.conversationId]
|
|
@@ -263,6 +289,9 @@ function useAgentChat(config) {
|
|
|
263
289
|
await sendMessage(lastUserMessageRef.current, lastUserAttachmentsRef.current);
|
|
264
290
|
}
|
|
265
291
|
}, [sendMessage]);
|
|
292
|
+
const stop = useCallback(() => {
|
|
293
|
+
abortControllerRef.current?.abort();
|
|
294
|
+
}, []);
|
|
266
295
|
const reset = useCallback(() => {
|
|
267
296
|
dispatch({ type: "RESET" });
|
|
268
297
|
lastUserMessageRef.current = null;
|
|
@@ -274,6 +303,7 @@ function useAgentChat(config) {
|
|
|
274
303
|
loadConversation,
|
|
275
304
|
submitFeedback,
|
|
276
305
|
retry,
|
|
306
|
+
stop,
|
|
277
307
|
reset
|
|
278
308
|
};
|
|
279
309
|
return { state, actions };
|
|
@@ -293,6 +323,7 @@ import { Badge as Badge2 } from "@surf-kit/core";
|
|
|
293
323
|
import React from "react";
|
|
294
324
|
import ReactMarkdown from "react-markdown";
|
|
295
325
|
import rehypeSanitize from "rehype-sanitize";
|
|
326
|
+
import remarkGfm from "remark-gfm";
|
|
296
327
|
import { twMerge } from "tailwind-merge";
|
|
297
328
|
import { jsx } from "react/jsx-runtime";
|
|
298
329
|
function normalizeMarkdownLists(content) {
|
|
@@ -317,6 +348,10 @@ function ResponseMessage({ content, className }) {
|
|
|
317
348
|
"[&_pre]:bg-surface-raised [&_pre]:border [&_pre]:border-border [&_pre]:rounded-xl [&_pre]:p-4 [&_pre]:overflow-x-auto",
|
|
318
349
|
"[&_hr]:my-3 [&_hr]:border-border",
|
|
319
350
|
"[&_blockquote]:border-l-2 [&_blockquote]:border-border-strong [&_blockquote]:pl-4 [&_blockquote]:text-text-secondary",
|
|
351
|
+
"[&_table]:w-full [&_table]:text-sm [&_table]:border-collapse [&_table]:my-2",
|
|
352
|
+
"[&_thead]:border-b [&_thead]:border-border",
|
|
353
|
+
"[&_th]:text-left [&_th]:px-2 [&_th]:py-1.5 [&_th]:font-semibold",
|
|
354
|
+
"[&_td]:px-2 [&_td]:py-1.5 [&_td]:border-t [&_td]:border-border/50",
|
|
320
355
|
"[&_a]:text-accent [&_a]:underline-offset-2 [&_a]:hover:text-accent/80",
|
|
321
356
|
className
|
|
322
357
|
),
|
|
@@ -324,6 +359,7 @@ function ResponseMessage({ content, className }) {
|
|
|
324
359
|
children: /* @__PURE__ */ jsx(
|
|
325
360
|
ReactMarkdown,
|
|
326
361
|
{
|
|
362
|
+
remarkPlugins: [remarkGfm],
|
|
327
363
|
rehypePlugins: [rehypeSanitize],
|
|
328
364
|
components: {
|
|
329
365
|
script: () => null,
|
|
@@ -349,7 +385,11 @@ function ResponseMessage({ content, className }) {
|
|
|
349
385
|
h2: ({ children }) => /* @__PURE__ */ jsx("h2", { className: "text-sm font-bold mt-3 mb-1", children }),
|
|
350
386
|
h3: ({ children }) => /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold mt-2 mb-1", children }),
|
|
351
387
|
hr: () => /* @__PURE__ */ jsx("hr", { className: "my-3 border-border" }),
|
|
352
|
-
code: ({ children }) => /* @__PURE__ */ jsx("code", { className: "bg-surface-sunken rounded px-1 py-0.5 text-xs font-mono", children })
|
|
388
|
+
code: ({ children }) => /* @__PURE__ */ jsx("code", { className: "bg-surface-sunken rounded px-1 py-0.5 text-xs font-mono", children }),
|
|
389
|
+
table: ({ children }) => /* @__PURE__ */ jsx("div", { className: "overflow-x-auto my-2", children: /* @__PURE__ */ jsx("table", { className: "w-full text-sm border-collapse", children }) }),
|
|
390
|
+
thead: ({ children }) => /* @__PURE__ */ jsx("thead", { className: "border-b border-border", children }),
|
|
391
|
+
th: ({ children }) => /* @__PURE__ */ jsx("th", { className: "text-left px-2 py-1.5 font-semibold", children }),
|
|
392
|
+
td: ({ children }) => /* @__PURE__ */ jsx("td", { className: "px-2 py-1.5 border-t border-border/50", children })
|
|
353
393
|
},
|
|
354
394
|
children: normalizeMarkdownLists(content)
|
|
355
395
|
}
|
|
@@ -359,7 +399,9 @@ function ResponseMessage({ content, className }) {
|
|
|
359
399
|
}
|
|
360
400
|
|
|
361
401
|
// src/response/StructuredResponse/StructuredResponse.tsx
|
|
362
|
-
import
|
|
402
|
+
import ReactMarkdown2 from "react-markdown";
|
|
403
|
+
import rehypeSanitize2 from "rehype-sanitize";
|
|
404
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
363
405
|
function tryParse(value) {
|
|
364
406
|
if (value === void 0 || value === null) return null;
|
|
365
407
|
if (typeof value === "string") {
|
|
@@ -371,6 +413,25 @@ function tryParse(value) {
|
|
|
371
413
|
}
|
|
372
414
|
return value;
|
|
373
415
|
}
|
|
416
|
+
function InlineMarkdown({ text }) {
|
|
417
|
+
return /* @__PURE__ */ jsx2(
|
|
418
|
+
ReactMarkdown2,
|
|
419
|
+
{
|
|
420
|
+
rehypePlugins: [rehypeSanitize2],
|
|
421
|
+
components: {
|
|
422
|
+
// Unwrap block-level <p> so content stays inline within its parent
|
|
423
|
+
p: ({ children }) => /* @__PURE__ */ jsx2(Fragment, { children }),
|
|
424
|
+
strong: ({ children }) => /* @__PURE__ */ jsx2("strong", { className: "font-semibold", children }),
|
|
425
|
+
em: ({ children }) => /* @__PURE__ */ jsx2("em", { className: "italic", children }),
|
|
426
|
+
code: ({ children }) => /* @__PURE__ */ jsx2("code", { className: "bg-surface-sunken rounded px-1 py-0.5 text-xs font-mono", children }),
|
|
427
|
+
// Prevent block elements that would break layout
|
|
428
|
+
script: () => null,
|
|
429
|
+
iframe: () => null
|
|
430
|
+
},
|
|
431
|
+
children: text
|
|
432
|
+
}
|
|
433
|
+
);
|
|
434
|
+
}
|
|
374
435
|
function renderSteps(data) {
|
|
375
436
|
const steps = tryParse(data.steps);
|
|
376
437
|
if (!steps || !Array.isArray(steps)) return null;
|
|
@@ -383,7 +444,7 @@ function renderSteps(data) {
|
|
|
383
444
|
children: i + 1
|
|
384
445
|
}
|
|
385
446
|
),
|
|
386
|
-
/* @__PURE__ */ jsx2("span", { className: "text-sm text-text-primary leading-relaxed", children: step })
|
|
447
|
+
/* @__PURE__ */ jsx2("span", { className: "text-sm text-text-primary leading-relaxed", children: /* @__PURE__ */ jsx2(InlineMarkdown, { text: step }) })
|
|
387
448
|
] }, i)) });
|
|
388
449
|
}
|
|
389
450
|
function renderTable(data) {
|
|
@@ -449,7 +510,7 @@ function renderList(data) {
|
|
|
449
510
|
title && /* @__PURE__ */ jsx2("p", { className: "text-xs font-semibold uppercase tracking-wider text-text-secondary mb-1", children: title }),
|
|
450
511
|
/* @__PURE__ */ jsx2("ul", { className: "flex flex-col gap-1.5", children: items.map((item, i) => /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-2.5", children: [
|
|
451
512
|
/* @__PURE__ */ jsx2("span", { className: "mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full bg-accent", "aria-hidden": "true" }),
|
|
452
|
-
/* @__PURE__ */ jsx2("span", { className: "text-sm text-text-primary leading-relaxed", children: item })
|
|
513
|
+
/* @__PURE__ */ jsx2("span", { className: "text-sm text-text-primary leading-relaxed", children: /* @__PURE__ */ jsx2(InlineMarkdown, { text: item }) })
|
|
453
514
|
] }, i)) })
|
|
454
515
|
] });
|
|
455
516
|
}
|
|
@@ -888,24 +949,46 @@ function MessageBubble({
|
|
|
888
949
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
889
950
|
function MessageThread({ messages, streamingSlot, showAgent, showSources, showConfidence, showVerification, hideLastAssistant, userBubbleClassName, className }) {
|
|
890
951
|
const scrollRef = useRef2(null);
|
|
891
|
-
const
|
|
892
|
-
const isProgrammaticScroll = useRef2(false);
|
|
952
|
+
const shouldAutoScroll = useRef2(true);
|
|
893
953
|
const hasStreaming = !!streamingSlot;
|
|
894
954
|
const scrollToBottom = useCallback2(() => {
|
|
895
955
|
const el = scrollRef.current;
|
|
896
|
-
if (el &&
|
|
897
|
-
isProgrammaticScroll.current = true;
|
|
956
|
+
if (el && shouldAutoScroll.current) {
|
|
898
957
|
el.scrollTop = el.scrollHeight;
|
|
899
958
|
}
|
|
900
959
|
}, []);
|
|
960
|
+
useEffect(() => {
|
|
961
|
+
const el = scrollRef.current;
|
|
962
|
+
if (!el) return;
|
|
963
|
+
const onWheel = (e) => {
|
|
964
|
+
if (e.deltaY < 0) {
|
|
965
|
+
shouldAutoScroll.current = false;
|
|
966
|
+
}
|
|
967
|
+
};
|
|
968
|
+
const onPointerDown = () => {
|
|
969
|
+
el.dataset.userPointer = "1";
|
|
970
|
+
};
|
|
971
|
+
const onPointerUp = () => {
|
|
972
|
+
delete el.dataset.userPointer;
|
|
973
|
+
};
|
|
974
|
+
el.addEventListener("wheel", onWheel, { passive: true });
|
|
975
|
+
el.addEventListener("pointerdown", onPointerDown);
|
|
976
|
+
window.addEventListener("pointerup", onPointerUp);
|
|
977
|
+
return () => {
|
|
978
|
+
el.removeEventListener("wheel", onWheel);
|
|
979
|
+
el.removeEventListener("pointerdown", onPointerDown);
|
|
980
|
+
window.removeEventListener("pointerup", onPointerUp);
|
|
981
|
+
};
|
|
982
|
+
}, []);
|
|
901
983
|
const handleScroll = useCallback2(() => {
|
|
902
|
-
if (isProgrammaticScroll.current) {
|
|
903
|
-
isProgrammaticScroll.current = false;
|
|
904
|
-
return;
|
|
905
|
-
}
|
|
906
984
|
const el = scrollRef.current;
|
|
907
985
|
if (!el) return;
|
|
908
|
-
|
|
986
|
+
const nearBottom = el.scrollHeight - el.scrollTop - el.clientHeight < 80;
|
|
987
|
+
if (nearBottom) {
|
|
988
|
+
shouldAutoScroll.current = true;
|
|
989
|
+
} else if (el.dataset.userPointer) {
|
|
990
|
+
shouldAutoScroll.current = false;
|
|
991
|
+
}
|
|
909
992
|
}, []);
|
|
910
993
|
useEffect(scrollToBottom, [messages.length, scrollToBottom]);
|
|
911
994
|
useEffect(() => {
|
|
@@ -918,6 +1001,11 @@ function MessageThread({ messages, streamingSlot, showAgent, showSources, showCo
|
|
|
918
1001
|
raf = requestAnimationFrame(tick);
|
|
919
1002
|
return () => cancelAnimationFrame(raf);
|
|
920
1003
|
}, [hasStreaming, scrollToBottom]);
|
|
1004
|
+
useEffect(() => {
|
|
1005
|
+
if (!hasStreaming) {
|
|
1006
|
+
shouldAutoScroll.current = true;
|
|
1007
|
+
}
|
|
1008
|
+
}, [hasStreaming]);
|
|
921
1009
|
return /* @__PURE__ */ jsxs6(
|
|
922
1010
|
"div",
|
|
923
1011
|
{
|
|
@@ -1049,6 +1137,7 @@ function AttachmentPreview({
|
|
|
1049
1137
|
}
|
|
1050
1138
|
function MessageComposer({
|
|
1051
1139
|
onSend,
|
|
1140
|
+
onStop,
|
|
1052
1141
|
isLoading = false,
|
|
1053
1142
|
placeholder = "Type a message...",
|
|
1054
1143
|
className
|
|
@@ -1258,16 +1347,16 @@ function MessageComposer({
|
|
|
1258
1347
|
"button",
|
|
1259
1348
|
{
|
|
1260
1349
|
type: "button",
|
|
1261
|
-
onClick: handleSend,
|
|
1262
|
-
disabled: !canSend,
|
|
1263
|
-
"aria-label": "Send message",
|
|
1350
|
+
onClick: isLoading && onStop ? onStop : handleSend,
|
|
1351
|
+
disabled: !canSend && !isLoading,
|
|
1352
|
+
"aria-label": isLoading ? "Stop generating" : "Send message",
|
|
1264
1353
|
className: twMerge6(
|
|
1265
1354
|
"absolute bottom-3 right-3",
|
|
1266
1355
|
"inline-flex items-center justify-center",
|
|
1267
1356
|
"w-9 h-9 rounded-full",
|
|
1268
1357
|
"transition-all duration-200",
|
|
1269
1358
|
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent",
|
|
1270
|
-
canSend ? "bg-accent text-white hover:bg-accent-hover active:scale-90 shadow-md shadow-accent/25" : isLoading ? "bg-text-muted/20 text-text-secondary hover:bg-text-muted/30" : "bg-transparent text-text-muted/40 cursor-default"
|
|
1359
|
+
canSend ? "bg-accent text-white hover:bg-accent-hover active:scale-90 shadow-md shadow-accent/25" : isLoading ? "bg-text-muted/20 text-text-secondary hover:bg-text-muted/30 cursor-pointer" : "bg-transparent text-text-muted/40 cursor-default"
|
|
1271
1360
|
),
|
|
1272
1361
|
children: isLoading ? /* @__PURE__ */ jsx9(StopIcon, {}) : /* @__PURE__ */ jsx9(ArrowUpIcon, {})
|
|
1273
1362
|
}
|
|
@@ -1423,9 +1512,10 @@ var phaseLabels = {
|
|
|
1423
1512
|
verifying: "Verifying..."
|
|
1424
1513
|
};
|
|
1425
1514
|
var CURSOR_STYLES = `
|
|
1426
|
-
.sk-streaming-cursor > :not(ul,ol,blockquote):last-child::after,
|
|
1515
|
+
.sk-streaming-cursor > :not(ul,ol,blockquote,div:has(table)):last-child::after,
|
|
1427
1516
|
.sk-streaming-cursor > :is(ul,ol):last-child > li:last-child::after,
|
|
1428
|
-
.sk-streaming-cursor > blockquote:last-child > p:last-child::after
|
|
1517
|
+
.sk-streaming-cursor > blockquote:last-child > p:last-child::after,
|
|
1518
|
+
.sk-streaming-cursor > div:has(table):last-child table tbody tr:last-child td:last-child::after {
|
|
1429
1519
|
content: "";
|
|
1430
1520
|
display: inline-block;
|
|
1431
1521
|
width: 2px;
|
|
@@ -1559,7 +1649,7 @@ function AgentChat({
|
|
|
1559
1649
|
onQuestionSelect: handleQuestionSelect
|
|
1560
1650
|
}
|
|
1561
1651
|
),
|
|
1562
|
-
/* @__PURE__ */ jsx12(MessageComposer, { onSend: handleSend, isLoading: state.isLoading })
|
|
1652
|
+
/* @__PURE__ */ jsx12(MessageComposer, { onSend: handleSend, onStop: actions.stop, isLoading: state.isLoading })
|
|
1563
1653
|
]
|
|
1564
1654
|
}
|
|
1565
1655
|
);
|
|
@@ -1580,14 +1670,14 @@ function ConversationList({
|
|
|
1580
1670
|
"nav",
|
|
1581
1671
|
{
|
|
1582
1672
|
"aria-label": "Conversation list",
|
|
1583
|
-
className: twMerge10("flex flex-col
|
|
1673
|
+
className: twMerge10("flex flex-col flex-1 min-h-0", className),
|
|
1584
1674
|
children: [
|
|
1585
|
-
onNew && /* @__PURE__ */ jsx13("div", { className: "
|
|
1675
|
+
onNew && /* @__PURE__ */ jsx13("div", { className: "px-5 pt-1 pb-3 border-b border-border", children: /* @__PURE__ */ jsx13(
|
|
1586
1676
|
"button",
|
|
1587
1677
|
{
|
|
1588
1678
|
type: "button",
|
|
1589
1679
|
onClick: onNew,
|
|
1590
|
-
className: "w-full px-4 py-2
|
|
1680
|
+
className: "w-full px-4 py-2 rounded-lg text-sm font-medium border border-border text-text-secondary hover:text-text-primary hover:bg-surface hover:border-border-strong transition-colors duration-150",
|
|
1591
1681
|
children: "New conversation"
|
|
1592
1682
|
}
|
|
1593
1683
|
) }),
|
|
@@ -1598,9 +1688,9 @@ function ConversationList({
|
|
|
1598
1688
|
"li",
|
|
1599
1689
|
{
|
|
1600
1690
|
className: twMerge10(
|
|
1601
|
-
"flex items-start
|
|
1602
|
-
"hover:bg-surface",
|
|
1603
|
-
isActive
|
|
1691
|
+
"flex items-start transition-colors duration-150",
|
|
1692
|
+
"hover:bg-surface-raised",
|
|
1693
|
+
isActive ? "bg-accent-subtlest border-l-[3px] border-l-accent" : "border-l-[3px] border-l-transparent"
|
|
1604
1694
|
),
|
|
1605
1695
|
children: [
|
|
1606
1696
|
/* @__PURE__ */ jsxs11(
|
|
@@ -1609,10 +1699,10 @@ function ConversationList({
|
|
|
1609
1699
|
type: "button",
|
|
1610
1700
|
onClick: () => onSelect(conversation.id),
|
|
1611
1701
|
"aria-current": isActive ? "true" : void 0,
|
|
1612
|
-
className: "flex-1 min-w-0 text-left px-
|
|
1702
|
+
className: "flex-1 min-w-0 text-left px-5 py-2.5",
|
|
1613
1703
|
children: [
|
|
1614
|
-
/* @__PURE__ */ jsx13("div", { className: "text-sm font-medium text-
|
|
1615
|
-
/* @__PURE__ */ jsx13("div", { className: "text-xs text-
|
|
1704
|
+
/* @__PURE__ */ jsx13("div", { className: "text-sm font-medium text-text-primary truncate", children: conversation.title }),
|
|
1705
|
+
/* @__PURE__ */ jsx13("div", { className: "text-xs text-text-muted truncate mt-0.5 leading-relaxed", children: conversation.lastMessage })
|
|
1616
1706
|
]
|
|
1617
1707
|
}
|
|
1618
1708
|
),
|
|
@@ -1622,7 +1712,7 @@ function ConversationList({
|
|
|
1622
1712
|
type: "button",
|
|
1623
1713
|
onClick: () => onDelete(conversation.id),
|
|
1624
1714
|
"aria-label": `Delete ${conversation.title}`,
|
|
1625
|
-
className: "shrink-0 p-1.5 m-2 rounded-lg text-
|
|
1715
|
+
className: "shrink-0 p-1.5 m-2 rounded-lg text-text-muted hover:text-status-error hover:bg-status-error/10 transition-colors duration-150",
|
|
1626
1716
|
children: /* @__PURE__ */ jsxs11(
|
|
1627
1717
|
"svg",
|
|
1628
1718
|
{
|
|
@@ -1649,7 +1739,7 @@ function ConversationList({
|
|
|
1649
1739
|
conversation.id
|
|
1650
1740
|
);
|
|
1651
1741
|
}),
|
|
1652
|
-
conversations.length === 0 && /* @__PURE__ */ jsx13("li", { className: "px-
|
|
1742
|
+
conversations.length === 0 && /* @__PURE__ */ jsx13("li", { className: "px-5 py-12 text-center", children: /* @__PURE__ */ jsx13("span", { className: "text-sm text-text-muted font-body", children: "No conversations yet" }) })
|
|
1653
1743
|
] })
|
|
1654
1744
|
]
|
|
1655
1745
|
}
|
|
@@ -1657,7 +1747,7 @@ function ConversationList({
|
|
|
1657
1747
|
}
|
|
1658
1748
|
|
|
1659
1749
|
// src/layouts/AgentFullPage/AgentFullPage.tsx
|
|
1660
|
-
import { Fragment, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1750
|
+
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1661
1751
|
function AgentFullPage({
|
|
1662
1752
|
endpoint,
|
|
1663
1753
|
title = "Chat",
|
|
@@ -1683,7 +1773,7 @@ function AgentFullPage({
|
|
|
1683
1773
|
className: twMerge11("flex h-screen w-full overflow-hidden bg-brand-dark", className),
|
|
1684
1774
|
"data-testid": "agent-full-page",
|
|
1685
1775
|
children: [
|
|
1686
|
-
showConversationList && /* @__PURE__ */ jsxs12(
|
|
1776
|
+
showConversationList && /* @__PURE__ */ jsxs12(Fragment2, { children: [
|
|
1687
1777
|
sidebarOpen && /* @__PURE__ */ jsx14(
|
|
1688
1778
|
"div",
|
|
1689
1779
|
{
|