@lukeashford/aurelius 2.21.0 → 3.0.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 +114 -179
- package/dist/index.d.ts +114 -179
- package/dist/index.js +95 -144
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -83
- package/dist/index.mjs.map +1 -1
- package/llms.md +11 -54
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4136,7 +4136,7 @@ var StreamingCursor = React55.forwardRef(
|
|
|
4136
4136
|
StreamingCursor.displayName = "StreamingCursor";
|
|
4137
4137
|
|
|
4138
4138
|
// src/components/chat/ChatInterface.tsx
|
|
4139
|
-
import React73, { useCallback as
|
|
4139
|
+
import React73, { useCallback as useCallback18, useEffect as useEffect15, useMemo as useMemo4, useRef as useRef13, useState as useState19 } from "react";
|
|
4140
4140
|
|
|
4141
4141
|
// src/components/chat/ChatView.tsx
|
|
4142
4142
|
import React57, { useEffect as useEffect9 } from "react";
|
|
@@ -5876,7 +5876,6 @@ function NodeRenderer({
|
|
|
5876
5876
|
var ArtifactsPanel = React69.forwardRef(
|
|
5877
5877
|
({
|
|
5878
5878
|
nodes,
|
|
5879
|
-
artifacts,
|
|
5880
5879
|
loading,
|
|
5881
5880
|
className,
|
|
5882
5881
|
...rest
|
|
@@ -5884,7 +5883,7 @@ var ArtifactsPanel = React69.forwardRef(
|
|
|
5884
5883
|
const [expandedArtifact, setExpandedArtifact] = useState16(null);
|
|
5885
5884
|
const [zoomIndex, setZoomIndex] = useState16(ZOOM_LEVELS.length - 1);
|
|
5886
5885
|
const treeNav = useArtifactTreeNavigation(nodes || []);
|
|
5887
|
-
const
|
|
5886
|
+
const hasNodes = !!nodes && nodes.length > 0;
|
|
5888
5887
|
const handleExpandArtifact = useCallback15((artifact) => {
|
|
5889
5888
|
setExpandedArtifact(artifact);
|
|
5890
5889
|
}, []);
|
|
@@ -5926,7 +5925,7 @@ var ArtifactsPanel = React69.forwardRef(
|
|
|
5926
5925
|
className: "flex items-center justify-between p-4 border-b border-ash/40 shrink-0"
|
|
5927
5926
|
},
|
|
5928
5927
|
/* @__PURE__ */ React69.createElement("h3", { className: "text-sm font-semibold text-white" }, "Artifacts"),
|
|
5929
|
-
|
|
5928
|
+
hasNodes && /* @__PURE__ */ React69.createElement(
|
|
5930
5929
|
"div",
|
|
5931
5930
|
{
|
|
5932
5931
|
className: "flex items-center gap-0.5",
|
|
@@ -5963,7 +5962,7 @@ var ArtifactsPanel = React69.forwardRef(
|
|
|
5963
5962
|
)
|
|
5964
5963
|
)
|
|
5965
5964
|
),
|
|
5966
|
-
|
|
5965
|
+
hasNodes && !treeNav.isAtRoot && /* @__PURE__ */ React69.createElement(
|
|
5967
5966
|
"nav",
|
|
5968
5967
|
{
|
|
5969
5968
|
className: "flex items-center gap-1 px-4 py-2 border-b border-ash/40 shrink-0 overflow-x-auto text-xs",
|
|
@@ -6004,7 +6003,7 @@ var ArtifactsPanel = React69.forwardRef(
|
|
|
6004
6003
|
transformOrigin: "top center"
|
|
6005
6004
|
} : void 0
|
|
6006
6005
|
},
|
|
6007
|
-
|
|
6006
|
+
treeNav.currentNodes.length === 0 ? /* @__PURE__ */ React69.createElement("p", { className: "text-xs text-silver/60 text-center py-8" }, hasNodes ? "Empty group" : "No artifacts to display") : treeNav.currentNodes.map((node) => /* @__PURE__ */ React69.createElement(
|
|
6008
6007
|
NodeRenderer,
|
|
6009
6008
|
{
|
|
6010
6009
|
key: node.id,
|
|
@@ -6013,14 +6012,6 @@ var ArtifactsPanel = React69.forwardRef(
|
|
|
6013
6012
|
onExpandArtifact: handleExpandArtifact,
|
|
6014
6013
|
onGroupClick: handleGroupClick
|
|
6015
6014
|
}
|
|
6016
|
-
)) : (!artifacts || artifacts.length === 0) && !loading ? /* @__PURE__ */ React69.createElement("p", { className: "text-xs text-silver/60 text-center py-8" }, "No artifacts to display") : artifacts?.map((artifact) => /* @__PURE__ */ React69.createElement(
|
|
6017
|
-
ArtifactCard,
|
|
6018
|
-
{
|
|
6019
|
-
key: artifact.id,
|
|
6020
|
-
artifact,
|
|
6021
|
-
loading,
|
|
6022
|
-
onExpand: handleExpandArtifact
|
|
6023
|
-
}
|
|
6024
6015
|
))
|
|
6025
6016
|
)
|
|
6026
6017
|
)
|
|
@@ -6365,58 +6356,27 @@ var ToolPanelContainer = React72.forwardRef(
|
|
|
6365
6356
|
);
|
|
6366
6357
|
ToolPanelContainer.displayName = "ToolPanelContainer";
|
|
6367
6358
|
|
|
6368
|
-
// src/components/chat/hooks/useArtifacts.ts
|
|
6369
|
-
import { useCallback as useCallback17, useState as useState18 } from "react";
|
|
6370
|
-
function useArtifacts() {
|
|
6371
|
-
const [artifacts, setArtifacts] = useState18([]);
|
|
6372
|
-
const scheduleArtifact = useCallback17((artifact) => {
|
|
6373
|
-
setArtifacts((prev) => [...prev, { ...artifact, isPending: true }]);
|
|
6374
|
-
}, []);
|
|
6375
|
-
const showArtifact = useCallback17(
|
|
6376
|
-
(artifactId, updates) => {
|
|
6377
|
-
setArtifacts((prev) => {
|
|
6378
|
-
const existingIndex = prev.findIndex((a) => a.id === artifactId);
|
|
6379
|
-
if (existingIndex >= 0) {
|
|
6380
|
-
return prev.map(
|
|
6381
|
-
(a) => a.id === artifactId ? { ...a, ...updates, isPending: false } : a
|
|
6382
|
-
);
|
|
6383
|
-
} else {
|
|
6384
|
-
return [...prev, { id: artifactId, ...updates, isPending: false }];
|
|
6385
|
-
}
|
|
6386
|
-
});
|
|
6387
|
-
},
|
|
6388
|
-
[]
|
|
6389
|
-
);
|
|
6390
|
-
const removeArtifact = useCallback17((artifactId) => {
|
|
6391
|
-
setArtifacts((prev) => prev.filter((a) => a.id !== artifactId));
|
|
6392
|
-
}, []);
|
|
6393
|
-
const clearArtifacts = useCallback17(() => {
|
|
6394
|
-
setArtifacts([]);
|
|
6395
|
-
}, []);
|
|
6396
|
-
return { artifacts, scheduleArtifact, showArtifact, removeArtifact, clearArtifacts };
|
|
6397
|
-
}
|
|
6398
|
-
|
|
6399
6359
|
// src/components/chat/hooks/useResizable.ts
|
|
6400
|
-
import { useCallback as
|
|
6360
|
+
import { useCallback as useCallback17, useEffect as useEffect14, useRef as useRef12, useState as useState18 } from "react";
|
|
6401
6361
|
function useResizable({
|
|
6402
6362
|
initialWidthPercent,
|
|
6403
6363
|
minWidthPercent,
|
|
6404
6364
|
maxWidthPercent,
|
|
6405
6365
|
direction
|
|
6406
6366
|
}) {
|
|
6407
|
-
const [widthPercent, setWidthPercent] =
|
|
6408
|
-
const [isResizing, setIsResizing] =
|
|
6367
|
+
const [widthPercent, setWidthPercent] = useState18(initialWidthPercent);
|
|
6368
|
+
const [isResizing, setIsResizing] = useState18(false);
|
|
6409
6369
|
const lastX = useRef12(null);
|
|
6410
|
-
const startResizing =
|
|
6370
|
+
const startResizing = useCallback17((e) => {
|
|
6411
6371
|
e.preventDefault();
|
|
6412
6372
|
setIsResizing(true);
|
|
6413
6373
|
lastX.current = e.clientX;
|
|
6414
6374
|
}, []);
|
|
6415
|
-
const stopResizing =
|
|
6375
|
+
const stopResizing = useCallback17(() => {
|
|
6416
6376
|
setIsResizing(false);
|
|
6417
6377
|
lastX.current = null;
|
|
6418
6378
|
}, []);
|
|
6419
|
-
const resize =
|
|
6379
|
+
const resize = useCallback17(
|
|
6420
6380
|
(e) => {
|
|
6421
6381
|
if (!isResizing || lastX.current === null) {
|
|
6422
6382
|
return;
|
|
@@ -6478,7 +6438,6 @@ var ChatInterface = React73.forwardRef(
|
|
|
6478
6438
|
enableMessageActions = true,
|
|
6479
6439
|
attachments: propsAttachments,
|
|
6480
6440
|
onAttachmentsChange,
|
|
6481
|
-
artifacts = [],
|
|
6482
6441
|
artifactNodes,
|
|
6483
6442
|
isArtifactsPanelOpen,
|
|
6484
6443
|
onArtifactsPanelOpenChange,
|
|
@@ -6487,10 +6446,10 @@ var ChatInterface = React73.forwardRef(
|
|
|
6487
6446
|
className,
|
|
6488
6447
|
...rest
|
|
6489
6448
|
}, ref) => {
|
|
6490
|
-
const [sidebarCollapsed, setSidebarCollapsed] =
|
|
6491
|
-
const
|
|
6449
|
+
const [sidebarCollapsed, setSidebarCollapsed] = useState19(initialSidebarCollapsed);
|
|
6450
|
+
const prevArtifactNodesRef = useRef13([]);
|
|
6492
6451
|
const prevTasksRef = useRef13([]);
|
|
6493
|
-
const [internalTools, setInternalTools] =
|
|
6452
|
+
const [internalTools, setInternalTools] = useState19({
|
|
6494
6453
|
top: null,
|
|
6495
6454
|
bottom: null
|
|
6496
6455
|
});
|
|
@@ -6524,7 +6483,7 @@ var ChatInterface = React73.forwardRef(
|
|
|
6524
6483
|
maxWidthPercent: 70,
|
|
6525
6484
|
direction: "left"
|
|
6526
6485
|
});
|
|
6527
|
-
const toggleTool =
|
|
6486
|
+
const toggleTool = useCallback18((toolId) => {
|
|
6528
6487
|
const toolDef = TOOL_DEFINITIONS.find((t) => t.id === toolId);
|
|
6529
6488
|
if (!toolDef) return;
|
|
6530
6489
|
const group = toolDef.group;
|
|
@@ -6571,15 +6530,10 @@ var ChatInterface = React73.forwardRef(
|
|
|
6571
6530
|
return -1;
|
|
6572
6531
|
}, [effectiveMessages]);
|
|
6573
6532
|
useEffect15(() => {
|
|
6574
|
-
const
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
if (p.title !== a.title || p.type !== a.type) return true;
|
|
6579
|
-
return false;
|
|
6580
|
-
});
|
|
6581
|
-
const hasNodes = artifactNodes && artifactNodes.length > 0;
|
|
6582
|
-
if (!isPanelControlled && (hasNewOrSignificantArtifact || hasNodes) && !dismissedToolsRef.current.has("artifacts")) {
|
|
6533
|
+
const nodes = artifactNodes || [];
|
|
6534
|
+
const prevNodes = prevArtifactNodesRef.current;
|
|
6535
|
+
const hasNewOrChangedNode = nodes.length !== prevNodes.length || nodes.some((n, i) => n.id !== prevNodes[i]?.id);
|
|
6536
|
+
if (!isPanelControlled && hasNewOrChangedNode && nodes.length > 0 && !dismissedToolsRef.current.has("artifacts")) {
|
|
6583
6537
|
setInternalTools((prev) => ({ ...prev, top: "artifacts" }));
|
|
6584
6538
|
}
|
|
6585
6539
|
const hasNewOrUpdatedTask = (curr, prev) => {
|
|
@@ -6594,10 +6548,10 @@ var ChatInterface = React73.forwardRef(
|
|
|
6594
6548
|
if (hasNewOrUpdatedTask(tasks, prevTasksRef.current) && !dismissedToolsRef.current.has("todos")) {
|
|
6595
6549
|
setInternalTools((prev) => ({ ...prev, bottom: "todos" }));
|
|
6596
6550
|
}
|
|
6597
|
-
|
|
6551
|
+
prevArtifactNodesRef.current = nodes;
|
|
6598
6552
|
prevTasksRef.current = tasks;
|
|
6599
|
-
}, [
|
|
6600
|
-
const handleBranchSwitch =
|
|
6553
|
+
}, [artifactNodes, tasks, isPanelControlled]);
|
|
6554
|
+
const handleBranchSwitch = useCallback18(
|
|
6601
6555
|
(nodeId, direction) => {
|
|
6602
6556
|
if (!isTreeMode || !conversationTree || !onTreeChange) return;
|
|
6603
6557
|
const newTree = switchBranch(conversationTree, nodeId, direction);
|
|
@@ -6635,13 +6589,13 @@ var ChatInterface = React73.forwardRef(
|
|
|
6635
6589
|
onRetryMessage,
|
|
6636
6590
|
handleBranchSwitch
|
|
6637
6591
|
]);
|
|
6638
|
-
const handleSubmit =
|
|
6592
|
+
const handleSubmit = useCallback18(
|
|
6639
6593
|
(message, attachments) => {
|
|
6640
6594
|
onMessageSubmit?.(message, attachments);
|
|
6641
6595
|
},
|
|
6642
6596
|
[onMessageSubmit]
|
|
6643
6597
|
);
|
|
6644
|
-
const toggleSidebar =
|
|
6598
|
+
const toggleSidebar = useCallback18(() => {
|
|
6645
6599
|
setSidebarCollapsed((prev) => !prev);
|
|
6646
6600
|
}, []);
|
|
6647
6601
|
const isEmpty = effectiveMessages.length === 0;
|
|
@@ -6667,7 +6621,6 @@ var ChatInterface = React73.forwardRef(
|
|
|
6667
6621
|
return /* @__PURE__ */ React73.createElement(
|
|
6668
6622
|
ArtifactsPanel,
|
|
6669
6623
|
{
|
|
6670
|
-
artifacts,
|
|
6671
6624
|
nodes: artifactNodes,
|
|
6672
6625
|
className: "h-full"
|
|
6673
6626
|
}
|
|
@@ -6763,7 +6716,7 @@ var TOOL_DEFINITIONS = [
|
|
|
6763
6716
|
];
|
|
6764
6717
|
|
|
6765
6718
|
// src/components/chat/MessageActions.tsx
|
|
6766
|
-
import React74, { useCallback as
|
|
6719
|
+
import React74, { useCallback as useCallback19, useState as useState20 } from "react";
|
|
6767
6720
|
import { Check as Check3, Copy, Pencil, RotateCcw, Send as Send2, X as X5 } from "lucide-react";
|
|
6768
6721
|
var ActionButton2 = ({ onClick, label, children, className, disabled }) => /* @__PURE__ */ React74.createElement(
|
|
6769
6722
|
"button",
|
|
@@ -6793,12 +6746,12 @@ var MessageActions = React74.forwardRef(
|
|
|
6793
6746
|
className,
|
|
6794
6747
|
...rest
|
|
6795
6748
|
}, ref) => {
|
|
6796
|
-
const [localIsEditing, setLocalIsEditing] =
|
|
6797
|
-
const [localEditValue, setLocalEditValue] =
|
|
6798
|
-
const [copied, setCopied] =
|
|
6749
|
+
const [localIsEditing, setLocalIsEditing] = useState20(false);
|
|
6750
|
+
const [localEditValue, setLocalEditValue] = useState20(content);
|
|
6751
|
+
const [copied, setCopied] = useState20(false);
|
|
6799
6752
|
const isEditing = controlledIsEditing ?? localIsEditing;
|
|
6800
6753
|
const editValue = controlledEditValue ?? localEditValue;
|
|
6801
|
-
const setIsEditing =
|
|
6754
|
+
const setIsEditing = useCallback19(
|
|
6802
6755
|
(value) => {
|
|
6803
6756
|
if (onEditingChange) {
|
|
6804
6757
|
onEditingChange(value);
|
|
@@ -6808,10 +6761,10 @@ var MessageActions = React74.forwardRef(
|
|
|
6808
6761
|
},
|
|
6809
6762
|
[onEditingChange]
|
|
6810
6763
|
);
|
|
6811
|
-
const setEditValue =
|
|
6764
|
+
const setEditValue = useCallback19((value) => {
|
|
6812
6765
|
setLocalEditValue(value);
|
|
6813
6766
|
}, []);
|
|
6814
|
-
const handleCopy =
|
|
6767
|
+
const handleCopy = useCallback19(async () => {
|
|
6815
6768
|
try {
|
|
6816
6769
|
await navigator.clipboard.writeText(content);
|
|
6817
6770
|
setCopied(true);
|
|
@@ -6827,22 +6780,22 @@ var MessageActions = React74.forwardRef(
|
|
|
6827
6780
|
setTimeout(() => setCopied(false), 2e3);
|
|
6828
6781
|
}
|
|
6829
6782
|
}, [content]);
|
|
6830
|
-
const handleStartEdit =
|
|
6783
|
+
const handleStartEdit = useCallback19(() => {
|
|
6831
6784
|
setLocalEditValue(content);
|
|
6832
6785
|
setIsEditing(true);
|
|
6833
6786
|
}, [content, setIsEditing]);
|
|
6834
|
-
const handleCancelEdit =
|
|
6787
|
+
const handleCancelEdit = useCallback19(() => {
|
|
6835
6788
|
setIsEditing(false);
|
|
6836
6789
|
setLocalEditValue(content);
|
|
6837
6790
|
}, [content, setIsEditing]);
|
|
6838
|
-
const handleSubmitEdit =
|
|
6791
|
+
const handleSubmitEdit = useCallback19(() => {
|
|
6839
6792
|
const trimmed = editValue.trim();
|
|
6840
6793
|
if (trimmed && trimmed !== content) {
|
|
6841
6794
|
onEdit?.(trimmed);
|
|
6842
6795
|
}
|
|
6843
6796
|
setIsEditing(false);
|
|
6844
6797
|
}, [editValue, content, onEdit, setIsEditing]);
|
|
6845
|
-
const handleEditKeyDown =
|
|
6798
|
+
const handleEditKeyDown = useCallback19(
|
|
6846
6799
|
(e) => {
|
|
6847
6800
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
6848
6801
|
e.preventDefault();
|
|
@@ -7212,7 +7165,6 @@ export {
|
|
|
7212
7165
|
switchBranch,
|
|
7213
7166
|
updateNodeContent,
|
|
7214
7167
|
useArtifactTreeNavigation,
|
|
7215
|
-
useArtifacts,
|
|
7216
7168
|
useResizable,
|
|
7217
7169
|
useScrollAnchor,
|
|
7218
7170
|
useToast,
|