@lukeashford/aurelius 3.3.0 → 3.5.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
@@ -4157,7 +4157,7 @@ var StreamingCursor = React56.forwardRef(
4157
4157
  StreamingCursor.displayName = "StreamingCursor";
4158
4158
 
4159
4159
  // src/components/chat/ChatInterface.tsx
4160
- import React73, { useCallback as useCallback18, useEffect as useEffect15, useMemo as useMemo4, useRef as useRef13, useState as useState19 } from "react";
4160
+ import React73, { useCallback as useCallback19, useEffect as useEffect15, useMemo as useMemo4, useRef as useRef13, useState as useState20 } from "react";
4161
4161
 
4162
4162
  // src/components/chat/ChatView.tsx
4163
4163
  import React58, { useEffect as useEffect9 } from "react";
@@ -4461,7 +4461,7 @@ ChatView.displayName = "ChatView";
4461
4461
 
4462
4462
  // src/components/chat/ChatInput.tsx
4463
4463
  import React59, { useCallback as useCallback13, useEffect as useEffect10, useRef as useRef8, useState as useState13 } from "react";
4464
- import { Paperclip, Send, Square } from "lucide-react";
4464
+ import { Paperclip, Send, Square, X as X5 } from "lucide-react";
4465
4465
 
4466
4466
  // src/components/chat/types.ts
4467
4467
  function isImageFile(file) {
@@ -4643,6 +4643,8 @@ var ChatInput = React59.forwardRef(
4643
4643
  onAttachmentsChange,
4644
4644
  showAttachmentButton = true,
4645
4645
  acceptedFileTypes,
4646
+ notice,
4647
+ onInputChange,
4646
4648
  className,
4647
4649
  ...rest
4648
4650
  }, ref) => {
@@ -4689,10 +4691,11 @@ var ChatInput = React59.forwardRef(
4689
4691
  );
4690
4692
  const handleChange = useCallback13((e) => {
4691
4693
  setValue(e.target.value);
4694
+ onInputChange?.(e.target.value);
4692
4695
  const textarea = e.target;
4693
4696
  textarea.style.height = "auto";
4694
4697
  textarea.style.height = `${Math.min(textarea.scrollHeight, 200)}px`;
4695
- }, []);
4698
+ }, [onInputChange]);
4696
4699
  useEffect10(() => {
4697
4700
  if (!disabled && !isStreaming && textareaRef.current) {
4698
4701
  textareaRef.current.focus();
@@ -4776,6 +4779,23 @@ var ChatInput = React59.forwardRef(
4776
4779
  ...rest
4777
4780
  },
4778
4781
  isCentered && helperText && /* @__PURE__ */ React59.createElement("p", { className: "text-silver text-sm mb-4 text-center" }, helperText),
4782
+ notice && /* @__PURE__ */ React59.createElement("div", { className: cx(
4783
+ "w-full flex items-start gap-2 px-3 py-2 mb-1 text-xs",
4784
+ isCentered && "max-w-lg",
4785
+ notice.variant === "warning" ? "bg-gold/5 border border-gold/20 text-gold/80" : "bg-error/10 border border-error/30 text-error"
4786
+ ) }, /* @__PURE__ */ React59.createElement("span", { className: "flex-1" }, notice.content), (notice.dismissible ?? notice.variant === "warning") && notice.onDismiss && /* @__PURE__ */ React59.createElement(
4787
+ "button",
4788
+ {
4789
+ type: "button",
4790
+ onClick: notice.onDismiss,
4791
+ "aria-label": "Dismiss",
4792
+ className: cx(
4793
+ "shrink-0 opacity-60 hover:opacity-100 transition-opacity",
4794
+ notice.variant === "warning" ? "text-gold" : "text-error"
4795
+ )
4796
+ },
4797
+ /* @__PURE__ */ React59.createElement(X5, { className: "w-3 h-3" })
4798
+ )),
4779
4799
  /* @__PURE__ */ React59.createElement(
4780
4800
  "div",
4781
4801
  {
@@ -5907,8 +5927,8 @@ var ArtifactsPanelToggle = React69.forwardRef(({ artifactCount = 0, onExpand, cl
5907
5927
  ArtifactsPanelToggle.displayName = "ArtifactsPanelToggle";
5908
5928
 
5909
5929
  // src/components/chat/TodosList.tsx
5910
- import React70, { useMemo as useMemo3 } from "react";
5911
- import { Square as Square2 } from "lucide-react";
5930
+ import React70, { useCallback as useCallback16, useMemo as useMemo3, useState as useState17 } from "react";
5931
+ import { Loader2 as Loader22, Square as Square2 } from "lucide-react";
5912
5932
  var TASK_STATUSES = {
5913
5933
  PENDING: "pending",
5914
5934
  IN_PROGRESS: "in_progress",
@@ -5984,6 +6004,16 @@ function hasInProgressTask(tasks) {
5984
6004
  var TodosList = React70.forwardRef(
5985
6005
  ({ tasks, title = "Tasks", onStopAllTasks, className, ...rest }, ref) => {
5986
6006
  const sortedTasks = useMemo3(() => sortTasks(tasks), [tasks]);
6007
+ const [isStopping, setIsStopping] = useState17(false);
6008
+ const handleStopClick = useCallback16(async () => {
6009
+ if (!onStopAllTasks || isStopping) return;
6010
+ try {
6011
+ setIsStopping(true);
6012
+ await onStopAllTasks();
6013
+ } finally {
6014
+ setIsStopping(false);
6015
+ }
6016
+ }, [onStopAllTasks, isStopping]);
5987
6017
  const countCompleted = (taskList) => {
5988
6018
  let count = 0;
5989
6019
  for (const task of taskList) {
@@ -6005,7 +6035,7 @@ var TodosList = React70.forwardRef(
6005
6035
  }
6006
6036
  return count;
6007
6037
  };
6008
- const showStopButton = !!onStopAllTasks && hasInProgressTask(tasks);
6038
+ const showStopButton = !!onStopAllTasks && (hasInProgressTask(tasks) || isStopping);
6009
6039
  if (tasks.length === 0) {
6010
6040
  return null;
6011
6041
  }
@@ -6033,17 +6063,20 @@ var TodosList = React70.forwardRef(
6033
6063
  "button",
6034
6064
  {
6035
6065
  type: "button",
6036
- onClick: onStopAllTasks,
6066
+ onClick: handleStopClick,
6067
+ disabled: isStopping,
6068
+ "aria-busy": isStopping,
6069
+ "aria-label": isStopping ? "Stopping tasks" : "Stop all tasks",
6037
6070
  className: cx(
6038
6071
  "w-full flex items-center justify-center gap-2 px-3 py-1.5",
6039
- "bg-error/10 hover:bg-error/20 text-error",
6072
+ "bg-error/10 text-error",
6040
6073
  "border border-error/30",
6041
6074
  "text-xs font-medium",
6042
- "transition-colors duration-200"
6075
+ "transition-colors duration-200",
6076
+ isStopping ? "cursor-not-allowed opacity-70" : "hover:bg-error/20"
6043
6077
  )
6044
6078
  },
6045
- /* @__PURE__ */ React70.createElement(Square2, { className: "w-3 h-3 fill-current" }),
6046
- "Stop All Tasks"
6079
+ isStopping ? /* @__PURE__ */ React70.createElement(React70.Fragment, null, /* @__PURE__ */ React70.createElement(Loader22, { className: "w-3 h-3 animate-spin" }), "Stopping tasks") : /* @__PURE__ */ React70.createElement(React70.Fragment, null, /* @__PURE__ */ React70.createElement(Square2, { className: "w-3 h-3 fill-current" }), "Stop All Tasks")
6047
6080
  ))
6048
6081
  );
6049
6082
  }
@@ -6106,24 +6139,33 @@ var ToolSidebar = React71.forwardRef(
6106
6139
  ToolSidebar.displayName = "ToolSidebar";
6107
6140
 
6108
6141
  // src/components/chat/ToolPanelContainer.tsx
6109
- import React72, { useCallback as useCallback16, useEffect as useEffect13, useRef as useRef11, useState as useState17 } from "react";
6142
+ import React72, { useCallback as useCallback17, useEffect as useEffect13, useRef as useRef11, useState as useState18 } from "react";
6110
6143
  var ToolPanelContainer = React72.forwardRef(
6111
- ({ topContent, bottomContent, width, onResizeStart, side = "right", className, ...rest }, ref) => {
6112
- const [topPercent, setTopPercent] = useState17(60);
6113
- const [isResizingHeight, setIsResizingHeight] = useState17(false);
6144
+ ({
6145
+ topContent,
6146
+ bottomContent,
6147
+ width,
6148
+ onResizeStart,
6149
+ side = "right",
6150
+ className,
6151
+ initialTopPercent = 60,
6152
+ ...rest
6153
+ }, ref) => {
6154
+ const [topPercent, setTopPercent] = useState18(initialTopPercent);
6155
+ const [isResizingHeight, setIsResizingHeight] = useState18(false);
6114
6156
  const containerRef = useRef11(null);
6115
6157
  const lastY = useRef11(null);
6116
6158
  const hasBoth = topContent !== null && bottomContent !== null;
6117
- const startHeightResize = useCallback16((e) => {
6159
+ const startHeightResize = useCallback17((e) => {
6118
6160
  e.preventDefault();
6119
6161
  setIsResizingHeight(true);
6120
6162
  lastY.current = e.clientY;
6121
6163
  }, []);
6122
- const stopHeightResize = useCallback16(() => {
6164
+ const stopHeightResize = useCallback17(() => {
6123
6165
  setIsResizingHeight(false);
6124
6166
  lastY.current = null;
6125
6167
  }, []);
6126
- const resizeHeight = useCallback16(
6168
+ const resizeHeight = useCallback17(
6127
6169
  (e) => {
6128
6170
  if (!isResizingHeight || lastY.current === null || !containerRef.current) {
6129
6171
  return;
@@ -6225,26 +6267,26 @@ var ToolPanelContainer = React72.forwardRef(
6225
6267
  ToolPanelContainer.displayName = "ToolPanelContainer";
6226
6268
 
6227
6269
  // src/components/chat/hooks/useResizable.ts
6228
- import { useCallback as useCallback17, useEffect as useEffect14, useRef as useRef12, useState as useState18 } from "react";
6270
+ import { useCallback as useCallback18, useEffect as useEffect14, useRef as useRef12, useState as useState19 } from "react";
6229
6271
  function useResizable({
6230
6272
  initialWidthPercent,
6231
6273
  minWidthPercent,
6232
6274
  maxWidthPercent,
6233
6275
  direction
6234
6276
  }) {
6235
- const [widthPercent, setWidthPercent] = useState18(initialWidthPercent);
6236
- const [isResizing, setIsResizing] = useState18(false);
6277
+ const [widthPercent, setWidthPercent] = useState19(initialWidthPercent);
6278
+ const [isResizing, setIsResizing] = useState19(false);
6237
6279
  const lastX = useRef12(null);
6238
- const startResizing = useCallback17((e) => {
6280
+ const startResizing = useCallback18((e) => {
6239
6281
  e.preventDefault();
6240
6282
  setIsResizing(true);
6241
6283
  lastX.current = e.clientX;
6242
6284
  }, []);
6243
- const stopResizing = useCallback17(() => {
6285
+ const stopResizing = useCallback18(() => {
6244
6286
  setIsResizing(false);
6245
6287
  lastX.current = null;
6246
6288
  }, []);
6247
- const resize = useCallback17(
6289
+ const resize = useCallback18(
6248
6290
  (e) => {
6249
6291
  if (!isResizing || lastX.current === null) {
6250
6292
  return;
@@ -6311,13 +6353,15 @@ var ChatInterface = React73.forwardRef(
6311
6353
  tasks = [],
6312
6354
  tasksTitle,
6313
6355
  onStopAllTasks,
6356
+ inputNotice,
6357
+ onInputChange,
6314
6358
  tools: externalTools = [],
6315
6359
  className,
6316
6360
  ...rest
6317
6361
  }, ref) => {
6318
6362
  const prevArtifactNodesRef = useRef13([]);
6319
6363
  const prevTasksRef = useRef13([]);
6320
- const [internalTools, setInternalTools] = useState19({
6364
+ const [internalTools, setInternalTools] = useState20({
6321
6365
  "top-left": "history",
6322
6366
  "bottom-left": null,
6323
6367
  "top-right": null,
@@ -6340,9 +6384,9 @@ var ChatInterface = React73.forwardRef(
6340
6384
  width: rightToolsWidth,
6341
6385
  startResizing: startResizingRightTools
6342
6386
  } = useResizable({
6343
- initialWidthPercent: 50,
6344
- minWidthPercent: 25,
6345
- maxWidthPercent: 70,
6387
+ initialWidthPercent: 40,
6388
+ minWidthPercent: 30,
6389
+ maxWidthPercent: 80,
6346
6390
  direction: "left"
6347
6391
  });
6348
6392
  const {
@@ -6369,7 +6413,7 @@ var ChatInterface = React73.forwardRef(
6369
6413
  const external = externalTools.map(({ content: _content, ...def }) => def);
6370
6414
  return [...builtIn, ...external];
6371
6415
  }, [allSettled, externalTools]);
6372
- const toggleTool = useCallback18((toolId) => {
6416
+ const toggleTool = useCallback19((toolId) => {
6373
6417
  const toolDef = allToolDefinitions.find((t) => t.id === toolId);
6374
6418
  if (!toolDef) {
6375
6419
  return;
@@ -6435,10 +6479,7 @@ var ChatInterface = React73.forwardRef(
6435
6479
  if (c.status !== p.status || c.label !== p.label) {
6436
6480
  return true;
6437
6481
  }
6438
- if (c.subtasks && hasNewOrUpdatedTask(c.subtasks, p?.subtasks || [])) {
6439
- return true;
6440
- }
6441
- return false;
6482
+ return !!(c.subtasks && hasNewOrUpdatedTask(c.subtasks, p?.subtasks || []));
6442
6483
  });
6443
6484
  };
6444
6485
  if (hasNewOrUpdatedTask(tasks, prevTasksRef.current) && !dismissedToolsRef.current.has("todos")) {
@@ -6447,7 +6488,7 @@ var ChatInterface = React73.forwardRef(
6447
6488
  prevArtifactNodesRef.current = nodes;
6448
6489
  prevTasksRef.current = tasks;
6449
6490
  }, [artifactNodes, tasks, isPanelControlled]);
6450
- const handleBranchSwitch = useCallback18(
6491
+ const handleBranchSwitch = useCallback19(
6451
6492
  (nodeId, direction) => {
6452
6493
  if (!isTreeMode || !conversationTree || !onTreeChange) {
6453
6494
  return;
@@ -6487,7 +6528,7 @@ var ChatInterface = React73.forwardRef(
6487
6528
  onRetryMessage,
6488
6529
  handleBranchSwitch
6489
6530
  ]);
6490
- const handleSubmit = useCallback18(
6531
+ const handleSubmit = useCallback19(
6491
6532
  (message, attachments) => {
6492
6533
  onMessageSubmit?.(message, attachments);
6493
6534
  },
@@ -6571,7 +6612,15 @@ var ChatInterface = React73.forwardRef(
6571
6612
  }
6572
6613
  );
6573
6614
  case "todos":
6574
- return tasks.length > 0 ? /* @__PURE__ */ React73.createElement(TodosList, { tasks, title: tasksTitle, onStopAllTasks, 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")));
6615
+ return tasks.length > 0 ? /* @__PURE__ */ React73.createElement(
6616
+ TodosList,
6617
+ {
6618
+ tasks,
6619
+ title: tasksTitle,
6620
+ onStopAllTasks,
6621
+ className: "h-full"
6622
+ }
6623
+ ) : /* @__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")));
6575
6624
  default: {
6576
6625
  const externalTool = externalTools.find((t) => t.id === toolId);
6577
6626
  return externalTool?.content ?? null;
@@ -6601,7 +6650,8 @@ var ChatInterface = React73.forwardRef(
6601
6650
  bottomContent: renderToolContent(activeTools["bottom-left"]),
6602
6651
  width: leftToolsWidth,
6603
6652
  onResizeStart: startResizingLeftTools,
6604
- side: "left"
6653
+ side: "left",
6654
+ initialTopPercent: 30
6605
6655
  }
6606
6656
  ),
6607
6657
  /* @__PURE__ */ React73.createElement("div", { className: "flex-1 flex flex-col min-w-0 relative" }, /* @__PURE__ */ React73.createElement("div", { className: cx(
@@ -6637,7 +6687,9 @@ var ChatInterface = React73.forwardRef(
6637
6687
  onStop,
6638
6688
  showAttachmentButton,
6639
6689
  attachments: propsAttachments,
6640
- onAttachmentsChange
6690
+ onAttachmentsChange,
6691
+ notice: inputNotice,
6692
+ onInputChange
6641
6693
  }
6642
6694
  )), /* @__PURE__ */ React73.createElement("div", { className: cx(
6643
6695
  "transition-all duration-500 ease-in-out",
@@ -6650,7 +6702,8 @@ var ChatInterface = React73.forwardRef(
6650
6702
  bottomContent: renderToolContent(activeTools["bottom-right"]),
6651
6703
  width: rightToolsWidth,
6652
6704
  onResizeStart: startResizingRightTools,
6653
- side: "right"
6705
+ side: "right",
6706
+ initialTopPercent: 70
6654
6707
  }
6655
6708
  ),
6656
6709
  hasRightTools && /* @__PURE__ */ React73.createElement(
@@ -6668,8 +6721,8 @@ var ChatInterface = React73.forwardRef(
6668
6721
  ChatInterface.displayName = "ChatInterface";
6669
6722
 
6670
6723
  // src/components/chat/MessageActions.tsx
6671
- import React74, { useCallback as useCallback19, useState as useState20 } from "react";
6672
- import { Check as Check3, Copy, Pencil, RotateCcw, Send as Send2, X as X5 } from "lucide-react";
6724
+ import React74, { useCallback as useCallback20, useState as useState21 } from "react";
6725
+ import { Check as Check3, Copy, Pencil, RotateCcw, Send as Send2, X as X6 } from "lucide-react";
6673
6726
  var ActionButton2 = ({ onClick, label, children, className, disabled }) => /* @__PURE__ */ React74.createElement(
6674
6727
  "button",
6675
6728
  {
@@ -6698,12 +6751,12 @@ var MessageActions = React74.forwardRef(
6698
6751
  className,
6699
6752
  ...rest
6700
6753
  }, ref) => {
6701
- const [localIsEditing, setLocalIsEditing] = useState20(false);
6702
- const [localEditValue, setLocalEditValue] = useState20(content);
6703
- const [copied, setCopied] = useState20(false);
6754
+ const [localIsEditing, setLocalIsEditing] = useState21(false);
6755
+ const [localEditValue, setLocalEditValue] = useState21(content);
6756
+ const [copied, setCopied] = useState21(false);
6704
6757
  const isEditing = controlledIsEditing ?? localIsEditing;
6705
6758
  const editValue = controlledEditValue ?? localEditValue;
6706
- const setIsEditing = useCallback19(
6759
+ const setIsEditing = useCallback20(
6707
6760
  (value) => {
6708
6761
  if (onEditingChange) {
6709
6762
  onEditingChange(value);
@@ -6713,10 +6766,10 @@ var MessageActions = React74.forwardRef(
6713
6766
  },
6714
6767
  [onEditingChange]
6715
6768
  );
6716
- const setEditValue = useCallback19((value) => {
6769
+ const setEditValue = useCallback20((value) => {
6717
6770
  setLocalEditValue(value);
6718
6771
  }, []);
6719
- const handleCopy = useCallback19(async () => {
6772
+ const handleCopy = useCallback20(async () => {
6720
6773
  try {
6721
6774
  await navigator.clipboard.writeText(content);
6722
6775
  setCopied(true);
@@ -6732,22 +6785,22 @@ var MessageActions = React74.forwardRef(
6732
6785
  setTimeout(() => setCopied(false), 2e3);
6733
6786
  }
6734
6787
  }, [content]);
6735
- const handleStartEdit = useCallback19(() => {
6788
+ const handleStartEdit = useCallback20(() => {
6736
6789
  setLocalEditValue(content);
6737
6790
  setIsEditing(true);
6738
6791
  }, [content, setIsEditing]);
6739
- const handleCancelEdit = useCallback19(() => {
6792
+ const handleCancelEdit = useCallback20(() => {
6740
6793
  setIsEditing(false);
6741
6794
  setLocalEditValue(content);
6742
6795
  }, [content, setIsEditing]);
6743
- const handleSubmitEdit = useCallback19(() => {
6796
+ const handleSubmitEdit = useCallback20(() => {
6744
6797
  const trimmed = editValue.trim();
6745
6798
  if (trimmed && trimmed !== content) {
6746
6799
  onEdit?.(trimmed);
6747
6800
  }
6748
6801
  setIsEditing(false);
6749
6802
  }, [editValue, content, onEdit, setIsEditing]);
6750
- const handleEditKeyDown = useCallback19(
6803
+ const handleEditKeyDown = useCallback20(
6751
6804
  (e) => {
6752
6805
  if (e.key === "Enter" && !e.shiftKey) {
6753
6806
  e.preventDefault();
@@ -6790,7 +6843,7 @@ var MessageActions = React74.forwardRef(
6790
6843
  label: "Cancel edit",
6791
6844
  className: "text-silver/60 hover:text-error"
6792
6845
  },
6793
- /* @__PURE__ */ React74.createElement(X5, { className: "w-4 h-4" })
6846
+ /* @__PURE__ */ React74.createElement(X6, { className: "w-4 h-4" })
6794
6847
  ), /* @__PURE__ */ React74.createElement(
6795
6848
  ActionButton2,
6796
6849
  {