@lukeashford/aurelius 4.4.0 → 4.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.d.mts CHANGED
@@ -742,6 +742,20 @@ interface MessageProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'con
742
742
  * artifact-card modal in the host app.
743
743
  */
744
744
  onAttachmentOpen?: (artifactId: string) => void;
745
+ /**
746
+ * Click handler for the bubble — when provided, the message becomes a
747
+ * navigational anchor (mirrors Checkpoint's `onJumpHere`): clicking the
748
+ * bubble moves the active leaf to this node. Suppressed when `isActive`
749
+ * is true (already here) or when the user is selecting text or clicking
750
+ * a markdown link inside the bubble.
751
+ */
752
+ onJumpHere?: () => void;
753
+ /**
754
+ * When true, this message is the active leaf — `onJumpHere` is suppressed
755
+ * (no point jumping to where you already are) and the affordance hover
756
+ * styling is skipped.
757
+ */
758
+ isActive?: boolean;
745
759
  }
746
760
  declare const Message: React$1.ForwardRefExoticComponent<MessageProps & React$1.RefAttributes<HTMLDivElement>>;
747
761
 
@@ -1417,12 +1431,12 @@ interface ChatInterfaceProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
1417
1431
  */
1418
1432
  onRetryMessage?: (messageId: string) => void;
1419
1433
  /**
1420
- * Called when the user clicks a non-active checkpoint to rewind. Receives
1421
- * the checkpoint id; the consumer should move the active leaf there
1422
- * (without forking) so the artifacts panel and chat re-anchor.
1423
- * In tree mode only.
1434
+ * Called when the user clicks a non-active node — checkpoint or message
1435
+ * to move the active leaf there. Receives the node id; the consumer should
1436
+ * move the active leaf without forking so the artifacts panel and chat
1437
+ * re-anchor. Mirrors the per-component `onJumpHere`. In tree mode only.
1424
1438
  */
1425
- onJumpToCheckpoint?: (checkpointId: string) => void;
1439
+ onJumpHere?: (nodeId: string) => void;
1426
1440
  /**
1427
1441
  * Called when the user clicks "Jump to latest" on the greyed-future divider
1428
1442
  * or otherwise asks to return to the deepest leaf they had reached.
@@ -1682,6 +1696,18 @@ interface ChatViewMessageItem extends Omit<MessageProps, 'variant' | 'children'>
1682
1696
  actions?: MessageActionsConfig;
1683
1697
  /** When true, this row is rendered in the greyed-future region. */
1684
1698
  muted?: boolean;
1699
+ /**
1700
+ * When true, this message is the active leaf — Message will suppress its
1701
+ * `onJumpHere` click target. Mirrors `ChatViewCheckpointItem.isActive`.
1702
+ */
1703
+ isActive?: boolean;
1704
+ /**
1705
+ * Click handler for the bubble. When provided, the bubble becomes a
1706
+ * navigational anchor that moves the active leaf to this node. Aurelius
1707
+ * suppresses the click for `isActive` rows, link / button targets inside
1708
+ * the bubble, and active text selections.
1709
+ */
1710
+ onJumpHere?: () => void;
1685
1711
  }
1686
1712
  interface ChatViewCheckpointItem extends CheckpointProps {
1687
1713
  kind: 'checkpoint';
package/dist/index.d.ts CHANGED
@@ -742,6 +742,20 @@ interface MessageProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'con
742
742
  * artifact-card modal in the host app.
743
743
  */
744
744
  onAttachmentOpen?: (artifactId: string) => void;
745
+ /**
746
+ * Click handler for the bubble — when provided, the message becomes a
747
+ * navigational anchor (mirrors Checkpoint's `onJumpHere`): clicking the
748
+ * bubble moves the active leaf to this node. Suppressed when `isActive`
749
+ * is true (already here) or when the user is selecting text or clicking
750
+ * a markdown link inside the bubble.
751
+ */
752
+ onJumpHere?: () => void;
753
+ /**
754
+ * When true, this message is the active leaf — `onJumpHere` is suppressed
755
+ * (no point jumping to where you already are) and the affordance hover
756
+ * styling is skipped.
757
+ */
758
+ isActive?: boolean;
745
759
  }
