@lukeashford/aurelius 3.9.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 +287 -125
- package/dist/index.d.ts +287 -125
- package/dist/index.js +1533 -1489
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1197 -1150
- package/dist/index.mjs.map +1 -1
- package/llms.md +60 -19
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React$1, { ReactNode } from 'react';
|
|
2
2
|
import { Config } from 'dompurify';
|
|
3
|
+
import ReactPlayer from 'react-player';
|
|
3
4
|
|
|
4
5
|
type ButtonVariant = 'primary' | 'important' | 'elevated' | 'outlined' | 'featured' | 'ghost' | 'danger';
|
|
5
6
|
type ButtonSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -738,69 +739,99 @@ interface MarkdownContentProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
|
738
739
|
declare const MarkdownContent: React$1.ForwardRefExoticComponent<MarkdownContentProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
739
740
|
|
|
740
741
|
/**
|
|
741
|
-
* Conversation
|
|
742
|
+
* Conversation tree types.
|
|
742
743
|
*
|
|
743
|
-
*
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
*
|
|
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.
|
|
747
753
|
*/
|
|
748
754
|
|
|
749
755
|
/**
|
|
750
|
-
*
|
|
756
|
+
* The minimal contract every tree node must satisfy. The tree algorithms only
|
|
757
|
+
* ever read these fields; everything else is opaque to them.
|
|
751
758
|
*/
|
|
752
|
-
interface
|
|
753
|
-
/**
|
|
754
|
-
* Unique identifier for this message
|
|
755
|
-
*/
|
|
759
|
+
interface NodeTopology {
|
|
756
760
|
id: string;
|
|
757
|
-
/**
|
|
758
|
-
* The role of the message author
|
|
759
|
-
*/
|
|
760
|
-
role: 'user' | 'assistant';
|
|
761
|
-
/**
|
|
762
|
-
* The message content (may include HTML/markdown or React components)
|
|
763
|
-
*/
|
|
764
|
-
content: ReactNode;
|
|
765
|
-
/**
|
|
766
|
-
* ID of the parent message (null for root messages)
|
|
767
|
-
*/
|
|
768
761
|
parentId: string | null;
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
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 & {
|
|
772
770
|
children: string[];
|
|
773
|
-
/**
|
|
774
|
-
* Which sibling branch this message is (0, 1, 2...)
|
|
775
|
-
* Used for UI display like "1/3"
|
|
776
|
-
*/
|
|
777
771
|
branchIndex?: number;
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
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. */
|
|
781
782
|
isStreaming?: boolean;
|
|
782
|
-
/**
|
|
783
|
-
* Timestamp when the message was created
|
|
784
|
-
*/
|
|
785
|
-
createdAt?: number;
|
|
786
783
|
}
|
|
787
784
|
/**
|
|
788
|
-
*
|
|
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.
|
|
789
789
|
*/
|
|
790
|
-
interface
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
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;
|
|
795
796
|
/**
|
|
796
|
-
*
|
|
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)
|
|
797
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>>;
|
|
798
826
|
rootIds: string[];
|
|
827
|
+
/** Leaf the user is currently viewing. Active path = root → here. */
|
|
828
|
+
activeLeafId: string | null;
|
|
799
829
|
/**
|
|
800
|
-
*
|
|
801
|
-
*
|
|
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.
|
|
802
833
|
*/
|
|
803
|
-
|
|
834
|
+
lastLeafId: string | null;
|
|
804
835
|
}
|
|
805
836
|
/**
|
|
806
837
|
* Attachment types for file uploads
|
|
@@ -848,46 +879,6 @@ declare function revokePreviewUrl(url: string | undefined): void;
|
|
|
848
879
|
* Generate a unique ID
|
|
849
880
|
*/
|
|
850
881
|
declare function generateId(): string;
|
|
851
|
-
/**
|
|
852
|
-
* Create an empty conversation tree
|
|
853
|
-
*/
|
|
854
|
-
declare function createEmptyTree(): ConversationTree;
|
|
855
|
-
/**
|
|
856
|
-
* Add a message to the tree
|
|
857
|
-
*/
|
|
858
|
-
declare function addMessageToTree(tree: ConversationTree, message: Omit<MessageNode, 'children' | 'branchIndex'>, parentId?: string | null): ConversationTree;
|
|
859
|
-
/**
|
|
860
|
-
* Get the linear path from root to the active leaf
|
|
861
|
-
*/
|
|
862
|
-
declare function getActivePathMessages(tree: ConversationTree): MessageNode[];
|
|
863
|
-
/**
|
|
864
|
-
* Get sibling count and current index for a node
|
|
865
|
-
*/
|
|
866
|
-
declare function getSiblingInfo(tree: ConversationTree, nodeId: string): {
|
|
867
|
-
total: number;
|
|
868
|
-
current: number;
|
|
869
|
-
};
|
|
870
|
-
/**
|
|
871
|
-
* Switch to a different branch at a given node
|
|
872
|
-
*/
|
|
873
|
-
declare function switchBranch(tree: ConversationTree, nodeId: string, direction: 'prev' | 'next'): ConversationTree;
|
|
874
|
-
/**
|
|
875
|
-
* Update a node's content (e.g., during streaming)
|
|
876
|
-
*/
|
|
877
|
-
declare function updateNodeContent(tree: ConversationTree, nodeId: string, content: ReactNode, isStreaming?: boolean): ConversationTree;
|
|
878
|
-
/**
|
|
879
|
-
* Convert a flat message array to a conversation tree
|
|
880
|
-
*/
|
|
881
|
-
declare function messagesToTree(messages: Array<{
|
|
882
|
-
id: string;
|
|
883
|
-
role: 'user' | 'assistant';
|
|
884
|
-
content: ReactNode;
|
|
885
|
-
isStreaming?: boolean;
|
|
886
|
-
}>): ConversationTree;
|
|
887
|
-
/**
|
|
888
|
-
* Check if a node has multiple children (is a branch point)
|
|
889
|
-
*/
|
|
890
|
-
declare function isBranchPoint(tree: ConversationTree, nodeId: string): boolean;
|
|
891
882
|
|
|
892
883
|
interface ChatInputNotice {
|
|
893
884
|
/**
|
|
@@ -1075,26 +1066,9 @@ interface ToolDefinition {
|
|
|
1075
1066
|
}
|
|
1076
1067
|
/**
|
|
1077
1068
|
* Consumer-provided tool definition passed via ChatInterface's `tools` prop.
|
|
1078
|
-
*
|
|
1079
|
-
* render when the tool is opened.
|
|
1069
|
+
* Adds the panel content to render when the tool is opened.
|
|
1080
1070
|
*/
|
|
1081
|
-
interface ExternalToolDefinition {
|
|
1082
|
-
/**
|
|
1083
|
-
* Unique identifier for this tool
|
|
1084
|
-
*/
|
|
1085
|
-
id: string;
|
|
1086
|
-
/**
|
|
1087
|
-
* Icon element shown in the sidebar button
|
|
1088
|
-
*/
|
|
1089
|
-
icon: React$1.ReactNode;
|
|
1090
|
-
/**
|
|
1091
|
-
* Accessible label for the button
|
|
1092
|
-
*/
|
|
1093
|
-
label: string;
|
|
1094
|
-
/**
|
|
1095
|
-
* Which group the tool belongs to
|
|
1096
|
-
*/
|
|
1097
|
-
group: ToolGroup;
|
|
1071
|
+
interface ExternalToolDefinition extends ToolDefinition {
|
|
1098
1072
|
/**
|
|
1099
1073
|
* Content to render when the tool is open
|
|
1100
1074
|
*/
|
|
@@ -1382,6 +1356,19 @@ interface ChatInterfaceProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
|
|
|
1382
1356
|
* In tree mode, this creates a new branch.
|
|
1383
1357
|
*/
|
|
1384
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;
|
|
1385
1372
|
/**
|
|
1386
1373
|
* Called when the Stop button is clicked during assistant streaming.
|
|
1387
1374
|
*/
|
|
@@ -1526,48 +1513,145 @@ interface ChatInterfaceProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
|
|
|
1526
1513
|
*/
|
|
1527
1514
|
declare const ChatInterface: React$1.ForwardRefExoticComponent<ChatInterfaceProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1528
1515
|
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
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;
|
|
1532
1540
|
/**
|
|
1533
|
-
*
|
|
1541
|
+
* Terminal status of the execution.
|
|
1542
|
+
* @default 'completed'
|
|
1534
1543
|
*/
|
|
1535
|
-
|
|
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;
|
|
1550
|
+
/**
|
|
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.
|
|
1553
|
+
*/
|
|
1554
|
+
muted?: boolean;
|
|
1536
1555
|
/**
|
|
1537
|
-
*
|
|
1556
|
+
* Sibling info for the BranchNavigator chevrons. Chevrons render only when
|
|
1557
|
+
* `total > 1`.
|
|
1538
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). */
|
|
1539
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;
|
|
1540
1620
|
}
|
|
1541
1621
|
interface ChatViewProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
1542
1622
|
/**
|
|
1543
|
-
*
|
|
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.
|
|
1544
1625
|
*/
|
|
1545
|
-
|
|
1626
|
+
items: ChatViewItem[];
|
|
1546
1627
|
/**
|
|
1547
|
-
* Index of the latest user
|
|
1548
|
-
*
|
|
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`.
|
|
1549
1631
|
*/
|
|
1550
1632
|
latestUserMessageIndex?: number;
|
|
1551
1633
|
/**
|
|
1552
|
-
* 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.
|
|
1553
1636
|
*/
|
|
1554
1637
|
isStreaming?: boolean;
|
|
1555
1638
|
/**
|
|
1556
|
-
* Whether to show the thinking indicator (between user message and response)
|
|
1639
|
+
* Whether to show the thinking indicator (between user message and response).
|
|
1557
1640
|
*/
|
|
1558
1641
|
isThinking?: boolean;
|
|
1559
1642
|
/**
|
|
1560
|
-
* Callback when the user scrolls manually
|
|
1643
|
+
* Callback when the user scrolls manually.
|
|
1561
1644
|
*/
|
|
1562
1645
|
onScroll?: (e: React$1.UIEvent<HTMLDivElement>) => void;
|
|
1563
1646
|
}
|
|
1564
1647
|
/**
|
|
1565
|
-
*
|
|
1648
|
+
* Renders a heterogeneous chat stream — messages, checkpoints, and the
|
|
1649
|
+
* greyed-future divider — with smart scrolling behavior.
|
|
1566
1650
|
*
|
|
1567
1651
|
* Key behaviors:
|
|
1568
|
-
* - When a user message
|
|
1652
|
+
* - When a user message arrives, it anchors to the top of the viewport
|
|
1569
1653
|
* - Does NOT auto-scroll during streaming (respects user's reading position)
|
|
1570
|
-
* -
|
|
1654
|
+
* - Each row's renderer is dispatched from its `kind` discriminator
|
|
1571
1655
|
*/
|
|
1572
1656
|
declare const ChatView: React$1.ForwardRefExoticComponent<ChatViewProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1573
1657
|
|
|
@@ -1671,12 +1755,15 @@ interface ToolPanelContainerProps extends React$1.HTMLAttributes<HTMLDivElement>
|
|
|
1671
1755
|
*/
|
|
1672
1756
|
declare const ToolPanelContainer: React$1.ForwardRefExoticComponent<ToolPanelContainerProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1673
1757
|
|
|
1674
|
-
|
|
1758
|
+
/**
|
|
1759
|
+
* @deprecated Use MessageVariant. Kept as an alias for backwards compatibility.
|
|
1760
|
+
*/
|
|
1761
|
+
type MessageActionsVariant = MessageVariant;
|
|
1675
1762
|
interface MessageActionsProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
1676
1763
|
/**
|
|
1677
1764
|
* Whether this is for a user or assistant message
|
|
1678
1765
|
*/
|
|
1679
|
-
variant:
|
|
1766
|
+
variant: MessageVariant;
|
|
1680
1767
|
/**
|
|
1681
1768
|
* The message content for copy functionality
|
|
1682
1769
|
*/
|
|
@@ -1759,6 +1846,77 @@ interface BranchNavigatorProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
|
1759
1846
|
*/
|
|
1760
1847
|
declare const BranchNavigator: React$1.ForwardRefExoticComponent<BranchNavigatorProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1761
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
|
+
|
|
1762
1920
|
interface UseScrollAnchorOptions {
|
|
1763
1921
|
/**
|
|
1764
1922
|
* Behavior for scrolling. Defaults to 'smooth'.
|
|
@@ -1893,6 +2051,7 @@ interface ImageCardProps extends Omit<CardProps, 'title'> {
|
|
|
1893
2051
|
}
|
|
1894
2052
|
declare const ImageCard: React$1.ForwardRefExoticComponent<ImageCardProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1895
2053
|
|
|
2054
|
+
type ReactPlayerProps$1 = React$1.ComponentProps<typeof ReactPlayer>;
|
|
1896
2055
|
type VideoAspectRatioPreset = 'video' | 'cinema' | 'square';
|
|
1897
2056
|
type VideoAspectRatio = VideoAspectRatioPreset | `${number}/${number}`;
|
|
1898
2057
|
interface VideoCardProps extends Omit<CardProps, 'title'> {
|
|
@@ -1908,11 +2067,13 @@ interface VideoCardProps extends Omit<CardProps, 'title'> {
|
|
|
1908
2067
|
loop?: boolean;
|
|
1909
2068
|
mediaClassName?: string;
|
|
1910
2069
|
contentClassName?: string;
|
|
1911
|
-
|
|
2070
|
+
/** Forwarded to the underlying ReactPlayer. */
|
|
2071
|
+
playerProps?: Partial<ReactPlayerProps$1>;
|
|
1912
2072
|
loading?: CardSlotLoading;
|
|
1913
2073
|
}
|
|
1914
2074
|
declare const VideoCard: React$1.ForwardRefExoticComponent<VideoCardProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1915
2075
|
|
|
2076
|
+
type ReactPlayerProps = React$1.ComponentProps<typeof ReactPlayer>;
|
|
1916
2077
|
interface AudioCardProps extends Omit<CardProps, 'title'> {
|
|
1917
2078
|
src?: string;
|
|
1918
2079
|
title?: React$1.ReactNode;
|
|
@@ -1924,7 +2085,8 @@ interface AudioCardProps extends Omit<CardProps, 'title'> {
|
|
|
1924
2085
|
loop?: boolean;
|
|
1925
2086
|
mediaClassName?: string;
|
|
1926
2087
|
contentClassName?: string;
|
|
1927
|
-
|
|
2088
|
+
/** Forwarded to the underlying ReactPlayer. */
|
|
2089
|
+
playerProps?: Partial<ReactPlayerProps>;
|
|
1928
2090
|
height?: string | number;
|
|
1929
2091
|
loading?: CardSlotLoading;
|
|
1930
2092
|
}
|
|
@@ -2054,4 +2216,4 @@ declare const ArtifactVariantStack: React$1.ForwardRefExoticComponent<ArtifactVa
|
|
|
2054
2216
|
|
|
2055
2217
|
declare const version = "2.0.0";
|
|
2056
2218
|
|
|
2057
|
-
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 };
|