@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,644 @@
|
|
|
1
|
+
import { Alert, AlertTitle } from "../../../components/ui/alert.js";
|
|
2
|
+
import { Button } from "../../../components/ui/button.js";
|
|
3
|
+
import { Badge } from "../../../components/ui/badge.js";
|
|
4
|
+
import { CollapsibleTrigger } from "../../../components/ui/collapsible.js";
|
|
5
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../../components/ui/popover.js";
|
|
6
|
+
import { Skeleton } from "../../../components/ui/skeleton.js";
|
|
7
|
+
import { BranchMenu } from "../../../motion/branch-menu/branch-menu.js";
|
|
8
|
+
import { DictationButton } from "../../../motion/dictation-button/dictation-button.js";
|
|
9
|
+
import { PromptComposer } from "../../../motion/prompt-composer/prompt-composer.js";
|
|
10
|
+
import { ScrubSelect } from "../../../motion/scrub-select/scrub-select.js";
|
|
11
|
+
import { StarRating } from "../../../motion/star-rating/star-rating.js";
|
|
12
|
+
import { StatusGlyph } from "../../../motion/status-glyph/status-glyph.js";
|
|
13
|
+
import { formatElapsed } from "../../../lib/elapsed.js";
|
|
14
|
+
import { ThinkingTrace } from "../../../motion/thinking-trace/thinking-trace.js";
|
|
15
|
+
import { ToolCallChip } from "../../../motion/tool-call-chip/tool-call-chip.js";
|
|
16
|
+
import { WorkingIndicator } from "../../../motion/working-indicator/working-indicator.js";
|
|
17
|
+
import { MarkdownText } from "../../../components/assistant-ui/elements/markdown-text.js";
|
|
18
|
+
import { ToolFallback } from "../../../components/assistant-ui/elements/tool-fallback.aui.js";
|
|
19
|
+
import { summarizeArgs } from "../tool-approval/json-args.js";
|
|
20
|
+
import { ToolApproval } from "../tool-approval/tool-approval.js";
|
|
21
|
+
import { ToolCallJson, formatToolValue, toolCallTriggerClassName, useRevealOnOpen } from "../tool-call-row/tool-call-row.js";
|
|
22
|
+
import { UsageMeter } from "../usage-meter/usage-meter.js";
|
|
23
|
+
import * as React from "react";
|
|
24
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
25
|
+
import { cn } from "cn";
|
|
26
|
+
import { AlertCircleIcon, ArrowDownIcon, ChevronRightIcon, ShieldAlertIcon, SlidersHorizontalIcon, WrenchIcon } from "lucide-react";
|
|
27
|
+
import { useSize } from "ahooks";
|
|
28
|
+
import { AuiIf, MessagePrimitive, ThreadPrimitive, groupPartByType, useAui, useAuiState } from "@assistant-ui/react";
|
|
29
|
+
//#region src/ai/compositions/agent-console/agent-console.tsx
|
|
30
|
+
/** Narrower than this, the header collapses into a details popover. */
|
|
31
|
+
const NARROW_WIDTH = 560;
|
|
32
|
+
const STATUS_LABEL = {
|
|
33
|
+
idle: "Idle",
|
|
34
|
+
working: "Working",
|
|
35
|
+
blocked: "Blocked",
|
|
36
|
+
failed: "Failed"
|
|
37
|
+
};
|
|
38
|
+
const STATUS_GLYPH = {
|
|
39
|
+
idle: "pending",
|
|
40
|
+
working: "running",
|
|
41
|
+
blocked: "cancelled",
|
|
42
|
+
failed: "failed"
|
|
43
|
+
};
|
|
44
|
+
const ConsoleContext = React.createContext(null);
|
|
45
|
+
function useConsole() {
|
|
46
|
+
const context = React.useContext(ConsoleContext);
|
|
47
|
+
if (!context) throw new Error("AgentConsole parts must render inside AgentConsole");
|
|
48
|
+
return context;
|
|
49
|
+
}
|
|
50
|
+
function collectDangerous(tools, into = /* @__PURE__ */ new Set()) {
|
|
51
|
+
for (const tool of tools) {
|
|
52
|
+
if (tool.dangerous) into.add(tool.id);
|
|
53
|
+
if (tool.children) collectDangerous(tool.children, into);
|
|
54
|
+
}
|
|
55
|
+
return into;
|
|
56
|
+
}
|
|
57
|
+
function countTools(tools) {
|
|
58
|
+
return tools.reduce((total, tool) => total + (tool.children ? countTools(tool.children) : 1), 0);
|
|
59
|
+
}
|
|
60
|
+
function toMenuItems(tools) {
|
|
61
|
+
return tools.map((tool) => tool.children ? {
|
|
62
|
+
id: tool.id,
|
|
63
|
+
label: tool.label ?? tool.id,
|
|
64
|
+
children: toMenuItems(tool.children)
|
|
65
|
+
} : {
|
|
66
|
+
id: tool.id,
|
|
67
|
+
label: tool.label ?? tool.id,
|
|
68
|
+
icon: tool.dangerous ? /* @__PURE__ */ jsx(ShieldAlertIcon, {
|
|
69
|
+
"aria-label": "Dangerous",
|
|
70
|
+
className: "text-destructive"
|
|
71
|
+
}) : /* @__PURE__ */ jsx(WrenchIcon, {})
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A chat with one agent, on the app's assistant-ui runtime. The header shows
|
|
76
|
+
* the agent's name, model and status, a compact UsageMeter and its scoped
|
|
77
|
+
* tool list (a BranchMenu in a popover). The thread streams the agent's
|
|
78
|
+
* reasoning as a ThinkingTrace, each tool call as a ToolCallChip that
|
|
79
|
+
* expands to its arguments and result (tool-fallback), and a gated call as a
|
|
80
|
+
* ToolApproval card. A WorkingIndicator runs while the agent works, and with
|
|
81
|
+
* `onRate` each finished answer gets a StarRating. The composer is a
|
|
82
|
+
* PromptComposer with a ScrubSelect model picker and a DictationButton.
|
|
83
|
+
*
|
|
84
|
+
* AgentConsole renders inside the app's `AssistantRuntimeProvider` and never
|
|
85
|
+
* creates a runtime: messages, streaming, approvals and cancelling all go
|
|
86
|
+
* through it. A run error shows in place, under its message, and the
|
|
87
|
+
* conversation stays on screen. Below 35rem the header collapses into a
|
|
88
|
+
* details popover, and the composer stays pinned to the bottom.
|
|
89
|
+
*/
|
|
90
|
+
function AgentConsole(props) {
|
|
91
|
+
const { name, status: statusProp, statusDetail, usage, tools = [], onToolSelect, onToolDecision, models = [], model: modelProp, defaultModel, onModelChange, efforts, effort, defaultEffort, onEffortChange, sources, commands, onAttach, dictation, onSend, onRate, ratings, placeholder, className } = props;
|
|
92
|
+
const aui = useAui();
|
|
93
|
+
const rootRef = React.useRef(null);
|
|
94
|
+
const size = useSize(rootRef);
|
|
95
|
+
const narrow = size !== void 0 && size.width < NARROW_WIDTH;
|
|
96
|
+
const isRunning = useAuiState((s) => s.thread.isRunning);
|
|
97
|
+
const isDisabled = useAuiState((s) => s.thread.isDisabled);
|
|
98
|
+
const awaitingApproval = useAuiState((s) => s.thread.messages.at(-1)?.status?.type === "requires-action");
|
|
99
|
+
const lastRunFailed = useAuiState((s) => {
|
|
100
|
+
const last = s.thread.messages.at(-1);
|
|
101
|
+
return last?.role === "assistant" && last.status?.type === "incomplete" && last.status.reason === "error";
|
|
102
|
+
});
|
|
103
|
+
const status = statusProp ?? (awaitingApproval ? "blocked" : isRunning ? "working" : "idle");
|
|
104
|
+
const headerStatus = !statusProp && status === "idle" && lastRunFailed ? "failed" : status;
|
|
105
|
+
const detail = statusDetail ?? (statusProp ? void 0 : awaitingApproval ? "Waiting for your approval" : void 0);
|
|
106
|
+
const [uncontrolledModel, setUncontrolledModel] = React.useState(defaultModel ?? models[0]?.value ?? null);
|
|
107
|
+
const model = modelProp ?? uncontrolledModel;
|
|
108
|
+
const modelLabel = models.find((option) => option.value === model)?.label ?? usage?.model;
|
|
109
|
+
React.useEffect(() => {
|
|
110
|
+
if (!model) return;
|
|
111
|
+
const config = { config: { modelName: model } };
|
|
112
|
+
return aui.modelContext().register({ getModelContext: () => config });
|
|
113
|
+
}, [aui, model]);
|
|
114
|
+
const context = React.useMemo(() => ({
|
|
115
|
+
name,
|
|
116
|
+
dangerous: collectDangerous(tools),
|
|
117
|
+
onToolDecision,
|
|
118
|
+
onRate,
|
|
119
|
+
ratings
|
|
120
|
+
}), [
|
|
121
|
+
name,
|
|
122
|
+
tools,
|
|
123
|
+
onToolDecision,
|
|
124
|
+
onRate,
|
|
125
|
+
ratings
|
|
126
|
+
]);
|
|
127
|
+
const send = (text, sendDetail) => {
|
|
128
|
+
aui.thread().append(text);
|
|
129
|
+
onSend?.(text, {
|
|
130
|
+
...sendDetail,
|
|
131
|
+
...model ? { model } : {}
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
const modelPicker = models.length > 0 ? /* @__PURE__ */ jsx(ScrubSelect, {
|
|
135
|
+
label: "Model",
|
|
136
|
+
size: "default",
|
|
137
|
+
options: [...models],
|
|
138
|
+
value: model,
|
|
139
|
+
disabled: isDisabled,
|
|
140
|
+
onValueChange: (next) => {
|
|
141
|
+
if (modelProp === void 0) setUncontrolledModel(next);
|
|
142
|
+
onModelChange?.(next);
|
|
143
|
+
},
|
|
144
|
+
className: "border-transparent bg-transparent hover:bg-muted dark:bg-transparent dark:hover:bg-muted/50"
|
|
145
|
+
}) : void 0;
|
|
146
|
+
return /* @__PURE__ */ jsx(ConsoleContext.Provider, {
|
|
147
|
+
value: context,
|
|
148
|
+
children: /* @__PURE__ */ jsxs("section", {
|
|
149
|
+
ref: rootRef,
|
|
150
|
+
"aria-label": `${name} console`,
|
|
151
|
+
"data-slot": "agent-console",
|
|
152
|
+
"data-narrow": narrow || void 0,
|
|
153
|
+
className: cn("flex h-full min-h-0 w-full flex-col overflow-hidden bg-background text-sm", className),
|
|
154
|
+
children: [
|
|
155
|
+
/* @__PURE__ */ jsx(ConsoleHeader, {
|
|
156
|
+
name,
|
|
157
|
+
width: size?.width,
|
|
158
|
+
status: headerStatus,
|
|
159
|
+
detail,
|
|
160
|
+
modelLabel,
|
|
161
|
+
usage,
|
|
162
|
+
tools,
|
|
163
|
+
onToolSelect,
|
|
164
|
+
narrow
|
|
165
|
+
}),
|
|
166
|
+
/* @__PURE__ */ jsxs(ThreadPrimitive.Root, {
|
|
167
|
+
className: "relative flex min-h-0 flex-1 flex-col",
|
|
168
|
+
children: [/* @__PURE__ */ jsx(ThreadPrimitive.Viewport, {
|
|
169
|
+
"data-slot": "agent-console-viewport",
|
|
170
|
+
className: "flex min-h-0 flex-1 flex-col overflow-y-auto [mask-image:linear-gradient(to_bottom,transparent,black_1rem,black_calc(100%-1.25rem),transparent)]",
|
|
171
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
172
|
+
className: "mx-auto flex w-full max-w-3xl flex-1 flex-col gap-6 px-4 pt-4 pb-6",
|
|
173
|
+
children: [
|
|
174
|
+
/* @__PURE__ */ jsx(AuiIf, {
|
|
175
|
+
condition: (s) => s.thread.messages.length === 0 && !s.thread.isLoading,
|
|
176
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
177
|
+
className: "my-auto flex flex-col items-center gap-1 py-10 text-center",
|
|
178
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
179
|
+
className: "font-heading text-base font-medium",
|
|
180
|
+
children: [
|
|
181
|
+
"Ask ",
|
|
182
|
+
name,
|
|
183
|
+
" anything"
|
|
184
|
+
]
|
|
185
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
186
|
+
className: "text-muted-foreground text-xs",
|
|
187
|
+
children: "It can only use the tools in its scope."
|
|
188
|
+
})]
|
|
189
|
+
})
|
|
190
|
+
}),
|
|
191
|
+
/* @__PURE__ */ jsx(AuiIf, {
|
|
192
|
+
condition: (s) => s.thread.messages.length === 0 && s.thread.isLoading,
|
|
193
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
194
|
+
role: "status",
|
|
195
|
+
"data-slot": "agent-console-loading",
|
|
196
|
+
className: "flex flex-col gap-6",
|
|
197
|
+
children: [
|
|
198
|
+
/* @__PURE__ */ jsx("span", {
|
|
199
|
+
className: "sr-only",
|
|
200
|
+
children: "Loading conversation"
|
|
201
|
+
}),
|
|
202
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "ml-auto h-9 w-2/5 rounded-2xl" }),
|
|
203
|
+
/* @__PURE__ */ jsxs("div", {
|
|
204
|
+
className: "flex flex-col gap-2",
|
|
205
|
+
children: [
|
|
206
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-11/12" }),
|
|
207
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4/5" }),
|
|
208
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-3/5" })
|
|
209
|
+
]
|
|
210
|
+
}),
|
|
211
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "ml-auto h-9 w-1/3 rounded-2xl" })
|
|
212
|
+
]
|
|
213
|
+
})
|
|
214
|
+
}),
|
|
215
|
+
/* @__PURE__ */ jsx(ThreadPrimitive.Messages, { children: () => /* @__PURE__ */ jsx(ConsoleMessage, {}) })
|
|
216
|
+
]
|
|
217
|
+
})
|
|
218
|
+
}), /* @__PURE__ */ jsx(ThreadPrimitive.ScrollToBottom, {
|
|
219
|
+
behavior: "smooth",
|
|
220
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
221
|
+
variant: "outline",
|
|
222
|
+
size: "icon-sm",
|
|
223
|
+
"aria-label": "Scroll to the latest message",
|
|
224
|
+
className: "absolute right-6 bottom-3 rounded-full bg-background shadow-sm disabled:invisible dark:bg-background"
|
|
225
|
+
}),
|
|
226
|
+
children: /* @__PURE__ */ jsx(ArrowDownIcon, { "aria-hidden": "true" })
|
|
227
|
+
})]
|
|
228
|
+
}),
|
|
229
|
+
/* @__PURE__ */ jsx("div", {
|
|
230
|
+
"data-slot": "agent-console-composer",
|
|
231
|
+
className: "mx-auto w-full max-w-3xl shrink-0 px-4 pt-1 pb-4",
|
|
232
|
+
children: /* @__PURE__ */ jsx(PromptComposer, {
|
|
233
|
+
label: `Message ${name}`,
|
|
234
|
+
placeholder: placeholder ?? `Message ${name}`,
|
|
235
|
+
onSend: send,
|
|
236
|
+
busy: isRunning,
|
|
237
|
+
onStop: () => aui.thread().cancelRun(),
|
|
238
|
+
disabled: isDisabled,
|
|
239
|
+
modelPicker,
|
|
240
|
+
...efforts !== void 0 ? { efforts } : {},
|
|
241
|
+
...effort !== void 0 ? { effort } : {},
|
|
242
|
+
...defaultEffort !== void 0 ? { defaultEffort } : {},
|
|
243
|
+
...onEffortChange !== void 0 ? { onEffortChange } : {},
|
|
244
|
+
...sources !== void 0 ? { sources } : {},
|
|
245
|
+
...commands !== void 0 ? { commands } : {},
|
|
246
|
+
...onAttach !== void 0 ? { onAttach } : {},
|
|
247
|
+
dictation: dictation ? /* @__PURE__ */ jsx(DictationButton, {
|
|
248
|
+
...dictation,
|
|
249
|
+
disabled: isDisabled,
|
|
250
|
+
className: "me-0.5 focus-visible:bg-muted focus-visible:text-foreground focus-visible:ring-2 focus-visible:ring-ring/30"
|
|
251
|
+
}) : void 0
|
|
252
|
+
})
|
|
253
|
+
})
|
|
254
|
+
]
|
|
255
|
+
})
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function StatusBadge({ status, detail, narrow }) {
|
|
259
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
260
|
+
role: "status",
|
|
261
|
+
"data-slot": "agent-console-status",
|
|
262
|
+
"data-status": status,
|
|
263
|
+
className: "inline-flex min-w-0 items-center gap-1.5 text-muted-foreground text-xs",
|
|
264
|
+
children: [
|
|
265
|
+
/* @__PURE__ */ jsx(StatusGlyph, {
|
|
266
|
+
"aria-hidden": "true",
|
|
267
|
+
status: STATUS_GLYPH[status],
|
|
268
|
+
size: 14,
|
|
269
|
+
className: cn(status === "blocked" && "[&_svg]:text-warning dark:[&_svg]:text-warning")
|
|
270
|
+
}),
|
|
271
|
+
/* @__PURE__ */ jsx("span", {
|
|
272
|
+
className: "shrink-0 font-medium text-foreground",
|
|
273
|
+
children: STATUS_LABEL[status]
|
|
274
|
+
}),
|
|
275
|
+
detail ? /* @__PURE__ */ jsxs("span", {
|
|
276
|
+
className: cn("truncate", narrow && "sr-only"),
|
|
277
|
+
"data-slot": "agent-console-status-detail",
|
|
278
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
279
|
+
"aria-hidden": "true",
|
|
280
|
+
children: "· "
|
|
281
|
+
}), detail]
|
|
282
|
+
}) : null
|
|
283
|
+
]
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
function ConsoleHeader({ name, status, detail, modelLabel, usage, tools, onToolSelect, narrow, width }) {
|
|
287
|
+
const toolCount = countTools(tools);
|
|
288
|
+
const menuItems = React.useMemo(() => toMenuItems(tools), [tools]);
|
|
289
|
+
const scopes = React.useMemo(() => tools.filter((tool) => tool.children).map((tool) => tool.id), [tools]);
|
|
290
|
+
const hasDetails = toolCount > 0 || narrow && (usage !== void 0 || modelLabel);
|
|
291
|
+
const meterUsage = React.useMemo(() => {
|
|
292
|
+
if (!usage || !modelLabel) return usage;
|
|
293
|
+
const { model: _model, ...rest } = usage;
|
|
294
|
+
return rest;
|
|
295
|
+
}, [usage, modelLabel]);
|
|
296
|
+
const popupRef = React.useRef(null);
|
|
297
|
+
const toolList = toolCount > 0 ? /* @__PURE__ */ jsx(BranchMenu, {
|
|
298
|
+
label: `${name} tools`,
|
|
299
|
+
items: menuItems,
|
|
300
|
+
defaultExpanded: scopes,
|
|
301
|
+
onActiveChange: (id) => onToolSelect?.(id),
|
|
302
|
+
className: "max-h-80 overflow-y-auto"
|
|
303
|
+
}) : null;
|
|
304
|
+
return /* @__PURE__ */ jsxs("header", {
|
|
305
|
+
"data-slot": "agent-console-header",
|
|
306
|
+
className: "flex shrink-0 items-center gap-3 border-b px-4 py-2.5",
|
|
307
|
+
children: [
|
|
308
|
+
/* @__PURE__ */ jsxs("div", {
|
|
309
|
+
className: "flex min-w-0 flex-1 flex-col gap-0.5",
|
|
310
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
311
|
+
className: "flex min-w-0 items-center gap-2.5",
|
|
312
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
313
|
+
className: "truncate font-heading text-sm font-medium",
|
|
314
|
+
children: name
|
|
315
|
+
}), /* @__PURE__ */ jsx(StatusBadge, {
|
|
316
|
+
status,
|
|
317
|
+
detail,
|
|
318
|
+
narrow
|
|
319
|
+
})]
|
|
320
|
+
}), modelLabel && !narrow ? /* @__PURE__ */ jsx("p", {
|
|
321
|
+
className: "truncate text-muted-foreground text-xs",
|
|
322
|
+
children: modelLabel
|
|
323
|
+
}) : null]
|
|
324
|
+
}),
|
|
325
|
+
meterUsage && !narrow ? /* @__PURE__ */ jsx(UsageMeter, {
|
|
326
|
+
usage: meterUsage,
|
|
327
|
+
scope: "thread",
|
|
328
|
+
className: "shrink"
|
|
329
|
+
}) : null,
|
|
330
|
+
hasDetails ? /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
331
|
+
render: narrow ? /* @__PURE__ */ jsx(Button, {
|
|
332
|
+
variant: "outline",
|
|
333
|
+
size: "icon",
|
|
334
|
+
"aria-label": `${name} details`,
|
|
335
|
+
className: "shrink-0"
|
|
336
|
+
}) : /* @__PURE__ */ jsx(Button, {
|
|
337
|
+
variant: "outline",
|
|
338
|
+
size: "sm",
|
|
339
|
+
className: "shrink-0"
|
|
340
|
+
}),
|
|
341
|
+
children: narrow ? /* @__PURE__ */ jsx(SlidersHorizontalIcon, { "aria-hidden": "true" }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
342
|
+
/* @__PURE__ */ jsx(WrenchIcon, { "aria-hidden": "true" }),
|
|
343
|
+
"Tools",
|
|
344
|
+
/* @__PURE__ */ jsx(Badge, {
|
|
345
|
+
variant: "secondary",
|
|
346
|
+
className: "h-4 min-w-4 px-1 text-[0.625rem]",
|
|
347
|
+
children: toolCount
|
|
348
|
+
})
|
|
349
|
+
] })
|
|
350
|
+
}), /* @__PURE__ */ jsxs(PopoverContent, {
|
|
351
|
+
ref: popupRef,
|
|
352
|
+
tabIndex: -1,
|
|
353
|
+
initialFocus: popupRef,
|
|
354
|
+
align: "end",
|
|
355
|
+
className: "w-80 max-w-[calc(100vw-2rem)] gap-3",
|
|
356
|
+
style: narrow && width !== void 0 ? { width: width - 32 } : void 0,
|
|
357
|
+
"aria-label": narrow ? `${name} details` : `${name} tools`,
|
|
358
|
+
children: [narrow && (modelLabel || usage) ? /* @__PURE__ */ jsxs("div", {
|
|
359
|
+
className: "flex flex-col gap-2 border-b pb-3",
|
|
360
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
361
|
+
className: "flex flex-col gap-1",
|
|
362
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
363
|
+
className: "text-sm font-medium",
|
|
364
|
+
children: "Model and usage"
|
|
365
|
+
}), modelLabel ? /* @__PURE__ */ jsx("p", {
|
|
366
|
+
className: "text-muted-foreground",
|
|
367
|
+
children: modelLabel
|
|
368
|
+
}) : null]
|
|
369
|
+
}), meterUsage ? /* @__PURE__ */ jsx(UsageMeter, {
|
|
370
|
+
usage: meterUsage,
|
|
371
|
+
scope: "thread",
|
|
372
|
+
contextSide: "bottom"
|
|
373
|
+
}) : null]
|
|
374
|
+
}) : null, toolList ? /* @__PURE__ */ jsxs("div", {
|
|
375
|
+
className: "flex flex-col gap-1.5",
|
|
376
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
377
|
+
className: "flex flex-col gap-1",
|
|
378
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
379
|
+
className: "text-sm font-medium",
|
|
380
|
+
children: "Tools in scope"
|
|
381
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
382
|
+
className: "text-muted-foreground",
|
|
383
|
+
children: [
|
|
384
|
+
toolCount,
|
|
385
|
+
" ",
|
|
386
|
+
toolCount === 1 ? "tool" : "tools",
|
|
387
|
+
". Shielded tools need a press-and-hold to approve."
|
|
388
|
+
]
|
|
389
|
+
})]
|
|
390
|
+
}), toolList]
|
|
391
|
+
}) : null]
|
|
392
|
+
})] }) : null
|
|
393
|
+
]
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
const groupBy = groupPartByType({
|
|
397
|
+
reasoning: ["group-reasoning"],
|
|
398
|
+
"tool-call": ["group-tool"]
|
|
399
|
+
});
|
|
400
|
+
/** The settled time of a trace that never visibly ran. */
|
|
401
|
+
const INSTANT = formatElapsed(0);
|
|
402
|
+
/** Splits reasoning into steps: one per sentence, so the trace grows as it streams. */
|
|
403
|
+
function reasoningSteps(text) {
|
|
404
|
+
return text.split(/(?<=[.!?])\s+|\n/).map((step) => step.trim()).filter((step) => step.length > 0);
|
|
405
|
+
}
|
|
406
|
+
function ReasoningGroup({ indices, running }) {
|
|
407
|
+
const steps = reasoningSteps(useAuiState((s) => indices.map((index) => {
|
|
408
|
+
const part = s.message.parts[index];
|
|
409
|
+
return part?.type === "reasoning" ? part.text : "";
|
|
410
|
+
}).join("\n")));
|
|
411
|
+
const [sawRunning] = React.useState(running);
|
|
412
|
+
const streamMs = useAuiState((s) => {
|
|
413
|
+
return s.message.metadata.timing?.totalStreamTime;
|
|
414
|
+
});
|
|
415
|
+
const [wasRunning, setWasRunning] = React.useState(running);
|
|
416
|
+
const [settledMs, setSettledMs] = React.useState(void 0);
|
|
417
|
+
if (wasRunning !== running) {
|
|
418
|
+
setWasRunning(running);
|
|
419
|
+
if (!running && sawRunning && streamMs !== void 0) setSettledMs(streamMs);
|
|
420
|
+
}
|
|
421
|
+
return /* @__PURE__ */ jsx(ThinkingTrace, {
|
|
422
|
+
working: running,
|
|
423
|
+
steps,
|
|
424
|
+
...!running && settledMs !== void 0 ? { elapsedMs: settledMs } : {},
|
|
425
|
+
doneLabel: (elapsed) => sawRunning && elapsed !== INSTANT ? `Thought for ${elapsed}` : "Reasoning",
|
|
426
|
+
className: "py-1"
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
function AssistantParts() {
|
|
430
|
+
return /* @__PURE__ */ jsx(MessagePrimitive.GroupedParts, {
|
|
431
|
+
groupBy,
|
|
432
|
+
indicator: "never",
|
|
433
|
+
children: ({ part, children }) => {
|
|
434
|
+
switch (part.type) {
|
|
435
|
+
case "group-reasoning": return /* @__PURE__ */ jsx(ReasoningGroup, {
|
|
436
|
+
indices: part.indices,
|
|
437
|
+
running: part.status.type === "running"
|
|
438
|
+
});
|
|
439
|
+
case "group-tool": return /* @__PURE__ */ jsx("div", {
|
|
440
|
+
"data-slot": "agent-console-tool-calls",
|
|
441
|
+
className: "flex min-w-0 flex-col items-start gap-1 py-1.5",
|
|
442
|
+
children
|
|
443
|
+
});
|
|
444
|
+
case "text": return /* @__PURE__ */ jsx(MarkdownText, {});
|
|
445
|
+
case "tool-call": return part.toolUI ?? /* @__PURE__ */ jsx(ConsoleToolCall, { ...part });
|
|
446
|
+
default: return /* @__PURE__ */ jsx(Fragment$1, {});
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
function errorText(error) {
|
|
452
|
+
if (typeof error === "string") return error;
|
|
453
|
+
if (error instanceof Error) return error.message;
|
|
454
|
+
return "The run failed.";
|
|
455
|
+
}
|
|
456
|
+
function ConsoleMessage() {
|
|
457
|
+
if (useAuiState((s) => s.message.role) === "user") return /* @__PURE__ */ jsx(MessagePrimitive.Root, {
|
|
458
|
+
"data-slot": "agent-console-user-message",
|
|
459
|
+
className: "flex flex-col items-end",
|
|
460
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
461
|
+
className: "max-w-[85%] rounded-2xl bg-muted px-4 py-2 wrap-break-word text-foreground",
|
|
462
|
+
children: /* @__PURE__ */ jsx(MessagePrimitive.Parts, { components: { Text: MarkdownText } })
|
|
463
|
+
})
|
|
464
|
+
});
|
|
465
|
+
return /* @__PURE__ */ jsx(AssistantMessage, {});
|
|
466
|
+
}
|
|
467
|
+
function AssistantMessage() {
|
|
468
|
+
const { name, onRate, ratings } = useConsole();
|
|
469
|
+
const id = useAuiState((s) => s.message.id);
|
|
470
|
+
const isLast = useAuiState((s) => s.message.isLast);
|
|
471
|
+
const statusType = useAuiState((s) => s.message.status?.type);
|
|
472
|
+
const failure = useAuiState((s) => s.message.status?.type === "incomplete" && s.message.status.reason === "error" ? errorText(s.message.status.error) : null);
|
|
473
|
+
const cancelled = useAuiState((s) => s.message.status?.type === "incomplete" && s.message.status.reason === "cancelled");
|
|
474
|
+
const streamMs = useAuiState((s) => {
|
|
475
|
+
return s.message.metadata.timing?.totalStreamTime;
|
|
476
|
+
});
|
|
477
|
+
const [sawRunning, setSawRunning] = React.useState(statusType === "running");
|
|
478
|
+
if (statusType === "running" && !sawRunning) setSawRunning(true);
|
|
479
|
+
const indicator = !isLast || !sawRunning || statusType === "requires-action" ? null : statusType === "running" ? "working" : failure || cancelled ? "error" : "done";
|
|
480
|
+
return /* @__PURE__ */ jsxs(MessagePrimitive.Root, {
|
|
481
|
+
"data-slot": "agent-console-assistant-message",
|
|
482
|
+
className: "flex flex-col gap-1.5",
|
|
483
|
+
children: [
|
|
484
|
+
/* @__PURE__ */ jsx("div", {
|
|
485
|
+
className: "leading-relaxed wrap-break-word text-foreground",
|
|
486
|
+
children: /* @__PURE__ */ jsx(AssistantParts, {})
|
|
487
|
+
}),
|
|
488
|
+
failure ? /* @__PURE__ */ jsxs(Alert, {
|
|
489
|
+
variant: "destructive",
|
|
490
|
+
"data-slot": "agent-console-run-error",
|
|
491
|
+
children: [/* @__PURE__ */ jsx(AlertCircleIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx(AlertTitle, { children: failure })]
|
|
492
|
+
}) : null,
|
|
493
|
+
indicator ? /* @__PURE__ */ jsx(WorkingIndicator, {
|
|
494
|
+
status: indicator,
|
|
495
|
+
label: `${name} is working`,
|
|
496
|
+
doneLabel: "Done",
|
|
497
|
+
errorLabel: cancelled ? "Stopped" : "Failed",
|
|
498
|
+
...indicator !== "working" && streamMs !== void 0 ? { elapsedMs: streamMs } : {}
|
|
499
|
+
}) : null,
|
|
500
|
+
onRate && statusType === "complete" ? /* @__PURE__ */ jsx(StarRating, {
|
|
501
|
+
size: "sm",
|
|
502
|
+
label: `Rate ${name}'s answer`,
|
|
503
|
+
clearable: true,
|
|
504
|
+
...ratings ? { value: ratings[id] ?? null } : {},
|
|
505
|
+
onValueChange: (value) => onRate(id, value),
|
|
506
|
+
className: "-ms-1"
|
|
507
|
+
}) : null
|
|
508
|
+
]
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
function chipStatus(part) {
|
|
512
|
+
if (part.approval?.approved === false || part.approval?.resolution) return "error";
|
|
513
|
+
if (part.status.type === "running" || part.status.type === "requires-action") return "running";
|
|
514
|
+
if (part.isError || part.status.type === "incomplete") return "error";
|
|
515
|
+
return part.result === void 0 ? "running" : "success";
|
|
516
|
+
}
|
|
517
|
+
function decisionLine(part) {
|
|
518
|
+
const approval = part.approval;
|
|
519
|
+
if (!approval) return null;
|
|
520
|
+
if (approval.resolution) return `Approval ${approval.resolution}`;
|
|
521
|
+
if (approval.approved === false) return `Denied${approval.reason ? `: ${approval.reason}` : ""}`;
|
|
522
|
+
if (approval.approved === true) return "Approved";
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* One tool call. While it waits on the owner it is a ToolApproval card;
|
|
527
|
+
* otherwise a ToolCallChip that expands to its arguments, result or error
|
|
528
|
+
* through the registry's tool-fallback parts.
|
|
529
|
+
*/
|
|
530
|
+
function ConsoleToolCall(part) {
|
|
531
|
+
const { name, dangerous, onToolDecision } = useConsole();
|
|
532
|
+
const [open, setOpen] = React.useState(false);
|
|
533
|
+
const rowRef = useRevealOnOpen(open);
|
|
534
|
+
const [pending, setPending] = React.useState(false);
|
|
535
|
+
const [error, setError] = React.useState(null);
|
|
536
|
+
if (part.approval !== void 0 && part.approval.approved === void 0 && part.approval.resolution === void 0) {
|
|
537
|
+
const args = part.args ?? {};
|
|
538
|
+
const toolCall = {
|
|
539
|
+
id: part.toolCallId,
|
|
540
|
+
name: part.toolName,
|
|
541
|
+
args,
|
|
542
|
+
status: "awaiting-approval",
|
|
543
|
+
dangerous: dangerous.has(part.toolName)
|
|
544
|
+
};
|
|
545
|
+
const respond = (approved, reason) => {
|
|
546
|
+
setPending(true);
|
|
547
|
+
setError(null);
|
|
548
|
+
part.respondToApproval({
|
|
549
|
+
approved,
|
|
550
|
+
...reason ? { reason } : {}
|
|
551
|
+
}).then(() => setPending(false), (failure) => {
|
|
552
|
+
setPending(false);
|
|
553
|
+
setError(errorText(failure));
|
|
554
|
+
});
|
|
555
|
+
};
|
|
556
|
+
const ids = {
|
|
557
|
+
toolCallId: part.toolCallId,
|
|
558
|
+
toolName: part.toolName
|
|
559
|
+
};
|
|
560
|
+
return /* @__PURE__ */ jsx("div", {
|
|
561
|
+
"data-slot": "agent-console-approval",
|
|
562
|
+
className: "w-full py-1",
|
|
563
|
+
children: /* @__PURE__ */ jsx(ToolApproval, {
|
|
564
|
+
toolCall,
|
|
565
|
+
agent: name,
|
|
566
|
+
...part.approval?.prompt ? { description: part.approval.prompt } : {},
|
|
567
|
+
editable: onToolDecision !== void 0,
|
|
568
|
+
pending,
|
|
569
|
+
error,
|
|
570
|
+
onDismissError: () => setError(null),
|
|
571
|
+
onApprove: (amendedArgs) => {
|
|
572
|
+
onToolDecision?.({
|
|
573
|
+
kind: "approve",
|
|
574
|
+
...ids,
|
|
575
|
+
...amendedArgs ? { amendedArgs } : {}
|
|
576
|
+
});
|
|
577
|
+
respond(true);
|
|
578
|
+
},
|
|
579
|
+
onDeny: (reason) => {
|
|
580
|
+
onToolDecision?.({
|
|
581
|
+
kind: "deny",
|
|
582
|
+
...ids,
|
|
583
|
+
...reason ? { reason } : {}
|
|
584
|
+
});
|
|
585
|
+
respond(false, reason);
|
|
586
|
+
},
|
|
587
|
+
...onToolDecision ? { onAlwaysAllow: () => {
|
|
588
|
+
onToolDecision({
|
|
589
|
+
kind: "always-allow",
|
|
590
|
+
...ids
|
|
591
|
+
});
|
|
592
|
+
respond(true);
|
|
593
|
+
} } : {}
|
|
594
|
+
})
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
const status = chipStatus(part);
|
|
598
|
+
const { startedAt, completedAt } = part.timing ?? {};
|
|
599
|
+
const denied = part.approval?.approved === false;
|
|
600
|
+
const elapsedMs = !denied && status !== "running" && startedAt !== void 0 && completedAt !== void 0 ? completedAt - startedAt : void 0;
|
|
601
|
+
const decision = decisionLine(part);
|
|
602
|
+
const statusWord = denied ? "denied" : status === "success" ? "succeeded" : status === "error" ? "failed" : "running";
|
|
603
|
+
const detail = denied ? "denied" : summarizeArgs(part.args ?? {}, 2);
|
|
604
|
+
return /* @__PURE__ */ jsx("div", {
|
|
605
|
+
ref: rowRef,
|
|
606
|
+
"data-slot": "agent-console-tool-call",
|
|
607
|
+
className: "max-w-full scroll-my-6",
|
|
608
|
+
children: /* @__PURE__ */ jsxs(ToolFallback.Root, {
|
|
609
|
+
open,
|
|
610
|
+
onOpenChange: setOpen,
|
|
611
|
+
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
612
|
+
"data-slot": "agent-console-tool-call-trigger",
|
|
613
|
+
"aria-label": `${part.toolName}, ${statusWord}`,
|
|
614
|
+
className: toolCallTriggerClassName,
|
|
615
|
+
children: [/* @__PURE__ */ jsx(ToolCallChip, {
|
|
616
|
+
name: part.toolName,
|
|
617
|
+
detail,
|
|
618
|
+
status,
|
|
619
|
+
...elapsedMs !== void 0 ? { elapsedMs } : {},
|
|
620
|
+
className: cn("min-w-0", denied && "[&>[data-slot=tool-call-chip-time]]:hidden")
|
|
621
|
+
}), /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
622
|
+
"aria-hidden": "true",
|
|
623
|
+
className: "size-3.5 shrink-0 transition-transform duration-200 group-data-panel-open/trigger:rotate-90 motion-reduce:transition-none"
|
|
624
|
+
})]
|
|
625
|
+
}), /* @__PURE__ */ jsxs(ToolFallback.Content, { children: [
|
|
626
|
+
decision ? /* @__PURE__ */ jsx("p", {
|
|
627
|
+
className: "text-muted-foreground text-xs",
|
|
628
|
+
children: decision
|
|
629
|
+
}) : null,
|
|
630
|
+
status === "error" && part.status.type === "incomplete" ? /* @__PURE__ */ jsx(ToolFallback.Error, {
|
|
631
|
+
status: part.status,
|
|
632
|
+
className: "text-xs"
|
|
633
|
+
}) : null,
|
|
634
|
+
part.argsText ? /* @__PURE__ */ jsx(ToolCallJson, { text: part.argsText }) : null,
|
|
635
|
+
part.result !== void 0 ? /* @__PURE__ */ jsx(ToolCallJson, {
|
|
636
|
+
heading: "Result:",
|
|
637
|
+
text: formatToolValue(part.result)
|
|
638
|
+
}) : null
|
|
639
|
+
] })]
|
|
640
|
+
})
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
//#endregion
|
|
644
|
+
export { AgentConsole };
|