@nadicodeai/ui 0.21.0 → 1.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/AGENTS.md +6 -7
- package/LICENSES/PAPER-SHADERS-APACHE-2.0.txt +186 -0
- package/NOTICE +12 -0
- package/README.md +14 -21
- package/dist/agents.d.ts +10 -0
- package/dist/agents.d.ts.map +1 -0
- package/dist/agents.js +10 -0
- package/dist/components/agent-card.d.ts +13 -0
- package/dist/components/agent-card.d.ts.map +1 -0
- package/dist/components/agent-card.js +15 -0
- package/dist/components/agent-visual.d.ts +17 -0
- package/dist/components/agent-visual.d.ts.map +1 -0
- package/dist/components/agent-visual.js +59 -0
- package/dist/components/alert-dialog.js +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/badge.d.ts.map +1 -1
- package/dist/components/badge.js +9 -0
- package/dist/components/button.d.ts +1 -1
- package/dist/components/card.d.ts +5 -3
- package/dist/components/card.d.ts.map +1 -1
- package/dist/components/card.js +7 -7
- package/dist/components/chart.js +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/context-menu.js +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/drawer.js +1 -1
- package/dist/components/dropdown-menu.js +1 -1
- package/dist/components/empty.d.ts +5 -2
- package/dist/components/empty.d.ts.map +1 -1
- package/dist/components/empty.js +3 -3
- package/dist/components/feedback-state.js +1 -1
- package/dist/components/glass-control.d.ts +7 -0
- package/dist/components/glass-control.d.ts.map +1 -0
- package/dist/components/glass-control.js +14 -0
- package/dist/components/hover-card.js +1 -1
- package/dist/components/label-system.d.ts +1 -10
- package/dist/components/label-system.d.ts.map +1 -1
- package/dist/components/label-system.js +1 -7
- package/dist/components/live-demo.js +1 -1
- package/dist/components/menubar.js +1 -1
- package/dist/components/nav-bar.d.ts +6 -8
- package/dist/components/nav-bar.d.ts.map +1 -1
- package/dist/components/nav-bar.js +8 -9
- package/dist/components/navigation-menu.js +2 -2
- package/dist/components/popover.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/sheet.js +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/sonner.js +2 -2
- package/dist/components/testimonials.d.ts +1 -1
- package/dist/components/testimonials.js +2 -2
- package/dist/components/tooltip.js +1 -1
- package/dist/components/use-case-bento.d.ts +2 -4
- package/dist/components/use-case-bento.d.ts.map +1 -1
- package/dist/components/use-case-bento.js +2 -3
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +0 -1
- package/dist/index.d.ts +3 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -16
- package/dist/internal/agent-visual/color.d.ts +4 -0
- package/dist/internal/agent-visual/color.d.ts.map +1 -0
- package/dist/internal/agent-visual/color.js +39 -0
- package/dist/internal/agent-visual/poster.d.ts +6 -0
- package/dist/internal/agent-visual/poster.d.ts.map +1 -0
- package/dist/internal/agent-visual/poster.js +35 -0
- package/dist/internal/agent-visual/recipes.d.ts +15 -0
- package/dist/internal/agent-visual/recipes.d.ts.map +1 -0
- package/dist/internal/agent-visual/recipes.js +72 -0
- package/dist/internal/agent-visual/renderer.d.ts +10 -0
- package/dist/internal/agent-visual/renderer.d.ts.map +1 -0
- package/dist/internal/agent-visual/renderer.js +112 -0
- package/dist/internal/agent-visual/shader.d.ts +2 -0
- package/dist/internal/agent-visual/shader.d.ts.map +1 -0
- package/dist/internal/agent-visual/shader.js +158 -0
- package/dist/internal/assistant-ui/attachment.d.ts +5 -0
- package/dist/internal/assistant-ui/attachment.d.ts.map +1 -0
- package/dist/internal/assistant-ui/attachment.js +93 -0
- package/dist/internal/assistant-ui/follow-up-suggestions.d.ts +3 -0
- package/dist/internal/assistant-ui/follow-up-suggestions.d.ts.map +1 -0
- package/dist/internal/assistant-ui/follow-up-suggestions.js +8 -0
- package/dist/internal/assistant-ui/markdown-text.d.ts +2 -0
- package/dist/internal/assistant-ui/markdown-text.d.ts.map +1 -0
- package/dist/internal/assistant-ui/markdown-text.js +54 -0
- package/dist/internal/assistant-ui/reasoning.d.ts +31 -0
- package/dist/internal/assistant-ui/reasoning.d.ts.map +1 -0
- package/dist/internal/assistant-ui/reasoning.js +118 -0
- package/dist/internal/assistant-ui/thread.d.ts +26 -0
- package/dist/internal/assistant-ui/thread.d.ts.map +1 -0
- package/dist/internal/assistant-ui/thread.js +118 -0
- package/dist/internal/assistant-ui/tool-fallback.d.ts +10 -0
- package/dist/internal/assistant-ui/tool-fallback.d.ts.map +1 -0
- package/dist/internal/assistant-ui/tool-fallback.js +163 -0
- package/dist/internal/assistant-ui/tool-group.d.ts +18 -0
- package/dist/internal/assistant-ui/tool-group.d.ts.map +1 -0
- package/dist/internal/assistant-ui/tool-group.js +44 -0
- package/dist/internal/assistant-ui/tooltip-icon-button.d.ts +8 -0
- package/dist/internal/assistant-ui/tooltip-icon-button.d.ts.map +1 -0
- package/dist/internal/assistant-ui/tooltip-icon-button.js +10 -0
- package/dist/styles/globals.css +24 -209
- package/docs/agents/nadicodeai-ui.md +8 -8
- package/docs/component-classification.md +1 -1
- package/docs/consuming-cross-repo.md +12 -4
- package/docs/contract.md +83 -7
- package/docs/migration/1.0.0.md +75 -0
- package/docs/migration/base-ui-migration.md +0 -11
- package/docs/product-compositions.md +1 -1
- package/llms.txt +7 -6
- package/package.json +17 -29
- package/skills/nadicodeai-ui/SKILL.md +11 -7
- package/dist/ai-elements.d.ts +0 -49
- package/dist/ai-elements.d.ts.map +0 -1
- package/dist/ai-elements.js +0 -48
- package/dist/components/agent-avatar.d.ts +0 -7
- package/dist/components/agent-avatar.d.ts.map +0 -1
- package/dist/components/agent-avatar.js +0 -6
- package/dist/components/agent-chat.d.ts +0 -20
- package/dist/components/agent-chat.d.ts.map +0 -1
- package/dist/components/agent-chat.js +0 -10
- package/dist/components/agent-composer.d.ts +0 -56
- package/dist/components/agent-composer.d.ts.map +0 -1
- package/dist/components/agent-composer.js +0 -56
- package/dist/components/agent-message.d.ts +0 -117
- package/dist/components/agent-message.d.ts.map +0 -1
- package/dist/components/agent-message.js +0 -99
- package/dist/components/agent-thread.d.ts +0 -26
- package/dist/components/agent-thread.d.ts.map +0 -1
- package/dist/components/agent-thread.js +0 -63
- package/dist/components/agent-tool-approval.d.ts +0 -27
- package/dist/components/agent-tool-approval.d.ts.map +0 -1
- package/dist/components/agent-tool-approval.js +0 -43
- package/dist/components/ai-elements/agent.d.ts +0 -27
- package/dist/components/ai-elements/agent.d.ts.map +0 -1
- package/dist/components/ai-elements/agent.js +0 -25
- package/dist/components/ai-elements/artifact.d.ts +0 -24
- package/dist/components/ai-elements/artifact.d.ts.map +0 -1
- package/dist/components/ai-elements/artifact.js +0 -20
- package/dist/components/ai-elements/attachments.d.ts +0 -55
- package/dist/components/ai-elements/attachments.d.ts.map +0 -1
- package/dist/components/ai-elements/attachments.js +0 -125
- package/dist/components/ai-elements/audio-player.d.ts +0 -30
- package/dist/components/ai-elements/audio-player.d.ts.map +0 -1
- package/dist/components/ai-elements/audio-player.js +0 -41
- package/dist/components/ai-elements/canvas.d.ts +0 -8
- package/dist/components/ai-elements/canvas.d.ts.map +0 -1
- package/dist/components/ai-elements/canvas.js +0 -5
- package/dist/components/ai-elements/chain-of-thought.d.ts +0 -30
- package/dist/components/ai-elements/chain-of-thought.d.ts.map +0 -1
- package/dist/components/ai-elements/chain-of-thought.js +0 -49
- package/dist/components/ai-elements/checkpoint.d.ts +0 -12
- package/dist/components/ai-elements/checkpoint.d.ts.map +0 -1
- package/dist/components/ai-elements/checkpoint.js +0 -10
- package/dist/components/ai-elements/code-block.d.ts +0 -53
- package/dist/components/ai-elements/code-block.d.ts.map +0 -1
- package/dist/components/ai-elements/code-block.js +0 -239
- package/dist/components/ai-elements/commit.d.ts +0 -65
- package/dist/components/ai-elements/commit.d.ts.map +0 -1
- package/dist/components/ai-elements/commit.js +0 -83
- package/dist/components/ai-elements/confirmation.d.ts +0 -50
- package/dist/components/ai-elements/confirmation.d.ts.map +0 -1
- package/dist/components/ai-elements/confirmation.js +0 -57
- package/dist/components/ai-elements/connection.d.ts +0 -6
- package/dist/components/ai-elements/connection.d.ts.map +0 -1
- package/dist/components/ai-elements/connection.js +0 -10
- package/dist/components/ai-elements/context.d.ts +0 -33
- package/dist/components/ai-elements/context.d.ts.map +0 -1
- package/dist/components/ai-elements/context.js +0 -147
- package/dist/components/ai-elements/controls.d.ts +0 -5
- package/dist/components/ai-elements/controls.d.ts.map +0 -1
- package/dist/components/ai-elements/controls.js +0 -5
- package/dist/components/ai-elements/conversation.d.ts +0 -24
- package/dist/components/ai-elements/conversation.d.ts.map +0 -1
- package/dist/components/ai-elements/conversation.js +0 -41
- package/dist/components/ai-elements/edge.d.ts +0 -6
- package/dist/components/ai-elements/edge.d.ts.map +0 -1
- package/dist/components/ai-elements/edge.js +0 -88
- package/dist/components/ai-elements/environment-variables.d.ts +0 -39
- package/dist/components/ai-elements/environment-variables.d.ts.map +0 -1
- package/dist/components/ai-elements/environment-variables.js +0 -60
- package/dist/components/ai-elements/file-tree.d.ts +0 -27
- package/dist/components/ai-elements/file-tree.d.ts.map +0 -1
- package/dist/components/ai-elements/file-tree.js +0 -73
- package/dist/components/ai-elements/image.d.ts +0 -7
- package/dist/components/ai-elements/image.d.ts.map +0 -1
- package/dist/components/ai-elements/image.js +0 -3
- package/dist/components/ai-elements/inline-citation.d.ts +0 -39
- package/dist/components/ai-elements/inline-citation.d.ts.map +0 -1
- package/dist/components/ai-elements/inline-citation.js +0 -86
- package/dist/components/ai-elements/jsx-preview.d.ts +0 -30
- package/dist/components/ai-elements/jsx-preview.d.ts.map +0 -1
- package/dist/components/ai-elements/jsx-preview.js +0 -159
- package/dist/components/ai-elements/message.d.ts +0 -38
- package/dist/components/ai-elements/message.d.ts.map +0 -1
- package/dist/components/ai-elements/message.js +0 -91
- package/dist/components/ai-elements/mic-selector.d.ts +0 -46
- package/dist/components/ai-elements/mic-selector.d.ts.map +0 -1
- package/dist/components/ai-elements/mic-selector.js +0 -180
- package/dist/components/ai-elements/model-selector.d.ts +0 -36
- package/dist/components/ai-elements/model-selector.d.ts.map +0 -1
- package/dist/components/ai-elements/model-selector.js +0 -18
- package/dist/components/ai-elements/node.d.ts +0 -22
- package/dist/components/ai-elements/node.d.ts.map +0 -1
- package/dist/components/ai-elements/node.js +0 -12
- package/dist/components/ai-elements/open-in-chat.d.ts +0 -27
- package/dist/components/ai-elements/open-in-chat.d.ts.map +0 -1
- package/dist/components/ai-elements/open-in-chat.js +0 -81
- package/dist/components/ai-elements/package-info.d.ts +0 -30
- package/dist/components/ai-elements/package-info.d.ts.map +0 -1
- package/dist/components/ai-elements/package-info.js +0 -50
- package/dist/components/ai-elements/panel.d.ts +0 -6
- package/dist/components/ai-elements/panel.d.ts.map +0 -1
- package/dist/components/ai-elements/panel.js +0 -5
- package/dist/components/ai-elements/persona.d.ts +0 -49
- package/dist/components/ai-elements/persona.d.ts.map +0 -1
- package/dist/components/ai-elements/persona.js +0 -175
- package/dist/components/ai-elements/plan.d.ts +0 -27
- package/dist/components/ai-elements/plan.d.ts.map +0 -1
- package/dist/components/ai-elements/plan.js +0 -34
- package/dist/components/ai-elements/prompt-input.d.ts +0 -149
- package/dist/components/ai-elements/prompt-input.d.ts.map +0 -1
- package/dist/components/ai-elements/prompt-input.js +0 -704
- package/dist/components/ai-elements/queue.d.ts +0 -62
- package/dist/components/ai-elements/queue.d.ts.map +0 -1
- package/dist/components/ai-elements/queue.js +0 -24
- package/dist/components/ai-elements/reasoning.d.ts +0 -27
- package/dist/components/ai-elements/reasoning.d.ts.map +0 -1
- package/dist/components/ai-elements/reasoning.js +0 -92
- package/dist/components/ai-elements/sandbox.d.ts +0 -25
- package/dist/components/ai-elements/sandbox.d.ts.map +0 -1
- package/dist/components/ai-elements/sandbox.js +0 -15
- package/dist/components/ai-elements/schema-display.d.ts +0 -56
- package/dist/components/ai-elements/schema-display.d.ts.map +0 -1
- package/dist/components/ai-elements/schema-display.js +0 -90
- package/dist/components/ai-elements/shimmer.d.ts +0 -10
- package/dist/components/ai-elements/shimmer.d.ts.map +0 -1
- package/dist/components/ai-elements/shimmer.js +0 -11
- package/dist/components/ai-elements/snippet.d.ts +0 -19
- package/dist/components/ai-elements/snippet.d.ts.map +0 -1
- package/dist/components/ai-elements/snippet.js +0 -32
- package/dist/components/ai-elements/sources.d.ts +0 -13
- package/dist/components/ai-elements/sources.d.ts.map +0 -1
- package/dist/components/ai-elements/sources.js +0 -9
- package/dist/components/ai-elements/speech-input.d.ts +0 -55
- package/dist/components/ai-elements/speech-input.d.ts.map +0 -1
- package/dist/components/ai-elements/speech-input.js +0 -187
- package/dist/components/ai-elements/stack-trace.d.ts +0 -38
- package/dist/components/ai-elements/stack-trace.d.ts.map +0 -1
- package/dist/components/ai-elements/stack-trace.js +0 -181
- package/dist/components/ai-elements/suggestion.d.ts +0 -11
- package/dist/components/ai-elements/suggestion.d.ts.map +0 -1
- package/dist/components/ai-elements/suggestion.js +0 -13
- package/dist/components/ai-elements/task.d.ts +0 -15
- package/dist/components/ai-elements/task.d.ts.map +0 -1
- package/dist/components/ai-elements/task.js +0 -10
- package/dist/components/ai-elements/terminal.d.ts +0 -28
- package/dist/components/ai-elements/terminal.d.ts.map +0 -1
- package/dist/components/ai-elements/terminal.js +0 -55
- package/dist/components/ai-elements/test-results.d.ts +0 -59
- package/dist/components/ai-elements/test-results.d.ts.map +0 -1
- package/dist/components/ai-elements/test-results.js +0 -98
- package/dist/components/ai-elements/tool.d.ts +0 -32
- package/dist/components/ai-elements/tool.d.ts.map +0 -1
- package/dist/components/ai-elements/tool.js +0 -49
- package/dist/components/ai-elements/toolbar.d.ts +0 -6
- package/dist/components/ai-elements/toolbar.d.ts.map +0 -1
- package/dist/components/ai-elements/toolbar.js +0 -5
- package/dist/components/ai-elements/transcription.d.ts +0 -17
- package/dist/components/ai-elements/transcription.d.ts.map +0 -1
- package/dist/components/ai-elements/transcription.js +0 -36
- package/dist/components/ai-elements/voice-selector.d.ts +0 -65
- package/dist/components/ai-elements/voice-selector.d.ts.map +0 -1
- package/dist/components/ai-elements/voice-selector.js +0 -224
- package/dist/components/ai-elements/web-preview.d.ts +0 -35
- package/dist/components/ai-elements/web-preview.d.ts.map +0 -1
- package/dist/components/ai-elements/web-preview.js +0 -66
- package/dist/components/artifact-panel.d.ts +0 -130
- package/dist/components/artifact-panel.d.ts.map +0 -1
- package/dist/components/artifact-panel.js +0 -180
- package/dist/components/attachment.d.ts +0 -24
- package/dist/components/attachment.d.ts.map +0 -1
- package/dist/components/attachment.js +0 -68
- package/dist/components/bubble.d.ts +0 -17
- package/dist/components/bubble.d.ts.map +0 -1
- package/dist/components/bubble.js +0 -59
- package/dist/components/demo-surface.d.ts +0 -34
- package/dist/components/demo-surface.d.ts.map +0 -1
- package/dist/components/demo-surface.js +0 -21
- package/dist/components/files-preview.d.ts +0 -36
- package/dist/components/files-preview.d.ts.map +0 -1
- package/dist/components/files-preview.js +0 -85
- package/dist/components/marker.d.ts +0 -11
- package/dist/components/marker.d.ts.map +0 -1
- package/dist/components/marker.js +0 -34
- package/dist/components/message-scroller.d.ts +0 -17
- package/dist/components/message-scroller.d.ts.map +0 -1
- package/dist/components/message-scroller.js +0 -29
- package/dist/components/message.d.ts +0 -11
- package/dist/components/message.d.ts.map +0 -1
- package/dist/components/message.js +0 -21
- package/dist/components/state-notice.d.ts +0 -13
- package/dist/components/state-notice.d.ts.map +0 -1
- package/dist/components/state-notice.js +0 -8
- package/dist/components/watch-it-work-band.d.ts +0 -12
- package/dist/components/watch-it-work-band.d.ts.map +0 -1
- package/dist/components/watch-it-work-band.js +0 -8
- package/dist/hooks/use-controllable-state.d.ts +0 -9
- package/dist/hooks/use-controllable-state.d.ts.map +0 -1
- package/dist/hooks/use-controllable-state.js +0 -23
- package/dist/lib/agent-attachment.d.ts +0 -11
- package/dist/lib/agent-attachment.d.ts.map +0 -1
- package/dist/lib/agent-attachment.js +0 -19
- package/dist/lib/agent-contracts.d.ts +0 -132
- package/dist/lib/agent-contracts.d.ts.map +0 -1
- package/dist/lib/agent-contracts.js +0 -6
- package/dist/lib/agent-state.d.ts +0 -22
- package/dist/lib/agent-state.d.ts.map +0 -1
- package/dist/lib/agent-state.js +0 -96
- package/dist/lib/agent-work-state.d.ts +0 -36
- package/dist/lib/agent-work-state.d.ts.map +0 -1
- package/dist/lib/agent-work-state.js +0 -36
- package/dist/lib/message-scroller-primitive/components.d.ts +0 -17
- package/dist/lib/message-scroller-primitive/components.d.ts.map +0 -1
- package/dist/lib/message-scroller-primitive/components.js +0 -204
- package/dist/lib/message-scroller-primitive/geometry.d.ts +0 -51
- package/dist/lib/message-scroller-primitive/geometry.d.ts.map +0 -1
- package/dist/lib/message-scroller-primitive/geometry.js +0 -199
- package/dist/lib/message-scroller-primitive/index.d.ts +0 -12
- package/dist/lib/message-scroller-primitive/index.d.ts.map +0 -1
- package/dist/lib/message-scroller-primitive/index.js +0 -12
- package/dist/lib/message-scroller-primitive/stores.d.ts +0 -6
- package/dist/lib/message-scroller-primitive/stores.d.ts.map +0 -1
- package/dist/lib/message-scroller-primitive/stores.js +0 -53
- package/dist/lib/message-scroller-primitive/types.d.ts +0 -88
- package/dist/lib/message-scroller-primitive/types.d.ts.map +0 -1
- package/dist/lib/message-scroller-primitive/types.js +0 -40
- package/dist/lib/message-scroller-primitive/use-message-scroller-commands.d.ts +0 -19
- package/dist/lib/message-scroller-primitive/use-message-scroller-commands.d.ts.map +0 -1
- package/dist/lib/message-scroller-primitive/use-message-scroller-commands.js +0 -188
- package/dist/lib/message-scroller-primitive/use-message-scroller-controller.d.ts +0 -7
- package/dist/lib/message-scroller-primitive/use-message-scroller-controller.d.ts.map +0 -1
- package/dist/lib/message-scroller-primitive/use-message-scroller-controller.js +0 -506
- package/dist/lib/message-scroller-primitive/use-message-scroller-refs.d.ts +0 -49
- package/dist/lib/message-scroller-primitive/use-message-scroller-refs.d.ts.map +0 -1
- package/dist/lib/message-scroller-primitive/use-message-scroller-refs.js +0 -90
- package/dist/lib/message-scroller-primitive/use-render.d.ts +0 -22
- package/dist/lib/message-scroller-primitive/use-render.d.ts.map +0 -1
- package/dist/lib/message-scroller-primitive/use-render.js +0 -113
- package/dist/lib/message-scroller-primitive/utils.d.ts +0 -4
- package/dist/lib/message-scroller-primitive/utils.d.ts.map +0 -1
- package/dist/lib/message-scroller-primitive/utils.js +0 -9
- package/docs/agent-work-surfaces.md +0 -132
- package/docs/migration/ai-elements-vendoring.md +0 -29
- package/docs/terminal-tui-semantics.md +0 -172
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { BotIcon, InfoIcon, UserIcon } from "lucide-react";
|
|
4
|
-
import { Attachment, AttachmentInfo, AttachmentPreview, Attachments, } from "./ai-elements/attachments.js";
|
|
5
|
-
import { Message, MessageResponse } from "./ai-elements/message.js";
|
|
6
|
-
import { Reasoning, ReasoningContent, ReasoningTrigger } from "./ai-elements/reasoning.js";
|
|
7
|
-
import { Source, Sources, SourcesContent, SourcesTrigger } from "./ai-elements/sources.js";
|
|
8
|
-
import { ToolContent, ToolHeader, ToolInput, ToolOutput, } from "./ai-elements/tool.js";
|
|
9
|
-
import { Collapsible } from "./collapsible.js";
|
|
10
|
-
import { ArtifactPanel, RedactedNotice, StackTraceDisclosure, getAgentRedactionText, } from "./artifact-panel.js";
|
|
11
|
-
import { AgentToolApproval, } from "./agent-tool-approval.js";
|
|
12
|
-
import { Badge } from "./badge.js";
|
|
13
|
-
import { StateNotice } from "./state-notice.js";
|
|
14
|
-
import { agentAttachmentToData } from "../lib/agent-attachment.js";
|
|
15
|
-
import { statePresentation } from "../lib/agent-work-state.js";
|
|
16
|
-
import { cn } from "../lib/utils.js";
|
|
17
|
-
const roleIcons = {
|
|
18
|
-
assistant: BotIcon,
|
|
19
|
-
system: InfoIcon,
|
|
20
|
-
user: UserIcon,
|
|
21
|
-
};
|
|
22
|
-
const stateMeta = {
|
|
23
|
-
empty: { label: "Empty" },
|
|
24
|
-
fatal: { label: "Fatal" },
|
|
25
|
-
idle: { label: "Idle" },
|
|
26
|
-
interrupted: { label: "Interrupted" },
|
|
27
|
-
"permission-denied": { label: "Permission denied" },
|
|
28
|
-
queued: { label: "Queued" },
|
|
29
|
-
retryable: { label: "Retryable" },
|
|
30
|
-
streaming: { label: "Streaming" },
|
|
31
|
-
};
|
|
32
|
-
const toolStatusToAiState = {
|
|
33
|
-
"approval-requested": "approval-requested",
|
|
34
|
-
"approval-responded": "approval-responded",
|
|
35
|
-
denied: "output-denied",
|
|
36
|
-
error: "output-error",
|
|
37
|
-
pending: "input-streaming",
|
|
38
|
-
running: "input-available",
|
|
39
|
-
success: "output-available",
|
|
40
|
-
};
|
|
41
|
-
function AgentMessageStateNotice({ state, title, description, actions, }) {
|
|
42
|
-
return (_jsx(StateNotice, { "data-slot": "agent-message-state", state: state, icon: statePresentation(state).icon, title: title ?? stateMeta[state].label, description: description, actions: actions, className: "rounded-md px-3 py-2" }));
|
|
43
|
-
}
|
|
44
|
-
function AgentAttachmentsList({ attachments }) {
|
|
45
|
-
if (!attachments?.length) {
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
return (_jsx(Attachments, { "data-slot": "agent-message-attachments", variant: "inline", className: "max-w-full", children: attachments.map((attachment) => (_jsxs(Attachment, { data: agentAttachmentToData(attachment), children: [_jsx(AttachmentPreview, {}), _jsx(AttachmentInfo, { showMediaType: true }), attachment.redaction && (_jsx("span", { className: "sr-only", children: getAgentRedactionText(attachment.redaction) }))] }, attachment.id))) }));
|
|
49
|
-
}
|
|
50
|
-
function AgentSourcesList({ sources }) {
|
|
51
|
-
if (!sources?.length) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
return (_jsxs(Sources, { "data-slot": "agent-message-sources", children: [_jsx(SourcesTrigger, { count: sources.length }), _jsx(SourcesContent, { keepMounted: true, children: sources.map((source) => (_jsx(Source, { href: source.url ?? "#", title: source.redaction ? getAgentRedactionText(source.redaction) : source.title }, source.id))) })] }));
|
|
55
|
-
}
|
|
56
|
-
function AgentReasoningBlock({ reasoning }) {
|
|
57
|
-
return (_jsxs(Reasoning, { "data-slot": "agent-reasoning-summary", "data-reasoning-status": reasoning.status, isStreaming: reasoning.status === "streaming", defaultOpen: reasoning.status === "streaming", duration: reasoning.durationSeconds, children: [_jsx(ReasoningTrigger, { getThinkingMessage: (isStreaming) => reasoning.title ?? (isStreaming ? "Preparing reasoning summary" : "Reasoning summary") }), reasoning.redaction ? (_jsx("div", { className: "mt-3", children: _jsx(RedactedNotice, { redaction: reasoning.redaction }) })) : (_jsx(ReasoningContent, { children: reasoning.summary ?? "No reasoning summary supplied." }))] }));
|
|
58
|
-
}
|
|
59
|
-
function AgentToolCall({ toolCall, actions, onApprovalChoice, }) {
|
|
60
|
-
const state = toolStatusToAiState[toolCall.status];
|
|
61
|
-
return (_jsxs(Collapsible, { "data-slot": "agent-tool-call", "data-tool-status": toolCall.status, className: "group not-prose w-full rounded-md border", defaultOpen: true, children: [_jsx(ToolHeader, { className: "nc-tool-call-trace", type: `tool-${toolCall.name}`, state: state, title: toolCall.title ?? toolCall.name }), _jsxs(ToolContent, { children: [toolCall.approval && (_jsx(AgentToolApproval, { request: toolCall.approval, disabled: !onApprovalChoice, onChoice: onApprovalChoice
|
|
62
|
-
? (choice, request) => onApprovalChoice(choice, request, toolCall)
|
|
63
|
-
: undefined })), toolCall.redaction ? (_jsx(RedactedNotice, { redaction: toolCall.redaction })) : (_jsxs(_Fragment, { children: [toolCall.input !== undefined && (_jsx(ToolInput, { input: toolCall.input })), (toolCall.output !== undefined || toolCall.error) && (_jsx(ToolOutput, { output: toolCall.output, errorText: toolCall.error }))] })), !toolCall.redaction && toolCall.trace && _jsx(StackTraceDisclosure, { trace: toolCall.trace }), actions] })] }));
|
|
64
|
-
}
|
|
65
|
-
function AgentMessagePartView({ part, role, toolActions, onToolApprovalChoice, }) {
|
|
66
|
-
if (part.type === "text") {
|
|
67
|
-
if (part.redaction) {
|
|
68
|
-
return _jsx(RedactedNotice, { redaction: part.redaction });
|
|
69
|
-
}
|
|
70
|
-
if (role === "system") {
|
|
71
|
-
return _jsx(MessageResponse, { children: part.text });
|
|
72
|
-
}
|
|
73
|
-
return (_jsx("div", { "data-slot": "agent-message-bubble", className: role === "user" ? "nc-chat-bubble-user" : "nc-chat-bubble-agent", children: _jsx(MessageResponse, { children: part.text }) }));
|
|
74
|
-
}
|
|
75
|
-
if (part.type === "reasoning") {
|
|
76
|
-
return _jsx(AgentReasoningBlock, { reasoning: part.reasoning });
|
|
77
|
-
}
|
|
78
|
-
if (part.type === "tool") {
|
|
79
|
-
return (_jsx(AgentToolCall, { toolCall: part.toolCall, actions: toolActions?.[part.toolCall.id], onApprovalChoice: onToolApprovalChoice }));
|
|
80
|
-
}
|
|
81
|
-
if (part.type === "source") {
|
|
82
|
-
return _jsx(AgentSourcesList, { sources: [part.source] });
|
|
83
|
-
}
|
|
84
|
-
if (part.type === "artifact") {
|
|
85
|
-
return _jsx(ArtifactPanel, { artifact: part.artifact });
|
|
86
|
-
}
|
|
87
|
-
return (_jsx(AgentMessageStateNotice, { state: part.state, title: part.title, description: part.description }));
|
|
88
|
-
}
|
|
89
|
-
function AgentMessageMeta({ role, metadata, state, }) {
|
|
90
|
-
const Icon = roleIcons[role];
|
|
91
|
-
const label = metadata?.label ?? role;
|
|
92
|
-
return (_jsxs("div", { "data-slot": "agent-message-meta", className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [_jsx(Icon, { className: "size-3.5" }), _jsx("span", { className: "font-medium capitalize", children: label }), metadata?.model && _jsx(Badge, { variant: "outline", children: metadata.model }), metadata?.timestamp && _jsx("span", { children: metadata.timestamp }), state && state !== "idle" && _jsx(Badge, { variant: "secondary", children: stateMeta[state].label })] }));
|
|
93
|
-
}
|
|
94
|
-
function AgentMessage({ message, toolActions, retryAction, onToolApprovalChoice, className, ...props }) {
|
|
95
|
-
const parts = message.parts ?? (message.content ? [{ text: message.content, type: "text" }] : []);
|
|
96
|
-
const aiRole = message.role === "user" ? "user" : "assistant";
|
|
97
|
-
return (_jsx("article", { "data-slot": "agent-message", "data-message-role": message.role, "data-agent-state": message.state, className: className, ...props, children: _jsxs(Message, { from: aiRole, className: cn("max-w-full", message.role === "system" && "mx-auto border-y bg-muted/20 px-4 py-3"), children: [_jsx(AgentMessageMeta, { role: message.role, metadata: message.metadata, state: message.state }), _jsxs("div", { "data-slot": "agent-message-content", className: cn("flex w-full min-w-0 flex-col gap-2 text-sm", message.role === "system" && "text-muted-foreground"), children: [_jsx(AgentAttachmentsList, { attachments: message.attachments }), message.redaction ? (_jsx(RedactedNotice, { redaction: message.redaction })) : (parts.map((part, index) => (_jsx(AgentMessagePartView, { part: part, role: message.role, toolActions: toolActions, onToolApprovalChoice: onToolApprovalChoice }, `${message.id}-${part.type}-${index}`)))), _jsx(AgentSourcesList, { sources: message.sources }), message.state && message.state !== "idle" && message.state !== "streaming" && (_jsx(AgentMessageStateNotice, { state: message.state, actions: message.state === "retryable" ? retryAction : undefined }))] })] }) }));
|
|
98
|
-
}
|
|
99
|
-
export { AgentAttachmentsList, AgentMessage, AgentMessageStateNotice, AgentSourcesList, AgentToolCall, };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Conversation } from "./ai-elements/conversation";
|
|
3
|
-
import { type AgentMessageModel, type AgentToolApprovalDecisionHandler, type AgentWorkState } from "./agent-message";
|
|
4
|
-
export type AgentThreadStateCopy = {
|
|
5
|
-
title?: React.ReactNode;
|
|
6
|
-
description?: React.ReactNode;
|
|
7
|
-
actions?: React.ReactNode;
|
|
8
|
-
};
|
|
9
|
-
declare function AgentThreadStateBanner({ state, title, description, actions, }: AgentThreadStateCopy & {
|
|
10
|
-
state: Exclude<AgentWorkState, "idle" | "empty">;
|
|
11
|
-
}): React.JSX.Element;
|
|
12
|
-
declare function AgentThreadEmptyState({ title, description, actions }: AgentThreadStateCopy): React.JSX.Element;
|
|
13
|
-
declare function AgentThread({ messages, state, stateCopy, emptyState, toolActions, retryAction, onToolApprovalChoice, maxMessages, className, contentClassName, children, ...props }: Omit<React.ComponentProps<typeof Conversation>, "children"> & {
|
|
14
|
-
messages: AgentMessageModel[];
|
|
15
|
-
state?: AgentWorkState;
|
|
16
|
-
stateCopy?: Partial<Record<Exclude<AgentWorkState, "idle">, AgentThreadStateCopy>>;
|
|
17
|
-
emptyState?: AgentThreadStateCopy;
|
|
18
|
-
toolActions?: Record<string, React.ReactNode>;
|
|
19
|
-
retryAction?: React.ReactNode;
|
|
20
|
-
onToolApprovalChoice?: AgentToolApprovalDecisionHandler;
|
|
21
|
-
maxMessages?: number;
|
|
22
|
-
contentClassName?: string;
|
|
23
|
-
children?: React.ReactNode;
|
|
24
|
-
}): React.JSX.Element;
|
|
25
|
-
export { AgentThread, AgentThreadEmptyState, AgentThreadStateBanner };
|
|
26
|
-
//# sourceMappingURL=agent-thread.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-thread.d.ts","sourceRoot":"","sources":["../../src/components/agent-thread.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAuB,MAAM,uCAAuC,CAAC;AAC1F,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,gCAAgC,EACrC,KAAK,cAAc,EACpB,MAAM,4BAA4B,CAAC;AAMpC,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAyCF,iBAAS,sBAAsB,CAAC,EAC9B,KAAK,EACL,KAAK,EACL,WAAW,EACX,OAAO,GACR,EAAE,oBAAoB,GAAG;IACxB,KAAK,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;CAClD,qBAcA;AAED,iBAAS,qBAAqB,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,oBAAoB,qBAYnF;AAaD,iBAAS,WAAW,CAAC,EACnB,QAAQ,EACR,KAAc,EACd,SAAS,EACT,UAAU,EACV,WAAW,EACX,WAAW,EACX,oBAAoB,EACpB,WAA2C,EAC3C,SAAS,EACT,gBAAgB,EAChB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,EAAE,UAAU,CAAC,GAAG;IAC/D,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC;IACnF,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC9C,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,oBAAoB,CAAC,EAAE,gCAAgC,CAAC;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,qBA+CA;AAED,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Conversation, ConversationContent } from "./ai-elements/conversation.js";
|
|
4
|
-
import { AgentMessage, } from "./agent-message.js";
|
|
5
|
-
import { FeedbackState } from "./feedback-state.js";
|
|
6
|
-
import { StateNotice } from "./state-notice.js";
|
|
7
|
-
import { statePresentation } from "../lib/agent-work-state.js";
|
|
8
|
-
import { cn } from "../lib/utils.js";
|
|
9
|
-
const threadStateDefaults = {
|
|
10
|
-
empty: {
|
|
11
|
-
description: "Start with a prompt or queue an agent task.",
|
|
12
|
-
title: "No agent messages",
|
|
13
|
-
},
|
|
14
|
-
fatal: {
|
|
15
|
-
description: "The consuming app should show its recovery action here.",
|
|
16
|
-
title: "Unable to continue",
|
|
17
|
-
},
|
|
18
|
-
interrupted: {
|
|
19
|
-
description: "The current run stopped before the agent finished.",
|
|
20
|
-
title: "Run interrupted",
|
|
21
|
-
},
|
|
22
|
-
"permission-denied": {
|
|
23
|
-
description: "This session cannot access the requested action or content.",
|
|
24
|
-
title: "Permission denied",
|
|
25
|
-
},
|
|
26
|
-
queued: {
|
|
27
|
-
description: "The next agent step is waiting for capacity or approval.",
|
|
28
|
-
title: "Queued",
|
|
29
|
-
},
|
|
30
|
-
retryable: {
|
|
31
|
-
description: "The run can be attempted again by the consuming app.",
|
|
32
|
-
title: "Retry available",
|
|
33
|
-
},
|
|
34
|
-
streaming: {
|
|
35
|
-
description: "The assistant is preparing a response.",
|
|
36
|
-
title: "Streaming",
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
const defaultMaxAgentThreadMessages = 50;
|
|
40
|
-
function AgentThreadStateBanner({ state, title, description, actions, }) {
|
|
41
|
-
const fallback = threadStateDefaults[state];
|
|
42
|
-
return (_jsx(StateNotice, { "data-slot": "agent-thread-state", state: state, icon: statePresentation(state).icon, title: title ?? fallback.title, description: description ?? fallback.description, actions: actions, className: "rounded-lg px-4 py-3" }));
|
|
43
|
-
}
|
|
44
|
-
function AgentThreadEmptyState({ title, description, actions }) {
|
|
45
|
-
return (_jsx(FeedbackState, { "data-slot": "agent-thread-empty-state", status: "empty", title: title ?? threadStateDefaults.empty.title, description: description ?? threadStateDefaults.empty.description, actions: actions, compact: true, className: "min-h-56 rounded-lg bg-muted/20" }));
|
|
46
|
-
}
|
|
47
|
-
function AgentThreadOverflowSummary({ omittedMessages }) {
|
|
48
|
-
return (_jsxs("div", { "data-slot": "agent-thread-overflow-summary", className: "rounded-md border bg-muted/30 px-3 py-2 text-muted-foreground text-xs", children: [omittedMessages, " earlier messages not shown."] }));
|
|
49
|
-
}
|
|
50
|
-
function AgentThread({ messages, state = "idle", stateCopy, emptyState, toolActions, retryAction, onToolApprovalChoice, maxMessages = defaultMaxAgentThreadMessages, className, contentClassName, children, ...props }) {
|
|
51
|
-
const maxVisibleMessages = Number.isFinite(maxMessages)
|
|
52
|
-
? Math.max(0, Math.floor(maxMessages))
|
|
53
|
-
: defaultMaxAgentThreadMessages;
|
|
54
|
-
const visibleMessages = maxVisibleMessages > 0 ? messages.slice(-maxVisibleMessages) : [];
|
|
55
|
-
const omittedMessages = messages.length - visibleMessages.length;
|
|
56
|
-
const hasMessages = messages.length > 0;
|
|
57
|
-
const nonIdleState = state === "idle" ? undefined : state;
|
|
58
|
-
const stateForRender = nonIdleState && nonIdleState !== "empty" ? nonIdleState : undefined;
|
|
59
|
-
const stateProps = nonIdleState ? stateCopy?.[nonIdleState] : undefined;
|
|
60
|
-
const stateActions = stateForRender === "retryable" ? (retryAction ?? stateProps?.actions) : stateProps?.actions;
|
|
61
|
-
return (_jsx(Conversation, { "data-slot": "agent-thread", "data-agent-state": state, className: cn("nc-chat-thread min-h-0", className), ...props, children: _jsxs(ConversationContent, { className: cn("nc-chat-thread-body", contentClassName), children: [stateForRender && (_jsx(AgentThreadStateBanner, { state: stateForRender, actions: stateActions, title: stateProps?.title, description: stateProps?.description })), omittedMessages > 0 && _jsx(AgentThreadOverflowSummary, { omittedMessages: omittedMessages }), !hasMessages ? (_jsx(AgentThreadEmptyState, { ...(stateProps ?? emptyState ?? {}) })) : (visibleMessages.map((message) => (_jsx(AgentMessage, { message: message, toolActions: toolActions, retryAction: retryAction, onToolApprovalChoice: onToolApprovalChoice }, message.id)))), children] }) }));
|
|
62
|
-
}
|
|
63
|
-
export { AgentThread, AgentThreadEmptyState, AgentThreadStateBanner };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import type { Card } from "./card";
|
|
3
|
-
import type { AgentApprovalChoice } from "../lib/agent-contracts";
|
|
4
|
-
export type { AgentApprovalAlias, AgentApprovalChoice } from "../lib/agent-contracts";
|
|
5
|
-
export { agentApprovalAliases } from "../lib/agent-contracts";
|
|
6
|
-
export type AgentApprovalRisk = "low" | "review" | "elevated" | "blocked";
|
|
7
|
-
export type AgentToolApprovalRequest = {
|
|
8
|
-
id: string;
|
|
9
|
-
toolName: string;
|
|
10
|
-
title?: string;
|
|
11
|
-
description?: string;
|
|
12
|
-
scope?: string;
|
|
13
|
-
risk?: AgentApprovalRisk;
|
|
14
|
-
choices?: AgentApprovalChoice[];
|
|
15
|
-
};
|
|
16
|
-
declare function AgentToolApproval({ request, title, description, choices, choiceLabels, onChoice, disabled, footer, size, className, ...props }: Omit<React.ComponentProps<typeof Card>, "children" | "title"> & {
|
|
17
|
-
request: AgentToolApprovalRequest;
|
|
18
|
-
title?: React.ReactNode;
|
|
19
|
-
description?: React.ReactNode;
|
|
20
|
-
choices?: AgentApprovalChoice[];
|
|
21
|
-
choiceLabels?: Partial<Record<AgentApprovalChoice, React.ReactNode>>;
|
|
22
|
-
onChoice?: (choice: AgentApprovalChoice, request: AgentToolApprovalRequest) => void;
|
|
23
|
-
disabled?: boolean;
|
|
24
|
-
footer?: React.ReactNode;
|
|
25
|
-
}): React.JSX.Element;
|
|
26
|
-
export { AgentToolApproval };
|
|
27
|
-
//# sourceMappingURL=agent-tool-approval.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-tool-approval.d.ts","sourceRoot":"","sources":["../../src/components/agent-tool-approval.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAIjE,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAE1E,MAAM,MAAM,wBAAwB,GAAG;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACjC,CAAC;AAgCF,iBAAS,iBAAiB,CAAC,EACzB,OAAO,EACP,KAAK,EACL,WAAW,EACX,OAAiE,EACjE,YAAY,EACZ,QAAQ,EACR,QAAgB,EAChB,MAAM,EACN,IAAI,EACJ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG;IACjE,OAAO,EAAE,wBAAwB,CAAC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,mBAAmB,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IACrE,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,EAAE,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAC;IACpF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,qBAgDA;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { BanIcon, CheckIcon, ClockIcon, ShieldCheckIcon } from "lucide-react";
|
|
4
|
-
import { agentApprovalAliases } from "../lib/agent-contracts.js";
|
|
5
|
-
import { cn } from "../lib/utils.js";
|
|
6
|
-
export { agentApprovalAliases } from "../lib/agent-contracts.js";
|
|
7
|
-
const approvalChoiceDefaults = {
|
|
8
|
-
always: {
|
|
9
|
-
icon: ShieldCheckIcon,
|
|
10
|
-
label: "Always allow",
|
|
11
|
-
variant: "secondary",
|
|
12
|
-
},
|
|
13
|
-
deny: {
|
|
14
|
-
icon: BanIcon,
|
|
15
|
-
label: "Deny",
|
|
16
|
-
variant: "destructive",
|
|
17
|
-
},
|
|
18
|
-
run: {
|
|
19
|
-
icon: CheckIcon,
|
|
20
|
-
label: "Run once",
|
|
21
|
-
variant: "default",
|
|
22
|
-
},
|
|
23
|
-
session: {
|
|
24
|
-
icon: ClockIcon,
|
|
25
|
-
label: "Allow this session",
|
|
26
|
-
variant: "outline",
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
const approvalRiskLabels = {
|
|
30
|
-
blocked: "Blocked",
|
|
31
|
-
elevated: "Elevated",
|
|
32
|
-
low: "Low risk",
|
|
33
|
-
review: "Review",
|
|
34
|
-
};
|
|
35
|
-
function AgentToolApproval({ request, title, description, choices = request.choices ?? ["run", "deny", "session", "always"], choiceLabels, onChoice, disabled = false, footer, size, className, ...props }) {
|
|
36
|
-
return (_jsxs("div", { "data-slot": "agent-tool-approval", "data-tool-name": request.toolName, "data-risk": request.risk, "data-size": size, className: cn("nc-approval-gate", className), ...props, children: [_jsx("span", { className: "nc-approval-gate-label", children: request.risk
|
|
37
|
-
? `${approvalRiskLabels[request.risk]} · ${request.toolName}`
|
|
38
|
-
: request.toolName }), _jsx("span", { className: "nc-approval-gate-title", children: title ?? request.title ?? "Approval required" }), (description ?? request.description) && (_jsx("span", { className: "nc-approval-gate-copy", children: description ?? request.description })), request.scope && (_jsx("span", { "data-slot": "agent-tool-approval-scope", className: "nc-approval-gate-copy", children: request.scope })), _jsx("div", { "data-slot": "agent-tool-approval-choices", className: "nc-approval-gate-actions", children: choices.map((choice) => {
|
|
39
|
-
const defaults = approvalChoiceDefaults[choice];
|
|
40
|
-
return (_jsx("button", { type: "button", disabled: disabled, "data-approval-choice": choice, "data-approval-alias": agentApprovalAliases[choice], "data-variant": defaults.variant, onClick: () => onChoice?.(choice, request), children: choiceLabels?.[choice] ?? defaults.label }, choice));
|
|
41
|
-
}) }), footer] }));
|
|
42
|
-
}
|
|
43
|
-
export { AgentToolApproval };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Accordion, AccordionItem } from "../accordion";
|
|
2
|
-
import type { Tool } from "ai";
|
|
3
|
-
import type { ComponentProps } from "react";
|
|
4
|
-
export type AgentProps = ComponentProps<"div">;
|
|
5
|
-
export declare const Agent: import("react").MemoExoticComponent<({ className, ...props }: AgentProps) => import("react").JSX.Element>;
|
|
6
|
-
export type AgentHeaderProps = ComponentProps<"div"> & {
|
|
7
|
-
name: string;
|
|
8
|
-
model?: string;
|
|
9
|
-
};
|
|
10
|
-
export declare const AgentHeader: import("react").MemoExoticComponent<({ className, name, model, ...props }: AgentHeaderProps) => import("react").JSX.Element>;
|
|
11
|
-
export type AgentContentProps = ComponentProps<"div">;
|
|
12
|
-
export declare const AgentContent: import("react").MemoExoticComponent<({ className, ...props }: AgentContentProps) => import("react").JSX.Element>;
|
|
13
|
-
export type AgentInstructionsProps = ComponentProps<"div"> & {
|
|
14
|
-
children: string;
|
|
15
|
-
};
|
|
16
|
-
export declare const AgentInstructions: import("react").MemoExoticComponent<({ className, children, ...props }: AgentInstructionsProps) => import("react").JSX.Element>;
|
|
17
|
-
export type AgentToolsProps = ComponentProps<typeof Accordion>;
|
|
18
|
-
export declare const AgentTools: import("react").MemoExoticComponent<({ className, ...props }: AgentToolsProps) => import("react").JSX.Element>;
|
|
19
|
-
export type AgentToolProps = ComponentProps<typeof AccordionItem> & {
|
|
20
|
-
tool: Tool;
|
|
21
|
-
};
|
|
22
|
-
export declare const AgentTool: import("react").MemoExoticComponent<({ className, tool, value, ...props }: AgentToolProps) => import("react").JSX.Element>;
|
|
23
|
-
export type AgentOutputProps = ComponentProps<"div"> & {
|
|
24
|
-
schema: string;
|
|
25
|
-
};
|
|
26
|
-
export declare const AgentOutput: import("react").MemoExoticComponent<({ className, schema, ...props }: AgentOutputProps) => import("react").JSX.Element>;
|
|
27
|
-
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/agent.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EAET,aAAa,EAEd,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAK5C,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE/C,eAAO,MAAM,KAAK,gEAAkC,UAAU,iCAE5D,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,WAAW,6EAA+C,gBAAgB,iCAYrF,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAEtD,eAAO,MAAM,YAAY,gEAAkC,iBAAiB,iCAE1E,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IAC3D,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,iBAAiB,0EACQ,sBAAsB,iCAQ3D,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,CAAC;AAE/D,eAAO,MAAM,UAAU,gEAAkC,eAAe,iCAKtE,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,OAAO,aAAa,CAAC,GAAG;IAClE,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,SAAS,6EAA+C,cAAc,iCAejF,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACrD,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,WAAW,wEAA0C,gBAAgB,iCAOhF,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from "../accordion.js";
|
|
4
|
-
import { Badge } from "../badge.js";
|
|
5
|
-
import { cn } from "../../lib/utils.js";
|
|
6
|
-
import { BotIcon } from "lucide-react";
|
|
7
|
-
import { memo } from "react";
|
|
8
|
-
import { CodeBlock } from "./code-block.js";
|
|
9
|
-
export const Agent = memo(({ className, ...props }) => (_jsx("div", { className: cn("not-prose w-full rounded-md border", className), ...props })));
|
|
10
|
-
export const AgentHeader = memo(({ className, name, model, ...props }) => (_jsx("div", { className: cn("flex w-full items-center justify-between gap-4 p-3", className), ...props, children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BotIcon, { className: "size-4 text-muted-foreground" }), _jsx("span", { className: "font-medium text-sm", children: name }), model && (_jsx(Badge, { className: "font-mono text-xs", variant: "secondary", children: model }))] }) })));
|
|
11
|
-
export const AgentContent = memo(({ className, ...props }) => (_jsx("div", { className: cn("flex flex-col gap-4 p-4 pt-0", className), ...props })));
|
|
12
|
-
export const AgentInstructions = memo(({ className, children, ...props }) => (_jsxs("div", { className: cn("flex flex-col gap-2", className), ...props, children: [_jsx("span", { className: "font-medium text-muted-foreground text-sm", children: "Instructions" }), _jsx("div", { className: "rounded-md bg-muted/50 p-3 text-muted-foreground text-sm", children: _jsx("p", { children: children }) })] })));
|
|
13
|
-
export const AgentTools = memo(({ className, ...props }) => (_jsxs("div", { className: cn("flex flex-col gap-2", className), children: [_jsx("span", { className: "font-medium text-muted-foreground text-sm", children: "Tools" }), _jsx(Accordion, { className: "rounded-md border", ...props })] })));
|
|
14
|
-
export const AgentTool = memo(({ className, tool, value, ...props }) => {
|
|
15
|
-
const schema = "jsonSchema" in tool && tool.jsonSchema ? tool.jsonSchema : tool.inputSchema;
|
|
16
|
-
return (_jsxs(AccordionItem, { className: cn("border-b last:border-b-0", className), value: value, ...props, children: [_jsx(AccordionTrigger, { className: "px-3 py-2 text-sm hover:no-underline", children: tool.description ?? "No description" }), _jsx(AccordionContent, { className: "px-3 pb-3", children: _jsx("div", { className: "rounded-md bg-muted/50", children: _jsx(CodeBlock, { code: JSON.stringify(schema, null, 2), language: "json" }) }) })] }));
|
|
17
|
-
});
|
|
18
|
-
export const AgentOutput = memo(({ className, schema, ...props }) => (_jsxs("div", { className: cn("flex flex-col gap-2", className), ...props, children: [_jsx("span", { className: "font-medium text-muted-foreground text-sm", children: "Output Schema" }), _jsx("div", { className: "rounded-md bg-muted/50", children: _jsx(CodeBlock, { code: schema, language: "typescript" }) })] })));
|
|
19
|
-
Agent.displayName = "Agent";
|
|
20
|
-
AgentHeader.displayName = "AgentHeader";
|
|
21
|
-
AgentContent.displayName = "AgentContent";
|
|
22
|
-
AgentInstructions.displayName = "AgentInstructions";
|
|
23
|
-
AgentTools.displayName = "AgentTools";
|
|
24
|
-
AgentTool.displayName = "AgentTool";
|
|
25
|
-
AgentOutput.displayName = "AgentOutput";
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Button } from "../button";
|
|
2
|
-
import type { LucideIcon } from "lucide-react";
|
|
3
|
-
import type { ComponentProps, HTMLAttributes } from "react";
|
|
4
|
-
export type ArtifactProps = HTMLAttributes<HTMLDivElement>;
|
|
5
|
-
export declare const Artifact: ({ className, ...props }: ArtifactProps) => import("react").JSX.Element;
|
|
6
|
-
export type ArtifactHeaderProps = HTMLAttributes<HTMLDivElement>;
|
|
7
|
-
export declare const ArtifactHeader: ({ className, ...props }: ArtifactHeaderProps) => import("react").JSX.Element;
|
|
8
|
-
export type ArtifactCloseProps = ComponentProps<typeof Button>;
|
|
9
|
-
export declare const ArtifactClose: ({ className, children, size, variant, ...props }: ArtifactCloseProps) => import("react").JSX.Element;
|
|
10
|
-
export type ArtifactTitleProps = HTMLAttributes<HTMLParagraphElement>;
|
|
11
|
-
export declare const ArtifactTitle: ({ className, ...props }: ArtifactTitleProps) => import("react").JSX.Element;
|
|
12
|
-
export type ArtifactDescriptionProps = HTMLAttributes<HTMLParagraphElement>;
|
|
13
|
-
export declare const ArtifactDescription: ({ className, ...props }: ArtifactDescriptionProps) => import("react").JSX.Element;
|
|
14
|
-
export type ArtifactActionsProps = HTMLAttributes<HTMLDivElement>;
|
|
15
|
-
export declare const ArtifactActions: ({ className, ...props }: ArtifactActionsProps) => import("react").JSX.Element;
|
|
16
|
-
export type ArtifactActionProps = ComponentProps<typeof Button> & {
|
|
17
|
-
tooltip?: string;
|
|
18
|
-
label?: string;
|
|
19
|
-
icon?: LucideIcon;
|
|
20
|
-
};
|
|
21
|
-
export declare const ArtifactAction: ({ tooltip, label, icon: Icon, children, className, size, variant, ...props }: ArtifactActionProps) => import("react").JSX.Element;
|
|
22
|
-
export type ArtifactContentProps = HTMLAttributes<HTMLDivElement>;
|
|
23
|
-
export declare const ArtifactContent: ({ className, ...props }: ArtifactContentProps) => import("react").JSX.Element;
|
|
24
|
-
//# sourceMappingURL=artifact.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/artifact.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5D,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAE3D,eAAO,MAAM,QAAQ,GAAI,yBAAyB,aAAa,gCAQ9D,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEjE,eAAO,MAAM,cAAc,GAAI,yBAAyB,mBAAmB,gCAK1E,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAE/D,eAAO,MAAM,aAAa,GAAI,kDAM3B,kBAAkB,gCAWpB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,oBAAoB,CAAC,CAAC;AAEtE,eAAO,MAAM,aAAa,GAAI,yBAAyB,kBAAkB,gCAExE,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,oBAAoB,CAAC,CAAC;AAE5E,eAAO,MAAM,mBAAmB,GAAI,yBAAyB,wBAAwB,gCAEpF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAElE,eAAO,MAAM,eAAe,GAAI,yBAAyB,oBAAoB,gCAE5E,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,8EAS5B,mBAAmB,gCA4BrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAElE,eAAO,MAAM,eAAe,GAAI,yBAAyB,oBAAoB,gCAE5E,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button } from "../button.js";
|
|
4
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../tooltip.js";
|
|
5
|
-
import { cn } from "../../lib/utils.js";
|
|
6
|
-
import { XIcon } from "lucide-react";
|
|
7
|
-
export const Artifact = ({ className, ...props }) => (_jsx("div", { className: cn("flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm", className), ...props }));
|
|
8
|
-
export const ArtifactHeader = ({ className, ...props }) => (_jsx("div", { className: cn("flex items-center justify-between border-b bg-muted/50 px-4 py-3", className), ...props }));
|
|
9
|
-
export const ArtifactClose = ({ className, children, size = "sm", variant = "ghost", ...props }) => (_jsxs(Button, { className: cn("size-8 p-0 text-muted-foreground hover:text-foreground", className), size: size, type: "button", variant: variant, ...props, children: [children ?? _jsx(XIcon, { className: "size-4" }), _jsx("span", { className: "sr-only", children: "Close" })] }));
|
|
10
|
-
export const ArtifactTitle = ({ className, ...props }) => (_jsx("p", { className: cn("font-medium text-foreground text-sm", className), ...props }));
|
|
11
|
-
export const ArtifactDescription = ({ className, ...props }) => (_jsx("p", { className: cn("text-muted-foreground text-sm", className), ...props }));
|
|
12
|
-
export const ArtifactActions = ({ className, ...props }) => (_jsx("div", { className: cn("flex items-center gap-1", className), ...props }));
|
|
13
|
-
export const ArtifactAction = ({ tooltip, label, icon: Icon, children, className, size = "sm", variant = "ghost", ...props }) => {
|
|
14
|
-
const button = (_jsxs(Button, { className: cn("size-8 p-0 text-muted-foreground hover:text-foreground", className), size: size, type: "button", variant: variant, ...props, children: [Icon ? _jsx(Icon, { className: "size-4" }) : children, _jsx("span", { className: "sr-only", children: label || tooltip })] }));
|
|
15
|
-
if (tooltip) {
|
|
16
|
-
return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: button }), _jsx(TooltipContent, { children: _jsx("p", { children: tooltip }) })] }) }));
|
|
17
|
-
}
|
|
18
|
-
return button;
|
|
19
|
-
};
|
|
20
|
-
export const ArtifactContent = ({ className, ...props }) => (_jsx("div", { className: cn("flex-1 overflow-auto p-4", className), ...props }));
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Button } from "../button";
|
|
2
|
-
import { HoverCard, HoverCardContent, HoverCardTrigger } from "../hover-card";
|
|
3
|
-
import type { FileUIPart, SourceDocumentUIPart } from "ai";
|
|
4
|
-
import type { ComponentProps, HTMLAttributes, ReactNode } from "react";
|
|
5
|
-
export type AttachmentData = (FileUIPart & {
|
|
6
|
-
id: string;
|
|
7
|
-
}) | (SourceDocumentUIPart & {
|
|
8
|
-
id: string;
|
|
9
|
-
});
|
|
10
|
-
export type AttachmentMediaCategory = "image" | "video" | "audio" | "document" | "source" | "unknown";
|
|
11
|
-
export type AttachmentVariant = "grid" | "inline" | "list";
|
|
12
|
-
export declare const getMediaCategory: (data: AttachmentData) => AttachmentMediaCategory;
|
|
13
|
-
export declare const getAttachmentLabel: (data: AttachmentData) => string;
|
|
14
|
-
interface AttachmentsContextValue {
|
|
15
|
-
variant: AttachmentVariant;
|
|
16
|
-
}
|
|
17
|
-
interface AttachmentContextValue {
|
|
18
|
-
data: AttachmentData;
|
|
19
|
-
mediaCategory: AttachmentMediaCategory;
|
|
20
|
-
onRemove?: () => void;
|
|
21
|
-
variant: AttachmentVariant;
|
|
22
|
-
}
|
|
23
|
-
export declare const useAttachmentsContext: () => AttachmentsContextValue;
|
|
24
|
-
export declare const useAttachmentContext: () => AttachmentContextValue;
|
|
25
|
-
export type AttachmentsProps = HTMLAttributes<HTMLDivElement> & {
|
|
26
|
-
variant?: AttachmentVariant;
|
|
27
|
-
};
|
|
28
|
-
export declare const Attachments: ({ variant, className, children, ...props }: AttachmentsProps) => import("react").JSX.Element;
|
|
29
|
-
export type AttachmentProps = HTMLAttributes<HTMLDivElement> & {
|
|
30
|
-
data: AttachmentData;
|
|
31
|
-
onRemove?: () => void;
|
|
32
|
-
};
|
|
33
|
-
export declare const Attachment: ({ data, onRemove, className, children, ...props }: AttachmentProps) => import("react").JSX.Element;
|
|
34
|
-
export type AttachmentPreviewProps = HTMLAttributes<HTMLDivElement> & {
|
|
35
|
-
fallbackIcon?: ReactNode;
|
|
36
|
-
};
|
|
37
|
-
export declare const AttachmentPreview: ({ fallbackIcon, className, ...props }: AttachmentPreviewProps) => import("react").JSX.Element;
|
|
38
|
-
export type AttachmentInfoProps = HTMLAttributes<HTMLDivElement> & {
|
|
39
|
-
showMediaType?: boolean;
|
|
40
|
-
};
|
|
41
|
-
export declare const AttachmentInfo: ({ showMediaType, className, ...props }: AttachmentInfoProps) => import("react").JSX.Element | null;
|
|
42
|
-
export type AttachmentRemoveProps = ComponentProps<typeof Button> & {
|
|
43
|
-
label?: string;
|
|
44
|
-
};
|
|
45
|
-
export declare const AttachmentRemove: ({ label, className, children, ...props }: AttachmentRemoveProps) => import("react").JSX.Element | null;
|
|
46
|
-
export type AttachmentHoverCardProps = ComponentProps<typeof HoverCard>;
|
|
47
|
-
export declare const AttachmentHoverCard: (props: AttachmentHoverCardProps) => import("react").JSX.Element;
|
|
48
|
-
export type AttachmentHoverCardTriggerProps = ComponentProps<typeof HoverCardTrigger>;
|
|
49
|
-
export declare const AttachmentHoverCardTrigger: (props: AttachmentHoverCardTriggerProps) => import("react").JSX.Element;
|
|
50
|
-
export type AttachmentHoverCardContentProps = ComponentProps<typeof HoverCardContent>;
|
|
51
|
-
export declare const AttachmentHoverCardContent: ({ align, className, ...props }: AttachmentHoverCardContentProps) => import("react").JSX.Element;
|
|
52
|
-
export type AttachmentEmptyProps = HTMLAttributes<HTMLDivElement>;
|
|
53
|
-
export declare const AttachmentEmpty: ({ className, children, ...props }: AttachmentEmptyProps) => import("react").JSX.Element;
|
|
54
|
-
export {};
|
|
55
|
-
//# sourceMappingURL=attachments.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/attachments.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAExF,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAU3D,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvE,MAAM,MAAM,cAAc,GACtB,CAAC,UAAU,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,GAC7B,CAAC,oBAAoB,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE5C,MAAM,MAAM,uBAAuB,GAC/B,OAAO,GACP,OAAO,GACP,OAAO,GACP,UAAU,GACV,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;AAe3D,eAAO,MAAM,gBAAgB,GAAI,MAAM,cAAc,KAAG,uBAqBvD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,MAAM,cAAc,KAAG,MAOzD,CAAC;AAyBF,UAAU,uBAAuB;IAC/B,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAID,UAAU,sBAAsB;IAC9B,IAAI,EAAE,cAAc,CAAC;IACrB,aAAa,EAAE,uBAAuB,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAQD,eAAO,MAAM,qBAAqB,+BAC8B,CAAC;AAEjE,eAAO,MAAM,oBAAoB,8BAMhC,CAAC;AAMF,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC9D,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,4CAKzB,gBAAgB,gCAkBlB,CAAC;AAMF,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC7D,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,mDAAmD,eAAe,gCAiC5F,CAAC;AAMF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACpE,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,uCAI/B,sBAAsB,gCAoCxB,CAAC;AAMF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACjE,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,wCAI5B,mBAAmB,uCAgBrB,CAAC;AAMF,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,0CAK9B,qBAAqB,uCA2CvB,CAAC;AAMF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,CAAC;AAExE,eAAO,MAAM,mBAAmB,GAAI,OAAO,wBAAwB,gCAA6B,CAAC;AAEjG,MAAM,MAAM,+BAA+B,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEtF,eAAO,MAAM,0BAA0B,GAAI,OAAO,+BAA+B,gCAEhF,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEtF,eAAO,MAAM,0BAA0B,GAAI,gCAIxC,+BAA+B,gCAEjC,CAAC;AAMF,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAElE,eAAO,MAAM,eAAe,GAAI,mCAAmC,oBAAoB,gCAOtF,CAAC"}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button } from "../button.js";
|
|
4
|
-
import { HoverCard, HoverCardContent, HoverCardTrigger } from "../hover-card.js";
|
|
5
|
-
import { cn } from "../../lib/utils.js";
|
|
6
|
-
import { FileTextIcon, GlobeIcon, ImageIcon, Music2Icon, PaperclipIcon, VideoIcon, XIcon, } from "lucide-react";
|
|
7
|
-
import { createContext, useCallback, useContext, useMemo } from "react";
|
|
8
|
-
const mediaCategoryIcons = {
|
|
9
|
-
audio: Music2Icon,
|
|
10
|
-
document: FileTextIcon,
|
|
11
|
-
image: ImageIcon,
|
|
12
|
-
source: GlobeIcon,
|
|
13
|
-
unknown: PaperclipIcon,
|
|
14
|
-
video: VideoIcon,
|
|
15
|
-
};
|
|
16
|
-
// ============================================================================
|
|
17
|
-
// Utility Functions
|
|
18
|
-
// ============================================================================
|
|
19
|
-
export const getMediaCategory = (data) => {
|
|
20
|
-
if (data.type === "source-document") {
|
|
21
|
-
return "source";
|
|
22
|
-
}
|
|
23
|
-
const mediaType = data.mediaType ?? "";
|
|
24
|
-
if (mediaType.startsWith("image/")) {
|
|
25
|
-
return "image";
|
|
26
|
-
}
|
|
27
|
-
if (mediaType.startsWith("video/")) {
|
|
28
|
-
return "video";
|
|
29
|
-
}
|
|
30
|
-
if (mediaType.startsWith("audio/")) {
|
|
31
|
-
return "audio";
|
|
32
|
-
}
|
|
33
|
-
if (mediaType.startsWith("application/") || mediaType.startsWith("text/")) {
|
|
34
|
-
return "document";
|
|
35
|
-
}
|
|
36
|
-
return "unknown";
|
|
37
|
-
};
|
|
38
|
-
export const getAttachmentLabel = (data) => {
|
|
39
|
-
if (data.type === "source-document") {
|
|
40
|
-
return data.title || data.filename || "Source";
|
|
41
|
-
}
|
|
42
|
-
const category = getMediaCategory(data);
|
|
43
|
-
return data.filename || (category === "image" ? "Image" : "Attachment");
|
|
44
|
-
};
|
|
45
|
-
const renderAttachmentImage = (url, filename, isGrid) => isGrid ? (_jsx("img", { alt: filename || "Image", className: "size-full object-cover", height: 96, src: url, width: 96 })) : (_jsx("img", { alt: filename || "Image", className: "size-full rounded object-cover", height: 20, src: url, width: 20 }));
|
|
46
|
-
const AttachmentsContext = createContext(null);
|
|
47
|
-
const AttachmentContext = createContext(null);
|
|
48
|
-
// ============================================================================
|
|
49
|
-
// Hooks
|
|
50
|
-
// ============================================================================
|
|
51
|
-
export const useAttachmentsContext = () => useContext(AttachmentsContext) ?? { variant: "grid" };
|
|
52
|
-
export const useAttachmentContext = () => {
|
|
53
|
-
const ctx = useContext(AttachmentContext);
|
|
54
|
-
if (!ctx) {
|
|
55
|
-
throw new Error("Attachment components must be used within <Attachment>");
|
|
56
|
-
}
|
|
57
|
-
return ctx;
|
|
58
|
-
};
|
|
59
|
-
export const Attachments = ({ variant = "grid", className, children, ...props }) => {
|
|
60
|
-
const contextValue = useMemo(() => ({ variant }), [variant]);
|
|
61
|
-
return (_jsx(AttachmentsContext.Provider, { value: contextValue, children: _jsx("div", { className: cn("flex items-start", variant === "list" ? "flex-col gap-2" : "flex-wrap gap-2", variant === "grid" && "ml-auto w-fit", className), ...props, children: children }) }));
|
|
62
|
-
};
|
|
63
|
-
export const Attachment = ({ data, onRemove, className, children, ...props }) => {
|
|
64
|
-
const { variant } = useAttachmentsContext();
|
|
65
|
-
const mediaCategory = getMediaCategory(data);
|
|
66
|
-
const contextValue = useMemo(() => ({ data, mediaCategory, onRemove, variant }), [data, mediaCategory, onRemove, variant]);
|
|
67
|
-
return (_jsx(AttachmentContext.Provider, { value: contextValue, children: _jsx("div", { className: cn("group relative", variant === "grid" && "size-24 overflow-hidden rounded-lg", variant === "inline" && [
|
|
68
|
-
"flex h-8 cursor-pointer select-none items-center gap-1.5",
|
|
69
|
-
"rounded-md border border-border px-1.5",
|
|
70
|
-
"nc-transition-paint font-medium text-sm",
|
|
71
|
-
"hover:bg-accent hover:text-accent-foreground",
|
|
72
|
-
], variant === "list" && [
|
|
73
|
-
"flex w-full items-center gap-3 rounded-lg border p-3",
|
|
74
|
-
"hover:bg-accent/50",
|
|
75
|
-
], className), ...props, children: children }) }));
|
|
76
|
-
};
|
|
77
|
-
export const AttachmentPreview = ({ fallbackIcon, className, ...props }) => {
|
|
78
|
-
const { data, mediaCategory, variant } = useAttachmentContext();
|
|
79
|
-
const iconSize = variant === "inline" ? "size-3" : "size-4";
|
|
80
|
-
const renderIcon = (Icon) => (_jsx(Icon, { className: cn(iconSize, "text-muted-foreground") }));
|
|
81
|
-
const renderContent = () => {
|
|
82
|
-
if (mediaCategory === "image" && data.type === "file" && data.url) {
|
|
83
|
-
return renderAttachmentImage(data.url, data.filename, variant === "grid");
|
|
84
|
-
}
|
|
85
|
-
if (mediaCategory === "video" && data.type === "file" && data.url) {
|
|
86
|
-
return _jsx("video", { className: "size-full object-cover", muted: true, src: data.url });
|
|
87
|
-
}
|
|
88
|
-
const Icon = mediaCategoryIcons[mediaCategory];
|
|
89
|
-
return fallbackIcon ?? renderIcon(Icon);
|
|
90
|
-
};
|
|
91
|
-
return (_jsx("div", { className: cn("flex shrink-0 items-center justify-center overflow-hidden", variant === "grid" && "size-full bg-muted", variant === "inline" && "size-5 rounded bg-background", variant === "list" && "size-12 rounded bg-muted", className), ...props, children: renderContent() }));
|
|
92
|
-
};
|
|
93
|
-
export const AttachmentInfo = ({ showMediaType = false, className, ...props }) => {
|
|
94
|
-
const { data, variant } = useAttachmentContext();
|
|
95
|
-
const label = getAttachmentLabel(data);
|
|
96
|
-
if (variant === "grid") {
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
return (_jsxs("div", { className: cn("min-w-0 flex-1", className), ...props, children: [_jsx("span", { className: "block truncate", children: label }), showMediaType && data.mediaType && (_jsx("span", { className: "block truncate text-muted-foreground text-xs", children: data.mediaType }))] }));
|
|
100
|
-
};
|
|
101
|
-
export const AttachmentRemove = ({ label = "Remove", className, children, ...props }) => {
|
|
102
|
-
const { onRemove, variant } = useAttachmentContext();
|
|
103
|
-
const handleClick = useCallback((e) => {
|
|
104
|
-
e.stopPropagation();
|
|
105
|
-
onRemove?.();
|
|
106
|
-
}, [onRemove]);
|
|
107
|
-
if (!onRemove) {
|
|
108
|
-
return null;
|
|
109
|
-
}
|
|
110
|
-
return (_jsxs(Button, { "aria-label": label, className: cn(variant === "grid" && [
|
|
111
|
-
"absolute top-2 right-2 size-6 rounded-full p-0",
|
|
112
|
-
"bg-background/80 backdrop-blur-sm",
|
|
113
|
-
"opacity-0 transition-opacity group-hover:opacity-100",
|
|
114
|
-
"hover:bg-background",
|
|
115
|
-
"[&>svg]:size-3",
|
|
116
|
-
], variant === "inline" && [
|
|
117
|
-
"size-5 rounded p-0",
|
|
118
|
-
"opacity-0 transition-opacity group-hover:opacity-100",
|
|
119
|
-
"[&>svg]:size-2.5",
|
|
120
|
-
], variant === "list" && ["size-8 shrink-0 rounded p-0", "[&>svg]:size-4"], className), onClick: handleClick, type: "button", variant: "ghost", ...props, children: [children ?? _jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: label })] }));
|
|
121
|
-
};
|
|
122
|
-
export const AttachmentHoverCard = (props) => _jsx(HoverCard, { ...props });
|
|
123
|
-
export const AttachmentHoverCardTrigger = (props) => (_jsx(HoverCardTrigger, { closeDelay: 0, delay: 0, ...props }));
|
|
124
|
-
export const AttachmentHoverCardContent = ({ align = "start", className, ...props }) => (_jsx(HoverCardContent, { align: align, className: cn("w-auto p-2", className), ...props }));
|
|
125
|
-
export const AttachmentEmpty = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex items-center justify-center p-4 text-muted-foreground text-sm", className), ...props, children: children ?? "No attachments" }));
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Experimental_SpeechResult as SpeechResult } from "ai";
|
|
2
|
-
import { MediaControlBar, MediaController, MediaDurationDisplay, MediaMuteButton, MediaPlayButton, MediaSeekBackwardButton, MediaSeekForwardButton, MediaTimeDisplay, MediaTimeRange, MediaVolumeRange } from "media-chrome/react";
|
|
3
|
-
import type { ComponentProps } from "react";
|
|
4
|
-
export type AudioPlayerProps = Omit<ComponentProps<typeof MediaController>, "audio">;
|
|
5
|
-
export declare const AudioPlayer: ({ children, style, ...props }: AudioPlayerProps) => import("react").JSX.Element;
|
|
6
|
-
export type AudioPlayerElementProps = Omit<ComponentProps<"audio">, "src"> & ({
|
|
7
|
-
data: SpeechResult["audio"];
|
|
8
|
-
} | {
|
|
9
|
-
src: string;
|
|
10
|
-
});
|
|
11
|
-
export declare const AudioPlayerElement: ({ tabIndex, ...props }: AudioPlayerElementProps) => import("react").JSX.Element;
|
|
12
|
-
export type AudioPlayerControlBarProps = ComponentProps<typeof MediaControlBar>;
|
|
13
|
-
export declare const AudioPlayerControlBar: ({ children, ...props }: AudioPlayerControlBarProps) => import("react").JSX.Element;
|
|
14
|
-
export type AudioPlayerPlayButtonProps = ComponentProps<typeof MediaPlayButton>;
|
|
15
|
-
export declare const AudioPlayerPlayButton: ({ className, ...props }: AudioPlayerPlayButtonProps) => import("react").JSX.Element;
|
|
16
|
-
export type AudioPlayerSeekBackwardButtonProps = ComponentProps<typeof MediaSeekBackwardButton>;
|
|
17
|
-
export declare const AudioPlayerSeekBackwardButton: ({ seekOffset, ...props }: AudioPlayerSeekBackwardButtonProps) => import("react").JSX.Element;
|
|
18
|
-
export type AudioPlayerSeekForwardButtonProps = ComponentProps<typeof MediaSeekForwardButton>;
|
|
19
|
-
export declare const AudioPlayerSeekForwardButton: ({ seekOffset, ...props }: AudioPlayerSeekForwardButtonProps) => import("react").JSX.Element;
|
|
20
|
-
export type AudioPlayerTimeDisplayProps = ComponentProps<typeof MediaTimeDisplay>;
|
|
21
|
-
export declare const AudioPlayerTimeDisplay: ({ className, ...props }: AudioPlayerTimeDisplayProps) => import("react").JSX.Element;
|
|
22
|
-
export type AudioPlayerTimeRangeProps = ComponentProps<typeof MediaTimeRange>;
|
|
23
|
-
export declare const AudioPlayerTimeRange: ({ className, ...props }: AudioPlayerTimeRangeProps) => import("react").JSX.Element;
|
|
24
|
-
export type AudioPlayerDurationDisplayProps = ComponentProps<typeof MediaDurationDisplay>;
|
|
25
|
-
export declare const AudioPlayerDurationDisplay: ({ className, ...props }: AudioPlayerDurationDisplayProps) => import("react").JSX.Element;
|
|
26
|
-
export type AudioPlayerMuteButtonProps = ComponentProps<typeof MediaMuteButton>;
|
|
27
|
-
export declare const AudioPlayerMuteButton: ({ className, ...props }: AudioPlayerMuteButtonProps) => import("react").JSX.Element;
|
|
28
|
-
export type AudioPlayerVolumeRangeProps = ComponentProps<typeof MediaVolumeRange>;
|
|
29
|
-
export declare const AudioPlayerVolumeRange: ({ className, ...props }: AudioPlayerVolumeRangeProps) => import("react").JSX.Element;
|
|
30
|
-
//# sourceMappingURL=audio-player.d.ts.map
|