@arbidocs/blocks 0.4.129 → 0.4.131
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/agents/index.cjs +303 -303
- package/dist/agents/index.js +11 -11
- package/dist/calendar/CalendarPrint.d.ts +25 -0
- package/dist/calendar/booking-slots.d.ts +21 -0
- package/dist/calendar/index.cjs +381 -97
- package/dist/calendar/index.cjs.map +1 -1
- package/dist/calendar/index.d.ts +4 -0
- package/dist/calendar/index.js +277 -3
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/print-layout.d.ts +16 -0
- package/dist/calendar/printCalendar.d.ts +6 -0
- package/dist/calls/composite-canvas.d.ts +52 -0
- package/dist/calls/index.cjs +374 -1
- package/dist/calls/index.cjs.map +1 -1
- package/dist/calls/index.d.ts +3 -0
- package/dist/calls/index.js +359 -4
- package/dist/calls/index.js.map +1 -1
- package/dist/calls/ringtone.d.ts +16 -0
- package/dist/calls/voice-levels.d.ts +32 -0
- package/dist/chat/ThreadVisualizer.d.ts +28 -0
- package/dist/chat/index.cjs +151 -135
- package/dist/chat/index.d.ts +2 -0
- package/dist/chat/index.js +4 -4
- package/dist/chat/thread-diagram.d.ts +26 -0
- package/dist/{chunk-H2KQ6OSU.js → chunk-26E6PHD2.js} +231 -6
- package/dist/chunk-26E6PHD2.js.map +1 -0
- package/dist/{chunk-2PNNCEPH.js → chunk-54ANPPMV.js} +4 -4
- package/dist/{chunk-2PNNCEPH.js.map → chunk-54ANPPMV.js.map} +1 -1
- package/dist/{chunk-IBZJYCYM.js → chunk-66TA5IBN.js} +17 -25
- package/dist/chunk-66TA5IBN.js.map +1 -0
- package/dist/{chunk-OYMWV45N.js → chunk-7D4W3SAH.js} +51 -4
- package/dist/chunk-7D4W3SAH.js.map +1 -0
- package/dist/{chunk-2DFDFOM7.js → chunk-7HAM7Y5U.js} +3 -3
- package/dist/{chunk-2DFDFOM7.js.map → chunk-7HAM7Y5U.js.map} +1 -1
- package/dist/{chunk-7423V6RM.cjs → chunk-7KH4M3KY.cjs} +8 -8
- package/dist/{chunk-7423V6RM.cjs.map → chunk-7KH4M3KY.cjs.map} +1 -1
- package/dist/{chunk-TGWTLNXW.cjs → chunk-BIXHB4LV.cjs} +3 -2
- package/dist/{chunk-TGWTLNXW.cjs.map → chunk-BIXHB4LV.cjs.map} +1 -1
- package/dist/{chunk-DZYAAL4H.cjs → chunk-BZF55UCE.cjs} +234 -5
- package/dist/chunk-BZF55UCE.cjs.map +1 -0
- package/dist/{chunk-3BJLNKOB.cjs → chunk-CDZVC32G.cjs} +5 -5
- package/dist/{chunk-3BJLNKOB.cjs.map → chunk-CDZVC32G.cjs.map} +1 -1
- package/dist/{chunk-PUCY3UXN.js → chunk-CXLVI3SB.js} +3 -3
- package/dist/{chunk-PUCY3UXN.js.map → chunk-CXLVI3SB.js.map} +1 -1
- package/dist/{chunk-KYDRUFWT.cjs → chunk-D4YR56FV.cjs} +5 -5
- package/dist/{chunk-KYDRUFWT.cjs.map → chunk-D4YR56FV.cjs.map} +1 -1
- package/dist/{chunk-6BTCDKCK.js → chunk-DI35D756.js} +4 -4
- package/dist/{chunk-6BTCDKCK.js.map → chunk-DI35D756.js.map} +1 -1
- package/dist/{chunk-TGJNPKST.js → chunk-GTCC2VAR.js} +3 -3
- package/dist/{chunk-TGJNPKST.js.map → chunk-GTCC2VAR.js.map} +1 -1
- package/dist/{chunk-6AALMYPS.cjs → chunk-HM23LXUP.cjs} +3 -3
- package/dist/{chunk-6AALMYPS.cjs.map → chunk-HM23LXUP.cjs.map} +1 -1
- package/dist/{chunk-HSFLEVZY.js → chunk-KLOSOT26.js} +10 -10
- package/dist/{chunk-HSFLEVZY.js.map → chunk-KLOSOT26.js.map} +1 -1
- package/dist/{chunk-SARREDFP.cjs → chunk-LC2KJSUS.cjs} +46 -46
- package/dist/{chunk-SARREDFP.cjs.map → chunk-LC2KJSUS.cjs.map} +1 -1
- package/dist/{chunk-MUMH3Z6K.cjs → chunk-LRD7BHAT.cjs} +50 -3
- package/dist/chunk-LRD7BHAT.cjs.map +1 -0
- package/dist/{chunk-CJBN5HIS.js → chunk-P5HOXWYL.js} +3 -3
- package/dist/{chunk-CJBN5HIS.js.map → chunk-P5HOXWYL.js.map} +1 -1
- package/dist/{chunk-5Y7JRY7Y.js → chunk-P5ST47VY.js} +3 -3
- package/dist/{chunk-5Y7JRY7Y.js.map → chunk-P5ST47VY.js.map} +1 -1
- package/dist/{chunk-A7NCSZAP.cjs → chunk-QZTNTP75.cjs} +17 -25
- package/dist/chunk-QZTNTP75.cjs.map +1 -0
- package/dist/{chunk-ENDP7JER.js → chunk-VW2C2AZL.js} +3 -3
- package/dist/{chunk-ENDP7JER.js.map → chunk-VW2C2AZL.js.map} +1 -1
- package/dist/{chunk-JLTXVW25.cjs → chunk-W27VK32R.cjs} +78 -78
- package/dist/{chunk-JLTXVW25.cjs.map → chunk-W27VK32R.cjs.map} +1 -1
- package/dist/{chunk-PJJY6CYL.cjs → chunk-WV4IDVDQ.cjs} +11 -11
- package/dist/{chunk-PJJY6CYL.cjs.map → chunk-WV4IDVDQ.cjs.map} +1 -1
- package/dist/{chunk-NYHGG2IA.cjs → chunk-ZV3BKLFY.cjs} +3 -3
- package/dist/{chunk-NYHGG2IA.cjs.map → chunk-ZV3BKLFY.cjs.map} +1 -1
- package/dist/collaboration/index.cjs +9 -9
- package/dist/collaboration/index.js +1 -1
- package/dist/connect/docx.cjs +4 -4
- package/dist/connect/docx.js +3 -3
- package/dist/connect/index.cjs +183 -146
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +1 -1
- package/dist/connect/index.js +134 -98
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/ConnectedSettings.d.ts +42 -7
- package/dist/document-tools/index.cjs +1 -1
- package/dist/document-tools/index.js +1 -1
- package/dist/facts/fact-citations.d.ts +56 -0
- package/dist/facts/fact-table-column-resize.d.ts +18 -0
- package/dist/facts/index.cjs +194 -8
- package/dist/facts/index.cjs.map +1 -1
- package/dist/facts/index.d.ts +2 -0
- package/dist/facts/index.js +180 -5
- package/dist/facts/index.js.map +1 -1
- package/dist/files/index.cjs +1 -1
- package/dist/files/index.js +1 -1
- package/dist/home/index.cjs +17 -17
- package/dist/home/index.js +3 -3
- package/dist/index.cjs +517 -501
- package/dist/index.js +18 -18
- package/dist/settings/MoreInfo.d.ts +25 -0
- package/dist/settings/PlanCard.d.ts +1 -1
- package/dist/settings/index.cjs +79 -225
- package/dist/settings/index.cjs.map +1 -1
- package/dist/settings/index.d.ts +1 -1
- package/dist/settings/index.js +70 -215
- package/dist/settings/index.js.map +1 -1
- package/dist/shell/index.cjs +1 -1
- package/dist/shell/index.js +1 -1
- package/dist/site/index.cjs +5 -5
- package/dist/site/index.js +1 -1
- package/dist/studio/index.cjs +8 -8
- package/dist/studio/index.js +6 -6
- package/dist/workflow-canvas/index.cjs +64 -64
- package/dist/workflow-canvas/index.js +12 -12
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +9 -4
- package/dist/chunk-A7NCSZAP.cjs.map +0 -1
- package/dist/chunk-DZYAAL4H.cjs.map +0 -1
- package/dist/chunk-H2KQ6OSU.js.map +0 -1
- package/dist/chunk-IBZJYCYM.js.map +0 -1
- package/dist/chunk-MUMH3Z6K.cjs.map +0 -1
- package/dist/chunk-OYMWV45N.js.map +0 -1
- package/dist/settings/FirmPool.d.ts +0 -82
package/dist/chat/index.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export { BranchControls, DEFAULT_BRANCH_CONTROLS_LABELS, type BranchControlsLabe
|
|
|
19
19
|
export { ModelAutoIcon, ModelConfigureButton, ModelDot, ModelMenuDivider, ModelMenuMessage, ModelOption, ModelOptionLabel, ModelPickerPopover, ModelPickerTrigger, ModelPricingTip, ModelTierIcon, ModelTierOption, ModelTriggerContent, DEFAULT_MODEL_PRICING_TIP_LABELS, type ModelPricingTipLabels, type ModelConfigureButtonProps, type ModelOptionProps, type ModelPickerPopoverProps, type ModelPickerTriggerProps, type ModelPricingTipProps, type ModelTierIconProps, type ModelTierKind, type ModelTierOptionProps, type ModelTriggerContentProps, } from './ModelPicker';
|
|
20
20
|
export { ComposerAccessories, ComposerTools, ConversationHeaderActions, ConversationHistoryPane, ConversationSettingsButton, NewChatButton, NewPaChatButton, PaModeBadge, DEFAULT_CONVERSATION_PARTS_LABELS, type ConversationPartsLabels, type NewChatButtonProps, } from './ConversationParts';
|
|
21
21
|
export { ThreadMap, ThreadMapDiagram, ThreadMapError, ThreadMapLoading, DEFAULT_THREAD_MAP_LABELS, type ThreadMapLabels, type ThreadMapDiagramProps, type ThreadMapProps, } from './ThreadMap';
|
|
22
|
+
export { ThreadVisualizer, DEFAULT_THREAD_VISUALIZER_LABELS, type ThreadVisualizerLabels, type ThreadVisualizerProps, } from './ThreadVisualizer';
|
|
23
|
+
export { buildThreadDiagram, threadForNode, type ThreadDiagramMessage, type ThreadDiagramThread, } from './thread-diagram';
|
|
22
24
|
export { useLongPaste, isLongPastedText, type UseLongPaste } from '../lib/useLongPaste';
|
|
23
25
|
export { useListKeyNav, type UseListKeyNav, type UseListKeyNavOptions } from '../lib/useListKeyNav';
|
|
24
26
|
export { PendingAnswerBar, DEFAULT_PENDING_ANSWER_BAR_LABELS, type PendingAnswerBarProps, type PendingAnswerBarLabels, } from './PendingAnswerBar';
|
package/dist/chat/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { AssistantToaster, BranchControls, ComposerAccessories, ComposerTools, ContextActionButton, ContextCheckRow, ContextPanelContent, ContextPanelFooter, ContextPanelTabs, ContextPickerList, ContextPickerRow, ContextSearchInput, ContextSelectList, ContextSelectRow, Conversation, ConversationBody, ConversationFilter, ConversationHeader, ConversationHeaderActions, ConversationHistoryPane, ConversationLoading, ConversationMain, ConversationRoot, ConversationSearchView, ConversationSettingsButton, DEFAULT_BRANCH_CONTROLS_LABELS, DEFAULT_CONVERSATION_LAYOUT_LABELS, DEFAULT_CONVERSATION_PARTS_LABELS, DEFAULT_CONVERSATION_SEARCH_LABELS, DEFAULT_DRAFTING_DOC_CHIP_LABELS, DEFAULT_LABEL_PIN_ROW_LABELS, DEFAULT_MODEL_PRICING_TIP_LABELS, DEFAULT_PENDING_ANSWER_BAR_LABELS, DEFAULT_PINNED_DOC_CHIP_LABELS, DEFAULT_SLASH_MENU_LABELS, DEFAULT_THREAD_MAP_LABELS, DraftingDocChip, LabelPinRow, ModelAutoIcon, ModelConfigureButton, ModelDot, ModelMenuDivider, ModelMenuMessage, ModelOption, ModelOptionLabel, ModelPickerPopover, ModelPickerTrigger, ModelPricingTip, ModelTierIcon, ModelTierOption, ModelTriggerContent, NewChatButton, NewPaChatButton, PaModeBadge, PendingAnswerBar, PinnedDocChip, ProvisionalTranscriptLine, SlashMenu, ThreadMap, ThreadMapDiagram, ThreadMapError, ThreadMapLoading, TranscriptLine, flashMessage, getParticipantTints, hasMessageBody, isLongPastedText, transcriptRuns, useDismissibleCard, useLongPaste, useRecipientDraft } from '../chunk-
|
|
2
|
+
export { AssistantToaster, BranchControls, ComposerAccessories, ComposerTools, ContextActionButton, ContextCheckRow, ContextPanelContent, ContextPanelFooter, ContextPanelTabs, ContextPickerList, ContextPickerRow, ContextSearchInput, ContextSelectList, ContextSelectRow, Conversation, ConversationBody, ConversationFilter, ConversationHeader, ConversationHeaderActions, ConversationHistoryPane, ConversationLoading, ConversationMain, ConversationRoot, ConversationSearchView, ConversationSettingsButton, DEFAULT_BRANCH_CONTROLS_LABELS, DEFAULT_CONVERSATION_LAYOUT_LABELS, DEFAULT_CONVERSATION_PARTS_LABELS, DEFAULT_CONVERSATION_SEARCH_LABELS, DEFAULT_DRAFTING_DOC_CHIP_LABELS, DEFAULT_LABEL_PIN_ROW_LABELS, DEFAULT_MODEL_PRICING_TIP_LABELS, DEFAULT_PENDING_ANSWER_BAR_LABELS, DEFAULT_PINNED_DOC_CHIP_LABELS, DEFAULT_SLASH_MENU_LABELS, DEFAULT_THREAD_MAP_LABELS, DEFAULT_THREAD_VISUALIZER_LABELS, DraftingDocChip, LabelPinRow, ModelAutoIcon, ModelConfigureButton, ModelDot, ModelMenuDivider, ModelMenuMessage, ModelOption, ModelOptionLabel, ModelPickerPopover, ModelPickerTrigger, ModelPricingTip, ModelTierIcon, ModelTierOption, ModelTriggerContent, NewChatButton, NewPaChatButton, PaModeBadge, PendingAnswerBar, PinnedDocChip, ProvisionalTranscriptLine, SlashMenu, ThreadMap, ThreadMapDiagram, ThreadMapError, ThreadMapLoading, ThreadVisualizer, TranscriptLine, buildThreadDiagram, flashMessage, getParticipantTints, hasMessageBody, isLongPastedText, threadForNode, transcriptRuns, useDismissibleCard, useLongPaste, useRecipientDraft } from '../chunk-26E6PHD2.js';
|
|
3
3
|
import '../chunk-OKERRHLH.js';
|
|
4
|
-
export { AssistantDock, AssistantDockToggle, AssistantModeToggle, ChatDocuments, ChatMessageContent, ChatPage, ChatThreadList, ChatThreadSelect, CitationMark, Composer, ComposerBranchingNotice, ComposerContainer, ComposerDock, ComposerFrame, ComposerInput, ComposerRoot, ComposerSend, ComposerToolbar, ComposerVoiceButton, ContextChip, ConversationEmpty, DEFAULT_ASSISTANT_MODE_TOGGLE_LABELS, DEFAULT_CHAT_PAGE_LABELS, DEFAULT_COMPOSER_LABELS, DEFAULT_CONVERSATION_EMPTY_LABELS, DEFAULT_MESSAGE_ALERT_LABELS, DEFAULT_MESSAGE_LABELS, DEFAULT_MESSAGE_LIST_LABELS, DEFAULT_WORKFLOW_STEP_CHIP_LABELS, Message, MessageActionButton, MessageActionMenu, MessageAlert, MessageAuthor, MessageBody, MessageBubble, MessageByline, MessageContent, MessageFooter, MessageList, MessageListBanner, MessageListEmpty, MessageListRoot, MessageListRow, MessageListRows, MessageListStatus, MessageListTail, MessageNarration, MessageRoot, MessageSources, MessageSubagentBadge, ScrollToBottom, SourceChip, WorkflowStepChip, toSpeakableText, useAssistantDock, useChatSurface, useRegisterEmbeddedChat, useStreamAnnouncement } from '../chunk-
|
|
4
|
+
export { AssistantDock, AssistantDockToggle, AssistantModeToggle, ChatDocuments, ChatMessageContent, ChatPage, ChatThreadList, ChatThreadSelect, CitationMark, Composer, ComposerBranchingNotice, ComposerContainer, ComposerDock, ComposerFrame, ComposerInput, ComposerRoot, ComposerSend, ComposerToolbar, ComposerVoiceButton, ContextChip, ConversationEmpty, DEFAULT_ASSISTANT_MODE_TOGGLE_LABELS, DEFAULT_CHAT_PAGE_LABELS, DEFAULT_COMPOSER_LABELS, DEFAULT_CONVERSATION_EMPTY_LABELS, DEFAULT_MESSAGE_ALERT_LABELS, DEFAULT_MESSAGE_LABELS, DEFAULT_MESSAGE_LIST_LABELS, DEFAULT_WORKFLOW_STEP_CHIP_LABELS, Message, MessageActionButton, MessageActionMenu, MessageAlert, MessageAuthor, MessageBody, MessageBubble, MessageByline, MessageContent, MessageFooter, MessageList, MessageListBanner, MessageListEmpty, MessageListRoot, MessageListRow, MessageListRows, MessageListStatus, MessageListTail, MessageNarration, MessageRoot, MessageSources, MessageSubagentBadge, ScrollToBottom, SourceChip, WorkflowStepChip, toSpeakableText, useAssistantDock, useChatSurface, useRegisterEmbeddedChat, useStreamAnnouncement } from '../chunk-CXLVI3SB.js';
|
|
5
5
|
import '../chunk-7XF5SFJ2.js';
|
|
6
6
|
export { savedDocumentIdFor, takeOpenDocumentForTurn, useOpenDocumentId, useRegisterOpenDocument } from '../chunk-GYCQ3FNL.js';
|
|
7
|
-
export { useMentionAutocomplete } from '../chunk-
|
|
8
|
-
import '../chunk-AUS3KBHJ.js';
|
|
7
|
+
export { useMentionAutocomplete } from '../chunk-7HAM7Y5U.js';
|
|
9
8
|
export { DEFAULT_MENTION_LABELS, MENTION_HREF_PREFIX, MentionChip, MentionMenu, extractMentions, filterMentionCandidates, findMentionQuery, insertMention, linkMentions, mentionFromHref, toMessageMentions, useListKeyNav } from '../chunk-AA3PT6KR.js';
|
|
9
|
+
import '../chunk-AUS3KBHJ.js';
|
|
10
10
|
import '../chunk-SLSBJRWW.js';
|
|
11
11
|
import '../chunk-Z3AZ7Q5X.js';
|
|
12
12
|
import '../chunk-NPLYHR2E.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers for the thread map: build the Mermaid flowchart of a conversation's threads, and
|
|
3
|
+
* resolve which thread a clicked node should open.
|
|
4
|
+
*
|
|
5
|
+
* A Thread is `{ leaf_message_ext_id, history }`; threads may share history up to a branch point.
|
|
6
|
+
*/
|
|
7
|
+
/** The message fields the map reads (an ARBI `MessageResponse` fits). */
|
|
8
|
+
export interface ThreadDiagramMessage {
|
|
9
|
+
external_id?: string | null;
|
|
10
|
+
parent_message_ext_id?: string | null;
|
|
11
|
+
is_branch_point?: boolean | null;
|
|
12
|
+
role: string;
|
|
13
|
+
content?: string | null;
|
|
14
|
+
}
|
|
15
|
+
/** One thread: the leaf message and the history leading to it (an ARBI `Thread` fits). */
|
|
16
|
+
export interface ThreadDiagramThread {
|
|
17
|
+
leaf_message_ext_id: string;
|
|
18
|
+
history: ThreadDiagramMessage[];
|
|
19
|
+
}
|
|
20
|
+
/** Mermaid `graph TD` source for the threads, or null while there is nothing to draw. */
|
|
21
|
+
export declare function buildThreadDiagram(threads: ThreadDiagramThread[]): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* The thread to open for a clicked flowchart node: the thread ending at that message if there is
|
|
24
|
+
* one, otherwise the first thread containing it. Node ids look like `flowchart-msg-{uuid}-{n}`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function threadForNode(threads: ThreadDiagramThread[], nodeId: string): string | null;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Toaster } from './chunk-OKERRHLH.js';
|
|
3
|
-
import { useAssistantDock, useChatSurface } from './chunk-
|
|
3
|
+
import { useAssistantDock, useChatSurface } from './chunk-CXLVI3SB.js';
|
|
4
4
|
import { BlocksTooltipProvider } from './chunk-7XF5SFJ2.js';
|
|
5
5
|
import { listOptionId } from './chunk-AA3PT6KR.js';
|
|
6
6
|
import { speakerAccent, speakerDot } from './chunk-Z3AZ7Q5X.js';
|
|
7
7
|
import { prefixedTestId, testIdOr } from './chunk-7F6CBP3Z.js';
|
|
8
|
-
import { Globe, BookOpen, ChevronsUpDown, Search, SquareSlash, PenLine, Pin, X, Network, ArrowLeft, ArrowRight, Crown, Glasses, Zap, Sparkles, Check, Settings, Plus, Bot,
|
|
8
|
+
import { Globe, BookOpen, ChevronsUpDown, Search, SquareSlash, Download, PenLine, Pin, X, Network, ArrowLeft, ArrowRight, Crown, Glasses, Zap, Sparkles, Check, Settings, Plus, Bot, MessageCircleQuestion, Clock, Play, Pause, Loader2, MessageSquare, CheckCircle, Tag, AudioLines, User } from 'lucide-react';
|
|
9
9
|
import { cn, Button, HoverCardContent, Input, Badge, Tooltip, TooltipTrigger, TooltipContent, Popover, PopoverTrigger, PopoverContent, PassageCard, Tabs, TabsList, TabsTrigger, TabsContent } from '@arbidocs/react/ui';
|
|
10
10
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
11
|
-
import { memo, useId, useRef, useEffect, forwardRef,
|
|
11
|
+
import { memo, useId, useRef, useEffect, forwardRef, useState, useMemo, useCallback, Fragment as Fragment$1 } from 'react';
|
|
12
12
|
import DOMPurify from 'dompurify';
|
|
13
13
|
|
|
14
14
|
// src/chat/participant-tints.ts
|
|
@@ -946,6 +946,231 @@ function ThreadMapDiagram({
|
|
|
946
946
|
}
|
|
947
947
|
);
|
|
948
948
|
}
|
|
949
|
+
|
|
950
|
+
// src/chat/thread-diagram.ts
|
|
951
|
+
var DIAGRAM_COLORS = {
|
|
952
|
+
userBg: "#f1f5f9",
|
|
953
|
+
// slate-100
|
|
954
|
+
assistantBg: "#ffffff",
|
|
955
|
+
stroke: "#cbd5e1",
|
|
956
|
+
// slate-300
|
|
957
|
+
strokeLight: "#e2e8f0",
|
|
958
|
+
// slate-200
|
|
959
|
+
text: "#334155"
|
|
960
|
+
// slate-700
|
|
961
|
+
};
|
|
962
|
+
function escapeLabel(text) {
|
|
963
|
+
return text.replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/\[/g, "[").replace(/\]/g, "]").replace(/\(/g, "(").replace(/\)/g, ")").replace(/\{/g, "{").replace(/\}/g, "}");
|
|
964
|
+
}
|
|
965
|
+
function buildThreadDiagram(threads) {
|
|
966
|
+
if (!threads || threads.length === 0) return null;
|
|
967
|
+
const allMessages = /* @__PURE__ */ new Map();
|
|
968
|
+
threads.forEach((thread) => {
|
|
969
|
+
thread.history.forEach((message) => {
|
|
970
|
+
allMessages.set(message.external_id, message);
|
|
971
|
+
});
|
|
972
|
+
});
|
|
973
|
+
const parentToChildren = /* @__PURE__ */ new Map();
|
|
974
|
+
threads.forEach((thread) => {
|
|
975
|
+
thread.history.forEach((message, index) => {
|
|
976
|
+
const messageId = message.external_id;
|
|
977
|
+
let parentId = message.parent_message_ext_id;
|
|
978
|
+
if (!parentId && index > 0) {
|
|
979
|
+
parentId = thread.history[index - 1].external_id;
|
|
980
|
+
console.warn(
|
|
981
|
+
`ThreadVisualizer: Message ${messageId} (${message.role}) missing parent_message_ext_id. Inferred parent: ${parentId}`
|
|
982
|
+
);
|
|
983
|
+
} else if (!parentId) {
|
|
984
|
+
parentId = null;
|
|
985
|
+
}
|
|
986
|
+
if (parentId && !allMessages.has(parentId)) {
|
|
987
|
+
if (index > 0) {
|
|
988
|
+
const fallbackParentId = thread.history[index - 1].external_id;
|
|
989
|
+
console.warn(
|
|
990
|
+
`ThreadVisualizer: Message ${messageId} has invalid parent ${parentId}. Using fallback: ${fallbackParentId}`
|
|
991
|
+
);
|
|
992
|
+
parentId = fallbackParentId;
|
|
993
|
+
} else {
|
|
994
|
+
console.warn(
|
|
995
|
+
`ThreadVisualizer: Message ${messageId} has invalid parent ${parentId} and no fallback. Using root.`
|
|
996
|
+
);
|
|
997
|
+
parentId = null;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
if (!parentToChildren.has(parentId)) parentToChildren.set(parentId, /* @__PURE__ */ new Set());
|
|
1001
|
+
parentToChildren.get(parentId)?.add(messageId);
|
|
1002
|
+
});
|
|
1003
|
+
});
|
|
1004
|
+
const branchPoints = /* @__PURE__ */ new Set();
|
|
1005
|
+
parentToChildren.forEach((children, parentId) => {
|
|
1006
|
+
if (children.size > 1 && parentId) branchPoints.add(parentId);
|
|
1007
|
+
});
|
|
1008
|
+
allMessages.forEach((message, id) => {
|
|
1009
|
+
if (message.is_branch_point) branchPoints.add(id);
|
|
1010
|
+
});
|
|
1011
|
+
const leafNodes = new Set(threads.map((thread) => thread.leaf_message_ext_id));
|
|
1012
|
+
let diagram = "graph TD\n";
|
|
1013
|
+
diagram += ` classDef user fill:${DIAGRAM_COLORS.userBg},stroke:${DIAGRAM_COLORS.stroke},color:${DIAGRAM_COLORS.text},stroke-width:1px,font-size:12px
|
|
1014
|
+
`;
|
|
1015
|
+
diagram += ` classDef assistant fill:${DIAGRAM_COLORS.assistantBg},stroke:${DIAGRAM_COLORS.strokeLight},color:${DIAGRAM_COLORS.text},stroke-width:1px,font-size:12px
|
|
1016
|
+
`;
|
|
1017
|
+
diagram += ` linkStyle default stroke:${DIAGRAM_COLORS.stroke},stroke-width:1px
|
|
1018
|
+
`;
|
|
1019
|
+
allMessages.forEach((message, id) => {
|
|
1020
|
+
const plain = (message.content || "").replace(/[*_~`#]/g, "");
|
|
1021
|
+
const shortened = plain.substring(0, 180).replace(/\n/g, " ");
|
|
1022
|
+
const content = escapeLabel(shortened) + (shortened.length < plain.length ? "..." : "");
|
|
1023
|
+
let label = `${message.role === "user" ? "User" : "Assistant"}: ${content}`;
|
|
1024
|
+
if (branchPoints.has(id)) label = `${label} \u{1F500}`;
|
|
1025
|
+
if (leafNodes.has(id)) label = `${label} \u{1F3C1}`;
|
|
1026
|
+
diagram += ` ${id}["${label}"]
|
|
1027
|
+
`;
|
|
1028
|
+
diagram += ` class ${id} ${message.role === "user" ? "user" : "assistant"}
|
|
1029
|
+
`;
|
|
1030
|
+
});
|
|
1031
|
+
parentToChildren.forEach((children, parentId) => {
|
|
1032
|
+
children.forEach((childId) => {
|
|
1033
|
+
if (parentId) diagram += ` ${parentId} --> ${childId}
|
|
1034
|
+
`;
|
|
1035
|
+
});
|
|
1036
|
+
});
|
|
1037
|
+
return diagram;
|
|
1038
|
+
}
|
|
1039
|
+
function threadForNode(threads, nodeId) {
|
|
1040
|
+
const messageId = nodeId.replace(/^flowchart-/, "").replace(/-\d+$/, "");
|
|
1041
|
+
if (threads.some((thread) => thread.leaf_message_ext_id === messageId)) return messageId;
|
|
1042
|
+
const containing = threads.find(
|
|
1043
|
+
(thread) => thread.history.some((msg) => msg.external_id === messageId)
|
|
1044
|
+
);
|
|
1045
|
+
return containing ? containing.leaf_message_ext_id : null;
|
|
1046
|
+
}
|
|
1047
|
+
var DEFAULT_THREAD_VISUALIZER_LABELS = {
|
|
1048
|
+
hint: "Click on a message to resume conversation thread.",
|
|
1049
|
+
hintMany: "This conversation has many threads. Click on a message to resume conversation thread."
|
|
1050
|
+
};
|
|
1051
|
+
var mermaidInitialized = false;
|
|
1052
|
+
var mermaidModule = null;
|
|
1053
|
+
async function getMermaid() {
|
|
1054
|
+
if (!mermaidModule) {
|
|
1055
|
+
mermaidModule = (await import('mermaid')).default;
|
|
1056
|
+
}
|
|
1057
|
+
if (!mermaidInitialized) {
|
|
1058
|
+
try {
|
|
1059
|
+
mermaidModule.initialize({
|
|
1060
|
+
startOnLoad: false,
|
|
1061
|
+
flowchart: { useMaxWidth: true, curve: "basis" },
|
|
1062
|
+
securityLevel: "loose"
|
|
1063
|
+
// Required for click interactivity
|
|
1064
|
+
});
|
|
1065
|
+
mermaidInitialized = true;
|
|
1066
|
+
} catch (error) {
|
|
1067
|
+
console.error("Error initializing Mermaid:", error);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
return mermaidModule;
|
|
1071
|
+
}
|
|
1072
|
+
function ThreadVisualizerView({
|
|
1073
|
+
threads,
|
|
1074
|
+
switchToThread,
|
|
1075
|
+
showHeader = true,
|
|
1076
|
+
showDownloadButton = true,
|
|
1077
|
+
className,
|
|
1078
|
+
labels
|
|
1079
|
+
}) {
|
|
1080
|
+
const svgContainerRef = useRef(null);
|
|
1081
|
+
const [isRendering, setIsRendering] = useState(true);
|
|
1082
|
+
const [renderError, setRenderError] = useState(null);
|
|
1083
|
+
const [svgContent, setSvgContent] = useState("");
|
|
1084
|
+
const renderingRef = useRef(false);
|
|
1085
|
+
const mermaidDiagram = useMemo(() => buildThreadDiagram(threads), [threads]);
|
|
1086
|
+
const handleNodeClick = useCallback(
|
|
1087
|
+
(nodeId) => {
|
|
1088
|
+
try {
|
|
1089
|
+
const threadId = threadForNode(threads, nodeId);
|
|
1090
|
+
if (threadId) switchToThread(threadId);
|
|
1091
|
+
} catch (error) {
|
|
1092
|
+
console.error("Error in thread navigation callback:", error);
|
|
1093
|
+
}
|
|
1094
|
+
},
|
|
1095
|
+
[threads, switchToThread]
|
|
1096
|
+
);
|
|
1097
|
+
const saveSvgAsFile = useCallback(() => {
|
|
1098
|
+
if (!svgContent) return;
|
|
1099
|
+
try {
|
|
1100
|
+
const blob = new Blob([svgContent], { type: "image/svg+xml" });
|
|
1101
|
+
const url = URL.createObjectURL(blob);
|
|
1102
|
+
const link = document.createElement("a");
|
|
1103
|
+
link.href = url;
|
|
1104
|
+
link.download = `thread-visualizer-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.svg`;
|
|
1105
|
+
document.body.appendChild(link);
|
|
1106
|
+
link.click();
|
|
1107
|
+
document.body.removeChild(link);
|
|
1108
|
+
URL.revokeObjectURL(url);
|
|
1109
|
+
} catch (error) {
|
|
1110
|
+
console.error("Failed to save SVG:", error);
|
|
1111
|
+
}
|
|
1112
|
+
}, [svgContent]);
|
|
1113
|
+
useEffect(() => {
|
|
1114
|
+
if (renderingRef.current || !mermaidDiagram) return;
|
|
1115
|
+
const renderDiagram = async () => {
|
|
1116
|
+
renderingRef.current = true;
|
|
1117
|
+
setIsRendering(true);
|
|
1118
|
+
setRenderError(null);
|
|
1119
|
+
setSvgContent("");
|
|
1120
|
+
try {
|
|
1121
|
+
const renderDiagramId = `mermaid-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
1122
|
+
const mermaid = await getMermaid();
|
|
1123
|
+
const { svg } = await mermaid.render(renderDiagramId, mermaidDiagram);
|
|
1124
|
+
setSvgContent(svg);
|
|
1125
|
+
setIsRendering(false);
|
|
1126
|
+
} catch (error) {
|
|
1127
|
+
console.error("Error rendering mermaid diagram:", error);
|
|
1128
|
+
setRenderError(error instanceof Error ? error.message : String(error));
|
|
1129
|
+
setIsRendering(false);
|
|
1130
|
+
setSvgContent("");
|
|
1131
|
+
} finally {
|
|
1132
|
+
renderingRef.current = false;
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
renderDiagram();
|
|
1136
|
+
}, [mermaidDiagram]);
|
|
1137
|
+
useEffect(() => {
|
|
1138
|
+
if (!svgContent || !svgContainerRef.current) return;
|
|
1139
|
+
const svgElement = svgContainerRef.current.querySelector("svg");
|
|
1140
|
+
if (!svgElement) return;
|
|
1141
|
+
svgElement.style.maxWidth = "100%";
|
|
1142
|
+
svgElement.style.height = "auto";
|
|
1143
|
+
svgElement.style.minHeight = "400px";
|
|
1144
|
+
const textElements = svgElement.getElementsByTagName("text");
|
|
1145
|
+
for (let i = 0; i < textElements.length; i++) {
|
|
1146
|
+
textElements[i].setAttribute("font-family", "system-ui, sans-serif");
|
|
1147
|
+
textElements[i].setAttribute("font-size", "12px");
|
|
1148
|
+
textElements[i].style.fontSize = "12px !important";
|
|
1149
|
+
}
|
|
1150
|
+
svgElement.querySelectorAll("g.node").forEach((element) => {
|
|
1151
|
+
const nodeId = element.getAttribute("id");
|
|
1152
|
+
if (!nodeId) return;
|
|
1153
|
+
element.style.cursor = "pointer";
|
|
1154
|
+
element.addEventListener("click", () => handleNodeClick(nodeId));
|
|
1155
|
+
});
|
|
1156
|
+
}, [svgContent, handleNodeClick]);
|
|
1157
|
+
const l = { ...DEFAULT_THREAD_VISUALIZER_LABELS, ...labels };
|
|
1158
|
+
const hint = showHeader ? threads.length > 5 ? l.hintMany : l.hint : void 0;
|
|
1159
|
+
return /* @__PURE__ */ jsxs(
|
|
1160
|
+
ThreadMap,
|
|
1161
|
+
{
|
|
1162
|
+
hint,
|
|
1163
|
+
onSave: showDownloadButton && svgContent ? saveSvgAsFile : void 0,
|
|
1164
|
+
className,
|
|
1165
|
+
children: [
|
|
1166
|
+
(isRendering || !svgContent || !mermaidDiagram) && !renderError && /* @__PURE__ */ jsx(ThreadMapLoading, {}),
|
|
1167
|
+
renderError && /* @__PURE__ */ jsx(ThreadMapError, { message: renderError }),
|
|
1168
|
+
svgContent && !renderError && /* @__PURE__ */ jsx(ThreadMapDiagram, { svg: svgContent, diagramRef: svgContainerRef })
|
|
1169
|
+
]
|
|
1170
|
+
}
|
|
1171
|
+
);
|
|
1172
|
+
}
|
|
1173
|
+
var ThreadVisualizer = memo(ThreadVisualizerView);
|
|
949
1174
|
var LONG_PASTE_CHARACTER_LIMIT = 1e3;
|
|
950
1175
|
var LONG_PASTE_LINE_LIMIT = 12;
|
|
951
1176
|
function isLongPastedText(value) {
|
|
@@ -1830,6 +2055,6 @@ function transcriptRuns(items, speakerOf, timeOf, gapMs = 2 * 6e4) {
|
|
|
1830
2055
|
return continued;
|
|
1831
2056
|
}
|
|
1832
2057
|
|
|
1833
|
-
export { AssistantToaster, BranchControls, ComposerAccessories, ComposerTools, ContextActionButton, ContextCheckRow, ContextPanelContent, ContextPanelFooter, ContextPanelTabs, ContextPickerList, ContextPickerRow, ContextSearchInput, ContextSelectList, ContextSelectRow, Conversation, ConversationBody, ConversationFilter, ConversationHeader, ConversationHeaderActions, ConversationHistoryPane, ConversationLoading, ConversationMain, ConversationRoot, ConversationSearchView, ConversationSettingsButton, DEFAULT_BRANCH_CONTROLS_LABELS, DEFAULT_CONVERSATION_LAYOUT_LABELS, DEFAULT_CONVERSATION_PARTS_LABELS, DEFAULT_CONVERSATION_SEARCH_LABELS, DEFAULT_DRAFTING_DOC_CHIP_LABELS, DEFAULT_LABEL_PIN_ROW_LABELS, DEFAULT_MODEL_PRICING_TIP_LABELS, DEFAULT_PENDING_ANSWER_BAR_LABELS, DEFAULT_PINNED_DOC_CHIP_LABELS, DEFAULT_SLASH_MENU_LABELS, DEFAULT_THREAD_MAP_LABELS, DraftingDocChip, LabelPinRow, ModelAutoIcon, ModelConfigureButton, ModelDot, ModelMenuDivider, ModelMenuMessage, ModelOption, ModelOptionLabel, ModelPickerPopover, ModelPickerTrigger, ModelPricingTip, ModelTierIcon, ModelTierOption, ModelTriggerContent, NewChatButton, NewPaChatButton, PaModeBadge, PendingAnswerBar, PinnedDocChip, ProvisionalTranscriptLine, SlashMenu, ThreadMap, ThreadMapDiagram, ThreadMapError, ThreadMapLoading, TranscriptLine, flashMessage, getParticipantTints, hasMessageBody, isLongPastedText, transcriptRuns, useDismissibleCard, useLongPaste, useRecipientDraft };
|
|
1834
|
-
//# sourceMappingURL=chunk-
|
|
1835
|
-
//# sourceMappingURL=chunk-
|
|
2058
|
+
export { AssistantToaster, BranchControls, ComposerAccessories, ComposerTools, ContextActionButton, ContextCheckRow, ContextPanelContent, ContextPanelFooter, ContextPanelTabs, ContextPickerList, ContextPickerRow, ContextSearchInput, ContextSelectList, ContextSelectRow, Conversation, ConversationBody, ConversationFilter, ConversationHeader, ConversationHeaderActions, ConversationHistoryPane, ConversationLoading, ConversationMain, ConversationRoot, ConversationSearchView, ConversationSettingsButton, DEFAULT_BRANCH_CONTROLS_LABELS, DEFAULT_CONVERSATION_LAYOUT_LABELS, DEFAULT_CONVERSATION_PARTS_LABELS, DEFAULT_CONVERSATION_SEARCH_LABELS, DEFAULT_DRAFTING_DOC_CHIP_LABELS, DEFAULT_LABEL_PIN_ROW_LABELS, DEFAULT_MODEL_PRICING_TIP_LABELS, DEFAULT_PENDING_ANSWER_BAR_LABELS, DEFAULT_PINNED_DOC_CHIP_LABELS, DEFAULT_SLASH_MENU_LABELS, DEFAULT_THREAD_MAP_LABELS, DEFAULT_THREAD_VISUALIZER_LABELS, DraftingDocChip, LabelPinRow, ModelAutoIcon, ModelConfigureButton, ModelDot, ModelMenuDivider, ModelMenuMessage, ModelOption, ModelOptionLabel, ModelPickerPopover, ModelPickerTrigger, ModelPricingTip, ModelTierIcon, ModelTierOption, ModelTriggerContent, NewChatButton, NewPaChatButton, PaModeBadge, PendingAnswerBar, PinnedDocChip, ProvisionalTranscriptLine, SlashMenu, ThreadMap, ThreadMapDiagram, ThreadMapError, ThreadMapLoading, ThreadVisualizer, TranscriptLine, buildThreadDiagram, flashMessage, getParticipantTints, hasMessageBody, isLongPastedText, threadForNode, transcriptRuns, useDismissibleCard, useLongPaste, useRecipientDraft };
|
|
2059
|
+
//# sourceMappingURL=chunk-26E6PHD2.js.map
|
|
2060
|
+
//# sourceMappingURL=chunk-26E6PHD2.js.map
|