@lukeashford/aurelius 3.4.0 → 3.6.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 +102 -3
- package/dist/index.d.ts +102 -3
- package/dist/index.js +539 -196
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +540 -198
- package/dist/index.mjs.map +1 -1
- package/llms.md +29 -4
- 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"));
|
|
@@ -4796,6 +4797,9 @@ var ChatInput = import_react61.default.forwardRef(
|
|
|
4796
4797
|
onAttachmentsChange,
|
|
4797
4798
|
showAttachmentButton = true,
|
|
4798
4799
|
acceptedFileTypes,
|
|
4800
|
+
notice,
|
|
4801
|
+
onInputChange,
|
|
4802
|
+
autoFocus = false,
|
|
4799
4803
|
className,
|
|
4800
4804
|
...rest
|
|
4801
4805
|
}, ref) => {
|
|
@@ -4842,15 +4846,16 @@ var ChatInput = import_react61.default.forwardRef(
|
|
|
4842
4846
|
);
|
|
4843
4847
|
const handleChange = (0, import_react61.useCallback)((e) => {
|
|
4844
4848
|
setValue(e.target.value);
|
|
4849
|
+
onInputChange?.(e.target.value);
|
|
4845
4850
|
const textarea = e.target;
|
|
4846
4851
|
textarea.style.height = "auto";
|
|
4847
4852
|
textarea.style.height = `${Math.min(textarea.scrollHeight, 200)}px`;
|
|
4848
|
-
}, []);
|
|
4853
|
+
}, [onInputChange]);
|
|
4849
4854
|
(0, import_react61.useEffect)(() => {
|
|
4850
|
-
if (!disabled && !isStreaming && textareaRef.current) {
|
|
4855
|
+
if (autoFocus && !disabled && !isStreaming && textareaRef.current) {
|
|
4851
4856
|
textareaRef.current.focus();
|
|
4852
4857
|
}
|
|
4853
|
-
}, [disabled, isStreaming]);
|
|
4858
|
+
}, [disabled, isStreaming, autoFocus]);
|
|
4854
4859
|
const addFiles = (0, import_react61.useCallback)(
|
|
4855
4860
|
(files) => {
|
|
4856
4861
|
const newAttachments = Array.from(files).map((file) => ({
|
|
@@ -4929,6 +4934,23 @@ var ChatInput = import_react61.default.forwardRef(
|
|
|
4929
4934
|
...rest
|
|
4930
4935
|
},
|
|
4931
4936
|
isCentered && helperText && /* @__PURE__ */ import_react61.default.createElement("p", { className: "text-silver text-sm mb-4 text-center" }, helperText),
|
|
4937
|
+
notice && /* @__PURE__ */ import_react61.default.createElement("div", { className: cx(
|
|
4938
|
+
"w-full flex items-start gap-2 px-3 py-2 mb-1 text-xs",
|
|
4939
|
+
isCentered && "max-w-lg",
|
|
4940
|
+
notice.variant === "warning" ? "bg-gold/5 border border-gold/20 text-gold/80" : "bg-error/10 border border-error/30 text-error"
|
|
4941
|
+
) }, /* @__PURE__ */ import_react61.default.createElement("span", { className: "flex-1" }, notice.content), (notice.dismissible ?? notice.variant === "warning") && notice.onDismiss && /* @__PURE__ */ import_react61.default.createElement(
|
|
4942
|
+
"button",
|
|
4943
|
+
{
|
|
4944
|
+
type: "button",
|
|
4945
|
+
onClick: notice.onDismiss,
|
|
4946
|
+
"aria-label": "Dismiss",
|
|
4947
|
+
className: cx(
|
|
4948
|
+
"shrink-0 opacity-60 hover:opacity-100 transition-opacity",
|
|
4949
|
+
notice.variant === "warning" ? "text-gold" : "text-error"
|
|
4950
|
+
)
|
|
4951
|
+
},
|
|
4952
|
+
/* @__PURE__ */ import_react61.default.createElement(import_lucide_react11.X, { className: "w-3 h-3" })
|
|
4953
|
+
)),
|
|
4932
4954
|
/* @__PURE__ */ import_react61.default.createElement(
|
|
4933
4955
|
"div",
|
|
4934
4956
|
{
|
|
@@ -6059,8 +6081,346 @@ var ArtifactsPanelToggle = import_react72.default.forwardRef(({ artifactCount =
|
|
|
6059
6081
|
});
|
|
6060
6082
|
ArtifactsPanelToggle.displayName = "ArtifactsPanelToggle";
|
|
6061
6083
|
|
|
6062
|
-
// src/components/chat/
|
|
6084
|
+
// src/components/chat/HistoryPanel.tsx
|
|
6063
6085
|
var import_react73 = __toESM(require("react"));
|
|
6086
|
+
function parseTimestamp(ts) {
|
|
6087
|
+
if (ts == null) {
|
|
6088
|
+
return null;
|
|
6089
|
+
}
|
|
6090
|
+
const d = ts instanceof Date ? ts : new Date(ts);
|
|
6091
|
+
return Number.isNaN(d.getTime()) ? null : d;
|
|
6092
|
+
}
|
|
6093
|
+
function startOfDay(d) {
|
|
6094
|
+
const x = new Date(d);
|
|
6095
|
+
x.setHours(0, 0, 0, 0);
|
|
6096
|
+
return x;
|
|
6097
|
+
}
|
|
6098
|
+
function groupConversations(conversations) {
|
|
6099
|
+
const today = startOfDay(/* @__PURE__ */ new Date());
|
|
6100
|
+
const yesterday = new Date(today);
|
|
6101
|
+
yesterday.setDate(yesterday.getDate() - 1);
|
|
6102
|
+
const todayList = [];
|
|
6103
|
+
const yesterdayList = [];
|
|
6104
|
+
const olderList = [];
|
|
6105
|
+
for (const c of conversations) {
|
|
6106
|
+
const d = parseTimestamp(c.timestamp);
|
|
6107
|
+
if (d && d >= today) {
|
|
6108
|
+
todayList.push(c);
|
|
6109
|
+
} else if (d && d >= yesterday) {
|
|
6110
|
+
yesterdayList.push(c);
|
|
6111
|
+
} else {
|
|
6112
|
+
olderList.push(c);
|
|
6113
|
+
}
|
|
6114
|
+
}
|
|
6115
|
+
return [
|
|
6116
|
+
{ key: "today", label: "Today", conversations: todayList },
|
|
6117
|
+
{ key: "yesterday", label: "Yesterday", conversations: yesterdayList },
|
|
6118
|
+
{ key: "older", label: "Older", conversations: olderList }
|
|
6119
|
+
].filter((g) => g.conversations.length > 0);
|
|
6120
|
+
}
|
|
6121
|
+
function ChevronDownIcon({ className }) {
|
|
6122
|
+
return /* @__PURE__ */ import_react73.default.createElement(
|
|
6123
|
+
"svg",
|
|
6124
|
+
{
|
|
6125
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6126
|
+
viewBox: "0 0 20 20",
|
|
6127
|
+
fill: "currentColor",
|
|
6128
|
+
className,
|
|
6129
|
+
"aria-hidden": "true"
|
|
6130
|
+
},
|
|
6131
|
+
/* @__PURE__ */ import_react73.default.createElement(
|
|
6132
|
+
"path",
|
|
6133
|
+
{
|
|
6134
|
+
fillRule: "evenodd",
|
|
6135
|
+
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",
|
|
6136
|
+
clipRule: "evenodd"
|
|
6137
|
+
}
|
|
6138
|
+
)
|
|
6139
|
+
);
|
|
6140
|
+
}
|
|
6141
|
+
function PencilIcon2({ className }) {
|
|
6142
|
+
return /* @__PURE__ */ import_react73.default.createElement(
|
|
6143
|
+
"svg",
|
|
6144
|
+
{
|
|
6145
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6146
|
+
viewBox: "0 0 20 20",
|
|
6147
|
+
fill: "currentColor",
|
|
6148
|
+
className,
|
|
6149
|
+
"aria-hidden": "true"
|
|
6150
|
+
},
|
|
6151
|
+
/* @__PURE__ */ import_react73.default.createElement(
|
|
6152
|
+
"path",
|
|
6153
|
+
{
|
|
6154
|
+
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"
|
|
6155
|
+
}
|
|
6156
|
+
)
|
|
6157
|
+
);
|
|
6158
|
+
}
|
|
6159
|
+
function ProjectFilter({
|
|
6160
|
+
projects,
|
|
6161
|
+
value,
|
|
6162
|
+
onChange,
|
|
6163
|
+
className
|
|
6164
|
+
}) {
|
|
6165
|
+
const [open, setOpen] = (0, import_react73.useState)(false);
|
|
6166
|
+
const ref = (0, import_react73.useRef)(null);
|
|
6167
|
+
(0, import_react73.useEffect)(() => {
|
|
6168
|
+
if (!open) {
|
|
6169
|
+
return;
|
|
6170
|
+
}
|
|
6171
|
+
const handler = (e) => {
|
|
6172
|
+
if (ref.current && !ref.current.contains(e.target)) {
|
|
6173
|
+
setOpen(false);
|
|
6174
|
+
}
|
|
6175
|
+
};
|
|
6176
|
+
document.addEventListener("mousedown", handler);
|
|
6177
|
+
return () => document.removeEventListener("mousedown", handler);
|
|
6178
|
+
}, [open]);
|
|
6179
|
+
const label = value ?? "All projects";
|
|
6180
|
+
return /* @__PURE__ */ import_react73.default.createElement("div", { className: cx("relative min-w-0", className), ref }, /* @__PURE__ */ import_react73.default.createElement(
|
|
6181
|
+
"button",
|
|
6182
|
+
{
|
|
6183
|
+
type: "button",
|
|
6184
|
+
onClick: () => setOpen((o) => !o),
|
|
6185
|
+
"aria-haspopup": "listbox",
|
|
6186
|
+
"aria-expanded": open,
|
|
6187
|
+
className: cx(
|
|
6188
|
+
"w-full flex items-center justify-between gap-1 px-2 py-1.5",
|
|
6189
|
+
"bg-obsidian/60 hover:bg-ash/30",
|
|
6190
|
+
"text-silver hover:text-white",
|
|
6191
|
+
"border border-ash/40",
|
|
6192
|
+
"text-xs",
|
|
6193
|
+
"transition-colors duration-150 min-w-0"
|
|
6194
|
+
)
|
|
6195
|
+
},
|
|
6196
|
+
/* @__PURE__ */ import_react73.default.createElement("span", { className: "truncate" }, label),
|
|
6197
|
+
/* @__PURE__ */ import_react73.default.createElement(ChevronDownIcon, { className: "w-3 h-3 shrink-0" })
|
|
6198
|
+
), open && /* @__PURE__ */ import_react73.default.createElement(
|
|
6199
|
+
"div",
|
|
6200
|
+
{
|
|
6201
|
+
role: "listbox",
|
|
6202
|
+
className: cx(
|
|
6203
|
+
"absolute top-full left-0 right-0 mt-1 z-20",
|
|
6204
|
+
"bg-charcoal border border-ash/40",
|
|
6205
|
+
"max-h-60 overflow-y-auto"
|
|
6206
|
+
)
|
|
6207
|
+
},
|
|
6208
|
+
/* @__PURE__ */ import_react73.default.createElement(
|
|
6209
|
+
"button",
|
|
6210
|
+
{
|
|
6211
|
+
type: "button",
|
|
6212
|
+
role: "option",
|
|
6213
|
+
"aria-selected": value === null,
|
|
6214
|
+
onClick: () => {
|
|
6215
|
+
onChange(null);
|
|
6216
|
+
setOpen(false);
|
|
6217
|
+
},
|
|
6218
|
+
className: cx(
|
|
6219
|
+
"w-full px-2 py-1.5 text-left text-xs truncate",
|
|
6220
|
+
"transition-colors duration-150",
|
|
6221
|
+
value === null ? "bg-gold/10 text-gold" : "text-silver hover:bg-ash/20 hover:text-white"
|
|
6222
|
+
)
|
|
6223
|
+
},
|
|
6224
|
+
"All projects"
|
|
6225
|
+
),
|
|
6226
|
+
projects.map((p) => /* @__PURE__ */ import_react73.default.createElement(
|
|
6227
|
+
"button",
|
|
6228
|
+
{
|
|
6229
|
+
key: p,
|
|
6230
|
+
type: "button",
|
|
6231
|
+
role: "option",
|
|
6232
|
+
"aria-selected": value === p,
|
|
6233
|
+
onClick: () => {
|
|
6234
|
+
onChange(p);
|
|
6235
|
+
setOpen(false);
|
|
6236
|
+
},
|
|
6237
|
+
className: cx(
|
|
6238
|
+
"w-full px-2 py-1.5 text-left text-xs truncate",
|
|
6239
|
+
"transition-colors duration-150",
|
|
6240
|
+
value === p ? "bg-gold/10 text-gold" : "text-silver hover:bg-ash/20 hover:text-white"
|
|
6241
|
+
)
|
|
6242
|
+
},
|
|
6243
|
+
p
|
|
6244
|
+
))
|
|
6245
|
+
));
|
|
6246
|
+
}
|
|
6247
|
+
function ConversationRow({
|
|
6248
|
+
conversation,
|
|
6249
|
+
onSelect,
|
|
6250
|
+
onRename
|
|
6251
|
+
}) {
|
|
6252
|
+
const [isEditing, setIsEditing] = (0, import_react73.useState)(false);
|
|
6253
|
+
const [draft, setDraft] = (0, import_react73.useState)(conversation.title);
|
|
6254
|
+
const inputRef = (0, import_react73.useRef)(null);
|
|
6255
|
+
(0, import_react73.useEffect)(() => {
|
|
6256
|
+
if (isEditing && inputRef.current) {
|
|
6257
|
+
inputRef.current.focus();
|
|
6258
|
+
inputRef.current.select();
|
|
6259
|
+
}
|
|
6260
|
+
}, [isEditing]);
|
|
6261
|
+
const startEdit = (0, import_react73.useCallback)((e) => {
|
|
6262
|
+
e.stopPropagation();
|
|
6263
|
+
setDraft(conversation.title);
|
|
6264
|
+
setIsEditing(true);
|
|
6265
|
+
}, [conversation.title]);
|
|
6266
|
+
const commit = (0, import_react73.useCallback)(() => {
|
|
6267
|
+
const trimmed = draft.trim();
|
|
6268
|
+
if (trimmed && trimmed !== conversation.title) {
|
|
6269
|
+
onRename?.(conversation.id, trimmed);
|
|
6270
|
+
}
|
|
6271
|
+
setIsEditing(false);
|
|
6272
|
+
}, [draft, conversation.id, conversation.title, onRename]);
|
|
6273
|
+
const cancel = (0, import_react73.useCallback)(() => {
|
|
6274
|
+
setDraft(conversation.title);
|
|
6275
|
+
setIsEditing(false);
|
|
6276
|
+
}, [conversation.title]);
|
|
6277
|
+
if (isEditing) {
|
|
6278
|
+
return /* @__PURE__ */ import_react73.default.createElement(
|
|
6279
|
+
"div",
|
|
6280
|
+
{
|
|
6281
|
+
className: cx(
|
|
6282
|
+
"w-full px-3 py-2",
|
|
6283
|
+
conversation.isActive ? "bg-ash/40" : "bg-ash/20"
|
|
6284
|
+
)
|
|
6285
|
+
},
|
|
6286
|
+
/* @__PURE__ */ import_react73.default.createElement(
|
|
6287
|
+
"input",
|
|
6288
|
+
{
|
|
6289
|
+
ref: inputRef,
|
|
6290
|
+
type: "text",
|
|
6291
|
+
value: draft,
|
|
6292
|
+
onChange: (e) => setDraft(e.target.value),
|
|
6293
|
+
onBlur: commit,
|
|
6294
|
+
onKeyDown: (e) => {
|
|
6295
|
+
if (e.key === "Enter") {
|
|
6296
|
+
e.preventDefault();
|
|
6297
|
+
commit();
|
|
6298
|
+
} else if (e.key === "Escape") {
|
|
6299
|
+
e.preventDefault();
|
|
6300
|
+
cancel();
|
|
6301
|
+
}
|
|
6302
|
+
},
|
|
6303
|
+
className: cx(
|
|
6304
|
+
"w-full px-2 py-1 text-sm font-medium text-white",
|
|
6305
|
+
"bg-obsidian border border-gold/40",
|
|
6306
|
+
"outline-none focus:border-gold"
|
|
6307
|
+
),
|
|
6308
|
+
"aria-label": "Conversation title"
|
|
6309
|
+
}
|
|
6310
|
+
),
|
|
6311
|
+
conversation.project && /* @__PURE__ */ import_react73.default.createElement("p", { className: "text-xs text-silver/60 truncate mt-1" }, conversation.project)
|
|
6312
|
+
);
|
|
6313
|
+
}
|
|
6314
|
+
return /* @__PURE__ */ import_react73.default.createElement("div", { className: "relative group" }, /* @__PURE__ */ import_react73.default.createElement(
|
|
6315
|
+
"button",
|
|
6316
|
+
{
|
|
6317
|
+
onClick: () => onSelect?.(conversation.id),
|
|
6318
|
+
className: cx(
|
|
6319
|
+
"w-full px-3 py-2 text-left",
|
|
6320
|
+
"transition-colors duration-150",
|
|
6321
|
+
conversation.isActive ? "bg-ash/40 text-white" : "text-silver hover:bg-ash/20 hover:text-white"
|
|
6322
|
+
)
|
|
6323
|
+
},
|
|
6324
|
+
/* @__PURE__ */ import_react73.default.createElement(
|
|
6325
|
+
"p",
|
|
6326
|
+
{
|
|
6327
|
+
className: cx(
|
|
6328
|
+
"text-sm font-medium truncate",
|
|
6329
|
+
onRename ? "pr-6" : ""
|
|
6330
|
+
)
|
|
6331
|
+
},
|
|
6332
|
+
conversation.title
|
|
6333
|
+
),
|
|
6334
|
+
conversation.project && /* @__PURE__ */ import_react73.default.createElement("p", { className: "text-xs text-silver/60 truncate mt-0.5" }, conversation.project)
|
|
6335
|
+
), onRename && /* @__PURE__ */ import_react73.default.createElement(
|
|
6336
|
+
"button",
|
|
6337
|
+
{
|
|
6338
|
+
type: "button",
|
|
6339
|
+
onClick: startEdit,
|
|
6340
|
+
"aria-label": "Rename conversation",
|
|
6341
|
+
className: cx(
|
|
6342
|
+
"absolute right-2 top-2",
|
|
6343
|
+
"p-1 text-silver/60 hover:text-gold hover:bg-ash/40",
|
|
6344
|
+
"opacity-0 group-hover:opacity-100 focus:opacity-100",
|
|
6345
|
+
"transition-opacity duration-150"
|
|
6346
|
+
)
|
|
6347
|
+
},
|
|
6348
|
+
/* @__PURE__ */ import_react73.default.createElement(PencilIcon2, { className: "w-3.5 h-3.5" })
|
|
6349
|
+
));
|
|
6350
|
+
}
|
|
6351
|
+
function HistoryPanel({
|
|
6352
|
+
conversations,
|
|
6353
|
+
onSelectConversation,
|
|
6354
|
+
onNewChat,
|
|
6355
|
+
onRenameConversation
|
|
6356
|
+
}) {
|
|
6357
|
+
const [projectFilter, setProjectFilter] = (0, import_react73.useState)(null);
|
|
6358
|
+
const projects = (0, import_react73.useMemo)(() => {
|
|
6359
|
+
const set = /* @__PURE__ */ new Set();
|
|
6360
|
+
for (const c of conversations) {
|
|
6361
|
+
if (c.project) {
|
|
6362
|
+
set.add(c.project);
|
|
6363
|
+
}
|
|
6364
|
+
}
|
|
6365
|
+
return Array.from(set).sort((a, b) => a.localeCompare(b));
|
|
6366
|
+
}, [conversations]);
|
|
6367
|
+
(0, import_react73.useEffect)(() => {
|
|
6368
|
+
if (projectFilter && !projects.includes(projectFilter)) {
|
|
6369
|
+
setProjectFilter(null);
|
|
6370
|
+
}
|
|
6371
|
+
}, [projects, projectFilter]);
|
|
6372
|
+
const filteredConversations = (0, import_react73.useMemo)(() => {
|
|
6373
|
+
if (!projectFilter) {
|
|
6374
|
+
return conversations;
|
|
6375
|
+
}
|
|
6376
|
+
return conversations.filter((c) => c.project === projectFilter);
|
|
6377
|
+
}, [conversations, projectFilter]);
|
|
6378
|
+
const groups = (0, import_react73.useMemo)(
|
|
6379
|
+
() => groupConversations(filteredConversations),
|
|
6380
|
+
[filteredConversations]
|
|
6381
|
+
);
|
|
6382
|
+
const hasFilter = projects.length > 0;
|
|
6383
|
+
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(
|
|
6384
|
+
ProjectFilter,
|
|
6385
|
+
{
|
|
6386
|
+
projects,
|
|
6387
|
+
value: projectFilter,
|
|
6388
|
+
onChange: setProjectFilter,
|
|
6389
|
+
className: "flex-1"
|
|
6390
|
+
}
|
|
6391
|
+
)), 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(
|
|
6392
|
+
"button",
|
|
6393
|
+
{
|
|
6394
|
+
onClick: onNewChat,
|
|
6395
|
+
className: cx(
|
|
6396
|
+
"flex items-center gap-1 px-2.5 py-1.5 shrink-0",
|
|
6397
|
+
"bg-gold/10 hover:bg-gold/20 text-gold",
|
|
6398
|
+
"border border-gold/30",
|
|
6399
|
+
"text-xs font-medium",
|
|
6400
|
+
"transition-colors duration-200"
|
|
6401
|
+
)
|
|
6402
|
+
},
|
|
6403
|
+
/* @__PURE__ */ import_react73.default.createElement(PlusIcon, { className: "w-4 h-4" }),
|
|
6404
|
+
/* @__PURE__ */ import_react73.default.createElement("span", { className: "truncate" }, "New Chat")
|
|
6405
|
+
)))), /* @__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(
|
|
6406
|
+
"span",
|
|
6407
|
+
{
|
|
6408
|
+
className: "text-xs font-medium uppercase tracking-wider text-gold/70"
|
|
6409
|
+
},
|
|
6410
|
+
group.label
|
|
6411
|
+
), /* @__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(
|
|
6412
|
+
ConversationRow,
|
|
6413
|
+
{
|
|
6414
|
+
key: conversation.id,
|
|
6415
|
+
conversation,
|
|
6416
|
+
onSelect: onSelectConversation,
|
|
6417
|
+
onRename: onRenameConversation
|
|
6418
|
+
}
|
|
6419
|
+
))))))));
|
|
6420
|
+
}
|
|
6421
|
+
|
|
6422
|
+
// src/components/chat/TodosList.tsx
|
|
6423
|
+
var import_react74 = __toESM(require("react"));
|
|
6064
6424
|
var import_lucide_react14 = require("lucide-react");
|
|
6065
6425
|
var TASK_STATUSES = {
|
|
6066
6426
|
PENDING: "pending",
|
|
@@ -6072,16 +6432,16 @@ var TASK_STATUSES = {
|
|
|
6072
6432
|
function TaskIcon({ status }) {
|
|
6073
6433
|
switch (status) {
|
|
6074
6434
|
case "done":
|
|
6075
|
-
return /* @__PURE__ */
|
|
6435
|
+
return /* @__PURE__ */ import_react74.default.createElement(CheckSquareIcon, null);
|
|
6076
6436
|
case "in_progress":
|
|
6077
|
-
return /* @__PURE__ */
|
|
6437
|
+
return /* @__PURE__ */ import_react74.default.createElement(SquareLoaderIcon, null);
|
|
6078
6438
|
case "cancelled":
|
|
6079
|
-
return /* @__PURE__ */
|
|
6439
|
+
return /* @__PURE__ */ import_react74.default.createElement(CrossSquareIcon, { variant: "cancelled" });
|
|
6080
6440
|
case "failed":
|
|
6081
|
-
return /* @__PURE__ */
|
|
6441
|
+
return /* @__PURE__ */ import_react74.default.createElement(CrossSquareIcon, { variant: "failed" });
|
|
6082
6442
|
case "pending":
|
|
6083
6443
|
default:
|
|
6084
|
-
return /* @__PURE__ */
|
|
6444
|
+
return /* @__PURE__ */ import_react74.default.createElement(EmptySquareIcon, null);
|
|
6085
6445
|
}
|
|
6086
6446
|
}
|
|
6087
6447
|
function sortTasks(tasks) {
|
|
@@ -6101,7 +6461,7 @@ function TaskItem({ task, depth = 0 }) {
|
|
|
6101
6461
|
const isSubtle = task.status === "cancelled" || task.status === "failed";
|
|
6102
6462
|
const showSubtasks = (task.status === "in_progress" || task.status === "done") && task.subtasks && task.subtasks.length > 0;
|
|
6103
6463
|
const sortedSubtasks = showSubtasks ? sortTasks(task.subtasks) : [];
|
|
6104
|
-
return /* @__PURE__ */
|
|
6464
|
+
return /* @__PURE__ */ import_react74.default.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ import_react74.default.createElement(
|
|
6105
6465
|
"div",
|
|
6106
6466
|
{
|
|
6107
6467
|
className: cx(
|
|
@@ -6109,8 +6469,8 @@ function TaskItem({ task, depth = 0 }) {
|
|
|
6109
6469
|
depth > 0 && "pl-6"
|
|
6110
6470
|
)
|
|
6111
6471
|
},
|
|
6112
|
-
/* @__PURE__ */
|
|
6113
|
-
/* @__PURE__ */
|
|
6472
|
+
/* @__PURE__ */ import_react74.default.createElement(TaskIcon, { status: task.status }),
|
|
6473
|
+
/* @__PURE__ */ import_react74.default.createElement(
|
|
6114
6474
|
"span",
|
|
6115
6475
|
{
|
|
6116
6476
|
className: cx(
|
|
@@ -6122,10 +6482,10 @@ function TaskItem({ task, depth = 0 }) {
|
|
|
6122
6482
|
)
|
|
6123
6483
|
},
|
|
6124
6484
|
task.label,
|
|
6125
|
-
task.status === "cancelled" && /* @__PURE__ */
|
|
6126
|
-
task.status === "failed" && /* @__PURE__ */
|
|
6485
|
+
task.status === "cancelled" && /* @__PURE__ */ import_react74.default.createElement("span", { className: "text-silver/40 ml-1" }, "(cancelled)"),
|
|
6486
|
+
task.status === "failed" && /* @__PURE__ */ import_react74.default.createElement("span", { className: "text-error/60 ml-1" }, "(failed)")
|
|
6127
6487
|
)
|
|
6128
|
-
), showSubtasks && /* @__PURE__ */
|
|
6488
|
+
), 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 }))));
|
|
6129
6489
|
}
|
|
6130
6490
|
function hasInProgressTask(tasks) {
|
|
6131
6491
|
return tasks.some((t) => {
|
|
@@ -6134,11 +6494,11 @@ function hasInProgressTask(tasks) {
|
|
|
6134
6494
|
return false;
|
|
6135
6495
|
});
|
|
6136
6496
|
}
|
|
6137
|
-
var TodosList =
|
|
6497
|
+
var TodosList = import_react74.default.forwardRef(
|
|
6138
6498
|
({ tasks, title = "Tasks", onStopAllTasks, className, ...rest }, ref) => {
|
|
6139
|
-
const sortedTasks = (0,
|
|
6140
|
-
const [isStopping, setIsStopping] = (0,
|
|
6141
|
-
const handleStopClick = (0,
|
|
6499
|
+
const sortedTasks = (0, import_react74.useMemo)(() => sortTasks(tasks), [tasks]);
|
|
6500
|
+
const [isStopping, setIsStopping] = (0, import_react74.useState)(false);
|
|
6501
|
+
const handleStopClick = (0, import_react74.useCallback)(async () => {
|
|
6142
6502
|
if (!onStopAllTasks || isStopping) return;
|
|
6143
6503
|
try {
|
|
6144
6504
|
setIsStopping(true);
|
|
@@ -6172,7 +6532,7 @@ var TodosList = import_react73.default.forwardRef(
|
|
|
6172
6532
|
if (tasks.length === 0) {
|
|
6173
6533
|
return null;
|
|
6174
6534
|
}
|
|
6175
|
-
return /* @__PURE__ */
|
|
6535
|
+
return /* @__PURE__ */ import_react74.default.createElement(
|
|
6176
6536
|
"div",
|
|
6177
6537
|
{
|
|
6178
6538
|
ref,
|
|
@@ -6183,16 +6543,16 @@ var TodosList = import_react73.default.forwardRef(
|
|
|
6183
6543
|
),
|
|
6184
6544
|
...rest
|
|
6185
6545
|
},
|
|
6186
|
-
/* @__PURE__ */
|
|
6546
|
+
/* @__PURE__ */ import_react74.default.createElement(
|
|
6187
6547
|
"div",
|
|
6188
6548
|
{
|
|
6189
6549
|
className: "flex items-center justify-between px-4 py-2 border-b border-ash/40 flex-shrink-0"
|
|
6190
6550
|
},
|
|
6191
|
-
/* @__PURE__ */
|
|
6192
|
-
/* @__PURE__ */
|
|
6551
|
+
/* @__PURE__ */ import_react74.default.createElement("h4", { className: "text-xs font-medium text-white" }, title),
|
|
6552
|
+
/* @__PURE__ */ import_react74.default.createElement("span", { className: "text-xs text-silver/60" }, countCompleted(tasks), "/", countTotal(tasks))
|
|
6193
6553
|
),
|
|
6194
|
-
/* @__PURE__ */
|
|
6195
|
-
showStopButton && /* @__PURE__ */
|
|
6554
|
+
/* @__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 }))),
|
|
6555
|
+
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(
|
|
6196
6556
|
"button",
|
|
6197
6557
|
{
|
|
6198
6558
|
type: "button",
|
|
@@ -6209,7 +6569,7 @@ var TodosList = import_react73.default.forwardRef(
|
|
|
6209
6569
|
isStopping ? "cursor-not-allowed opacity-70" : "hover:bg-error/20"
|
|
6210
6570
|
)
|
|
6211
6571
|
},
|
|
6212
|
-
isStopping ? /* @__PURE__ */
|
|
6572
|
+
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")
|
|
6213
6573
|
))
|
|
6214
6574
|
);
|
|
6215
6575
|
}
|
|
@@ -6225,8 +6585,8 @@ function areAllTasksSettled(tasks) {
|
|
|
6225
6585
|
}
|
|
6226
6586
|
|
|
6227
6587
|
// src/components/chat/ToolSidebar.tsx
|
|
6228
|
-
var
|
|
6229
|
-
var ToolSidebar =
|
|
6588
|
+
var import_react75 = __toESM(require("react"));
|
|
6589
|
+
var ToolSidebar = import_react75.default.forwardRef(
|
|
6230
6590
|
({ tools, activeTools, onToggleTool, side, className, ...rest }, ref) => {
|
|
6231
6591
|
const topTools = tools.filter((t) => t.group === `top-${side}`);
|
|
6232
6592
|
const bottomTools = tools.filter((t) => t.group === `bottom-${side}`);
|
|
@@ -6237,7 +6597,7 @@ var ToolSidebar = import_react74.default.forwardRef(
|
|
|
6237
6597
|
};
|
|
6238
6598
|
const renderButton = (tool) => {
|
|
6239
6599
|
const active = isActive(tool.id);
|
|
6240
|
-
return /* @__PURE__ */
|
|
6600
|
+
return /* @__PURE__ */ import_react75.default.createElement(
|
|
6241
6601
|
"button",
|
|
6242
6602
|
{
|
|
6243
6603
|
key: tool.id,
|
|
@@ -6249,10 +6609,10 @@ var ToolSidebar = import_react74.default.forwardRef(
|
|
|
6249
6609
|
"aria-label": tool.label,
|
|
6250
6610
|
"aria-pressed": active
|
|
6251
6611
|
},
|
|
6252
|
-
/* @__PURE__ */
|
|
6612
|
+
/* @__PURE__ */ import_react75.default.createElement("span", { className: "w-4 h-4 block" }, tool.icon)
|
|
6253
6613
|
);
|
|
6254
6614
|
};
|
|
6255
|
-
return /* @__PURE__ */
|
|
6615
|
+
return /* @__PURE__ */ import_react75.default.createElement(
|
|
6256
6616
|
"div",
|
|
6257
6617
|
{
|
|
6258
6618
|
ref,
|
|
@@ -6263,33 +6623,42 @@ var ToolSidebar = import_react74.default.forwardRef(
|
|
|
6263
6623
|
),
|
|
6264
6624
|
...rest
|
|
6265
6625
|
},
|
|
6266
|
-
/* @__PURE__ */
|
|
6267
|
-
/* @__PURE__ */
|
|
6268
|
-
/* @__PURE__ */
|
|
6626
|
+
/* @__PURE__ */ import_react75.default.createElement("div", { className: "flex flex-col items-center gap-1" }, topTools.map(renderButton)),
|
|
6627
|
+
/* @__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" })),
|
|
6628
|
+
/* @__PURE__ */ import_react75.default.createElement("div", { className: "flex flex-col items-center gap-1" }, bottomTools.map(renderButton))
|
|
6269
6629
|
);
|
|
6270
6630
|
}
|
|
6271
6631
|
);
|
|
6272
6632
|
ToolSidebar.displayName = "ToolSidebar";
|
|
6273
6633
|
|
|
6274
6634
|
// src/components/chat/ToolPanelContainer.tsx
|
|
6275
|
-
var
|
|
6276
|
-
var ToolPanelContainer =
|
|
6277
|
-
({
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6635
|
+
var import_react76 = __toESM(require("react"));
|
|
6636
|
+
var ToolPanelContainer = import_react76.default.forwardRef(
|
|
6637
|
+
({
|
|
6638
|
+
topContent,
|
|
6639
|
+
bottomContent,
|
|
6640
|
+
width,
|
|
6641
|
+
onResizeStart,
|
|
6642
|
+
side = "right",
|
|
6643
|
+
className,
|
|
6644
|
+
initialTopPercent = 60,
|
|
6645
|
+
...rest
|
|
6646
|
+
}, ref) => {
|
|
6647
|
+
const [topPercent, setTopPercent] = (0, import_react76.useState)(initialTopPercent);
|
|
6648
|
+
const [isResizingHeight, setIsResizingHeight] = (0, import_react76.useState)(false);
|
|
6649
|
+
const containerRef = (0, import_react76.useRef)(null);
|
|
6650
|
+
const lastY = (0, import_react76.useRef)(null);
|
|
6282
6651
|
const hasBoth = topContent !== null && bottomContent !== null;
|
|
6283
|
-
const startHeightResize = (0,
|
|
6652
|
+
const startHeightResize = (0, import_react76.useCallback)((e) => {
|
|
6284
6653
|
e.preventDefault();
|
|
6285
6654
|
setIsResizingHeight(true);
|
|
6286
6655
|
lastY.current = e.clientY;
|
|
6287
6656
|
}, []);
|
|
6288
|
-
const stopHeightResize = (0,
|
|
6657
|
+
const stopHeightResize = (0, import_react76.useCallback)(() => {
|
|
6289
6658
|
setIsResizingHeight(false);
|
|
6290
6659
|
lastY.current = null;
|
|
6291
6660
|
}, []);
|
|
6292
|
-
const resizeHeight = (0,
|
|
6661
|
+
const resizeHeight = (0, import_react76.useCallback)(
|
|
6293
6662
|
(e) => {
|
|
6294
6663
|
if (!isResizingHeight || lastY.current === null || !containerRef.current) {
|
|
6295
6664
|
return;
|
|
@@ -6308,7 +6677,7 @@ var ToolPanelContainer = import_react75.default.forwardRef(
|
|
|
6308
6677
|
},
|
|
6309
6678
|
[isResizingHeight]
|
|
6310
6679
|
);
|
|
6311
|
-
(0,
|
|
6680
|
+
(0, import_react76.useEffect)(() => {
|
|
6312
6681
|
if (isResizingHeight) {
|
|
6313
6682
|
window.addEventListener("mousemove", resizeHeight);
|
|
6314
6683
|
window.addEventListener("mouseup", stopHeightResize);
|
|
@@ -6327,7 +6696,7 @@ var ToolPanelContainer = import_react75.default.forwardRef(
|
|
|
6327
6696
|
document.body.style.userSelect = "";
|
|
6328
6697
|
};
|
|
6329
6698
|
}, [isResizingHeight, resizeHeight, stopHeightResize]);
|
|
6330
|
-
return /* @__PURE__ */
|
|
6699
|
+
return /* @__PURE__ */ import_react76.default.createElement(
|
|
6331
6700
|
"div",
|
|
6332
6701
|
{
|
|
6333
6702
|
ref: (node) => {
|
|
@@ -6346,7 +6715,7 @@ var ToolPanelContainer = import_react75.default.forwardRef(
|
|
|
6346
6715
|
style: width ? { width } : void 0,
|
|
6347
6716
|
...rest
|
|
6348
6717
|
},
|
|
6349
|
-
/* @__PURE__ */
|
|
6718
|
+
/* @__PURE__ */ import_react76.default.createElement(
|
|
6350
6719
|
"div",
|
|
6351
6720
|
{
|
|
6352
6721
|
onMouseDown: onResizeStart,
|
|
@@ -6357,7 +6726,7 @@ var ToolPanelContainer = import_react75.default.forwardRef(
|
|
|
6357
6726
|
)
|
|
6358
6727
|
}
|
|
6359
6728
|
),
|
|
6360
|
-
topContent !== null && /* @__PURE__ */
|
|
6729
|
+
topContent !== null && /* @__PURE__ */ import_react76.default.createElement(
|
|
6361
6730
|
"div",
|
|
6362
6731
|
{
|
|
6363
6732
|
className: "min-h-0 overflow-hidden flex flex-col",
|
|
@@ -6365,7 +6734,7 @@ var ToolPanelContainer = import_react75.default.forwardRef(
|
|
|
6365
6734
|
},
|
|
6366
6735
|
topContent
|
|
6367
6736
|
),
|
|
6368
|
-
hasBoth && /* @__PURE__ */
|
|
6737
|
+
hasBoth && /* @__PURE__ */ import_react76.default.createElement(
|
|
6369
6738
|
"div",
|
|
6370
6739
|
{
|
|
6371
6740
|
onMouseDown: startHeightResize,
|
|
@@ -6377,7 +6746,7 @@ var ToolPanelContainer = import_react75.default.forwardRef(
|
|
|
6377
6746
|
)
|
|
6378
6747
|
}
|
|
6379
6748
|
),
|
|
6380
|
-
bottomContent !== null && /* @__PURE__ */
|
|
6749
|
+
bottomContent !== null && /* @__PURE__ */ import_react76.default.createElement(
|
|
6381
6750
|
"div",
|
|
6382
6751
|
{
|
|
6383
6752
|
className: "min-h-0 overflow-hidden flex flex-col",
|
|
@@ -6391,26 +6760,26 @@ var ToolPanelContainer = import_react75.default.forwardRef(
|
|
|
6391
6760
|
ToolPanelContainer.displayName = "ToolPanelContainer";
|
|
6392
6761
|
|
|
6393
6762
|
// src/components/chat/hooks/useResizable.ts
|
|
6394
|
-
var
|
|
6763
|
+
var import_react77 = require("react");
|
|
6395
6764
|
function useResizable({
|
|
6396
6765
|
initialWidthPercent,
|
|
6397
6766
|
minWidthPercent,
|
|
6398
6767
|
maxWidthPercent,
|
|
6399
6768
|
direction
|
|
6400
6769
|
}) {
|
|
6401
|
-
const [widthPercent, setWidthPercent] = (0,
|
|
6402
|
-
const [isResizing, setIsResizing] = (0,
|
|
6403
|
-
const lastX = (0,
|
|
6404
|
-
const startResizing = (0,
|
|
6770
|
+
const [widthPercent, setWidthPercent] = (0, import_react77.useState)(initialWidthPercent);
|
|
6771
|
+
const [isResizing, setIsResizing] = (0, import_react77.useState)(false);
|
|
6772
|
+
const lastX = (0, import_react77.useRef)(null);
|
|
6773
|
+
const startResizing = (0, import_react77.useCallback)((e) => {
|
|
6405
6774
|
e.preventDefault();
|
|
6406
6775
|
setIsResizing(true);
|
|
6407
6776
|
lastX.current = e.clientX;
|
|
6408
6777
|
}, []);
|
|
6409
|
-
const stopResizing = (0,
|
|
6778
|
+
const stopResizing = (0, import_react77.useCallback)(() => {
|
|
6410
6779
|
setIsResizing(false);
|
|
6411
6780
|
lastX.current = null;
|
|
6412
6781
|
}, []);
|
|
6413
|
-
const resize = (0,
|
|
6782
|
+
const resize = (0, import_react77.useCallback)(
|
|
6414
6783
|
(e) => {
|
|
6415
6784
|
if (!isResizing || lastX.current === null) {
|
|
6416
6785
|
return;
|
|
@@ -6426,7 +6795,7 @@ function useResizable({
|
|
|
6426
6795
|
},
|
|
6427
6796
|
[isResizing, direction, minWidthPercent, maxWidthPercent]
|
|
6428
6797
|
);
|
|
6429
|
-
(0,
|
|
6798
|
+
(0, import_react77.useEffect)(() => {
|
|
6430
6799
|
if (isResizing) {
|
|
6431
6800
|
window.addEventListener("mousemove", resize);
|
|
6432
6801
|
window.addEventListener("mouseup", stopResizing);
|
|
@@ -6450,7 +6819,7 @@ function useResizable({
|
|
|
6450
6819
|
}
|
|
6451
6820
|
|
|
6452
6821
|
// src/components/chat/ChatInterface.tsx
|
|
6453
|
-
var ChatInterface =
|
|
6822
|
+
var ChatInterface = import_react78.default.forwardRef(
|
|
6454
6823
|
({
|
|
6455
6824
|
messages = [],
|
|
6456
6825
|
conversationTree,
|
|
@@ -6462,6 +6831,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6462
6831
|
onStop,
|
|
6463
6832
|
onSelectConversation,
|
|
6464
6833
|
onNewChat,
|
|
6834
|
+
onRenameConversation,
|
|
6465
6835
|
isStreaming = false,
|
|
6466
6836
|
isThinking = false,
|
|
6467
6837
|
placeholder = "Send a message...",
|
|
@@ -6477,21 +6847,24 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6477
6847
|
tasks = [],
|
|
6478
6848
|
tasksTitle,
|
|
6479
6849
|
onStopAllTasks,
|
|
6850
|
+
inputNotice,
|
|
6851
|
+
onInputChange,
|
|
6480
6852
|
tools: externalTools = [],
|
|
6853
|
+
autoFocus = true,
|
|
6481
6854
|
className,
|
|
6482
6855
|
...rest
|
|
6483
6856
|
}, ref) => {
|
|
6484
|
-
const prevArtifactNodesRef = (0,
|
|
6485
|
-
const prevTasksRef = (0,
|
|
6486
|
-
const [internalTools, setInternalTools] = (0,
|
|
6857
|
+
const prevArtifactNodesRef = (0, import_react78.useRef)([]);
|
|
6858
|
+
const prevTasksRef = (0, import_react78.useRef)([]);
|
|
6859
|
+
const [internalTools, setInternalTools] = (0, import_react78.useState)({
|
|
6487
6860
|
"top-left": "history",
|
|
6488
6861
|
"bottom-left": null,
|
|
6489
6862
|
"top-right": null,
|
|
6490
6863
|
"bottom-right": null
|
|
6491
6864
|
});
|
|
6492
|
-
const dismissedToolsRef = (0,
|
|
6865
|
+
const dismissedToolsRef = (0, import_react78.useRef)(/* @__PURE__ */ new Set());
|
|
6493
6866
|
const isPanelControlled = isArtifactsPanelOpen !== void 0;
|
|
6494
|
-
const activeTools = (0,
|
|
6867
|
+
const activeTools = (0, import_react78.useMemo)(() => {
|
|
6495
6868
|
if (isPanelControlled) {
|
|
6496
6869
|
return {
|
|
6497
6870
|
...internalTools,
|
|
@@ -6506,9 +6879,9 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6506
6879
|
width: rightToolsWidth,
|
|
6507
6880
|
startResizing: startResizingRightTools
|
|
6508
6881
|
} = useResizable({
|
|
6509
|
-
initialWidthPercent:
|
|
6510
|
-
minWidthPercent:
|
|
6511
|
-
maxWidthPercent:
|
|
6882
|
+
initialWidthPercent: 40,
|
|
6883
|
+
minWidthPercent: 30,
|
|
6884
|
+
maxWidthPercent: 80,
|
|
6512
6885
|
direction: "left"
|
|
6513
6886
|
});
|
|
6514
6887
|
const {
|
|
@@ -6521,13 +6894,13 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6521
6894
|
direction: "right"
|
|
6522
6895
|
});
|
|
6523
6896
|
const allSettled = tasks.length === 0 || areAllTasksSettled(tasks);
|
|
6524
|
-
const allToolDefinitions = (0,
|
|
6897
|
+
const allToolDefinitions = (0, import_react78.useMemo)(() => {
|
|
6525
6898
|
const builtIn = [
|
|
6526
|
-
{ id: "history", icon: /* @__PURE__ */
|
|
6527
|
-
{ id: "artifacts", icon: /* @__PURE__ */
|
|
6899
|
+
{ id: "history", icon: /* @__PURE__ */ import_react78.default.createElement(ChatBubbleIcon, null), label: "History", group: "top-left" },
|
|
6900
|
+
{ id: "artifacts", icon: /* @__PURE__ */ import_react78.default.createElement(MediaIcon, null), label: "Artifacts", group: "top-right" },
|
|
6528
6901
|
{
|
|
6529
6902
|
id: "todos",
|
|
6530
|
-
icon: allSettled ? /* @__PURE__ */
|
|
6903
|
+
icon: allSettled ? /* @__PURE__ */ import_react78.default.createElement(CheckSquareIcon, null) : /* @__PURE__ */ import_react78.default.createElement(SquareLoaderIcon, null),
|
|
6531
6904
|
label: "Tasks",
|
|
6532
6905
|
group: "bottom-right"
|
|
6533
6906
|
}
|
|
@@ -6535,7 +6908,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6535
6908
|
const external = externalTools.map(({ content: _content, ...def }) => def);
|
|
6536
6909
|
return [...builtIn, ...external];
|
|
6537
6910
|
}, [allSettled, externalTools]);
|
|
6538
|
-
const toggleTool = (0,
|
|
6911
|
+
const toggleTool = (0, import_react78.useCallback)((toolId) => {
|
|
6539
6912
|
const toolDef = allToolDefinitions.find((t) => t.id === toolId);
|
|
6540
6913
|
if (!toolDef) {
|
|
6541
6914
|
return;
|
|
@@ -6565,7 +6938,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6565
6938
|
});
|
|
6566
6939
|
}, [allToolDefinitions, isPanelControlled, activeTools, onArtifactsPanelOpenChange]);
|
|
6567
6940
|
const isTreeMode = !!conversationTree;
|
|
6568
|
-
const effectiveMessages = (0,
|
|
6941
|
+
const effectiveMessages = (0, import_react78.useMemo)(() => {
|
|
6569
6942
|
if (isTreeMode && conversationTree) {
|
|
6570
6943
|
const pathNodes = getActivePathMessages(conversationTree);
|
|
6571
6944
|
return pathNodes.map((node) => ({
|
|
@@ -6577,7 +6950,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6577
6950
|
}
|
|
6578
6951
|
return messages;
|
|
6579
6952
|
}, [isTreeMode, conversationTree, messages]);
|
|
6580
|
-
const latestUserMessageIndex = (0,
|
|
6953
|
+
const latestUserMessageIndex = (0, import_react78.useMemo)(() => {
|
|
6581
6954
|
for (let i = effectiveMessages.length - 1; i >= 0; i--) {
|
|
6582
6955
|
if (effectiveMessages[i].variant === "user") {
|
|
6583
6956
|
return i;
|
|
@@ -6585,7 +6958,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6585
6958
|
}
|
|
6586
6959
|
return -1;
|
|
6587
6960
|
}, [effectiveMessages]);
|
|
6588
|
-
(0,
|
|
6961
|
+
(0, import_react78.useEffect)(() => {
|
|
6589
6962
|
const nodes = artifactNodes || [];
|
|
6590
6963
|
const prevNodes = prevArtifactNodesRef.current;
|
|
6591
6964
|
const hasNewOrChangedNode = nodes.length !== prevNodes.length || nodes.some((n, i) => n.id !== prevNodes[i]?.id);
|
|
@@ -6601,10 +6974,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6601
6974
|
if (c.status !== p.status || c.label !== p.label) {
|
|
6602
6975
|
return true;
|
|
6603
6976
|
}
|
|
6604
|
-
|
|
6605
|
-
return true;
|
|
6606
|
-
}
|
|
6607
|
-
return false;
|
|
6977
|
+
return !!(c.subtasks && hasNewOrUpdatedTask(c.subtasks, p?.subtasks || []));
|
|
6608
6978
|
});
|
|
6609
6979
|
};
|
|
6610
6980
|
if (hasNewOrUpdatedTask(tasks, prevTasksRef.current) && !dismissedToolsRef.current.has("todos")) {
|
|
@@ -6613,7 +6983,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6613
6983
|
prevArtifactNodesRef.current = nodes;
|
|
6614
6984
|
prevTasksRef.current = tasks;
|
|
6615
6985
|
}, [artifactNodes, tasks, isPanelControlled]);
|
|
6616
|
-
const handleBranchSwitch = (0,
|
|
6986
|
+
const handleBranchSwitch = (0, import_react78.useCallback)(
|
|
6617
6987
|
(nodeId, direction) => {
|
|
6618
6988
|
if (!isTreeMode || !conversationTree || !onTreeChange) {
|
|
6619
6989
|
return;
|
|
@@ -6623,7 +6993,7 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6623
6993
|
},
|
|
6624
6994
|
[isTreeMode, conversationTree, onTreeChange]
|
|
6625
6995
|
);
|
|
6626
|
-
const displayMessages = (0,
|
|
6996
|
+
const displayMessages = (0, import_react78.useMemo)(() => {
|
|
6627
6997
|
return effectiveMessages.map((msg) => {
|
|
6628
6998
|
let branchInfo = void 0;
|
|
6629
6999
|
if (isTreeMode && conversationTree) {
|
|
@@ -6653,18 +7023,18 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6653
7023
|
onRetryMessage,
|
|
6654
7024
|
handleBranchSwitch
|
|
6655
7025
|
]);
|
|
6656
|
-
const handleSubmit = (0,
|
|
7026
|
+
const handleSubmit = (0, import_react78.useCallback)(
|
|
6657
7027
|
(message, attachments) => {
|
|
6658
7028
|
onMessageSubmit?.(message, attachments);
|
|
6659
7029
|
},
|
|
6660
7030
|
[onMessageSubmit]
|
|
6661
7031
|
);
|
|
6662
7032
|
const isEmpty = effectiveMessages.length === 0;
|
|
6663
|
-
const leftToolDefs = (0,
|
|
7033
|
+
const leftToolDefs = (0, import_react78.useMemo)(
|
|
6664
7034
|
() => allToolDefinitions.filter((t) => t.group === "top-left" || t.group === "bottom-left"),
|
|
6665
7035
|
[allToolDefinitions]
|
|
6666
7036
|
);
|
|
6667
|
-
const rightToolDefs = (0,
|
|
7037
|
+
const rightToolDefs = (0, import_react78.useMemo)(
|
|
6668
7038
|
() => allToolDefinitions.filter(
|
|
6669
7039
|
(t) => t.group === "top-right" || t.group === "bottom-right"
|
|
6670
7040
|
),
|
|
@@ -6678,58 +7048,17 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6678
7048
|
}
|
|
6679
7049
|
switch (toolId) {
|
|
6680
7050
|
case "history":
|
|
6681
|
-
return /* @__PURE__ */
|
|
6682
|
-
|
|
6683
|
-
{
|
|
6684
|
-
className: "flex items-center justify-between p-4 border-b border-ash/40 shrink-0"
|
|
6685
|
-
},
|
|
6686
|
-
/* @__PURE__ */ import_react77.default.createElement("h3", { className: "text-xs font-medium text-white" }, "History"),
|
|
6687
|
-
onNewChat && /* @__PURE__ */ import_react77.default.createElement(
|
|
6688
|
-
"button",
|
|
6689
|
-
{
|
|
6690
|
-
onClick: onNewChat,
|
|
6691
|
-
className: cx(
|
|
6692
|
-
"flex px-3 py-1.5",
|
|
6693
|
-
"bg-gold/10 hover:bg-gold/20 text-gold",
|
|
6694
|
-
"border border-gold/30",
|
|
6695
|
-
"text-xs font-medium",
|
|
6696
|
-
"transition-colors duration-200"
|
|
6697
|
-
)
|
|
6698
|
-
},
|
|
6699
|
-
/* @__PURE__ */ import_react77.default.createElement(
|
|
6700
|
-
"svg",
|
|
6701
|
-
{
|
|
6702
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
6703
|
-
viewBox: "0 0 20 20",
|
|
6704
|
-
fill: "currentColor",
|
|
6705
|
-
className: "w-4 h-4"
|
|
6706
|
-
},
|
|
6707
|
-
/* @__PURE__ */ import_react77.default.createElement(
|
|
6708
|
-
"path",
|
|
6709
|
-
{
|
|
6710
|
-
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"
|
|
6711
|
-
}
|
|
6712
|
-
)
|
|
6713
|
-
),
|
|
6714
|
-
"New Chat"
|
|
6715
|
-
)
|
|
6716
|
-
), /* @__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(
|
|
6717
|
-
"button",
|
|
7051
|
+
return /* @__PURE__ */ import_react78.default.createElement(
|
|
7052
|
+
HistoryPanel,
|
|
6718
7053
|
{
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
)
|
|
6726
|
-
},
|
|
6727
|
-
/* @__PURE__ */ import_react77.default.createElement("p", { className: "text-sm font-medium truncate" }, conversation.title),
|
|
6728
|
-
conversation.preview && /* @__PURE__ */ import_react77.default.createElement("p", { className: "text-xs text-silver/60 truncate mt-0.5" }, conversation.preview),
|
|
6729
|
-
conversation.timestamp && /* @__PURE__ */ import_react77.default.createElement("p", { className: "text-xs text-silver/40 mt-1" }, conversation.timestamp)
|
|
6730
|
-
)))));
|
|
7054
|
+
conversations,
|
|
7055
|
+
onSelectConversation,
|
|
7056
|
+
onNewChat,
|
|
7057
|
+
onRenameConversation
|
|
7058
|
+
}
|
|
7059
|
+
);
|
|
6731
7060
|
case "artifacts":
|
|
6732
|
-
return /* @__PURE__ */
|
|
7061
|
+
return /* @__PURE__ */ import_react78.default.createElement(
|
|
6733
7062
|
ArtifactsPanel,
|
|
6734
7063
|
{
|
|
6735
7064
|
nodes: artifactNodes,
|
|
@@ -6737,21 +7066,29 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6737
7066
|
}
|
|
6738
7067
|
);
|
|
6739
7068
|
case "todos":
|
|
6740
|
-
return tasks.length > 0 ? /* @__PURE__ */
|
|
7069
|
+
return tasks.length > 0 ? /* @__PURE__ */ import_react78.default.createElement(
|
|
7070
|
+
TodosList,
|
|
7071
|
+
{
|
|
7072
|
+
tasks,
|
|
7073
|
+
title: tasksTitle,
|
|
7074
|
+
onStopAllTasks,
|
|
7075
|
+
className: "h-full"
|
|
7076
|
+
}
|
|
7077
|
+
) : /* @__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")));
|
|
6741
7078
|
default: {
|
|
6742
7079
|
const externalTool = externalTools.find((t) => t.id === toolId);
|
|
6743
7080
|
return externalTool?.content ?? null;
|
|
6744
7081
|
}
|
|
6745
7082
|
}
|
|
6746
7083
|
};
|
|
6747
|
-
return /* @__PURE__ */
|
|
7084
|
+
return /* @__PURE__ */ import_react78.default.createElement(
|
|
6748
7085
|
"div",
|
|
6749
7086
|
{
|
|
6750
7087
|
ref,
|
|
6751
7088
|
className: cx("flex h-full w-full bg-obsidian overflow-hidden", className),
|
|
6752
7089
|
...rest
|
|
6753
7090
|
},
|
|
6754
|
-
hasLeftTools && /* @__PURE__ */
|
|
7091
|
+
hasLeftTools && /* @__PURE__ */ import_react78.default.createElement(
|
|
6755
7092
|
ToolSidebar,
|
|
6756
7093
|
{
|
|
6757
7094
|
tools: leftToolDefs,
|
|
@@ -6760,26 +7097,27 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6760
7097
|
side: "left"
|
|
6761
7098
|
}
|
|
6762
7099
|
),
|
|
6763
|
-
isLeftPanelOpen && /* @__PURE__ */
|
|
7100
|
+
isLeftPanelOpen && /* @__PURE__ */ import_react78.default.createElement(
|
|
6764
7101
|
ToolPanelContainer,
|
|
6765
7102
|
{
|
|
6766
7103
|
topContent: renderToolContent(activeTools["top-left"]),
|
|
6767
7104
|
bottomContent: renderToolContent(activeTools["bottom-left"]),
|
|
6768
7105
|
width: leftToolsWidth,
|
|
6769
7106
|
onResizeStart: startResizingLeftTools,
|
|
6770
|
-
side: "left"
|
|
7107
|
+
side: "left",
|
|
7108
|
+
initialTopPercent: 30
|
|
6771
7109
|
}
|
|
6772
7110
|
),
|
|
6773
|
-
/* @__PURE__ */
|
|
7111
|
+
/* @__PURE__ */ import_react78.default.createElement("div", { className: "flex-1 flex flex-col min-w-0 relative" }, /* @__PURE__ */ import_react78.default.createElement("div", { className: cx(
|
|
6774
7112
|
"flex-1 flex flex-col min-h-0 relative",
|
|
6775
7113
|
isEmpty ? "justify-center" : "justify-start"
|
|
6776
|
-
) }, /* @__PURE__ */
|
|
7114
|
+
) }, /* @__PURE__ */ import_react78.default.createElement("div", { className: cx(
|
|
6777
7115
|
"transition-all duration-500 ease-in-out",
|
|
6778
7116
|
isEmpty ? "flex-1" : "flex-zero"
|
|
6779
|
-
) }), /* @__PURE__ */
|
|
7117
|
+
) }), /* @__PURE__ */ import_react78.default.createElement("div", { className: cx(
|
|
6780
7118
|
"transition-all duration-500 ease-in-out overflow-hidden flex flex-col",
|
|
6781
7119
|
isEmpty ? "flex-zero opacity-0" : "flex-1 opacity-100"
|
|
6782
|
-
) }, /* @__PURE__ */
|
|
7120
|
+
) }, /* @__PURE__ */ import_react78.default.createElement(
|
|
6783
7121
|
ChatView,
|
|
6784
7122
|
{
|
|
6785
7123
|
messages: displayMessages,
|
|
@@ -6788,10 +7126,10 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6788
7126
|
isThinking,
|
|
6789
7127
|
className: "flex-1"
|
|
6790
7128
|
}
|
|
6791
|
-
)), /* @__PURE__ */
|
|
7129
|
+
)), /* @__PURE__ */ import_react78.default.createElement("div", { className: cx(
|
|
6792
7130
|
"transition-all duration-500 ease-in-out z-10 w-full flex flex-col items-center",
|
|
6793
7131
|
isEmpty ? "p-4" : "shrink-0 p-4 border-t border-ash/40 bg-obsidian"
|
|
6794
|
-
) }, isEmpty && /* @__PURE__ */
|
|
7132
|
+
) }, 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(
|
|
6795
7133
|
ChatInput,
|
|
6796
7134
|
{
|
|
6797
7135
|
position: isEmpty ? "centered" : "bottom",
|
|
@@ -6803,23 +7141,27 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6803
7141
|
onStop,
|
|
6804
7142
|
showAttachmentButton,
|
|
6805
7143
|
attachments: propsAttachments,
|
|
6806
|
-
onAttachmentsChange
|
|
7144
|
+
onAttachmentsChange,
|
|
7145
|
+
notice: inputNotice,
|
|
7146
|
+
onInputChange,
|
|
7147
|
+
autoFocus
|
|
6807
7148
|
}
|
|
6808
|
-
)), /* @__PURE__ */
|
|
7149
|
+
)), /* @__PURE__ */ import_react78.default.createElement("div", { className: cx(
|
|
6809
7150
|
"transition-all duration-500 ease-in-out",
|
|
6810
7151
|
isEmpty ? "flex-1" : "flex-zero"
|
|
6811
7152
|
) }))),
|
|
6812
|
-
isRightPanelOpen && /* @__PURE__ */
|
|
7153
|
+
isRightPanelOpen && /* @__PURE__ */ import_react78.default.createElement(
|
|
6813
7154
|
ToolPanelContainer,
|
|
6814
7155
|
{
|
|
6815
7156
|
topContent: renderToolContent(activeTools["top-right"]),
|
|
6816
7157
|
bottomContent: renderToolContent(activeTools["bottom-right"]),
|
|
6817
7158
|
width: rightToolsWidth,
|
|
6818
7159
|
onResizeStart: startResizingRightTools,
|
|
6819
|
-
side: "right"
|
|
7160
|
+
side: "right",
|
|
7161
|
+
initialTopPercent: 70
|
|
6820
7162
|
}
|
|
6821
7163
|
),
|
|
6822
|
-
hasRightTools && /* @__PURE__ */
|
|
7164
|
+
hasRightTools && /* @__PURE__ */ import_react78.default.createElement(
|
|
6823
7165
|
ToolSidebar,
|
|
6824
7166
|
{
|
|
6825
7167
|
tools: rightToolDefs,
|
|
@@ -6834,9 +7176,9 @@ var ChatInterface = import_react77.default.forwardRef(
|
|
|
6834
7176
|
ChatInterface.displayName = "ChatInterface";
|
|
6835
7177
|
|
|
6836
7178
|
// src/components/chat/MessageActions.tsx
|
|
6837
|
-
var
|
|
7179
|
+
var import_react79 = __toESM(require("react"));
|
|
6838
7180
|
var import_lucide_react15 = require("lucide-react");
|
|
6839
|
-
var ActionButton2 = ({ onClick, label, children, className, disabled }) => /* @__PURE__ */
|
|
7181
|
+
var ActionButton2 = ({ onClick, label, children, className, disabled }) => /* @__PURE__ */ import_react79.default.createElement(
|
|
6840
7182
|
"button",
|
|
6841
7183
|
{
|
|
6842
7184
|
type: "button",
|
|
@@ -6852,7 +7194,7 @@ var ActionButton2 = ({ onClick, label, children, className, disabled }) => /* @_
|
|
|
6852
7194
|
},
|
|
6853
7195
|
children
|
|
6854
7196
|
);
|
|
6855
|
-
var MessageActions =
|
|
7197
|
+
var MessageActions = import_react79.default.forwardRef(
|
|
6856
7198
|
({
|
|
6857
7199
|
variant,
|
|
6858
7200
|
content,
|
|
@@ -6864,12 +7206,12 @@ var MessageActions = import_react78.default.forwardRef(
|
|
|
6864
7206
|
className,
|
|
6865
7207
|
...rest
|
|
6866
7208
|
}, ref) => {
|
|
6867
|
-
const [localIsEditing, setLocalIsEditing] = (0,
|
|
6868
|
-
const [localEditValue, setLocalEditValue] = (0,
|
|
6869
|
-
const [copied, setCopied] = (0,
|
|
7209
|
+
const [localIsEditing, setLocalIsEditing] = (0, import_react79.useState)(false);
|
|
7210
|
+
const [localEditValue, setLocalEditValue] = (0, import_react79.useState)(content);
|
|
7211
|
+
const [copied, setCopied] = (0, import_react79.useState)(false);
|
|
6870
7212
|
const isEditing = controlledIsEditing ?? localIsEditing;
|
|
6871
7213
|
const editValue = controlledEditValue ?? localEditValue;
|
|
6872
|
-
const setIsEditing = (0,
|
|
7214
|
+
const setIsEditing = (0, import_react79.useCallback)(
|
|
6873
7215
|
(value) => {
|
|
6874
7216
|
if (onEditingChange) {
|
|
6875
7217
|
onEditingChange(value);
|
|
@@ -6879,10 +7221,10 @@ var MessageActions = import_react78.default.forwardRef(
|
|
|
6879
7221
|
},
|
|
6880
7222
|
[onEditingChange]
|
|
6881
7223
|
);
|
|
6882
|
-
const setEditValue = (0,
|
|
7224
|
+
const setEditValue = (0, import_react79.useCallback)((value) => {
|
|
6883
7225
|
setLocalEditValue(value);
|
|
6884
7226
|
}, []);
|
|
6885
|
-
const handleCopy = (0,
|
|
7227
|
+
const handleCopy = (0, import_react79.useCallback)(async () => {
|
|
6886
7228
|
try {
|
|
6887
7229
|
await navigator.clipboard.writeText(content);
|
|
6888
7230
|
setCopied(true);
|
|
@@ -6898,22 +7240,22 @@ var MessageActions = import_react78.default.forwardRef(
|
|
|
6898
7240
|
setTimeout(() => setCopied(false), 2e3);
|
|
6899
7241
|
}
|
|
6900
7242
|
}, [content]);
|
|
6901
|
-
const handleStartEdit = (0,
|
|
7243
|
+
const handleStartEdit = (0, import_react79.useCallback)(() => {
|
|
6902
7244
|
setLocalEditValue(content);
|
|
6903
7245
|
setIsEditing(true);
|
|
6904
7246
|
}, [content, setIsEditing]);
|
|
6905
|
-
const handleCancelEdit = (0,
|
|
7247
|
+
const handleCancelEdit = (0, import_react79.useCallback)(() => {
|
|
6906
7248
|
setIsEditing(false);
|
|
6907
7249
|
setLocalEditValue(content);
|
|
6908
7250
|
}, [content, setIsEditing]);
|
|
6909
|
-
const handleSubmitEdit = (0,
|
|
7251
|
+
const handleSubmitEdit = (0, import_react79.useCallback)(() => {
|
|
6910
7252
|
const trimmed = editValue.trim();
|
|
6911
7253
|
if (trimmed && trimmed !== content) {
|
|
6912
7254
|
onEdit?.(trimmed);
|
|
6913
7255
|
}
|
|
6914
7256
|
setIsEditing(false);
|
|
6915
7257
|
}, [editValue, content, onEdit, setIsEditing]);
|
|
6916
|
-
const handleEditKeyDown = (0,
|
|
7258
|
+
const handleEditKeyDown = (0, import_react79.useCallback)(
|
|
6917
7259
|
(e) => {
|
|
6918
7260
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
6919
7261
|
e.preventDefault();
|
|
@@ -6926,19 +7268,19 @@ var MessageActions = import_react78.default.forwardRef(
|
|
|
6926
7268
|
);
|
|
6927
7269
|
const isUser = variant === "user";
|
|
6928
7270
|
if (isUser && isEditing) {
|
|
6929
|
-
return /* @__PURE__ */
|
|
7271
|
+
return /* @__PURE__ */ import_react79.default.createElement(
|
|
6930
7272
|
"div",
|
|
6931
7273
|
{
|
|
6932
7274
|
ref,
|
|
6933
7275
|
className: cx("mt-2", className),
|
|
6934
7276
|
...rest
|
|
6935
7277
|
},
|
|
6936
|
-
/* @__PURE__ */
|
|
7278
|
+
/* @__PURE__ */ import_react79.default.createElement(
|
|
6937
7279
|
"div",
|
|
6938
7280
|
{
|
|
6939
7281
|
className: "relative bg-charcoal border border-ash/60 focus-within:border-gold/60 focus-within:ring-1 focus-within:ring-gold/20"
|
|
6940
7282
|
},
|
|
6941
|
-
/* @__PURE__ */
|
|
7283
|
+
/* @__PURE__ */ import_react79.default.createElement(
|
|
6942
7284
|
"textarea",
|
|
6943
7285
|
{
|
|
6944
7286
|
value: editValue,
|
|
@@ -6949,15 +7291,15 @@ var MessageActions = import_react78.default.forwardRef(
|
|
|
6949
7291
|
rows: 2
|
|
6950
7292
|
}
|
|
6951
7293
|
),
|
|
6952
|
-
/* @__PURE__ */
|
|
7294
|
+
/* @__PURE__ */ import_react79.default.createElement("div", { className: "absolute right-2 bottom-2 flex gap-1" }, /* @__PURE__ */ import_react79.default.createElement(
|
|
6953
7295
|
ActionButton2,
|
|
6954
7296
|
{
|
|
6955
7297
|
onClick: handleCancelEdit,
|
|
6956
7298
|
label: "Cancel edit",
|
|
6957
7299
|
className: "text-silver/60 hover:text-error"
|
|
6958
7300
|
},
|
|
6959
|
-
/* @__PURE__ */
|
|
6960
|
-
), /* @__PURE__ */
|
|
7301
|
+
/* @__PURE__ */ import_react79.default.createElement(import_lucide_react15.X, { className: "w-4 h-4" })
|
|
7302
|
+
), /* @__PURE__ */ import_react79.default.createElement(
|
|
6961
7303
|
ActionButton2,
|
|
6962
7304
|
{
|
|
6963
7305
|
onClick: handleSubmitEdit,
|
|
@@ -6965,13 +7307,13 @@ var MessageActions = import_react78.default.forwardRef(
|
|
|
6965
7307
|
className: "text-silver/60 hover:text-gold",
|
|
6966
7308
|
disabled: !editValue.trim() || editValue.trim() === content
|
|
6967
7309
|
},
|
|
6968
|
-
/* @__PURE__ */
|
|
7310
|
+
/* @__PURE__ */ import_react79.default.createElement(import_lucide_react15.Send, { className: "w-4 h-4" })
|
|
6969
7311
|
))
|
|
6970
7312
|
),
|
|
6971
|
-
/* @__PURE__ */
|
|
7313
|
+
/* @__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.")
|
|
6972
7314
|
);
|
|
6973
7315
|
}
|
|
6974
|
-
return /* @__PURE__ */
|
|
7316
|
+
return /* @__PURE__ */ import_react79.default.createElement(
|
|
6975
7317
|
"div",
|
|
6976
7318
|
{
|
|
6977
7319
|
ref,
|
|
@@ -6982,18 +7324,18 @@ var MessageActions = import_react78.default.forwardRef(
|
|
|
6982
7324
|
),
|
|
6983
7325
|
...rest
|
|
6984
7326
|
},
|
|
6985
|
-
/* @__PURE__ */
|
|
6986
|
-
isUser && onEdit && /* @__PURE__ */
|
|
6987
|
-
!isUser && onRetry && /* @__PURE__ */
|
|
7327
|
+
/* @__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" })),
|
|
7328
|
+
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" })),
|
|
7329
|
+
!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" }))
|
|
6988
7330
|
);
|
|
6989
7331
|
}
|
|
6990
7332
|
);
|
|
6991
7333
|
MessageActions.displayName = "MessageActions";
|
|
6992
7334
|
|
|
6993
7335
|
// src/components/chat/BranchNavigator.tsx
|
|
6994
|
-
var
|
|
7336
|
+
var import_react80 = __toESM(require("react"));
|
|
6995
7337
|
var import_lucide_react16 = require("lucide-react");
|
|
6996
|
-
var BranchNavigator =
|
|
7338
|
+
var BranchNavigator = import_react80.default.forwardRef(
|
|
6997
7339
|
({
|
|
6998
7340
|
current,
|
|
6999
7341
|
total,
|
|
@@ -7012,7 +7354,7 @@ var BranchNavigator = import_react79.default.forwardRef(
|
|
|
7012
7354
|
const buttonSize = size === "sm" ? "p-0.5" : "p-1";
|
|
7013
7355
|
const iconSize = size === "sm" ? "w-3 h-3" : "w-4 h-4";
|
|
7014
7356
|
const textSize = size === "sm" ? "text-xs" : "text-sm";
|
|
7015
|
-
return /* @__PURE__ */
|
|
7357
|
+
return /* @__PURE__ */ import_react80.default.createElement(
|
|
7016
7358
|
"div",
|
|
7017
7359
|
{
|
|
7018
7360
|
ref,
|
|
@@ -7024,8 +7366,8 @@ var BranchNavigator = import_react79.default.forwardRef(
|
|
|
7024
7366
|
"aria-label": "Branch navigation",
|
|
7025
7367
|
...rest
|
|
7026
7368
|
},
|
|
7027
|
-
showIcon && /* @__PURE__ */
|
|
7028
|
-
/* @__PURE__ */
|
|
7369
|
+
showIcon && /* @__PURE__ */ import_react80.default.createElement(import_lucide_react16.GitBranch, { className: cx(iconSize, "mr-0.5 text-silver/50"), "aria-hidden": "true" }),
|
|
7370
|
+
/* @__PURE__ */ import_react80.default.createElement(
|
|
7029
7371
|
"button",
|
|
7030
7372
|
{
|
|
7031
7373
|
type: "button",
|
|
@@ -7038,10 +7380,10 @@ var BranchNavigator = import_react79.default.forwardRef(
|
|
|
7038
7380
|
),
|
|
7039
7381
|
"aria-label": "Previous branch"
|
|
7040
7382
|
},
|
|
7041
|
-
/* @__PURE__ */
|
|
7383
|
+
/* @__PURE__ */ import_react80.default.createElement(import_lucide_react16.ChevronLeft, { className: iconSize })
|
|
7042
7384
|
),
|
|
7043
|
-
/* @__PURE__ */
|
|
7044
|
-
/* @__PURE__ */
|
|
7385
|
+
/* @__PURE__ */ import_react80.default.createElement("span", { className: cx(textSize, "tabular-nums min-w-6 text-center") }, current, "/", total),
|
|
7386
|
+
/* @__PURE__ */ import_react80.default.createElement(
|
|
7045
7387
|
"button",
|
|
7046
7388
|
{
|
|
7047
7389
|
type: "button",
|
|
@@ -7054,7 +7396,7 @@ var BranchNavigator = import_react79.default.forwardRef(
|
|
|
7054
7396
|
),
|
|
7055
7397
|
"aria-label": "Next branch"
|
|
7056
7398
|
},
|
|
7057
|
-
/* @__PURE__ */
|
|
7399
|
+
/* @__PURE__ */ import_react80.default.createElement(import_lucide_react16.ChevronRight, { className: iconSize })
|
|
7058
7400
|
)
|
|
7059
7401
|
);
|
|
7060
7402
|
}
|
|
@@ -7062,16 +7404,16 @@ var BranchNavigator = import_react79.default.forwardRef(
|
|
|
7062
7404
|
BranchNavigator.displayName = "BranchNavigator";
|
|
7063
7405
|
|
|
7064
7406
|
// src/components/BrandIcon.tsx
|
|
7065
|
-
var
|
|
7407
|
+
var import_react81 = __toESM(require("react"));
|
|
7066
7408
|
var sizeMap2 = {
|
|
7067
7409
|
sm: "h-8 w-8 text-sm",
|
|
7068
7410
|
md: "h-12 w-12 text-base",
|
|
7069
7411
|
lg: "h-16 w-16 text-lg"
|
|
7070
7412
|
};
|
|
7071
|
-
var BrandIcon =
|
|
7413
|
+
var BrandIcon = import_react81.default.forwardRef(
|
|
7072
7414
|
({ size = "md", variant = "solid", children, className, ...rest }, ref) => {
|
|
7073
7415
|
const variantClasses = variant === "solid" ? "bg-gold text-obsidian border-2 border-gold" : "bg-transparent text-gold border-2 border-gold";
|
|
7074
|
-
return /* @__PURE__ */
|
|
7416
|
+
return /* @__PURE__ */ import_react81.default.createElement(
|
|
7075
7417
|
"div",
|
|
7076
7418
|
{
|
|
7077
7419
|
ref,
|
|
@@ -7090,17 +7432,17 @@ var BrandIcon = import_react80.default.forwardRef(
|
|
|
7090
7432
|
BrandIcon.displayName = "BrandIcon";
|
|
7091
7433
|
|
|
7092
7434
|
// src/components/ColorSwatch.tsx
|
|
7093
|
-
var
|
|
7094
|
-
var ColorSwatch =
|
|
7435
|
+
var import_react82 = __toESM(require("react"));
|
|
7436
|
+
var ColorSwatch = import_react82.default.forwardRef(
|
|
7095
7437
|
({ color, label, className, ...rest }, ref) => {
|
|
7096
|
-
return /* @__PURE__ */
|
|
7438
|
+
return /* @__PURE__ */ import_react82.default.createElement(
|
|
7097
7439
|
"div",
|
|
7098
7440
|
{
|
|
7099
7441
|
ref,
|
|
7100
7442
|
className: cx("flex flex-col items-center gap-2", className),
|
|
7101
7443
|
...rest
|
|
7102
7444
|
},
|
|
7103
|
-
/* @__PURE__ */
|
|
7445
|
+
/* @__PURE__ */ import_react82.default.createElement(
|
|
7104
7446
|
"div",
|
|
7105
7447
|
{
|
|
7106
7448
|
className: "h-16 w-16 border-2 border-ash rounded-none shadow-sm",
|
|
@@ -7108,22 +7450,22 @@ var ColorSwatch = import_react81.default.forwardRef(
|
|
|
7108
7450
|
"aria-label": label || color
|
|
7109
7451
|
}
|
|
7110
7452
|
),
|
|
7111
|
-
label && /* @__PURE__ */
|
|
7453
|
+
label && /* @__PURE__ */ import_react82.default.createElement("span", { className: "text-xs text-silver font-medium" }, label)
|
|
7112
7454
|
);
|
|
7113
7455
|
}
|
|
7114
7456
|
);
|
|
7115
7457
|
ColorSwatch.displayName = "ColorSwatch";
|
|
7116
7458
|
|
|
7117
7459
|
// src/components/SectionHeading.tsx
|
|
7118
|
-
var
|
|
7460
|
+
var import_react83 = __toESM(require("react"));
|
|
7119
7461
|
var levelStyles = {
|
|
7120
7462
|
h2: "text-2xl mb-4",
|
|
7121
7463
|
h3: "text-xl mb-3"
|
|
7122
7464
|
};
|
|
7123
|
-
var SectionHeading =
|
|
7465
|
+
var SectionHeading = import_react83.default.forwardRef(
|
|
7124
7466
|
({ level = "h2", children, className, ...rest }, ref) => {
|
|
7125
7467
|
const Component = level;
|
|
7126
|
-
return /* @__PURE__ */
|
|
7468
|
+
return /* @__PURE__ */ import_react83.default.createElement(
|
|
7127
7469
|
Component,
|
|
7128
7470
|
{
|
|
7129
7471
|
ref,
|
|
@@ -7195,6 +7537,7 @@ var version = "2.0.0";
|
|
|
7195
7537
|
FileChip,
|
|
7196
7538
|
HelperText,
|
|
7197
7539
|
HistoryIcon,
|
|
7540
|
+
HistoryPanel,
|
|
7198
7541
|
ImageCard,
|
|
7199
7542
|
Input,
|
|
7200
7543
|
InputGroup,
|