@lukeashford/aurelius 3.0.0 → 3.1.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
@@ -6356,9 +6356,9 @@ function areAllTasksSettled(tasks) {
6356
6356
  // src/components/chat/ToolSidebar.tsx
6357
6357
  var import_react74 = __toESM(require("react"));
6358
6358
  var ToolSidebar = import_react74.default.forwardRef(
6359
- ({ tools, activeTools, onToggleTool, className, ...rest }, ref) => {
6360
- const topTools = tools.filter((t) => t.group === "top");
6361
- const bottomTools = tools.filter((t) => t.group === "bottom");
6359
+ ({ tools, activeTools, onToggleTool, side, className, ...rest }, ref) => {
6360
+ const topTools = tools.filter((t) => t.group === `top-${side}`);
6361
+ const bottomTools = tools.filter((t) => t.group === `bottom-${side}`);
6362
6362
  const isActive = (toolId) => {
6363
6363
  const tool = tools.find((t) => t.id === toolId);
6364
6364
  if (!tool) return false;
@@ -6386,7 +6386,8 @@ var ToolSidebar = import_react74.default.forwardRef(
6386
6386
  {
6387
6387
  ref,
6388
6388
  className: cx(
6389
- "h-full w-9 bg-charcoal/80 border-l border-ash/40 flex flex-col items-center shrink-0 py-2",
6389
+ "h-full w-9 bg-charcoal/80 flex flex-col items-center shrink-0 py-2",
6390
+ side === "left" ? "border-r border-ash/40" : "border-l border-ash/40",
6390
6391
  className
6391
6392
  ),
6392
6393
  ...rest
@@ -6402,7 +6403,7 @@ ToolSidebar.displayName = "ToolSidebar";
6402
6403
  // src/components/chat/ToolPanelContainer.tsx
6403
6404
  var import_react75 = __toESM(require("react"));
6404
6405
  var ToolPanelContainer = import_react75.default.forwardRef(
6405
- ({ topContent, bottomContent, width, onResizeStart, className, ...rest }, ref) => {
6406
+ ({ topContent, bottomContent, width, onResizeStart, side = "right", className, ...rest }, ref) => {
6406
6407
  const [topPercent, setTopPercent] = (0, import_react75.useState)(60);
6407
6408
  const [isResizingHeight, setIsResizingHeight] = (0, import_react75.useState)(false);
6408
6409
  const containerRef = (0, import_react75.useRef)(null);
@@ -6460,7 +6461,8 @@ var ToolPanelContainer = import_react75.default.forwardRef(
6460
6461
  else if (ref) ref.current = node;
6461
6462
  },
6462
6463
  className: cx(
6463
- "h-full bg-charcoal/50 border-l border-ash/40 flex flex-col relative shrink-0",
6464
+ "h-full bg-charcoal/50 flex flex-col relative shrink-0",
6465
+ side === "left" ? "border-r border-ash/40" : "border-l border-ash/40",
6464
6466
  className
6465
6467
  ),
6466
6468
  style: width ? { width } : void 0,
@@ -6471,9 +6473,9 @@ var ToolPanelContainer = import_react75.default.forwardRef(
6471
6473
  {
6472
6474
  onMouseDown: onResizeStart,
6473
6475
  className: cx(
6474
- "absolute top-0 left-0 w-1 h-full cursor-col-resize z-50",
6476
+ "absolute top-0 w-1 h-full cursor-col-resize z-50",
6475
6477
  "hover:bg-gold/50 transition-colors",
6476
- "after:absolute after:inset-y-0 after:-left-1 after:w-2"
6478
+ side === "left" ? "right-0 after:absolute after:inset-y-0 after:-right-1 after:w-2" : "left-0 after:absolute after:inset-y-0 after:-left-1 after:w-2"
6477
6479
  )
6478
6480
  }
6479
6481
  ),
@@ -6597,6 +6599,7 @@ var ChatInterface = import_react77.default.forwardRef(
6597
6599
  onArtifactsPanelOpenChange,
6598
6600
  tasks = [],
6599
6601
  tasksTitle,
6602
+ tools: externalTools = [],
6600
6603
  className,
6601
6604
  ...rest
6602
6605
  }, ref) => {
@@ -6604,21 +6607,24 @@ var ChatInterface = import_react77.default.forwardRef(
6604
6607
  const prevArtifactNodesRef = (0, import_react77.useRef)([]);
6605
6608
  const prevTasksRef = (0, import_react77.useRef)([]);
6606
6609
  const [internalTools, setInternalTools] = (0, import_react77.useState)({
6607
- top: null,
6608
- bottom: null
6610
+ "top-left": null,
6611
+ "bottom-left": null,
6612
+ "top-right": null,
6613
+ "bottom-right": null
6609
6614
  });
6610
6615
  const dismissedToolsRef = (0, import_react77.useRef)(/* @__PURE__ */ new Set());
6611
6616
  const isPanelControlled = isArtifactsPanelOpen !== void 0;
6612
6617
  const activeTools = (0, import_react77.useMemo)(() => {
6613
6618
  if (isPanelControlled) {
6614
6619
  return {
6615
- top: isArtifactsPanelOpen ? "artifacts" : internalTools.top,
6616
- bottom: internalTools.bottom
6620
+ ...internalTools,
6621
+ "top-right": isArtifactsPanelOpen ? "artifacts" : internalTools["top-right"]
6617
6622
  };
6618
6623
  }
6619
6624
  return internalTools;
6620
6625
  }, [isPanelControlled, isArtifactsPanelOpen, internalTools]);
6621
- const isAnyToolOpen = activeTools.top !== null || activeTools.bottom !== null;
6626
+ const isLeftPanelOpen = activeTools["top-left"] !== null || activeTools["bottom-left"] !== null;
6627
+ const isRightPanelOpen = activeTools["top-right"] !== null || activeTools["bottom-right"] !== null;
6622
6628
  const {
6623
6629
  width: sidebarWidth,
6624
6630
  startResizing: startResizingSidebar
@@ -6629,20 +6635,44 @@ var ChatInterface = import_react77.default.forwardRef(
6629
6635
  direction: "right"
6630
6636
  });
6631
6637
  const {
6632
- width: toolsWidth,
6633
- startResizing: startResizingTools
6638
+ width: rightToolsWidth,
6639
+ startResizing: startResizingRightTools
6634
6640
  } = useResizable({
6635
6641
  initialWidthPercent: 50,
6636
6642
  minWidthPercent: 25,
6637
6643
  maxWidthPercent: 70,
6638
6644
  direction: "left"
6639
6645
  });
6646
+ const {
6647
+ width: leftToolsWidth,
6648
+ startResizing: startResizingLeftTools
6649
+ } = useResizable({
6650
+ initialWidthPercent: 25,
6651
+ minWidthPercent: 15,
6652
+ maxWidthPercent: 40,
6653
+ direction: "right"
6654
+ });
6655
+ const allSettled = tasks.length === 0 || areAllTasksSettled(tasks);
6656
+ const allToolDefinitions = (0, import_react77.useMemo)(() => {
6657
+ const builtIn = [
6658
+ { id: "history", icon: /* @__PURE__ */ import_react77.default.createElement(HistoryIcon, null), label: "History", group: "top-left" },
6659
+ { id: "artifacts", icon: /* @__PURE__ */ import_react77.default.createElement(MediaIcon, null), label: "Artifacts", group: "top-right" },
6660
+ {
6661
+ id: "todos",
6662
+ icon: allSettled ? /* @__PURE__ */ import_react77.default.createElement(CheckSquareIcon, null) : /* @__PURE__ */ import_react77.default.createElement(SquareLoaderIcon, null),
6663
+ label: "Tasks",
6664
+ group: "bottom-right"
6665
+ }
6666
+ ];
6667
+ const external = externalTools.map(({ content: _content, ...def }) => def);
6668
+ return [...builtIn, ...external];
6669
+ }, [allSettled, externalTools]);
6640
6670
  const toggleTool = (0, import_react77.useCallback)((toolId) => {
6641
- const toolDef = TOOL_DEFINITIONS.find((t) => t.id === toolId);
6671
+ const toolDef = allToolDefinitions.find((t) => t.id === toolId);
6642
6672
  if (!toolDef) return;
6643
6673
  const group = toolDef.group;
6644
6674
  if (toolId === "artifacts" && isPanelControlled) {
6645
- const isCurrentlyOpen = activeTools.top === "artifacts";
6675
+ const isCurrentlyOpen = activeTools["top-right"] === "artifacts";
6646
6676
  if (isCurrentlyOpen) {
6647
6677
  dismissedToolsRef.current.add("artifacts");
6648
6678
  } else {
@@ -6663,7 +6693,7 @@ var ChatInterface = import_react77.default.forwardRef(
6663
6693
  [group]: isCurrentlyOpen ? null : toolId
6664
6694
  };
6665
6695
  });
6666
- }, [isPanelControlled, activeTools.top, onArtifactsPanelOpenChange]);
6696
+ }, [allToolDefinitions, isPanelControlled, activeTools, onArtifactsPanelOpenChange]);
6667
6697
  const isTreeMode = !!conversationTree;
6668
6698
  const effectiveMessages = (0, import_react77.useMemo)(() => {
6669
6699
  if (isTreeMode && conversationTree) {
@@ -6688,7 +6718,7 @@ var ChatInterface = import_react77.default.forwardRef(
6688
6718
  const prevNodes = prevArtifactNodesRef.current;
6689
6719
  const hasNewOrChangedNode = nodes.length !== prevNodes.length || nodes.some((n, i) => n.id !== prevNodes[i]?.id);
6690
6720
  if (!isPanelControlled && hasNewOrChangedNode && nodes.length > 0 && !dismissedToolsRef.current.has("artifacts")) {
6691
- setInternalTools((prev) => ({ ...prev, top: "artifacts" }));
6721
+ setInternalTools((prev) => ({ ...prev, "top-right": "artifacts" }));
6692
6722
  }
6693
6723
  const hasNewOrUpdatedTask = (curr, prev) => {
6694
6724
  return curr.some((c) => {
@@ -6700,7 +6730,7 @@ var ChatInterface = import_react77.default.forwardRef(
6700
6730
  });
6701
6731
  };
6702
6732
  if (hasNewOrUpdatedTask(tasks, prevTasksRef.current) && !dismissedToolsRef.current.has("todos")) {
6703
- setInternalTools((prev) => ({ ...prev, bottom: "todos" }));
6733
+ setInternalTools((prev) => ({ ...prev, "bottom-right": "todos" }));
6704
6734
  }
6705
6735
  prevArtifactNodesRef.current = nodes;
6706
6736
  prevTasksRef.current = tasks;
@@ -6753,24 +6783,35 @@ var ChatInterface = import_react77.default.forwardRef(
6753
6783
  setSidebarCollapsed((prev) => !prev);
6754
6784
  }, []);
6755
6785
  const isEmpty = effectiveMessages.length === 0;
6756
- const allSettled = tasks.length === 0 || areAllTasksSettled(tasks);
6757
- const toolDefinitions = (0, import_react77.useMemo)(() => [
6758
- {
6759
- id: "artifacts",
6760
- icon: /* @__PURE__ */ import_react77.default.createElement(MediaIcon, null),
6761
- label: "Artifacts",
6762
- group: "top"
6763
- },
6764
- {
6765
- id: "todos",
6766
- icon: allSettled ? /* @__PURE__ */ import_react77.default.createElement(CheckSquareIcon, null) : /* @__PURE__ */ import_react77.default.createElement(SquareLoaderIcon, null),
6767
- label: "Tasks",
6768
- group: "bottom"
6769
- }
6770
- ], [allSettled]);
6786
+ const leftToolDefs = (0, import_react77.useMemo)(
6787
+ () => allToolDefinitions.filter((t) => t.group === "top-left" || t.group === "bottom-left"),
6788
+ [allToolDefinitions]
6789
+ );
6790
+ const rightToolDefs = (0, import_react77.useMemo)(
6791
+ () => allToolDefinitions.filter((t) => t.group === "top-right" || t.group === "bottom-right"),
6792
+ [allToolDefinitions]
6793
+ );
6794
+ const hasLeftTools = leftToolDefs.length > 0;
6795
+ const hasRightTools = rightToolDefs.length > 0;
6771
6796
  const renderToolContent = (toolId) => {
6772
6797
  if (!toolId) return null;
6773
6798
  switch (toolId) {
6799
+ case "history":
6800
+ return /* @__PURE__ */ import_react77.default.createElement("div", { className: "h-full flex flex-col" }, /* @__PURE__ */ import_react77.default.createElement("div", { className: "flex items-center p-4 border-b border-ash/40 shrink-0" }, /* @__PURE__ */ import_react77.default.createElement("h3", { className: "text-xs font-medium text-white" }, "History")), /* @__PURE__ */ import_react77.default.createElement("div", { className: "flex-1 overflow-y-auto py-2" }, conversations.length === 0 ? /* @__PURE__ */ import_react77.default.createElement("p", { className: "px-4 py-2 text-xs text-silver/60" }, "No conversations yet") : /* @__PURE__ */ import_react77.default.createElement("div", { className: "space-y-1 px-2" }, conversations.map((conversation) => /* @__PURE__ */ import_react77.default.createElement(
6801
+ "button",
6802
+ {
6803
+ key: conversation.id,
6804
+ onClick: () => onSelectConversation?.(conversation.id),
6805
+ className: cx(
6806
+ "w-full px-3 py-2 text-left",
6807
+ "transition-colors duration-150",
6808
+ conversation.isActive ? "bg-ash/40 text-white" : "text-silver hover:bg-ash/20 hover:text-white"
6809
+ )
6810
+ },
6811
+ /* @__PURE__ */ import_react77.default.createElement("p", { className: "text-sm font-medium truncate" }, conversation.title),
6812
+ conversation.preview && /* @__PURE__ */ import_react77.default.createElement("p", { className: "text-xs text-silver/60 truncate mt-0.5" }, conversation.preview),
6813
+ conversation.timestamp && /* @__PURE__ */ import_react77.default.createElement("p", { className: "text-xs text-silver/40 mt-1" }, conversation.timestamp)
6814
+ )))));
6774
6815
  case "artifacts":
6775
6816
  return /* @__PURE__ */ import_react77.default.createElement(
6776
6817
  ArtifactsPanel,
@@ -6781,8 +6822,10 @@ var ChatInterface = import_react77.default.forwardRef(
6781
6822
  );
6782
6823
  case "todos":
6783
6824
  return tasks.length > 0 ? /* @__PURE__ */ import_react77.default.createElement(TodosList, { tasks, title: tasksTitle, className: "h-full" }) : /* @__PURE__ */ import_react77.default.createElement("div", { className: "h-full flex flex-col" }, /* @__PURE__ */ import_react77.default.createElement("div", { className: "flex items-center p-4 border-b border-ash/40 shrink-0" }, /* @__PURE__ */ import_react77.default.createElement("h3", { className: "text-xs font-medium text-white" }, "Tasks")), /* @__PURE__ */ import_react77.default.createElement("div", { className: "flex-1 flex items-center justify-center" }, /* @__PURE__ */ import_react77.default.createElement("p", { className: "text-xs text-silver/60" }, "No tasks")));
6784
- default:
6785
- return null;
6825
+ default: {
6826
+ const externalTool = externalTools.find((t) => t.id === toolId);
6827
+ return externalTool?.content ?? null;
6828
+ }
6786
6829
  }
6787
6830
  };
6788
6831
  return /* @__PURE__ */ import_react77.default.createElement(
@@ -6804,6 +6847,25 @@ var ChatInterface = import_react77.default.forwardRef(
6804
6847
  onResizeStart: startResizingSidebar
6805
6848
  }
6806
6849
  ),
6850
+ hasLeftTools && /* @__PURE__ */ import_react77.default.createElement(
6851
+ ToolSidebar,
6852
+ {
6853
+ tools: leftToolDefs,
6854
+ activeTools,
6855
+ onToggleTool: toggleTool,
6856
+ side: "left"
6857
+ }
6858
+ ),
6859
+ isLeftPanelOpen && /* @__PURE__ */ import_react77.default.createElement(
6860
+ ToolPanelContainer,
6861
+ {
6862
+ topContent: renderToolContent(activeTools["top-left"]),
6863
+ bottomContent: renderToolContent(activeTools["bottom-left"]),
6864
+ width: leftToolsWidth,
6865
+ onResizeStart: startResizingLeftTools,
6866
+ side: "left"
6867
+ }
6868
+ ),
6807
6869
  /* @__PURE__ */ import_react77.default.createElement("div", { className: "flex-1 flex flex-col min-w-0 relative" }, /* @__PURE__ */ import_react77.default.createElement("div", { className: cx(
6808
6870
  "flex-1 flex flex-col min-h-0 relative",
6809
6871
  isEmpty ? "justify-center" : "justify-start"
@@ -6843,31 +6905,29 @@ var ChatInterface = import_react77.default.forwardRef(
6843
6905
  "transition-all duration-500 ease-in-out",
6844
6906
  isEmpty ? "flex-1" : "flex-zero"
6845
6907
  ) }))),
6846
- isAnyToolOpen && /* @__PURE__ */ import_react77.default.createElement(
6908
+ isRightPanelOpen && /* @__PURE__ */ import_react77.default.createElement(
6847
6909
  ToolPanelContainer,
6848
6910
  {
6849
- topContent: renderToolContent(activeTools.top),
6850
- bottomContent: renderToolContent(activeTools.bottom),
6851
- width: toolsWidth,
6852
- onResizeStart: startResizingTools
6911
+ topContent: renderToolContent(activeTools["top-right"]),
6912
+ bottomContent: renderToolContent(activeTools["bottom-right"]),
6913
+ width: rightToolsWidth,
6914
+ onResizeStart: startResizingRightTools,
6915
+ side: "right"
6853
6916
  }
6854
6917
  ),
6855
- /* @__PURE__ */ import_react77.default.createElement(
6918
+ hasRightTools && /* @__PURE__ */ import_react77.default.createElement(
6856
6919
  ToolSidebar,
6857
6920
  {
6858
- tools: toolDefinitions,
6921
+ tools: rightToolDefs,
6859
6922
  activeTools,
6860
- onToggleTool: toggleTool
6923
+ onToggleTool: toggleTool,
6924
+ side: "right"
6861
6925
  }
6862
6926
  )
6863
6927
  );
6864
6928
  }
6865
6929
  );
6866
6930
  ChatInterface.displayName = "ChatInterface";
6867
- var TOOL_DEFINITIONS = [
6868
- { id: "artifacts", icon: null, label: "Artifacts", group: "top" },
6869
- { id: "todos", icon: null, label: "Tasks", group: "bottom" }
6870
- ];
6871
6931
 
6872
6932
  // src/components/chat/MessageActions.tsx
6873
6933
  var import_react78 = __toESM(require("react"));