@assistant-ui/react-devtools 1.2.6 → 1.2.7
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/README.md +26 -8
- package/dist/DevToolsModal.d.ts +18 -2
- package/dist/DevToolsModal.d.ts.map +1 -1
- package/dist/DevToolsModal.js +25 -232
- package/dist/DevToolsModal.js.map +1 -1
- package/dist/DevToolsModalImpl.d.ts +11 -0
- package/dist/DevToolsModalImpl.d.ts.map +1 -0
- package/dist/DevToolsModalImpl.js +62 -0
- package/dist/DevToolsModalImpl.js.map +1 -0
- package/dist/data/createInProcessClient.d.ts +17 -0
- package/dist/data/createInProcessClient.d.ts.map +1 -0
- package/dist/data/createInProcessClient.js +54 -0
- package/dist/data/createInProcessClient.js.map +1 -0
- package/dist/data/projectApi.d.ts +22 -0
- package/dist/data/projectApi.d.ts.map +1 -0
- package/dist/data/projectApi.js +103 -0
- package/dist/data/projectApi.js.map +1 -0
- package/dist/data/types.d.ts +52 -0
- package/dist/data/types.d.ts.map +1 -0
- package/dist/data/types.js +10 -0
- package/dist/data/types.js.map +1 -0
- package/dist/data/useDevToolsClient.d.ts +19 -0
- package/dist/data/useDevToolsClient.d.ts.map +1 -0
- package/dist/data/useDevToolsClient.js +70 -0
- package/dist/data/useDevToolsClient.js.map +1 -0
- package/dist/index.d.ts +9 -10
- package/dist/index.js +7 -9
- package/dist/shell/DevToolsOverlay.d.ts +23 -0
- package/dist/shell/DevToolsOverlay.d.ts.map +1 -0
- package/dist/shell/DevToolsOverlay.js +106 -0
- package/dist/shell/DevToolsOverlay.js.map +1 -0
- package/dist/shell/DevToolsPanel.d.ts +23 -0
- package/dist/shell/DevToolsPanel.d.ts.map +1 -0
- package/dist/shell/DevToolsPanel.js +256 -0
- package/dist/shell/DevToolsPanel.js.map +1 -0
- package/dist/shell/ShadowRoot.d.ts +24 -0
- package/dist/shell/ShadowRoot.d.ts.map +1 -0
- package/dist/shell/ShadowRoot.js +107 -0
- package/dist/shell/ShadowRoot.js.map +1 -0
- package/dist/shell/SplitLayout.d.ts +28 -0
- package/dist/shell/SplitLayout.d.ts.map +1 -0
- package/dist/shell/SplitLayout.js +67 -0
- package/dist/shell/SplitLayout.js.map +1 -0
- package/dist/shell/registry.d.ts +41 -0
- package/dist/shell/registry.d.ts.map +1 -0
- package/dist/shell/registry.js +36 -0
- package/dist/shell/registry.js.map +1 -0
- package/dist/shell/tabs/ActivityTab.d.ts +13 -0
- package/dist/shell/tabs/ActivityTab.d.ts.map +1 -0
- package/dist/shell/tabs/ActivityTab.js +259 -0
- package/dist/shell/tabs/ActivityTab.js.map +1 -0
- package/dist/shell/tabs/ContextTab.d.ts +11 -0
- package/dist/shell/tabs/ContextTab.d.ts.map +1 -0
- package/dist/shell/tabs/ContextTab.js +210 -0
- package/dist/shell/tabs/ContextTab.js.map +1 -0
- package/dist/shell/tabs/RawTab.d.ts +11 -0
- package/dist/shell/tabs/RawTab.d.ts.map +1 -0
- package/dist/shell/tabs/RawTab.js +238 -0
- package/dist/shell/tabs/RawTab.js.map +1 -0
- package/dist/shell/tabs/ThreadTab.d.ts +12 -0
- package/dist/shell/tabs/ThreadTab.d.ts.map +1 -0
- package/dist/shell/tabs/ThreadTab.js +426 -0
- package/dist/shell/tabs/ThreadTab.js.map +1 -0
- package/dist/shell/tabs/navSelection.d.ts +10 -0
- package/dist/shell/tabs/navSelection.d.ts.map +1 -0
- package/dist/shell/tabs/navSelection.js +37 -0
- package/dist/shell/tabs/navSelection.js.map +1 -0
- package/dist/styles/panel.generated.d.ts +5 -0
- package/dist/styles/panel.generated.d.ts.map +1 -0
- package/dist/styles/panel.generated.js +6 -0
- package/dist/styles/panel.generated.js.map +1 -0
- package/dist/types.d.ts +1 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/common.d.ts +24 -0
- package/dist/utils/common.d.ts.map +1 -0
- package/dist/utils/common.js +64 -0
- package/dist/utils/common.js.map +1 -0
- package/dist/utils/diff.d.ts +16 -0
- package/dist/utils/diff.d.ts.map +1 -0
- package/dist/utils/diff.js +41 -0
- package/dist/utils/diff.js.map +1 -0
- package/dist/utils/serialization.d.ts.map +1 -1
- package/dist/utils/serialization.js +4 -1
- package/dist/utils/serialization.js.map +1 -1
- package/dist/views/activity/EventLogRow.d.ts +28 -0
- package/dist/views/activity/EventLogRow.d.ts.map +1 -0
- package/dist/views/activity/EventLogRow.js +185 -0
- package/dist/views/activity/EventLogRow.js.map +1 -0
- package/dist/views/activity/EventStreamPane.d.ts +11 -0
- package/dist/views/activity/EventStreamPane.d.ts.map +1 -0
- package/dist/views/activity/EventStreamPane.js +98 -0
- package/dist/views/activity/EventStreamPane.js.map +1 -0
- package/dist/views/activity/OrphansPane.d.ts +11 -0
- package/dist/views/activity/OrphansPane.d.ts.map +1 -0
- package/dist/views/activity/OrphansPane.js +39 -0
- package/dist/views/activity/OrphansPane.js.map +1 -0
- package/dist/views/activity/RunDetailPane.d.ts +11 -0
- package/dist/views/activity/RunDetailPane.d.ts.map +1 -0
- package/dist/views/activity/RunDetailPane.js +344 -0
- package/dist/views/activity/RunDetailPane.js.map +1 -0
- package/dist/views/activity/activityNodes.d.ts +39 -0
- package/dist/views/activity/activityNodes.d.ts.map +1 -0
- package/dist/views/activity/activityNodes.js +199 -0
- package/dist/views/activity/activityNodes.js.map +1 -0
- package/dist/views/activity/index.d.ts +6 -0
- package/dist/views/activity/index.js +6 -0
- package/dist/views/attachments/AttachmentList.d.ts +15 -0
- package/dist/views/attachments/AttachmentList.d.ts.map +1 -0
- package/dist/views/attachments/AttachmentList.js +279 -0
- package/dist/views/attachments/AttachmentList.js.map +1 -0
- package/dist/views/attachments/MediaPartView.d.ts +27 -0
- package/dist/views/attachments/MediaPartView.d.ts.map +1 -0
- package/dist/views/attachments/MediaPartView.js +180 -0
- package/dist/views/attachments/MediaPartView.js.map +1 -0
- package/dist/views/attachments/formatBytes.d.ts +8 -0
- package/dist/views/attachments/formatBytes.d.ts.map +1 -0
- package/dist/views/attachments/formatBytes.js +14 -0
- package/dist/views/attachments/formatBytes.js.map +1 -0
- package/dist/views/attachments/index.d.ts +5 -0
- package/dist/views/attachments/index.js +4 -0
- package/dist/views/attachments/parseAttachment.d.ts +8 -0
- package/dist/views/attachments/parseAttachment.d.ts.map +1 -0
- package/dist/views/attachments/parseAttachment.js +58 -0
- package/dist/views/attachments/parseAttachment.js.map +1 -0
- package/dist/views/attachments/types.d.ts +18 -0
- package/dist/views/attachments/types.d.ts.map +1 -0
- package/dist/views/attachments/types.js +0 -0
- package/dist/views/context/ContextDetail.d.ts +14 -0
- package/dist/views/context/ContextDetail.d.ts.map +1 -0
- package/dist/views/context/ContextDetail.js +87 -0
- package/dist/views/context/ContextDetail.js.map +1 -0
- package/dist/views/context/ToolUIsView.d.ts +9 -0
- package/dist/views/context/ToolUIsView.d.ts.map +1 -0
- package/dist/views/context/ToolUIsView.js +80 -0
- package/dist/views/context/ToolUIsView.js.map +1 -0
- package/dist/views/context/contextNodes.d.ts +32 -0
- package/dist/views/context/contextNodes.d.ts.map +1 -0
- package/dist/views/context/contextNodes.js +49 -0
- package/dist/views/context/contextNodes.js.map +1 -0
- package/dist/views/context/index.d.ts +4 -0
- package/dist/views/context/index.js +4 -0
- package/dist/views/mcp/McpView.d.ts +11 -0
- package/dist/views/mcp/McpView.d.ts.map +1 -0
- package/dist/views/mcp/McpView.js +239 -0
- package/dist/views/mcp/McpView.js.map +1 -0
- package/dist/views/mcp/index.d.ts +2 -0
- package/dist/views/mcp/index.js +2 -0
- package/dist/views/mcp/parse.d.ts +7 -0
- package/dist/views/mcp/parse.d.ts.map +1 -0
- package/dist/views/mcp/parse.js +43 -0
- package/dist/views/mcp/parse.js.map +1 -0
- package/dist/views/mcp/types.d.ts +22 -0
- package/dist/views/mcp/types.d.ts.map +1 -0
- package/dist/views/mcp/types.js +0 -0
- package/dist/views/message/ChainOfThought.d.ts +11 -0
- package/dist/views/message/ChainOfThought.d.ts.map +1 -0
- package/dist/views/message/ChainOfThought.js +132 -0
- package/dist/views/message/ChainOfThought.js.map +1 -0
- package/dist/views/message/MessageDetailPane.d.ts +12 -0
- package/dist/views/message/MessageDetailPane.d.ts.map +1 -0
- package/dist/views/message/MessageDetailPane.js +38 -0
- package/dist/views/message/MessageDetailPane.js.map +1 -0
- package/dist/views/message/MessageItem.d.ts +13 -0
- package/dist/views/message/MessageItem.d.ts.map +1 -0
- package/dist/views/message/MessageItem.js +136 -0
- package/dist/views/message/MessageItem.js.map +1 -0
- package/dist/views/message/MessageList.d.ts +13 -0
- package/dist/views/message/MessageList.d.ts.map +1 -0
- package/dist/views/message/MessageList.js +95 -0
- package/dist/views/message/MessageList.js.map +1 -0
- package/dist/views/message/MessageMetrics.d.ts +11 -0
- package/dist/views/message/MessageMetrics.d.ts.map +1 -0
- package/dist/views/message/MessageMetrics.js +93 -0
- package/dist/views/message/MessageMetrics.js.map +1 -0
- package/dist/views/message/MessageTimeline.d.ts +16 -0
- package/dist/views/message/MessageTimeline.d.ts.map +1 -0
- package/dist/views/message/MessageTimeline.js +100 -0
- package/dist/views/message/MessageTimeline.js.map +1 -0
- package/dist/views/message/PartDisclosure.d.ts +18 -0
- package/dist/views/message/PartDisclosure.d.ts.map +1 -0
- package/dist/views/message/PartDisclosure.js +79 -0
- package/dist/views/message/PartDisclosure.js.map +1 -0
- package/dist/views/message/PartView.d.ts +13 -0
- package/dist/views/message/PartView.d.ts.map +1 -0
- package/dist/views/message/PartView.js +416 -0
- package/dist/views/message/PartView.js.map +1 -0
- package/dist/views/message/RoleLabel.d.ts +11 -0
- package/dist/views/message/RoleLabel.d.ts.map +1 -0
- package/dist/views/message/RoleLabel.js +30 -0
- package/dist/views/message/RoleLabel.js.map +1 -0
- package/dist/views/message/StatusBadge.d.ts +17 -0
- package/dist/views/message/StatusBadge.d.ts.map +1 -0
- package/dist/views/message/StatusBadge.js +58 -0
- package/dist/views/message/StatusBadge.js.map +1 -0
- package/dist/views/message/ToolCallView.d.ts +13 -0
- package/dist/views/message/ToolCallView.d.ts.map +1 -0
- package/dist/views/message/ToolCallView.js +289 -0
- package/dist/views/message/ToolCallView.js.map +1 -0
- package/dist/views/message/TtftBar.d.ts +16 -0
- package/dist/views/message/TtftBar.d.ts.map +1 -0
- package/dist/views/message/TtftBar.js +128 -0
- package/dist/views/message/TtftBar.js.map +1 -0
- package/dist/views/message/index.d.ts +6 -0
- package/dist/views/message/index.js +5 -0
- package/dist/views/message/messagePlainText.d.ts +8 -0
- package/dist/views/message/messagePlainText.d.ts.map +1 -0
- package/dist/views/message/messagePlainText.js +39 -0
- package/dist/views/message/messagePlainText.js.map +1 -0
- package/dist/views/message/parse.d.ts +10 -0
- package/dist/views/message/parse.d.ts.map +1 -0
- package/dist/views/message/parse.js +235 -0
- package/dist/views/message/parse.js.map +1 -0
- package/dist/views/message/types.d.ts +114 -0
- package/dist/views/message/types.d.ts.map +1 -0
- package/dist/views/message/types.js +0 -0
- package/dist/views/model-context/ModelContextView.d.ts +26 -0
- package/dist/views/model-context/ModelContextView.d.ts.map +1 -0
- package/dist/views/model-context/ModelContextView.js +214 -0
- package/dist/views/model-context/ModelContextView.js.map +1 -0
- package/dist/views/nav.d.ts +19 -0
- package/dist/views/nav.d.ts.map +1 -0
- package/dist/views/nav.js +8 -0
- package/dist/views/nav.js.map +1 -0
- package/dist/views/raw/RawDetail.d.ts +15 -0
- package/dist/views/raw/RawDetail.d.ts.map +1 -0
- package/dist/views/raw/RawDetail.js +79 -0
- package/dist/views/raw/RawDetail.js.map +1 -0
- package/dist/views/raw/index.d.ts +3 -0
- package/dist/views/raw/index.js +3 -0
- package/dist/views/raw/rawNodes.d.ts +20 -0
- package/dist/views/raw/rawNodes.d.ts.map +1 -0
- package/dist/views/raw/rawNodes.js +78 -0
- package/dist/views/raw/rawNodes.js.map +1 -0
- package/dist/views/raw/statePreview.d.ts +5 -0
- package/dist/views/raw/statePreview.d.ts.map +1 -0
- package/dist/views/raw/statePreview.js +213 -0
- package/dist/views/raw/statePreview.js.map +1 -0
- package/dist/views/runs/PayloadDiff.d.ts +11 -0
- package/dist/views/runs/PayloadDiff.d.ts.map +1 -0
- package/dist/views/runs/PayloadDiff.js +92 -0
- package/dist/views/runs/PayloadDiff.js.map +1 -0
- package/dist/views/runs/parse.d.ts +8 -0
- package/dist/views/runs/parse.d.ts.map +1 -0
- package/dist/views/runs/parse.js +78 -0
- package/dist/views/runs/parse.js.map +1 -0
- package/dist/views/runs/types.d.ts +25 -0
- package/dist/views/runs/types.d.ts.map +1 -0
- package/dist/views/runs/types.js +0 -0
- package/dist/views/scopes/ScopesView.d.ts +9 -0
- package/dist/views/scopes/ScopesView.d.ts.map +1 -0
- package/dist/views/scopes/ScopesView.js +235 -0
- package/dist/views/scopes/ScopesView.js.map +1 -0
- package/dist/views/scopes/index.d.ts +2 -0
- package/dist/views/scopes/index.js +2 -0
- package/dist/views/scopes/parse.d.ts +7 -0
- package/dist/views/scopes/parse.d.ts.map +1 -0
- package/dist/views/scopes/parse.js +23 -0
- package/dist/views/scopes/parse.js.map +1 -0
- package/dist/views/scopes/types.d.ts +10 -0
- package/dist/views/scopes/types.d.ts.map +1 -0
- package/dist/views/scopes/types.js +0 -0
- package/dist/views/thread/ComposerAttachments.d.ts +11 -0
- package/dist/views/thread/ComposerAttachments.d.ts.map +1 -0
- package/dist/views/thread/ComposerAttachments.js +22 -0
- package/dist/views/thread/ComposerAttachments.js.map +1 -0
- package/dist/views/thread/ComposerFlags.d.ts +11 -0
- package/dist/views/thread/ComposerFlags.d.ts.map +1 -0
- package/dist/views/thread/ComposerFlags.js +54 -0
- package/dist/views/thread/ComposerFlags.js.map +1 -0
- package/dist/views/thread/ComposerQueue.d.ts +11 -0
- package/dist/views/thread/ComposerQueue.d.ts.map +1 -0
- package/dist/views/thread/ComposerQueue.js +55 -0
- package/dist/views/thread/ComposerQueue.js.map +1 -0
- package/dist/views/thread/ConversationList.d.ts +18 -0
- package/dist/views/thread/ConversationList.d.ts.map +1 -0
- package/dist/views/thread/ConversationList.js +228 -0
- package/dist/views/thread/ConversationList.js.map +1 -0
- package/dist/views/thread/ConversationStatusDot.d.ts +29 -0
- package/dist/views/thread/ConversationStatusDot.d.ts.map +1 -0
- package/dist/views/thread/ConversationStatusDot.js +91 -0
- package/dist/views/thread/ConversationStatusDot.js.map +1 -0
- package/dist/views/thread/ThreadDetails.d.ts +13 -0
- package/dist/views/thread/ThreadDetails.d.ts.map +1 -0
- package/dist/views/thread/ThreadDetails.js +170 -0
- package/dist/views/thread/ThreadDetails.js.map +1 -0
- package/dist/views/thread/Transcript.d.ts +21 -0
- package/dist/views/thread/Transcript.d.ts.map +1 -0
- package/dist/views/thread/Transcript.js +520 -0
- package/dist/views/thread/Transcript.js.map +1 -0
- package/dist/views/thread/index.d.ts +10 -0
- package/dist/views/thread/index.js +9 -0
- package/dist/views/thread/resolve.d.ts +13 -0
- package/dist/views/thread/resolve.d.ts.map +1 -0
- package/dist/views/thread/resolve.js +29 -0
- package/dist/views/thread/resolve.js.map +1 -0
- package/dist/views/thread/types.d.ts +50 -0
- package/dist/views/thread/types.d.ts.map +1 -0
- package/dist/views/thread/types.js +0 -0
- package/dist/views/thread/utils.d.ts +10 -0
- package/dist/views/thread/utils.d.ts.map +1 -0
- package/dist/views/thread/utils.js +77 -0
- package/dist/views/thread/utils.js.map +1 -0
- package/dist/views/ui/CenteredMessage.d.ts +11 -0
- package/dist/views/ui/CenteredMessage.d.ts.map +1 -0
- package/dist/views/ui/CenteredMessage.js +21 -0
- package/dist/views/ui/CenteredMessage.js.map +1 -0
- package/dist/views/ui/Chip.d.ts +13 -0
- package/dist/views/ui/Chip.d.ts.map +1 -0
- package/dist/views/ui/Chip.js +30 -0
- package/dist/views/ui/Chip.js.map +1 -0
- package/dist/views/ui/ControlButton.d.ts +10 -0
- package/dist/views/ui/ControlButton.d.ts.map +1 -0
- package/dist/views/ui/ControlButton.js +39 -0
- package/dist/views/ui/ControlButton.js.map +1 -0
- package/dist/views/ui/CopyButton.d.ts +19 -0
- package/dist/views/ui/CopyButton.d.ts.map +1 -0
- package/dist/views/ui/CopyButton.js +125 -0
- package/dist/views/ui/CopyButton.js.map +1 -0
- package/dist/views/ui/EmptyState.d.ts +11 -0
- package/dist/views/ui/EmptyState.d.ts.map +1 -0
- package/dist/views/ui/EmptyState.js +21 -0
- package/dist/views/ui/EmptyState.js.map +1 -0
- package/dist/views/ui/InfoCard.d.ts +22 -0
- package/dist/views/ui/InfoCard.d.ts.map +1 -0
- package/dist/views/ui/InfoCard.js +44 -0
- package/dist/views/ui/InfoCard.js.map +1 -0
- package/dist/views/ui/JSONTree.d.ts +16 -0
- package/dist/views/ui/JSONTree.d.ts.map +1 -0
- package/dist/views/ui/JSONTree.js +394 -0
- package/dist/views/ui/JSONTree.js.map +1 -0
- package/dist/views/ui/PaneHeader.d.ts +27 -0
- package/dist/views/ui/PaneHeader.d.ts.map +1 -0
- package/dist/views/ui/PaneHeader.js +71 -0
- package/dist/views/ui/PaneHeader.js.map +1 -0
- package/dist/views/ui/RailTime.d.ts +12 -0
- package/dist/views/ui/RailTime.d.ts.map +1 -0
- package/dist/views/ui/RailTime.js +49 -0
- package/dist/views/ui/RailTime.js.map +1 -0
- package/dist/views/ui/SectionLabel.d.ts +11 -0
- package/dist/views/ui/SectionLabel.d.ts.map +1 -0
- package/dist/views/ui/SectionLabel.js +21 -0
- package/dist/views/ui/SectionLabel.js.map +1 -0
- package/dist/views/ui/SelectableRow.d.ts +18 -0
- package/dist/views/ui/SelectableRow.d.ts.map +1 -0
- package/dist/views/ui/SelectableRow.js +49 -0
- package/dist/views/ui/SelectableRow.js.map +1 -0
- package/dist/views/ui/Sparkline.d.ts +17 -0
- package/dist/views/ui/Sparkline.d.ts.map +1 -0
- package/dist/views/ui/Sparkline.js +96 -0
- package/dist/views/ui/Sparkline.js.map +1 -0
- package/dist/views/ui/SummaryItem.d.ts +23 -0
- package/dist/views/ui/SummaryItem.d.ts.map +1 -0
- package/dist/views/ui/SummaryItem.js +59 -0
- package/dist/views/ui/SummaryItem.js.map +1 -0
- package/dist/views/ui/ToneBadge.d.ts +18 -0
- package/dist/views/ui/ToneBadge.d.ts.map +1 -0
- package/dist/views/ui/ToneBadge.js +34 -0
- package/dist/views/ui/ToneBadge.js.map +1 -0
- package/dist/views/ui/badgeTone.d.ts +21 -0
- package/dist/views/ui/badgeTone.d.ts.map +1 -0
- package/dist/views/ui/badgeTone.js +33 -0
- package/dist/views/ui/badgeTone.js.map +1 -0
- package/dist/views/ui/index.d.ts +16 -0
- package/dist/views/ui/index.js +16 -0
- package/dist/views/ui/useCopyToClipboard.d.ts +12 -0
- package/dist/views/ui/useCopyToClipboard.d.ts.map +1 -0
- package/dist/views/ui/useCopyToClipboard.js +44 -0
- package/dist/views/ui/useCopyToClipboard.js.map +1 -0
- package/package.json +9 -5
- package/src/DevToolsModal.tsx +26 -179
- package/src/DevToolsModalImpl.tsx +60 -0
- package/src/data/createInProcessClient.ts +66 -0
- package/src/data/projectApi.test.ts +100 -0
- package/src/data/projectApi.ts +169 -0
- package/src/data/types.ts +54 -0
- package/src/data/useDevToolsClient.ts +59 -0
- package/src/index.ts +16 -13
- package/src/shell/DevToolsOverlay.tsx +84 -0
- package/src/shell/DevToolsPanel.tsx +192 -0
- package/src/shell/ShadowRoot.tsx +85 -0
- package/src/shell/SplitLayout.tsx +46 -0
- package/src/shell/registry.ts +51 -0
- package/src/shell/tabs/ActivityTab.test.tsx +34 -0
- package/src/shell/tabs/ActivityTab.tsx +161 -0
- package/src/shell/tabs/ContextTab.test.tsx +37 -0
- package/src/shell/tabs/ContextTab.tsx +157 -0
- package/src/shell/tabs/RawTab.test.tsx +43 -0
- package/src/shell/tabs/RawTab.tsx +123 -0
- package/src/shell/tabs/ThreadTab.tsx +220 -0
- package/src/shell/tabs/navSelection.ts +17 -0
- package/src/styles/panel.css +153 -0
- package/src/styles/panel.generated.ts +2 -0
- package/src/types.ts +0 -5
- package/src/utils/common.test.ts +30 -0
- package/src/utils/common.ts +101 -0
- package/src/utils/diff.test.ts +37 -0
- package/src/utils/diff.ts +41 -0
- package/src/utils/serialization.test.ts +31 -0
- package/src/utils/serialization.ts +4 -1
- package/src/views/activity/EventLogRow.tsx +108 -0
- package/src/views/activity/EventStreamPane.tsx +86 -0
- package/src/views/activity/OrphansPane.tsx +23 -0
- package/src/views/activity/RunDetailPane.tsx +128 -0
- package/src/views/activity/activityNodes.test.ts +24 -0
- package/src/views/activity/activityNodes.ts +179 -0
- package/src/views/activity/index.ts +10 -0
- package/src/views/attachments/AttachmentList.tsx +122 -0
- package/src/views/attachments/MediaPartView.tsx +77 -0
- package/src/views/attachments/formatBytes.ts +15 -0
- package/src/views/attachments/index.ts +4 -0
- package/src/views/attachments/parseAttachment.test.ts +37 -0
- package/src/views/attachments/parseAttachment.ts +85 -0
- package/src/views/attachments/types.ts +15 -0
- package/src/views/context/ContextDetail.tsx +37 -0
- package/src/views/context/ToolUIsView.tsx +44 -0
- package/src/views/context/contextNodes.test.ts +31 -0
- package/src/views/context/contextNodes.ts +66 -0
- package/src/views/context/index.ts +4 -0
- package/src/views/mcp/McpView.tsx +125 -0
- package/src/views/mcp/index.ts +1 -0
- package/src/views/mcp/parse.test.ts +63 -0
- package/src/views/mcp/parse.ts +65 -0
- package/src/views/mcp/render.test.tsx +34 -0
- package/src/views/mcp/types.ts +20 -0
- package/src/views/message/ChainOfThought.tsx +74 -0
- package/src/views/message/MessageDetailPane.tsx +26 -0
- package/src/views/message/MessageItem.tsx +94 -0
- package/src/views/message/MessageList.tsx +48 -0
- package/src/views/message/MessageMetrics.tsx +68 -0
- package/src/views/message/MessageTimeline.test.tsx +78 -0
- package/src/views/message/MessageTimeline.tsx +51 -0
- package/src/views/message/PartDisclosure.tsx +32 -0
- package/src/views/message/PartView.tsx +197 -0
- package/src/views/message/RoleLabel.tsx +22 -0
- package/src/views/message/StatusBadge.tsx +28 -0
- package/src/views/message/ToolCallView.tsx +151 -0
- package/src/views/message/TtftBar.tsx +44 -0
- package/src/views/message/index.ts +5 -0
- package/src/views/message/messagePlainText.test.ts +48 -0
- package/src/views/message/messagePlainText.ts +65 -0
- package/src/views/message/parse.test.ts +269 -0
- package/src/views/message/parse.ts +282 -0
- package/src/views/message/render.test.tsx +128 -0
- package/src/views/message/types.ts +137 -0
- package/src/views/model-context/ModelContextView.tsx +71 -0
- package/src/views/model-context/render.test.tsx +24 -0
- package/src/views/nav.ts +18 -0
- package/src/views/raw/RawDetail.tsx +39 -0
- package/src/views/raw/index.ts +3 -0
- package/src/views/raw/rawNodes.test.ts +38 -0
- package/src/views/raw/rawNodes.ts +107 -0
- package/src/views/raw/statePreview.tsx +188 -0
- package/src/views/runs/PayloadDiff.tsx +49 -0
- package/src/views/runs/parse.test.ts +152 -0
- package/src/views/runs/parse.ts +110 -0
- package/src/views/runs/types.ts +23 -0
- package/src/views/scopes/ScopesView.tsx +105 -0
- package/src/views/scopes/index.ts +1 -0
- package/src/views/scopes/parse.test.ts +35 -0
- package/src/views/scopes/parse.ts +30 -0
- package/src/views/scopes/render.test.tsx +35 -0
- package/src/views/scopes/types.ts +6 -0
- package/src/views/thread/ComposerAttachments.test.tsx +36 -0
- package/src/views/thread/ComposerAttachments.tsx +8 -0
- package/src/views/thread/ComposerFlags.test.tsx +23 -0
- package/src/views/thread/ComposerFlags.tsx +19 -0
- package/src/views/thread/ComposerQueue.test.tsx +20 -0
- package/src/views/thread/ComposerQueue.tsx +26 -0
- package/src/views/thread/ConversationList.tsx +127 -0
- package/src/views/thread/ConversationStatusDot.test.ts +86 -0
- package/src/views/thread/ConversationStatusDot.tsx +126 -0
- package/src/views/thread/ThreadDetails.tsx +85 -0
- package/src/views/thread/Transcript.test.tsx +56 -0
- package/src/views/thread/Transcript.tsx +332 -0
- package/src/views/thread/index.ts +19 -0
- package/src/views/thread/render.test.tsx +41 -0
- package/src/views/thread/resolve.ts +36 -0
- package/src/views/thread/types.ts +53 -0
- package/src/views/thread/utils.test.ts +72 -0
- package/src/views/thread/utils.ts +149 -0
- package/src/views/ui/CenteredMessage.tsx +7 -0
- package/src/views/ui/Chip.tsx +17 -0
- package/src/views/ui/ControlButton.tsx +15 -0
- package/src/views/ui/CopyButton.tsx +73 -0
- package/src/views/ui/EmptyState.tsx +7 -0
- package/src/views/ui/InfoCard.tsx +35 -0
- package/src/views/ui/JSONTree.test.tsx +29 -0
- package/src/views/ui/JSONTree.tsx +240 -0
- package/src/views/ui/PaneHeader.tsx +46 -0
- package/src/views/ui/RailTime.tsx +27 -0
- package/src/views/ui/SectionLabel.tsx +7 -0
- package/src/views/ui/SelectableRow.tsx +41 -0
- package/src/views/ui/Sparkline.tsx +49 -0
- package/src/views/ui/SummaryItem.tsx +25 -0
- package/src/views/ui/ToneBadge.tsx +26 -0
- package/src/views/ui/badgeTone.ts +40 -0
- package/src/views/ui/index.ts +20 -0
- package/src/views/ui/useCopyToClipboard.ts +27 -0
- package/dist/DevToolsFrame.d.ts +0 -11
- package/dist/DevToolsFrame.d.ts.map +0 -1
- package/dist/DevToolsFrame.js +0 -66
- package/dist/DevToolsFrame.js.map +0 -1
- package/dist/DevToolsHost.d.ts +0 -38
- package/dist/DevToolsHost.d.ts.map +0 -1
- package/dist/DevToolsHost.js +0 -93
- package/dist/DevToolsHost.js.map +0 -1
- package/dist/ExtensionHost.d.ts +0 -10
- package/dist/ExtensionHost.d.ts.map +0 -1
- package/dist/ExtensionHost.js +0 -42
- package/dist/ExtensionHost.js.map +0 -1
- package/dist/FrameClient.d.ts +0 -38
- package/dist/FrameClient.d.ts.map +0 -1
- package/dist/FrameClient.js +0 -53
- package/dist/FrameClient.js.map +0 -1
- package/dist/FrameHost.d.ts +0 -11
- package/dist/FrameHost.d.ts.map +0 -1
- package/dist/FrameHost.js +0 -26
- package/dist/FrameHost.js.map +0 -1
- package/dist/constants.d.ts +0 -6
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -7
- package/dist/constants.js.map +0 -1
- package/dist/styles/DevToolsModal.styles.d.ts +0 -18
- package/dist/styles/DevToolsModal.styles.d.ts.map +0 -1
- package/dist/styles/DevToolsModal.styles.js +0 -120
- package/dist/styles/DevToolsModal.styles.js.map +0 -1
- package/src/DevToolsFrame.tsx +0 -55
- package/src/DevToolsHost.ts +0 -178
- package/src/ExtensionHost.ts +0 -57
- package/src/FrameClient.ts +0 -99
- package/src/FrameHost.ts +0 -31
- package/src/constants.ts +0 -2
- package/src/styles/DevToolsModal.styles.ts +0 -137
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { parseMcpManager } from "./parse";
|
|
3
|
+
|
|
4
|
+
describe("parseMcpManager", () => {
|
|
5
|
+
it("parses servers with connection state, error, and tools", () => {
|
|
6
|
+
const manager = parseMcpManager({
|
|
7
|
+
isHydrated: true,
|
|
8
|
+
servers: [
|
|
9
|
+
{
|
|
10
|
+
id: "s1",
|
|
11
|
+
kind: "connector",
|
|
12
|
+
name: "GitHub",
|
|
13
|
+
url: "https://mcp.example.com",
|
|
14
|
+
connectionState: "connected",
|
|
15
|
+
lastError: null,
|
|
16
|
+
authorizationUrl: null,
|
|
17
|
+
tools: [
|
|
18
|
+
{ name: "list_repos", description: "list repositories" },
|
|
19
|
+
{ name: "create_issue" },
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "s2",
|
|
24
|
+
kind: "custom",
|
|
25
|
+
name: "Broken",
|
|
26
|
+
connectionState: "error",
|
|
27
|
+
lastError: { message: "ECONNREFUSED" },
|
|
28
|
+
authorizationUrl: null,
|
|
29
|
+
tools: [],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
expect(manager).not.toBeNull();
|
|
35
|
+
if (!manager) return;
|
|
36
|
+
expect(manager.isHydrated).toBe(true);
|
|
37
|
+
expect(manager.servers).toHaveLength(2);
|
|
38
|
+
expect(manager.servers[0]).toMatchObject({
|
|
39
|
+
id: "s1",
|
|
40
|
+
name: "GitHub",
|
|
41
|
+
connectionState: "connected",
|
|
42
|
+
});
|
|
43
|
+
expect(manager.servers[0]?.tools).toHaveLength(2);
|
|
44
|
+
expect(manager.servers[1]?.lastError).toBe("ECONNREFUSED");
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("falls back to connectors + customServers when servers is absent", () => {
|
|
48
|
+
const manager = parseMcpManager({
|
|
49
|
+
connectors: [
|
|
50
|
+
{ id: "c1", name: "A", connectionState: "disconnected", tools: [] },
|
|
51
|
+
],
|
|
52
|
+
customServers: [
|
|
53
|
+
{ id: "x1", name: "B", connectionState: "authRequired", tools: [] },
|
|
54
|
+
],
|
|
55
|
+
});
|
|
56
|
+
if (!manager) return;
|
|
57
|
+
expect(manager.servers.map((s) => s.id)).toEqual(["c1", "x1"]);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("returns null for non-records", () => {
|
|
61
|
+
expect(parseMcpManager(undefined)).toBeNull();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { asString, isRecord } from "../../utils/common";
|
|
2
|
+
import type {
|
|
3
|
+
McpManagerPreview,
|
|
4
|
+
McpServerPreview,
|
|
5
|
+
McpToolPreview,
|
|
6
|
+
} from "./types";
|
|
7
|
+
|
|
8
|
+
const parseTool = (value: unknown): McpToolPreview | null => {
|
|
9
|
+
if (!isRecord(value)) return null;
|
|
10
|
+
const name = asString(value.name);
|
|
11
|
+
if (!name) return null;
|
|
12
|
+
const description = asString(value.description);
|
|
13
|
+
return { name, ...(description ? { description } : {}) };
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const parseServer = (value: unknown): McpServerPreview | null => {
|
|
17
|
+
if (!isRecord(value)) return null;
|
|
18
|
+
const id = asString(value.id);
|
|
19
|
+
if (!id) return null;
|
|
20
|
+
|
|
21
|
+
const lastError = isRecord(value.lastError)
|
|
22
|
+
? asString(value.lastError.message)
|
|
23
|
+
: undefined;
|
|
24
|
+
const kind = asString(value.kind);
|
|
25
|
+
const url = asString(value.url);
|
|
26
|
+
const authorizationUrl = asString(value.authorizationUrl);
|
|
27
|
+
const tools = Array.isArray(value.tools)
|
|
28
|
+
? value.tools
|
|
29
|
+
.map((tool) => parseTool(tool))
|
|
30
|
+
.filter((tool): tool is McpToolPreview => Boolean(tool))
|
|
31
|
+
: [];
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
id,
|
|
35
|
+
name: asString(value.name) || id,
|
|
36
|
+
connectionState: asString(value.connectionState) || "unknown",
|
|
37
|
+
tools,
|
|
38
|
+
...(kind ? { kind } : {}),
|
|
39
|
+
...(url ? { url } : {}),
|
|
40
|
+
...(lastError ? { lastError } : {}),
|
|
41
|
+
...(authorizationUrl ? { authorizationUrl } : {}),
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const parseMcpManager = (value: unknown): McpManagerPreview | null => {
|
|
46
|
+
if (!isRecord(value)) return null;
|
|
47
|
+
|
|
48
|
+
const source = Array.isArray(value.servers)
|
|
49
|
+
? value.servers
|
|
50
|
+
: [
|
|
51
|
+
...(Array.isArray(value.connectors) ? value.connectors : []),
|
|
52
|
+
...(Array.isArray(value.customServers) ? value.customServers : []),
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
const servers = source
|
|
56
|
+
.map((server) => parseServer(server))
|
|
57
|
+
.filter((server): server is McpServerPreview => Boolean(server));
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
servers,
|
|
61
|
+
...(typeof value.isHydrated === "boolean"
|
|
62
|
+
? { isHydrated: value.isHydrated }
|
|
63
|
+
: {}),
|
|
64
|
+
};
|
|
65
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { McpView } from "./McpView";
|
|
4
|
+
|
|
5
|
+
describe("McpView rendering", () => {
|
|
6
|
+
it("renders server connection state and a discovered tool", () => {
|
|
7
|
+
const html = renderToStaticMarkup(
|
|
8
|
+
<McpView
|
|
9
|
+
value={{
|
|
10
|
+
isHydrated: true,
|
|
11
|
+
servers: [
|
|
12
|
+
{
|
|
13
|
+
id: "s1",
|
|
14
|
+
kind: "connector",
|
|
15
|
+
name: "GitHub",
|
|
16
|
+
connectionState: "connected",
|
|
17
|
+
lastError: null,
|
|
18
|
+
authorizationUrl: null,
|
|
19
|
+
tools: [{ name: "list_repos", description: "list repos" }],
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
}}
|
|
23
|
+
/>,
|
|
24
|
+
);
|
|
25
|
+
expect(html).toContain("GitHub");
|
|
26
|
+
expect(html).toContain("connected");
|
|
27
|
+
expect(html).toContain("list_repos");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("falls back to raw JSON for non-manager values", () => {
|
|
31
|
+
const html = renderToStaticMarkup(<McpView value={42} />);
|
|
32
|
+
expect(html).toContain("42");
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface McpToolPreview {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
readonly description?: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface McpServerPreview {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly kind?: string;
|
|
10
|
+
readonly url?: string;
|
|
11
|
+
readonly connectionState: string;
|
|
12
|
+
readonly lastError?: string;
|
|
13
|
+
readonly authorizationUrl?: string;
|
|
14
|
+
readonly tools: readonly McpToolPreview[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface McpManagerPreview {
|
|
18
|
+
readonly isHydrated?: boolean;
|
|
19
|
+
readonly servers: readonly McpServerPreview[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ToneBadge } from "../ui";
|
|
2
|
+
import { partKey } from "./parse";
|
|
3
|
+
import { PartView } from "./PartView";
|
|
4
|
+
import { StatusBadge } from "./StatusBadge";
|
|
5
|
+
import type { PartPreview, PartStatusPreview } from "./types";
|
|
6
|
+
|
|
7
|
+
const rollupStatus = (
|
|
8
|
+
parts: readonly PartPreview[],
|
|
9
|
+
): PartStatusPreview | undefined => {
|
|
10
|
+
const statuses = parts
|
|
11
|
+
.map((part) => part.status)
|
|
12
|
+
.filter((status): status is PartStatusPreview => Boolean(status));
|
|
13
|
+
if (statuses.length === 0) return undefined;
|
|
14
|
+
|
|
15
|
+
if (statuses.some((status) => status.type === "running")) {
|
|
16
|
+
return { type: "running" };
|
|
17
|
+
}
|
|
18
|
+
if (statuses.some((status) => status.type === "requires-action")) {
|
|
19
|
+
return { type: "requires-action" };
|
|
20
|
+
}
|
|
21
|
+
const incomplete = statuses.find((status) => status.type === "incomplete");
|
|
22
|
+
if (incomplete) return incomplete;
|
|
23
|
+
return { type: "complete" };
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const hasAwaitingTool = (parts: readonly PartPreview[]) =>
|
|
27
|
+
parts.some(
|
|
28
|
+
(part) =>
|
|
29
|
+
part.type === "tool-call" &&
|
|
30
|
+
(part.status?.type === "requires-action" ||
|
|
31
|
+
(part.approval !== undefined && part.approval.approved === undefined) ||
|
|
32
|
+
part.interrupt !== undefined),
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export const ChainOfThought = ({
|
|
36
|
+
parts,
|
|
37
|
+
}: {
|
|
38
|
+
parts: readonly PartPreview[];
|
|
39
|
+
}) => {
|
|
40
|
+
const status = rollupStatus(parts);
|
|
41
|
+
const defaultOpen = hasAwaitingTool(parts);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<details
|
|
45
|
+
open={defaultOpen}
|
|
46
|
+
className="group border-border overflow-hidden rounded-md border"
|
|
47
|
+
>
|
|
48
|
+
<summary className="hover:bg-accent/40 flex cursor-pointer list-none items-center gap-1.5 px-2 py-1.5 select-none">
|
|
49
|
+
<span className="text-muted-foreground inline-block shrink-0 transition-transform group-open:rotate-90">
|
|
50
|
+
›
|
|
51
|
+
</span>
|
|
52
|
+
<ToneBadge tone="violet" size="sm">
|
|
53
|
+
cot
|
|
54
|
+
</ToneBadge>
|
|
55
|
+
<span className="text-muted-foreground text-[10px]">
|
|
56
|
+
{parts.length} step{parts.length === 1 ? "" : "s"}
|
|
57
|
+
</span>
|
|
58
|
+
{status ? (
|
|
59
|
+
<StatusBadge
|
|
60
|
+
type={status.type}
|
|
61
|
+
reason={status.reason}
|
|
62
|
+
compact
|
|
63
|
+
size="sm"
|
|
64
|
+
/>
|
|
65
|
+
) : null}
|
|
66
|
+
</summary>
|
|
67
|
+
<div className="border-border divide-border divide-y border-t">
|
|
68
|
+
{parts.map((part, index) => (
|
|
69
|
+
<PartView key={partKey(part, index)} part={part} compact />
|
|
70
|
+
))}
|
|
71
|
+
</div>
|
|
72
|
+
</details>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CopyButton, PaneHeader, RailTime } from "../ui";
|
|
2
|
+
import { MessageItem } from "./MessageItem";
|
|
3
|
+
import { messagePlainText } from "./messagePlainText";
|
|
4
|
+
import type { MessagePreview } from "./types";
|
|
5
|
+
|
|
6
|
+
export const messageDetailHeader = (message: MessagePreview) => (
|
|
7
|
+
<PaneHeader
|
|
8
|
+
trailing={
|
|
9
|
+
<>
|
|
10
|
+
<CopyButton
|
|
11
|
+
value={messagePlainText(message)}
|
|
12
|
+
label="Copy message"
|
|
13
|
+
iconOnly
|
|
14
|
+
size="sm"
|
|
15
|
+
/>
|
|
16
|
+
<RailTime value={message.createdAt} />
|
|
17
|
+
</>
|
|
18
|
+
}
|
|
19
|
+
>
|
|
20
|
+
<span className="text-foreground capitalize">{message.role}</span>
|
|
21
|
+
</PaneHeader>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export const MessageDetailBody = ({ message }: { message: MessagePreview }) => (
|
|
25
|
+
<MessageItem message={message} showHeader={false} />
|
|
26
|
+
);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import { formatDateTime } from "../../utils/common";
|
|
3
|
+
import { AttachmentList } from "../attachments";
|
|
4
|
+
import { MessageMetrics } from "./MessageMetrics";
|
|
5
|
+
import { MessageTimeline } from "./MessageTimeline";
|
|
6
|
+
import { RoleLabel } from "./RoleLabel";
|
|
7
|
+
import { StatusBadge } from "./StatusBadge";
|
|
8
|
+
import { Chip, JSONTree, ToneBadge } from "../ui";
|
|
9
|
+
import type { MessagePreview } from "./types";
|
|
10
|
+
|
|
11
|
+
export const MessageItem = ({
|
|
12
|
+
message,
|
|
13
|
+
showHeader = true,
|
|
14
|
+
}: {
|
|
15
|
+
message: MessagePreview;
|
|
16
|
+
/** When false, skips the summary header (role, badges, timestamp). */
|
|
17
|
+
showHeader?: boolean;
|
|
18
|
+
}) => {
|
|
19
|
+
const hasBranches =
|
|
20
|
+
message.branchNumber !== undefined &&
|
|
21
|
+
message.branchCount !== undefined &&
|
|
22
|
+
message.branchCount > 1;
|
|
23
|
+
const errorValue =
|
|
24
|
+
message.status && message.status.type === "incomplete"
|
|
25
|
+
? message.status.error
|
|
26
|
+
: undefined;
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
className={clsx(
|
|
31
|
+
"flex flex-col px-3",
|
|
32
|
+
showHeader ? "gap-3 py-3" : "gap-2 py-2",
|
|
33
|
+
)}
|
|
34
|
+
>
|
|
35
|
+
{showHeader ? (
|
|
36
|
+
<div className="flex flex-wrap items-center justify-between gap-2">
|
|
37
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
38
|
+
<RoleLabel role={message.role} />
|
|
39
|
+
{message.index !== undefined ? (
|
|
40
|
+
<span className="text-muted-foreground text-[11px]">
|
|
41
|
+
#{message.index}
|
|
42
|
+
</span>
|
|
43
|
+
) : null}
|
|
44
|
+
{message.status ? (
|
|
45
|
+
<StatusBadge
|
|
46
|
+
type={message.status.type}
|
|
47
|
+
reason={message.status.reason}
|
|
48
|
+
/>
|
|
49
|
+
) : null}
|
|
50
|
+
{hasBranches ? (
|
|
51
|
+
<Chip>
|
|
52
|
+
branch {message.branchNumber}/{message.branchCount}
|
|
53
|
+
</Chip>
|
|
54
|
+
) : null}
|
|
55
|
+
{message.isOptimistic ? (
|
|
56
|
+
<ToneBadge tone="amber">optimistic</ToneBadge>
|
|
57
|
+
) : null}
|
|
58
|
+
{message.submittedFeedback ? (
|
|
59
|
+
<span className="text-muted-foreground text-[11px]">
|
|
60
|
+
feedback: {message.submittedFeedback}
|
|
61
|
+
</span>
|
|
62
|
+
) : null}
|
|
63
|
+
</div>
|
|
64
|
+
<span className="text-muted-foreground text-[11px]">
|
|
65
|
+
{formatDateTime(message.createdAt) ?? "—"}
|
|
66
|
+
</span>
|
|
67
|
+
</div>
|
|
68
|
+
) : null}
|
|
69
|
+
|
|
70
|
+
<MessageMetrics message={message} />
|
|
71
|
+
|
|
72
|
+
{errorValue !== undefined ? (
|
|
73
|
+
<div className="bg-muted/40 rounded-md border p-2 text-[11px]">
|
|
74
|
+
<ToneBadge tone="red">error</ToneBadge>
|
|
75
|
+
<div className="mt-1">
|
|
76
|
+
<JSONTree value={errorValue} />
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
) : null}
|
|
80
|
+
|
|
81
|
+
{message.attachments.length ? (
|
|
82
|
+
<AttachmentList attachments={message.attachments} />
|
|
83
|
+
) : null}
|
|
84
|
+
|
|
85
|
+
{message.parts.length ? (
|
|
86
|
+
<MessageTimeline parts={message.parts} />
|
|
87
|
+
) : (
|
|
88
|
+
<div className="text-muted-foreground text-[11px]">
|
|
89
|
+
No content parts
|
|
90
|
+
</div>
|
|
91
|
+
)}
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { InfoCard } from "../ui";
|
|
3
|
+
import { MessageItem } from "./MessageItem";
|
|
4
|
+
import type { MessagePreview } from "./types";
|
|
5
|
+
|
|
6
|
+
const DEFAULT_LIMIT = 20;
|
|
7
|
+
|
|
8
|
+
export const MessageList = ({
|
|
9
|
+
messages,
|
|
10
|
+
title = "Messages",
|
|
11
|
+
}: {
|
|
12
|
+
messages: readonly MessagePreview[];
|
|
13
|
+
title?: string;
|
|
14
|
+
}) => {
|
|
15
|
+
const [showAll, setShowAll] = useState(false);
|
|
16
|
+
|
|
17
|
+
if (!messages.length) {
|
|
18
|
+
return (
|
|
19
|
+
<InfoCard title={title}>
|
|
20
|
+
<p className="text-muted-foreground text-[12px]">
|
|
21
|
+
No messages in this thread.
|
|
22
|
+
</p>
|
|
23
|
+
</InfoCard>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const hidden = showAll ? 0 : Math.max(0, messages.length - DEFAULT_LIMIT);
|
|
28
|
+
const visible = hidden > 0 ? messages.slice(-DEFAULT_LIMIT) : messages;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<InfoCard title={title} count={messages.length}>
|
|
32
|
+
{hidden > 0 ? (
|
|
33
|
+
<button
|
|
34
|
+
type="button"
|
|
35
|
+
onClick={() => setShowAll(true)}
|
|
36
|
+
className="text-muted-foreground hover:text-foreground self-start text-[11px] font-medium transition-colors"
|
|
37
|
+
>
|
|
38
|
+
Show {hidden} older message{hidden === 1 ? "" : "s"}
|
|
39
|
+
</button>
|
|
40
|
+
) : null}
|
|
41
|
+
<div className="divide-border divide-y">
|
|
42
|
+
{visible.map((message) => (
|
|
43
|
+
<MessageItem key={message.id} message={message} />
|
|
44
|
+
))}
|
|
45
|
+
</div>
|
|
46
|
+
</InfoCard>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { formatMs } from "../../utils/common";
|
|
2
|
+
import type { MessagePreview } from "./types";
|
|
3
|
+
import { TtftBar } from "./TtftBar";
|
|
4
|
+
|
|
5
|
+
const canRenderBar = (timing: MessagePreview["timing"]) =>
|
|
6
|
+
Boolean(
|
|
7
|
+
timing &&
|
|
8
|
+
timing.streamStartTime !== undefined &&
|
|
9
|
+
timing.firstTokenTime !== undefined &&
|
|
10
|
+
timing.totalStreamTime !== undefined,
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
const inlineStats = (message: MessagePreview): string[] => {
|
|
14
|
+
const { timing, usage } = message;
|
|
15
|
+
const stats: string[] = [];
|
|
16
|
+
|
|
17
|
+
if (timing && !canRenderBar(timing)) {
|
|
18
|
+
const ttft =
|
|
19
|
+
timing.firstTokenTime !== undefined &&
|
|
20
|
+
timing.streamStartTime !== undefined
|
|
21
|
+
? Math.max(0, timing.firstTokenTime - timing.streamStartTime)
|
|
22
|
+
: undefined;
|
|
23
|
+
if (ttft !== undefined) stats.push(`TTFT ${formatMs(ttft)}`);
|
|
24
|
+
if (timing.totalStreamTime !== undefined) {
|
|
25
|
+
stats.push(`${formatMs(timing.totalStreamTime)} stream`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (timing?.tokensPerSecond !== undefined) {
|
|
30
|
+
stats.push(`${timing.tokensPerSecond.toFixed(1)} tok/s`);
|
|
31
|
+
}
|
|
32
|
+
if (timing?.tokenCount !== undefined) {
|
|
33
|
+
stats.push(`${timing.tokenCount} tok`);
|
|
34
|
+
}
|
|
35
|
+
if (timing?.totalChunks !== undefined) {
|
|
36
|
+
stats.push(`${timing.totalChunks} chunks`);
|
|
37
|
+
}
|
|
38
|
+
if (timing?.toolCallCount !== undefined) {
|
|
39
|
+
const count = timing.toolCallCount;
|
|
40
|
+
stats.push(`${count} tool${count === 1 ? "" : "s"}`);
|
|
41
|
+
}
|
|
42
|
+
if (usage) {
|
|
43
|
+
stats.push(`${usage.inputTokens}/${usage.outputTokens} in/out`);
|
|
44
|
+
const steps = usage.stepCount;
|
|
45
|
+
stats.push(`${steps} step${steps === 1 ? "" : "s"}`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return stats;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const MessageMetrics = ({ message }: { message: MessagePreview }) => {
|
|
52
|
+
const { timing } = message;
|
|
53
|
+
const stats = inlineStats(message);
|
|
54
|
+
const bar = timing && canRenderBar(timing);
|
|
55
|
+
|
|
56
|
+
if (!bar && stats.length === 0) return null;
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div className="flex flex-col gap-1">
|
|
60
|
+
{bar ? <TtftBar timing={timing} /> : null}
|
|
61
|
+
{stats.length ? (
|
|
62
|
+
<p className="text-muted-foreground text-[10px] leading-tight tabular-nums">
|
|
63
|
+
{stats.join(" · ")}
|
|
64
|
+
</p>
|
|
65
|
+
) : null}
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import {
|
|
4
|
+
MessageTimeline,
|
|
5
|
+
messageStepCount,
|
|
6
|
+
messageToolCount,
|
|
7
|
+
} from "./MessageTimeline";
|
|
8
|
+
import type { PartPreview } from "./types";
|
|
9
|
+
|
|
10
|
+
const part = (over: PartPreview): PartPreview => over;
|
|
11
|
+
|
|
12
|
+
describe("MessageTimeline", () => {
|
|
13
|
+
it("renders interleaved tool/text parts in order", () => {
|
|
14
|
+
const parts: PartPreview[] = [
|
|
15
|
+
part({
|
|
16
|
+
type: "tool-call",
|
|
17
|
+
toolCallId: "c1",
|
|
18
|
+
toolName: "search",
|
|
19
|
+
args: { q: "a" },
|
|
20
|
+
}),
|
|
21
|
+
part({ type: "text", text: "First chunk." }),
|
|
22
|
+
part({
|
|
23
|
+
type: "tool-call",
|
|
24
|
+
toolCallId: "c2",
|
|
25
|
+
toolName: "lookup",
|
|
26
|
+
args: { id: "b" },
|
|
27
|
+
}),
|
|
28
|
+
part({ type: "text", text: "Final reply." }),
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const html = renderToStaticMarkup(<MessageTimeline parts={parts} />);
|
|
32
|
+
expect(html.indexOf("search")).toBeLessThan(html.indexOf("First chunk."));
|
|
33
|
+
expect(html.indexOf("First chunk.")).toBeLessThan(html.indexOf("lookup"));
|
|
34
|
+
expect(html.indexOf("lookup")).toBeLessThan(html.indexOf("Final reply."));
|
|
35
|
+
expect(html).not.toMatch(/>answer</);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("groups reasoning+tool prefix as chain of thought before body", () => {
|
|
39
|
+
const parts: PartPreview[] = [
|
|
40
|
+
part({ type: "reasoning", text: "thinking…" }),
|
|
41
|
+
part({
|
|
42
|
+
type: "tool-call",
|
|
43
|
+
toolCallId: "c1",
|
|
44
|
+
toolName: "getWeather",
|
|
45
|
+
args: {},
|
|
46
|
+
}),
|
|
47
|
+
part({ type: "text", text: "It is sunny." }),
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
const html = renderToStaticMarkup(<MessageTimeline parts={parts} />);
|
|
51
|
+
expect(html).toContain("cot");
|
|
52
|
+
expect(html).toContain("getWeather");
|
|
53
|
+
expect(html).toContain("It is sunny.");
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
describe("messageStepCount", () => {
|
|
58
|
+
it("counts tools and text parts", () => {
|
|
59
|
+
const parts: PartPreview[] = [
|
|
60
|
+
part({
|
|
61
|
+
type: "tool-call",
|
|
62
|
+
toolCallId: "c1",
|
|
63
|
+
toolName: "a",
|
|
64
|
+
args: {},
|
|
65
|
+
}),
|
|
66
|
+
part({ type: "text", text: "one" }),
|
|
67
|
+
part({
|
|
68
|
+
type: "tool-call",
|
|
69
|
+
toolCallId: "c2",
|
|
70
|
+
toolName: "b",
|
|
71
|
+
args: {},
|
|
72
|
+
}),
|
|
73
|
+
part({ type: "text", text: "two" }),
|
|
74
|
+
];
|
|
75
|
+
expect(messageStepCount(parts)).toEqual({ tools: 2, texts: 2 });
|
|
76
|
+
expect(messageToolCount(parts)).toBe(2);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { ChainOfThought } from "./ChainOfThought";
|
|
3
|
+
import { partKey } from "./parse";
|
|
4
|
+
import { PartView } from "./PartView";
|
|
5
|
+
import type { PartPreview } from "./types";
|
|
6
|
+
|
|
7
|
+
const isThoughtPart = (part: PartPreview) =>
|
|
8
|
+
part.type === "reasoning" || part.type === "tool-call";
|
|
9
|
+
|
|
10
|
+
export const MessageTimeline = ({
|
|
11
|
+
parts,
|
|
12
|
+
}: {
|
|
13
|
+
parts: readonly PartPreview[];
|
|
14
|
+
}) => {
|
|
15
|
+
const { prefix, body, useCotPrefix } = useMemo(() => {
|
|
16
|
+
const firstTextIdx = parts.findIndex((part) => part.type === "text");
|
|
17
|
+
const prefix = firstTextIdx > 0 ? parts.slice(0, firstTextIdx) : [];
|
|
18
|
+
const body = firstTextIdx >= 0 ? parts.slice(firstTextIdx) : parts;
|
|
19
|
+
const useCotPrefix =
|
|
20
|
+
prefix.length >= 2 &&
|
|
21
|
+
prefix.every(isThoughtPart) &&
|
|
22
|
+
prefix.some((part) => part.type === "reasoning");
|
|
23
|
+
|
|
24
|
+
return { prefix, body, useCotPrefix };
|
|
25
|
+
}, [parts]);
|
|
26
|
+
|
|
27
|
+
if (!parts.length) return null;
|
|
28
|
+
|
|
29
|
+
const items = useCotPrefix ? body : parts;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div className="flex flex-col gap-1">
|
|
33
|
+
{useCotPrefix ? <ChainOfThought parts={prefix} /> : null}
|
|
34
|
+
{items.map((part, index) => {
|
|
35
|
+
const globalIndex = useCotPrefix ? prefix.length + index : index;
|
|
36
|
+
return (
|
|
37
|
+
<PartView key={partKey(part, globalIndex)} part={part} compact />
|
|
38
|
+
);
|
|
39
|
+
})}
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const messageToolCount = (parts: readonly PartPreview[]) =>
|
|
45
|
+
parts.filter((part) => part.type === "tool-call").length;
|
|
46
|
+
|
|
47
|
+
export const messageStepCount = (parts: readonly PartPreview[]) => {
|
|
48
|
+
const tools = messageToolCount(parts);
|
|
49
|
+
const texts = parts.filter((part) => part.type === "text").length;
|
|
50
|
+
return { tools, texts };
|
|
51
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
/** Label-only row; put payload in children. */
|
|
4
|
+
export const PartDisclosure = ({
|
|
5
|
+
label,
|
|
6
|
+
defaultOpen = false,
|
|
7
|
+
trailing,
|
|
8
|
+
children,
|
|
9
|
+
}: {
|
|
10
|
+
label: string;
|
|
11
|
+
defaultOpen?: boolean;
|
|
12
|
+
trailing?: ReactNode;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}) => (
|
|
15
|
+
<details open={defaultOpen} className="group">
|
|
16
|
+
<summary className="text-muted-foreground hover:text-foreground flex cursor-pointer list-none items-center gap-1 py-0.5 text-[10px] font-medium select-none">
|
|
17
|
+
<span className="inline-block shrink-0 transition-transform group-open:rotate-90">
|
|
18
|
+
›
|
|
19
|
+
</span>
|
|
20
|
+
<span className="min-w-0 flex-1">{label}</span>
|
|
21
|
+
{trailing ? (
|
|
22
|
+
<span
|
|
23
|
+
className="flex shrink-0 items-center gap-px"
|
|
24
|
+
onClick={(event) => event.stopPropagation()}
|
|
25
|
+
>
|
|
26
|
+
{trailing}
|
|
27
|
+
</span>
|
|
28
|
+
) : null}
|
|
29
|
+
</summary>
|
|
30
|
+
<div className="min-w-0 ps-3 pb-0.5">{children}</div>
|
|
31
|
+
</details>
|
|
32
|
+
);
|