@lukeashford/aurelius 4.0.0 → 4.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.d.mts +281 -98
- package/dist/index.d.ts +281 -98
- package/dist/index.js +832 -581
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +729 -478
- package/dist/index.mjs.map +1 -1
- package/llms.md +52 -13
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -739,69 +739,99 @@ interface MarkdownContentProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
|
739
739
|
declare const MarkdownContent: React$1.ForwardRefExoticComponent<MarkdownContentProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
740
740
|
|
|
741
741
|
/**
|
|
742
|
-
* Conversation
|
|
742
|
+
* Conversation tree types.
|
|
743
743
|
*
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
744
|
+
* The chat is rendered from a tree where every fork point — user-edits,
|
|
745
|
+
* retries, parallel task attempts, rewinds — produces siblings under a shared
|
|
746
|
+
* parent. The tree is generic over its node type so that the topology
|
|
747
|
+
* algorithms in `./tree.ts` stay free of any kind-specific branching.
|
|
748
|
+
*
|
|
749
|
+
* Two concrete node kinds live here today: `MessageNode` (a user or assistant
|
|
750
|
+
* turn) and `CheckpointNode` (a marker anchored to a hypocaust task execution
|
|
751
|
+
* that the user can rewind to). New kinds plug in by extending `NodeTopology`
|
|
752
|
+
* and joining the `ChatNode` union.
|
|
748
753
|
*/
|
|
749
754
|
|
|
750
755
|
/**
|
|
751
|
-
*
|
|
756
|
+
* The minimal contract every tree node must satisfy. The tree algorithms only
|
|
757
|
+
* ever read these fields; everything else is opaque to them.
|
|
752
758
|
*/
|
|
753
|
-
interface
|
|
754
|
-
/**
|
|
755
|
-
* Unique identifier for this message
|
|
756
|
-
*/
|
|
759
|
+
interface NodeTopology {
|
|
757
760
|
id: string;
|
|
758
|
-
/**
|
|
759
|
-
* The role of the message author
|
|
760
|
-
*/
|
|
761
|
-
role: 'user' | 'assistant';
|
|
762
|
-
/**
|
|
763
|
-
* The message content (may include HTML/markdown or React components)
|
|
764
|
-
*/
|
|
765
|
-
content: ReactNode;
|
|
766
|
-
/**
|
|
767
|
-
* ID of the parent message (null for root messages)
|
|
768
|
-
*/
|
|
769
761
|
parentId: string | null;
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
762
|
+
createdAt?: number;
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* A node as actually stored in the tree: the caller's data plus the adjacency
|
|
766
|
+
* info the tree maintains. `children` and `branchIndex` are owned by the tree
|
|
767
|
+
* and must never be set by callers — pass a plain `T` to `addNodeToTree`.
|
|
768
|
+
*/
|
|
769
|
+
type TreeNode<T extends NodeTopology> = T & {
|
|
773
770
|
children: string[];
|
|
774
|
-
/**
|
|
775
|
-
* Which sibling branch this message is (0, 1, 2...)
|
|
776
|
-
* Used for UI display like "1/3"
|
|
777
|
-
*/
|
|
778
771
|
branchIndex?: number;
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
772
|
+
};
|
|
773
|
+
/**
|
|
774
|
+
* A user or assistant message in the conversation.
|
|
775
|
+
*/
|
|
776
|
+
interface MessageNode extends NodeTopology {
|
|
777
|
+
kind: 'message';
|
|
778
|
+
role: 'user' | 'assistant';
|
|
779
|
+
/** Rendered content. Strings, React nodes, or anything ChatView can display. */
|
|
780
|
+
content: ReactNode;
|
|
781
|
+
/** Whether this message is currently being streamed. */
|
|
782
782
|
isStreaming?: boolean;
|
|
783
|
-
/**
|
|
784
|
-
* Timestamp when the message was created
|
|
785
|
-
*/
|
|
786
|
-
createdAt?: number;
|
|
787
783
|
}
|
|
788
784
|
/**
|
|
789
|
-
*
|
|
785
|
+
* A checkpoint that anchors a chat position to a hypocaust task execution.
|
|
786
|
+
* Clicking a checkpoint rewinds the artifact view (and the tree's active leaf)
|
|
787
|
+
* to the project state at that execution. New tasks sent from this position
|
|
788
|
+
* use the checkpoint's `taskExecutionId` as their predecessor.
|
|
790
789
|
*/
|
|
791
|
-
interface
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
790
|
+
interface CheckpointNode extends NodeTopology {
|
|
791
|
+
kind: 'checkpoint';
|
|
792
|
+
/** ID of the hypocaust task execution this checkpoint anchors to. */
|
|
793
|
+
taskExecutionId: string;
|
|
794
|
+
/** Human-readable label, ≤ 50 chars, supplied by hypocaust. */
|
|
795
|
+
name: string;
|
|
796
796
|
/**
|
|
797
|
-
*
|
|
797
|
+
* What kind of project mutation produced this checkpoint.
|
|
798
|
+
* - `task`: a Claude-driven task execution
|
|
799
|
+
* - `submit`: a merge of a working branch into the project head
|
|
800
|
+
* - `rename`: a manual artifact rename via the artifacts panel (planned)
|
|
801
|
+
* - `init`: the project head at session start (seeded into new chats)
|
|
798
802
|
*/
|
|
803
|
+
executionKind: 'task' | 'submit' | 'rename' | 'init';
|
|
804
|
+
/** Terminal status reported by hypocaust. */
|
|
805
|
+
status: 'completed' | 'failed' | 'cancelled';
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Discriminated union of every chat-tree node kind.
|
|
809
|
+
*
|
|
810
|
+
* Extend by adding a new `interface FooNode extends NodeTopology { kind: 'foo' ... }`
|
|
811
|
+
* and joining it here. Every algorithm in `./tree.ts` will keep working without
|
|
812
|
+
* change because it operates on `NodeTopology`, not on this union.
|
|
813
|
+
*/
|
|
814
|
+
type ChatNode = MessageNode | CheckpointNode;
|
|
815
|
+
/**
|
|
816
|
+
* A branching conversation tree.
|
|
817
|
+
*
|
|
818
|
+
* The path the user is currently viewing runs from a root through descendants
|
|
819
|
+
* until it reaches `activeLeafId`. `lastLeafId` records the deepest leaf the
|
|
820
|
+
* user has reached on the previously-active path; when `activeLeafId` is an
|
|
821
|
+
* ancestor of `lastLeafId`, the nodes between them are the "greyed future"
|
|
822
|
+
* (the timeline the user rewound away from but can still jump back into).
|
|
823
|
+
*/
|
|
824
|
+
interface ConversationTree<T extends NodeTopology = ChatNode> {
|
|
825
|
+
nodes: Record<string, TreeNode<T>>;
|
|
799
826
|
rootIds: string[];
|
|
827
|
+
/** Leaf the user is currently viewing. Active path = root → here. */
|
|
828
|
+
activeLeafId: string | null;
|
|
800
829
|
/**
|
|
801
|
-
*
|
|
802
|
-
*
|
|
830
|
+
* Deepest leaf the user reached on the previously-active path. Equal to
|
|
831
|
+
* `activeLeafId` whenever no rewind is in effect; cleared/reset by branch
|
|
832
|
+
* switches and new node insertions.
|
|
803
833
|
*/
|
|
804
|
-
|
|
834
|
+
lastLeafId: string | null;
|
|
805
835
|
}
|
|
806
836
|
/**
|
|
807
837
|
* Attachment types for file uploads
|
|
@@ -834,49 +864,21 @@ interface Attachment {
|
|
|
834
864
|
progress?: number;
|
|
835
865
|
}
|
|
836
866
|
/**
|
|
837
|
-
*
|
|
867
|
+
* Helper to check if a file is an image
|
|
838
868
|
*/
|
|
839
|
-
declare function
|
|
840
|
-
/**
|
|
841
|
-
* Create an empty conversation tree
|
|
842
|
-
*/
|
|
843
|
-
declare function createEmptyTree(): ConversationTree;
|
|
844
|
-
/**
|
|
845
|
-
* Add a message to the tree
|
|
846
|
-
*/
|
|
847
|
-
declare function addMessageToTree(tree: ConversationTree, message: Omit<MessageNode, 'children' | 'branchIndex'>, parentId?: string | null): ConversationTree;
|
|
869
|
+
declare function isImageFile(file: File): boolean;
|
|
848
870
|
/**
|
|
849
|
-
*
|
|
871
|
+
* Helper to create a preview URL for an image file
|
|
850
872
|
*/
|
|
851
|
-
declare function
|
|
873
|
+
declare function createPreviewUrl(file: File): string | undefined;
|
|
852
874
|
/**
|
|
853
|
-
*
|
|
875
|
+
* Helper to revoke a preview URL when no longer needed
|
|
854
876
|
*/
|
|
855
|
-
declare function
|
|
856
|
-
total: number;
|
|
857
|
-
current: number;
|
|
858
|
-
};
|
|
877
|
+
declare function revokePreviewUrl(url: string | undefined): void;
|
|
859
878
|
/**
|
|
860
|
-
*
|
|
861
|
-
*/
|
|
862
|
-
declare function switchBranch(tree: ConversationTree, nodeId: string, direction: 'prev' | 'next'): ConversationTree;
|
|
863
|
-
/**
|
|
864
|
-
* Update a node's content (e.g., during streaming)
|
|
865
|
-
*/
|
|
866
|
-
declare function updateNodeContent(tree: ConversationTree, nodeId: string, content: ReactNode, isStreaming?: boolean): ConversationTree;
|
|
867
|
-
/**
|
|
868
|
-
* Convert a flat message array to a conversation tree
|
|
869
|
-
*/
|
|
870
|
-
declare function messagesToTree(messages: Array<{
|
|
871
|
-
id: string;
|
|
872
|
-
role: 'user' | 'assistant';
|
|
873
|
-
content: ReactNode;
|
|
874
|
-
isStreaming?: boolean;
|
|
875
|
-
}>): ConversationTree;
|
|
876
|
-
/**
|
|
877
|
-
* Check if a node has multiple children (is a branch point)
|
|
879
|
+
* Generate a unique ID
|
|
878
880
|
*/
|
|
879
|
-
declare function
|
|
881
|
+
declare function generateId(): string;
|
|
880
882
|
|
|
881
883
|
interface ChatInputNotice {
|
|
882
884
|
/**
|
|
@@ -1354,6 +1356,19 @@ interface ChatInterfaceProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
|
|
|
1354
1356
|
* In tree mode, this creates a new branch.
|
|
1355
1357
|
*/
|
|
1356
1358
|
onRetryMessage?: (messageId: string) => void;
|
|
1359
|
+
/**
|
|
1360
|
+
* Called when the user clicks a non-active checkpoint to rewind. Receives
|
|
1361
|
+
* the checkpoint id; the consumer should move the active leaf there
|
|
1362
|
+
* (without forking) so the artifacts panel and chat re-anchor.
|
|
1363
|
+
* In tree mode only.
|
|
1364
|
+
*/
|
|
1365
|
+
onJumpToCheckpoint?: (checkpointId: string) => void;
|
|
1366
|
+
/**
|
|
1367
|
+
* Called when the user clicks "Jump to latest" on the greyed-future divider
|
|
1368
|
+
* or otherwise asks to return to the deepest leaf they had reached.
|
|
1369
|
+
* In tree mode only.
|
|
1370
|
+
*/
|
|
1371
|
+
onJumpToLatest?: () => void;
|
|
1357
1372
|
/**
|
|
1358
1373
|
* Called when the Stop button is clicked during assistant streaming.
|
|
1359
1374
|
*/
|
|
@@ -1498,48 +1513,145 @@ interface ChatInterfaceProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
|
|
|
1498
1513
|
*/
|
|
1499
1514
|
declare const ChatInterface: React$1.ForwardRefExoticComponent<ChatInterfaceProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1500
1515
|
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1516
|
+
/**
|
|
1517
|
+
* What kind of project mutation produced this checkpoint. Drives the icon and
|
|
1518
|
+
* visual emphasis. The label and underlying state are unchanged.
|
|
1519
|
+
*/
|
|
1520
|
+
type CheckpointExecutionKind = 'task' | 'submit' | 'rename' | 'init';
|
|
1521
|
+
/**
|
|
1522
|
+
* Terminal state of the underlying execution. `failed` and `cancelled` render
|
|
1523
|
+
* with status text and muted accents but stay clickable so the user can still
|
|
1524
|
+
* inspect the partial state.
|
|
1525
|
+
*/
|
|
1526
|
+
type CheckpointStatus = 'completed' | 'failed' | 'cancelled';
|
|
1527
|
+
interface CheckpointBranchInfo {
|
|
1528
|
+
/** 1-based index of this checkpoint among its siblings. */
|
|
1529
|
+
current: number;
|
|
1530
|
+
/** Total sibling count at this fork point. */
|
|
1531
|
+
total: number;
|
|
1532
|
+
onPrevious?: () => void;
|
|
1533
|
+
onNext?: () => void;
|
|
1534
|
+
}
|
|
1535
|
+
interface CheckpointProps {
|
|
1536
|
+
/** Human-readable label, ≤ 50 chars. Comes from the underlying execution name. */
|
|
1537
|
+
name: string;
|
|
1538
|
+
/** What produced the checkpoint — drives the leading icon. */
|
|
1539
|
+
executionKind: CheckpointExecutionKind;
|
|
1504
1540
|
/**
|
|
1505
|
-
*
|
|
1541
|
+
* Terminal status of the execution.
|
|
1542
|
+
* @default 'completed'
|
|
1506
1543
|
*/
|
|
1507
|
-
|
|
1544
|
+
status?: CheckpointStatus;
|
|
1545
|
+
/**
|
|
1546
|
+
* When true, this checkpoint is the active leaf — the artifacts panel is
|
|
1547
|
+
* already showing this state. Renders without underline or jump affordance.
|
|
1548
|
+
*/
|
|
1549
|
+
isActive?: boolean;
|
|
1508
1550
|
/**
|
|
1509
|
-
*
|
|
1551
|
+
* When true, this checkpoint sits in the greyed-future region (the timeline
|
|
1552
|
+
* the user rewound away from). Lower opacity; still clickable to jump back.
|
|
1510
1553
|
*/
|
|
1554
|
+
muted?: boolean;
|
|
1555
|
+
/**
|
|
1556
|
+
* Sibling info for the BranchNavigator chevrons. Chevrons render only when
|
|
1557
|
+
* `total > 1`.
|
|
1558
|
+
*/
|
|
1559
|
+
branchInfo?: CheckpointBranchInfo;
|
|
1560
|
+
/**
|
|
1561
|
+
* Click handler for the row. Called when the user wants to jump to this
|
|
1562
|
+
* checkpoint (rewind the artifacts panel and active leaf to here).
|
|
1563
|
+
*/
|
|
1564
|
+
onJumpHere?: () => void;
|
|
1565
|
+
}
|
|
1566
|
+
/**
|
|
1567
|
+
* A single-line marker in the chat stream that anchors a chat position to a
|
|
1568
|
+
* project state. Clicking the underlined name rewinds the artifacts panel and
|
|
1569
|
+
* the active leaf to this checkpoint without forking. Chevrons switch between
|
|
1570
|
+
* sibling forks (e.g. parallel task attempts, alternative submits).
|
|
1571
|
+
*
|
|
1572
|
+
* Visual variants:
|
|
1573
|
+
* - active: gold accent, no underline (the user is already here)
|
|
1574
|
+
* - muted: greyed-future row, lower opacity, still clickable
|
|
1575
|
+
* - failed/cancelled: status suffix in muted error/silver, still clickable
|
|
1576
|
+
*/
|
|
1577
|
+
declare const Checkpoint: React$1.ForwardRefExoticComponent<CheckpointProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1578
|
+
|
|
1579
|
+
interface GreyedDividerProps {
|
|
1580
|
+
/** Number of message rows in the greyed-future region. */
|
|
1581
|
+
messageCount: number;
|
|
1582
|
+
/** Number of checkpoint rows in the greyed-future region. */
|
|
1583
|
+
checkpointCount: number;
|
|
1584
|
+
/** Click handler that jumps the active leaf to the deepest greyed leaf. */
|
|
1585
|
+
onJumpToLatest?: () => void;
|
|
1586
|
+
}
|
|
1587
|
+
/**
|
|
1588
|
+
* A full-width divider that announces the start of the greyed-future region —
|
|
1589
|
+
* the timeline beyond the user's current rewound position. Clicking
|
|
1590
|
+
* "Jump to latest" returns to the deepest leaf the user previously reached.
|
|
1591
|
+
*
|
|
1592
|
+
* Visual: hairline rule with a centered summary chip and a right-aligned
|
|
1593
|
+
* jump-to-latest action. Renders nothing when both counts are zero.
|
|
1594
|
+
*/
|
|
1595
|
+
declare const GreyedDivider: React$1.ForwardRefExoticComponent<GreyedDividerProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1596
|
+
|
|
1597
|
+
/**
|
|
1598
|
+
* One row in the chat stream. Discriminated by `kind` so ChatView can dispatch
|
|
1599
|
+
* to the right renderer without leaking shape into upstream types.
|
|
1600
|
+
*/
|
|
1601
|
+
type ChatViewItem = ChatViewMessageItem | ChatViewCheckpointItem | ChatViewDividerItem;
|
|
1602
|
+
interface ChatViewMessageItem extends Omit<MessageProps, 'variant' | 'children'> {
|
|
1603
|
+
kind: 'message';
|
|
1604
|
+
id: string;
|
|
1605
|
+
variant: MessageVariant;
|
|
1606
|
+
/** Branch navigation info — chevrons render only when total > 1. */
|
|
1607
|
+
branchInfo?: MessageBranchInfo;
|
|
1608
|
+
/** Actions configuration (copy / edit / retry). */
|
|
1511
1609
|
actions?: MessageActionsConfig;
|
|
1610
|
+
/** When true, this row is rendered in the greyed-future region. */
|
|
1611
|
+
muted?: boolean;
|
|
1612
|
+
}
|
|
1613
|
+
interface ChatViewCheckpointItem extends CheckpointProps {
|
|
1614
|
+
kind: 'checkpoint';
|
|
1615
|
+
id: string;
|
|
1616
|
+
}
|
|
1617
|
+
interface ChatViewDividerItem extends GreyedDividerProps {
|
|
1618
|
+
kind: 'divider';
|
|
1619
|
+
id: string;
|
|
1512
1620
|
}
|
|
1513
1621
|
interface ChatViewProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
1514
1622
|
/**
|
|
1515
|
-
*
|
|
1623
|
+
* Rows to render in the chat stream. Heterogeneous: messages, checkpoints,
|
|
1624
|
+
* and the greyed-future divider live in the same list, ordered top-to-bottom.
|
|
1516
1625
|
*/
|
|
1517
|
-
|
|
1626
|
+
items: ChatViewItem[];
|
|
1518
1627
|
/**
|
|
1519
|
-
* Index of the latest user
|
|
1520
|
-
*
|
|
1628
|
+
* Index of the latest user-message row to anchor scroll to. When this index
|
|
1629
|
+
* changes, the corresponding row scrolls to the top. Defaults to the
|
|
1630
|
+
* last-found user message in `items`.
|
|
1521
1631
|
*/
|
|
1522
1632
|
latestUserMessageIndex?: number;
|
|
1523
1633
|
/**
|
|
1524
|
-
* Whether the assistant is currently streaming a response
|
|
1634
|
+
* Whether the assistant is currently streaming a response. Drives the
|
|
1635
|
+
* streaming cursor on the last assistant message and the thinking indicator.
|
|
1525
1636
|
*/
|
|
1526
1637
|
isStreaming?: boolean;
|
|
1527
1638
|
/**
|
|
1528
|
-
* Whether to show the thinking indicator (between user message and response)
|
|
1639
|
+
* Whether to show the thinking indicator (between user message and response).
|
|
1529
1640
|
*/
|
|
1530
1641
|
isThinking?: boolean;
|
|
1531
1642
|
/**
|
|
1532
|
-
* Callback when the user scrolls manually
|
|
1643
|
+
* Callback when the user scrolls manually.
|
|
1533
1644
|
*/
|
|
1534
1645
|
onScroll?: (e: React$1.UIEvent<HTMLDivElement>) => void;
|
|
1535
1646
|
}
|
|
1536
1647
|
/**
|
|
1537
|
-
*
|
|
1648
|
+
* Renders a heterogeneous chat stream — messages, checkpoints, and the
|
|
1649
|
+
* greyed-future divider — with smart scrolling behavior.
|
|
1538
1650
|
*
|
|
1539
1651
|
* Key behaviors:
|
|
1540
|
-
* - When a user message
|
|
1652
|
+
* - When a user message arrives, it anchors to the top of the viewport
|
|
1541
1653
|
* - Does NOT auto-scroll during streaming (respects user's reading position)
|
|
1542
|
-
* -
|
|
1654
|
+
* - Each row's renderer is dispatched from its `kind` discriminator
|
|
1543
1655
|
*/
|
|
1544
1656
|
declare const ChatView: React$1.ForwardRefExoticComponent<ChatViewProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1545
1657
|
|
|
@@ -1734,6 +1846,77 @@ interface BranchNavigatorProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
|
1734
1846
|
*/
|
|
1735
1847
|
declare const BranchNavigator: React$1.ForwardRefExoticComponent<BranchNavigatorProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1736
1848
|
|
|
1849
|
+
/**
|
|
1850
|
+
* Conversation tree algorithms.
|
|
1851
|
+
*
|
|
1852
|
+
* Every function here operates on `NodeTopology` only — the tree never branches
|
|
1853
|
+
* on a node's `kind`. Domain questions ("where's the nearest checkpoint?",
|
|
1854
|
+
* "which message did I edit?") become predicates passed to `findAncestor`.
|
|
1855
|
+
*
|
|
1856
|
+
* The tree is the single source of truth for navigation. `activeLeafId` is the
|
|
1857
|
+
* leaf the user is viewing; `lastLeafId` is the deepest leaf they reached on
|
|
1858
|
+
* the previously-active path. The greyed-future region is derived from the
|
|
1859
|
+
* pair, not stored.
|
|
1860
|
+
*/
|
|
1861
|
+
|
|
1862
|
+
declare function createEmptyTree<T extends NodeTopology = ChatNode>(): ConversationTree<T>;
|
|
1863
|
+
/**
|
|
1864
|
+
* Append a node under `parentId` (or as a root when null) and make it the new
|
|
1865
|
+
* active leaf. Sending a message, retrying, editing, and submitting all go
|
|
1866
|
+
* through here — the tree doesn't care which one. `lastLeafId` is reset to the
|
|
1867
|
+
* new node since by definition the user is now at a fresh deepest leaf.
|
|
1868
|
+
*/
|
|
1869
|
+
declare function addNodeToTree<T extends NodeTopology>(tree: ConversationTree<T>, node: T, parentId?: string | null): ConversationTree<T>;
|
|
1870
|
+
/**
|
|
1871
|
+
* Walk root → activeLeaf, returning the nodes on the active path in order.
|
|
1872
|
+
*/
|
|
1873
|
+
declare function getActivePath<T extends NodeTopology>(tree: ConversationTree<T>): TreeNode<T>[];
|
|
1874
|
+
/**
|
|
1875
|
+
* Walk from `fromId` upward and return the first ancestor (inclusive) that
|
|
1876
|
+
* matches the predicate. Domain helpers compose on top — e.g. finding the
|
|
1877
|
+
* closest checkpoint is `findAncestor(t, id, n => n.kind === 'checkpoint')`.
|
|
1878
|
+
*/
|
|
1879
|
+
declare function findAncestor<T extends NodeTopology>(tree: ConversationTree<T>, fromId: string | null, predicate: (node: TreeNode<T>) => boolean): TreeNode<T> | null;
|
|
1880
|
+
declare function getSiblingInfo<T extends NodeTopology>(tree: ConversationTree<T>, nodeId: string): {
|
|
1881
|
+
total: number;
|
|
1882
|
+
current: number;
|
|
1883
|
+
};
|
|
1884
|
+
declare function isBranchPoint<T extends NodeTopology>(tree: ConversationTree<T>, nodeId: string): boolean;
|
|
1885
|
+
/**
|
|
1886
|
+
* Switch to a sibling branch at `nodeId` and follow first-children down to a
|
|
1887
|
+
* leaf. Used by the BranchNavigator chevrons. Resets `lastLeafId` to the new
|
|
1888
|
+
* leaf because the previous greyed-future, if any, lives on a different branch.
|
|
1889
|
+
*/
|
|
1890
|
+
declare function switchBranch<T extends NodeTopology>(tree: ConversationTree<T>, nodeId: string, direction: 'prev' | 'next'): ConversationTree<T>;
|
|
1891
|
+
/**
|
|
1892
|
+
* Set the active leaf without forking. Use for rewinds (clicking a checkpoint),
|
|
1893
|
+
* jumping forward into the greyed future, and "jump to latest".
|
|
1894
|
+
*
|
|
1895
|
+
* Preserves `lastLeafId` when the new leaf is an ancestor of it (i.e. the user
|
|
1896
|
+
* rewound, or moved within the rewound region). Otherwise resets `lastLeafId`
|
|
1897
|
+
* to the new leaf — the greyed future doesn't carry over to unrelated paths.
|
|
1898
|
+
*/
|
|
1899
|
+
declare function setActiveLeaf<T extends NodeTopology>(tree: ConversationTree<T>, leafId: string | null): ConversationTree<T>;
|
|
1900
|
+
/**
|
|
1901
|
+
* Nodes between `activeLeafId` (exclusive) and `lastLeafId` (inclusive) — the
|
|
1902
|
+
* timeline the user rewound away from. Empty whenever no rewind is in effect.
|
|
1903
|
+
*/
|
|
1904
|
+
declare function getGreyedFuture<T extends NodeTopology>(tree: ConversationTree<T>): TreeNode<T>[];
|
|
1905
|
+
/**
|
|
1906
|
+
* Convenience: build a strictly linear message-only tree from a flat array.
|
|
1907
|
+
* Useful for tests, fixtures, and consumers that don't care about branching.
|
|
1908
|
+
*/
|
|
1909
|
+
declare function messagesToTree(messages: Array<Omit<MessageNode, 'kind' | 'parentId'>>): ConversationTree<MessageNode>;
|
|
1910
|
+
/**
|
|
1911
|
+
* Update a streaming message's content. Generic over the tree's node type so
|
|
1912
|
+
* the function works equally on message-only trees (`ConversationTree<MessageNode>`)
|
|
1913
|
+
* and mixed trees (`ConversationTree<ChatNode>`). At runtime it narrows to
|
|
1914
|
+
* `MessageNode` via the `kind` discriminator and silently no-ops on any other
|
|
1915
|
+
* kind. The single cast below is the cost of bridging a generic-T tree to the
|
|
1916
|
+
* concrete `MessageNode` shape it operates on.
|
|
1917
|
+
*/
|
|
1918
|
+
declare function updateMessageContent<T extends NodeTopology>(tree: ConversationTree<T>, nodeId: string, content: ReactNode, isStreaming?: boolean): ConversationTree<T>;
|
|
1919
|
+
|
|
1737
1920
|
interface UseScrollAnchorOptions {
|
|
1738
1921
|
/**
|
|
1739
1922
|
* Behavior for scrolling. Defaults to 'smooth'.
|
|
@@ -2033,4 +2216,4 @@ declare const ArtifactVariantStack: React$1.ForwardRefExoticComponent<ArtifactVa
|
|
|
2033
2216
|
|
|
2034
2217
|
declare const version = "2.0.0";
|
|
2035
2218
|
|
|
2036
|
-
export { ARTIFACT_TYPES, Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, Alert, AlertDialog, type AlertDialogProps, type AlertProps, type AlertVariant, type Artifact, ArtifactCard, type ArtifactCardProps, ArtifactGroup, type ArtifactGroupProps, type ArtifactNode, type ArtifactType, ArtifactVariantStack, type ArtifactVariantStackProps, ArtifactsPanel, type ArtifactsPanelProps, ArtifactsPanelToggle, type ArtifactsPanelToggleProps, type AspectRatio, type AspectRatioPreset, type Attachment, type AttachmentItem, AttachmentPreview, type AttachmentPreviewProps, type AttachmentStatus, AudioCard, type AudioCardProps, Avatar, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeVariant, BranchNavigator, type BranchNavigatorProps, BrandIcon, type BrandIconProps, type BrandIconSize, type BrandIconVariant, Breadcrumb, type BreadcrumbEntry, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkProps, type BreadcrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, type CardVariant, ChatBubbleIcon, ChatInput, type ChatInputNotice, type ChatInputPosition, type ChatInputProps, ChatInterface, type ChatInterfaceProps, ChatView, type ChatViewItem, type ChatViewProps, CheckSquareIcon, Checkbox, type CheckboxProps, ChevronLeftIcon, ChevronRightIcon, CloseIcon, Col, type ColOffset, type ColOrder, type ColProps, type ColSpan, ColorSwatch, type ColorSwatchProps, ConfirmDialog, type ConfirmDialogProps, Container, type ContainerProps, type ContainerSize, type Conversation, type ConversationTree, CrossSquareIcon, Divider, type DividerProps, Drawer, type DrawerPosition, type DrawerProps, EmptySquareIcon, ExpandIcon, type ExternalToolDefinition, FileChip, type FileChipProps, type FileChipStatus, HelperText, type HelperTextProps, HistoryIcon, HistoryPanel, type HistoryPanelProps, type IconProps, ImageCard, type ImageCardProps, Input, type InputAddonProps, type InputElementProps, InputGroup, type InputGroupProps, InputLeftAddon, InputLeftElement, type InputProps, InputRightAddon, InputRightElement, InputWrapper, type InputWrapperProps, Label, type LabelProps, LayersIcon, List, ListItem, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, MarkdownContent, type MarkdownContentProps, MediaIcon, Menu, MenuContent, type MenuContentProps, MenuItem, type MenuItemProps, MenuLabel, type MenuProps, MenuSeparator, MenuTrigger, type MenuTriggerProps, Message, MessageActions, type MessageActionsConfig, type MessageActionsProps, type MessageActionsVariant, type MessageBranchInfo, type MessageNode, type MessageProps, type MessageVariant, Modal, type ModalProps, NODE_TYPES, Navbar, NavbarBrand, type NavbarBrandProps, NavbarContent, type NavbarContentProps, NavbarDivider, NavbarItem, type NavbarItemProps, NavbarLink, type NavbarLinkProps, type NavbarProps, type NodeType, Pagination, type PaginationProps, PdfCard, type PdfCardProps, PlusIcon, Popover, type PopoverAlign, type PopoverPosition, type PopoverProps, Progress, type ProgressProps, PromptDialog, type PromptDialogProps, Radio, type RadioProps, Row, type RowAlign, type RowGutter, type RowJustify, type RowProps, SCRIPT_ELEMENT_TYPES, ScriptCard, type ScriptCardProps, type ScriptElement, type ScriptElementType, SectionHeading, type SectionHeadingLevel, type SectionHeadingProps, Select, type SelectOption, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, SquareLoaderIcon, Stack, type StackDirection, type StackGap, type StackProps, type Step, type StepStatus, Stepper, type StepperProps, StreamingCursor, type StreamingCursorProps, Switch, type SwitchProps, TASK_STATUSES, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Table, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, type Task, type TaskStatus, TextCard, type TextCardProps, Textarea, type TextareaProps, ThinkingIndicator, type ThinkingIndicatorProps, type ToastData, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, TodosList, type TodosListProps, type ToolDefinition, type ToolGroup, ToolPanelContainer, type ToolPanelContainerProps, type ToolPanelState, ToolSidebar, type ToolSidebarProps, Tooltip, type TooltipProps, type UseArtifactTreeNavigationReturn, type UseScrollAnchorOptions, type UseScrollAnchorReturn, type VideoAspectRatio, type VideoAspectRatioPreset, VideoCard, type VideoCardProps,
|
|
2219
|
+
export { ARTIFACT_TYPES, Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, Alert, AlertDialog, type AlertDialogProps, type AlertProps, type AlertVariant, type Artifact, ArtifactCard, type ArtifactCardProps, ArtifactGroup, type ArtifactGroupProps, type ArtifactNode, type ArtifactType, ArtifactVariantStack, type ArtifactVariantStackProps, ArtifactsPanel, type ArtifactsPanelProps, ArtifactsPanelToggle, type ArtifactsPanelToggleProps, type AspectRatio, type AspectRatioPreset, type Attachment, type AttachmentItem, AttachmentPreview, type AttachmentPreviewProps, type AttachmentStatus, AudioCard, type AudioCardProps, Avatar, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeVariant, BranchNavigator, type BranchNavigatorProps, BrandIcon, type BrandIconProps, type BrandIconSize, type BrandIconVariant, Breadcrumb, type BreadcrumbEntry, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkProps, type BreadcrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, type CardVariant, ChatBubbleIcon, ChatInput, type ChatInputNotice, type ChatInputPosition, type ChatInputProps, ChatInterface, type ChatInterfaceProps, type ChatNode, ChatView, type ChatViewCheckpointItem, type ChatViewDividerItem, type ChatViewItem, type ChatViewMessageItem, type ChatViewProps, CheckSquareIcon, Checkbox, type CheckboxProps, Checkpoint, type CheckpointBranchInfo, type CheckpointExecutionKind, type CheckpointNode, type CheckpointProps, type CheckpointStatus, ChevronLeftIcon, ChevronRightIcon, CloseIcon, Col, type ColOffset, type ColOrder, type ColProps, type ColSpan, ColorSwatch, type ColorSwatchProps, ConfirmDialog, type ConfirmDialogProps, Container, type ContainerProps, type ContainerSize, type Conversation, type ConversationTree, CrossSquareIcon, Divider, type DividerProps, Drawer, type DrawerPosition, type DrawerProps, EmptySquareIcon, ExpandIcon, type ExternalToolDefinition, FileChip, type FileChipProps, type FileChipStatus, GreyedDivider, type GreyedDividerProps, HelperText, type HelperTextProps, HistoryIcon, HistoryPanel, type HistoryPanelProps, type IconProps, ImageCard, type ImageCardProps, Input, type InputAddonProps, type InputElementProps, InputGroup, type InputGroupProps, InputLeftAddon, InputLeftElement, type InputProps, InputRightAddon, InputRightElement, InputWrapper, type InputWrapperProps, Label, type LabelProps, LayersIcon, List, ListItem, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, MarkdownContent, type MarkdownContentProps, MediaIcon, Menu, MenuContent, type MenuContentProps, MenuItem, type MenuItemProps, MenuLabel, type MenuProps, MenuSeparator, MenuTrigger, type MenuTriggerProps, Message, MessageActions, type MessageActionsConfig, type MessageActionsProps, type MessageActionsVariant, type MessageBranchInfo, type MessageNode, type MessageProps, type MessageVariant, Modal, type ModalProps, NODE_TYPES, Navbar, NavbarBrand, type NavbarBrandProps, NavbarContent, type NavbarContentProps, NavbarDivider, NavbarItem, type NavbarItemProps, NavbarLink, type NavbarLinkProps, type NavbarProps, type NodeTopology, type NodeType, Pagination, type PaginationProps, PdfCard, type PdfCardProps, PlusIcon, Popover, type PopoverAlign, type PopoverPosition, type PopoverProps, Progress, type ProgressProps, PromptDialog, type PromptDialogProps, Radio, type RadioProps, Row, type RowAlign, type RowGutter, type RowJustify, type RowProps, SCRIPT_ELEMENT_TYPES, ScriptCard, type ScriptCardProps, type ScriptElement, type ScriptElementType, SectionHeading, type SectionHeadingLevel, type SectionHeadingProps, Select, type SelectOption, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, SquareLoaderIcon, Stack, type StackDirection, type StackGap, type StackProps, type Step, type StepStatus, Stepper, type StepperProps, StreamingCursor, type StreamingCursorProps, Switch, type SwitchProps, TASK_STATUSES, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Table, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, type Task, type TaskStatus, TextCard, type TextCardProps, Textarea, type TextareaProps, ThinkingIndicator, type ThinkingIndicatorProps, type ToastData, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, TodosList, type TodosListProps, type ToolDefinition, type ToolGroup, ToolPanelContainer, type ToolPanelContainerProps, type ToolPanelState, ToolSidebar, type ToolSidebarProps, Tooltip, type TooltipProps, type TreeNode, type UseArtifactTreeNavigationReturn, type UseScrollAnchorOptions, type UseScrollAnchorReturn, type VideoAspectRatio, type VideoAspectRatioPreset, VideoCard, type VideoCardProps, addNodeToTree, areAllTasksSettled, createEmptyTree, createPreviewUrl, findAncestor, generateId, getActivePath, getGreyedFuture, getSiblingInfo, isBranchPoint, isImageFile, messagesToTree, revokePreviewUrl, setActiveLeaf, switchBranch, updateMessageContent, useArtifactTreeNavigation, useResizable, useScrollAnchor, useToast, version };
|