@lukeashford/aurelius 2.18.0 → 2.19.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.mjs CHANGED
@@ -4098,7 +4098,7 @@ var StreamingCursor = React54.forwardRef(
4098
4098
  StreamingCursor.displayName = "StreamingCursor";
4099
4099
 
4100
4100
  // src/components/chat/ChatInterface.tsx
4101
- import React68, { useCallback as useCallback17, useMemo as useMemo3, useState as useState17 } from "react";
4101
+ import React68, { useCallback as useCallback17, useEffect as useEffect13, useMemo as useMemo3, useRef as useRef10, useState as useState17 } from "react";
4102
4102
 
4103
4103
  // src/components/chat/ChatView.tsx
4104
4104
  import React56, { useEffect as useEffect9 } from "react";
@@ -6037,6 +6037,8 @@ var ChatInterface = React68.forwardRef(
6037
6037
  }, ref) => {
6038
6038
  const [sidebarCollapsed, setSidebarCollapsed] = useState17(initialSidebarCollapsed);
6039
6039
  const [internalPanelOpen, setInternalPanelOpen] = useState17(false);
6040
+ const prevArtifactsRef = useRef10([]);
6041
+ const prevTasksRef = useRef10([]);
6040
6042
  const {
6041
6043
  width: sidebarWidth,
6042
6044
  startResizing: startResizingSidebar
@@ -6082,11 +6084,44 @@ var ChatInterface = React68.forwardRef(
6082
6084
  const hasPendingArtifact = useMemo3(() => {
6083
6085
  return artifacts.some((a) => a.isPending);
6084
6086
  }, [artifacts]);
6085
- React68.useEffect(() => {
6086
- if (!isPanelControlled && artifacts.length > 0) {
6087
+ useEffect13(() => {
6088
+ if (isPanelControlled) {
6089
+ return;
6090
+ }
6091
+ const hasNewOrSignificantArtifact = artifacts.some((a) => {
6092
+ const p = prevArtifactsRef.current.find((prev) => prev.id === a.id);
6093
+ if (!p) {
6094
+ return true;
6095
+ }
6096
+ if (p.isPending && !a.isPending) {
6097
+ return true;
6098
+ }
6099
+ if (p.title !== a.title || p.type !== a.type) {
6100
+ return true;
6101
+ }
6102
+ return false;
6103
+ });
6104
+ const hasNewOrUpdatedTask = (curr, prev) => {
6105
+ return curr.some((c) => {
6106
+ const p = prev.find((x) => x.id === c.id);
6107
+ if (!p) {
6108
+ return true;
6109
+ }
6110
+ if (c.status !== p.status || c.label !== p.label) {
6111
+ return true;
6112
+ }
6113
+ if (c.subtasks && hasNewOrUpdatedTask(c.subtasks, p?.subtasks || [])) {
6114
+ return true;
6115
+ }
6116
+ return false;
6117
+ });
6118
+ };
6119
+ if (hasNewOrSignificantArtifact || hasNewOrUpdatedTask(tasks, prevTasksRef.current)) {
6087
6120
  setInternalPanelOpen(true);
6088
6121
  }
6089
- }, [artifacts.length, isPanelControlled]);
6122
+ prevArtifactsRef.current = artifacts;
6123
+ prevTasksRef.current = tasks;
6124
+ }, [artifacts, tasks, isPanelControlled]);
6090
6125
  const handleBranchSwitch = useCallback17(
6091
6126
  (nodeId, direction) => {
6092
6127
  if (!isTreeMode || !conversationTree || !onTreeChange) {