@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.mjs CHANGED
@@ -6202,9 +6202,9 @@ function areAllTasksSettled(tasks) {
6202
6202
  // src/components/chat/ToolSidebar.tsx
6203
6203
  import React71 from "react";
6204
6204
  var ToolSidebar = React71.forwardRef(
6205
- ({ tools, activeTools, onToggleTool, className, ...rest }, ref) => {
6206
- const topTools = tools.filter((t) => t.group === "top");
6207
- const bottomTools = tools.filter((t) => t.group === "bottom");
6205
+ ({ tools, activeTools, onToggleTool, side, className, ...rest }, ref) => {
6206
+ const topTools = tools.filter((t) => t.group === `top-${side}`);
6207
+ const bottomTools = tools.filter((t) => t.group === `bottom-${side}`);
6208
6208
  const isActive = (toolId) => {
6209
6209
  const tool = tools.find((t) => t.id === toolId);
6210
6210
  if (!tool) return false;
@@ -6232,7 +6232,8 @@ var ToolSidebar = React71.forwardRef(
6232
6232
  {
6233
6233
  ref,
6234
6234
  className: cx(
6235
- "h-full w-9 bg-charcoal/80 border-l border-ash/40 flex flex-col items-center shrink-0 py-2",
6235
+ "h-full w-9 bg-charcoal/80 flex flex-col items-center shrink-0 py-2",
6236
+ side === "left" ? "border-r border-ash/40" : "border-l border-ash/40",
6236
6237
  className
6237
6238
  ),
6238
6239
  ...rest
@@ -6248,7 +6249,7 @@ ToolSidebar.displayName = "ToolSidebar";
6248
6249
  // src/components/chat/ToolPanelContainer.tsx
6249
6250
  import React72, { useCallback as useCallback16, useEffect as useEffect13, useRef as useRef11, useState as useState17 } from "react";
6250
6251
  var ToolPanelContainer = React72.forwardRef(
6251
- ({ topContent, bottomContent, width, onResizeStart, className, ...rest }, ref) => {
6252
+ ({ topContent, bottomContent, width, onResizeStart, side = "right", className, ...rest }, ref) => {
6252
6253
  const [topPercent, setTopPercent] = useState17(60);
6253
6254
  const [isResizingHeight, setIsResizingHeight] = useState17(false);
6254
6255
  const containerRef = useRef11(null);
@@ -6306,7 +6307,8 @@ var ToolPanelContainer = React72.forwardRef(
6306
6307
  else if (ref) ref.current = node;
6307
6308
  },
6308
6309
  className: cx(
6309
- "h-full bg-charcoal/50 border-l border-ash/40 flex flex-col relative shrink-0",
6310
+ "h-full bg-charcoal/50 flex flex-col relative shrink-0",
6311
+ side === "left" ? "border-r border-ash/40" : "border-l border-ash/40",
6310
6312
  className
6311
6313
  ),
6312
6314
  style: width ? { width } : void 0,
@@ -6317,9 +6319,9 @@ var ToolPanelContainer = React72.forwardRef(
6317
6319
  {
6318
6320
  onMouseDown: onResizeStart,
6319
6321
  className: cx(
6320
- "absolute top-0 left-0 w-1 h-full cursor-col-resize z-50",
6322
+ "absolute top-0 w-1 h-full cursor-col-resize z-50",
6321
6323
  "hover:bg-gold/50 transition-colors",
6322
- "after:absolute after:inset-y-0 after:-left-1 after:w-2"
6324
+ 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"
6323
6325
  )
6324
6326
  }
6325
6327
  ),
@@ -6443,6 +6445,7 @@ var ChatInterface = React73.forwardRef(
6443
6445
  onArtifactsPanelOpenChange,
6444
6446
  tasks = [],
6445
6447
  tasksTitle,
6448
+ tools: externalTools = [],
6446
6449
  className,
6447
6450
  ...rest
6448
6451
  }, ref) => {
@@ -6450,21 +6453,24 @@ var ChatInterface = React73.forwardRef(
6450
6453
  const prevArtifactNodesRef = useRef13([]);
6451
6454
  const prevTasksRef = useRef13([]);
6452
6455
  const [internalTools, setInternalTools] = useState19({
6453
- top: null,
6454
- bottom: null
6456
+ "top-left": null,
6457
+ "bottom-left": null,
6458
+ "top-right": null,
6459
+ "bottom-right": null
6455
6460
  });
6456
6461
  const dismissedToolsRef = useRef13(/* @__PURE__ */ new Set());
6457
6462
  const isPanelControlled = isArtifactsPanelOpen !== void 0;
6458
6463
  const activeTools = useMemo4(() => {
6459
6464
  if (isPanelControlled) {
6460
6465
  return {
6461
- top: isArtifactsPanelOpen ? "artifacts" : internalTools.top,
6462
- bottom: internalTools.bottom
6466
+ ...internalTools,
6467
+ "top-right": isArtifactsPanelOpen ? "artifacts" : internalTools["top-right"]
6463
6468
  };
6464
6469
  }
6465
6470
  return internalTools;
6466
6471
  }, [isPanelControlled, isArtifactsPanelOpen, internalTools]);
6467
- const isAnyToolOpen = activeTools.top !== null || activeTools.bottom !== null;
6472
+ const isLeftPanelOpen = activeTools["top-left"] !== null || activeTools["bottom-left"] !== null;
6473
+ const isRightPanelOpen = activeTools["top-right"] !== null || activeTools["bottom-right"] !== null;
6468
6474
  const {
6469
6475
  width: sidebarWidth,
6470
6476
  startResizing: startResizingSidebar
@@ -6475,20 +6481,44 @@ var ChatInterface = React73.forwardRef(
6475
6481
  direction: "right"
6476
6482
  });
6477
6483
  const {
6478
- width: toolsWidth,
6479
- startResizing: startResizingTools
6484
+ width: rightToolsWidth,
6485
+ startResizing: startResizingRightTools
6480
6486
  } = useResizable({
6481
6487
  initialWidthPercent: 50,
6482
6488
  minWidthPercent: 25,
6483
6489
  maxWidthPercent: 70,
6484
6490
  direction: "left"
6485
6491
  });
6492
+ const {
6493
+ width: leftToolsWidth,
6494
+ startResizing: startResizingLeftTools
6495
+ } = useResizable({
6496
+ initialWidthPercent: 25,
6497
+ minWidthPercent: 15,
6498
+ maxWidthPercent: 40,
6499
+ direction: "right"
6500
+ });
6501
+ const allSettled = tasks.length === 0 || areAllTasksSettled(tasks);
6502
+ const allToolDefinitions = useMemo4(() => {
6503
+ const builtIn = [
6504
+ { id: "history", icon: /* @__PURE__ */ React73.createElement(HistoryIcon, null), label: "History", group: "top-left" },
6505
+ { id: "artifacts", icon: /* @__PURE__ */ React73.createElement(MediaIcon, null), label: "Artifacts", group: "top-right" },
6506
+ {
6507
+ id: "todos",
6508
+ icon: allSettled ? /* @__PURE__ */ React73.createElement(CheckSquareIcon, null) : /* @__PURE__ */ React73.createElement(SquareLoaderIcon, null),
6509
+ label: "Tasks",
6510
+ group: "bottom-right"
6511
+ }
6512
+ ];
6513
+ const external = externalTools.map(({ content: _content, ...def }) => def);
6514
+ return [...builtIn, ...external];
6515
+ }, [allSettled, externalTools]);
6486
6516
  const toggleTool = useCallback18((toolId) => {
6487
- const toolDef = TOOL_DEFINITIONS.find((t) => t.id === toolId);
6517
+ const toolDef = allToolDefinitions.find((t) => t.id === toolId);
6488
6518
  if (!toolDef) return;
6489
6519
  const group = toolDef.group;
6490
6520
  if (toolId === "artifacts" && isPanelControlled) {
6491
- const isCurrentlyOpen = activeTools.top === "artifacts";
6521
+ const isCurrentlyOpen = activeTools["top-right"] === "artifacts";
6492
6522
  if (isCurrentlyOpen) {
6493
6523
  dismissedToolsRef.current.add("artifacts");
6494
6524
  } else {
@@ -6509,7 +6539,7 @@ var ChatInterface = React73.forwardRef(
6509
6539
  [group]: isCurrentlyOpen ? null : toolId
6510
6540
  };
6511
6541
  });
6512
- }, [isPanelControlled, activeTools.top, onArtifactsPanelOpenChange]);
6542
+ }, [allToolDefinitions, isPanelControlled, activeTools, onArtifactsPanelOpenChange]);
6513
6543
  const isTreeMode = !!conversationTree;
6514
6544
  const effectiveMessages = useMemo4(() => {
6515
6545
  if (isTreeMode && conversationTree) {
@@ -6534,7 +6564,7 @@ var ChatInterface = React73.forwardRef(
6534
6564
  const prevNodes = prevArtifactNodesRef.current;
6535
6565
  const hasNewOrChangedNode = nodes.length !== prevNodes.length || nodes.some((n, i) => n.id !== prevNodes[i]?.id);
6536
6566
  if (!isPanelControlled && hasNewOrChangedNode && nodes.length > 0 && !dismissedToolsRef.current.has("artifacts")) {
6537
- setInternalTools((prev) => ({ ...prev, top: "artifacts" }));
6567
+ setInternalTools((prev) => ({ ...prev, "top-right": "artifacts" }));
6538
6568
  }
6539
6569
  const hasNewOrUpdatedTask = (curr, prev) => {
6540
6570
  return curr.some((c) => {
@@ -6546,7 +6576,7 @@ var ChatInterface = React73.forwardRef(
6546
6576
  });
6547
6577
  };
6548
6578
  if (hasNewOrUpdatedTask(tasks, prevTasksRef.current) && !dismissedToolsRef.current.has("todos")) {
6549
- setInternalTools((prev) => ({ ...prev, bottom: "todos" }));
6579
+ setInternalTools((prev) => ({ ...prev, "bottom-right": "todos" }));
6550
6580
  }
6551
6581
  prevArtifactNodesRef.current = nodes;
6552
6582
  prevTasksRef.current = tasks;
@@ -6599,24 +6629,35 @@ var ChatInterface = React73.forwardRef(
6599
6629
  setSidebarCollapsed((prev) => !prev);
6600
6630
  }, []);
6601
6631
  const isEmpty = effectiveMessages.length === 0;
6602
- const allSettled = tasks.length === 0 || areAllTasksSettled(tasks);
6603
- const toolDefinitions = useMemo4(() => [
6604
- {
6605
- id: "artifacts",
6606
- icon: /* @__PURE__ */ React73.createElement(MediaIcon, null),
6607
- label: "Artifacts",
6608
- group: "top"
6609
- },
6610
- {
6611
- id: "todos",
6612
- icon: allSettled ? /* @__PURE__ */ React73.createElement(CheckSquareIcon, null) : /* @__PURE__ */ React73.createElement(SquareLoaderIcon, null),
6613
- label: "Tasks",
6614
- group: "bottom"
6615
- }
6616
- ], [allSettled]);
6632
+ const leftToolDefs = useMemo4(
6633
+ () => allToolDefinitions.filter((t) => t.group === "top-left" || t.group === "bottom-left"),
6634
+ [allToolDefinitions]
6635
+ );
6636
+ const rightToolDefs = useMemo4(
6637
+ () => allToolDefinitions.filter((t) => t.group === "top-right" || t.group === "bottom-right"),
6638
+ [allToolDefinitions]
6639
+ );
6640
+ const hasLeftTools = leftToolDefs.length > 0;
6641
+ const hasRightTools = rightToolDefs.length > 0;
6617
6642
  const renderToolContent = (toolId) => {
6618
6643
  if (!toolId) return null;
6619
6644
  switch (toolId) {
6645
+ case "history":
6646
+ return /* @__PURE__ */ React73.createElement("div", { className: "h-full flex flex-col" }, /* @__PURE__ */ React73.createElement("div", { className: "flex items-center p-4 border-b border-ash/40 shrink-0" }, /* @__PURE__ */ React73.createElement("h3", { className: "text-xs font-medium text-white" }, "History")), /* @__PURE__ */ React73.createElement("div", { className: "flex-1 overflow-y-auto py-2" }, conversations.length === 0 ? /* @__PURE__ */ React73.createElement("p", { className: "px-4 py-2 text-xs text-silver/60" }, "No conversations yet") : /* @__PURE__ */ React73.createElement("div", { className: "space-y-1 px-2" }, conversations.map((conversation) => /* @__PURE__ */ React73.createElement(
6647
+ "button",
6648
+ {
6649
+ key: conversation.id,
6650
+ onClick: () => onSelectConversation?.(conversation.id),
6651
+ className: cx(
6652
+ "w-full px-3 py-2 text-left",
6653
+ "transition-colors duration-150",
6654
+ conversation.isActive ? "bg-ash/40 text-white" : "text-silver hover:bg-ash/20 hover:text-white"
6655
+ )
6656
+ },
6657
+ /* @__PURE__ */ React73.createElement("p", { className: "text-sm font-medium truncate" }, conversation.title),
6658
+ conversation.preview && /* @__PURE__ */ React73.createElement("p", { className: "text-xs text-silver/60 truncate mt-0.5" }, conversation.preview),
6659
+ conversation.timestamp && /* @__PURE__ */ React73.createElement("p", { className: "text-xs text-silver/40 mt-1" }, conversation.timestamp)
6660
+ )))));
6620
6661
  case "artifacts":
6621
6662
  return /* @__PURE__ */ React73.createElement(
6622
6663
  ArtifactsPanel,
@@ -6627,8 +6668,10 @@ var ChatInterface = React73.forwardRef(
6627
6668
  );
6628
6669
  case "todos":
6629
6670
  return tasks.length > 0 ? /* @__PURE__ */ React73.createElement(TodosList, { tasks, title: tasksTitle, className: "h-full" }) : /* @__PURE__ */ React73.createElement("div", { className: "h-full flex flex-col" }, /* @__PURE__ */ React73.createElement("div", { className: "flex items-center p-4 border-b border-ash/40 shrink-0" }, /* @__PURE__ */ React73.createElement("h3", { className: "text-xs font-medium text-white" }, "Tasks")), /* @__PURE__ */ React73.createElement("div", { className: "flex-1 flex items-center justify-center" }, /* @__PURE__ */ React73.createElement("p", { className: "text-xs text-silver/60" }, "No tasks")));
6630
- default:
6631
- return null;
6671
+ default: {
6672
+ const externalTool = externalTools.find((t) => t.id === toolId);
6673
+ return externalTool?.content ?? null;
6674
+ }
6632
6675
  }
6633
6676
  };
6634
6677
  return /* @__PURE__ */ React73.createElement(
@@ -6650,6 +6693,25 @@ var ChatInterface = React73.forwardRef(
6650
6693
  onResizeStart: startResizingSidebar
6651
6694
  }
6652
6695
  ),
6696
+ hasLeftTools && /* @__PURE__ */ React73.createElement(
6697
+ ToolSidebar,
6698
+ {
6699
+ tools: leftToolDefs,
6700
+ activeTools,
6701
+ onToggleTool: toggleTool,
6702
+ side: "left"
6703
+ }
6704
+ ),
6705
+ isLeftPanelOpen && /* @__PURE__ */ React73.createElement(
6706
+ ToolPanelContainer,
6707
+ {
6708
+ topContent: renderToolContent(activeTools["top-left"]),
6709
+ bottomContent: renderToolContent(activeTools["bottom-left"]),
6710
+ width: leftToolsWidth,
6711
+ onResizeStart: startResizingLeftTools,
6712
+ side: "left"
6713
+ }
6714
+ ),
6653
6715
  /* @__PURE__ */ React73.createElement("div", { className: "flex-1 flex flex-col min-w-0 relative" }, /* @__PURE__ */ React73.createElement("div", { className: cx(
6654
6716
  "flex-1 flex flex-col min-h-0 relative",
6655
6717
  isEmpty ? "justify-center" : "justify-start"
@@ -6689,31 +6751,29 @@ var ChatInterface = React73.forwardRef(
6689
6751
  "transition-all duration-500 ease-in-out",
6690
6752
  isEmpty ? "flex-1" : "flex-zero"
6691
6753
  ) }))),
6692
- isAnyToolOpen && /* @__PURE__ */ React73.createElement(
6754
+ isRightPanelOpen && /* @__PURE__ */ React73.createElement(
6693
6755
  ToolPanelContainer,
6694
6756
  {
6695
- topContent: renderToolContent(activeTools.top),
6696
- bottomContent: renderToolContent(activeTools.bottom),
6697
- width: toolsWidth,
6698
- onResizeStart: startResizingTools
6757
+ topContent: renderToolContent(activeTools["top-right"]),
6758
+ bottomContent: renderToolContent(activeTools["bottom-right"]),
6759
+ width: rightToolsWidth,
6760
+ onResizeStart: startResizingRightTools,
6761
+ side: "right"
6699
6762
  }
6700
6763
  ),
6701
- /* @__PURE__ */ React73.createElement(
6764
+ hasRightTools && /* @__PURE__ */ React73.createElement(
6702
6765
  ToolSidebar,
6703
6766
  {
6704
- tools: toolDefinitions,
6767
+ tools: rightToolDefs,
6705
6768
  activeTools,
6706
- onToggleTool: toggleTool
6769
+ onToggleTool: toggleTool,
6770
+ side: "right"
6707
6771
  }
6708
6772
  )
6709
6773
  );
6710
6774
  }
6711
6775
  );
6712
6776
  ChatInterface.displayName = "ChatInterface";
6713
- var TOOL_DEFINITIONS = [
6714
- { id: "artifacts", icon: null, label: "Artifacts", group: "top" },
6715
- { id: "todos", icon: null, label: "Tasks", group: "bottom" }
6716
- ];
6717
6777
 
6718
6778
  // src/components/chat/MessageActions.tsx
6719
6779
  import React74, { useCallback as useCallback19, useState as useState20 } from "react";