@lukeashford/aurelius 3.6.0 → 3.8.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
@@ -3972,7 +3972,7 @@ var Message = React55.forwardRef(
3972
3972
  const isUser = variant === "user";
3973
3973
  const [copied, setCopied] = useState10(false);
3974
3974
  const [isEditing, setIsEditing] = useState10(false);
3975
- const [editValue, setEditValue] = useState10(content);
3975
+ const [editValue, setEditValue] = useState10(typeof content === "string" ? content : "");
3976
3976
  const textareaRef = useRef5(null);
3977
3977
  const showBranchNav = branchInfo && branchInfo.total > 1;
3978
3978
  const showActions = actions && !hideActions && !isStreaming;
@@ -3986,6 +3986,9 @@ var Message = React55.forwardRef(
3986
3986
  }
3987
3987
  }, [isEditing]);
3988
3988
  const handleCopy = async () => {
3989
+ if (typeof content !== "string") {
3990
+ return;
3991
+ }
3989
3992
  try {
3990
3993
  await navigator.clipboard.writeText(content);
3991
3994
  setCopied(true);
@@ -4002,16 +4005,20 @@ var Message = React55.forwardRef(
4002
4005
  }
4003
4006
  };
4004
4007
  const handleStartEdit = () => {
4005
- setEditValue(content);
4006
- setIsEditing(true);
4008
+ if (typeof content === "string") {
4009
+ setEditValue(content);
4010
+ setIsEditing(true);
4011
+ }
4007
4012
  };
4008
4013
  const handleCancelEdit = () => {
4009
4014
  setIsEditing(false);
4010
- setEditValue(content);
4015
+ if (typeof content === "string") {
4016
+ setEditValue(content);
4017
+ }
4011
4018
  };
4012
4019
  const handleSubmitEdit = () => {
4013
4020
  const trimmed = editValue.trim();
4014
- if (trimmed && trimmed !== content) {
4021
+ if (typeof content === "string" && trimmed && trimmed !== content) {
4015
4022
  actions?.onEdit?.(trimmed);
4016
4023
  }
4017
4024
  setIsEditing(false);
@@ -4078,7 +4085,7 @@ var Message = React55.forwardRef(
4078
4085
  variantStyles2[variant]
4079
4086
  )
4080
4087
  },
4081
- /* @__PURE__ */ React55.createElement(
4088
+ typeof content === "string" ? /* @__PURE__ */ React55.createElement(
4082
4089
  MarkdownContent,
4083
4090
  {
4084
4091
  content,
@@ -4086,7 +4093,7 @@ var Message = React55.forwardRef(
4086
4093
  isStreaming,
4087
4094
  cursorClassName: "ml-0.5"
4088
4095
  }
4089
- )
4096
+ ) : content
4090
4097
  ),
4091
4098
  showActions && !isEditing && /* @__PURE__ */ React55.createElement("div", { className: cx(
4092
4099
  "flex items-center gap-0.5 mt-1",
@@ -4098,7 +4105,7 @@ var Message = React55.forwardRef(
4098
4105
  label: copied ? "Copied!" : "Copy message"
4099
4106
  },
4100
4107
  copied ? /* @__PURE__ */ React55.createElement(CheckIcon, null) : /* @__PURE__ */ React55.createElement(CopyIcon, null)
4101
- ), isUser && actions.onEdit && /* @__PURE__ */ React55.createElement(ActionButton, { onClick: handleStartEdit, label: "Edit message" }, /* @__PURE__ */ React55.createElement(PencilIcon, null)), !isUser && actions.onRetry && /* @__PURE__ */ React55.createElement(ActionButton, { onClick: actions.onRetry, label: "Regenerate response" }, /* @__PURE__ */ React55.createElement(RetryIcon, null)), showBranchNav && /* @__PURE__ */ React55.createElement(React55.Fragment, null, /* @__PURE__ */ React55.createElement("div", { className: "w-px h-4 bg-ash/40 mx-1" }), /* @__PURE__ */ React55.createElement("div", { className: "flex items-center gap-0.5 text-silver/70" }, /* @__PURE__ */ React55.createElement(GitBranchIcon, null), /* @__PURE__ */ React55.createElement(
4108
+ ), isUser && actions.onEdit && typeof content === "string" && /* @__PURE__ */ React55.createElement(ActionButton, { onClick: handleStartEdit, label: "Edit message" }, /* @__PURE__ */ React55.createElement(PencilIcon, null)), !isUser && actions.onRetry && /* @__PURE__ */ React55.createElement(ActionButton, { onClick: actions.onRetry, label: "Regenerate response" }, /* @__PURE__ */ React55.createElement(RetryIcon, null)), showBranchNav && /* @__PURE__ */ React55.createElement(React55.Fragment, null, /* @__PURE__ */ React55.createElement("div", { className: "w-px h-4 bg-ash/40 mx-1" }), /* @__PURE__ */ React55.createElement("div", { className: "flex items-center gap-0.5 text-silver/70" }, /* @__PURE__ */ React55.createElement(GitBranchIcon, null), /* @__PURE__ */ React55.createElement(
4102
4109
  "button",
4103
4110
  {
4104
4111
  type: "button",
@@ -4645,11 +4652,12 @@ var ChatInput = React59.forwardRef(
4645
4652
  acceptedFileTypes,
4646
4653
  notice,
4647
4654
  onInputChange,
4655
+ initialInputValue = "",
4648
4656
  autoFocus = false,
4649
4657
  className,
4650
4658
  ...rest
4651
4659
  }, ref) => {
4652
- const [value, setValue] = useState13("");
4660
+ const [value, setValue] = useState13(initialInputValue);
4653
4661
  const [localAttachments, setLocalAttachments] = useState13([]);
4654
4662
  const [isDragOver, setIsDragOver] = useState13(false);
4655
4663
  const textareaRef = useRef8(null);
@@ -6305,15 +6313,13 @@ function sortTasks(tasks) {
6305
6313
  function TaskItem({ task, depth = 0 }) {
6306
6314
  const isTerminal = task.status === "done" || task.status === "cancelled" || task.status === "failed";
6307
6315
  const isSubtle = task.status === "cancelled" || task.status === "failed";
6308
- const showSubtasks = (task.status === "in_progress" || task.status === "done") && task.subtasks && task.subtasks.length > 0;
6316
+ const showSubtasks = task.subtasks && task.subtasks.length > 0;
6309
6317
  const sortedSubtasks = showSubtasks ? sortTasks(task.subtasks) : [];
6310
6318
  return /* @__PURE__ */ React71.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React71.createElement(
6311
6319
  "div",
6312
6320
  {
6313
- className: cx(
6314
- "flex items-center gap-2 py-1",
6315
- depth > 0 && "pl-6"
6316
- )
6321
+ className: "flex items-center gap-2 py-1",
6322
+ style: { paddingLeft: `${depth * 1.5}rem` }
6317
6323
  },
6318
6324
  /* @__PURE__ */ React71.createElement(TaskIcon, { status: task.status }),
6319
6325
  /* @__PURE__ */ React71.createElement(
@@ -6335,8 +6341,12 @@ function TaskItem({ task, depth = 0 }) {
6335
6341
  }
6336
6342
  function hasInProgressTask(tasks) {
6337
6343
  return tasks.some((t) => {
6338
- if (t.status === "in_progress") return true;
6339
- if (t.subtasks && t.subtasks.length > 0) return hasInProgressTask(t.subtasks);
6344
+ if (t.status === "in_progress") {
6345
+ return true;
6346
+ }
6347
+ if (t.subtasks && t.subtasks.length > 0) {
6348
+ return hasInProgressTask(t.subtasks);
6349
+ }
6340
6350
  return false;
6341
6351
  });
6342
6352
  }
@@ -6345,7 +6355,9 @@ var TodosList = React71.forwardRef(
6345
6355
  const sortedTasks = useMemo4(() => sortTasks(tasks), [tasks]);
6346
6356
  const [isStopping, setIsStopping] = useState18(false);
6347
6357
  const handleStopClick = useCallback17(async () => {
6348
- if (!onStopAllTasks || isStopping) return;
6358
+ if (!onStopAllTasks || isStopping) {
6359
+ return;
6360
+ }
6349
6361
  try {
6350
6362
  setIsStopping(true);
6351
6363
  await onStopAllTasks();
@@ -6354,25 +6366,10 @@ var TodosList = React71.forwardRef(
6354
6366
  }
6355
6367
  }, [onStopAllTasks, isStopping]);
6356
6368
  const countCompleted = (taskList) => {
6357
- let count = 0;
6358
- for (const task of taskList) {
6359
- if (task.status === "done") {
6360
- count++;
6361
- }
6362
- if (task.subtasks) {
6363
- count += countCompleted(task.subtasks);
6364
- }
6365
- }
6366
- return count;
6369
+ return taskList.filter((task) => task.status === "done").length;
6367
6370
  };
6368
6371
  const countTotal = (taskList) => {
6369
- let count = taskList.length;
6370
- for (const task of taskList) {
6371
- if (task.subtasks) {
6372
- count += countTotal(task.subtasks);
6373
- }
6374
- }
6375
- return count;
6372
+ return taskList.length;
6376
6373
  };
6377
6374
  const showStopButton = !!onStopAllTasks && (hasInProgressTask(tasks) || isStopping);
6378
6375
  if (tasks.length === 0) {
@@ -6424,8 +6421,12 @@ TodosList.displayName = "TodosList";
6424
6421
  function areAllTasksSettled(tasks) {
6425
6422
  return tasks.every((t) => {
6426
6423
  const settled = t.status === "done" || t.status === "cancelled" || t.status === "failed";
6427
- if (!settled) return false;
6428
- if (t.subtasks && t.subtasks.length > 0) return areAllTasksSettled(t.subtasks);
6424
+ if (!settled) {
6425
+ return false;
6426
+ }
6427
+ if (t.subtasks && t.subtasks.length > 0) {
6428
+ return areAllTasksSettled(t.subtasks);
6429
+ }
6429
6430
  return true;
6430
6431
  });
6431
6432
  }
@@ -6695,6 +6696,7 @@ var ChatInterface = React74.forwardRef(
6695
6696
  onStopAllTasks,
6696
6697
  inputNotice,
6697
6698
  onInputChange,
6699
+ initialInputValue = "",
6698
6700
  tools: externalTools = [],
6699
6701
  autoFocus = true,
6700
6702
  className,
@@ -6990,6 +6992,7 @@ var ChatInterface = React74.forwardRef(
6990
6992
  onAttachmentsChange,
6991
6993
  notice: inputNotice,
6992
6994
  onInputChange,
6995
+ initialInputValue,
6993
6996
  autoFocus
6994
6997
  }
6995
6998
  )), /* @__PURE__ */ React74.createElement("div", { className: cx(