@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,152 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import type { EventLogEntry } from "../../data/types";
|
|
3
|
+
import { groupRuns } from "./parse";
|
|
4
|
+
|
|
5
|
+
const base = 2_000_000_000_000;
|
|
6
|
+
const t = (ms: number) => new Date(base + ms);
|
|
7
|
+
|
|
8
|
+
describe("groupRuns", () => {
|
|
9
|
+
it("pairs runStart/runEnd and computes durations and offsets", () => {
|
|
10
|
+
const logs: EventLogEntry[] = [
|
|
11
|
+
{ time: t(0), event: "thread.runStart", data: { threadId: "T1" } },
|
|
12
|
+
{
|
|
13
|
+
time: t(150),
|
|
14
|
+
event: "composer.send",
|
|
15
|
+
data: { threadId: "T1", messageId: "m1" },
|
|
16
|
+
},
|
|
17
|
+
{ time: t(900), event: "thread.runEnd", data: { threadId: "T1" } },
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
const { runs, orphans } = groupRuns(logs);
|
|
21
|
+
expect(orphans).toEqual([]);
|
|
22
|
+
expect(runs).toHaveLength(1);
|
|
23
|
+
const run = runs[0]!;
|
|
24
|
+
expect(run.index).toBe(0);
|
|
25
|
+
expect(run.threadId).toBe("T1");
|
|
26
|
+
expect(run.endTime).toBeDefined();
|
|
27
|
+
expect(run.durationMs).toBe(900);
|
|
28
|
+
expect(run.spanMs).toBe(900);
|
|
29
|
+
expect(run.events.map((e) => e.offsetMs)).toEqual([0, 150, 900]);
|
|
30
|
+
expect(run.events.map((e) => e.scope)).toEqual([
|
|
31
|
+
"thread",
|
|
32
|
+
"composer",
|
|
33
|
+
"thread",
|
|
34
|
+
]);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("marks a run with no runEnd as running, with span from last event", () => {
|
|
38
|
+
const logs: EventLogEntry[] = [
|
|
39
|
+
{ time: t(0), event: "thread.runStart", data: { threadId: "T1" } },
|
|
40
|
+
{ time: t(100), event: "composer.send", data: { threadId: "T1" } },
|
|
41
|
+
];
|
|
42
|
+
const { runs } = groupRuns(logs);
|
|
43
|
+
expect(runs[0]!.endTime).toBeUndefined();
|
|
44
|
+
expect(runs[0]!.durationMs).toBeUndefined();
|
|
45
|
+
expect(runs[0]!.spanMs).toBe(100);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("buckets events outside any run as orphans", () => {
|
|
49
|
+
const logs: EventLogEntry[] = [
|
|
50
|
+
{
|
|
51
|
+
time: t(0),
|
|
52
|
+
event: "thread.modelContextUpdate",
|
|
53
|
+
data: { threadId: "T1" },
|
|
54
|
+
},
|
|
55
|
+
{ time: t(50), event: "thread.runStart", data: { threadId: "T1" } },
|
|
56
|
+
{ time: t(200), event: "thread.runEnd", data: { threadId: "T1" } },
|
|
57
|
+
];
|
|
58
|
+
const { runs, orphans } = groupRuns(logs);
|
|
59
|
+
expect(runs).toHaveLength(1);
|
|
60
|
+
expect(orphans).toHaveLength(1);
|
|
61
|
+
expect(orphans[0]!.event).toBe("thread.modelContextUpdate");
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("sorts out-of-order logs before pairing", () => {
|
|
65
|
+
const logs: EventLogEntry[] = [
|
|
66
|
+
{ time: t(100), event: "thread.runEnd", data: { threadId: "T1" } },
|
|
67
|
+
{ time: t(0), event: "thread.runStart", data: { threadId: "T1" } },
|
|
68
|
+
];
|
|
69
|
+
const { runs, orphans } = groupRuns(logs);
|
|
70
|
+
expect(orphans).toEqual([]);
|
|
71
|
+
expect(runs).toHaveLength(1);
|
|
72
|
+
expect(runs[0]!.durationMs).toBe(100);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("routes events to the matching thread when runs interleave", () => {
|
|
76
|
+
const logs: EventLogEntry[] = [
|
|
77
|
+
{ time: t(0), event: "thread.runStart", data: { threadId: "T1" } },
|
|
78
|
+
{ time: t(50), event: "thread.runStart", data: { threadId: "T2" } },
|
|
79
|
+
{ time: t(60), event: "composer.send", data: { threadId: "T2" } },
|
|
80
|
+
{ time: t(100), event: "thread.runEnd", data: { threadId: "T2" } },
|
|
81
|
+
{ time: t(200), event: "thread.runEnd", data: { threadId: "T1" } },
|
|
82
|
+
];
|
|
83
|
+
const { runs } = groupRuns(logs);
|
|
84
|
+
expect(runs).toHaveLength(2);
|
|
85
|
+
const t2 = runs.find((r) => r.threadId === "T2")!;
|
|
86
|
+
expect(t2.events.map((e) => e.event)).toEqual([
|
|
87
|
+
"thread.runStart",
|
|
88
|
+
"composer.send",
|
|
89
|
+
"thread.runEnd",
|
|
90
|
+
]);
|
|
91
|
+
expect(runs.find((r) => r.threadId === "T1")!.durationMs).toBe(200);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it("closes a prior open run on the same thread when a new run starts", () => {
|
|
95
|
+
const logs: EventLogEntry[] = [
|
|
96
|
+
{ time: t(0), event: "thread.runStart", data: { threadId: "T1" } },
|
|
97
|
+
{ time: t(50), event: "thread.runStart", data: { threadId: "T1" } },
|
|
98
|
+
{ time: t(100), event: "thread.runEnd", data: { threadId: "T1" } },
|
|
99
|
+
];
|
|
100
|
+
const { runs } = groupRuns(logs);
|
|
101
|
+
expect(runs).toHaveLength(2);
|
|
102
|
+
expect(runs[0]!.endTime).toBeDefined();
|
|
103
|
+
expect(runs[0]!.durationMs).toBe(50);
|
|
104
|
+
expect(runs[1]!.endTime).toBeDefined();
|
|
105
|
+
expect(runs[1]!.durationMs).toBe(50);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it("orphans an event whose explicit threadId matches no open run", () => {
|
|
109
|
+
const logs: EventLogEntry[] = [
|
|
110
|
+
{ time: t(0), event: "thread.runStart", data: { threadId: "T1" } },
|
|
111
|
+
{ time: t(50), event: "composer.send", data: { threadId: "T2" } },
|
|
112
|
+
{ time: t(100), event: "thread.runEnd", data: { threadId: "T1" } },
|
|
113
|
+
];
|
|
114
|
+
const { runs, orphans } = groupRuns(logs);
|
|
115
|
+
expect(runs).toHaveLength(1);
|
|
116
|
+
expect(runs[0]!.events.map((e) => e.event)).toEqual([
|
|
117
|
+
"thread.runStart",
|
|
118
|
+
"thread.runEnd",
|
|
119
|
+
]);
|
|
120
|
+
expect(orphans.map((o) => o.event)).toEqual(["composer.send"]);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it("attaches a thread-less event to the single open run", () => {
|
|
124
|
+
const logs: EventLogEntry[] = [
|
|
125
|
+
{ time: t(0), event: "thread.runStart", data: { threadId: "T1" } },
|
|
126
|
+
{ time: t(50), event: "custom.event", data: {} },
|
|
127
|
+
{ time: t(100), event: "thread.runEnd", data: { threadId: "T1" } },
|
|
128
|
+
];
|
|
129
|
+
const { runs, orphans } = groupRuns(logs);
|
|
130
|
+
expect(orphans).toEqual([]);
|
|
131
|
+
expect(runs[0]!.events.map((e) => e.event)).toContain("custom.event");
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it("keeps an empty-string threadId distinct from a thread-less run", () => {
|
|
135
|
+
const logs: EventLogEntry[] = [
|
|
136
|
+
{ time: t(0), event: "thread.runStart", data: { threadId: "" } },
|
|
137
|
+
{ time: t(50), event: "thread.runStart", data: {} },
|
|
138
|
+
{ time: t(100), event: "thread.runEnd", data: { threadId: "" } },
|
|
139
|
+
];
|
|
140
|
+
const { runs } = groupRuns(logs);
|
|
141
|
+
expect(runs).toHaveLength(2);
|
|
142
|
+
expect(runs[0]!.threadId).toBe("");
|
|
143
|
+
expect(runs[0]!.endTime).toBeDefined();
|
|
144
|
+
expect(runs[0]!.durationMs).toBe(100);
|
|
145
|
+
expect(runs[1]!.threadId).toBeUndefined();
|
|
146
|
+
expect(runs[1]!.endTime).toBeUndefined();
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it("returns nothing for an empty log", () => {
|
|
150
|
+
expect(groupRuns([])).toEqual({ runs: [], orphans: [] });
|
|
151
|
+
});
|
|
152
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { eventScope, isRecord } from "../../utils/common";
|
|
2
|
+
import type { EventLogEntry } from "../../data/types";
|
|
3
|
+
import type { RunEventEntry, RunGrouping, RunPreview } from "./types";
|
|
4
|
+
|
|
5
|
+
// thread.runStart/runEnd are @deprecated in core but kept for backward
|
|
6
|
+
// compatibility; they are the only run-boundary signal in the event log.
|
|
7
|
+
const RUN_START = "thread.runStart";
|
|
8
|
+
const RUN_END = "thread.runEnd";
|
|
9
|
+
|
|
10
|
+
const threadIdOf = (data: unknown): string | undefined =>
|
|
11
|
+
isRecord(data) && typeof data.threadId === "string"
|
|
12
|
+
? data.threadId
|
|
13
|
+
: undefined;
|
|
14
|
+
|
|
15
|
+
interface RunBuilder {
|
|
16
|
+
id: string;
|
|
17
|
+
threadId?: string;
|
|
18
|
+
index: number;
|
|
19
|
+
startTime: Date;
|
|
20
|
+
endTime?: Date;
|
|
21
|
+
events: RunEventEntry[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const entryFor = (log: EventLogEntry, offsetMs: number): RunEventEntry => ({
|
|
25
|
+
time: log.time,
|
|
26
|
+
event: log.event,
|
|
27
|
+
scope: eventScope(log.event),
|
|
28
|
+
offsetMs: Math.max(0, offsetMs),
|
|
29
|
+
data: log.data,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const groupRuns = (logs: readonly EventLogEntry[]): RunGrouping => {
|
|
33
|
+
const sorted = [...logs].sort((a, b) => a.time.getTime() - b.time.getTime());
|
|
34
|
+
const builders: RunBuilder[] = [];
|
|
35
|
+
const openByThread = new Map<string | undefined, RunBuilder>();
|
|
36
|
+
const orphans: RunEventEntry[] = [];
|
|
37
|
+
|
|
38
|
+
const targetRun = (tid: string | undefined): RunBuilder | undefined => {
|
|
39
|
+
const exact = openByThread.get(tid);
|
|
40
|
+
if (exact) return exact;
|
|
41
|
+
if (tid === undefined && openByThread.size === 1) {
|
|
42
|
+
return [...openByThread.values()][0];
|
|
43
|
+
}
|
|
44
|
+
return undefined;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
for (const log of sorted) {
|
|
48
|
+
const tid = threadIdOf(log.data);
|
|
49
|
+
|
|
50
|
+
if (log.event === RUN_START) {
|
|
51
|
+
const stale = openByThread.get(tid);
|
|
52
|
+
if (stale) {
|
|
53
|
+
stale.endTime = log.time;
|
|
54
|
+
openByThread.delete(tid);
|
|
55
|
+
}
|
|
56
|
+
const builder: RunBuilder = {
|
|
57
|
+
id: `run-${builders.length}`,
|
|
58
|
+
...(tid !== undefined ? { threadId: tid } : {}),
|
|
59
|
+
index: builders.length,
|
|
60
|
+
startTime: log.time,
|
|
61
|
+
events: [entryFor(log, 0)],
|
|
62
|
+
};
|
|
63
|
+
builders.push(builder);
|
|
64
|
+
openByThread.set(tid, builder);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (log.event === RUN_END) {
|
|
69
|
+
const run = targetRun(tid);
|
|
70
|
+
if (run && run.endTime === undefined) {
|
|
71
|
+
run.endTime = log.time;
|
|
72
|
+
run.events.push(
|
|
73
|
+
entryFor(log, log.time.getTime() - run.startTime.getTime()),
|
|
74
|
+
);
|
|
75
|
+
openByThread.delete(run.threadId);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
orphans.push(entryFor(log, 0));
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const run = targetRun(tid);
|
|
83
|
+
if (run) {
|
|
84
|
+
run.events.push(
|
|
85
|
+
entryFor(log, log.time.getTime() - run.startTime.getTime()),
|
|
86
|
+
);
|
|
87
|
+
} else {
|
|
88
|
+
orphans.push(entryFor(log, 0));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const runs: RunPreview[] = builders.map((b) => {
|
|
93
|
+
const maxOffset = b.events.reduce((max, e) => Math.max(max, e.offsetMs), 0);
|
|
94
|
+
const durationMs = b.endTime
|
|
95
|
+
? b.endTime.getTime() - b.startTime.getTime()
|
|
96
|
+
: undefined;
|
|
97
|
+
return {
|
|
98
|
+
id: b.id,
|
|
99
|
+
...(b.threadId !== undefined ? { threadId: b.threadId } : {}),
|
|
100
|
+
index: b.index,
|
|
101
|
+
startTime: b.startTime,
|
|
102
|
+
...(b.endTime !== undefined ? { endTime: b.endTime } : {}),
|
|
103
|
+
...(durationMs !== undefined ? { durationMs } : {}),
|
|
104
|
+
spanMs: Math.max(durationMs ?? 0, maxOffset),
|
|
105
|
+
events: b.events,
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
return { runs, orphans };
|
|
110
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface RunEventEntry {
|
|
2
|
+
readonly time: Date;
|
|
3
|
+
readonly event: string;
|
|
4
|
+
readonly scope: string;
|
|
5
|
+
readonly offsetMs: number;
|
|
6
|
+
readonly data: unknown;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface RunPreview {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly threadId?: string;
|
|
12
|
+
readonly index: number;
|
|
13
|
+
readonly startTime: Date;
|
|
14
|
+
readonly endTime?: Date;
|
|
15
|
+
readonly durationMs?: number;
|
|
16
|
+
readonly spanMs: number;
|
|
17
|
+
readonly events: readonly RunEventEntry[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface RunGrouping {
|
|
21
|
+
readonly runs: readonly RunPreview[];
|
|
22
|
+
readonly orphans: readonly RunEventEntry[];
|
|
23
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { isRecord } from "../../utils/common";
|
|
2
|
+
import { Chip, EmptyState, SummaryItem, SummaryList, ToneBadge } from "../ui";
|
|
3
|
+
import { parseScopes } from "./parse";
|
|
4
|
+
import type { ScopePreview } from "./types";
|
|
5
|
+
|
|
6
|
+
const SourceBadge = ({ source }: { source: string | null }) => {
|
|
7
|
+
if (!source) return null;
|
|
8
|
+
if (source === "root") return <ToneBadge tone="emerald">root</ToneBadge>;
|
|
9
|
+
return <Chip>← {source}</Chip>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const ScopeNode = ({
|
|
13
|
+
scope,
|
|
14
|
+
scopes,
|
|
15
|
+
path,
|
|
16
|
+
}: {
|
|
17
|
+
scope: ScopePreview;
|
|
18
|
+
scopes: readonly ScopePreview[];
|
|
19
|
+
path: ReadonlySet<string>;
|
|
20
|
+
}) => {
|
|
21
|
+
const hasQuery = isRecord(scope.query) && Object.keys(scope.query).length > 0;
|
|
22
|
+
const children = path.has(scope.name)
|
|
23
|
+
? []
|
|
24
|
+
: scopes.filter((candidate) => candidate.source === scope.name);
|
|
25
|
+
const nextPath = new Set(path).add(scope.name);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div className="flex flex-col gap-1.5">
|
|
29
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
30
|
+
<span className="text-foreground text-[13px] font-medium">
|
|
31
|
+
{scope.name}
|
|
32
|
+
</span>
|
|
33
|
+
<SourceBadge source={scope.source} />
|
|
34
|
+
{hasQuery ? (
|
|
35
|
+
<span className="text-muted-foreground font-mono text-[11px]">
|
|
36
|
+
{JSON.stringify(scope.query)}
|
|
37
|
+
</span>
|
|
38
|
+
) : null}
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
{scope.methods.length ? (
|
|
42
|
+
<div className="flex flex-wrap gap-1.5">
|
|
43
|
+
{scope.methods.map((method) => (
|
|
44
|
+
<Chip key={method} className="font-mono">
|
|
45
|
+
{method}
|
|
46
|
+
</Chip>
|
|
47
|
+
))}
|
|
48
|
+
</div>
|
|
49
|
+
) : null}
|
|
50
|
+
|
|
51
|
+
{children.length ? (
|
|
52
|
+
<div className="border-border/60 ms-1 mt-1 flex flex-col gap-3 border-s ps-3">
|
|
53
|
+
{children.map((child) => (
|
|
54
|
+
<ScopeNode
|
|
55
|
+
key={child.name}
|
|
56
|
+
scope={child}
|
|
57
|
+
scopes={scopes}
|
|
58
|
+
path={nextPath}
|
|
59
|
+
/>
|
|
60
|
+
))}
|
|
61
|
+
</div>
|
|
62
|
+
) : null}
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const ScopesView = ({ scopes }: { scopes?: unknown }) => {
|
|
68
|
+
const list = parseScopes(scopes);
|
|
69
|
+
|
|
70
|
+
if (list.length === 0) {
|
|
71
|
+
return (
|
|
72
|
+
<EmptyState>
|
|
73
|
+
No scopes reported. Update `@assistant-ui/react-devtools` to forward the
|
|
74
|
+
scope graph.
|
|
75
|
+
</EmptyState>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const names = new Set(list.map((scope) => scope.name));
|
|
80
|
+
const roots = list.filter(
|
|
81
|
+
(scope) =>
|
|
82
|
+
scope.source === "root" ||
|
|
83
|
+
scope.source === null ||
|
|
84
|
+
!names.has(scope.source),
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<div className="flex flex-col gap-4">
|
|
89
|
+
<SummaryList>
|
|
90
|
+
<SummaryItem label="Scopes" value={String(list.length)} />
|
|
91
|
+
<SummaryItem label="Roots" value={String(roots.length)} />
|
|
92
|
+
</SummaryList>
|
|
93
|
+
<div className="flex flex-col gap-3">
|
|
94
|
+
{roots.map((scope) => (
|
|
95
|
+
<ScopeNode
|
|
96
|
+
key={scope.name}
|
|
97
|
+
scope={scope}
|
|
98
|
+
scopes={list}
|
|
99
|
+
path={new Set()}
|
|
100
|
+
/>
|
|
101
|
+
))}
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ScopesView } from "./ScopesView";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { parseScopes } from "./parse";
|
|
3
|
+
|
|
4
|
+
describe("parseScopes", () => {
|
|
5
|
+
it("parses scopes and sorts root first, then by name", () => {
|
|
6
|
+
const out = parseScopes([
|
|
7
|
+
{
|
|
8
|
+
name: "thread",
|
|
9
|
+
source: "threads",
|
|
10
|
+
query: { type: "main" },
|
|
11
|
+
methods: ["getState", "append"],
|
|
12
|
+
},
|
|
13
|
+
{ name: "threads", source: "root", query: {}, methods: ["getState"] },
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
expect(out.map((s) => s.name)).toEqual(["threads", "thread"]);
|
|
17
|
+
expect(out[0]!.source).toBe("root");
|
|
18
|
+
expect(out[1]!.query).toEqual({ type: "main" });
|
|
19
|
+
expect(out[1]!.methods).toEqual(["getState", "append"]);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("filters non-string methods and defaults a missing source to null", () => {
|
|
23
|
+
const out = parseScopes([{ name: "x", methods: ["a", 1, null, "b"] }]);
|
|
24
|
+
expect(out[0]!.methods).toEqual(["a", "b"]);
|
|
25
|
+
expect(out[0]!.source).toBeNull();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("drops entries without a name and returns [] for non-arrays", () => {
|
|
29
|
+
expect(parseScopes([{ source: "root" }, 5, null])).toEqual([]);
|
|
30
|
+
expect(parseScopes(undefined)).toEqual([]);
|
|
31
|
+
expect(parseScopes(null)).toEqual([]);
|
|
32
|
+
expect(parseScopes(42)).toEqual([]);
|
|
33
|
+
expect(parseScopes({})).toEqual([]);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { isRecord, isStringArray } from "../../utils/common";
|
|
2
|
+
import type { ScopePreview } from "./types";
|
|
3
|
+
|
|
4
|
+
const parseScope = (value: unknown): ScopePreview | null => {
|
|
5
|
+
if (!isRecord(value) || typeof value.name !== "string") return null;
|
|
6
|
+
|
|
7
|
+
const methods = isStringArray(value.methods);
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
name: value.name,
|
|
11
|
+
source: typeof value.source === "string" ? value.source : null,
|
|
12
|
+
query: value.query,
|
|
13
|
+
methods,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const parseScopes = (value: unknown): ScopePreview[] => {
|
|
18
|
+
if (!Array.isArray(value)) return [];
|
|
19
|
+
|
|
20
|
+
const scopes = value
|
|
21
|
+
.map((scope) => parseScope(scope))
|
|
22
|
+
.filter((scope): scope is ScopePreview => Boolean(scope));
|
|
23
|
+
|
|
24
|
+
// Root scopes first, then alphabetically by name. This is not a full
|
|
25
|
+
// hierarchy sort: a derived scope can sort before its parent.
|
|
26
|
+
return scopes.sort((a, b) => {
|
|
27
|
+
const rootDelta = Number(b.source === "root") - Number(a.source === "root");
|
|
28
|
+
return rootDelta !== 0 ? rootDelta : a.name.localeCompare(b.name);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { ScopesView } from "./ScopesView";
|
|
4
|
+
|
|
5
|
+
describe("ScopesView", () => {
|
|
6
|
+
it("renders scope names, source, query, and methods", () => {
|
|
7
|
+
const html = renderToStaticMarkup(
|
|
8
|
+
<ScopesView
|
|
9
|
+
scopes={[
|
|
10
|
+
{ name: "threads", source: "root", query: {}, methods: ["getState"] },
|
|
11
|
+
{
|
|
12
|
+
name: "composer",
|
|
13
|
+
source: "thread",
|
|
14
|
+
query: { type: "main" },
|
|
15
|
+
methods: ["send", "setText"],
|
|
16
|
+
},
|
|
17
|
+
]}
|
|
18
|
+
/>,
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
expect(html).toContain("threads");
|
|
22
|
+
expect(html).toContain("root");
|
|
23
|
+
expect(html).toContain("composer");
|
|
24
|
+
expect(html).toContain("send");
|
|
25
|
+
expect(html).toContain("setText");
|
|
26
|
+
// the query renders as escaped JSON ({"type":"main"})
|
|
27
|
+
expect(html).toContain("type");
|
|
28
|
+
expect(html).toContain("main");
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("shows an empty state when no scopes are reported", () => {
|
|
32
|
+
const html = renderToStaticMarkup(<ScopesView scopes={undefined} />);
|
|
33
|
+
expect(html).toContain("No scopes reported");
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { ComposerAttachments } from "./ComposerAttachments";
|
|
4
|
+
|
|
5
|
+
describe("ComposerAttachments", () => {
|
|
6
|
+
it("renders attachments with name, kind, and upload status", () => {
|
|
7
|
+
const html = renderToStaticMarkup(
|
|
8
|
+
<ComposerAttachments
|
|
9
|
+
attachments={[
|
|
10
|
+
{
|
|
11
|
+
id: "a1",
|
|
12
|
+
name: "photo.png",
|
|
13
|
+
kind: "image",
|
|
14
|
+
status: { type: "running", reason: "uploading", progress: 0.5 },
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: "a2",
|
|
18
|
+
name: "doc.pdf",
|
|
19
|
+
kind: "file",
|
|
20
|
+
status: { type: "complete" },
|
|
21
|
+
},
|
|
22
|
+
]}
|
|
23
|
+
/>,
|
|
24
|
+
);
|
|
25
|
+
expect(html).toContain("Composer attachments (2)");
|
|
26
|
+
expect(html).toContain("photo.png");
|
|
27
|
+
expect(html).toContain("uploading 50%");
|
|
28
|
+
expect(html).toContain("complete");
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("renders nothing when there are no attachments", () => {
|
|
32
|
+
expect(renderToStaticMarkup(<ComposerAttachments attachments={[]} />)).toBe(
|
|
33
|
+
"",
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AttachmentPreview } from "../attachments/types";
|
|
2
|
+
import { AttachmentList } from "../attachments";
|
|
3
|
+
|
|
4
|
+
export const ComposerAttachments = ({
|
|
5
|
+
attachments,
|
|
6
|
+
}: {
|
|
7
|
+
attachments: readonly AttachmentPreview[];
|
|
8
|
+
}) => <AttachmentList attachments={attachments} label="Composer attachments" />;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { ComposerFlags } from "./ComposerFlags";
|
|
4
|
+
|
|
5
|
+
describe("ComposerFlags", () => {
|
|
6
|
+
it("renders only the boolean flags that are present", () => {
|
|
7
|
+
const html = renderToStaticMarkup(
|
|
8
|
+
<ComposerFlags
|
|
9
|
+
composer={{
|
|
10
|
+
textLength: 0,
|
|
11
|
+
attachments: [],
|
|
12
|
+
queue: [],
|
|
13
|
+
isEditing: true,
|
|
14
|
+
canSend: false,
|
|
15
|
+
}}
|
|
16
|
+
/>,
|
|
17
|
+
);
|
|
18
|
+
expect(html).toContain("Edit: true");
|
|
19
|
+
expect(html).toContain("Can send: false");
|
|
20
|
+
expect(html).not.toContain("Can cancel");
|
|
21
|
+
expect(html).not.toContain("Empty");
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { formatBoolean } from "../../utils/common";
|
|
2
|
+
import type { ComposerPreview } from "./types";
|
|
3
|
+
|
|
4
|
+
export const ComposerFlags = ({ composer }: { composer: ComposerPreview }) => (
|
|
5
|
+
<div className="text-muted-foreground flex flex-wrap gap-2 text-[11px]">
|
|
6
|
+
{typeof composer.isEditing === "boolean" ? (
|
|
7
|
+
<span>Edit: {formatBoolean(composer.isEditing)}</span>
|
|
8
|
+
) : null}
|
|
9
|
+
{typeof composer.canCancel === "boolean" ? (
|
|
10
|
+
<span>Can cancel: {formatBoolean(composer.canCancel)}</span>
|
|
11
|
+
) : null}
|
|
12
|
+
{typeof composer.canSend === "boolean" ? (
|
|
13
|
+
<span>Can send: {formatBoolean(composer.canSend)}</span>
|
|
14
|
+
) : null}
|
|
15
|
+
{typeof composer.isEmpty === "boolean" ? (
|
|
16
|
+
<span>Empty: {formatBoolean(composer.isEmpty)}</span>
|
|
17
|
+
) : null}
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { ComposerQueue } from "./ComposerQueue";
|
|
4
|
+
|
|
5
|
+
describe("ComposerQueue", () => {
|
|
6
|
+
it("renders the queued prompts", () => {
|
|
7
|
+
const html = renderToStaticMarkup(
|
|
8
|
+
<ComposerQueue
|
|
9
|
+
queue={[{ id: "q1", prompt: "first" }, { prompt: "second" }]}
|
|
10
|
+
/>,
|
|
11
|
+
);
|
|
12
|
+
expect(html).toContain("Message queue (2)");
|
|
13
|
+
expect(html).toContain("first");
|
|
14
|
+
expect(html).toContain("second");
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("renders nothing when the queue is empty", () => {
|
|
18
|
+
expect(renderToStaticMarkup(<ComposerQueue queue={[]} />)).toBe("");
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SectionLabel } from "../ui";
|
|
2
|
+
import type { ComposerQueueItem } from "./types";
|
|
3
|
+
|
|
4
|
+
export const ComposerQueue = ({
|
|
5
|
+
queue,
|
|
6
|
+
}: {
|
|
7
|
+
queue: readonly ComposerQueueItem[];
|
|
8
|
+
}) => {
|
|
9
|
+
if (!queue.length) return null;
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div className="bg-card rounded-md border p-3">
|
|
13
|
+
<SectionLabel>Message queue ({queue.length})</SectionLabel>
|
|
14
|
+
<ol className="text-foreground mt-1 list-decimal space-y-0.5 pl-5 text-[11px]">
|
|
15
|
+
{queue.map((item, index) => (
|
|
16
|
+
<li
|
|
17
|
+
key={item.id ?? index}
|
|
18
|
+
className="wrap-break-word whitespace-pre-wrap"
|
|
19
|
+
>
|
|
20
|
+
{item.prompt || "(empty)"}
|
|
21
|
+
</li>
|
|
22
|
+
))}
|
|
23
|
+
</ol>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
};
|