@lukeashford/aurelius 2.14.0 → 2.15.1
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.js +99 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -59
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4222,7 +4222,7 @@ var StreamingCursor = import_react54.default.forwardRef(
|
|
|
4222
4222
|
StreamingCursor.displayName = "StreamingCursor";
|
|
4223
4223
|
|
|
4224
4224
|
// src/components/chat/ChatInterface.tsx
|
|
4225
|
-
var
|
|
4225
|
+
var import_react69 = __toESM(require("react"));
|
|
4226
4226
|
|
|
4227
4227
|
// src/components/chat/ChatView.tsx
|
|
4228
4228
|
var import_react58 = __toESM(require("react"));
|
|
@@ -5877,27 +5877,58 @@ var TodosList = import_react66.default.forwardRef(
|
|
|
5877
5877
|
);
|
|
5878
5878
|
TodosList.displayName = "TodosList";
|
|
5879
5879
|
|
|
5880
|
-
// src/components/chat/hooks/
|
|
5880
|
+
// src/components/chat/hooks/useArtifacts.ts
|
|
5881
5881
|
var import_react67 = require("react");
|
|
5882
|
+
function useArtifacts() {
|
|
5883
|
+
const [artifacts, setArtifacts] = (0, import_react67.useState)([]);
|
|
5884
|
+
const scheduleArtifact = (0, import_react67.useCallback)((artifact) => {
|
|
5885
|
+
setArtifacts((prev) => [...prev, { ...artifact, isPending: true }]);
|
|
5886
|
+
}, []);
|
|
5887
|
+
const showArtifact = (0, import_react67.useCallback)(
|
|
5888
|
+
(artifactId, updates) => {
|
|
5889
|
+
setArtifacts((prev) => {
|
|
5890
|
+
const existingIndex = prev.findIndex((a) => a.id === artifactId);
|
|
5891
|
+
if (existingIndex >= 0) {
|
|
5892
|
+
return prev.map(
|
|
5893
|
+
(a) => a.id === artifactId ? { ...a, ...updates, isPending: false } : a
|
|
5894
|
+
);
|
|
5895
|
+
} else {
|
|
5896
|
+
return [...prev, { id: artifactId, ...updates, isPending: false }];
|
|
5897
|
+
}
|
|
5898
|
+
});
|
|
5899
|
+
},
|
|
5900
|
+
[]
|
|
5901
|
+
);
|
|
5902
|
+
const removeArtifact = (0, import_react67.useCallback)((artifactId) => {
|
|
5903
|
+
setArtifacts((prev) => prev.filter((a) => a.id !== artifactId));
|
|
5904
|
+
}, []);
|
|
5905
|
+
const clearArtifacts = (0, import_react67.useCallback)(() => {
|
|
5906
|
+
setArtifacts([]);
|
|
5907
|
+
}, []);
|
|
5908
|
+
return { artifacts, scheduleArtifact, showArtifact, removeArtifact, clearArtifacts };
|
|
5909
|
+
}
|
|
5910
|
+
|
|
5911
|
+
// src/components/chat/hooks/useResizable.ts
|
|
5912
|
+
var import_react68 = require("react");
|
|
5882
5913
|
function useResizable({
|
|
5883
5914
|
initialWidthPercent,
|
|
5884
5915
|
minWidthPercent,
|
|
5885
5916
|
maxWidthPercent,
|
|
5886
5917
|
direction
|
|
5887
5918
|
}) {
|
|
5888
|
-
const [widthPercent, setWidthPercent] = (0,
|
|
5889
|
-
const [isResizing, setIsResizing] = (0,
|
|
5890
|
-
const lastX = (0,
|
|
5891
|
-
const startResizing = (0,
|
|
5919
|
+
const [widthPercent, setWidthPercent] = (0, import_react68.useState)(initialWidthPercent);
|
|
5920
|
+
const [isResizing, setIsResizing] = (0, import_react68.useState)(false);
|
|
5921
|
+
const lastX = (0, import_react68.useRef)(null);
|
|
5922
|
+
const startResizing = (0, import_react68.useCallback)((e) => {
|
|
5892
5923
|
e.preventDefault();
|
|
5893
5924
|
setIsResizing(true);
|
|
5894
5925
|
lastX.current = e.clientX;
|
|
5895
5926
|
}, []);
|
|
5896
|
-
const stopResizing = (0,
|
|
5927
|
+
const stopResizing = (0, import_react68.useCallback)(() => {
|
|
5897
5928
|
setIsResizing(false);
|
|
5898
5929
|
lastX.current = null;
|
|
5899
5930
|
}, []);
|
|
5900
|
-
const resize = (0,
|
|
5931
|
+
const resize = (0, import_react68.useCallback)(
|
|
5901
5932
|
(e) => {
|
|
5902
5933
|
if (!isResizing || lastX.current === null) {
|
|
5903
5934
|
return;
|
|
@@ -5913,7 +5944,7 @@ function useResizable({
|
|
|
5913
5944
|
},
|
|
5914
5945
|
[isResizing, direction, minWidthPercent, maxWidthPercent]
|
|
5915
5946
|
);
|
|
5916
|
-
(0,
|
|
5947
|
+
(0, import_react68.useEffect)(() => {
|
|
5917
5948
|
if (isResizing) {
|
|
5918
5949
|
window.addEventListener("mousemove", resize);
|
|
5919
5950
|
window.addEventListener("mouseup", stopResizing);
|
|
@@ -5937,7 +5968,7 @@ function useResizable({
|
|
|
5937
5968
|
}
|
|
5938
5969
|
|
|
5939
5970
|
// src/components/chat/ChatInterface.tsx
|
|
5940
|
-
var ChatInterface =
|
|
5971
|
+
var ChatInterface = import_react69.default.forwardRef(
|
|
5941
5972
|
({
|
|
5942
5973
|
messages = [],
|
|
5943
5974
|
conversationTree,
|
|
@@ -5952,7 +5983,7 @@ var ChatInterface = import_react68.default.forwardRef(
|
|
|
5952
5983
|
isStreaming = false,
|
|
5953
5984
|
isThinking = false,
|
|
5954
5985
|
placeholder = "Send a message...",
|
|
5955
|
-
emptyStateHelper = "
|
|
5986
|
+
emptyStateHelper = "Let's talk.",
|
|
5956
5987
|
initialSidebarCollapsed = false,
|
|
5957
5988
|
emptyState,
|
|
5958
5989
|
showAttachmentButton = true,
|
|
@@ -5967,8 +5998,8 @@ var ChatInterface = import_react68.default.forwardRef(
|
|
|
5967
5998
|
className,
|
|
5968
5999
|
...rest
|
|
5969
6000
|
}, ref) => {
|
|
5970
|
-
const [sidebarCollapsed, setSidebarCollapsed] = (0,
|
|
5971
|
-
const [internalPanelOpen, setInternalPanelOpen] = (0,
|
|
6001
|
+
const [sidebarCollapsed, setSidebarCollapsed] = (0, import_react69.useState)(initialSidebarCollapsed);
|
|
6002
|
+
const [internalPanelOpen, setInternalPanelOpen] = (0, import_react69.useState)(false);
|
|
5972
6003
|
const {
|
|
5973
6004
|
width: sidebarWidth,
|
|
5974
6005
|
startResizing: startResizingSidebar
|
|
@@ -5991,7 +6022,7 @@ var ChatInterface = import_react68.default.forwardRef(
|
|
|
5991
6022
|
const isPanelControlled = isArtifactsPanelOpen !== void 0;
|
|
5992
6023
|
const artifactsPanelOpen = isPanelControlled ? isArtifactsPanelOpen : internalPanelOpen;
|
|
5993
6024
|
const isTreeMode = !!conversationTree;
|
|
5994
|
-
const effectiveMessages = (0,
|
|
6025
|
+
const effectiveMessages = (0, import_react69.useMemo)(() => {
|
|
5995
6026
|
if (isTreeMode && conversationTree) {
|
|
5996
6027
|
const pathNodes = getActivePathMessages(conversationTree);
|
|
5997
6028
|
return pathNodes.map((node) => ({
|
|
@@ -6003,7 +6034,7 @@ var ChatInterface = import_react68.default.forwardRef(
|
|
|
6003
6034
|
}
|
|
6004
6035
|
return messages;
|
|
6005
6036
|
}, [isTreeMode, conversationTree, messages]);
|
|
6006
|
-
const latestUserMessageIndex = (0,
|
|
6037
|
+
const latestUserMessageIndex = (0, import_react69.useMemo)(() => {
|
|
6007
6038
|
for (let i = effectiveMessages.length - 1; i >= 0; i--) {
|
|
6008
6039
|
if (effectiveMessages[i].variant === "user") {
|
|
6009
6040
|
return i;
|
|
@@ -6011,15 +6042,15 @@ var ChatInterface = import_react68.default.forwardRef(
|
|
|
6011
6042
|
}
|
|
6012
6043
|
return -1;
|
|
6013
6044
|
}, [effectiveMessages]);
|
|
6014
|
-
const hasPendingArtifact = (0,
|
|
6045
|
+
const hasPendingArtifact = (0, import_react69.useMemo)(() => {
|
|
6015
6046
|
return artifacts.some((a) => a.isPending);
|
|
6016
6047
|
}, [artifacts]);
|
|
6017
|
-
|
|
6048
|
+
import_react69.default.useEffect(() => {
|
|
6018
6049
|
if (!isPanelControlled && artifacts.length > 0) {
|
|
6019
6050
|
setInternalPanelOpen(true);
|
|
6020
6051
|
}
|
|
6021
6052
|
}, [artifacts.length, isPanelControlled]);
|
|
6022
|
-
const handleBranchSwitch = (0,
|
|
6053
|
+
const handleBranchSwitch = (0, import_react69.useCallback)(
|
|
6023
6054
|
(nodeId, direction) => {
|
|
6024
6055
|
if (!isTreeMode || !conversationTree || !onTreeChange) {
|
|
6025
6056
|
return;
|
|
@@ -6029,7 +6060,7 @@ var ChatInterface = import_react68.default.forwardRef(
|
|
|
6029
6060
|
},
|
|
6030
6061
|
[isTreeMode, conversationTree, onTreeChange]
|
|
6031
6062
|
);
|
|
6032
|
-
const displayMessages = (0,
|
|
6063
|
+
const displayMessages = (0, import_react69.useMemo)(() => {
|
|
6033
6064
|
return effectiveMessages.map((msg) => {
|
|
6034
6065
|
let branchInfo = void 0;
|
|
6035
6066
|
if (isTreeMode && conversationTree) {
|
|
@@ -6063,16 +6094,16 @@ var ChatInterface = import_react68.default.forwardRef(
|
|
|
6063
6094
|
onRetryMessage,
|
|
6064
6095
|
handleBranchSwitch
|
|
6065
6096
|
]);
|
|
6066
|
-
const handleSubmit = (0,
|
|
6097
|
+
const handleSubmit = (0, import_react69.useCallback)(
|
|
6067
6098
|
(message, attachments) => {
|
|
6068
6099
|
onMessageSubmit?.(message, attachments);
|
|
6069
6100
|
},
|
|
6070
6101
|
[onMessageSubmit]
|
|
6071
6102
|
);
|
|
6072
|
-
const toggleSidebar = (0,
|
|
6103
|
+
const toggleSidebar = (0, import_react69.useCallback)(() => {
|
|
6073
6104
|
setSidebarCollapsed((prev) => !prev);
|
|
6074
6105
|
}, []);
|
|
6075
|
-
const toggleArtifactsPanel = (0,
|
|
6106
|
+
const toggleArtifactsPanel = (0, import_react69.useCallback)(() => {
|
|
6076
6107
|
if (isPanelControlled) {
|
|
6077
6108
|
onArtifactsPanelOpenChange?.(!artifactsPanelOpen);
|
|
6078
6109
|
} else {
|
|
@@ -6080,14 +6111,14 @@ var ChatInterface = import_react68.default.forwardRef(
|
|
|
6080
6111
|
}
|
|
6081
6112
|
}, [isPanelControlled, artifactsPanelOpen, onArtifactsPanelOpenChange]);
|
|
6082
6113
|
const isEmpty = effectiveMessages.length === 0;
|
|
6083
|
-
return /* @__PURE__ */
|
|
6114
|
+
return /* @__PURE__ */ import_react69.default.createElement(
|
|
6084
6115
|
"div",
|
|
6085
6116
|
{
|
|
6086
6117
|
ref,
|
|
6087
6118
|
className: cx("flex h-full w-full bg-obsidian overflow-hidden", className),
|
|
6088
6119
|
...rest
|
|
6089
6120
|
},
|
|
6090
|
-
/* @__PURE__ */
|
|
6121
|
+
/* @__PURE__ */ import_react69.default.createElement(
|
|
6091
6122
|
ConversationSidebar,
|
|
6092
6123
|
{
|
|
6093
6124
|
conversations,
|
|
@@ -6099,16 +6130,16 @@ var ChatInterface = import_react68.default.forwardRef(
|
|
|
6099
6130
|
onResizeStart: startResizingSidebar
|
|
6100
6131
|
}
|
|
6101
6132
|
),
|
|
6102
|
-
/* @__PURE__ */
|
|
6133
|
+
/* @__PURE__ */ import_react69.default.createElement("div", { className: "flex-1 flex flex-col min-w-0 relative" }, /* @__PURE__ */ import_react69.default.createElement("div", { className: cx(
|
|
6103
6134
|
"flex-1 flex flex-col min-h-0 relative",
|
|
6104
6135
|
isEmpty ? "justify-center" : "justify-start"
|
|
6105
|
-
) }, /* @__PURE__ */
|
|
6136
|
+
) }, /* @__PURE__ */ import_react69.default.createElement("div", { className: cx(
|
|
6106
6137
|
"transition-all duration-500 ease-in-out",
|
|
6107
6138
|
isEmpty ? "flex-1" : "flex-zero"
|
|
6108
|
-
) }), /* @__PURE__ */
|
|
6139
|
+
) }), /* @__PURE__ */ import_react69.default.createElement("div", { className: cx(
|
|
6109
6140
|
"transition-all duration-500 ease-in-out overflow-hidden flex flex-col",
|
|
6110
6141
|
isEmpty ? "flex-zero opacity-0" : "flex-1 opacity-100"
|
|
6111
|
-
) }, /* @__PURE__ */
|
|
6142
|
+
) }, /* @__PURE__ */ import_react69.default.createElement(
|
|
6112
6143
|
ChatView,
|
|
6113
6144
|
{
|
|
6114
6145
|
messages: displayMessages,
|
|
@@ -6117,10 +6148,10 @@ var ChatInterface = import_react68.default.forwardRef(
|
|
|
6117
6148
|
isThinking,
|
|
6118
6149
|
className: "flex-1"
|
|
6119
6150
|
}
|
|
6120
|
-
)), /* @__PURE__ */
|
|
6121
|
-
"transition-all duration-500 ease-in-out z-10 w-full",
|
|
6151
|
+
)), /* @__PURE__ */ import_react69.default.createElement("div", { className: cx(
|
|
6152
|
+
"transition-all duration-500 ease-in-out z-10 w-full flex flex-col items-center",
|
|
6122
6153
|
isEmpty ? "p-4" : "shrink-0 p-4 border-t border-ash/40 bg-obsidian"
|
|
6123
|
-
) }, isEmpty &&
|
|
6154
|
+
) }, isEmpty && /* @__PURE__ */ import_react69.default.createElement("div", { className: "mb-8 text-center animate-fade-in duration-500" }, emptyState ? emptyState : /* @__PURE__ */ import_react69.default.createElement("h1", { className: "text-4xl md:text-5xl font-heading text-gold mb-2 tracking-tight" }, "Welcome!")), /* @__PURE__ */ import_react69.default.createElement(
|
|
6124
6155
|
ChatInput,
|
|
6125
6156
|
{
|
|
6126
6157
|
position: isEmpty ? "centered" : "bottom",
|
|
@@ -6134,11 +6165,11 @@ var ChatInterface = import_react68.default.forwardRef(
|
|
|
6134
6165
|
attachments: propsAttachments,
|
|
6135
6166
|
onAttachmentsChange
|
|
6136
6167
|
}
|
|
6137
|
-
)), /* @__PURE__ */
|
|
6168
|
+
)), /* @__PURE__ */ import_react69.default.createElement("div", { className: cx(
|
|
6138
6169
|
"transition-all duration-500 ease-in-out",
|
|
6139
6170
|
isEmpty ? "flex-1" : "flex-zero"
|
|
6140
6171
|
) }))),
|
|
6141
|
-
/* @__PURE__ */
|
|
6172
|
+
/* @__PURE__ */ import_react69.default.createElement("div", { className: "h-full flex flex-col shrink-0" }, /* @__PURE__ */ import_react69.default.createElement("div", { className: "flex-1 min-h-0" }, /* @__PURE__ */ import_react69.default.createElement(
|
|
6142
6173
|
ArtifactsPanel,
|
|
6143
6174
|
{
|
|
6144
6175
|
artifacts,
|
|
@@ -6150,7 +6181,7 @@ var ChatInterface = import_react68.default.forwardRef(
|
|
|
6150
6181
|
onResizeStart: startResizingArtifacts,
|
|
6151
6182
|
className: "h-full"
|
|
6152
6183
|
}
|
|
6153
|
-
)), tasks.length > 0 && artifactsPanelOpen && /* @__PURE__ */
|
|
6184
|
+
)), tasks.length > 0 && artifactsPanelOpen && /* @__PURE__ */ import_react69.default.createElement(
|
|
6154
6185
|
TodosList,
|
|
6155
6186
|
{
|
|
6156
6187
|
tasks,
|
|
@@ -6164,9 +6195,9 @@ var ChatInterface = import_react68.default.forwardRef(
|
|
|
6164
6195
|
ChatInterface.displayName = "ChatInterface";
|
|
6165
6196
|
|
|
6166
6197
|
// src/components/chat/MessageActions.tsx
|
|
6167
|
-
var
|
|
6198
|
+
var import_react70 = __toESM(require("react"));
|
|
6168
6199
|
var import_lucide_react13 = require("lucide-react");
|
|
6169
|
-
var ActionButton2 = ({ onClick, label, children, className, disabled }) => /* @__PURE__ */
|
|
6200
|
+
var ActionButton2 = ({ onClick, label, children, className, disabled }) => /* @__PURE__ */ import_react70.default.createElement(
|
|
6170
6201
|
"button",
|
|
6171
6202
|
{
|
|
6172
6203
|
type: "button",
|
|
@@ -6182,7 +6213,7 @@ var ActionButton2 = ({ onClick, label, children, className, disabled }) => /* @_
|
|
|
6182
6213
|
},
|
|
6183
6214
|
children
|
|
6184
6215
|
);
|
|
6185
|
-
var MessageActions =
|
|
6216
|
+
var MessageActions = import_react70.default.forwardRef(
|
|
6186
6217
|
({
|
|
6187
6218
|
variant,
|
|
6188
6219
|
content,
|
|
@@ -6194,12 +6225,12 @@ var MessageActions = import_react69.default.forwardRef(
|
|
|
6194
6225
|
className,
|
|
6195
6226
|
...rest
|
|
6196
6227
|
}, ref) => {
|
|
6197
|
-
const [localIsEditing, setLocalIsEditing] = (0,
|
|
6198
|
-
const [localEditValue, setLocalEditValue] = (0,
|
|
6199
|
-
const [copied, setCopied] = (0,
|
|
6228
|
+
const [localIsEditing, setLocalIsEditing] = (0, import_react70.useState)(false);
|
|
6229
|
+
const [localEditValue, setLocalEditValue] = (0, import_react70.useState)(content);
|
|
6230
|
+
const [copied, setCopied] = (0, import_react70.useState)(false);
|
|
6200
6231
|
const isEditing = controlledIsEditing ?? localIsEditing;
|
|
6201
6232
|
const editValue = controlledEditValue ?? localEditValue;
|
|
6202
|
-
const setIsEditing = (0,
|
|
6233
|
+
const setIsEditing = (0, import_react70.useCallback)(
|
|
6203
6234
|
(value) => {
|
|
6204
6235
|
if (onEditingChange) {
|
|
6205
6236
|
onEditingChange(value);
|
|
@@ -6209,10 +6240,10 @@ var MessageActions = import_react69.default.forwardRef(
|
|
|
6209
6240
|
},
|
|
6210
6241
|
[onEditingChange]
|
|
6211
6242
|
);
|
|
6212
|
-
const setEditValue = (0,
|
|
6243
|
+
const setEditValue = (0, import_react70.useCallback)((value) => {
|
|
6213
6244
|
setLocalEditValue(value);
|
|
6214
6245
|
}, []);
|
|
6215
|
-
const handleCopy = (0,
|
|
6246
|
+
const handleCopy = (0, import_react70.useCallback)(async () => {
|
|
6216
6247
|
try {
|
|
6217
6248
|
await navigator.clipboard.writeText(content);
|
|
6218
6249
|
setCopied(true);
|
|
@@ -6228,22 +6259,22 @@ var MessageActions = import_react69.default.forwardRef(
|
|
|
6228
6259
|
setTimeout(() => setCopied(false), 2e3);
|
|
6229
6260
|
}
|
|
6230
6261
|
}, [content]);
|
|
6231
|
-
const handleStartEdit = (0,
|
|
6262
|
+
const handleStartEdit = (0, import_react70.useCallback)(() => {
|
|
6232
6263
|
setLocalEditValue(content);
|
|
6233
6264
|
setIsEditing(true);
|
|
6234
6265
|
}, [content, setIsEditing]);
|
|
6235
|
-
const handleCancelEdit = (0,
|
|
6266
|
+
const handleCancelEdit = (0, import_react70.useCallback)(() => {
|
|
6236
6267
|
setIsEditing(false);
|
|
6237
6268
|
setLocalEditValue(content);
|
|
6238
6269
|
}, [content, setIsEditing]);
|
|
6239
|
-
const handleSubmitEdit = (0,
|
|
6270
|
+
const handleSubmitEdit = (0, import_react70.useCallback)(() => {
|
|
6240
6271
|
const trimmed = editValue.trim();
|
|
6241
6272
|
if (trimmed && trimmed !== content) {
|
|
6242
6273
|
onEdit?.(trimmed);
|
|
6243
6274
|
}
|
|
6244
6275
|
setIsEditing(false);
|
|
6245
6276
|
}, [editValue, content, onEdit, setIsEditing]);
|
|
6246
|
-
const handleEditKeyDown = (0,
|
|
6277
|
+
const handleEditKeyDown = (0, import_react70.useCallback)(
|
|
6247
6278
|
(e) => {
|
|
6248
6279
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
6249
6280
|
e.preventDefault();
|
|
@@ -6256,19 +6287,19 @@ var MessageActions = import_react69.default.forwardRef(
|
|
|
6256
6287
|
);
|
|
6257
6288
|
const isUser = variant === "user";
|
|
6258
6289
|
if (isUser && isEditing) {
|
|
6259
|
-
return /* @__PURE__ */
|
|
6290
|
+
return /* @__PURE__ */ import_react70.default.createElement(
|
|
6260
6291
|
"div",
|
|
6261
6292
|
{
|
|
6262
6293
|
ref,
|
|
6263
6294
|
className: cx("mt-2", className),
|
|
6264
6295
|
...rest
|
|
6265
6296
|
},
|
|
6266
|
-
/* @__PURE__ */
|
|
6297
|
+
/* @__PURE__ */ import_react70.default.createElement(
|
|
6267
6298
|
"div",
|
|
6268
6299
|
{
|
|
6269
6300
|
className: "relative bg-charcoal border border-ash/60 focus-within:border-gold/60 focus-within:ring-1 focus-within:ring-gold/20"
|
|
6270
6301
|
},
|
|
6271
|
-
/* @__PURE__ */
|
|
6302
|
+
/* @__PURE__ */ import_react70.default.createElement(
|
|
6272
6303
|
"textarea",
|
|
6273
6304
|
{
|
|
6274
6305
|
value: editValue,
|
|
@@ -6279,15 +6310,15 @@ var MessageActions = import_react69.default.forwardRef(
|
|
|
6279
6310
|
rows: 2
|
|
6280
6311
|
}
|
|
6281
6312
|
),
|
|
6282
|
-
/* @__PURE__ */
|
|
6313
|
+
/* @__PURE__ */ import_react70.default.createElement("div", { className: "absolute right-2 bottom-2 flex gap-1" }, /* @__PURE__ */ import_react70.default.createElement(
|
|
6283
6314
|
ActionButton2,
|
|
6284
6315
|
{
|
|
6285
6316
|
onClick: handleCancelEdit,
|
|
6286
6317
|
label: "Cancel edit",
|
|
6287
6318
|
className: "text-silver/60 hover:text-error"
|
|
6288
6319
|
},
|
|
6289
|
-
/* @__PURE__ */
|
|
6290
|
-
), /* @__PURE__ */
|
|
6320
|
+
/* @__PURE__ */ import_react70.default.createElement(import_lucide_react13.X, { className: "w-4 h-4" })
|
|
6321
|
+
), /* @__PURE__ */ import_react70.default.createElement(
|
|
6291
6322
|
ActionButton2,
|
|
6292
6323
|
{
|
|
6293
6324
|
onClick: handleSubmitEdit,
|
|
@@ -6295,13 +6326,13 @@ var MessageActions = import_react69.default.forwardRef(
|
|
|
6295
6326
|
className: "text-silver/60 hover:text-gold",
|
|
6296
6327
|
disabled: !editValue.trim() || editValue.trim() === content
|
|
6297
6328
|
},
|
|
6298
|
-
/* @__PURE__ */
|
|
6329
|
+
/* @__PURE__ */ import_react70.default.createElement(import_lucide_react13.Send, { className: "w-4 h-4" })
|
|
6299
6330
|
))
|
|
6300
6331
|
),
|
|
6301
|
-
/* @__PURE__ */
|
|
6332
|
+
/* @__PURE__ */ import_react70.default.createElement("p", { className: "text-xs text-silver/50 mt-1" }, "Press Enter to submit, Esc to cancel. This will create a new branch.")
|
|
6302
6333
|
);
|
|
6303
6334
|
}
|
|
6304
|
-
return /* @__PURE__ */
|
|
6335
|
+
return /* @__PURE__ */ import_react70.default.createElement(
|
|
6305
6336
|
"div",
|
|
6306
6337
|
{
|
|
6307
6338
|
ref,
|
|
@@ -6312,18 +6343,18 @@ var MessageActions = import_react69.default.forwardRef(
|
|
|
6312
6343
|
),
|
|
6313
6344
|
...rest
|
|
6314
6345
|
},
|
|
6315
|
-
/* @__PURE__ */
|
|
6316
|
-
isUser && onEdit && /* @__PURE__ */
|
|
6317
|
-
!isUser && onRetry && /* @__PURE__ */
|
|
6346
|
+
/* @__PURE__ */ import_react70.default.createElement(ActionButton2, { onClick: handleCopy, label: copied ? "Copied!" : "Copy message" }, copied ? /* @__PURE__ */ import_react70.default.createElement(import_lucide_react13.Check, { className: "w-3.5 h-3.5 text-success" }) : /* @__PURE__ */ import_react70.default.createElement(import_lucide_react13.Copy, { className: "w-3.5 h-3.5" })),
|
|
6347
|
+
isUser && onEdit && /* @__PURE__ */ import_react70.default.createElement(ActionButton2, { onClick: handleStartEdit, label: "Edit message" }, /* @__PURE__ */ import_react70.default.createElement(import_lucide_react13.Pencil, { className: "w-3.5 h-3.5" })),
|
|
6348
|
+
!isUser && onRetry && /* @__PURE__ */ import_react70.default.createElement(ActionButton2, { onClick: onRetry, label: "Regenerate response" }, /* @__PURE__ */ import_react70.default.createElement(import_lucide_react13.RotateCcw, { className: "w-3.5 h-3.5" }))
|
|
6318
6349
|
);
|
|
6319
6350
|
}
|
|
6320
6351
|
);
|
|
6321
6352
|
MessageActions.displayName = "MessageActions";
|
|
6322
6353
|
|
|
6323
6354
|
// src/components/chat/BranchNavigator.tsx
|
|
6324
|
-
var
|
|
6355
|
+
var import_react71 = __toESM(require("react"));
|
|
6325
6356
|
var import_lucide_react14 = require("lucide-react");
|
|
6326
|
-
var BranchNavigator =
|
|
6357
|
+
var BranchNavigator = import_react71.default.forwardRef(
|
|
6327
6358
|
({
|
|
6328
6359
|
current,
|
|
6329
6360
|
total,
|
|
@@ -6342,7 +6373,7 @@ var BranchNavigator = import_react70.default.forwardRef(
|
|
|
6342
6373
|
const buttonSize = size === "sm" ? "p-0.5" : "p-1";
|
|
6343
6374
|
const iconSize = size === "sm" ? "w-3 h-3" : "w-4 h-4";
|
|
6344
6375
|
const textSize = size === "sm" ? "text-xs" : "text-sm";
|
|
6345
|
-
return /* @__PURE__ */
|
|
6376
|
+
return /* @__PURE__ */ import_react71.default.createElement(
|
|
6346
6377
|
"div",
|
|
6347
6378
|
{
|
|
6348
6379
|
ref,
|
|
@@ -6354,8 +6385,8 @@ var BranchNavigator = import_react70.default.forwardRef(
|
|
|
6354
6385
|
"aria-label": "Branch navigation",
|
|
6355
6386
|
...rest
|
|
6356
6387
|
},
|
|
6357
|
-
showIcon && /* @__PURE__ */
|
|
6358
|
-
/* @__PURE__ */
|
|
6388
|
+
showIcon && /* @__PURE__ */ import_react71.default.createElement(import_lucide_react14.GitBranch, { className: cx(iconSize, "mr-0.5 text-silver/50"), "aria-hidden": "true" }),
|
|
6389
|
+
/* @__PURE__ */ import_react71.default.createElement(
|
|
6359
6390
|
"button",
|
|
6360
6391
|
{
|
|
6361
6392
|
type: "button",
|
|
@@ -6368,10 +6399,10 @@ var BranchNavigator = import_react70.default.forwardRef(
|
|
|
6368
6399
|
),
|
|
6369
6400
|
"aria-label": "Previous branch"
|
|
6370
6401
|
},
|
|
6371
|
-
/* @__PURE__ */
|
|
6402
|
+
/* @__PURE__ */ import_react71.default.createElement(import_lucide_react14.ChevronLeft, { className: iconSize })
|
|
6372
6403
|
),
|
|
6373
|
-
/* @__PURE__ */
|
|
6374
|
-
/* @__PURE__ */
|
|
6404
|
+
/* @__PURE__ */ import_react71.default.createElement("span", { className: cx(textSize, "tabular-nums min-w-6 text-center") }, current, "/", total),
|
|
6405
|
+
/* @__PURE__ */ import_react71.default.createElement(
|
|
6375
6406
|
"button",
|
|
6376
6407
|
{
|
|
6377
6408
|
type: "button",
|
|
@@ -6384,44 +6415,13 @@ var BranchNavigator = import_react70.default.forwardRef(
|
|
|
6384
6415
|
),
|
|
6385
6416
|
"aria-label": "Next branch"
|
|
6386
6417
|
},
|
|
6387
|
-
/* @__PURE__ */
|
|
6418
|
+
/* @__PURE__ */ import_react71.default.createElement(import_lucide_react14.ChevronRight, { className: iconSize })
|
|
6388
6419
|
)
|
|
6389
6420
|
);
|
|
6390
6421
|
}
|
|
6391
6422
|
);
|
|
6392
6423
|
BranchNavigator.displayName = "BranchNavigator";
|
|
6393
6424
|
|
|
6394
|
-
// src/components/chat/hooks/useArtifacts.ts
|
|
6395
|
-
var import_react71 = require("react");
|
|
6396
|
-
function useArtifacts() {
|
|
6397
|
-
const [artifacts, setArtifacts] = (0, import_react71.useState)([]);
|
|
6398
|
-
const scheduleArtifact = (0, import_react71.useCallback)((artifact) => {
|
|
6399
|
-
setArtifacts((prev) => [...prev, { ...artifact, isPending: true }]);
|
|
6400
|
-
}, []);
|
|
6401
|
-
const showArtifact = (0, import_react71.useCallback)(
|
|
6402
|
-
(artifactId, updates) => {
|
|
6403
|
-
setArtifacts((prev) => {
|
|
6404
|
-
const existingIndex = prev.findIndex((a) => a.id === artifactId);
|
|
6405
|
-
if (existingIndex >= 0) {
|
|
6406
|
-
return prev.map(
|
|
6407
|
-
(a) => a.id === artifactId ? { ...a, ...updates, isPending: false } : a
|
|
6408
|
-
);
|
|
6409
|
-
} else {
|
|
6410
|
-
return [...prev, { id: artifactId, ...updates, isPending: false }];
|
|
6411
|
-
}
|
|
6412
|
-
});
|
|
6413
|
-
},
|
|
6414
|
-
[]
|
|
6415
|
-
);
|
|
6416
|
-
const removeArtifact = (0, import_react71.useCallback)((artifactId) => {
|
|
6417
|
-
setArtifacts((prev) => prev.filter((a) => a.id !== artifactId));
|
|
6418
|
-
}, []);
|
|
6419
|
-
const clearArtifacts = (0, import_react71.useCallback)(() => {
|
|
6420
|
-
setArtifacts([]);
|
|
6421
|
-
}, []);
|
|
6422
|
-
return { artifacts, scheduleArtifact, showArtifact, removeArtifact, clearArtifacts };
|
|
6423
|
-
}
|
|
6424
|
-
|
|
6425
6425
|
// src/components/BrandIcon.tsx
|
|
6426
6426
|
var import_react72 = __toESM(require("react"));
|
|
6427
6427
|
var sizeMap2 = {
|