@lukeashford/aurelius 3.5.0 → 3.7.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/index.d.mts +70 -4
- package/dist/index.d.ts +70 -4
- package/dist/index.js +513 -214
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +512 -214
- package/dist/index.mjs.map +1 -1
- package/llms.md +22 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -74,6 +74,7 @@ __export(index_exports, {
|
|
|
74
74
|
FileChip: () => FileChip,
|
|
75
75
|
HelperText: () => HelperText,
|
|
76
76
|
HistoryIcon: () => HistoryIcon,
|
|
77
|
+
HistoryPanel: () => HistoryPanel,
|
|
77
78
|
ImageCard: () => ImageCard,
|
|
78
79
|
Input: () => Input,
|
|
79
80
|
InputGroup: () => InputGroup,
|
|
@@ -4310,7 +4311,7 @@ var StreamingCursor = import_react56.default.forwardRef(
|
|
|
4310
4311
|
StreamingCursor.displayName = "StreamingCursor";
|
|
4311
4312
|
|
|
4312
4313
|
// src/components/chat/ChatInterface.tsx
|
|
4313
|
-
var
|
|
4314
|
+
var import_react78 = __toESM(require("react"));
|
|
4314
4315
|
|
|
4315
4316
|
// src/components/chat/ChatView.tsx
|
|
4316
4317
|
var import_react60 = __toESM(require("react"));
|
|
@@ -4798,10 +4799,12 @@ var ChatInput = import_react61.default.forwardRef(
|
|
|
4798
4799
|
acceptedFileTypes,
|
|
4799
4800
|
notice,
|
|
4800
4801
|
onInputChange,
|
|
4802
|
+
initialInputValue = "",
|
|
4803
|
+
autoFocus = false,
|
|
4801
4804
|
className,
|
|
4802
4805
|
...rest
|
|
4803
4806
|
}, ref) => {
|
|
4804
|
-
const [value, setValue] = (0, import_react61.useState)(
|
|
4807
|
+
const [value, setValue] = (0, import_react61.useState)(initialInputValue);
|
|
4805
4808
|
const [localAttachments, setLocalAttachments] = (0, import_react61.useState)([]);
|
|
4806
4809
|
const [isDragOver, setIsDragOver] = (0, import_react61.useState)(false);
|
|
4807
4810
|
const textareaRef = (0, import_react61.useRef)(null);
|
|
@@ -4850,10 +4853,10 @@ var ChatInput = import_react61.default.forwardRef(
|
|
|
4850
4853
|
textarea.style.height = `${Math.min(textarea.scrollHeight, 200)}px`;
|
|
4851
4854
|
}, [onInputChange]);
|
|
4852
4855
|
(0, import_react61.useEffect)(() => {
|
|
4853
|
-
if (!disabled && !isStreaming && textareaRef.current) {
|
|
4856
|
+
if (autoFocus && !disabled && !isStreaming && textareaRef.current) {
|
|
4854
4857
|
textareaRef.current.focus();
|
|
4855
4858
|
}
|
|
4856
|
-
}, [disabled, isStreaming]);
|
|
4859
|
+
}, [disabled, isStreaming, autoFocus]);
|
|
4857
4860
|
const addFiles = (0, import_react61.useCallback)(
|
|
4858
4861
|
(files) => {
|
|
4859
4862
|
const newAttachments = Array.from(files).map((file) => ({
|
|
@@ -6079,8 +6082,346 @@ var ArtifactsPanelToggle = import_react72.default.forwardRef(({ artifactCount =
|
|
|
6079
6082
|
});
|
|
6080
6083
|
ArtifactsPanelToggle.displayName = "ArtifactsPanelToggle";
|
|
6081
6084
|
|
|
6082
|
-
// src/components/chat/
|
|
6085
|
+
// src/components/chat/HistoryPanel.tsx
|
|
6083
6086
|
var import_react73 = __toESM(require("react"));
|
|
6087
|
+
function parseTimestamp(ts) {
|
|
6088
|
+
if (ts == null) {
|
|
6089
|
+
return null;
|
|
6090
|
+
}
|
|
6091
|
+
const d = ts instanceof Date ? ts : new Date(ts);
|
|
6092
|
+
return Number.isNaN(d.getTime()) ? null : d;
|
|
6093
|
+
}
|
|
6094
|
+
function startOfDay(d) {
|
|
6095
|
+
const x = new Date(d);
|
|
6096
|
+
x.setHours(0, 0, 0, 0);
|
|
6097
|
+
return x;
|
|
6098
|
+
}
|
|
6099
|
+
function groupConversations(conversations) {
|
|
6100
|
+
const today = startOfDay(/* @__PURE__ */ new Date());
|
|
6101
|
+
const yesterday = new Date(today);
|
|
6102
|
+
yesterday.setDate(yesterday.getDate() - 1);
|
|
6103
|
+
const todayList = [];
|
|
6104
|
+
const yesterdayList = [];
|
|
6105
|
+
const olderList = [];
|
|
6106
|
+
for (const c of conversations) {
|
|
6107
|
+
const d = parseTimestamp(c.timestamp);
|
|
6108
|
+
if (d && d >= today) {
|
|
6109
|
+
todayList.push(c);
|
|
6110
|
+
} else if (d && d >= yesterday) {
|
|
6111
|
+
yesterdayList.push(c);
|
|
6112
|
+
} else {
|
|
6113
|
+
olderList.push(c);
|
|
6114
|
+
}
|
|
6115
|
+
}
|
|
6116
|
+
return [
|
|
6117
|
+
{ key: "today", label: "Today", conversations: todayList },
|
|
6118
|
+
{ key: "yesterday", label: "Yesterday", conversations: yesterdayList },
|
|
6119
|
+
{ key: "older", label: "Older", conversations: olderList }
|
|
6120
|
+
].filter((g) => g.conversations.length > 0);
|
|
6121
|
+
}
|
|
6122
|
+
function ChevronDownIcon({ className }) {
|
|
6123
|
+
return /* @__PURE__ */ import_react73.default.createElement(
|
|
6124
|
+
"svg",
|
|
6125
|
+
{
|
|
6126
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6127
|
+
viewBox: "0 0 20 20",
|
|
6128
|
+
fill: "currentColor",
|
|
6129
|
+
className,
|
|
6130
|
+
"aria-hidden": "true"
|
|
6131
|
+
},
|
|
6132
|
+
/* @__PURE__ */ import_react73.default.createElement(
|
|
6133
|
+
"path",
|
|
6134
|
+
{
|
|
6135
|
+
fillRule: "evenodd",
|
|
6136
|
+
d: "M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.83a.75.75 0 111.08 1.04l-4.25 4.39a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z",
|
|
6137
|
+
clipRule: "evenodd"
|
|
6138
|
+
}
|
|
6139
|
+
)
|
|
6140
|
+
);
|
|
6141
|
+
}
|
|
6142
|
+
function PencilIcon2({ className }) {
|
|
6143
|
+
return /* @__PURE__ */ import_react73.default.createElement(
|
|
6144
|
+
"svg",
|
|
6145
|
+
{
|
|
6146
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6147
|
+
viewBox: "0 0 20 20",
|
|
6148
|
+
fill: "currentColor",
|
|
6149
|
+
className,
|
|
6150
|
+
"aria-hidden": "true"
|
|
6151
|
+
},
|
|
6152
|
+
/* @__PURE__ */ import_react73.default.createElement(
|
|
6153
|
+
"path",
|
|
6154
|
+
{
|
|
6155
|
+
d: "M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"
|
|
6156
|
+
}
|
|
6157
|
+
)
|
|
6158
|
+
);
|
|
6159
|
+
}
|
|
6160
|
+
function ProjectFilter({
|
|
6161
|
+
projects,
|
|
6162
|
+
value,
|
|
6163
|
+
onChange,
|
|
6164
|
+
className
|
|
6165
|
+
}) {
|
|
6166
|
+
const [open, setOpen] = (0, import_react73.useState)(false);
|
|
6167
|
+
const ref = (0, import_react73.useRef)(null);
|
|
6168
|
+
(0, import_react73.useEffect)(() => {
|
|
6169
|
+
if (!open) {
|
|
6170
|
+
return;
|
|
6171
|
+
}
|
|
6172
|
+
const handler = (e) => {
|
|
6173
|
+
if (ref.current && !ref.current.contains(e.target)) {
|
|
6174
|
+
setOpen(false);
|
|
6175
|
+
}
|
|
6176
|
+
};
|
|
6177
|
+
document.addEventListener("mousedown", handler);
|
|
6178
|
+
return () => document.removeEventListener("mousedown", handler);
|
|
6179
|
+
}, [open]);
|
|
6180
|
+
const label = value ?? "All projects";
|
|
6181
|
+
return /* @__PURE__ */ import_react73.default.createElement("div", { className: cx("relative min-w-0", className), ref }, /* @__PURE__ */ import_react73.default.createElement(
|
|
6182
|
+
"button",
|
|
6183
|
+
{
|
|
6184
|
+
type: "button",
|
|
6185
|
+
onClick: () => setOpen((o) => !o),
|
|
6186
|
+
"aria-haspopup": "listbox",
|
|
6187
|
+
"aria-expanded": open,
|
|
6188
|
+
className: cx(
|
|
6189
|
+
"w-full flex items-center justify-between gap-1 px-2 py-1.5",
|
|
6190
|
+
"bg-obsidian/60 hover:bg-ash/30",
|
|
6191
|
+
"text-silver hover:text-white",
|
|
6192
|
+
"border border-ash/40",
|
|
6193
|
+
"text-xs",
|
|
6194
|
+
"transition-colors duration-150 min-w-0"
|
|
6195
|
+
)
|
|
6196
|
+
},
|
|
6197
|
+
/* @__PURE__ */ import_react73.default.createElement("span", { className: "truncate" }, label),
|
|
6198
|
+
/* @__PURE__ */ import_react73.default.createElement(ChevronDownIcon, { className: "w-3 h-3 shrink-0" })
|
|
6199
|
+
), open && /* @__PURE__ */ import_react73.default.createElement(
|
|
6200
|
+
"div",
|
|
6201
|
+
{
|
|
6202
|
+
role: "listbox",
|
|
6203
|
+
className: cx(
|
|
6204
|
+
"absolute top-full left-0 right-0 mt-1 z-20",
|
|
6205
|
+
"bg-charcoal border border-ash/40",
|
|
6206
|
+
"max-h-60 overflow-y-auto"
|
|
6207
|
+
)
|
|
6208
|
+
},
|
|
6209
|
+
/* @__PURE__ */ import_react73.default.createElement(
|
|
6210
|
+
"button",
|
|
6211
|
+
{
|
|
6212
|
+
type: "button",
|
|
6213
|
+
role: "option",
|
|
6214
|
+
"aria-selected": value === null,
|
|
6215
|
+
onClick: () => {
|
|
6216
|
+
onChange(null);
|
|
6217
|
+
setOpen(false);
|
|
6218
|
+
},
|
|
6219
|
+
className: cx(
|
|
6220
|
+
"w-full px-2 py-1.5 text-left text-xs truncate",
|
|
6221
|
+
"transition-colors duration-150",
|
|
6222
|
+
value === null ? "bg-gold/10 text-gold" : "text-silver hover:bg-ash/20 hover:text-white"
|
|
6223
|
+
)
|
|
6224
|
+
},
|
|
6225
|
+
"All projects"
|
|
6226
|
+
),
|
|
6227
|
+
projects.map((p) => /* @__PURE__ */ import_react73.default.createElement(
|
|
6228
|
+
"button",
|
|
6229
|
+
{
|
|
6230
|
+
key: p,
|
|
6231
|
+
type: "button",
|
|
6232
|
+
role: "option",
|
|
6233
|
+
"aria-selected": value === p,
|
|
6234
|
+
onClick: () => {
|
|
6235
|
+
onChange(p);
|
|
6236
|
+
setOpen(false);
|
|
6237
|
+
},
|
|
6238
|
+
className: cx(
|
|
6239
|
+
"w-full px-2 py-1.5 text-left text-xs truncate",
|
|
6240
|
+
"transition-colors duration-150",
|
|
6241
|
+
value === p ? "bg-gold/10 text-gold" : "text-silver hover:bg-ash/20 hover:text-white"
|
|
6242
|
+
)
|
|
6243
|
+
},
|
|
6244
|
+
p
|
|
6245
|
+
))
|
|
6246
|
+
));
|
|
6247
|
+
}
|
|
6248
|
+
function ConversationRow({
|
|
6249
|
+
conversation,
|
|
6250
|
+
onSelect,
|
|
6251
|
+
onRename
|
|
6252
|
+
}) {
|
|
6253
|
+
const [isEditing, setIsEditing] = (0, import_react73.useState)(false);
|
|
6254
|
+
const [draft, setDraft] = (0, import_react73.useState)(conversation.title);
|
|
6255
|
+
const inputRef = (0, import_react73.useRef)(null);
|
|
6256
|
+
(0, import_react73.useEffect)(() => {
|
|
6257
|
+
if (isEditing && inputRef.current) {
|
|
6258
|
+
inputRef.current.focus();
|
|
6259
|
+
inputRef.current.select();
|
|
6260
|
+
}
|
|
6261
|
+
}, [isEditing]);
|
|
6262
|
+
const startEdit = (0, import_react73.useCallback)((e) => {
|
|
6263
|
+
e.stopPropagation();
|
|
6264
|
+
setDraft(conversation.title);
|
|
6265
|
+
setIsEditing(true);
|
|
6266
|
+
}, [conversation.title]);
|
|
6267
|
+
const commit = (0, import_react73.useCallback)(() => {
|
|
6268
|
+
const trimmed = draft.trim();
|
|
6269
|
+
if (trimmed && trimmed !== conversation.title) {
|
|
6270
|
+
onRename?.(conversation.id, trimmed);
|
|
6271
|
+
}
|
|
6272
|
+
setIsEditing(false);
|
|
6273
|
+
}, [draft, conversation.id, conversation.title, onRename]);
|
|
6274
|
+
const cancel = (0, import_react73.useCallback)(() => {
|
|
6275
|
+
setDraft(conversation.title);
|
|
6276
|
+
setIsEditing(false);
|
|
6277
|
+
}, [conversation.title]);
|
|
6278
|
+
if (isEditing) {
|
|
6279
|
+
return /* @__PURE__ */ import_react73.default.createElement(
|
|
6280
|
+
"div",
|
|
6281
|
+
{
|
|
6282
|
+
className: cx(
|
|
6283
|
+
"w-full px-3 py-2",
|
|
6284
|
+
conversation.isActive ? "bg-ash/40" : "bg-ash/20"
|
|
6285
|
+
)
|
|
6286
|
+
},
|
|
6287
|
+
/* @__PURE__ */ import_react73.default.createElement(
|
|
6288
|
+
"input",
|
|
6289
|
+
{
|
|
6290
|
+
ref: inputRef,
|
|
6291
|
+
type: "text",
|
|
6292
|
+
value: draft,
|
|
6293
|
+
onChange: (e) => setDraft(e.target.value),
|
|
6294
|
+
onBlur: commit,
|
|
6295
|
+
onKeyDown: (e) => {
|
|
6296
|
+
if (e.key === "Enter") {
|
|
6297
|
+
e.preventDefault();
|
|
6298
|
+
commit();
|
|
6299
|
+
} else if (e.key === "Escape") {
|
|
6300
|
+
e.preventDefault();
|
|
6301
|
+
cancel();
|
|
6302
|
+
}
|
|
6303
|
+
},
|
|
6304
|
+
className: cx(
|
|
6305
|
+
"w-full px-2 py-1 text-sm font-medium text-white",
|
|
6306
|
+
"bg-obsidian border border-gold/40",
|
|
6307
|
+
"outline-none focus:border-gold"
|
|
6308
|
+
),
|
|
6309
|
+
"aria-label": "Conversation title"
|
|
6310
|
+
}
|
|
6311
|
+
),
|
|
6312
|
+
conversation.project && /* @__PURE__ */ import_react73.default.createElement("p", { className: "text-xs text-silver/60 truncate mt-1" }, conversation.project)
|
|
6313
|
+
);
|
|
6314
|
+
}
|
|
6315
|
+
return /* @__PURE__ */ import_react73.default.createElement("div", { className: "relative group" }, /* @__PURE__ */ import_react73.default.createElement(
|
|
6316
|
+
"button",
|
|
6317
|
+
{
|
|
6318
|
+
onClick: () => onSelect?.(conversation.id),
|
|
6319
|
+
className: cx(
|
|
6320
|
+
"w-full px-3 py-2 text-left",
|
|
6321
|
+
"transition-colors duration-150",
|
|
6322
|
+
conversation.isActive ? "bg-ash/40 text-white" : "text-silver hover:bg-ash/20 hover:text-white"
|
|
6323
|
+
)
|
|
6324
|
+
},
|
|
6325
|
+
/* @__PURE__ */ import_react73.default.createElement(
|
|
6326
|
+
"p",
|
|
6327
|
+
{
|
|
6328
|
+
className: cx(
|
|
6329
|
+
"text-sm font-medium truncate",
|
|
6330
|
+
onRename ? "pr-6" : ""
|
|
6331
|
+
)
|
|
6332
|
+
},
|
|
6333
|
+
conversation.title
|
|
6334
|
+
),
|
|
6335
|
+
conversation.project && /* @__PURE__ */ import_react73.default.createElement("p", { className: "text-xs text-silver/60 truncate mt-0.5" }, conversation.project)
|
|
6336
|
+
), onRename && /* @__PURE__ */ import_react73.default.createElement(
|
|
6337
|
+
"button",
|
|
6338
|
+
{
|
|
6339
|
+
type: "button",
|
|
6340
|
+
onClick: startEdit,
|
|
6341
|
+
"aria-label": "Rename conversation",
|
|
6342
|
+
className: cx(
|
|
6343
|
+
"absolute right-2 top-2",
|
|
6344
|
+
"p-1 text-silver/60 hover:text-gold hover:bg-ash/40",
|
|
6345
|
+
"opacity-0 group-hover:opacity-100 focus:opacity-100",
|
|
6346
|
+
"transition-opacity duration-150"
|
|
6347
|
+
)
|
|
6348
|
+
},
|
|
6349
|
+
/* @__PURE__ */ import_react73.default.createElement(PencilIcon2, { className: "w-3.5 h-3.5" })
|
|
6350
|
+
));
|
|
6351
|
+
}
|
|
6352
|
+
function HistoryPanel({
|
|
6353
|
+
conversations,
|
|
6354
|
+
onSelectConversation,
|
|
6355
|
+
onNewChat,
|
|
6356
|
+
onRenameConversation
|
|
6357
|
+
}) {
|
|
6358
|
+
const [projectFilter, setProjectFilter] = (0, import_react73.useState)(null);
|
|
6359
|
+
const projects = (0, import_react73.useMemo)(() => {
|
|
6360
|
+
const set = /* @__PURE__ */ new Set();
|
|
6361
|
+
for (const c of conversations) {
|
|
6362
|
+
if (c.project) {
|
|
6363
|
+
set.add(c.project);
|
|
6364
|
+
}
|
|
6365
|
+
}
|
|
6366
|
+
return Array.from(set).sort((a, b) => a.localeCompare(b));
|
|
6367
|
+
}, [conversations]);
|
|
6368
|
+
(0, import_react73.useEffect)(() => {
|
|
6369
|
+
if (projectFilter && !projects.includes(projectFilter)) {
|
|
6370
|
+
setProjectFilter(null);
|
|
6371
|
+
}
|
|
6372
|
+
}, [projects, projectFilter]);
|
|
6373
|
+
const filteredConversations = (0, import_react73.useMemo)(() => {
|
|
6374
|
+
if (!projectFilter) {
|
|
6375
|
+
return conversations;
|
|
6376
|
+
}
|
|
6377
|
+
return conversations.filter((c) => c.project === projectFilter);
|
|
6378
|
+
}, [conversations, projectFilter]);
|
|
6379
|
+
const groups = (0, import_react73.useMemo)(
|
|
6380
|
+
() => groupConversations(filteredConversations),
|
|
6381
|
+
[filteredConversations]
|
|
6382
|
+
);
|
|
6383
|
+
const hasFilter = projects.length > 0;
|
|
6384
|
+
return /* @__PURE__ */ import_react73.default.createElement("div", { className: "h-full flex flex-col" }, /* @__PURE__ */ import_react73.default.createElement("div", { className: "px-4 py-3 border-b border-ash/40 shrink-0 flex items-center gap-2" }, /* @__PURE__ */ import_react73.default.createElement("h3", { className: "text-xs font-medium text-white shrink-0" }, "History"), (hasFilter || onNewChat) && /* @__PURE__ */ import_react73.default.createElement("div", { className: "flex items-center gap-2 flex-1 min-w-0" }, hasFilter && /* @__PURE__ */ import_react73.default.createElement(import_react73.default.Fragment, null, /* @__PURE__ */ import_react73.default.createElement("div", { className: "w-px h-3 bg-ash/40 shrink-0 mx-1" }), /* @__PURE__ */ import_react73.default.createElement(
|
|
6385
|
+
ProjectFilter,
|
|
6386
|
+
{
|
|
6387
|
+
projects,
|
|
6388
|
+
value: projectFilter,
|
|
6389
|
+
onChange: setProjectFilter,
|
|
6390
|
+
className: "flex-1"
|
|
6391
|
+
}
|
|
6392
|
+
)), onNewChat && /* @__PURE__ */ import_react73.default.createElement(import_react73.default.Fragment, null, /* @__PURE__ */ import_react73.default.createElement("div", { className: "w-px h-3 bg-ash/40 shrink-0 mx-1" }), /* @__PURE__ */ import_react73.default.createElement(
|
|
6393
|
+
"button",
|
|
6394
|
+
{
|
|
6395
|
+
onClick: onNewChat,
|
|
6396
|
+
className: cx(
|
|
6397
|
+
"flex items-center gap-1 px-2.5 py-1.5 shrink-0",
|
|
6398
|
+
"bg-gold/10 hover:bg-gold/20 text-gold",
|
|
6399
|
+
"border border-gold/30",
|
|
6400
|
+
"text-xs font-medium",
|
|
6401
|
+
"transition-colors duration-200"
|
|
6402
|
+
)
|
|
6403
|
+
},
|
|
6404
|
+
/* @__PURE__ */ import_react73.default.createElement(PlusIcon, { className: "w-4 h-4" }),
|
|
6405
|
+
/* @__PURE__ */ import_react73.default.createElement("span", { className: "truncate" }, "New Chat")
|
|
6406
|
+
)))), /* @__PURE__ */ import_react73.default.createElement("div", { className: "flex-1 overflow-y-auto py-2" }, conversations.length === 0 ? /* @__PURE__ */ import_react73.default.createElement("p", { className: "px-4 py-2 text-xs text-silver/60" }, "No conversations yet") : groups.length === 0 ? /* @__PURE__ */ import_react73.default.createElement("p", { className: "px-4 py-2 text-xs text-silver/60" }, "No conversations match this filter") : /* @__PURE__ */ import_react73.default.createElement("div", null, groups.map((group, index) => /* @__PURE__ */ import_react73.default.createElement("section", { key: group.key, className: cx(index > 0 && "mt-3") }, /* @__PURE__ */ import_react73.default.createElement("div", { className: "flex items-center gap-2 px-3 pb-2" }, /* @__PURE__ */ import_react73.default.createElement(
|
|
6407
|
+
"span",
|
|
6408
|
+
{
|
|
6409
|
+
className: "text-xs font-medium uppercase tracking-wider text-gold/70"
|
|
6410
|
+
},
|
|
6411
|
+
group.label
|
|
6412
|
+
), /* @__PURE__ */ import_react73.default.createElement("div", { className: "flex-1 h-px bg-gold/20" })), /* @__PURE__ */ import_react73.default.createElement("div", { className: "space-y-1 px-2" }, group.conversations.map((conversation) => /* @__PURE__ */ import_react73.default.createElement(
|
|
6413
|
+
ConversationRow,
|
|
6414
|
+
{
|
|
6415
|
+
key: conversation.id,
|
|
6416
|
+
conversation,
|
|
6417
|
+
onSelect: onSelectConversation,
|
|
6418
|
+
onRename: onRenameConversation
|
|
6419
|
+
}
|
|
6420
|
+
))))))));
|
|
6421
|
+
}
|
|
6422
|
+
|
|
6423
|
+
// src/components/chat/TodosList.tsx
|
|
6424
|
+
var import_react74 = __toESM(require("react"));
|
|
6084
6425
|
var import_lucide_react14 = require("lucide-react");
|
|
6085
6426
|
var TASK_STATUSES = {
|
|
6086
6427
|
PENDING: "pending",
|
|
@@ -6092,16 +6433,16 @@ var TASK_STATUSES = {
|
|
|
6092
6433
|
function TaskIcon({ status }) {
|
|
6093
6434
|
switch (status) {
|
|
6094
6435
|
case "done":
|
|
6095
|
-
return /* @__PURE__ */
|
|
6436
|
+
return /* @__PURE__ */ import_react74.default.createElement(CheckSquareIcon, null);
|
|
6096
6437
|
case "in_progress":
|
|
6097
|
-
return /* @__PURE__ */
|
|
6438
|
+
return /* @__PURE__ */ import_react74.default.createElement(SquareLoaderIcon, null);
|
|
6098
6439
|
case "cancelled":
|
|
6099
|
-
return /* @__PURE__ */
|
|
6440
|
+
return /* @__PURE__ */ import_react74.default.createElement(CrossSquareIcon, { variant: "cancelled" });
|
|
6100
6441
|
case "failed":
|
|
6101
|
-
return /* @__PURE__ */
|
|
6442
|
+
return /* @__PURE__ */ import_react74.default.createElement(CrossSquareIcon, { variant: "failed" });
|
|
6102
6443
|
case "pending":
|
|
6103
6444
|
default:
|
|
6104
|
-
return /* @__PURE__ */
|
|
6445
|
+
return /* @__PURE__ */ import_react74.default.createElement(EmptySquareIcon, null);
|
|
6105
6446
|
}
|
|
6106
6447
|
}
|
|
6107
6448
|
function sortTasks(tasks) {
|
|
@@ -6119,18 +6460,16 @@ function sortTasks(tasks) {
|
|
|
6119
6460
|
function TaskItem({ task, depth = 0 }) {
|
|
6120
6461
|
const isTerminal = task.status === "done" || task.status === "cancelled" || task.status === "failed";
|
|
6121
6462
|
const isSubtle = task.status === "cancelled" || task.status === "failed";
|
|
6122
|
-
const showSubtasks =
|
|
6463
|
+
const showSubtasks = task.subtasks && task.subtasks.length > 0;
|
|
6123
6464
|
const sortedSubtasks = showSubtasks ? sortTasks(task.subtasks) : [];
|
|
6124
|
-
return /* @__PURE__ */
|
|
6465
|
+
return /* @__PURE__ */ import_react74.default.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ import_react74.default.createElement(
|
|
6125
6466
|
"div",
|
|
6126
6467
|
{
|
|
6127
|
-
className:
|
|
6128
|
-
|
|
6129
|
-
depth > 0 && "pl-6"
|
|
6130
|
-
)
|
|
6468
|
+
className: "flex items-center gap-2 py-1",
|
|
6469
|
+
style: { paddingLeft: `${depth * 1.5}rem` }
|
|
6131
6470
|
},
|
|
6132
|
-
/* @__PURE__ */
|
|
6133
|
-
/* @__PURE__ */
|
|
6471
|
+
/* @__PURE__ */ import_react74.default.createElement(TaskIcon, { status: task.status }),
|
|
6472
|
+
/* @__PURE__ */ import_react74.default.createElement(
|
|
6134
6473
|
"span",
|
|
6135
6474
|
{
|
|
6136
6475
|
className: cx(
|
|
@@ -6142,24 +6481,30 @@ function TaskItem({ task, depth = 0 }) {
|
|
|
6142
6481
|
)
|
|
6143
6482
|
},
|
|
6144
6483
|
task.label,
|
|
6145
|
-
task.status === "cancelled" && /* @__PURE__ */
|
|
6146
|
-
task.status === "failed" && /* @__PURE__ */
|
|
6484
|
+
task.status === "cancelled" && /* @__PURE__ */ import_react74.default.createElement("span", { className: "text-silver/40 ml-1" }, "(cancelled)"),
|
|
6485
|
+
task.status === "failed" && /* @__PURE__ */ import_react74.default.createElement("span", { className: "text-error/60 ml-1" }, "(failed)")
|
|
6147
6486
|
)
|
|
6148
|
-
), showSubtasks && /* @__PURE__ */
|
|
6487
|
+
), showSubtasks && /* @__PURE__ */ import_react74.default.createElement("div", { className: "flex flex-col" }, sortedSubtasks.map((subtask) => /* @__PURE__ */ import_react74.default.createElement(TaskItem, { key: subtask.id, task: subtask, depth: depth + 1 }))));
|
|
6149
6488
|
}
|
|
6150
6489
|
function hasInProgressTask(tasks) {
|
|
6151
6490
|
return tasks.some((t) => {
|
|
6152
|
-
if (t.status === "in_progress")
|
|
6153
|
-
|
|
6491
|
+
if (t.status === "in_progress") {
|
|
6492
|
+
return true;
|
|
6493
|
+
}
|
|
6494
|
+
if (t.subtasks && t.subtasks.length > 0) {
|
|
6495
|
+
return hasInProgressTask(t.subtasks);
|
|
6496
|
+
}
|
|
6154
6497
|
return false;
|
|
6155
6498
|
});
|
|
6156
6499
|
}
|
|
6157
|
-
var TodosList =
|
|
6500
|
+
var TodosList = import_react74.default.forwardRef(
|
|
6158
6501
|
({ tasks, title = "Tasks", onStopAllTasks, className, ...rest }, ref) => {
|
|
6159
|
-
const sortedTasks = (0,
|
|
6160
|
-
const [isStopping, setIsStopping] = (0,
|
|
6161
|
-
const handleStopClick = (0,
|
|
6162
|
-
if (!onStopAllTasks || isStopping)
|
|
6502
|
+
const sortedTasks = (0, import_react74.useMemo)(() => sortTasks(tasks), [tasks]);
|
|
6503
|
+
const [isStopping, setIsStopping] = (0, import_react74.useState)(false);
|
|
6504
|
+
const handleStopClick = (0, import_react74.useCallback)(async () => {
|
|
6505
|
+
if (!onStopAllTasks || isStopping) {
|
|
6506
|
+
return;
|
|
6507
|
+
}
|
|
6163
6508
|
try {
|
|
6164
6509
|
setIsStopping(true);
|
|
6165
6510
|
await onStopAllTasks();
|
|
@@ -6168,31 +6513,16 @@ var TodosList = import_react73.default.forwardRef(
|
|
|
6168
6513
|
}
|
|
6169
6514
|
}, [onStopAllTasks, isStopping]);
|
|
6170
6515
|
const countCompleted = (taskList) => {
|
|
6171
|
-
|
|
6172
|
-
for (const task of taskList) {
|
|
6173
|
-
if (task.status === "done") {
|
|
6174
|
-
count++;
|
|
6175
|
-
}
|
|
6176
|
-
if (task.subtasks) {
|
|
6177
|
-
count += countCompleted(task.subtasks);
|
|
6178
|
-
}
|
|
6179
|
-
}
|
|
6180
|
-
return count;
|
|
6516
|
+
return taskList.filter((task) => task.status === "done").length;
|
|
6181
6517
|
};
|
|
6182
6518
|
const countTotal = (taskList) => {
|
|
6183
|
-
|
|
6184
|
-
for (const task of taskList) {
|
|
6185
|
-
if (task.subtasks) {
|
|
6186
|
-
count += countTotal(task.subtasks);
|
|
6187
|
-
}
|
|
6188
|
-
}
|
|
6189
|
-
return count;
|
|
6519
|
+
return taskList.length;
|
|
6190
6520
|
};
|
|
6191
6521
|
const showStopButton = !!onStopAllTasks && (hasInProgressTask(tasks) || isStopping);
|
|
6192
6522
|
if (tasks.length === 0) {
|
|
6193
6523
|
return null;
|
|
6194
6524
|
}
|
|
6195
|
-
return /* @__PURE__ */
|
|
6525
|
+
return /* @__PURE__ */ import_react74.default.createElement(
|
|
6196
6526
|
"div",
|
|
6197
6527
|
{
|
|
6198
6528
|
ref,
|
|
@@ -6203,16 +6533,16 @@ var TodosList = import_react73.default.forwardRef(
|
|
|
6203
6533
|
),
|
|
6204
6534
|
...rest
|
|
6205
6535
|
},
|
|
6206
|
-
/* @__PURE__ */
|
|
6536
|
+
/* @__PURE__ */ import_react74.default.createElement(
|
|
6207
6537
|
"div",
|
|
6208
6538
|
{
|
|
6209
6539
|
className: "flex items-center justify-between px-4 py-2 border-b border-ash/40 flex-shrink-0"
|
|
6210
6540
|
},
|
|
6211
|
-
/* @__PURE__ */
|
|
6212
|
-
/* @__PURE__ */
|
|
6541
|
+
/* @__PURE__ */ import_react74.default.createElement("h4", { className: "text-xs font-medium text-white" }, title),
|
|
6542
|
+
/* @__PURE__ */ import_react74.default.createElement("span", { className: "text-xs text-silver/60" }, countCompleted(tasks), "/", countTotal(tasks))
|
|
6213
6543
|
),
|
|
6214
|
-
/* @__PURE__ */
|
|
6215
|
-
showStopButton && /* @__PURE__ */
|
|
6544
|
+
/* @__PURE__ */ import_react74.default.createElement("div", { className: "flex-1 overflow-y-auto px-4 py-2" }, sortedTasks.map((task) => /* @__PURE__ */ import_react74.default.createElement(TaskItem, { key: task.id, task }))),
|
|
6545
|
+
showStopButton && /* @__PURE__ */ import_react74.default.createElement("div", { className: "px-4 py-2 border-t border-ash/40 flex-shrink-0" }, /* @__PURE__ */ import_react74.default.createElement(
|
|
6216
6546
|
"button",
|
|
6217
6547
|
{
|
|
6218
6548
|
type: "button",
|
|
@@ -6229,7 +6559,7 @@ var TodosList = import_react73.default.forwardRef(
|
|
|
6229
6559
|
isStopping ? "cursor-not-allowed opacity-70" : "hover:bg-error/20"
|
|
6230
6560
|
)
|
|
6231
6561
|
},
|
|
6232
|
-
isStopping ? /* @__PURE__ */
|
|
6562
|
+
isStopping ? /* @__PURE__ */ import_react74.default.createElement(import_react74.default.Fragment, null, /* @__PURE__ */ import_react74.default.createElement(import_lucide_react14.Loader2, { className: "w-3 h-3 animate-spin" }), "Stopping tasks") : /* @__PURE__ */ import_react74.default.createElement(import_react74.default.Fragment, null, /* @__PURE__ */ import_react74.default.createElement(import_lucide_react14.Square, { className: "w-3 h-3 fill-current" }), "Stop All Tasks")
|
|
6233
6563
|
))
|
|
6234
6564
|
);
|
|
6235
6565
|
}
|
|
@@ -6238,15 +6568,19 @@ TodosList.displayName = "TodosList";
|
|
|
6238
6568
|
function areAllTasksSettled(tasks) {
|
|
6239
6569
|
return tasks.every((t) => {
|
|
6240
6570
|
const settled = t.status === "done" || t.status === "cancelled" || t.status === "failed";
|
|
6241
|
-
if (!settled)
|
|
6242
|
-
|
|
6571
|
+
if (!settled) {
|
|
6572
|
+
return false;
|
|
6573
|
+
}
|
|
6574
|
+
if (t.subtasks && t.subtasks.length > 0) {
|
|
6575
|
+
return areAllTasksSettled(t.subtasks);
|
|
6576
|
+
}
|
|
6243
6577
|
return true;
|
|
6244
6578
|
});
|
|
6245
6579
|
}
|
|
6246
6580
|
|
|
6247
6581
|
// src/components/chat/ToolSidebar.tsx
|
|
6248
|
-
var
|
|
6249
|
-
var ToolSidebar =
|
|
6582
|
+
var import_react75 = __toESM(require("react"));
|
|
6583
|
+
var ToolSidebar = import_react75.default.forwardRef(
|
|
6250
6584
|
({ tools, activeTools, onToggleTool, side, className, ...rest }, ref) => {
|
|
6251
6585
|
const topTools = tools.filter((t) => t.group === `top-${side}`);
|
|
6252
6586
|
const bottomTools = tools.filter((t) => t.group === `bottom-${side}`);
|
|
@@ -6257,7 +6591,7 @@ var ToolSidebar = import_react74.default.forwardRef(
|
|
|
6257
6591
|
};
|
|
6258
6592
|
const renderButton = (tool) => {
|
|
6259
6593
|
const active = isActive(tool.id);
|
|
6260
|
-
return /* @__PURE__ */
|
|
6594
|
+
return /* @__PURE__ */ import_react75.default.createElement(
|
|
6261
6595
|
"button",
|
|
6262
6596
|
{
|
|
6263
6597
|
key: tool.id,
|
|
@@ -6269,10 +6603,10 @@ var ToolSidebar = import_react74.default.forwardRef(
|
|
|
6269
6603
|
"aria-label": tool.label,
|
|
6270
6604
|
"aria-pressed": active
|
|
6271
6605
|
},
|
|
6272
|
-
/* @__PURE__ */
|
|
6606
|
+
/* @__PURE__ */ import_react75.default.createElement("span", { className: "w-4 h-4 block" }, tool.icon)
|
|
6273
6607
|
);
|
|
6274
6608
|
};
|
|
6275
|
-
return /* @__PURE__ */
|
|
6609
|
+
return /* @__PURE__ */ import_react75.default.createElement(
|
|
6276
6610
|
"div",
|
|
6277
6611
|
{
|
|
6278
6612
|
ref,
|
|
@@ -6283,17 +6617,17 @@ var ToolSidebar = import_react74.default.forwardRef(
|
|
|
6283
6617
|
),
|
|
6284
6618
|
...rest
|
|
6285
6619
|
},
|
|
6286
|
-
/* @__PURE__ */
|
|
6287
|
-
/* @__PURE__ */
|
|
6288
|
-
/* @__PURE__ */
|
|
6620
|
+
/* @__PURE__ */ import_react75.default.createElement("div", { className: "flex flex-col items-center gap-1" }, topTools.map(renderButton)),
|
|
6621
|
+
/* @__PURE__ */ import_react75.default.createElement("div", { className: "flex-1 flex items-center justify-center" }, /* @__PURE__ */ import_react75.default.createElement("div", { className: "w-5 border-t border-ash/30" })),
|
|
6622
|
+
/* @__PURE__ */ import_react75.default.createElement("div", { className: "flex flex-col items-center gap-1" }, bottomTools.map(renderButton))
|
|
6289
6623
|
);
|
|
6290
6624
|
}
|
|
6291
6625
|
);
|
|
6292
6626
|
ToolSidebar.displayName = "ToolSidebar";
|
|
6293
6627
|
|
|
6294
6628
|
// src/components/chat/ToolPanelContainer.tsx
|
|
6295
|
-
var
|
|
6296
|
-
var ToolPanelContainer =
|
|
6629
|
+
var import_react76 = __toESM(require("react"));
|
|
6630
|
+
var ToolPanelContainer = import_react76.default.forwardRef(
|
|
6297
6631
|
({
|
|
6298
6632
|
topContent,
|
|
6299
6633
|
bottomContent,
|
|
@@ -6304,21 +6638,21 @@ var ToolPanelContainer = import_react75.default.forwardRef(
|
|
|
6304
6638
|
initialTopPercent = 60,
|
|
6305
6639
|
...rest
|
|
6306
6640
|
}, ref) => {
|
|
6307
|
-
const [topPercent, setTopPercent] = (0,
|
|
6308
|
-
const [isResizingHeight, setIsResizingHeight] = (0,
|
|
6309
|
-
const containerRef = (0,
|
|
6310
|
-
const lastY = (0,
|
|
6641
|
+
const [topPercent, setTopPercent] = (0, import_react76.useState)(initialTopPercent);
|
|
6642
|
+
const [isResizingHeight, setIsResizingHeight] = (0, import_react76.useState)(false);
|
|
6643
|
+
const containerRef = (0, import_react76.useRef)(null);
|
|
6644
|
+
const lastY = (0, import_react76.useRef)(null);
|
|
6311
6645
|
const hasBoth = topContent !== null && bottomContent !== null;
|
|
6312
|
-
const startHeightResize = (0,
|
|
6646
|
+
const startHeightResize = (0, import_react76.useCallback)((e) => {
|
|
6313
6647
|
e.preventDefault();
|
|
6314
6648
|
setIsResizingHeight(true);
|
|
6315
6649
|
lastY.current = e.clientY;
|
|
6316
6650
|
}, []);
|
|
6317
|
-
const stopHeightResize = (0,
|
|
6651
|
+
const stopHeightResize = (0, import_react76.useCallback)(() => {
|
|
6318
6652
|
setIsResizingHeight(false);
|
|
6319
6653
|
lastY.current = null;
|
|
6320
6654
|
}, []);
|
|
6321
|
-
const resizeHeight = (0,
|
|
6655
|
+
const resizeHeight = (0, import_react76.useCallback)(
|
|
6322
6656
|
(e) => {
|
|
6323
6657
|
if (!isResizingHeight || lastY.current === null || !containerRef.current) {
|
|
6324
6658
|
return;
|
|
@@ -6337,7 +6671,7 @@ var ToolPanelContainer = import_react75.default.forwardRef(
|
|
|
6337
6671
|
},
|
|
6338
6672
|
[isResizingHeight]
|
|
6339
6673
|
);
|
|
6340
|
-
(0,
|
|
6674
|
+
(0, import_react76.useEffect)(() => {
|
|
6341
6675
|
if (isResizingHeight) {
|
|
6342
6676
|
window.addEventListener("mousemove", resizeHeight);
|
|
6343
6677
|
window.addEventListener("mouseup", stopHeightResize);
|
|
@@ -6356,7 +6690,7 @@ var ToolPanelContainer = import_react75.default.forwardRef(
|
|
|
6356
6690
|
document.body.style.userSelect = "";
|
|
6357
6691
|
};
|
|
6358
6692
|
}, [isResizingHeight, resizeHeight, stopHeightResize]);
|
|
6359
|
-
return /* @__PURE__ */
|
|
6693
|
+
return /* @__PURE__ */ import_react76.default.createElement(
|
|
6360
6694
|
"div",
|
|
6361
6695
|
{
|
|
6362
6696
|
ref: (node) => {
|
|
@@ -6375,7 +6709,7 @@ var ToolPanelContainer = import_react75.default.forwardRef(
|
|
|
6375
6709
|
style: width ? { width } : void 0,
|
|
6376
6710
|
...rest
|
|
6377
6711
|
},
|
|
6378
|
-
/* @__PURE__ */
|
|
6712
|
+
/* @__PURE__ */ import_react76.default.createElement(
|
|
6379
6713
|
"div",
|
|
6380
6714
|
{
|
|
6381
6715
|
onMouseDown: onResizeStart,
|
|
@@ -6386,7 +6720,7 @@ var ToolPanelContainer = import_react75.default.forwardRef(
|
|
|
6386
6720
|
)
|
|
6387
6721
|
}
|
|
6388
6722
|
),
|
|
6389
|
-
topContent !== null && /* @__PURE__ */
|
|
6723
|
+
topContent !== null && /* @__PURE__ */ import_react76.default.createElement(
|
|
6390
6724
|
"div",
|
|
6391
6725
|
{
|
|
6392
6726
|
className: "min-h-0 overflow-hidden flex flex-col",
|
|
@@ -6394,7 +6728,7 @@ var ToolPanelContainer = import_react75.default.forwardRef(
|
|
|
6394
6728
|
},
|
|
6395
6729
|
topContent
|
|
6396
6730
|
),
|
|
6397
|
-
hasBoth && /* @__PURE__ */
|
|
6731
|
+
hasBoth && /* @__PURE__ */ import_react76.default.createElement(
|
|
6398
6732
|
"div",
|
|
6399
6733
|
{
|
|
6400
6734
|
onMouseDown: startHeightResize,
|
|
@@ -6406,7 +6740,7 @@ var ToolPanelContainer = import_react75.default.forwardRef(
|
|
|
6406
6740
|
)
|
|
6407
6741
|
}
|
|
6408
6742
|
),
|
|
6409
|
-
bottomContent !== null && /* @__PURE__ */
|
|
6743
|
+
bottomContent !== null && /* @__PURE__ */ import_react76.default.createElement(
|
|
6410
6744
|
"div",
|
|
6411
6745
|
{
|
|
6412
6746
|
className: "min-h-0 overflow-hidden flex flex-col",
|
|
@@ -6420,26 +6754,26 @@ var ToolPanelContainer = import_react75.default.forwardRef(
|
|
|
6420
6754
|
ToolPanelContainer.displayName = "ToolPanelContainer";
|
|
6421
6755
|
|
|
6422
6756
|
// src/components/chat/hooks/useResizable.ts
|
|
6423
|
-
var
|
|
6757
|
+
var import_react77 = require("react");
|
|
6424
6758
|
function useResizable({
|
|
6425
6759
|
initialWidthPercent,
|
|
6426
6760
|
minWidthPercent,
|
|
6427
6761
|
maxWidthPercent,
|
|
6428
6762
|
direction
|
|
6429
6763
|
}) {
|
|
6430
|
-
const [widthPercent, setWidthPercent] = (0,
|
|
6431
|
-
const [isResizing, setIsResizing] = (0,
|
|
6432
|
-
const lastX = (0,
|
|
6433
|
-
const startResizing = (0,
|
|
6764
|
+
const [widthPercent, setWidthPercent] = (0, import_react77.useState)(initialWidthPercent);
|
|
6765
|
+
const [isResizing, setIsResizing] = (0, import_react77.useState)(false);
|
|
6766
|
+
const lastX = (0, import_react77.useRef)(null);
|
|
6767
|
+
const startResizing = (0, import_react77.useCallback)((e) => {
|
|
6434
6768
|
e.preventDefault();
|
|
6435
6769
|
setIsResizing(true);
|
|
6436
6770
|
lastX.current = e.clientX;
|
|
6437
6771
|
}, []);
|
|
6438
|
-
const stopResizing = (0,
|
|
6772
|
+
const stopResizing = (0, import_react77.useCallback)(() => {
|
|
6439
6773
|
setIsResizing(false);
|
|
6440
6774
|
lastX.current = null;
|
|
6441
6775
|
}, []);
|
|
6442
|
-
const resize = (0,
|
|
6776
|
+
const resize = (0, import_react77.useCallback)(
|
|
6443
6777
|
(e) => {
|
|
6444
6778
|
if (!isResizing || lastX.current === null) {
|
|
6445
6779
|
return;
|
|
@@ -6455,7 +6789,7 @@ function useResizable({
|
|
|
6455
6789
|
},
|
|
6456
6790
|
[isResizing, direction, minWidthPercent, maxWidthPercent]
|
|
6457
6791
|
);
|
|
6458
|
-
(0,
|
|
6792
|
+
(0, import_react77.useEffect)(() => {
|
|
6459
6793
|
if (isResizing) {
|
|
6460
6794
|
window.addEventListener("mousemove", resize);
|
|
6461
6795
|
window.addEventListener("mouseup", stopResizing);
|
|
@@ -6479,7 +6813,7 @@ function useResizable({
|
|
|
6479
6813
|
}
|
|
6480
6814
|
|
|
6481
6815
|
// src/components/chat/ChatInterface.tsx
|
|
6482
|
-
var ChatInterface =
|
|
6816
|
+
var ChatInterface = import_react78.default.forwardRef(
|
|
6483
6817
|
({
|
|
6484
6818
|
messages = [],
|
|
6485
6819
|
conversationTree,
|
|
@@ -6491,6 +6825,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6491
6825
|
onStop,
|
|
6492
6826
|
onSelectConversation,
|
|
6493
6827
|
onNewChat,
|
|
6828
|
+
onRenameConversation,
|
|
6494
6829
|
isStreaming = false,
|
|
6495
6830
|
isThinking = false,
|
|
6496
6831
|
placeholder = "Send a message...",
|
|
@@ -6508,21 +6843,23 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6508
6843
|
onStopAllTasks,
|
|
6509
6844
|
inputNotice,
|
|
6510
6845
|
onInputChange,
|
|
6846
|
+
initialInputValue = "",
|
|
6511
6847
|
tools: externalTools = [],
|
|
6848
|
+
autoFocus = true,
|
|
6512
6849
|
className,
|
|
6513
6850
|
...rest
|
|
6514
6851
|
}, ref) => {
|
|
6515
|
-
const prevArtifactNodesRef = (0,
|
|
6516
|
-
const prevTasksRef = (0,
|
|
6517
|
-
const [internalTools, setInternalTools] = (0,
|
|
6852
|
+
const prevArtifactNodesRef = (0, import_react78.useRef)([]);
|
|
6853
|
+
const prevTasksRef = (0, import_react78.useRef)([]);
|
|
6854
|
+
const [internalTools, setInternalTools] = (0, import_react78.useState)({
|
|
6518
6855
|
"top-left": "history",
|
|
6519
6856
|
"bottom-left": null,
|
|
6520
6857
|
"top-right": null,
|
|
6521
6858
|
"bottom-right": null
|
|
6522
6859
|
});
|
|
6523
|
-
const dismissedToolsRef = (0,
|
|
6860
|
+
const dismissedToolsRef = (0, import_react78.useRef)(/* @__PURE__ */ new Set());
|
|
6524
6861
|
const isPanelControlled = isArtifactsPanelOpen !== void 0;
|
|
6525
|
-
const activeTools = (0,
|
|
6862
|
+
const activeTools = (0, import_react78.useMemo)(() => {
|
|
6526
6863
|
if (isPanelControlled) {
|
|
6527
6864
|
return {
|
|
6528
6865
|
...internalTools,
|
|
@@ -6552,13 +6889,13 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6552
6889
|
direction: "right"
|
|
6553
6890
|
});
|
|
6554
6891
|
const allSettled = tasks.length === 0 || areAllTasksSettled(tasks);
|
|
6555
|
-
const allToolDefinitions = (0,
|
|
6892
|
+
const allToolDefinitions = (0, import_react78.useMemo)(() => {
|
|
6556
6893
|
const builtIn = [
|
|
6557
|
-
{ id: "history", icon: /* @__PURE__ */
|
|
6558
|
-
{ id: "artifacts", icon: /* @__PURE__ */
|
|
6894
|
+
{ id: "history", icon: /* @__PURE__ */ import_react78.default.createElement(ChatBubbleIcon, null), label: "History", group: "top-left" },
|
|
6895
|
+
{ id: "artifacts", icon: /* @__PURE__ */ import_react78.default.createElement(MediaIcon, null), label: "Artifacts", group: "top-right" },
|
|
6559
6896
|
{
|
|
6560
6897
|
id: "todos",
|
|
6561
|
-
icon: allSettled ? /* @__PURE__ */
|
|
6898
|
+
icon: allSettled ? /* @__PURE__ */ import_react78.default.createElement(CheckSquareIcon, null) : /* @__PURE__ */ import_react78.default.createElement(SquareLoaderIcon, null),
|
|
6562
6899
|
label: "Tasks",
|
|
6563
6900
|
group: "bottom-right"
|
|
6564
6901
|
}
|
|
@@ -6566,7 +6903,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6566
6903
|
const external = externalTools.map(({ content: _content, ...def }) => def);
|
|
6567
6904
|
return [...builtIn, ...external];
|
|
6568
6905
|
}, [allSettled, externalTools]);
|
|
6569
|
-
const toggleTool = (0,
|
|
6906
|
+
const toggleTool = (0, import_react78.useCallback)((toolId) => {
|
|
6570
6907
|
const toolDef = allToolDefinitions.find((t) => t.id === toolId);
|
|
6571
6908
|
if (!toolDef) {
|
|
6572
6909
|
return;
|
|
@@ -6596,7 +6933,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6596
6933
|
});
|
|
6597
6934
|
}, [allToolDefinitions, isPanelControlled, activeTools, onArtifactsPanelOpenChange]);
|
|
6598
6935
|
const isTreeMode = !!conversationTree;
|
|
6599
|
-
const effectiveMessages = (0,
|
|
6936
|
+
const effectiveMessages = (0, import_react78.useMemo)(() => {
|
|
6600
6937
|
if (isTreeMode && conversationTree) {
|
|
6601
6938
|
const pathNodes = getActivePathMessages(conversationTree);
|
|
6602
6939
|
return pathNodes.map((node) => ({
|
|
@@ -6608,7 +6945,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6608
6945
|
}
|
|
6609
6946
|
return messages;
|
|
6610
6947
|
}, [isTreeMode, conversationTree, messages]);
|
|
6611
|
-
const latestUserMessageIndex = (0,
|
|
6948
|
+
const latestUserMessageIndex = (0, import_react78.useMemo)(() => {
|
|
6612
6949
|
for (let i = effectiveMessages.length - 1; i >= 0; i--) {
|
|
6613
6950
|
if (effectiveMessages[i].variant === "user") {
|
|
6614
6951
|
return i;
|
|
@@ -6616,7 +6953,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6616
6953
|
}
|
|
6617
6954
|
return -1;
|
|
6618
6955
|
}, [effectiveMessages]);
|
|
6619
|
-
(0,
|
|
6956
|
+
(0, import_react78.useEffect)(() => {
|
|
6620
6957
|
const nodes = artifactNodes || [];
|
|
6621
6958
|
const prevNodes = prevArtifactNodesRef.current;
|
|
6622
6959
|
const hasNewOrChangedNode = nodes.length !== prevNodes.length || nodes.some((n, i) => n.id !== prevNodes[i]?.id);
|
|
@@ -6641,7 +6978,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6641
6978
|
prevArtifactNodesRef.current = nodes;
|
|
6642
6979
|
prevTasksRef.current = tasks;
|
|
6643
6980
|
}, [artifactNodes, tasks, isPanelControlled]);
|
|
6644
|
-
const handleBranchSwitch = (0,
|
|
6981
|
+
const handleBranchSwitch = (0, import_react78.useCallback)(
|
|
6645
6982
|
(nodeId, direction) => {
|
|
6646
6983
|
if (!isTreeMode || !conversationTree || !onTreeChange) {
|
|
6647
6984
|
return;
|
|
@@ -6651,7 +6988,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6651
6988
|
},
|
|
6652
6989
|
[isTreeMode, conversationTree, onTreeChange]
|
|
6653
6990
|
);
|
|
6654
|
-
const displayMessages = (0,
|
|
6991
|
+
const displayMessages = (0, import_react78.useMemo)(() => {
|
|
6655
6992
|
return effectiveMessages.map((msg) => {
|
|
6656
6993
|
let branchInfo = void 0;
|
|
6657
6994
|
if (isTreeMode && conversationTree) {
|
|
@@ -6681,18 +7018,18 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6681
7018
|
onRetryMessage,
|
|
6682
7019
|
handleBranchSwitch
|
|
6683
7020
|
]);
|
|
6684
|
-
const handleSubmit = (0,
|
|
7021
|
+
const handleSubmit = (0, import_react78.useCallback)(
|
|
6685
7022
|
(message, attachments) => {
|
|
6686
7023
|
onMessageSubmit?.(message, attachments);
|
|
6687
7024
|
},
|
|
6688
7025
|
[onMessageSubmit]
|
|
6689
7026
|
);
|
|
6690
7027
|
const isEmpty = effectiveMessages.length === 0;
|
|
6691
|
-
const leftToolDefs = (0,
|
|
7028
|
+
const leftToolDefs = (0, import_react78.useMemo)(
|
|
6692
7029
|
() => allToolDefinitions.filter((t) => t.group === "top-left" || t.group === "bottom-left"),
|
|
6693
7030
|
[allToolDefinitions]
|
|
6694
7031
|
);
|
|
6695
|
-
const rightToolDefs = (0,
|
|
7032
|
+
const rightToolDefs = (0, import_react78.useMemo)(
|
|
6696
7033
|
() => allToolDefinitions.filter(
|
|
6697
7034
|
(t) => t.group === "top-right" || t.group === "bottom-right"
|
|
6698
7035
|
),
|
|
@@ -6706,58 +7043,17 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6706
7043
|
}
|
|
6707
7044
|
switch (toolId) {
|
|
6708
7045
|
case "history":
|
|
6709
|
-
return /* @__PURE__ */
|
|
6710
|
-
|
|
6711
|
-
{
|
|
6712
|
-
className: "flex items-center justify-between p-4 border-b border-ash/40 shrink-0"
|
|
6713
|
-
},
|
|
6714
|
-
/* @__PURE__ */ import_react77.default.createElement("h3", { className: "text-xs font-medium text-white" }, "History"),
|
|
6715
|
-
onNewChat && /* @__PURE__ */ import_react77.default.createElement(
|
|
6716
|
-
"button",
|
|
6717
|
-
{
|
|
6718
|
-
onClick: onNewChat,
|
|
6719
|
-
className: cx(
|
|
6720
|
-
"flex px-3 py-1.5",
|
|
6721
|
-
"bg-gold/10 hover:bg-gold/20 text-gold",
|
|
6722
|
-
"border border-gold/30",
|
|
6723
|
-
"text-xs font-medium",
|
|
6724
|
-
"transition-colors duration-200"
|
|
6725
|
-
)
|
|
6726
|
-
},
|
|
6727
|
-
/* @__PURE__ */ import_react77.default.createElement(
|
|
6728
|
-
"svg",
|
|
6729
|
-
{
|
|
6730
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
6731
|
-
viewBox: "0 0 20 20",
|
|
6732
|
-
fill: "currentColor",
|
|
6733
|
-
className: "w-4 h-4"
|
|
6734
|
-
},
|
|
6735
|
-
/* @__PURE__ */ import_react77.default.createElement(
|
|
6736
|
-
"path",
|
|
6737
|
-
{
|
|
6738
|
-
d: "M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z"
|
|
6739
|
-
}
|
|
6740
|
-
)
|
|
6741
|
-
),
|
|
6742
|
-
"New Chat"
|
|
6743
|
-
)
|
|
6744
|
-
), /* @__PURE__ */ import_react77.default.createElement("div", { className: "flex-1 overflow-y-auto py-2" }, conversations.length === 0 ? /* @__PURE__ */ import_react77.default.createElement("p", { className: "px-4 py-2 text-xs text-silver/60" }, "No conversations yet") : /* @__PURE__ */ import_react77.default.createElement("div", { className: "space-y-1 px-2" }, conversations.map((conversation) => /* @__PURE__ */ import_react77.default.createElement(
|
|
6745
|
-
"button",
|
|
7046
|
+
return /* @__PURE__ */ import_react78.default.createElement(
|
|
7047
|
+
HistoryPanel,
|
|
6746
7048
|
{
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
)
|
|
6754
|
-
},
|
|
6755
|
-
/* @__PURE__ */ import_react77.default.createElement("p", { className: "text-sm font-medium truncate" }, conversation.title),
|
|
6756
|
-
conversation.preview && /* @__PURE__ */ import_react77.default.createElement("p", { className: "text-xs text-silver/60 truncate mt-0.5" }, conversation.preview),
|
|
6757
|
-
conversation.timestamp && /* @__PURE__ */ import_react77.default.createElement("p", { className: "text-xs text-silver/40 mt-1" }, conversation.timestamp)
|
|
6758
|
-
)))));
|
|
7049
|
+
conversations,
|
|
7050
|
+
onSelectConversation,
|
|
7051
|
+
onNewChat,
|
|
7052
|
+
onRenameConversation
|
|
7053
|
+
}
|
|
7054
|
+
);
|
|
6759
7055
|
case "artifacts":
|
|
6760
|
-
return /* @__PURE__ */
|
|
7056
|
+
return /* @__PURE__ */ import_react78.default.createElement(
|
|
6761
7057
|
ArtifactsPanel,
|
|
6762
7058
|
{
|
|
6763
7059
|
nodes: artifactNodes,
|
|
@@ -6765,7 +7061,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6765
7061
|
}
|
|
6766
7062
|
);
|
|
6767
7063
|
case "todos":
|
|
6768
|
-
return tasks.length > 0 ? /* @__PURE__ */
|
|
7064
|
+
return tasks.length > 0 ? /* @__PURE__ */ import_react78.default.createElement(
|
|
6769
7065
|
TodosList,
|
|
6770
7066
|
{
|
|
6771
7067
|
tasks,
|
|
@@ -6773,21 +7069,21 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6773
7069
|
onStopAllTasks,
|
|
6774
7070
|
className: "h-full"
|
|
6775
7071
|
}
|
|
6776
|
-
) : /* @__PURE__ */
|
|
7072
|
+
) : /* @__PURE__ */ import_react78.default.createElement("div", { className: "h-full flex flex-col" }, /* @__PURE__ */ import_react78.default.createElement("div", { className: "flex items-center p-4 border-b border-ash/40 shrink-0" }, /* @__PURE__ */ import_react78.default.createElement("h3", { className: "text-xs font-medium text-white" }, "Tasks")), /* @__PURE__ */ import_react78.default.createElement("div", { className: "flex-1 flex items-center justify-center" }, /* @__PURE__ */ import_react78.default.createElement("p", { className: "text-xs text-silver/60" }, "No tasks")));
|
|
6777
7073
|
default: {
|
|
6778
7074
|
const externalTool = externalTools.find((t) => t.id === toolId);
|
|
6779
7075
|
return externalTool?.content ?? null;
|
|
6780
7076
|
}
|
|
6781
7077
|
}
|
|
6782
7078
|
};
|
|
6783
|
-
return /* @__PURE__ */
|
|
7079
|
+
return /* @__PURE__ */ import_react78.default.createElement(
|
|
6784
7080
|
"div",
|
|
6785
7081
|
{
|
|
6786
7082
|
ref,
|
|
6787
7083
|
className: cx("flex h-full w-full bg-obsidian overflow-hidden", className),
|
|
6788
7084
|
...rest
|
|
6789
7085
|
},
|
|
6790
|
-
hasLeftTools && /* @__PURE__ */
|
|
7086
|
+
hasLeftTools && /* @__PURE__ */ import_react78.default.createElement(
|
|
6791
7087
|
ToolSidebar,
|
|
6792
7088
|
{
|
|
6793
7089
|
tools: leftToolDefs,
|
|
@@ -6796,7 +7092,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6796
7092
|
side: "left"
|
|
6797
7093
|
}
|
|
6798
7094
|
),
|
|
6799
|
-
isLeftPanelOpen && /* @__PURE__ */
|
|
7095
|
+
isLeftPanelOpen && /* @__PURE__ */ import_react78.default.createElement(
|
|
6800
7096
|
ToolPanelContainer,
|
|
6801
7097
|
{
|
|
6802
7098
|
topContent: renderToolContent(activeTools["top-left"]),
|
|
@@ -6807,16 +7103,16 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6807
7103
|
initialTopPercent: 30
|
|
6808
7104
|
}
|
|
6809
7105
|
),
|
|
6810
|
-
/* @__PURE__ */
|
|
7106
|
+
/* @__PURE__ */ import_react78.default.createElement("div", { className: "flex-1 flex flex-col min-w-0 relative" }, /* @__PURE__ */ import_react78.default.createElement("div", { className: cx(
|
|
6811
7107
|
"flex-1 flex flex-col min-h-0 relative",
|
|
6812
7108
|
isEmpty ? "justify-center" : "justify-start"
|
|
6813
|
-
) }, /* @__PURE__ */
|
|
7109
|
+
) }, /* @__PURE__ */ import_react78.default.createElement("div", { className: cx(
|
|
6814
7110
|
"transition-all duration-500 ease-in-out",
|
|
6815
7111
|
isEmpty ? "flex-1" : "flex-zero"
|
|
6816
|
-
) }), /* @__PURE__ */
|
|
7112
|
+
) }), /* @__PURE__ */ import_react78.default.createElement("div", { className: cx(
|
|
6817
7113
|
"transition-all duration-500 ease-in-out overflow-hidden flex flex-col",
|
|
6818
7114
|
isEmpty ? "flex-zero opacity-0" : "flex-1 opacity-100"
|
|
6819
|
-
) }, /* @__PURE__ */
|
|
7115
|
+
) }, /* @__PURE__ */ import_react78.default.createElement(
|
|
6820
7116
|
ChatView,
|
|
6821
7117
|
{
|
|
6822
7118
|
messages: displayMessages,
|
|
@@ -6825,10 +7121,10 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6825
7121
|
isThinking,
|
|
6826
7122
|
className: "flex-1"
|
|
6827
7123
|
}
|
|
6828
|
-
)), /* @__PURE__ */
|
|
7124
|
+
)), /* @__PURE__ */ import_react78.default.createElement("div", { className: cx(
|
|
6829
7125
|
"transition-all duration-500 ease-in-out z-10 w-full flex flex-col items-center",
|
|
6830
7126
|
isEmpty ? "p-4" : "shrink-0 p-4 border-t border-ash/40 bg-obsidian"
|
|
6831
|
-
) }, isEmpty && /* @__PURE__ */
|
|
7127
|
+
) }, isEmpty && /* @__PURE__ */ import_react78.default.createElement("div", { className: "mb-8 text-center animate-fade-in duration-500" }, emptyState ? emptyState : /* @__PURE__ */ import_react78.default.createElement("h1", { className: "text-4xl md:text-5xl font-heading text-gold mb-2 tracking-tight" }, "Welcome!")), /* @__PURE__ */ import_react78.default.createElement(
|
|
6832
7128
|
ChatInput,
|
|
6833
7129
|
{
|
|
6834
7130
|
position: isEmpty ? "centered" : "bottom",
|
|
@@ -6842,13 +7138,15 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6842
7138
|
attachments: propsAttachments,
|
|
6843
7139
|
onAttachmentsChange,
|
|
6844
7140
|
notice: inputNotice,
|
|
6845
|
-
onInputChange
|
|
7141
|
+
onInputChange,
|
|
7142
|
+
initialInputValue,
|
|
7143
|
+
autoFocus
|
|
6846
7144
|
}
|
|
6847
|
-
)), /* @__PURE__ */
|
|
7145
|
+
)), /* @__PURE__ */ import_react78.default.createElement("div", { className: cx(
|
|
6848
7146
|
"transition-all duration-500 ease-in-out",
|
|
6849
7147
|
isEmpty ? "flex-1" : "flex-zero"
|
|
6850
7148
|
) }))),
|
|
6851
|
-
isRightPanelOpen && /* @__PURE__ */
|
|
7149
|
+
isRightPanelOpen && /* @__PURE__ */ import_react78.default.createElement(
|
|
6852
7150
|
ToolPanelContainer,
|
|
6853
7151
|
{
|
|
6854
7152
|
topContent: renderToolContent(activeTools["top-right"]),
|
|
@@ -6859,7 +7157,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6859
7157
|
initialTopPercent: 70
|
|
6860
7158
|
}
|
|
6861
7159
|
),
|
|
6862
|
-
hasRightTools && /* @__PURE__ */
|
|
7160
|
+
hasRightTools && /* @__PURE__ */ import_react78.default.createElement(
|
|
6863
7161
|
ToolSidebar,
|
|
6864
7162
|
{
|
|
6865
7163
|
tools: rightToolDefs,
|
|
@@ -6874,9 +7172,9 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6874
7172
|
ChatInterface.displayName = "ChatInterface";
|
|
6875
7173
|
|
|
6876
7174
|
// src/components/chat/MessageActions.tsx
|
|
6877
|
-
var
|
|
7175
|
+
var import_react79 = __toESM(require("react"));
|
|
6878
7176
|
var import_lucide_react15 = require("lucide-react");
|
|
6879
|
-
var ActionButton2 = ({ onClick, label, children, className, disabled }) => /* @__PURE__ */
|
|
7177
|
+
var ActionButton2 = ({ onClick, label, children, className, disabled }) => /* @__PURE__ */ import_react79.default.createElement(
|
|
6880
7178
|
"button",
|
|
6881
7179
|
{
|
|
6882
7180
|
type: "button",
|
|
@@ -6892,7 +7190,7 @@ var ActionButton2 = ({ onClick, label, children, className, disabled }) => /* @_
|
|
|
6892
7190
|
},
|
|
6893
7191
|
children
|
|
6894
7192
|
);
|
|
6895
|
-
var MessageActions =
|
|
7193
|
+
var MessageActions = import_react79.default.forwardRef(
|
|
6896
7194
|
({
|
|
6897
7195
|
variant,
|
|
6898
7196
|
content,
|
|
@@ -6904,12 +7202,12 @@ var MessageActions = import_react78.default.forwardRef(
|
|
|
6904
7202
|
className,
|
|
6905
7203
|
...rest
|
|
6906
7204
|
}, ref) => {
|
|
6907
|
-
const [localIsEditing, setLocalIsEditing] = (0,
|
|
6908
|
-
const [localEditValue, setLocalEditValue] = (0,
|
|
6909
|
-
const [copied, setCopied] = (0,
|
|
7205
|
+
const [localIsEditing, setLocalIsEditing] = (0, import_react79.useState)(false);
|
|
7206
|
+
const [localEditValue, setLocalEditValue] = (0, import_react79.useState)(content);
|
|
7207
|
+
const [copied, setCopied] = (0, import_react79.useState)(false);
|
|
6910
7208
|
const isEditing = controlledIsEditing ?? localIsEditing;
|
|
6911
7209
|
const editValue = controlledEditValue ?? localEditValue;
|
|
6912
|
-
const setIsEditing = (0,
|
|
7210
|
+
const setIsEditing = (0, import_react79.useCallback)(
|
|
6913
7211
|
(value) => {
|
|
6914
7212
|
if (onEditingChange) {
|
|
6915
7213
|
onEditingChange(value);
|
|
@@ -6919,10 +7217,10 @@ var MessageActions = import_react78.default.forwardRef(
|
|
|
6919
7217
|
},
|
|
6920
7218
|
[onEditingChange]
|
|
6921
7219
|
);
|
|
6922
|
-
const setEditValue = (0,
|
|
7220
|
+
const setEditValue = (0, import_react79.useCallback)((value) => {
|
|
6923
7221
|
setLocalEditValue(value);
|
|
6924
7222
|
}, []);
|
|
6925
|
-
const handleCopy = (0,
|
|
7223
|
+
const handleCopy = (0, import_react79.useCallback)(async () => {
|
|
6926
7224
|
try {
|
|
6927
7225
|
await navigator.clipboard.writeText(content);
|
|
6928
7226
|
setCopied(true);
|
|
@@ -6938,22 +7236,22 @@ var MessageActions = import_react78.default.forwardRef(
|
|
|
6938
7236
|
setTimeout(() => setCopied(false), 2e3);
|
|
6939
7237
|
}
|
|
6940
7238
|
}, [content]);
|
|
6941
|
-
const handleStartEdit = (0,
|
|
7239
|
+
const handleStartEdit = (0, import_react79.useCallback)(() => {
|
|
6942
7240
|
setLocalEditValue(content);
|
|
6943
7241
|
setIsEditing(true);
|
|
6944
7242
|
}, [content, setIsEditing]);
|
|
6945
|
-
const handleCancelEdit = (0,
|
|
7243
|
+
const handleCancelEdit = (0, import_react79.useCallback)(() => {
|
|
6946
7244
|
setIsEditing(false);
|
|
6947
7245
|
setLocalEditValue(content);
|
|
6948
7246
|
}, [content, setIsEditing]);
|
|
6949
|
-
const handleSubmitEdit = (0,
|
|
7247
|
+
const handleSubmitEdit = (0, import_react79.useCallback)(() => {
|
|
6950
7248
|
const trimmed = editValue.trim();
|
|
6951
7249
|
if (trimmed && trimmed !== content) {
|
|
6952
7250
|
onEdit?.(trimmed);
|
|
6953
7251
|
}
|
|
6954
7252
|
setIsEditing(false);
|
|
6955
7253
|
}, [editValue, content, onEdit, setIsEditing]);
|
|
6956
|
-
const handleEditKeyDown = (0,
|
|
7254
|
+
const handleEditKeyDown = (0, import_react79.useCallback)(
|
|
6957
7255
|
(e) => {
|
|
6958
7256
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
6959
7257
|
e.preventDefault();
|
|
@@ -6966,19 +7264,19 @@ var MessageActions = import_react78.default.forwardRef(
|
|
|
6966
7264
|
);
|
|
6967
7265
|
const isUser = variant === "user";
|
|
6968
7266
|
if (isUser && isEditing) {
|
|
6969
|
-
return /* @__PURE__ */
|
|
7267
|
+
return /* @__PURE__ */ import_react79.default.createElement(
|
|
6970
7268
|
"div",
|
|
6971
7269
|
{
|
|
6972
7270
|
ref,
|
|
6973
7271
|
className: cx("mt-2", className),
|
|
6974
7272
|
...rest
|
|
6975
7273
|
},
|
|
6976
|
-
/* @__PURE__ */
|
|
7274
|
+
/* @__PURE__ */ import_react79.default.createElement(
|
|
6977
7275
|
"div",
|
|
6978
7276
|
{
|
|
6979
7277
|
className: "relative bg-charcoal border border-ash/60 focus-within:border-gold/60 focus-within:ring-1 focus-within:ring-gold/20"
|
|
6980
7278
|
},
|
|
6981
|
-
/* @__PURE__ */
|
|
7279
|
+
/* @__PURE__ */ import_react79.default.createElement(
|
|
6982
7280
|
"textarea",
|
|
6983
7281
|
{
|
|
6984
7282
|
value: editValue,
|
|
@@ -6989,15 +7287,15 @@ var MessageActions = import_react78.default.forwardRef(
|
|
|
6989
7287
|
rows: 2
|
|
6990
7288
|
}
|
|
6991
7289
|
),
|
|
6992
|
-
/* @__PURE__ */
|
|
7290
|
+
/* @__PURE__ */ import_react79.default.createElement("div", { className: "absolute right-2 bottom-2 flex gap-1" }, /* @__PURE__ */ import_react79.default.createElement(
|
|
6993
7291
|
ActionButton2,
|
|
6994
7292
|
{
|
|
6995
7293
|
onClick: handleCancelEdit,
|
|
6996
7294
|
label: "Cancel edit",
|
|
6997
7295
|
className: "text-silver/60 hover:text-error"
|
|
6998
7296
|
},
|
|
6999
|
-
/* @__PURE__ */
|
|
7000
|
-
), /* @__PURE__ */
|
|
7297
|
+
/* @__PURE__ */ import_react79.default.createElement(import_lucide_react15.X, { className: "w-4 h-4" })
|
|
7298
|
+
), /* @__PURE__ */ import_react79.default.createElement(
|
|
7001
7299
|
ActionButton2,
|
|
7002
7300
|
{
|
|
7003
7301
|
onClick: handleSubmitEdit,
|
|
@@ -7005,13 +7303,13 @@ var MessageActions = import_react78.default.forwardRef(
|
|
|
7005
7303
|
className: "text-silver/60 hover:text-gold",
|
|
7006
7304
|
disabled: !editValue.trim() || editValue.trim() === content
|
|
7007
7305
|
},
|
|
7008
|
-
/* @__PURE__ */
|
|
7306
|
+
/* @__PURE__ */ import_react79.default.createElement(import_lucide_react15.Send, { className: "w-4 h-4" })
|
|
7009
7307
|
))
|
|
7010
7308
|
),
|
|
7011
|
-
/* @__PURE__ */
|
|
7309
|
+
/* @__PURE__ */ import_react79.default.createElement("p", { className: "text-xs text-silver/50 mt-1" }, "Press Enter to submit, Esc to cancel. This will create a new branch.")
|
|
7012
7310
|
);
|
|
7013
7311
|
}
|
|
7014
|
-
return /* @__PURE__ */
|
|
7312
|
+
return /* @__PURE__ */ import_react79.default.createElement(
|
|
7015
7313
|
"div",
|
|
7016
7314
|
{
|
|
7017
7315
|
ref,
|
|
@@ -7022,18 +7320,18 @@ var MessageActions = import_react78.default.forwardRef(
|
|
|
7022
7320
|
),
|
|
7023
7321
|
...rest
|
|
7024
7322
|
},
|
|
7025
|
-
/* @__PURE__ */
|
|
7026
|
-
isUser && onEdit && /* @__PURE__ */
|
|
7027
|
-
!isUser && onRetry && /* @__PURE__ */
|
|
7323
|
+
/* @__PURE__ */ import_react79.default.createElement(ActionButton2, { onClick: handleCopy, label: copied ? "Copied!" : "Copy message" }, copied ? /* @__PURE__ */ import_react79.default.createElement(import_lucide_react15.Check, { className: "w-3.5 h-3.5 text-success" }) : /* @__PURE__ */ import_react79.default.createElement(import_lucide_react15.Copy, { className: "w-3.5 h-3.5" })),
|
|
7324
|
+
isUser && onEdit && /* @__PURE__ */ import_react79.default.createElement(ActionButton2, { onClick: handleStartEdit, label: "Edit message" }, /* @__PURE__ */ import_react79.default.createElement(import_lucide_react15.Pencil, { className: "w-3.5 h-3.5" })),
|
|
7325
|
+
!isUser && onRetry && /* @__PURE__ */ import_react79.default.createElement(ActionButton2, { onClick: onRetry, label: "Regenerate response" }, /* @__PURE__ */ import_react79.default.createElement(import_lucide_react15.RotateCcw, { className: "w-3.5 h-3.5" }))
|
|
7028
7326
|
);
|
|
7029
7327
|
}
|
|
7030
7328
|
);
|
|
7031
7329
|
MessageActions.displayName = "MessageActions";
|
|
7032
7330
|
|
|
7033
7331
|
// src/components/chat/BranchNavigator.tsx
|
|
7034
|
-
var
|
|
7332
|
+
var import_react80 = __toESM(require("react"));
|
|
7035
7333
|
var import_lucide_react16 = require("lucide-react");
|
|
7036
|
-
var BranchNavigator =
|
|
7334
|
+
var BranchNavigator = import_react80.default.forwardRef(
|
|
7037
7335
|
({
|
|
7038
7336
|
current,
|
|
7039
7337
|
total,
|
|
@@ -7052,7 +7350,7 @@ var BranchNavigator = import_react79.default.forwardRef(
|
|
|
7052
7350
|
const buttonSize = size === "sm" ? "p-0.5" : "p-1";
|
|
7053
7351
|
const iconSize = size === "sm" ? "w-3 h-3" : "w-4 h-4";
|
|
7054
7352
|
const textSize = size === "sm" ? "text-xs" : "text-sm";
|
|
7055
|
-
return /* @__PURE__ */
|
|
7353
|
+
return /* @__PURE__ */ import_react80.default.createElement(
|
|
7056
7354
|
"div",
|
|
7057
7355
|
{
|
|
7058
7356
|
ref,
|
|
@@ -7064,8 +7362,8 @@ var BranchNavigator = import_react79.default.forwardRef(
|
|
|
7064
7362
|
"aria-label": "Branch navigation",
|
|
7065
7363
|
...rest
|
|
7066
7364
|
},
|
|
7067
|
-
showIcon && /* @__PURE__ */
|
|
7068
|
-
/* @__PURE__ */
|
|
7365
|
+
showIcon && /* @__PURE__ */ import_react80.default.createElement(import_lucide_react16.GitBranch, { className: cx(iconSize, "mr-0.5 text-silver/50"), "aria-hidden": "true" }),
|
|
7366
|
+
/* @__PURE__ */ import_react80.default.createElement(
|
|
7069
7367
|
"button",
|
|
7070
7368
|
{
|
|
7071
7369
|
type: "button",
|
|
@@ -7078,10 +7376,10 @@ var BranchNavigator = import_react79.default.forwardRef(
|
|
|
7078
7376
|
),
|
|
7079
7377
|
"aria-label": "Previous branch"
|
|
7080
7378
|
},
|
|
7081
|
-
/* @__PURE__ */
|
|
7379
|
+
/* @__PURE__ */ import_react80.default.createElement(import_lucide_react16.ChevronLeft, { className: iconSize })
|
|
7082
7380
|
),
|
|
7083
|
-
/* @__PURE__ */
|
|
7084
|
-
/* @__PURE__ */
|
|
7381
|
+
/* @__PURE__ */ import_react80.default.createElement("span", { className: cx(textSize, "tabular-nums min-w-6 text-center") }, current, "/", total),
|
|
7382
|
+
/* @__PURE__ */ import_react80.default.createElement(
|
|
7085
7383
|
"button",
|
|
7086
7384
|
{
|
|
7087
7385
|
type: "button",
|
|
@@ -7094,7 +7392,7 @@ var BranchNavigator = import_react79.default.forwardRef(
|
|
|
7094
7392
|
),
|
|
7095
7393
|
"aria-label": "Next branch"
|
|
7096
7394
|
},
|
|
7097
|
-
/* @__PURE__ */
|
|
7395
|
+
/* @__PURE__ */ import_react80.default.createElement(import_lucide_react16.ChevronRight, { className: iconSize })
|
|
7098
7396
|
)
|
|
7099
7397
|
);
|
|
7100
7398
|
}
|
|
@@ -7102,16 +7400,16 @@ var BranchNavigator = import_react79.default.forwardRef(
|
|
|
7102
7400
|
BranchNavigator.displayName = "BranchNavigator";
|
|
7103
7401
|
|
|
7104
7402
|
// src/components/BrandIcon.tsx
|
|
7105
|
-
var
|
|
7403
|
+
var import_react81 = __toESM(require("react"));
|
|
7106
7404
|
var sizeMap2 = {
|
|
7107
7405
|
sm: "h-8 w-8 text-sm",
|
|
7108
7406
|
md: "h-12 w-12 text-base",
|
|
7109
7407
|
lg: "h-16 w-16 text-lg"
|
|
7110
7408
|
};
|
|
7111
|
-
var BrandIcon =
|
|
7409
|
+
var BrandIcon = import_react81.default.forwardRef(
|
|
7112
7410
|
({ size = "md", variant = "solid", children, className, ...rest }, ref) => {
|
|
7113
7411
|
const variantClasses = variant === "solid" ? "bg-gold text-obsidian border-2 border-gold" : "bg-transparent text-gold border-2 border-gold";
|
|
7114
|
-
return /* @__PURE__ */
|
|
7412
|
+
return /* @__PURE__ */ import_react81.default.createElement(
|
|
7115
7413
|
"div",
|
|
7116
7414
|
{
|
|
7117
7415
|
ref,
|
|
@@ -7130,17 +7428,17 @@ var BrandIcon = import_react80.default.forwardRef(
|
|
|
7130
7428
|
BrandIcon.displayName = "BrandIcon";
|
|
7131
7429
|
|
|
7132
7430
|
// src/components/ColorSwatch.tsx
|
|
7133
|
-
var
|
|
7134
|
-
var ColorSwatch =
|
|
7431
|
+
var import_react82 = __toESM(require("react"));
|
|
7432
|
+
var ColorSwatch = import_react82.default.forwardRef(
|
|
7135
7433
|
({ color, label, className, ...rest }, ref) => {
|
|
7136
|
-
return /* @__PURE__ */
|
|
7434
|
+
return /* @__PURE__ */ import_react82.default.createElement(
|
|
7137
7435
|
"div",
|
|
7138
7436
|
{
|
|
7139
7437
|
ref,
|
|
7140
7438
|
className: cx("flex flex-col items-center gap-2", className),
|
|
7141
7439
|
...rest
|
|
7142
7440
|
},
|
|
7143
|
-
/* @__PURE__ */
|
|
7441
|
+
/* @__PURE__ */ import_react82.default.createElement(
|
|
7144
7442
|
"div",
|
|
7145
7443
|
{
|
|
7146
7444
|
className: "h-16 w-16 border-2 border-ash rounded-none shadow-sm",
|
|
@@ -7148,22 +7446,22 @@ var ColorSwatch = import_react81.default.forwardRef(
|
|
|
7148
7446
|
"aria-label": label || color
|
|
7149
7447
|
}
|
|
7150
7448
|
),
|
|
7151
|
-
label && /* @__PURE__ */
|
|
7449
|
+
label && /* @__PURE__ */ import_react82.default.createElement("span", { className: "text-xs text-silver font-medium" }, label)
|
|
7152
7450
|
);
|
|
7153
7451
|
}
|
|
7154
7452
|
);
|
|
7155
7453
|
ColorSwatch.displayName = "ColorSwatch";
|
|
7156
7454
|
|
|
7157
7455
|
// src/components/SectionHeading.tsx
|
|
7158
|
-
var
|
|
7456
|
+
var import_react83 = __toESM(require("react"));
|
|
7159
7457
|
var levelStyles = {
|
|
7160
7458
|
h2: "text-2xl mb-4",
|
|
7161
7459
|
h3: "text-xl mb-3"
|
|
7162
7460
|
};
|
|
7163
|
-
var SectionHeading =
|
|
7461
|
+
var SectionHeading = import_react83.default.forwardRef(
|
|
7164
7462
|
({ level = "h2", children, className, ...rest }, ref) => {
|
|
7165
7463
|
const Component = level;
|
|
7166
|
-
return /* @__PURE__ */
|
|
7464
|
+
return /* @__PURE__ */ import_react83.default.createElement(
|
|
7167
7465
|
Component,
|
|
7168
7466
|
{
|
|
7169
7467
|
ref,
|
|
@@ -7235,6 +7533,7 @@ var version = "2.0.0";
|
|
|
7235
7533
|
FileChip,
|
|
7236
7534
|
HelperText,
|
|
7237
7535
|
HistoryIcon,
|
|
7536
|
+
HistoryPanel,
|
|
7238
7537
|
ImageCard,
|
|
7239
7538
|
Input,
|
|
7240
7539
|
InputGroup,
|