@lukeashford/aurelius 3.7.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.d.mts CHANGED
@@ -682,15 +682,15 @@ interface MessageActionsConfig {
682
682
  */
683
683
  showCopy?: boolean;
684
684
  }
685
- interface MessageProps extends React$1.HTMLAttributes<HTMLDivElement> {
685
+ interface MessageProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'content'> {
686
686
  /**
687
687
  * Whether the message is from the user or the assistant
688
688
  */
689
689
  variant?: MessageVariant;
690
690
  /**
691
- * The message content (supports Markdown)
691
+ * The message content (supports Markdown if string)
692
692
  */
693
- content: string;
693
+ content: string | React$1.ReactNode;
694
694
  /**
695
695
  * Whether the message is currently being streamed (shows cursor)
696
696
  */
package/dist/index.d.ts CHANGED
@@ -682,15 +682,15 @@ interface MessageActionsConfig {
682
682
  */
683
683
  showCopy?: boolean;
684
684
  }
685
- interface MessageProps extends React$1.HTMLAttributes<HTMLDivElement> {
685
+ interface MessageProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'content'> {
686
686
  /**
687
687
  * Whether the message is from the user or the assistant
688
688
  */
689
689
  variant?: MessageVariant;
690
690
  /**
691
- * The message content (supports Markdown)
691
+ * The message content (supports Markdown if string)
692
692
  */
693
- content: string;
693
+ content: string | React$1.ReactNode;
694
694
  /**
695
695
  * Whether the message is currently being streamed (shows cursor)
696
696
  */
package/dist/index.js CHANGED
@@ -4126,7 +4126,7 @@ var Message = import_react55.default.forwardRef(
4126
4126
  const isUser = variant === "user";
4127
4127
  const [copied, setCopied] = (0, import_react55.useState)(false);
4128
4128
  const [isEditing, setIsEditing] = (0, import_react55.useState)(false);
4129
- const [editValue, setEditValue] = (0, import_react55.useState)(content);
4129
+ const [editValue, setEditValue] = (0, import_react55.useState)(typeof content === "string" ? content : "");
4130
4130
  const textareaRef = (0, import_react55.useRef)(null);
4131
4131
  const showBranchNav = branchInfo && branchInfo.total > 1;
4132
4132
  const showActions = actions && !hideActions && !isStreaming;
@@ -4140,6 +4140,9 @@ var Message = import_react55.default.forwardRef(
4140
4140
  }
4141
4141
  }, [isEditing]);
4142
4142
  const handleCopy = async () => {
4143
+ if (typeof content !== "string") {
4144
+ return;
4145
+ }
4143
4146
  try {
4144
4147
  await navigator.clipboard.writeText(content);
4145
4148
  setCopied(true);
@@ -4156,16 +4159,20 @@ var Message = import_react55.default.forwardRef(
4156
4159
  }
4157
4160
  };
4158
4161
  const handleStartEdit = () => {
4159
- setEditValue(content);
4160
- setIsEditing(true);
4162
+ if (typeof content === "string") {
4163
+ setEditValue(content);
4164
+ setIsEditing(true);
4165
+ }
4161
4166
  };
4162
4167
  const handleCancelEdit = () => {
4163
4168
  setIsEditing(false);
4164
- setEditValue(content);
4169
+ if (typeof content === "string") {
4170
+ setEditValue(content);
4171
+ }
4165
4172
  };
4166
4173
  const handleSubmitEdit = () => {
4167
4174
  const trimmed = editValue.trim();
4168
- if (trimmed && trimmed !== content) {
4175
+ if (typeof content === "string" && trimmed && trimmed !== content) {
4169
4176
  actions?.onEdit?.(trimmed);
4170
4177
  }
4171
4178
  setIsEditing(false);
@@ -4232,7 +4239,7 @@ var Message = import_react55.default.forwardRef(
4232
4239
  variantStyles2[variant]
4233
4240
  )
4234
4241
  },
4235
- /* @__PURE__ */ import_react55.default.createElement(
4242
+ typeof content === "string" ? /* @__PURE__ */ import_react55.default.createElement(
4236
4243
  MarkdownContent,
4237
4244
  {
4238
4245
  content,
@@ -4240,7 +4247,7 @@ var Message = import_react55.default.forwardRef(
4240
4247
  isStreaming,
4241
4248
  cursorClassName: "ml-0.5"
4242
4249
  }
4243
- )
4250
+ ) : content
4244
4251
  ),
4245
4252
  showActions && !isEditing && /* @__PURE__ */ import_react55.default.createElement("div", { className: cx(
4246
4253
  "flex items-center gap-0.5 mt-1",
@@ -4252,7 +4259,7 @@ var Message = import_react55.default.forwardRef(
4252
4259
  label: copied ? "Copied!" : "Copy message"
4253
4260
  },
4254
4261
  copied ? /* @__PURE__ */ import_react55.default.createElement(CheckIcon, null) : /* @__PURE__ */ import_react55.default.createElement(CopyIcon, null)
4255
- ), isUser && actions.onEdit && /* @__PURE__ */ import_react55.default.createElement(ActionButton, { onClick: handleStartEdit, label: "Edit message" }, /* @__PURE__ */ import_react55.default.createElement(PencilIcon, null)), !isUser && actions.onRetry && /* @__PURE__ */ import_react55.default.createElement(ActionButton, { onClick: actions.onRetry, label: "Regenerate response" }, /* @__PURE__ */ import_react55.default.createElement(RetryIcon, null)), showBranchNav && /* @__PURE__ */ import_react55.default.createElement(import_react55.default.Fragment, null, /* @__PURE__ */ import_react55.default.createElement("div", { className: "w-px h-4 bg-ash/40 mx-1" }), /* @__PURE__ */ import_react55.default.createElement("div", { className: "flex items-center gap-0.5 text-silver/70" }, /* @__PURE__ */ import_react55.default.createElement(GitBranchIcon, null), /* @__PURE__ */ import_react55.default.createElement(
4262
+ ), isUser && actions.onEdit && typeof content === "string" && /* @__PURE__ */ import_react55.default.createElement(ActionButton, { onClick: handleStartEdit, label: "Edit message" }, /* @__PURE__ */ import_react55.default.createElement(PencilIcon, null)), !isUser && actions.onRetry && /* @__PURE__ */ import_react55.default.createElement(ActionButton, { onClick: actions.onRetry, label: "Regenerate response" }, /* @__PURE__ */ import_react55.default.createElement(RetryIcon, null)), showBranchNav && /* @__PURE__ */ import_react55.default.createElement(import_react55.default.Fragment, null, /* @__PURE__ */ import_react55.default.createElement("div", { className: "w-px h-4 bg-ash/40 mx-1" }), /* @__PURE__ */ import_react55.default.createElement("div", { className: "flex items-center gap-0.5 text-silver/70" }, /* @__PURE__ */ import_react55.default.createElement(GitBranchIcon, null), /* @__PURE__ */ import_react55.default.createElement(
4256
4263
  "button",
4257
4264
  {
4258
4265
  type: "button",