@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.js CHANGED
@@ -6184,6 +6184,8 @@ var ChatInterface = import_react72.default.forwardRef(
6184
6184
  }, ref) => {
6185
6185
  const [sidebarCollapsed, setSidebarCollapsed] = (0, import_react72.useState)(initialSidebarCollapsed);
6186
6186
  const [internalPanelOpen, setInternalPanelOpen] = (0, import_react72.useState)(false);
6187
+ const prevArtifactsRef = (0, import_react72.useRef)([]);
6188
+ const prevTasksRef = (0, import_react72.useRef)([]);
6187
6189
  const {
6188
6190
  width: sidebarWidth,
6189
6191
  startResizing: startResizingSidebar
@@ -6229,11 +6231,44 @@ var ChatInterface = import_react72.default.forwardRef(
6229
6231
  const hasPendingArtifact = (0, import_react72.useMemo)(() => {
6230
6232
  return artifacts.some((a) => a.isPending);
6231
6233
  }, [artifacts]);
6232
- import_react72.default.useEffect(() => {
6233
- if (!isPanelControlled && artifacts.length > 0) {
6234
+ (0, import_react72.useEffect)(() => {
6235
+ if (isPanelControlled) {
6236
+ return;
6237
+ }
6238
+ const hasNewOrSignificantArtifact = artifacts.some((a) => {
6239
+ const p = prevArtifactsRef.current.find((prev) => prev.id === a.id);
6240
+ if (!p) {
6241
+ return true;
6242
+ }
6243
+ if (p.isPending && !a.isPending) {
6244
+ return true;
6245
+ }
6246
+ if (p.title !== a.title || p.type !== a.type) {
6247
+ return true;
6248
+ }
6249
+ return false;
6250
+ });
6251
+ const hasNewOrUpdatedTask = (curr, prev) => {
6252
+ return curr.some((c) => {
6253
+ const p = prev.find((x) => x.id === c.id);
6254
+ if (!p) {
6255
+ return true;
6256
+ }
6257
+ if (c.status !== p.status || c.label !== p.label) {
6258
+ return true;
6259
+ }
6260
+ if (c.subtasks && hasNewOrUpdatedTask(c.subtasks, p?.subtasks || [])) {
6261
+ return true;
6262
+ }
6263
+ return false;
6264
+ });
6265
+ };
6266
+ if (hasNewOrSignificantArtifact || hasNewOrUpdatedTask(tasks, prevTasksRef.current)) {
6234
6267
  setInternalPanelOpen(true);
6235
6268
  }
6236
- }, [artifacts.length, isPanelControlled]);
6269
+ prevArtifactsRef.current = artifacts;
6270
+ prevTasksRef.current = tasks;
6271
+ }, [artifacts, tasks, isPanelControlled]);
6237
6272
  const handleBranchSwitch = (0, import_react72.useCallback)(
6238
6273
  (nodeId, direction) => {
6239
6274
  if (!isTreeMode || !conversationTree || !onTreeChange) {