746
760
  declare const Message: React$1.ForwardRefExoticComponent<MessageProps & React$1.RefAttributes<HTMLDivElement>>;
747
761
 
@@ -1417,12 +1431,12 @@ interface ChatInterfaceProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
1417
1431
  */
1418
1432
  onRetryMessage?: (messageId: string) => void;
1419
1433
  /**
1420
- * Called when the user clicks a non-active checkpoint to rewind. Receives
1421
- * the checkpoint id; the consumer should move the active leaf there
1422
- * (without forking) so the artifacts panel and chat re-anchor.
1423
- * In tree mode only.
1434
+ * Called when the user clicks a non-active node — checkpoint or message
1435
+ * to move the active leaf there. Receives the node id; the consumer should
1436
+ * move the active leaf without forking so the artifacts panel and chat
1437
+ * re-anchor. Mirrors the per-component `onJumpHere`. In tree mode only.
1424
1438
  */
1425
- onJumpToCheckpoint?: (checkpointId: string) => void;
1439
+ onJumpHere?: (nodeId: string) => void;
1426
1440
  /**
1427
1441
  * Called when the user clicks "Jump to latest" on the greyed-future divider
1428
1442
  * or otherwise asks to return to the deepest leaf they had reached.
@@ -1682,6 +1696,18 @@ interface ChatViewMessageItem extends Omit<MessageProps, 'variant' | 'children'>
1682
1696
  actions?: MessageActionsConfig;
1683
1697
  /** When true, this row is rendered in the greyed-future region. */
1684
1698
  muted?: boolean;
1699
+ /**
1700
+ * When true, this message is the active leaf — Message will suppress its
1701
+ * `onJumpHere` click target. Mirrors `ChatViewCheckpointItem.isActive`.
1702
+ */
1703
+ isActive?: boolean;
1704
+ /**
1705
+ * Click handler for the bubble. When provided, the bubble becomes a
1706
+ * navigational anchor that moves the active leaf to this node. Aurelius
1707
+ * suppresses the click for `isActive` rows, link / button targets inside
1708
+ * the bubble, and active text selections.
1709
+ */
1710
+ onJumpHere?: () => void;
1685
1711
  }
