@dungle-scrubs/admin-ui-soft 0.0.0-stage → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GUIDE.md +110 -0
- package/LICENSE +21 -0
- package/README.md +36 -2
- package/THIRD-PARTY-NOTICES.md +25 -0
- package/UPSTREAM-VENDORED-CHANGES.md +317 -0
- package/VENDORED-CHANGES.md +60 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/ai/compositions/agent-console/agent-console.d.ts +109 -0
- package/dist/ai/compositions/agent-console/agent-console.js +644 -0
- package/dist/ai/compositions/attention-feed/attention-feed.d.ts +127 -0
- package/dist/ai/compositions/attention-feed/attention-feed.js +626 -0
- package/dist/ai/compositions/conversation-browser/conversation-browser.d.ts +126 -0
- package/dist/ai/compositions/conversation-browser/conversation-browser.js +364 -0
- package/dist/ai/compositions/redaction-marker/redaction-marker.d.ts +42 -0
- package/dist/ai/compositions/redaction-marker/redaction-marker.js +202 -0
- package/dist/ai/compositions/run-inspector/json-view.js +164 -0
- package/dist/ai/compositions/run-inspector/run-inspector.d.ts +66 -0
- package/dist/ai/compositions/run-inspector/run-inspector.js +703 -0
- package/dist/ai/compositions/run-inspector/run-model.js +155 -0
- package/dist/ai/compositions/tool-approval/json-args.js +54 -0
- package/dist/ai/compositions/tool-approval/tool-approval.d.ts +57 -0
- package/dist/ai/compositions/tool-approval/tool-approval.js +331 -0
- package/dist/ai/compositions/tool-call-row/tool-call-row.js +74 -0
- package/dist/ai/compositions/transcript-viewer/to-thread-messages.js +65 -0
- package/dist/ai/compositions/transcript-viewer/transcript-viewer.d.ts +63 -0
- package/dist/ai/compositions/transcript-viewer/transcript-viewer.js +471 -0
- package/dist/ai/compositions/usage-meter/usage-format.js +107 -0
- package/dist/ai/compositions/usage-meter/usage-meter.d.ts +32 -0
- package/dist/ai/compositions/usage-meter/usage-meter.js +258 -0
- package/dist/ai/testing/mock-clock.d.ts +31 -0
- package/dist/ai/testing/mock-clock.js +66 -0
- package/dist/ai/testing/mock-reply.d.ts +70 -0
- package/dist/ai/testing/mock-reply.js +100 -0
- package/dist/ai/testing/mock-runtime.d.ts +86 -0
- package/dist/ai/testing/mock-runtime.js +384 -0
- package/dist/ai/types.d.ts +323 -0
- package/dist/ai.css +1088 -0
- package/dist/ai.d.ts +160 -0
- package/dist/ai.js +158 -0
- package/dist/components/assistant-ui/elements/activity-graph.d.ts +14 -0
- package/dist/components/assistant-ui/elements/activity-graph.js +69 -0
- package/dist/components/assistant-ui/elements/agent-card.d.ts +21 -0
- package/dist/components/assistant-ui/elements/agent-card.js +75 -0
- package/dist/components/assistant-ui/elements/agent-handoff.d.ts +13 -0
- package/dist/components/assistant-ui/elements/agent-handoff.js +47 -0
- package/dist/components/assistant-ui/elements/agent-plan.d.ts +16 -0
- package/dist/components/assistant-ui/elements/agent-plan.js +93 -0
- package/dist/components/assistant-ui/elements/agent-status.aui.d.ts +24 -0
- package/dist/components/assistant-ui/elements/agent-status.aui.js +161 -0
- package/dist/components/assistant-ui/elements/agent-status.d.ts +17 -0
- package/dist/components/assistant-ui/elements/agent-status.js +47 -0
- package/dist/components/assistant-ui/elements/approval-card.d.ts +31 -0
- package/dist/components/assistant-ui/elements/approval-card.js +99 -0
- package/dist/components/assistant-ui/elements/artifact-card.d.ts +12 -0
- package/dist/components/assistant-ui/elements/artifact-card.js +47 -0
- package/dist/components/assistant-ui/elements/assistant-modal.aui.d.ts +7 -0
- package/dist/components/assistant-ui/elements/assistant-modal.aui.js +276 -0
- package/dist/components/assistant-ui/elements/assistant-sidebar.aui.d.ts +7 -0
- package/dist/components/assistant-ui/elements/assistant-sidebar.aui.js +18 -0
- package/dist/components/assistant-ui/elements/attachment.aui.d.ts +9 -0
- package/dist/components/assistant-ui/elements/attachment.aui.js +143 -0
- package/dist/components/assistant-ui/elements/background-inbox.d.ts +18 -0
- package/dist/components/assistant-ui/elements/background-inbox.js +65 -0
- package/dist/components/assistant-ui/elements/canvas-split.d.ts +25 -0
- package/dist/components/assistant-ui/elements/canvas-split.js +106 -0
- package/dist/components/assistant-ui/elements/chart.d.ts +19 -0
- package/dist/components/assistant-ui/elements/chart.js +105 -0
- package/dist/components/assistant-ui/elements/chat-panel.d.ts +15 -0
- package/dist/components/assistant-ui/elements/chat-panel.js +82 -0
- package/dist/components/assistant-ui/elements/checkpoint-history.d.ts +17 -0
- package/dist/components/assistant-ui/elements/checkpoint-history.js +60 -0
- package/dist/components/assistant-ui/elements/code-diff.d.ts +18 -0
- package/dist/components/assistant-ui/elements/code-diff.js +89 -0
- package/dist/components/assistant-ui/elements/code-runner.d.ts +15 -0
- package/dist/components/assistant-ui/elements/code-runner.js +108 -0
- package/dist/components/assistant-ui/elements/command-palette.d.ts +20 -0
- package/dist/components/assistant-ui/elements/command-palette.js +129 -0
- package/dist/components/assistant-ui/elements/comparison-card.d.ts +18 -0
- package/dist/components/assistant-ui/elements/comparison-card.js +58 -0
- package/dist/components/assistant-ui/elements/composer-trigger-popover.aui.d.ts +51 -0
- package/dist/components/assistant-ui/elements/composer-trigger-popover.aui.js +104 -0
- package/dist/components/assistant-ui/elements/composer.d.ts +91 -0
- package/dist/components/assistant-ui/elements/composer.js +416 -0
- package/dist/components/assistant-ui/elements/computer-use.d.ts +19 -0
- package/dist/components/assistant-ui/elements/computer-use.js +84 -0
- package/dist/components/assistant-ui/elements/confidence-marker.d.ts +20 -0
- package/dist/components/assistant-ui/elements/confidence-marker.js +58 -0
- package/dist/components/assistant-ui/elements/connection-state.d.ts +13 -0
- package/dist/components/assistant-ui/elements/connection-state.js +59 -0
- package/dist/components/assistant-ui/elements/context-breakdown.d.ts +15 -0
- package/dist/components/assistant-ui/elements/context-breakdown.js +91 -0
- package/dist/components/assistant-ui/elements/context-display.aui.d.ts +25 -0
- package/dist/components/assistant-ui/elements/context-display.aui.js +26 -0
- package/dist/components/assistant-ui/elements/context-display.d.ts +43 -0
- package/dist/components/assistant-ui/elements/context-display.js +300 -0
- package/dist/components/assistant-ui/elements/conversation-map.aui.d.ts +9 -0
- package/dist/components/assistant-ui/elements/conversation-map.aui.js +177 -0
- package/dist/components/assistant-ui/elements/conversation-map.d.ts +19 -0
- package/dist/components/assistant-ui/elements/conversation-map.js +84 -0
- package/dist/components/assistant-ui/elements/conversation-search.d.ts +20 -0
- package/dist/components/assistant-ui/elements/conversation-search.js +75 -0
- package/dist/components/assistant-ui/elements/cost-meter.d.ts +19 -0
- package/dist/components/assistant-ui/elements/cost-meter.js +76 -0
- package/dist/components/assistant-ui/elements/data-table.d.ts +72 -0
- package/dist/components/assistant-ui/elements/data-table.js +368 -0
- package/dist/components/assistant-ui/elements/day-separator.d.ts +16 -0
- package/dist/components/assistant-ui/elements/day-separator.js +44 -0
- package/dist/components/assistant-ui/elements/diagram.d.ts +15 -0
- package/dist/components/assistant-ui/elements/diagram.js +65 -0
- package/dist/components/assistant-ui/elements/directive-text.aui.d.ts +11 -0
- package/dist/components/assistant-ui/elements/directive-text.aui.js +18 -0
- package/dist/components/assistant-ui/elements/directive-text.d.ts +32 -0
- package/dist/components/assistant-ui/elements/directive-text.js +35 -0
- package/dist/components/assistant-ui/elements/document-reference.d.ts +17 -0
- package/dist/components/assistant-ui/elements/document-reference.js +62 -0
- package/dist/components/assistant-ui/elements/draft-restore.d.ts +12 -0
- package/dist/components/assistant-ui/elements/draft-restore.js +43 -0
- package/dist/components/assistant-ui/elements/edit-message.d.ts +15 -0
- package/dist/components/assistant-ui/elements/edit-message.js +63 -0
- package/dist/components/assistant-ui/elements/elicitation-form.d.ts +23 -0
- package/dist/components/assistant-ui/elements/elicitation-form.js +112 -0
- package/dist/components/assistant-ui/elements/empty-state.d.ts +16 -0
- package/dist/components/assistant-ui/elements/empty-state.js +71 -0
- package/dist/components/assistant-ui/elements/error-state.d.ts +13 -0
- package/dist/components/assistant-ui/elements/error-state.js +52 -0
- package/dist/components/assistant-ui/elements/feedback-dialog.d.ts +15 -0
- package/dist/components/assistant-ui/elements/feedback-dialog.js +77 -0
- package/dist/components/assistant-ui/elements/file-tree.d.ts +20 -0
- package/dist/components/assistant-ui/elements/file-tree.js +74 -0
- package/dist/components/assistant-ui/elements/file.d.ts +52 -0
- package/dist/components/assistant-ui/elements/file.js +222 -0
- package/dist/components/assistant-ui/elements/flow-graph.d.ts +23 -0
- package/dist/components/assistant-ui/elements/flow-graph.js +72 -0
- package/dist/components/assistant-ui/elements/follow-up-suggestions.aui.d.ts +7 -0
- package/dist/components/assistant-ui/elements/follow-up-suggestions.aui.js +30 -0
- package/dist/components/assistant-ui/elements/generative-ui.d.ts +8 -0
- package/dist/components/assistant-ui/elements/generative-ui.js +27 -0
- package/dist/components/assistant-ui/elements/geo-map.d.ts +29 -0
- package/dist/components/assistant-ui/elements/geo-map.js +190 -0
- package/dist/components/assistant-ui/elements/guardrail-notice.d.ts +15 -0
- package/dist/components/assistant-ui/elements/guardrail-notice.js +59 -0
- package/dist/components/assistant-ui/elements/heat-graph.d.ts +9 -0
- package/dist/components/assistant-ui/elements/heat-graph.js +90 -0
- package/dist/components/assistant-ui/elements/image-gallery.d.ts +22 -0
- package/dist/components/assistant-ui/elements/image-gallery.js +192 -0
- package/dist/components/assistant-ui/elements/image-generation.d.ts +11 -0
- package/dist/components/assistant-ui/elements/image-generation.js +64 -0
- package/dist/components/assistant-ui/elements/image.d.ts +59 -0
- package/dist/components/assistant-ui/elements/image.js +416 -0
- package/dist/components/assistant-ui/elements/inline-citation.d.ts +23 -0
- package/dist/components/assistant-ui/elements/inline-citation.js +90 -0
- package/dist/components/assistant-ui/elements/job-progress.d.ts +25 -0
- package/dist/components/assistant-ui/elements/job-progress.js +102 -0
- package/dist/components/assistant-ui/elements/launcher-bubble.d.ts +15 -0
- package/dist/components/assistant-ui/elements/launcher-bubble.js +71 -0
- package/dist/components/assistant-ui/elements/link-preview.d.ts +17 -0
- package/dist/components/assistant-ui/elements/link-preview.js +77 -0
- package/dist/components/assistant-ui/elements/loading-state.d.ts +13 -0
- package/dist/components/assistant-ui/elements/loading-state.js +33 -0
- package/dist/components/assistant-ui/elements/logos.d.ts +10 -0
- package/dist/components/assistant-ui/elements/logos.js +63 -0
- package/dist/components/assistant-ui/elements/map-answer.d.ts +19 -0
- package/dist/components/assistant-ui/elements/map-answer.js +120 -0
- package/dist/components/assistant-ui/elements/markdown-text.d.ts +11 -0
- package/dist/components/assistant-ui/elements/markdown-text.js +152 -0
- package/dist/components/assistant-ui/elements/math-block.d.ts +25 -0
- package/dist/components/assistant-ui/elements/math-block.js +60 -0
- package/dist/components/assistant-ui/elements/mcp-config.aui.d.ts +28 -0
- package/dist/components/assistant-ui/elements/mcp-config.aui.js +380 -0
- package/dist/components/assistant-ui/elements/mcp-server-panel.d.ts +20 -0
- package/dist/components/assistant-ui/elements/mcp-server-panel.js +114 -0
- package/dist/components/assistant-ui/elements/media-player.d.ts +21 -0
- package/dist/components/assistant-ui/elements/media-player.js +302 -0
- package/dist/components/assistant-ui/elements/memory-chips.d.ts +16 -0
- package/dist/components/assistant-ui/elements/memory-chips.js +44 -0
- package/dist/components/assistant-ui/elements/mermaid-diagram.aui.d.ts +14 -0
- package/dist/components/assistant-ui/elements/mermaid-diagram.aui.js +43 -0
- package/dist/components/assistant-ui/elements/mermaid-diagram.d.ts +20 -0
- package/dist/components/assistant-ui/elements/mermaid-diagram.js +258 -0
- package/dist/components/assistant-ui/elements/message-actions.d.ts +17 -0
- package/dist/components/assistant-ui/elements/message-actions.js +57 -0
- package/dist/components/assistant-ui/elements/message-attachment.d.ts +18 -0
- package/dist/components/assistant-ui/elements/message-attachment.js +58 -0
- package/dist/components/assistant-ui/elements/message-branches.d.ts +12 -0
- package/dist/components/assistant-ui/elements/message-branches.js +55 -0
- package/dist/components/assistant-ui/elements/message-pair.d.ts +16 -0
- package/dist/components/assistant-ui/elements/message-pair.js +63 -0
- package/dist/components/assistant-ui/elements/message-queue.d.ts +15 -0
- package/dist/components/assistant-ui/elements/message-queue.js +70 -0
- package/dist/components/assistant-ui/elements/message-timing.aui.d.ts +30 -0
- package/dist/components/assistant-ui/elements/message-timing.aui.js +98 -0
- package/dist/components/assistant-ui/elements/message-timing.d.ts +14 -0
- package/dist/components/assistant-ui/elements/message-timing.js +26 -0
- package/dist/components/assistant-ui/elements/mobile-composer.d.ts +18 -0
- package/dist/components/assistant-ui/elements/mobile-composer.js +76 -0
- package/dist/components/assistant-ui/elements/model-picker.d.ts +19 -0
- package/dist/components/assistant-ui/elements/model-picker.js +68 -0
- package/dist/components/assistant-ui/elements/model-selector.aui.d.ts +23 -0
- package/dist/components/assistant-ui/elements/model-selector.aui.js +79 -0
- package/dist/components/assistant-ui/elements/model-selector.d.ts +130 -0
- package/dist/components/assistant-ui/elements/model-selector.js +399 -0
- package/dist/components/assistant-ui/elements/number-ticker.d.ts +10 -0
- package/dist/components/assistant-ui/elements/number-ticker.js +41 -0
- package/dist/components/assistant-ui/elements/onboarding.d.ts +17 -0
- package/dist/components/assistant-ui/elements/onboarding.js +69 -0
- package/dist/components/assistant-ui/elements/option-list.d.ts +39 -0
- package/dist/components/assistant-ui/elements/option-list.js +176 -0
- package/dist/components/assistant-ui/elements/permission-grant.d.ts +14 -0
- package/dist/components/assistant-ui/elements/permission-grant.js +84 -0
- package/dist/components/assistant-ui/elements/prompt-library.d.ts +20 -0
- package/dist/components/assistant-ui/elements/prompt-library.js +121 -0
- package/dist/components/assistant-ui/elements/question-flow.d.ts +24 -0
- package/dist/components/assistant-ui/elements/question-flow.js +180 -0
- package/dist/components/assistant-ui/elements/quota-banner.d.ts +14 -0
- package/dist/components/assistant-ui/elements/quota-banner.js +68 -0
- package/dist/components/assistant-ui/elements/quote-reply.d.ts +20 -0
- package/dist/components/assistant-ui/elements/quote-reply.js +66 -0
- package/dist/components/assistant-ui/elements/quote.aui.d.ts +61 -0
- package/dist/components/assistant-ui/elements/quote.aui.js +170 -0
- package/dist/components/assistant-ui/elements/read-aloud.d.ts +16 -0
- package/dist/components/assistant-ui/elements/read-aloud.js +66 -0
- package/dist/components/assistant-ui/elements/reasoning-effort.d.ts +17 -0
- package/dist/components/assistant-ui/elements/reasoning-effort.js +67 -0
- package/dist/components/assistant-ui/elements/reasoning-panel.d.ts +20 -0
- package/dist/components/assistant-ui/elements/reasoning-panel.js +60 -0
- package/dist/components/assistant-ui/elements/reasoning.aui.d.ts +24 -0
- package/dist/components/assistant-ui/elements/reasoning.aui.js +70 -0
- package/dist/components/assistant-ui/elements/reasoning.d.ts +38 -0
- package/dist/components/assistant-ui/elements/reasoning.js +194 -0
- package/dist/components/assistant-ui/elements/recommendation-card.d.ts +16 -0
- package/dist/components/assistant-ui/elements/recommendation-card.js +65 -0
- package/dist/components/assistant-ui/elements/regenerate-menu.d.ts +18 -0
- package/dist/components/assistant-ui/elements/regenerate-menu.js +46 -0
- package/dist/components/assistant-ui/elements/research-report.d.ts +19 -0
- package/dist/components/assistant-ui/elements/research-report.js +63 -0
- package/dist/components/assistant-ui/elements/retrieval-chunks.d.ts +19 -0
- package/dist/components/assistant-ui/elements/retrieval-chunks.js +86 -0
- package/dist/components/assistant-ui/elements/reviewable-diff.d.ts +21 -0
- package/dist/components/assistant-ui/elements/reviewable-diff.js +104 -0
- package/dist/components/assistant-ui/elements/schedule-card.d.ts +19 -0
- package/dist/components/assistant-ui/elements/schedule-card.js +80 -0
- package/dist/components/assistant-ui/elements/score-breakdown.d.ts +19 -0
- package/dist/components/assistant-ui/elements/score-breakdown.js +107 -0
- package/dist/components/assistant-ui/elements/scroll-anchor.d.ts +15 -0
- package/dist/components/assistant-ui/elements/scroll-anchor.js +104 -0
- package/dist/components/assistant-ui/elements/settings-panel.d.ts +23 -0
- package/dist/components/assistant-ui/elements/settings-panel.js +108 -0
- package/dist/components/assistant-ui/elements/shared-conversation.d.ts +18 -0
- package/dist/components/assistant-ui/elements/shared-conversation.js +56 -0
- package/dist/components/assistant-ui/elements/shiki-highlighter.aui.d.ts +29 -0
- package/dist/components/assistant-ui/elements/shiki-highlighter.aui.js +31 -0
- package/dist/components/assistant-ui/elements/shiki-highlighter.d.ts +26 -0
- package/dist/components/assistant-ui/elements/shiki-highlighter.js +49 -0
- package/dist/components/assistant-ui/elements/sources.aui.d.ts +24 -0
- package/dist/components/assistant-ui/elements/sources.aui.js +121 -0
- package/dist/components/assistant-ui/elements/sources.d.ts +21 -0
- package/dist/components/assistant-ui/elements/sources.js +109 -0
- package/dist/components/assistant-ui/elements/speaker-identity.d.ts +17 -0
- package/dist/components/assistant-ui/elements/speaker-identity.js +45 -0
- package/dist/components/assistant-ui/elements/spec-sheet.d.ts +17 -0
- package/dist/components/assistant-ui/elements/spec-sheet.js +39 -0
- package/dist/components/assistant-ui/elements/stopped-run.d.ts +12 -0
- package/dist/components/assistant-ui/elements/stopped-run.js +44 -0
- package/dist/components/assistant-ui/elements/streaming-text.d.ts +15 -0
- package/dist/components/assistant-ui/elements/streaming-text.js +45 -0
- package/dist/components/assistant-ui/elements/subagent-list.d.ts +17 -0
- package/dist/components/assistant-ui/elements/subagent-list.js +74 -0
- package/dist/components/assistant-ui/elements/suggestions.d.ts +14 -0
- package/dist/components/assistant-ui/elements/suggestions.js +25 -0
- package/dist/components/assistant-ui/elements/surfaces.d.ts +42 -0
- package/dist/components/assistant-ui/elements/surfaces.js +87 -0
- package/dist/components/assistant-ui/elements/syntax-highlighter.d.ts +7 -0
- package/dist/components/assistant-ui/elements/syntax-highlighter.js +41 -0
- package/dist/components/assistant-ui/elements/task-card.aui.d.ts +24 -0
- package/dist/components/assistant-ui/elements/task-card.aui.js +136 -0
- package/dist/components/assistant-ui/elements/task-card.d.ts +22 -0
- package/dist/components/assistant-ui/elements/task-card.js +104 -0
- package/dist/components/assistant-ui/elements/terminal-block.d.ts +27 -0
- package/dist/components/assistant-ui/elements/terminal-block.js +266 -0
- package/dist/components/assistant-ui/elements/thinking-indicator.d.ts +10 -0
- package/dist/components/assistant-ui/elements/thinking-indicator.js +30 -0
- package/dist/components/assistant-ui/elements/thread-list.aui.d.ts +39 -0
- package/dist/components/assistant-ui/elements/thread-list.aui.js +331 -0
- package/dist/components/assistant-ui/elements/thread-list.d.ts +19 -0
- package/dist/components/assistant-ui/elements/thread-list.js +72 -0
- package/dist/components/assistant-ui/elements/thread-search.d.ts +20 -0
- package/dist/components/assistant-ui/elements/thread-search.js +94 -0
- package/dist/components/assistant-ui/elements/thread.aui.d.ts +36 -0
- package/dist/components/assistant-ui/elements/thread.aui.js +625 -0
- package/dist/components/assistant-ui/elements/threadlist-sidebar.aui.d.ts +19 -0
- package/dist/components/assistant-ui/elements/threadlist-sidebar.aui.js +75 -0
- package/dist/components/assistant-ui/elements/timeline.d.ts +18 -0
- package/dist/components/assistant-ui/elements/timeline.js +40 -0
- package/dist/components/assistant-ui/elements/todo-list.d.ts +21 -0
- package/dist/components/assistant-ui/elements/todo-list.js +100 -0
- package/dist/components/assistant-ui/elements/tool-call.d.ts +17 -0
- package/dist/components/assistant-ui/elements/tool-call.js +70 -0
- package/dist/components/assistant-ui/elements/tool-error.d.ts +16 -0
- package/dist/components/assistant-ui/elements/tool-error.js +62 -0
- package/dist/components/assistant-ui/elements/tool-fallback.aui.d.ts +44 -0
- package/dist/components/assistant-ui/elements/tool-fallback.aui.js +542 -0
- package/dist/components/assistant-ui/elements/tool-group.aui.d.ts +37 -0
- package/dist/components/assistant-ui/elements/tool-group.aui.js +104 -0
- package/dist/components/assistant-ui/elements/tool-group.d.ts +20 -0
- package/dist/components/assistant-ui/elements/tool-group.js +71 -0
- package/dist/components/assistant-ui/elements/tool-timeline.d.ts +44 -0
- package/dist/components/assistant-ui/elements/tool-timeline.js +109 -0
- package/dist/components/assistant-ui/elements/tooltip-icon-button.d.ts +12 -0
- package/dist/components/assistant-ui/elements/tooltip-icon-button.js +30 -0
- package/dist/components/assistant-ui/elements/trace-waterfall.d.ts +33 -0
- package/dist/components/assistant-ui/elements/trace-waterfall.js +102 -0
- package/dist/components/assistant-ui/elements/typing-indicator.d.ts +9 -0
- package/dist/components/assistant-ui/elements/typing-indicator.js +45 -0
- package/dist/components/assistant-ui/elements/voice-conversation.aui.d.ts +11 -0
- package/dist/components/assistant-ui/elements/voice-conversation.aui.js +54 -0
- package/dist/components/assistant-ui/elements/voice-conversation.d.ts +21 -0
- package/dist/components/assistant-ui/elements/voice-conversation.js +110 -0
- package/dist/components/assistant-ui/elements/voice.aui.d.ts +22 -0
- package/dist/components/assistant-ui/elements/voice.aui.js +100 -0
- package/dist/components/assistant-ui/elements/voice.d.ts +15 -0
- package/dist/components/assistant-ui/elements/voice.js +400 -0
- package/dist/components/assistant-ui/elements/web-preview.d.ts +18 -0
- package/dist/components/assistant-ui/elements/web-preview.js +61 -0
- package/dist/components/assistant-ui/elements/web-search.d.ts +17 -0
- package/dist/components/assistant-ui/elements/web-search.js +54 -0
- package/dist/components/assistant-ui/utils/href.d.ts +13 -0
- package/dist/components/assistant-ui/utils/href.js +39 -0
- package/dist/components/assistant-ui/utils/range.d.ts +22 -0
- package/dist/components/assistant-ui/utils/range.js +48 -0
- package/dist/components/assistant-ui/utils/task.d.ts +14 -0
- package/dist/components/assistant-ui/utils/task.js +75 -0
- package/dist/components/icons/github.js +13 -0
- package/dist/components/theme-provider.d.ts +16 -0
- package/dist/components/theme-provider.js +116 -0
- package/dist/components/ui/accordion.d.ts +8 -0
- package/dist/components/ui/accordion.js +53 -0
- package/dist/components/ui/alert-dialog.d.ts +20 -0
- package/dist/components/ui/alert-dialog.js +93 -0
- package/dist/components/ui/alert.d.ts +12 -0
- package/dist/components/ui/alert.js +42 -0
- package/dist/components/ui/aspect-ratio.d.ts +6 -0
- package/dist/components/ui/aspect-ratio.js +13 -0
- package/dist/components/ui/attachment.d.ts +25 -0
- package/dist/components/ui/attachment.js +103 -0
- package/dist/components/ui/avatar.d.ts +13 -0
- package/dist/components/ui/avatar.js +50 -0
- package/dist/components/ui/badge.d.ts +14 -0
- package/dist/components/ui/badge.js +30 -0
- package/dist/components/ui/breadcrumb.d.ts +12 -0
- package/dist/components/ui/breadcrumb.js +71 -0
- package/dist/components/ui/bubble.d.ts +18 -0
- package/dist/components/ui/bubble.js +72 -0
- package/dist/components/ui/button-group.d.ts +12 -0
- package/dist/components/ui/button-group.js +41 -0
- package/dist/components/ui/button.d.ts +19 -0
- package/dist/components/ui/button.js +71 -0
- package/dist/components/ui/calendar.d.ts +12 -0
- package/dist/components/ui/calendar.js +108 -0
- package/dist/components/ui/card.d.ts +13 -0
- package/dist/components/ui/card.js +55 -0
- package/dist/components/ui/carousel.d.ts +30 -0
- package/dist/components/ui/carousel.js +131 -0
- package/dist/components/ui/chart.d.ts +46 -0
- package/dist/components/ui/chart.js +148 -0
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox.js +20 -0
- package/dist/components/ui/collapsible.d.ts +7 -0
- package/dist/components/ui/collapsible.js +23 -0
- package/dist/components/ui/combobox.d.ts +26 -0
- package/dist/components/ui/combobox.js +161 -0
- package/dist/components/ui/command.d.ts +21 -0
- package/dist/components/ui/command.js +87 -0
- package/dist/components/ui/context-menu.d.ts +31 -0
- package/dist/components/ui/context-menu.js +132 -0
- package/dist/components/ui/dialog.d.ts +19 -0
- package/dist/components/ui/dialog.js +91 -0
- package/dist/components/ui/diff-viewer.d.ts +100 -0
- package/dist/components/ui/diff-viewer.js +461 -0
- package/dist/components/ui/direction.d.ts +2 -0
- package/dist/components/ui/direction.js +2 -0
- package/dist/components/ui/dot-matrix.d.ts +150 -0
- package/dist/components/ui/dot-matrix.js +248 -0
- package/dist/components/ui/drawer.d.ts +18 -0
- package/dist/components/ui/drawer.js +123 -0
- package/dist/components/ui/dropdown-menu.d.ts +31 -0
- package/dist/components/ui/dropdown-menu.js +136 -0
- package/dist/components/ui/empty.d.ts +13 -0
- package/dist/components/ui/empty.js +59 -0
- package/dist/components/ui/field.d.ts +26 -0
- package/dist/components/ui/field.js +109 -0
- package/dist/components/ui/hover-card.d.ts +7 -0
- package/dist/components/ui/hover-card.js +36 -0
- package/dist/components/ui/input-group.d.ts +20 -0
- package/dist/components/ui/input-group.js +77 -0
- package/dist/components/ui/input-otp.d.ts +13 -0
- package/dist/components/ui/input-otp.js +46 -0
- package/dist/components/ui/input.d.ts +5 -0
- package/dist/components/ui/input.js +14 -0
- package/dist/components/ui/item.d.ts +24 -0
- package/dist/components/ui/item.js +120 -0
- package/dist/components/ui/kbd.d.ts +5 -0
- package/dist/components/ui/kbd.js +19 -0
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/label.js +12 -0
- package/dist/components/ui/marker.d.ts +12 -0
- package/dist/components/ui/marker.js +42 -0
- package/dist/components/ui/menubar.d.ts +31 -0
- package/dist/components/ui/menubar.js +135 -0
- package/dist/components/ui/message-scroller.d.ts +12 -0
- package/dist/components/ui/message-scroller.js +59 -0
- package/dist/components/ui/message.d.ts +12 -0
- package/dist/components/ui/message.js +48 -0
- package/dist/components/ui/native-select.d.ts +10 -0
- package/dist/components/ui/native-select.js +37 -0
- package/dist/components/ui/navigation-menu.d.ts +13 -0
- package/dist/components/ui/navigation-menu.js +82 -0
- package/dist/components/ui/number-roll.d.ts +21 -0
- package/dist/components/ui/number-roll.js +269 -0
- package/dist/components/ui/pagination.d.ts +19 -0
- package/dist/components/ui/pagination.js +79 -0
- package/dist/components/ui/popover.d.ts +11 -0
- package/dist/components/ui/popover.js +54 -0
- package/dist/components/ui/progress.d.ts +9 -0
- package/dist/components/ui/progress.js +44 -0
- package/dist/components/ui/questionnaire.d.ts +21 -0
- package/dist/components/ui/questionnaire.js +169 -0
- package/dist/components/ui/radio-group.d.ts +7 -0
- package/dist/components/ui/radio-group.js +26 -0
- package/dist/components/ui/resizable.d.ts +9 -0
- package/dist/components/ui/resizable.js +28 -0
- package/dist/components/ui/scroll-area.d.ts +6 -0
- package/dist/components/ui/scroll-area.js +35 -0
- package/dist/components/ui/select.d.ts +17 -0
- package/dist/components/ui/select.js +96 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.js +14 -0
- package/dist/components/ui/sheet.d.ts +16 -0
- package/dist/components/ui/sheet.js +87 -0
- package/dist/components/ui/sidebar.d.ts +65 -0
- package/dist/components/ui/sidebar.js +386 -0
- package/dist/components/ui/skeleton.d.ts +4 -0
- package/dist/components/ui/skeleton.js +12 -0
- package/dist/components/ui/slider.d.ts +5 -0
- package/dist/components/ui/slider.js +33 -0
- package/dist/components/ui/spinner.d.ts +4 -0
- package/dist/components/ui/spinner.js +15 -0
- package/dist/components/ui/switch.d.ts +7 -0
- package/dist/components/ui/switch.js +19 -0
- package/dist/components/ui/table.d.ts +12 -0
- package/dist/components/ui/table.js +65 -0
- package/dist/components/ui/tabs.d.ts +12 -0
- package/dist/components/ui/tabs.js +45 -0
- package/dist/components/ui/textarea.d.ts +5 -0
- package/dist/components/ui/textarea.js +12 -0
- package/dist/components/ui/toast.d.ts +18 -0
- package/dist/components/ui/toast.js +121 -0
- package/dist/components/ui/toggle-group.d.ts +13 -0
- package/dist/components/ui/toggle-group.js +51 -0
- package/dist/components/ui/toggle.d.ts +10 -0
- package/dist/components/ui/toggle.js +35 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/components/ui/tooltip.js +43 -0
- package/dist/compositions/app-rail/app-rail.d.ts +19 -0
- package/dist/compositions/app-rail/app-rail.js +58 -0
- package/dist/compositions/app-shell/app-shell.d.ts +56 -0
- package/dist/compositions/app-shell/app-shell.js +143 -0
- package/dist/compositions/app-shell/theme-toggle.d.ts +10 -0
- package/dist/compositions/app-shell/theme-toggle.js +65 -0
- package/dist/compositions/confirm-action/confirm-action.d.ts +48 -0
- package/dist/compositions/confirm-action/confirm-action.js +48 -0
- package/dist/compositions/data-table/data-table-state.d.ts +23 -0
- package/dist/compositions/data-table/data-table-state.js +46 -0
- package/dist/compositions/data-table/data-table.d.ts +185 -0
- package/dist/compositions/data-table/data-table.js +615 -0
- package/dist/compositions/date-range-picker/date-range-options.d.ts +28 -0
- package/dist/compositions/date-range-picker/date-range-options.js +61 -0
- package/dist/compositions/date-range-picker/date-range-picker.d.ts +55 -0
- package/dist/compositions/date-range-picker/date-range-picker.js +409 -0
- package/dist/compositions/decision-queue/decision-queue.d.ts +114 -0
- package/dist/compositions/decision-queue/decision-queue.js +478 -0
- package/dist/compositions/event-feed/event-feed.d.ts +59 -0
- package/dist/compositions/event-feed/event-feed.js +105 -0
- package/dist/compositions/feedback.d.ts +20 -0
- package/dist/compositions/feedback.js +49 -0
- package/dist/compositions/fields.d.ts +64 -0
- package/dist/compositions/fields.js +293 -0
- package/dist/compositions/form-kit/form-context.d.ts +10 -0
- package/dist/compositions/form-kit/form-context.js +12 -0
- package/dist/compositions/form-kit/form-fields.d.ts +95 -0
- package/dist/compositions/form-kit/form-fields.js +233 -0
- package/dist/compositions/form-kit/form-kit.d.ts +128 -0
- package/dist/compositions/form-kit/form-kit.js +119 -0
- package/dist/compositions/inspector/inspector.d.ts +53 -0
- package/dist/compositions/inspector/inspector.js +80 -0
- package/dist/compositions/layout.d.ts +36 -0
- package/dist/compositions/layout.js +86 -0
- package/dist/compositions/state-blocks/state-blocks.d.ts +42 -0
- package/dist/compositions/state-blocks/state-blocks.js +81 -0
- package/dist/compositions/status-panel/status-panel.d.ts +94 -0
- package/dist/compositions/status-panel/status-panel.js +189 -0
- package/dist/fonts/InterVariable.woff2 +0 -0
- package/dist/fonts/inter.css +15 -0
- package/dist/hooks/use-attachment-src.js +35 -0
- package/dist/hooks/use-copy-to-clipboard.js +34 -0
- package/dist/hooks/use-mobile.d.ts +3 -0
- package/dist/hooks/use-mobile.js +18 -0
- package/dist/index.d.ts +102 -0
- package/dist/index.js +102 -0
- package/dist/lib/context-level.js +7 -0
- package/dist/lib/elapsed.js +61 -0
- package/dist/lib/iso-date.js +30 -0
- package/dist/lib/motion-loop.js +41 -0
- package/dist/lib/pointer.js +14 -0
- package/dist/lib/status-tone.d.ts +7 -0
- package/dist/lib/status-tone.js +55 -0
- package/dist/lib/triage-keys.js +229 -0
- package/dist/lib/utils.js +2 -0
- package/dist/motion/alert-toast/alert-toast.d.ts +51 -0
- package/dist/motion/alert-toast/alert-toast.js +226 -0
- package/dist/motion/branch-menu/branch-menu.d.ts +47 -0
- package/dist/motion/branch-menu/branch-menu.js +287 -0
- package/dist/motion/check-item/check-item.d.ts +24 -0
- package/dist/motion/check-item/check-item.js +110 -0
- package/dist/motion/dial/dial.d.ts +39 -0
- package/dist/motion/dial/dial.js +290 -0
- package/dist/motion/dictation-button/dictation-button.d.ts +45 -0
- package/dist/motion/dictation-button/dictation-button.js +232 -0
- package/dist/motion/hold-button/hold-button.d.ts +37 -0
- package/dist/motion/hold-button/hold-button.js +192 -0
- package/dist/motion/masonry-grid/masonry-grid.d.ts +42 -0
- package/dist/motion/masonry-grid/masonry-grid.js +145 -0
- package/dist/motion/prompt-composer/prompt-composer.d.ts +90 -0
- package/dist/motion/prompt-composer/prompt-composer.js +374 -0
- package/dist/motion/scrub-select/scrub-select.d.ts +33 -0
- package/dist/motion/scrub-select/scrub-select.js +346 -0
- package/dist/motion/spotlight-grid/spotlight-grid.d.ts +40 -0
- package/dist/motion/spotlight-grid/spotlight-grid.js +171 -0
- package/dist/motion/star-rating/star-rating.d.ts +32 -0
- package/dist/motion/star-rating/star-rating.js +191 -0
- package/dist/motion/status-glyph/status-glyph.d.ts +28 -0
- package/dist/motion/status-glyph/status-glyph.js +171 -0
- package/dist/motion/stepper/stepper.d.ts +56 -0
- package/dist/motion/stepper/stepper.js +211 -0
- package/dist/motion/swipe-row/swipe-row.d.ts +52 -0
- package/dist/motion/swipe-row/swipe-row.js +208 -0
- package/dist/motion/thinking-trace/thinking-trace.d.ts +32 -0
- package/dist/motion/thinking-trace/thinking-trace.js +186 -0
- package/dist/motion/tool-call-chip/tool-call-chip.d.ts +36 -0
- package/dist/motion/tool-call-chip/tool-call-chip.js +135 -0
- package/dist/motion/working-indicator/working-indicator.d.ts +38 -0
- package/dist/motion/working-indicator/working-indicator.js +171 -0
- package/dist/styles.css +828 -0
- package/dist/tokens.css +230 -0
- package/licenses/Inter-OFL.txt +92 -0
- package/licenses/assistant-ui-MIT.txt +21 -0
- package/licenses/shadcn-MIT.md +21 -0
- package/package.json +133 -4
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//#region src/ai/compositions/transcript-viewer/to-thread-messages.ts
|
|
2
|
+
/** Milliseconds since the epoch, or undefined for a missing or unreadable timestamp. */
|
|
3
|
+
function epoch(iso) {
|
|
4
|
+
if (iso === void 0) return void 0;
|
|
5
|
+
const value = Date.parse(iso);
|
|
6
|
+
return Number.isNaN(value) ? void 0 : value;
|
|
7
|
+
}
|
|
8
|
+
/** A tool call as an assistant-ui tool-call part. */
|
|
9
|
+
function toToolCallPart(toolCall) {
|
|
10
|
+
const startedAt = epoch(toolCall.startedAt);
|
|
11
|
+
const completedAt = epoch(toolCall.endedAt);
|
|
12
|
+
return {
|
|
13
|
+
type: "tool-call",
|
|
14
|
+
toolCallId: toolCall.id,
|
|
15
|
+
toolName: toolCall.name,
|
|
16
|
+
args: toolCall.args,
|
|
17
|
+
argsText: JSON.stringify(toolCall.args, null, 2),
|
|
18
|
+
...toolCall.result !== void 0 ? { result: toolCall.result } : {},
|
|
19
|
+
...toolCall.status === "failed" ? { isError: true } : {},
|
|
20
|
+
...startedAt !== void 0 ? { timing: {
|
|
21
|
+
startedAt,
|
|
22
|
+
...completedAt !== void 0 ? { completedAt } : {}
|
|
23
|
+
} } : {}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* One stored message as an assistant-ui message. Parts follow the order an
|
|
28
|
+
* agent produces them: reasoning, then tool calls, then the answer. A system
|
|
29
|
+
* message carries its text only, as assistant-ui allows.
|
|
30
|
+
*/
|
|
31
|
+
function toThreadMessage(message) {
|
|
32
|
+
const createdAt = new Date(epoch(message.createdAt) ?? 0);
|
|
33
|
+
if (message.role === "system") return {
|
|
34
|
+
id: message.id,
|
|
35
|
+
role: "system",
|
|
36
|
+
createdAt,
|
|
37
|
+
content: message.text
|
|
38
|
+
};
|
|
39
|
+
const content = [];
|
|
40
|
+
if (message.role === "assistant" && message.reasoning) content.push({
|
|
41
|
+
type: "reasoning",
|
|
42
|
+
text: message.reasoning
|
|
43
|
+
});
|
|
44
|
+
if (message.role === "assistant") for (const toolCall of message.toolCalls ?? []) content.push(toToolCallPart(toolCall));
|
|
45
|
+
if (message.text !== "") content.push({
|
|
46
|
+
type: "text",
|
|
47
|
+
text: message.text
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
id: message.id,
|
|
51
|
+
role: message.role,
|
|
52
|
+
createdAt,
|
|
53
|
+
content,
|
|
54
|
+
...message.role === "assistant" ? { status: {
|
|
55
|
+
type: "complete",
|
|
56
|
+
reason: "stop"
|
|
57
|
+
} } : {}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/** Every message, in order. */
|
|
61
|
+
function toThreadMessages(messages) {
|
|
62
|
+
return messages.map(toThreadMessage);
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { toThreadMessage, toThreadMessages, toToolCallPart };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { TranscriptMessage } from "../../types.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
//#region src/ai/compositions/transcript-viewer/transcript-viewer.d.ts
|
|
4
|
+
export interface TranscriptViewerProps extends Omit<React.ComponentProps<"section">, "children" | "onError"> {
|
|
5
|
+
/** The conversation, oldest first. */
|
|
6
|
+
messages: readonly TranscriptMessage[];
|
|
7
|
+
/** Accessible name of the transcript. */
|
|
8
|
+
label?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The message or tool call to scroll to and highlight, by its record id
|
|
11
|
+
* (controlled). Set it from a deep link to open the transcript at that
|
|
12
|
+
* point.
|
|
13
|
+
*/
|
|
14
|
+
highlightId?: string | null;
|
|
15
|
+
/** The message or tool call highlighted on mount (uncontrolled). */
|
|
16
|
+
defaultHighlightId?: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* The owner followed a message's or tool call's anchor link. The id is the
|
|
19
|
+
* record's id; `transcriptAnchorId(id)` gives its DOM id, for a URL hash.
|
|
20
|
+
*/
|
|
21
|
+
onAnchor?: (id: string) => void;
|
|
22
|
+
/** Prefix of every anchor's DOM id, to keep two transcripts on one page apart. */
|
|
23
|
+
anchorPrefix?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Shows a star rating under each assistant message; called with the
|
|
26
|
+
* message id when the owner rates it (null when they clear it).
|
|
27
|
+
*/
|
|
28
|
+
onRate?: (messageId: string, rating: number | null) => void;
|
|
29
|
+
/** The ratings the app recorded, by message id (controls the stars). */
|
|
30
|
+
ratings?: Readonly<Record<string, number | null>>;
|
|
31
|
+
/** Formats a message's ISO timestamp for display. Defaults to the local time, such as 09:02. */
|
|
32
|
+
formatTime?: (iso: string) => string;
|
|
33
|
+
/** Show placeholder messages while the conversation loads. */
|
|
34
|
+
isLoading?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Plain-text error, such as a failed load or a run that stopped. It shows in
|
|
37
|
+
* place below the messages, which stay on screen; with no messages it shows
|
|
38
|
+
* alone.
|
|
39
|
+
*/
|
|
40
|
+
error?: string | null;
|
|
41
|
+
/** Offers a Retry button with `error`. Retrying is the owner's action, never automatic. */
|
|
42
|
+
onRetry?: () => void;
|
|
43
|
+
/** Text shown for a conversation with no messages. */
|
|
44
|
+
emptyLabel?: string;
|
|
45
|
+
}
|
|
46
|
+
/** The DOM id of a message's or tool call's anchor, for links and URL hashes. */
|
|
47
|
+
export declare function transcriptAnchorId(id: string, prefix?: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* A read-only past conversation, with no composer. It converts the
|
|
50
|
+
* `TranscriptMessage` props to assistant-ui messages internally and draws
|
|
51
|
+
* them with the registry's message rendering: markdown text, collapsible
|
|
52
|
+
* reasoning, and each tool call as a ToolCallChip that expands to the call's
|
|
53
|
+
* arguments and result (tool-fallback).
|
|
54
|
+
*
|
|
55
|
+
* It opens at the latest message, as a conversation does, so a run that
|
|
56
|
+
* ended in an error or mid-call shows its end. Every message and tool call
|
|
57
|
+
* has a stable anchor (`transcriptAnchorId`). Following one calls
|
|
58
|
+
* `onAnchor`; setting `highlightId` scrolls to that message or call (instead
|
|
59
|
+
* of the end) and highlights it. With `onRate`, each assistant message gets a
|
|
60
|
+
* star rating.
|
|
61
|
+
*/
|
|
62
|
+
export declare function TranscriptViewer(props: TranscriptViewerProps): React.JSX.Element;
|
|
63
|
+
//#endregion
|
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
import { Alert, AlertAction, AlertTitle } from "../../../components/ui/alert.js";
|
|
2
|
+
import { Button } from "../../../components/ui/button.js";
|
|
3
|
+
import { CollapsibleTrigger } from "../../../components/ui/collapsible.js";
|
|
4
|
+
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "../../../components/ui/empty.js";
|
|
5
|
+
import { Skeleton } from "../../../components/ui/skeleton.js";
|
|
6
|
+
import { StarRating } from "../../../motion/star-rating/star-rating.js";
|
|
7
|
+
import { ToolCallChip } from "../../../motion/tool-call-chip/tool-call-chip.js";
|
|
8
|
+
import { MarkdownText } from "../../../components/assistant-ui/elements/markdown-text.js";
|
|
9
|
+
import { ToolFallback } from "../../../components/assistant-ui/elements/tool-fallback.aui.js";
|
|
10
|
+
import { summarizeArgs } from "../tool-approval/json-args.js";
|
|
11
|
+
import { ToolCallJson, formatToolValue, toolCallTriggerBaseClassName, toolCallTriggerClassName, useRevealOnOpen } from "../tool-call-row/tool-call-row.js";
|
|
12
|
+
import { ReasoningContent, ReasoningText, ReasoningTrigger } from "../../../components/assistant-ui/elements/reasoning.js";
|
|
13
|
+
import { ReasoningRoot } from "../../../components/assistant-ui/elements/reasoning.aui.js";
|
|
14
|
+
import { toThreadMessages } from "./to-thread-messages.js";
|
|
15
|
+
import * as React from "react";
|
|
16
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
import { cn } from "cn";
|
|
18
|
+
import { AlertCircleIcon, ChevronRightIcon, LinkIcon, RotateCwIcon } from "lucide-react";
|
|
19
|
+
import { useControllableValue } from "ahooks";
|
|
20
|
+
import { useReducedMotionConfig } from "motion/react";
|
|
21
|
+
import { AssistantRuntimeProvider, MessagePrimitive, ThreadPrimitive, groupPartByType, useAuiState, useExternalStoreRuntime } from "@assistant-ui/react";
|
|
22
|
+
//#region src/ai/compositions/transcript-viewer/transcript-viewer.tsx
|
|
23
|
+
/** The DOM id of a message's or tool call's anchor, for links and URL hashes. */
|
|
24
|
+
function transcriptAnchorId(id, prefix = "transcript-") {
|
|
25
|
+
return `${prefix}${id}`;
|
|
26
|
+
}
|
|
27
|
+
const timeFormat = new Intl.DateTimeFormat("en-GB", {
|
|
28
|
+
hour: "2-digit",
|
|
29
|
+
minute: "2-digit"
|
|
30
|
+
});
|
|
31
|
+
function defaultFormatTime(iso) {
|
|
32
|
+
const date = new Date(iso);
|
|
33
|
+
return Number.isNaN(date.getTime()) ? iso : timeFormat.format(date);
|
|
34
|
+
}
|
|
35
|
+
const DEFAULT_AUTHOR = {
|
|
36
|
+
user: "User",
|
|
37
|
+
assistant: "Assistant",
|
|
38
|
+
system: "System"
|
|
39
|
+
};
|
|
40
|
+
const TranscriptContext = React.createContext(null);
|
|
41
|
+
function useTranscript() {
|
|
42
|
+
const context = React.useContext(TranscriptContext);
|
|
43
|
+
if (!context) throw new Error("TranscriptViewer parts must render inside TranscriptViewer");
|
|
44
|
+
return context;
|
|
45
|
+
}
|
|
46
|
+
/** A small "link to here" anchor, shown on hover or focus (always on touch screens). */
|
|
47
|
+
function AnchorLink({ id, label }) {
|
|
48
|
+
const { anchorPrefix, follow } = useTranscript();
|
|
49
|
+
return /* @__PURE__ */ jsx("a", {
|
|
50
|
+
href: `#${transcriptAnchorId(id, anchorPrefix)}`,
|
|
51
|
+
"aria-label": label,
|
|
52
|
+
"data-slot": "transcript-anchor",
|
|
53
|
+
onClick: (event) => {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
follow(id);
|
|
56
|
+
},
|
|
57
|
+
className: "inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground opacity-0 outline-none transition-opacity group-hover/anchor:opacity-100 hover:text-foreground focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50 pointer-coarse:opacity-100",
|
|
58
|
+
children: /* @__PURE__ */ jsx(LinkIcon, {
|
|
59
|
+
"aria-hidden": "true",
|
|
60
|
+
className: "size-3"
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A deep-linked message or call: a quiet 1px outline at the ring tone, not
|
|
66
|
+
* the heavy 2px ring that stacked with the chip's border and focus. Not a
|
|
67
|
+
* fill: any tint under an error chip drops its muted text below 4.5:1.
|
|
68
|
+
*/
|
|
69
|
+
const HIGHLIGHT = "transition-shadow duration-300 data-highlighted:ring-1 data-highlighted:ring-ring/40";
|
|
70
|
+
const CHIP_STATUS = {
|
|
71
|
+
running: "running",
|
|
72
|
+
"awaiting-approval": "running",
|
|
73
|
+
succeeded: "success",
|
|
74
|
+
failed: "error",
|
|
75
|
+
denied: "error",
|
|
76
|
+
cancelled: "error"
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* How long a finished call took, from its record. A call without `endedAt`
|
|
80
|
+
* has no duration: a transcript is history, so it never runs a live clock.
|
|
81
|
+
*/
|
|
82
|
+
function elapsedOf(toolCall) {
|
|
83
|
+
if (!toolCall.startedAt || !toolCall.endedAt) return void 0;
|
|
84
|
+
const ms = Date.parse(toolCall.endedAt) - Date.parse(toolCall.startedAt);
|
|
85
|
+
return Number.isNaN(ms) ? void 0 : ms;
|
|
86
|
+
}
|
|
87
|
+
function approvalLine(toolCall) {
|
|
88
|
+
const { approval, status } = toolCall;
|
|
89
|
+
if (status === "awaiting-approval") return "Waiting for approval";
|
|
90
|
+
if (!approval) return status === "denied" ? "Denied" : null;
|
|
91
|
+
const by = approval.decidedBy ? ` by ${approval.decidedBy}` : "";
|
|
92
|
+
if (approval.decision === "rejected") return `Denied${by}${approval.reason ? `: ${approval.reason}` : ""}`;
|
|
93
|
+
if (approval.byStandingPermission) return "Allowed by standing permission";
|
|
94
|
+
return `Approved${approval.amendedArgs ? " with edits" : ""}${by}`;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* One tool call: a ToolCallChip that expands to the call's arguments, result
|
|
98
|
+
* or error, through the registry's tool-fallback parts. Any tool renders this
|
|
99
|
+
* way; there is no per-tool UI in a transcript.
|
|
100
|
+
*/
|
|
101
|
+
function TranscriptToolCall({ toolCallId }) {
|
|
102
|
+
const { toolCalls, highlightId, anchorPrefix } = useTranscript();
|
|
103
|
+
const toolCall = toolCalls.get(toolCallId);
|
|
104
|
+
const highlighted = highlightId === toolCallId;
|
|
105
|
+
const [open, setOpen] = React.useState(highlighted);
|
|
106
|
+
const rowRef = useRevealOnOpen(open);
|
|
107
|
+
const [wasHighlighted, setWasHighlighted] = React.useState(highlighted);
|
|
108
|
+
if (highlighted !== wasHighlighted) {
|
|
109
|
+
setWasHighlighted(highlighted);
|
|
110
|
+
if (highlighted) setOpen(true);
|
|
111
|
+
}
|
|
112
|
+
if (!toolCall) return null;
|
|
113
|
+
const status = CHIP_STATUS[toolCall.status];
|
|
114
|
+
const elapsedMs = elapsedOf(toolCall);
|
|
115
|
+
const decision = approvalLine(toolCall);
|
|
116
|
+
const detail = toolCall.status === "succeeded" || toolCall.status === "failed" ? summarizeArgs(toolCall.args, 2) : toolCall.status.replace("-", " ");
|
|
117
|
+
return /* @__PURE__ */ jsx("div", {
|
|
118
|
+
ref: rowRef,
|
|
119
|
+
id: transcriptAnchorId(toolCall.id, anchorPrefix),
|
|
120
|
+
"data-slot": "transcript-tool-call",
|
|
121
|
+
"data-highlighted": highlighted || void 0,
|
|
122
|
+
className: cn("group/anchor -mx-1.5 max-w-[calc(100%+0.75rem)] scroll-my-4 rounded-lg px-1.5 py-0.5", HIGHLIGHT, "data-highlighted:has-[[data-slot=transcript-tool-call-trigger]:focus-visible]:ring-ring/80"),
|
|
123
|
+
children: /* @__PURE__ */ jsxs(ToolFallback.Root, {
|
|
124
|
+
open,
|
|
125
|
+
onOpenChange: setOpen,
|
|
126
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
127
|
+
className: "flex min-w-0 items-center gap-1",
|
|
128
|
+
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
129
|
+
"data-slot": "transcript-tool-call-trigger",
|
|
130
|
+
"aria-label": `${toolCall.name}, ${toolCall.status.replace("-", " ")}`,
|
|
131
|
+
className: highlighted ? toolCallTriggerBaseClassName : toolCallTriggerClassName,
|
|
132
|
+
children: [/* @__PURE__ */ jsx(ToolCallChip, {
|
|
133
|
+
name: toolCall.name,
|
|
134
|
+
detail,
|
|
135
|
+
status,
|
|
136
|
+
elapsedMs: elapsedMs ?? 0,
|
|
137
|
+
className: cn("min-w-0", elapsedMs === void 0 && "[&>[data-slot=tool-call-chip-time]]:hidden")
|
|
138
|
+
}), /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
139
|
+
"aria-hidden": "true",
|
|
140
|
+
className: "size-3.5 shrink-0 transition-transform duration-200 group-data-panel-open/trigger:rotate-90 motion-reduce:transition-none"
|
|
141
|
+
})]
|
|
142
|
+
}), /* @__PURE__ */ jsx(AnchorLink, {
|
|
143
|
+
id: toolCall.id,
|
|
144
|
+
label: `Link to the ${toolCall.name} call`
|
|
145
|
+
})]
|
|
146
|
+
}), /* @__PURE__ */ jsxs(ToolFallback.Content, { children: [
|
|
147
|
+
decision ? /* @__PURE__ */ jsx("p", {
|
|
148
|
+
className: "text-muted-foreground text-xs",
|
|
149
|
+
children: decision
|
|
150
|
+
}) : null,
|
|
151
|
+
toolCall.error ? /* @__PURE__ */ jsx(ToolFallback.Error, {
|
|
152
|
+
status: {
|
|
153
|
+
type: "incomplete",
|
|
154
|
+
reason: "error",
|
|
155
|
+
error: toolCall.error.message
|
|
156
|
+
},
|
|
157
|
+
className: "text-xs"
|
|
158
|
+
}) : null,
|
|
159
|
+
/* @__PURE__ */ jsx(ToolCallJson, { text: JSON.stringify(toolCall.args, null, 2) }),
|
|
160
|
+
toolCall.result !== void 0 ? /* @__PURE__ */ jsx(ToolCallJson, {
|
|
161
|
+
heading: "Result:",
|
|
162
|
+
text: formatToolValue(toolCall.result)
|
|
163
|
+
}) : null
|
|
164
|
+
] })]
|
|
165
|
+
})
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
const groupBy = groupPartByType({
|
|
169
|
+
reasoning: ["group-reasoning"],
|
|
170
|
+
"tool-call": ["group-tool"]
|
|
171
|
+
});
|
|
172
|
+
function AssistantParts() {
|
|
173
|
+
return /* @__PURE__ */ jsx(MessagePrimitive.GroupedParts, {
|
|
174
|
+
groupBy,
|
|
175
|
+
indicator: "never",
|
|
176
|
+
children: ({ part, children }) => {
|
|
177
|
+
switch (part.type) {
|
|
178
|
+
case "group-reasoning": return /* @__PURE__ */ jsxs(ReasoningRoot, {
|
|
179
|
+
variant: "ghost",
|
|
180
|
+
children: [/* @__PURE__ */ jsx(ReasoningTrigger, {}), /* @__PURE__ */ jsx(ReasoningContent, {
|
|
181
|
+
className: "[&>[data-slot=reasoning-fade]]:hidden",
|
|
182
|
+
children: /* @__PURE__ */ jsx(ReasoningText, { children })
|
|
183
|
+
})]
|
|
184
|
+
});
|
|
185
|
+
case "group-tool": return /* @__PURE__ */ jsx("div", {
|
|
186
|
+
className: "flex min-w-0 flex-col items-start gap-0.5 pt-1 pb-5",
|
|
187
|
+
children
|
|
188
|
+
});
|
|
189
|
+
case "reasoning":
|
|
190
|
+
case "text": return /* @__PURE__ */ jsx(MarkdownText, {});
|
|
191
|
+
case "tool-call": return /* @__PURE__ */ jsx(TranscriptToolCall, { toolCallId: part.toolCallId });
|
|
192
|
+
default: return /* @__PURE__ */ jsx(Fragment$1, {});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
function MessageView() {
|
|
198
|
+
const id = useAuiState((s) => s.message.id);
|
|
199
|
+
const { records, highlightId, anchorPrefix, formatTime, onRate, ratings } = useTranscript();
|
|
200
|
+
const record = records.get(id);
|
|
201
|
+
const headerId = React.useId();
|
|
202
|
+
if (!record) return null;
|
|
203
|
+
const highlighted = highlightId === id;
|
|
204
|
+
const author = record.author ?? DEFAULT_AUTHOR[record.role];
|
|
205
|
+
const time = formatTime(record.createdAt);
|
|
206
|
+
const header = /* @__PURE__ */ jsxs("div", {
|
|
207
|
+
id: headerId,
|
|
208
|
+
className: cn("flex items-center gap-1.5 text-xs text-muted-foreground", record.role === "user" && "flex-row-reverse"),
|
|
209
|
+
children: [
|
|
210
|
+
/* @__PURE__ */ jsx("span", {
|
|
211
|
+
className: "font-medium text-foreground",
|
|
212
|
+
children: author
|
|
213
|
+
}),
|
|
214
|
+
/* @__PURE__ */ jsx("time", {
|
|
215
|
+
dateTime: record.createdAt,
|
|
216
|
+
children: time
|
|
217
|
+
}),
|
|
218
|
+
/* @__PURE__ */ jsx(AnchorLink, {
|
|
219
|
+
id,
|
|
220
|
+
label: `Link to ${author}'s message at ${time}`
|
|
221
|
+
})
|
|
222
|
+
]
|
|
223
|
+
});
|
|
224
|
+
const shared = {
|
|
225
|
+
id: transcriptAnchorId(id, anchorPrefix),
|
|
226
|
+
role: "article",
|
|
227
|
+
"aria-labelledby": headerId,
|
|
228
|
+
"data-role": record.role,
|
|
229
|
+
"data-highlighted": highlighted || void 0
|
|
230
|
+
};
|
|
231
|
+
const highlight = cn("group/anchor scroll-mt-4 rounded-xl", HIGHLIGHT);
|
|
232
|
+
if (record.role === "system") return /* @__PURE__ */ jsxs(MessagePrimitive.Root, {
|
|
233
|
+
...shared,
|
|
234
|
+
className: cn(highlight, "flex flex-col items-center gap-1 px-3 py-2 text-center"),
|
|
235
|
+
children: [header, /* @__PURE__ */ jsx("p", {
|
|
236
|
+
className: "text-muted-foreground text-xs",
|
|
237
|
+
children: record.text
|
|
238
|
+
})]
|
|
239
|
+
});
|
|
240
|
+
if (record.role === "user") return /* @__PURE__ */ jsxs(MessagePrimitive.Root, {
|
|
241
|
+
...shared,
|
|
242
|
+
className: cn(highlight, "-mx-2 flex flex-col items-end gap-1.5 p-2"),
|
|
243
|
+
children: [header, /* @__PURE__ */ jsx("div", {
|
|
244
|
+
className: "max-w-[85%] rounded-2xl bg-muted px-4 py-2 wrap-break-word text-foreground",
|
|
245
|
+
children: /* @__PURE__ */ jsx(MessagePrimitive.Parts, { components: { Text: MarkdownText } })
|
|
246
|
+
})]
|
|
247
|
+
});
|
|
248
|
+
return /* @__PURE__ */ jsxs(MessagePrimitive.Root, {
|
|
249
|
+
...shared,
|
|
250
|
+
className: cn(highlight, "-mx-2 flex flex-col gap-1 p-2"),
|
|
251
|
+
children: [
|
|
252
|
+
header,
|
|
253
|
+
/* @__PURE__ */ jsx("div", {
|
|
254
|
+
className: "leading-relaxed wrap-break-word text-foreground",
|
|
255
|
+
children: /* @__PURE__ */ jsx(AssistantParts, {})
|
|
256
|
+
}),
|
|
257
|
+
onRate ? /* @__PURE__ */ jsx(StarRating, {
|
|
258
|
+
size: "sm",
|
|
259
|
+
label: `Rate ${author}'s message at ${time}`,
|
|
260
|
+
clearable: true,
|
|
261
|
+
...ratings ? { value: ratings[id] ?? null } : {},
|
|
262
|
+
onValueChange: (value) => onRate(id, value),
|
|
263
|
+
className: "-ms-1 -mt-4.5"
|
|
264
|
+
}) : null
|
|
265
|
+
]
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function TranscriptSkeleton() {
|
|
269
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
270
|
+
role: "status",
|
|
271
|
+
className: "flex flex-col gap-6",
|
|
272
|
+
"data-slot": "transcript-loading",
|
|
273
|
+
children: [
|
|
274
|
+
/* @__PURE__ */ jsx("span", {
|
|
275
|
+
className: "sr-only",
|
|
276
|
+
children: "Loading conversation"
|
|
277
|
+
}),
|
|
278
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "ml-auto h-9 w-2/5 rounded-2xl" }),
|
|
279
|
+
/* @__PURE__ */ jsxs("div", {
|
|
280
|
+
className: "flex flex-col gap-2",
|
|
281
|
+
children: [
|
|
282
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-11/12" }),
|
|
283
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4/5" }),
|
|
284
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-3/5" })
|
|
285
|
+
]
|
|
286
|
+
}),
|
|
287
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "ml-auto h-9 w-1/3 rounded-2xl" }),
|
|
288
|
+
/* @__PURE__ */ jsxs("div", {
|
|
289
|
+
className: "flex flex-col gap-2",
|
|
290
|
+
children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-10/12" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-2/3" })]
|
|
291
|
+
})
|
|
292
|
+
]
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
const noSend = async () => {};
|
|
296
|
+
/**
|
|
297
|
+
* How a scrolled edge fades: fully clear for the outer 0.75rem, then ramping
|
|
298
|
+
* in by 2rem, past one text line (1.25rem). A line the scroll box cuts sits
|
|
299
|
+
* in the clear band or the faint start of the ramp, so it dissolves instead
|
|
300
|
+
* of reading as sliced against the pane's border. Only an edge with content
|
|
301
|
+
* scrolled past it fades, so content at rest is never faded.
|
|
302
|
+
*/
|
|
303
|
+
const EDGE_CLEAR = "0.75rem";
|
|
304
|
+
const EDGE_FADE = "2rem";
|
|
305
|
+
function RetryButton({ onRetry }) {
|
|
306
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
307
|
+
variant: "outline",
|
|
308
|
+
size: "xs",
|
|
309
|
+
className: "text-foreground",
|
|
310
|
+
onClick: () => onRetry(),
|
|
311
|
+
children: [/* @__PURE__ */ jsx(RotateCwIcon, { "aria-hidden": "true" }), "Retry"]
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* A read-only past conversation, with no composer. It converts the
|
|
316
|
+
* `TranscriptMessage` props to assistant-ui messages internally and draws
|
|
317
|
+
* them with the registry's message rendering: markdown text, collapsible
|
|
318
|
+
* reasoning, and each tool call as a ToolCallChip that expands to the call's
|
|
319
|
+
* arguments and result (tool-fallback).
|
|
320
|
+
*
|
|
321
|
+
* It opens at the latest message, as a conversation does, so a run that
|
|
322
|
+
* ended in an error or mid-call shows its end. Every message and tool call
|
|
323
|
+
* has a stable anchor (`transcriptAnchorId`). Following one calls
|
|
324
|
+
* `onAnchor`; setting `highlightId` scrolls to that message or call (instead
|
|
325
|
+
* of the end) and highlights it. With `onRate`, each assistant message gets a
|
|
326
|
+
* star rating.
|
|
327
|
+
*/
|
|
328
|
+
function TranscriptViewer(props) {
|
|
329
|
+
const { messages, label = "Transcript", highlightId: _highlightId, defaultHighlightId: _defaultHighlightId, onAnchor: _onAnchor, anchorPrefix = "transcript-", onRate, ratings, formatTime = defaultFormatTime, isLoading = false, error, onRetry, emptyLabel = "No messages in this conversation", className, ref, style, onScroll, ...rest } = props;
|
|
330
|
+
const sectionRef = React.useRef(null);
|
|
331
|
+
const reduced = useReducedMotionConfig() ?? false;
|
|
332
|
+
const controllable = {};
|
|
333
|
+
if (_highlightId !== void 0) controllable.highlightId = _highlightId;
|
|
334
|
+
if (_defaultHighlightId !== void 0) controllable.defaultHighlightId = _defaultHighlightId;
|
|
335
|
+
if (_onAnchor) controllable.onAnchor = _onAnchor;
|
|
336
|
+
const [highlightId, setHighlightId] = useControllableValue(controllable, {
|
|
337
|
+
valuePropName: "highlightId",
|
|
338
|
+
defaultValuePropName: "defaultHighlightId",
|
|
339
|
+
trigger: "onAnchor",
|
|
340
|
+
defaultValue: null
|
|
341
|
+
});
|
|
342
|
+
const threadMessages = React.useMemo(() => toThreadMessages(messages), [messages]);
|
|
343
|
+
const records = React.useMemo(() => new Map(messages.map((message) => [message.id, message])), [messages]);
|
|
344
|
+
const toolCalls = React.useMemo(() => new Map(messages.flatMap((message) => (message.toolCalls ?? []).map((toolCall) => [toolCall.id, toolCall]))), [messages]);
|
|
345
|
+
const runtime = useExternalStoreRuntime({
|
|
346
|
+
messages: threadMessages,
|
|
347
|
+
convertMessage: (message) => message,
|
|
348
|
+
isDisabled: true,
|
|
349
|
+
onNew: noSend
|
|
350
|
+
});
|
|
351
|
+
const openedAtEnd = React.useRef(false);
|
|
352
|
+
const hasMessages = messages.length > 0;
|
|
353
|
+
React.useLayoutEffect(() => {
|
|
354
|
+
if (openedAtEnd.current || !hasMessages || isLoading) return;
|
|
355
|
+
openedAtEnd.current = true;
|
|
356
|
+
const section = sectionRef.current;
|
|
357
|
+
if (!highlightId && section) section.scrollTop = section.scrollHeight;
|
|
358
|
+
}, [
|
|
359
|
+
hasMessages,
|
|
360
|
+
isLoading,
|
|
361
|
+
highlightId
|
|
362
|
+
]);
|
|
363
|
+
const [edges, setEdges] = React.useState({
|
|
364
|
+
top: false,
|
|
365
|
+
bottom: false
|
|
366
|
+
});
|
|
367
|
+
const measureEdges = React.useCallback(() => {
|
|
368
|
+
const section = sectionRef.current;
|
|
369
|
+
if (!section) return;
|
|
370
|
+
const top = section.scrollTop > 1;
|
|
371
|
+
const bottom = section.scrollTop + section.clientHeight < section.scrollHeight - 1;
|
|
372
|
+
setEdges((current) => current.top === top && current.bottom === bottom ? current : {
|
|
373
|
+
top,
|
|
374
|
+
bottom
|
|
375
|
+
});
|
|
376
|
+
}, []);
|
|
377
|
+
React.useLayoutEffect(measureEdges);
|
|
378
|
+
const edgeFade = edges.top || edges.bottom ? `linear-gradient(to bottom, ${edges.top ? `transparent ${EDGE_CLEAR}` : "#000"}, #000 ${EDGE_FADE}, #000 calc(100% - ${EDGE_FADE}), ${edges.bottom ? `transparent calc(100% - ${EDGE_CLEAR})` : "#000"})` : void 0;
|
|
379
|
+
React.useEffect(() => {
|
|
380
|
+
if (!highlightId || isLoading) return;
|
|
381
|
+
document.getElementById(transcriptAnchorId(highlightId, anchorPrefix))?.scrollIntoView({
|
|
382
|
+
block: "center",
|
|
383
|
+
behavior: reduced ? "auto" : "smooth"
|
|
384
|
+
});
|
|
385
|
+
}, [
|
|
386
|
+
highlightId,
|
|
387
|
+
anchorPrefix,
|
|
388
|
+
isLoading,
|
|
389
|
+
reduced
|
|
390
|
+
]);
|
|
391
|
+
const context = React.useMemo(() => ({
|
|
392
|
+
records,
|
|
393
|
+
toolCalls,
|
|
394
|
+
anchorPrefix,
|
|
395
|
+
highlightId: highlightId ?? null,
|
|
396
|
+
follow: (id) => setHighlightId(id),
|
|
397
|
+
formatTime,
|
|
398
|
+
onRate,
|
|
399
|
+
ratings
|
|
400
|
+
}), [
|
|
401
|
+
records,
|
|
402
|
+
toolCalls,
|
|
403
|
+
anchorPrefix,
|
|
404
|
+
highlightId,
|
|
405
|
+
setHighlightId,
|
|
406
|
+
formatTime,
|
|
407
|
+
onRate,
|
|
408
|
+
ratings
|
|
409
|
+
]);
|
|
410
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
411
|
+
"aria-label": label,
|
|
412
|
+
"aria-busy": isLoading || void 0,
|
|
413
|
+
"data-slot": "transcript-viewer",
|
|
414
|
+
className: cn("@container/transcript flex flex-col overflow-y-auto text-sm", className),
|
|
415
|
+
...rest,
|
|
416
|
+
style: edgeFade ? {
|
|
417
|
+
...style,
|
|
418
|
+
maskImage: edgeFade,
|
|
419
|
+
WebkitMaskImage: edgeFade
|
|
420
|
+
} : style,
|
|
421
|
+
onScroll: (event) => {
|
|
422
|
+
measureEdges();
|
|
423
|
+
onScroll?.(event);
|
|
424
|
+
},
|
|
425
|
+
ref: (element) => {
|
|
426
|
+
sectionRef.current = element;
|
|
427
|
+
if (typeof ref === "function") return ref(element);
|
|
428
|
+
if (ref) ref.current = element;
|
|
429
|
+
},
|
|
430
|
+
children: [messages.length === 0 && error ? /* @__PURE__ */ jsxs(Empty, {
|
|
431
|
+
"data-slot": "transcript-error",
|
|
432
|
+
role: "alert",
|
|
433
|
+
className: "border",
|
|
434
|
+
children: [/* @__PURE__ */ jsxs(EmptyHeader, { children: [/* @__PURE__ */ jsx(EmptyMedia, {
|
|
435
|
+
variant: "icon",
|
|
436
|
+
className: "bg-destructive/10 text-destructive",
|
|
437
|
+
children: /* @__PURE__ */ jsx(AlertCircleIcon, { "aria-hidden": "true" })
|
|
438
|
+
}), /* @__PURE__ */ jsx(EmptyTitle, {
|
|
439
|
+
className: "wrap-break-word",
|
|
440
|
+
children: error
|
|
441
|
+
})] }), onRetry ? /* @__PURE__ */ jsx(EmptyContent, { children: /* @__PURE__ */ jsx(RetryButton, { onRetry }) }) : null]
|
|
442
|
+
}) : isLoading && messages.length === 0 ? /* @__PURE__ */ jsx(TranscriptSkeleton, {}) : messages.length === 0 ? /* @__PURE__ */ jsx(Empty, {
|
|
443
|
+
"data-slot": "transcript-empty",
|
|
444
|
+
className: "border",
|
|
445
|
+
children: /* @__PURE__ */ jsxs(EmptyHeader, { children: [/* @__PURE__ */ jsx(EmptyTitle, { children: emptyLabel }), /* @__PURE__ */ jsx(EmptyDescription, { children: "Messages show here once the conversation has any." })] })
|
|
446
|
+
}) : /* @__PURE__ */ jsx(TranscriptContext.Provider, {
|
|
447
|
+
value: context,
|
|
448
|
+
children: /* @__PURE__ */ jsx(AssistantRuntimeProvider, {
|
|
449
|
+
runtime,
|
|
450
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
451
|
+
className: "flex flex-col gap-4",
|
|
452
|
+
children: /* @__PURE__ */ jsx(ThreadPrimitive.Messages, { children: () => /* @__PURE__ */ jsx(MessageView, {}) })
|
|
453
|
+
})
|
|
454
|
+
})
|
|
455
|
+
}), error && messages.length > 0 ? /* @__PURE__ */ jsxs(Alert, {
|
|
456
|
+
variant: "destructive",
|
|
457
|
+
"data-slot": "transcript-error",
|
|
458
|
+
className: "mt-4",
|
|
459
|
+
children: [
|
|
460
|
+
/* @__PURE__ */ jsx(AlertCircleIcon, { "aria-hidden": "true" }),
|
|
461
|
+
/* @__PURE__ */ jsx(AlertTitle, {
|
|
462
|
+
className: "min-w-0 wrap-break-word",
|
|
463
|
+
children: error
|
|
464
|
+
}),
|
|
465
|
+
onRetry ? /* @__PURE__ */ jsx(AlertAction, { children: /* @__PURE__ */ jsx(RetryButton, { onRetry }) }) : null
|
|
466
|
+
]
|
|
467
|
+
}) : null]
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
//#endregion
|
|
471
|
+
export { TranscriptViewer, transcriptAnchorId };
|