@lukeashford/aurelius 2.17.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";
@@ -5297,6 +5297,16 @@ PdfCard.displayName = "PdfCard";
5297
5297
 
5298
5298
  // src/components/ScriptCard.tsx
5299
5299
  import React63 from "react";
5300
+ var SCRIPT_ELEMENT_TYPES = {
5301
+ SCENE_HEADING: "scene-heading",
5302
+ ACTION: "action",
5303
+ CHARACTER: "character",
5304
+ DIALOGUE: "dialogue",
5305
+ PARENTHETICAL: "parenthetical",
5306
+ TRANSITION: "transition",
5307
+ TITLE: "title",
5308
+ SUBTITLE: "subtitle"
5309
+ };
5300
5310
  function ScriptElementRenderer({ element }) {
5301
5311
  switch (element.type) {
5302
5312
  case "scene-heading":
@@ -5399,6 +5409,14 @@ var TextCard = React64.forwardRef(
5399
5409
  TextCard.displayName = "TextCard";
5400
5410
 
5401
5411
  // src/components/ArtifactCard.tsx
5412
+ var ARTIFACT_TYPES = {
5413
+ TEXT: "TEXT",
5414
+ IMAGE: "IMAGE",
5415
+ VIDEO: "VIDEO",
5416
+ AUDIO: "AUDIO",
5417
+ SCRIPT: "SCRIPT",
5418
+ PDF: "PDF"
5419
+ };
5402
5420
  var ArtifactCard = React65.forwardRef(
5403
5421
  ({ artifact, onExpand, isLoading, className, ...props }, ref) => {
5404
5422
  const commonProps = {
@@ -5778,6 +5796,13 @@ ArtifactsPanelToggle.displayName = "ArtifactsPanelToggle";
5778
5796
 
5779
5797
  // src/components/chat/TodosList.tsx
5780
5798
  import React67, { useMemo as useMemo2 } from "react";
5799
+ var TASK_STATUSES = {
5800
+ PENDING: "pending",
5801
+ IN_PROGRESS: "in_progress",
5802
+ DONE: "done",
5803
+ CANCELLED: "cancelled",
5804
+ FAILED: "failed"
5805
+ };
5781
5806
  function TaskIcon({ status }) {
5782
5807
  switch (status) {
5783
5808
  case "done":
@@ -5842,15 +5867,21 @@ var TodosList = React67.forwardRef(
5842
5867
  const countCompleted = (taskList) => {
5843
5868
  let count = 0;
5844
5869
  for (const task of taskList) {
5845
- if (task.status === "done") count++;
5846
- if (task.subtasks) count += countCompleted(task.subtasks);
5870
+ if (task.status === "done") {
5871
+ count++;
5872
+ }
5873
+ if (task.subtasks) {
5874
+ count += countCompleted(task.subtasks);
5875
+ }
5847
5876
  }
5848
5877
  return count;
5849
5878
  };
5850
5879
  const countTotal = (taskList) => {
5851
5880
  let count = taskList.length;
5852
5881
  for (const task of taskList) {
5853
- if (task.subtasks) count += countTotal(task.subtasks);
5882
+ if (task.subtasks) {
5883
+ count += countTotal(task.subtasks);
5884
+ }
5854
5885
  }
5855
5886
  return count;
5856
5887
  };
@@ -5869,7 +5900,14 @@ var TodosList = React67.forwardRef(
5869
5900
  style: { maxHeight: "25vh" },
5870
5901
  ...rest
5871
5902
  },
5872
- /* @__PURE__ */ React67.createElement("div", { className: "flex items-center justify-between px-4 py-2 border-b border-ash/40 flex-shrink-0" }, /* @__PURE__ */ React67.createElement("h4", { className: "text-xs font-medium text-white" }, title), /* @__PURE__ */ React67.createElement("span", { className: "text-xs text-silver/60" }, countCompleted(tasks), "/", countTotal(tasks))),
5903
+ /* @__PURE__ */ React67.createElement(
5904
+ "div",
5905
+ {
5906
+ className: "flex items-center justify-between px-4 py-2 border-b border-ash/40 flex-shrink-0"
5907
+ },
5908
+ /* @__PURE__ */ React67.createElement("h4", { className: "text-xs font-medium text-white" }, title),
5909
+ /* @__PURE__ */ React67.createElement("span", { className: "text-xs text-silver/60" }, countCompleted(tasks), "/", countTotal(tasks))
5910
+ ),
5873
5911
  /* @__PURE__ */ React67.createElement("div", { className: "flex-1 overflow-y-auto px-4 py-2" }, sortedTasks.map((task) => /* @__PURE__ */ React67.createElement(TaskItem, { key: task.id, task })))
5874
5912
  );
5875
5913
  }
@@ -5999,6 +6037,8 @@ var ChatInterface = React68.forwardRef(
5999
6037
  }, ref) => {
6000
6038
  const [sidebarCollapsed, setSidebarCollapsed] = useState17(initialSidebarCollapsed);
6001
6039
  const [internalPanelOpen, setInternalPanelOpen] = useState17(false);
6040
+ const prevArtifactsRef = useRef10([]);
6041
+ const prevTasksRef = useRef10([]);
6002
6042
  const {
6003
6043
  width: sidebarWidth,
6004
6044
  startResizing: startResizingSidebar
@@ -6044,11 +6084,44 @@ var ChatInterface = React68.forwardRef(
6044
6084
  const hasPendingArtifact = useMemo3(() => {
6045
6085
  return artifacts.some((a) => a.isPending);
6046
6086
  }, [artifacts]);
6047
- React68.useEffect(() => {
6048
- 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)) {
6049
6120
  setInternalPanelOpen(true);
6050
6121
  }
6051
- }, [artifacts.length, isPanelControlled]);
6122
+ prevArtifactsRef.current = artifacts;
6123
+ prevTasksRef.current = tasks;
6124
+ }, [artifacts, tasks, isPanelControlled]);
6052
6125
  const handleBranchSwitch = useCallback17(
6053
6126
  (nodeId, direction) => {
6054
6127
  if (!isTreeMode || !conversationTree || !onTreeChange) {
@@ -6503,6 +6576,7 @@ SectionHeading.displayName = "SectionHeading";
6503
6576
  // src/index.ts
6504
6577
  var version = "2.0.0";
6505
6578
  export {
6579
+ ARTIFACT_TYPES,
6506
6580
  Accordion,
6507
6581
  AccordionContent,
6508
6582
  AccordionItem,
@@ -6583,6 +6657,7 @@ export {
6583
6657
  PromptDialog,
6584
6658
  Radio,
6585
6659
  Row,
6660
+ SCRIPT_ELEMENT_TYPES,
6586
6661
  ScriptCard,
6587
6662
  SectionHeading,
6588
6663
  Select,
@@ -6594,6 +6669,7 @@ export {
6594
6669
  Stepper,
6595
6670
  StreamingCursor,
6596
6671
  Switch,
6672
+ TASK_STATUSES,
6597
6673
  Tab,
6598
6674
  TabList,
6599
6675
  TabPanel,