1686
1712
  interface ChatViewCheckpointItem extends CheckpointProps {
1687
1713
  kind: 'checkpoint';
package/dist/index.js CHANGED
@@ -4108,9 +4108,26 @@ var Message = import_react56.default.forwardRef(
4108
4108
  hideActions,
4109
4109
  attachments,
4110
4110
  onAttachmentOpen,
4111
+ onJumpHere,
4112
+ isActive,
4111
4113
  ...rest
4112
4114
  }, ref) => {
4113
4115
  const isUser = variant === "user";
4116
+ const isJumpInteractive = !!onJumpHere && !isActive && !isStreaming;
4117
+ const handleBubbleClick = (0, import_react56.useCallback)((e) => {
4118
+ if (!isJumpInteractive) {
4119
+ return;
4120
+ }
4121
+ const target = e.target;
4122
+ if (target.closest("a, button")) {
4123
+ return;
4124
+ }
4125
+ const selection = typeof window !== "undefined" ? window.getSelection() : null;
4126
+ if (selection && !selection.isCollapsed) {
4127
+ return;
4128
+ }
4129
+ onJumpHere();
4130
+ }, [isJumpInteractive, onJumpHere]);
4114
4131
  const { copied, copy } = useCopyToClipboard();
4115
4132
  const [isEditing, setIsEditing] = (0, import_react56.useState)(false);
4116
4133
  const [editValue, setEditValue] = (0, import_react56.useState)(typeof content === "string" ? content : "");
@@ -4217,8 +4234,12 @@ var Message = import_react56.default.forwardRef(
4217
4234
  {
4218
4235
  className: cx(
4219
4236
  "px-3 py-2 w-fit max-w-11/12",
4220
- VARIANT_STYLES3[variant]
4221
- )
4237
+ VARIANT_STYLES3[variant],
4238
+ isJumpInteractive && "cursor-pointer hover:brightness-110 transition-all duration-150"
4239
+ ),
4240
+ onClick: isJumpInteractive ? handleBubbleClick : void 0,
4241
+ role: isJumpInteractive ? "button" : void 0,
4242
+ "aria-label": isJumpInteractive ? "Jump to this message" : void 0
4222
4243
  },
4223
4244
  typeof content === "string" ? /* @__PURE__ */ import_react56.default.createElement(
4224
4245
  MarkdownContent,
@@ -6954,7 +6975,7 @@ var ChatInterface = import_react81.default.forwardRef(
6954
6975
  onMessageSubmit,
6955
6976
  onEditMessage,
6956
6977
  onRetryMessage,
6957
- onJumpToCheckpoint,
6978
+ onJumpHere,
6958
6979
  onJumpToLatest,
6959
6980
  onStop,
6960
6981
  onSelectConversation,
@@ -7130,16 +7151,16 @@ var ChatInterface = import_react81.default.forwardRef(
7130
7151
  },
7131
7152
  [tree, onTreeChange]
7132
7153
  );
7133
- const handleJumpToCheckpoint = (0, import_react81.useCallback)((checkpointId) => {
7154
+ const handleJumpHere = (0, import_react81.useCallback)((nodeId) => {
7134
7155
  if (!tree) return;
7135
- if (onJumpToCheckpoint) {
7136
- onJumpToCheckpoint(checkpointId);
7156
+ if (onJumpHere) {
7157
+ onJumpHere(nodeId);
7137
7158
  return;
7138
7159
  }
7139
7160
  if (onTreeChange) {
7140
- onTreeChange(setActiveLeaf(tree, checkpointId));
7161
+ onTreeChange(setActiveLeaf(tree, nodeId));
7141
7162
  }
7142
- }, [tree, onTreeChange, onJumpToCheckpoint]);
7163
+ }, [tree, onTreeChange, onJumpHere]);
7143
7164
  const handleJumpToLatest = (0, import_react81.useCallback)(() => {
7144
7165
  if (!tree) return;
7145
7166
  if (onJumpToLatest) {
@@ -7167,7 +7188,7 @@ var ChatInterface = import_react81.default.forwardRef(
7167
7188
  isActive: node.id === activeCheckpointId && !opts.muted,
7168
7189
  muted: opts.muted,
7169
7190
  branchInfo,
7170
- onJumpHere: () => handleJumpToCheckpoint(node.id)
7191
+ onJumpHere: () => handleJumpHere(node.id)
7171
7192
  };
7172
7193
  }
7173
7194
  const actions = enableMessageActions ? {
@@ -7175,6 +7196,7 @@ var ChatInterface = import_react81.default.forwardRef(
7175
7196
  onEdit: node.role === "user" && onEditMessage ? (newContent) => onEditMessage(node.id, newContent) : void 0,
7176
7197
  onRetry: node.role === "assistant" && onRetryMessage ? () => onRetryMessage(node.id) : void 0
7177
7198
  } : void 0;
7199
+ const isActiveLeaf = tree?.activeLeafId === node.id;
7178
7200
  return {
7179
7201
  kind: "message",
7180
7202
  id: node.id,
@@ -7191,7 +7213,9 @@ var ChatInterface = import_react81.default.forwardRef(
7191
7213
  artifactId: a.artifactId,
7192
7214
  status: a.status ?? "analyzed"
7193
7215
  })) : void 0,
7194
- onAttachmentOpen: handleAttachmentOpen
7216
+ onAttachmentOpen: handleAttachmentOpen,
7217
+ isActive: isActiveLeaf,
7218
+ onJumpHere: () => handleJumpHere(node.id)
7195
7219
  };
7196
7220
  },
7197
7221
  [
@@ -7201,7 +7225,7 @@ var ChatInterface = import_react81.default.forwardRef(
7201
7225
  onEditMessage,
7202
7226
  onRetryMessage,
7203
7227
  handleBranchSwitch,
7204
- handleJumpToCheckpoint,
7228
+ handleJumpHere,
7205
7229
  handleAttachmentOpen
7206
7230
  ]
7207
7231
  );