@ciridae/ui-agent 0.3.2 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/dist/ciridae-agent.css +5 -0
- package/dist/ciridae-agent.css.d.ts +2 -0
- package/dist/components/agentic/agent-card.d.ts +28 -0
- package/dist/components/agentic/agent-card.js +27 -0
- package/dist/components/agentic/agent-composer.d.ts +42 -0
- package/dist/components/agentic/agent-composer.js +89 -0
- package/dist/components/agentic/agent-context.d.ts +28 -0
- package/dist/components/agentic/agent-context.js +102 -0
- package/dist/components/agentic/agent-plan.js +1 -1
- package/dist/components/agentic/approval-request.d.ts +1 -1
- package/dist/components/agentic/assistant-mark-icon.d.ts +9 -0
- package/dist/components/agentic/assistant-mark-icon.js +12 -0
- package/dist/components/agentic/attachments-actions.d.ts +10 -0
- package/dist/components/agentic/attachments-actions.js +142 -0
- package/dist/components/agentic/attachments-context.d.ts +25 -0
- package/dist/components/agentic/attachments-context.js +196 -0
- package/dist/components/agentic/attachments-model.d.ts +23 -0
- package/dist/components/agentic/attachments-model.js +226 -0
- package/dist/components/agentic/attachments-preview.d.ts +7 -0
- package/dist/components/agentic/attachments-preview.js +25 -0
- package/dist/components/agentic/attachments-types.d.ts +87 -0
- package/dist/components/agentic/attachments-types.js +1 -0
- package/dist/components/agentic/attachments-ui.d.ts +14 -0
- package/dist/components/agentic/attachments-ui.js +90 -0
- package/dist/components/agentic/attachments.d.ts +5 -124
- package/dist/components/agentic/attachments.js +5 -591
- package/dist/components/agentic/audio-player.d.ts +16 -0
- package/dist/components/agentic/audio-player.js +21 -0
- package/dist/components/agentic/breathing-grid-icon.css +45 -0
- package/dist/components/agentic/breathing-grid-icon.css.d.ts +2 -0
- package/dist/components/agentic/breathing-grid-icon.d.ts +6 -0
- package/dist/components/agentic/breathing-grid-icon.js +7 -0
- package/dist/components/agentic/canvas.d.ts +10 -0
- package/dist/components/agentic/canvas.js +22 -0
- package/dist/components/agentic/code-block.js +1 -1
- package/dist/components/agentic/commit.d.ts +57 -0
- package/dist/components/agentic/commit.js +85 -0
- package/dist/components/agentic/connection.d.ts +3 -0
- package/dist/components/agentic/connection.js +8 -0
- package/dist/components/agentic/controls.d.ts +6 -0
- package/dist/components/agentic/controls.js +7 -0
- package/dist/components/agentic/conversation.d.ts +1 -1
- package/dist/components/agentic/edge.d.ts +8 -0
- package/dist/components/agentic/edge.js +65 -0
- package/dist/components/agentic/effort-selector.d.ts +43 -0
- package/dist/components/agentic/effort-selector.js +47 -0
- package/dist/components/agentic/environment-variables.d.ts +32 -0
- package/dist/components/agentic/environment-variables.js +66 -0
- package/dist/components/agentic/jsx-preview.d.ts +19 -0
- package/dist/components/agentic/jsx-preview.js +34 -0
- package/dist/components/agentic/message.d.ts +4 -4
- package/dist/components/agentic/message.js +48 -8
- package/dist/components/agentic/mic-selector.d.ts +58 -0
- package/dist/components/agentic/mic-selector.js +173 -0
- package/dist/components/agentic/node.d.ts +26 -0
- package/dist/components/agentic/node.js +29 -0
- package/dist/components/agentic/open-in-chat.d.ts +9 -0
- package/dist/components/agentic/open-in-chat.js +8 -0
- package/dist/components/agentic/package-info.d.ts +30 -0
- package/dist/components/agentic/package-info.js +44 -0
- package/dist/components/agentic/panel.d.ts +6 -0
- package/dist/components/agentic/panel.js +7 -0
- package/dist/components/agentic/persona.d.ts +16 -0
- package/dist/components/agentic/persona.js +116 -0
- package/dist/components/agentic/prompt-input-select.js +1 -1
- package/dist/components/agentic/prompt-input.d.ts +9 -9
- package/dist/components/agentic/prompt-input.js +7 -7
- package/dist/components/agentic/reasoning.d.ts +1 -1
- package/dist/components/agentic/reasoning.js +2 -2
- package/dist/components/agentic/run-checkpoint.d.ts +1 -1
- package/dist/components/agentic/shimmer.d.ts +2 -2
- package/dist/components/agentic/speech-input.d.ts +24 -0
- package/dist/components/agentic/speech-input.js +30 -0
- package/dist/components/agentic/stack-trace.d.ts +27 -0
- package/dist/components/agentic/stack-trace.js +76 -0
- package/dist/components/agentic/suggestion.d.ts +12 -0
- package/dist/components/agentic/suggestion.js +15 -0
- package/dist/components/agentic/test-results.d.ts +51 -0
- package/dist/components/agentic/test-results.js +83 -0
- package/dist/components/agentic/theme.d.ts +5 -0
- package/dist/components/agentic/theme.js +31 -0
- package/dist/components/agentic/tool.d.ts +1 -1
- package/dist/components/agentic/toolbar.d.ts +6 -0
- package/dist/components/agentic/toolbar.js +7 -0
- package/dist/components/agentic/transcription.d.ts +20 -0
- package/dist/components/agentic/transcription.js +32 -0
- package/dist/components/agentic/use-controllable-state.d.ts +6 -0
- package/dist/components/agentic/use-controllable-state.js +13 -0
- package/dist/components/agentic/voice-selector.d.ts +69 -0
- package/dist/components/agentic/voice-selector.js +122 -0
- package/dist/components/blocks/artifact-workbench.d.ts +9 -0
- package/dist/components/blocks/artifact-workbench.js +28 -0
- package/dist/components/blocks/tool-approval-panel.d.ts +11 -0
- package/dist/components/blocks/tool-approval-panel.js +11 -0
- package/dist/components/blocks/voice-agent-panel.d.ts +14 -0
- package/dist/components/blocks/voice-agent-panel.js +60 -0
- package/dist/components/blocks/workflow-canvas-panel.d.ts +18 -0
- package/dist/components/blocks/workflow-canvas-panel.js +106 -0
- package/dist/entries/agent-card.d.ts +1 -0
- package/dist/entries/agent-card.js +1 -0
- package/dist/entries/agent-composer.d.ts +1 -0
- package/dist/entries/agent-composer.js +1 -0
- package/dist/entries/agent-context.d.ts +1 -0
- package/dist/entries/agent-context.js +1 -0
- package/dist/entries/agent-plan.d.ts +1 -0
- package/dist/entries/agent-plan.js +1 -0
- package/dist/entries/agent-queue.d.ts +1 -0
- package/dist/entries/agent-queue.js +1 -0
- package/dist/entries/agent-task.d.ts +1 -0
- package/dist/entries/agent-task.js +1 -0
- package/dist/entries/agentic-types.d.ts +1 -0
- package/dist/entries/agentic-types.js +1 -0
- package/dist/entries/approval-request.d.ts +1 -0
- package/dist/entries/approval-request.js +1 -0
- package/dist/entries/artifact-workbench.d.ts +1 -0
- package/dist/entries/artifact-workbench.js +1 -0
- package/dist/entries/artifact.d.ts +1 -0
- package/dist/entries/artifact.js +1 -0
- package/dist/entries/assistant-mark-icon.d.ts +1 -0
- package/dist/entries/assistant-mark-icon.js +1 -0
- package/dist/entries/attachments-actions.d.ts +1 -0
- package/dist/entries/attachments-actions.js +1 -0
- package/dist/entries/attachments-context.d.ts +1 -0
- package/dist/entries/attachments-context.js +1 -0
- package/dist/entries/attachments-model.d.ts +1 -0
- package/dist/entries/attachments-model.js +1 -0
- package/dist/entries/attachments-preview.d.ts +1 -0
- package/dist/entries/attachments-preview.js +1 -0
- package/dist/entries/attachments-types.d.ts +1 -0
- package/dist/entries/attachments-types.js +1 -0
- package/dist/entries/attachments-ui.d.ts +1 -0
- package/dist/entries/attachments-ui.js +1 -0
- package/dist/entries/attachments.d.ts +1 -0
- package/dist/entries/attachments.js +1 -0
- package/dist/entries/audio-player.d.ts +1 -0
- package/dist/entries/audio-player.js +1 -0
- package/dist/entries/breathing-grid-icon.d.ts +1 -0
- package/dist/entries/breathing-grid-icon.js +1 -0
- package/dist/entries/canvas.d.ts +1 -0
- package/dist/entries/canvas.js +1 -0
- package/dist/entries/clipboard.d.ts +1 -0
- package/dist/entries/clipboard.js +1 -0
- package/dist/entries/code-block.d.ts +1 -0
- package/dist/entries/code-block.js +1 -0
- package/dist/entries/commit.d.ts +1 -0
- package/dist/entries/commit.js +1 -0
- package/dist/entries/connection.d.ts +1 -0
- package/dist/entries/connection.js +1 -0
- package/dist/entries/controls.d.ts +1 -0
- package/dist/entries/controls.js +1 -0
- package/dist/entries/conversation.d.ts +1 -0
- package/dist/entries/conversation.js +1 -0
- package/dist/entries/edge.d.ts +1 -0
- package/dist/entries/edge.js +1 -0
- package/dist/entries/effort-selector.d.ts +1 -0
- package/dist/entries/effort-selector.js +1 -0
- package/dist/entries/environment-variables.d.ts +1 -0
- package/dist/entries/environment-variables.js +1 -0
- package/dist/entries/file-tree.d.ts +1 -0
- package/dist/entries/file-tree.js +1 -0
- package/dist/entries/image.d.ts +1 -0
- package/dist/entries/image.js +1 -0
- package/dist/entries/inline-citation.d.ts +1 -0
- package/dist/entries/inline-citation.js +1 -0
- package/dist/entries/jsx-preview.d.ts +1 -0
- package/dist/entries/jsx-preview.js +1 -0
- package/dist/entries/message-branch.d.ts +1 -0
- package/dist/entries/message-branch.js +1 -0
- package/dist/entries/message.d.ts +1 -0
- package/dist/entries/message.js +1 -0
- package/dist/entries/mic-selector.d.ts +1 -0
- package/dist/entries/mic-selector.js +1 -0
- package/dist/entries/model-selector.d.ts +1 -0
- package/dist/entries/model-selector.js +1 -0
- package/dist/entries/node.d.ts +1 -0
- package/dist/entries/node.js +1 -0
- package/dist/entries/open-in-chat.d.ts +1 -0
- package/dist/entries/open-in-chat.js +1 -0
- package/dist/entries/package-info.d.ts +1 -0
- package/dist/entries/package-info.js +1 -0
- package/dist/entries/panel.d.ts +1 -0
- package/dist/entries/panel.js +1 -0
- package/dist/entries/persona.d.ts +1 -0
- package/dist/entries/persona.js +1 -0
- package/dist/entries/prompt-input-action-menu.d.ts +1 -0
- package/dist/entries/prompt-input-action-menu.js +1 -0
- package/dist/entries/prompt-input-command.d.ts +1 -0
- package/dist/entries/prompt-input-command.js +1 -0
- package/dist/entries/prompt-input-hover-card.d.ts +1 -0
- package/dist/entries/prompt-input-hover-card.js +1 -0
- package/dist/entries/prompt-input-select.d.ts +1 -0
- package/dist/entries/prompt-input-select.js +1 -0
- package/dist/entries/prompt-input-tabs.d.ts +1 -0
- package/dist/entries/prompt-input-tabs.js +1 -0
- package/dist/entries/prompt-input.d.ts +1 -0
- package/dist/entries/prompt-input.js +1 -0
- package/dist/entries/reasoning.d.ts +1 -0
- package/dist/entries/reasoning.js +1 -0
- package/dist/entries/run-checkpoint.d.ts +1 -0
- package/dist/entries/run-checkpoint.js +1 -0
- package/dist/entries/run-trace.d.ts +1 -0
- package/dist/entries/run-trace.js +1 -0
- package/dist/entries/sandbox.d.ts +1 -0
- package/dist/entries/sandbox.js +1 -0
- package/dist/entries/schema-display.d.ts +1 -0
- package/dist/entries/schema-display.js +1 -0
- package/dist/entries/shimmer.d.ts +1 -0
- package/dist/entries/shimmer.js +1 -0
- package/dist/entries/snippet.d.ts +1 -0
- package/dist/entries/snippet.js +1 -0
- package/dist/entries/sources.d.ts +1 -0
- package/dist/entries/sources.js +1 -0
- package/dist/entries/speech-input.d.ts +1 -0
- package/dist/entries/speech-input.js +1 -0
- package/dist/entries/stack-trace.d.ts +1 -0
- package/dist/entries/stack-trace.js +1 -0
- package/dist/entries/suggestion.d.ts +1 -0
- package/dist/entries/suggestion.js +1 -0
- package/dist/entries/terminal.d.ts +1 -0
- package/dist/entries/terminal.js +1 -0
- package/dist/entries/test-results.d.ts +1 -0
- package/dist/entries/test-results.js +1 -0
- package/dist/entries/theme.d.ts +1 -0
- package/dist/entries/theme.js +1 -0
- package/dist/entries/tool-approval-panel.d.ts +1 -0
- package/dist/entries/tool-approval-panel.js +1 -0
- package/dist/entries/tool.d.ts +1 -0
- package/dist/entries/tool.js +1 -0
- package/dist/entries/toolbar.d.ts +1 -0
- package/dist/entries/toolbar.js +1 -0
- package/dist/entries/transcription.d.ts +1 -0
- package/dist/entries/transcription.js +1 -0
- package/dist/entries/types.d.ts +1 -0
- package/dist/entries/types.js +1 -0
- package/dist/entries/use-controllable-state.d.ts +1 -0
- package/dist/entries/use-controllable-state.js +1 -0
- package/dist/entries/voice-agent-panel.d.ts +1 -0
- package/dist/entries/voice-agent-panel.js +1 -0
- package/dist/entries/voice-selector.d.ts +1 -0
- package/dist/entries/voice-selector.js +1 -0
- package/dist/entries/web-preview.d.ts +1 -0
- package/dist/entries/web-preview.js +1 -0
- package/dist/entries/workflow-canvas-panel.d.ts +1 -0
- package/dist/entries/workflow-canvas-panel.js +1 -0
- package/dist/style-imports.d.ts +3 -0
- package/dist/styled-system/styles.css +422 -0
- package/dist/styled-system/styles.css.d.ts +2 -0
- package/dist/styles.css +7 -0
- package/package.json +17 -137
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
2
|
import { Streamdown } from "streamdown";
|
|
3
|
-
import { MessageBranch, MessageBranchContent, MessageBranchNext, MessageBranchPage, MessageBranchPrevious, MessageBranchSelector, type MessageBranchContentProps, type MessageBranchNextProps, type MessageBranchPageProps, type MessageBranchPreviousProps, type MessageBranchProps, type MessageBranchSelectorProps } from "
|
|
4
|
-
import type { AgenticMessageRole } from "
|
|
5
|
-
import "
|
|
3
|
+
import { MessageBranch, MessageBranchContent, MessageBranchNext, MessageBranchPage, MessageBranchPrevious, MessageBranchSelector, type MessageBranchContentProps, type MessageBranchNextProps, type MessageBranchPageProps, type MessageBranchPreviousProps, type MessageBranchProps, type MessageBranchSelectorProps } from "./message-branch";
|
|
4
|
+
import type { AgenticMessageRole } from "./types";
|
|
5
|
+
import "./message-response.css";
|
|
6
6
|
import { Button } from "@ciridae/ui/button";
|
|
7
7
|
type MessageProps = React.ComponentProps<"div"> & {
|
|
8
8
|
role: AgenticMessageRole;
|
|
@@ -23,7 +23,7 @@ declare function Message({ className, role, ...props }: MessageProps): React.JSX
|
|
|
23
23
|
declare function MessageContent({ className, variant, ...props }: MessageContentProps): React.JSX.Element;
|
|
24
24
|
declare function MessageActions({ className, ...props }: MessageActionsProps): React.JSX.Element;
|
|
25
25
|
declare function MessageAction({ children, label, tooltip, variant, size, ...props }: MessageActionProps): React.JSX.Element;
|
|
26
|
-
declare const MessageResponse: React.MemoExoticComponent<({ animated, className, components, isStreaming, plugins, ...props }: MessageResponseProps) => React.JSX.Element>;
|
|
26
|
+
declare const MessageResponse: React.MemoExoticComponent<({ animated, className, components, controls, icons, isAnimating, isStreaming, mermaid: mermaidOptions, plugins, prefix, translations, ...props }: MessageResponseProps) => React.JSX.Element>;
|
|
27
27
|
declare function MessageToolbar({ className, ...props }: MessageToolbarProps): React.JSX.Element;
|
|
28
28
|
export { Message, MessageAction, MessageActions, MessageBranch, MessageBranchContent, MessageBranchNext, MessageBranchPage, MessageBranchPrevious, MessageBranchSelector, MessageContent, MessageResponse, MessageToolbar, };
|
|
29
29
|
export type { MessageActionProps, MessageActionsProps, MessageBranchContentProps, MessageBranchNextProps, MessageBranchPageProps, MessageBranchPreviousProps, MessageBranchProps, MessageBranchSelectorProps, MessageContentProps, MessageProps, MessageResponseProps, MessageToolbarProps, };
|
|
@@ -5,16 +5,19 @@ import { math } from "@streamdown/math";
|
|
|
5
5
|
import { mermaid } from "@streamdown/mermaid";
|
|
6
6
|
import { createContext, memo, useContext, useEffect, useMemo, useState } from "react";
|
|
7
7
|
import { bundledLanguages } from "shiki";
|
|
8
|
-
import { Streamdown } from "streamdown";
|
|
9
|
-
import { CodeBlock, CodeBlockContent, CodeBlockCopyButton, CodeBlockHeader, CodeBlockTitle, } from "
|
|
10
|
-
import { MessageBranch, MessageBranchContent, MessageBranchNext, MessageBranchPage, MessageBranchPrevious, MessageBranchSelector, } from "
|
|
11
|
-
import "
|
|
8
|
+
import { Streamdown, useIsCodeFenceIncomplete, } from "streamdown";
|
|
9
|
+
import { CodeBlock, CodeBlockContent, CodeBlockCopyButton, CodeBlockHeader, CodeBlockTitle, } from "./code-block";
|
|
10
|
+
import { MessageBranch, MessageBranchContent, MessageBranchNext, MessageBranchPage, MessageBranchPrevious, MessageBranchSelector, } from "./message-branch";
|
|
11
|
+
import "./message-response.css";
|
|
12
12
|
import { Button } from "@ciridae/ui/button";
|
|
13
13
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@ciridae/ui/tooltip";
|
|
14
14
|
import { cn } from "@ciridae/ui/utils";
|
|
15
15
|
import { css, cva } from "@ciridae/ui/styled-system/css";
|
|
16
16
|
const MessageResponseStreamingContext = createContext(false);
|
|
17
17
|
const streamdownPlugins = { cjk, code, math, mermaid };
|
|
18
|
+
const MessageResponseRendererOptionsContext = createContext({
|
|
19
|
+
plugins: streamdownPlugins,
|
|
20
|
+
});
|
|
18
21
|
const messageResponseComponents = {
|
|
19
22
|
code: MessageResponseCode,
|
|
20
23
|
};
|
|
@@ -138,22 +141,59 @@ function MessageAction({ children, label, tooltip, variant = "ghost", size = "ic
|
|
|
138
141
|
return button;
|
|
139
142
|
return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: button }), _jsx(TooltipContent, { children: _jsx("p", { children: tooltip }) })] }) }));
|
|
140
143
|
}
|
|
141
|
-
const MessageResponse = memo(function MessageResponse({ animated, className, components, isStreaming = false, plugins, ...props }) {
|
|
144
|
+
const MessageResponse = memo(function MessageResponse({ animated, className, components, controls, icons, isAnimating = false, isStreaming = false, mermaid: mermaidOptions, plugins, prefix, translations, ...props }) {
|
|
142
145
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
146
|
+
const isActivelyStreaming = isAnimating || isStreaming;
|
|
143
147
|
const resolvedAnimation = animated === true ? messageResponseAnimation : animated;
|
|
144
148
|
const resolvedComponents = useMemo(() => ({ ...messageResponseComponents, ...components }), [components]);
|
|
145
149
|
const resolvedPlugins = useMemo(() => ({ ...streamdownPlugins, ...plugins }), [plugins]);
|
|
146
|
-
|
|
150
|
+
const rendererOptions = useMemo(() => ({
|
|
151
|
+
controls,
|
|
152
|
+
icons,
|
|
153
|
+
mermaid: mermaidOptions,
|
|
154
|
+
plugins: resolvedPlugins,
|
|
155
|
+
prefix,
|
|
156
|
+
translations,
|
|
157
|
+
}), [controls, icons, mermaidOptions, prefix, resolvedPlugins, translations]);
|
|
158
|
+
return (_jsx(MessageResponseStreamingContext.Provider, { value: isActivelyStreaming, children: _jsx(MessageResponseRendererOptionsContext.Provider, { value: rendererOptions, children: _jsx(Streamdown, { animated: prefersReducedMotion ? false : resolvedAnimation, className: cn("agentic-message-response", className), components: resolvedComponents, controls: controls, icons: icons, isAnimating: isActivelyStreaming, mermaid: mermaidOptions, plugins: resolvedPlugins, prefix: prefix, translations: translations, ...props }) }) }));
|
|
147
159
|
});
|
|
148
160
|
MessageResponse.displayName = "MessageResponse";
|
|
149
|
-
function MessageResponseCode({ children, className, "data-block": dataBlock, ...props }) {
|
|
161
|
+
function MessageResponseCode({ children, className, "data-block": dataBlock, node, ...props }) {
|
|
150
162
|
const isStreaming = useContext(MessageResponseStreamingContext);
|
|
163
|
+
const rendererOptions = useContext(MessageResponseRendererOptionsContext);
|
|
164
|
+
const isIncomplete = useIsCodeFenceIncomplete();
|
|
151
165
|
if (!dataBlock) {
|
|
152
166
|
return (_jsx("code", { className: className, ...props, children: children }));
|
|
153
167
|
}
|
|
154
168
|
const language = getCodeLanguage(className);
|
|
155
169
|
const codeText = getCodeText(children);
|
|
156
|
-
|
|
170
|
+
const meta = typeof node?.properties?.metastring === "string" ? node.properties.metastring : undefined;
|
|
171
|
+
if (language === "mermaid" && !isIncomplete && canRenderMermaid(rendererOptions.plugins)) {
|
|
172
|
+
return _jsx(MessageResponseMermaid, { code: codeText, meta: meta });
|
|
173
|
+
}
|
|
174
|
+
return (_jsxs(CodeBlock, { code: codeText, language: language, className: messageResponseCodeBlockClassName, children: [_jsxs(CodeBlockHeader, { children: [_jsx(CodeBlockTitle, { className: messageResponseCodeTitleClassName, children: language }), _jsx(CodeBlockCopyButton, { size: "icon-sm" })] }), _jsx(CodeBlockContent, { streaming: isStreaming || isIncomplete })] }));
|
|
175
|
+
}
|
|
176
|
+
function MessageResponseMermaid({ code, meta }) {
|
|
177
|
+
const { controls, icons, mermaid: mermaidOptions, plugins, prefix, translations, } = useContext(MessageResponseRendererOptionsContext);
|
|
178
|
+
return (_jsx(Streamdown, { className: "agentic-message-response", controls: controls, icons: icons, mermaid: mermaidOptions, mode: "static", plugins: plugins, prefix: prefix, translations: translations, children: createMermaidMarkdown(code, meta) }));
|
|
179
|
+
}
|
|
180
|
+
function canRenderMermaid(plugins) {
|
|
181
|
+
if (plugins.mermaid)
|
|
182
|
+
return true;
|
|
183
|
+
return Boolean(plugins.renderers?.some(({ language }) => Array.isArray(language) ? language.includes("mermaid") : language === "mermaid"));
|
|
184
|
+
}
|
|
185
|
+
function createMermaidMarkdown(code, meta) {
|
|
186
|
+
// CommonMark forbids backticks in the info string of a backtick fence, so
|
|
187
|
+
// metadata carrying one (possible with tilde-fenced input) needs a tilde fence.
|
|
188
|
+
const fenceCharacter = meta?.includes("`") ? "~" : "`";
|
|
189
|
+
const longestFenceRun = code
|
|
190
|
+
.match(fenceCharacter === "~" ? /~+/g : /`+/g)
|
|
191
|
+
?.reduce((longest, run) => {
|
|
192
|
+
return Math.max(longest, run.length);
|
|
193
|
+
}, 0);
|
|
194
|
+
const fence = fenceCharacter.repeat(Math.max(3, (longestFenceRun ?? 0) + 1));
|
|
195
|
+
const info = meta === undefined ? "mermaid" : `mermaid ${meta}`;
|
|
196
|
+
return `${fence}${info}\n${code}\n${fence}`;
|
|
157
197
|
}
|
|
158
198
|
function getCodeLanguage(className) {
|
|
159
199
|
const language = className?.match(/language-([^\s]+)/)?.[1];
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { AgenticMicOption } from "./types";
|
|
3
|
+
import { CommandEmpty, CommandInput, CommandItem, CommandList } from "@ciridae/ui/command";
|
|
4
|
+
import { Popover, PopoverContent, PopoverTrigger } from "@ciridae/ui/popover";
|
|
5
|
+
type MicSelectorContextValue = {
|
|
6
|
+
data: AgenticMicOption[];
|
|
7
|
+
open: boolean;
|
|
8
|
+
setOpen: (open: boolean) => void;
|
|
9
|
+
setValue: (value: string | undefined) => void;
|
|
10
|
+
setWidth: (width: number) => void;
|
|
11
|
+
value: string | undefined;
|
|
12
|
+
width: number;
|
|
13
|
+
};
|
|
14
|
+
type MicSelectorProps = React.ComponentProps<typeof Popover> & {
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
mics?: AgenticMicOption[];
|
|
17
|
+
onValueChange?: (value: string | undefined) => void;
|
|
18
|
+
value?: string;
|
|
19
|
+
};
|
|
20
|
+
type MicSelectorTriggerProps = React.ComponentProps<typeof PopoverTrigger>;
|
|
21
|
+
type MicSelectorContentProps = React.ComponentProps<typeof PopoverContent> & {
|
|
22
|
+
popoverOptions?: React.ComponentProps<typeof PopoverContent>;
|
|
23
|
+
};
|
|
24
|
+
type MicSelectorInputProps = React.ComponentProps<typeof CommandInput>;
|
|
25
|
+
type MicSelectorListProps = Omit<React.ComponentProps<typeof CommandList>, "children"> & {
|
|
26
|
+
children: (mics: AgenticMicOption[]) => React.ReactNode;
|
|
27
|
+
};
|
|
28
|
+
type MicSelectorEmptyProps = React.ComponentProps<typeof CommandEmpty>;
|
|
29
|
+
type MicSelectorItemProps = React.ComponentProps<typeof CommandItem> & {
|
|
30
|
+
mic?: AgenticMicOption;
|
|
31
|
+
};
|
|
32
|
+
type MicSelectorLabelProps = React.ComponentProps<"span"> & {
|
|
33
|
+
mic: AgenticMicOption;
|
|
34
|
+
};
|
|
35
|
+
type MicSelectorValueProps = React.ComponentProps<"span"> & {
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
};
|
|
38
|
+
declare function MicSelector({ children, defaultOpen, defaultValue, mics, onOpenChange, onValueChange, open: openProp, value: valueProp, ...props }: MicSelectorProps): React.JSX.Element;
|
|
39
|
+
declare function useMicSelector(): MicSelectorContextValue;
|
|
40
|
+
declare function useAudioDevices({ enabled }?: {
|
|
41
|
+
enabled?: boolean;
|
|
42
|
+
}): {
|
|
43
|
+
devices: AgenticMicOption[];
|
|
44
|
+
error: string | null;
|
|
45
|
+
hasPermission: boolean;
|
|
46
|
+
loadDevices: () => Promise<void>;
|
|
47
|
+
loading: boolean;
|
|
48
|
+
};
|
|
49
|
+
declare function MicSelectorTrigger({ children, ...props }: MicSelectorTriggerProps): React.JSX.Element;
|
|
50
|
+
declare function MicSelectorContent({ className, popoverOptions, style, ...props }: MicSelectorContentProps): React.JSX.Element;
|
|
51
|
+
declare function MicSelectorInput(props: MicSelectorInputProps): React.JSX.Element;
|
|
52
|
+
declare function MicSelectorList({ children, ...props }: MicSelectorListProps): React.JSX.Element;
|
|
53
|
+
declare function MicSelectorEmpty({ children, ...props }: MicSelectorEmptyProps): React.JSX.Element;
|
|
54
|
+
declare function MicSelectorItem({ children, mic, onSelect, value, ...props }: MicSelectorItemProps): React.JSX.Element;
|
|
55
|
+
declare function MicSelectorLabel({ className, mic, ...props }: MicSelectorLabelProps): React.JSX.Element;
|
|
56
|
+
declare function MicSelectorValue({ className, placeholder, ...props }: MicSelectorValueProps): React.JSX.Element;
|
|
57
|
+
export { MicSelector, MicSelectorContent, MicSelectorEmpty, MicSelectorInput, MicSelectorItem, MicSelectorLabel, MicSelectorList, MicSelectorTrigger, MicSelectorValue, useAudioDevices, useMicSelector, };
|
|
58
|
+
export type { MicSelectorContentProps, MicSelectorEmptyProps, MicSelectorInputProps, MicSelectorItemProps, MicSelectorLabelProps, MicSelectorListProps, MicSelectorProps, MicSelectorTriggerProps, MicSelectorValueProps, };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable max-lines, react-refresh/only-export-components */
|
|
3
|
+
import { ChevronsUpDownIcon } from "lucide-react";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { Button } from "@ciridae/ui/button";
|
|
6
|
+
import { Command, CommandEmpty, CommandInput, CommandItem, CommandList } from "@ciridae/ui/command";
|
|
7
|
+
import { Popover, PopoverContent, PopoverTrigger } from "@ciridae/ui/popover";
|
|
8
|
+
import { cn } from "@ciridae/ui/utils";
|
|
9
|
+
import { useControllableState } from "./use-controllable-state";
|
|
10
|
+
const deviceIdRegex = /\(([\da-fA-F]{4}:[\da-fA-F]{4})\)$/;
|
|
11
|
+
const MicSelectorContext = React.createContext(null);
|
|
12
|
+
function MicSelector({ children, defaultOpen = false, defaultValue, mics, onOpenChange, onValueChange, open: openProp, value: valueProp, ...props }) {
|
|
13
|
+
const [value, setValue] = useControllableState({
|
|
14
|
+
defaultValue,
|
|
15
|
+
onChange: onValueChange,
|
|
16
|
+
value: valueProp,
|
|
17
|
+
});
|
|
18
|
+
const [open, setOpen] = useControllableState({
|
|
19
|
+
defaultValue: defaultOpen,
|
|
20
|
+
onChange: onOpenChange,
|
|
21
|
+
value: openProp,
|
|
22
|
+
});
|
|
23
|
+
const [width, setWidth] = React.useState(200);
|
|
24
|
+
const audioDevices = useAudioDevices({ enabled: !mics });
|
|
25
|
+
const { devices: detectedMics, hasPermission, loadDevices, loading: devicesLoading, } = audioDevices;
|
|
26
|
+
const attemptedPermissionRef = React.useRef(false);
|
|
27
|
+
React.useEffect(() => {
|
|
28
|
+
if (open && !mics && !hasPermission && !devicesLoading && !attemptedPermissionRef.current) {
|
|
29
|
+
attemptedPermissionRef.current = true;
|
|
30
|
+
void loadDevices();
|
|
31
|
+
}
|
|
32
|
+
}, [devicesLoading, hasPermission, loadDevices, mics, open]);
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
if (!open)
|
|
35
|
+
attemptedPermissionRef.current = false;
|
|
36
|
+
}, [open]);
|
|
37
|
+
const contextValue = React.useMemo(() => ({
|
|
38
|
+
data: mics ?? detectedMics,
|
|
39
|
+
open,
|
|
40
|
+
setOpen,
|
|
41
|
+
setValue,
|
|
42
|
+
setWidth,
|
|
43
|
+
value,
|
|
44
|
+
width,
|
|
45
|
+
}), [detectedMics, mics, open, setOpen, setValue, value, width]);
|
|
46
|
+
return (_jsx(MicSelectorContext.Provider, { value: contextValue, children: _jsx(Popover, { onOpenChange: setOpen, open: open, ...props, children: children ?? _jsx(MicSelectorDefaultContent, {}) }) }));
|
|
47
|
+
}
|
|
48
|
+
function MicSelectorDefaultContent() {
|
|
49
|
+
return (_jsxs(_Fragment, { children: [_jsx(MicSelectorTrigger, { asChild: true, children: _jsxs(Button, { className: "w-64 justify-between", variant: "outline", children: [_jsx(MicSelectorValue, { className: "max-w-52 text-left" }), _jsx(ChevronsUpDownIcon, { className: "size-4 opacity-60" })] }) }), _jsxs(MicSelectorContent, { children: [_jsx(MicSelectorInput, { placeholder: "Search microphones..." }), _jsx(MicSelectorList, { children: (devices) => (_jsxs(_Fragment, { children: [_jsx(MicSelectorEmpty, { children: "No microphone found." }), devices.map((mic) => (_jsx(MicSelectorItem, { mic: mic }, mic.id)))] })) })] })] }));
|
|
50
|
+
}
|
|
51
|
+
function useMicSelector() {
|
|
52
|
+
const context = React.useContext(MicSelectorContext);
|
|
53
|
+
if (!context)
|
|
54
|
+
throw new Error("MicSelector components must be used within MicSelector");
|
|
55
|
+
return context;
|
|
56
|
+
}
|
|
57
|
+
function useAudioDevices({ enabled = true } = {}) {
|
|
58
|
+
const [devices, setDevices] = React.useState([]);
|
|
59
|
+
const [error, setError] = React.useState(null);
|
|
60
|
+
const [hasPermission, setHasPermission] = React.useState(false);
|
|
61
|
+
const [loading, setLoading] = React.useState(false);
|
|
62
|
+
const loadDevicesWithoutPermission = React.useCallback(async () => {
|
|
63
|
+
if (!enabled || !navigator.mediaDevices?.enumerateDevices)
|
|
64
|
+
return;
|
|
65
|
+
try {
|
|
66
|
+
setLoading(true);
|
|
67
|
+
setError(null);
|
|
68
|
+
const deviceList = await navigator.mediaDevices.enumerateDevices();
|
|
69
|
+
setDevices(deviceList.filter(isAudioInput).map(mediaDeviceToMicOption));
|
|
70
|
+
}
|
|
71
|
+
catch (caughtError) {
|
|
72
|
+
setError(caughtError instanceof Error ? caughtError.message : "Failed to get audio devices");
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
setLoading(false);
|
|
76
|
+
}
|
|
77
|
+
}, [enabled]);
|
|
78
|
+
const loadDevices = React.useCallback(async () => {
|
|
79
|
+
if (!enabled || !navigator.mediaDevices?.getUserMedia)
|
|
80
|
+
return;
|
|
81
|
+
try {
|
|
82
|
+
setLoading(true);
|
|
83
|
+
setError(null);
|
|
84
|
+
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
85
|
+
for (const track of stream.getTracks())
|
|
86
|
+
track.stop();
|
|
87
|
+
const deviceList = await navigator.mediaDevices.enumerateDevices();
|
|
88
|
+
setDevices(deviceList.filter(isAudioInput).map(mediaDeviceToMicOption));
|
|
89
|
+
setHasPermission(true);
|
|
90
|
+
}
|
|
91
|
+
catch (caughtError) {
|
|
92
|
+
setError(caughtError instanceof Error ? caughtError.message : "Failed to get audio devices");
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
setLoading(false);
|
|
96
|
+
}
|
|
97
|
+
}, [enabled]);
|
|
98
|
+
React.useEffect(() => {
|
|
99
|
+
void loadDevicesWithoutPermission();
|
|
100
|
+
}, [loadDevicesWithoutPermission]);
|
|
101
|
+
React.useEffect(() => {
|
|
102
|
+
if (!enabled || !navigator.mediaDevices?.addEventListener)
|
|
103
|
+
return;
|
|
104
|
+
const handleDeviceChange = () => {
|
|
105
|
+
void (hasPermission ? loadDevices() : loadDevicesWithoutPermission());
|
|
106
|
+
};
|
|
107
|
+
navigator.mediaDevices.addEventListener("devicechange", handleDeviceChange);
|
|
108
|
+
return () => navigator.mediaDevices.removeEventListener("devicechange", handleDeviceChange);
|
|
109
|
+
}, [enabled, hasPermission, loadDevices, loadDevicesWithoutPermission]);
|
|
110
|
+
return { devices, error, hasPermission, loadDevices, loading };
|
|
111
|
+
}
|
|
112
|
+
function MicSelectorTrigger({ children, ...props }) {
|
|
113
|
+
const { setWidth } = useMicSelector();
|
|
114
|
+
const ref = React.useRef(null);
|
|
115
|
+
React.useEffect(() => {
|
|
116
|
+
if (!ref.current)
|
|
117
|
+
return;
|
|
118
|
+
const resizeObserver = new ResizeObserver(([entry]) => {
|
|
119
|
+
if (entry?.target instanceof HTMLElement)
|
|
120
|
+
setWidth(entry.target.offsetWidth);
|
|
121
|
+
});
|
|
122
|
+
resizeObserver.observe(ref.current);
|
|
123
|
+
return () => resizeObserver.disconnect();
|
|
124
|
+
}, [setWidth]);
|
|
125
|
+
return (_jsx(PopoverTrigger, { ref: ref, ...props, children: children }));
|
|
126
|
+
}
|
|
127
|
+
function MicSelectorContent({ className, popoverOptions, style, ...props }) {
|
|
128
|
+
const { width } = useMicSelector();
|
|
129
|
+
const { className: popoverClassName, style: popoverStyle, ...popoverContentOptions } = popoverOptions ?? {};
|
|
130
|
+
return (_jsx(PopoverContent, { align: "start", ...popoverContentOptions, ...props, className: cn("p-0", popoverClassName, className), style: { ...popoverStyle, ...style, width }, children: _jsx(Command, { children: props.children }) }));
|
|
131
|
+
}
|
|
132
|
+
function MicSelectorInput(props) {
|
|
133
|
+
return _jsx(CommandInput, { ...props });
|
|
134
|
+
}
|
|
135
|
+
function MicSelectorList({ children, ...props }) {
|
|
136
|
+
const { data } = useMicSelector();
|
|
137
|
+
return _jsx(CommandList, { ...props, children: children(data) });
|
|
138
|
+
}
|
|
139
|
+
function MicSelectorEmpty({ children = "No microphone found.", ...props }) {
|
|
140
|
+
return _jsx(CommandEmpty, { ...props, children: children });
|
|
141
|
+
}
|
|
142
|
+
function MicSelectorItem({ children, mic, onSelect, value, ...props }) {
|
|
143
|
+
const { setOpen, setValue } = useMicSelector();
|
|
144
|
+
const itemValue = value ?? mic?.id;
|
|
145
|
+
return (_jsx(CommandItem, { onSelect: (currentValue) => {
|
|
146
|
+
setValue(itemValue ?? currentValue);
|
|
147
|
+
setOpen(false);
|
|
148
|
+
onSelect?.(currentValue);
|
|
149
|
+
}, value: itemValue, ...props, children: children ?? (mic ? _jsx(MicSelectorLabel, { mic: mic }) : null) }));
|
|
150
|
+
}
|
|
151
|
+
function MicSelectorLabel({ className, mic, ...props }) {
|
|
152
|
+
const matches = mic.label.match(deviceIdRegex);
|
|
153
|
+
const deviceId = matches?.[1];
|
|
154
|
+
const name = deviceId ? mic.label.replace(deviceIdRegex, "").trim() : mic.label;
|
|
155
|
+
return (_jsxs("span", { className: cn("grid min-w-0 gap-0.5", className), ...props, children: [_jsx("span", { className: "truncate", children: name }), _jsx("span", { className: "truncate text-xs text-muted-foreground", children: mic.description ?? (deviceId ? `Device ${deviceId}` : "Audio input") })] }));
|
|
156
|
+
}
|
|
157
|
+
function MicSelectorValue({ className, placeholder = "Select microphone...", ...props }) {
|
|
158
|
+
const { data, value } = useMicSelector();
|
|
159
|
+
const currentDevice = data.find((device) => device.id === value);
|
|
160
|
+
return (_jsx("span", { className: cn("truncate", className), ...props, children: currentDevice?.label ?? placeholder }));
|
|
161
|
+
}
|
|
162
|
+
function isAudioInput(device) {
|
|
163
|
+
return device.kind === "audioinput";
|
|
164
|
+
}
|
|
165
|
+
function mediaDeviceToMicOption(device) {
|
|
166
|
+
return {
|
|
167
|
+
description: device.groupId ? `Group ${device.groupId.slice(0, 8)}` : undefined,
|
|
168
|
+
id: device.deviceId,
|
|
169
|
+
label: device.label || "Microphone",
|
|
170
|
+
mediaType: device.kind,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
export { MicSelector, MicSelectorContent, MicSelectorEmpty, MicSelectorInput, MicSelectorItem, MicSelectorLabel, MicSelectorList, MicSelectorTrigger, MicSelectorValue, useAudioDevices, useMicSelector, };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { Position } from "@xyflow/react";
|
|
3
|
+
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@ciridae/ui/card";
|
|
4
|
+
type NodeProps = React.ComponentProps<typeof Card> & {
|
|
5
|
+
handles?: {
|
|
6
|
+
source?: boolean;
|
|
7
|
+
target?: boolean;
|
|
8
|
+
};
|
|
9
|
+
sourcePosition?: Position;
|
|
10
|
+
targetPosition?: Position;
|
|
11
|
+
};
|
|
12
|
+
type NodeHeaderProps = React.ComponentProps<typeof CardHeader>;
|
|
13
|
+
type NodeTitleProps = React.ComponentProps<typeof CardTitle>;
|
|
14
|
+
type NodeDescriptionProps = React.ComponentProps<typeof CardDescription>;
|
|
15
|
+
type NodeActionProps = React.ComponentProps<typeof CardAction>;
|
|
16
|
+
type NodeContentProps = React.ComponentProps<typeof CardContent>;
|
|
17
|
+
type NodeFooterProps = React.ComponentProps<typeof CardFooter>;
|
|
18
|
+
declare function Node({ children, className, handles, sourcePosition, targetPosition, ...props }: NodeProps): React.JSX.Element;
|
|
19
|
+
declare function NodeHeader({ className, ...props }: NodeHeaderProps): React.JSX.Element;
|
|
20
|
+
declare function NodeTitle(props: NodeTitleProps): React.JSX.Element;
|
|
21
|
+
declare function NodeDescription(props: NodeDescriptionProps): React.JSX.Element;
|
|
22
|
+
declare function NodeAction(props: NodeActionProps): React.JSX.Element;
|
|
23
|
+
declare function NodeContent({ className, ...props }: NodeContentProps): React.JSX.Element;
|
|
24
|
+
declare function NodeFooter({ className, ...props }: NodeFooterProps): React.JSX.Element;
|
|
25
|
+
export { Node, NodeAction, NodeContent, NodeDescription, NodeFooter, NodeHeader, NodeTitle };
|
|
26
|
+
export type { NodeActionProps, NodeContentProps, NodeDescriptionProps, NodeFooterProps, NodeHeaderProps, NodeProps, NodeTitleProps, };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Handle, Position } from "@xyflow/react";
|
|
3
|
+
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@ciridae/ui/card";
|
|
4
|
+
import { cn } from "@ciridae/ui/utils";
|
|
5
|
+
function Node({ children, className, handles = { source: true, target: true }, sourcePosition = Position.Right, targetPosition = Position.Left, ...props }) {
|
|
6
|
+
return (_jsxs(Card, { "data-slot": "node", className: cn("relative min-w-60 gap-3 py-4 shadow-xs", "data-[selected=true]:border-ring data-[selected=true]:ring-2 data-[selected=true]:ring-ring/20", className), ...props, children: [handles.target ? _jsx(NodeHandle, { position: targetPosition, type: "target" }) : null, children, handles.source ? _jsx(NodeHandle, { position: sourcePosition, type: "source" }) : null] }));
|
|
7
|
+
}
|
|
8
|
+
function NodeHandle({ position, type }) {
|
|
9
|
+
return (_jsx(Handle, { className: "size-2.5! border-2! border-background! bg-foreground!", position: position, type: type }));
|
|
10
|
+
}
|
|
11
|
+
function NodeHeader({ className, ...props }) {
|
|
12
|
+
return _jsx(CardHeader, { className: cn("gap-1 px-4", className), ...props });
|
|
13
|
+
}
|
|
14
|
+
function NodeTitle(props) {
|
|
15
|
+
return _jsx(CardTitle, { ...props });
|
|
16
|
+
}
|
|
17
|
+
function NodeDescription(props) {
|
|
18
|
+
return _jsx(CardDescription, { ...props });
|
|
19
|
+
}
|
|
20
|
+
function NodeAction(props) {
|
|
21
|
+
return _jsx(CardAction, { ...props });
|
|
22
|
+
}
|
|
23
|
+
function NodeContent({ className, ...props }) {
|
|
24
|
+
return _jsx(CardContent, { className: cn("px-4 text-sm", className), ...props });
|
|
25
|
+
}
|
|
26
|
+
function NodeFooter({ className, ...props }) {
|
|
27
|
+
return (_jsx(CardFooter, { className: cn("items-center justify-between px-4 text-xs", className), ...props }));
|
|
28
|
+
}
|
|
29
|
+
export { Node, NodeAction, NodeContent, NodeDescription, NodeFooter, NodeHeader, NodeTitle };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { Button } from "@ciridae/ui/button";
|
|
3
|
+
type OpenInChatProps = React.ComponentProps<typeof Button> & {
|
|
4
|
+
label?: string;
|
|
5
|
+
metadataLabel?: string;
|
|
6
|
+
};
|
|
7
|
+
declare function OpenInChat({ children, className, label, metadataLabel, size, type, variant, ...props }: OpenInChatProps): React.JSX.Element;
|
|
8
|
+
export { OpenInChat };
|
|
9
|
+
export type { OpenInChatProps };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { MessageSquareTextIcon } from "lucide-react";
|
|
3
|
+
import { Button } from "@ciridae/ui/button";
|
|
4
|
+
import { cn } from "@ciridae/ui/utils";
|
|
5
|
+
function OpenInChat({ children, className, label = "Open in chat", metadataLabel, size = "sm", type = "button", variant = "outline", ...props }) {
|
|
6
|
+
return (_jsx(Button, { "data-slot": "open-in-chat", className: cn("max-w-full justify-start", className), size: size, type: type, variant: variant, ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsx(MessageSquareTextIcon, { "aria-hidden": "true", className: "size-4" }), _jsx("span", { className: "truncate", children: label }), metadataLabel ? (_jsx("span", { className: "font-mono text-xs text-muted-foreground tabular-nums", children: metadataLabel })) : null] })) }));
|
|
7
|
+
}
|
|
8
|
+
export { OpenInChat };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { Badge } from "@ciridae/ui/badge";
|
|
3
|
+
type PackageChangeType = "added" | "major" | "minor" | "patch" | "removed";
|
|
4
|
+
type PackageInfoProps = React.ComponentProps<"div"> & {
|
|
5
|
+
changeType?: PackageChangeType;
|
|
6
|
+
name: string;
|
|
7
|
+
version?: string;
|
|
8
|
+
};
|
|
9
|
+
type PackageInfoHeaderProps = React.ComponentProps<"div">;
|
|
10
|
+
type PackageInfoNameProps = React.ComponentProps<"div">;
|
|
11
|
+
type PackageInfoChangeTypeProps = React.ComponentProps<typeof Badge>;
|
|
12
|
+
type PackageInfoVersionProps = React.ComponentProps<"div">;
|
|
13
|
+
type PackageInfoDescriptionProps = React.ComponentProps<"p">;
|
|
14
|
+
type PackageInfoContentProps = React.ComponentProps<"div">;
|
|
15
|
+
type PackageInfoDependenciesProps = React.ComponentProps<"div">;
|
|
16
|
+
type PackageInfoDependencyProps = React.ComponentProps<"div"> & {
|
|
17
|
+
name: string;
|
|
18
|
+
version?: string;
|
|
19
|
+
};
|
|
20
|
+
declare function PackageInfo({ children, className, changeType, name, version, ...props }: PackageInfoProps): React.JSX.Element;
|
|
21
|
+
declare function PackageInfoHeader({ className, ...props }: PackageInfoHeaderProps): React.JSX.Element;
|
|
22
|
+
declare function PackageInfoName({ className, ...props }: PackageInfoNameProps): React.JSX.Element;
|
|
23
|
+
declare function PackageInfoChangeType({ children, variant, ...props }: PackageInfoChangeTypeProps): React.JSX.Element | null;
|
|
24
|
+
declare function PackageInfoVersion({ className, ...props }: PackageInfoVersionProps): React.JSX.Element;
|
|
25
|
+
declare function PackageInfoDescription({ className, ...props }: PackageInfoDescriptionProps): React.JSX.Element;
|
|
26
|
+
declare function PackageInfoContent({ className, ...props }: PackageInfoContentProps): React.JSX.Element;
|
|
27
|
+
declare function PackageInfoDependencies({ className, ...props }: PackageInfoDependenciesProps): React.JSX.Element;
|
|
28
|
+
declare function PackageInfoDependency({ children, className, name, version, ...props }: PackageInfoDependencyProps): React.JSX.Element;
|
|
29
|
+
export { PackageInfo, PackageInfoChangeType, PackageInfoContent, PackageInfoDependencies, PackageInfoDependency, PackageInfoDescription, PackageInfoHeader, PackageInfoName, PackageInfoVersion, };
|
|
30
|
+
export type { PackageChangeType, PackageInfoChangeTypeProps, PackageInfoContentProps, PackageInfoDependenciesProps, PackageInfoDependencyProps, PackageInfoDescriptionProps, PackageInfoHeaderProps, PackageInfoNameProps, PackageInfoProps, PackageInfoVersionProps, };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PackageIcon } from "lucide-react";
|
|
3
|
+
import { createContext, useContext, useMemo } from "react";
|
|
4
|
+
import { Badge } from "@ciridae/ui/badge";
|
|
5
|
+
import { cn } from "@ciridae/ui/utils";
|
|
6
|
+
const PackageInfoContext = createContext({ name: "" });
|
|
7
|
+
function usePackageInfo() {
|
|
8
|
+
return useContext(PackageInfoContext);
|
|
9
|
+
}
|
|
10
|
+
function PackageInfo({ children, className, changeType, name, version, ...props }) {
|
|
11
|
+
const contextValue = useMemo(() => ({ changeType, name, version }), [changeType, name, version]);
|
|
12
|
+
return (_jsx(PackageInfoContext.Provider, { value: contextValue, children: _jsx("div", { "data-slot": "package-info", className: cn("grid gap-3 rounded-lg border bg-card p-4", className), ...props, children: children }) }));
|
|
13
|
+
}
|
|
14
|
+
function PackageInfoHeader({ className, ...props }) {
|
|
15
|
+
return (_jsx("div", { "data-slot": "package-info-header", className: cn("flex min-w-0 items-start justify-between gap-3", className), ...props }));
|
|
16
|
+
}
|
|
17
|
+
function PackageInfoName({ className, ...props }) {
|
|
18
|
+
const { name } = usePackageInfo();
|
|
19
|
+
return (_jsxs("div", { "data-slot": "package-info-name", className: cn("flex min-w-0 items-center gap-2 text-sm font-medium", className), ...props, children: [_jsx(PackageIcon, { "aria-hidden": "true", className: "size-4 shrink-0 text-muted-foreground" }), _jsx("span", { className: "truncate", children: props.children ?? name })] }));
|
|
20
|
+
}
|
|
21
|
+
function PackageInfoChangeType({ children, variant = "outline", ...props }) {
|
|
22
|
+
const { changeType } = usePackageInfo();
|
|
23
|
+
const label = children ?? changeType;
|
|
24
|
+
if (!label)
|
|
25
|
+
return null;
|
|
26
|
+
return (_jsx(Badge, { "data-slot": "package-info-change-type", variant: variant, ...props, children: label }));
|
|
27
|
+
}
|
|
28
|
+
function PackageInfoVersion({ className, ...props }) {
|
|
29
|
+
const { version } = usePackageInfo();
|
|
30
|
+
return (_jsx("div", { "data-slot": "package-info-version", className: cn("font-mono text-xs text-muted-foreground", className), ...props, children: props.children ?? version }));
|
|
31
|
+
}
|
|
32
|
+
function PackageInfoDescription({ className, ...props }) {
|
|
33
|
+
return (_jsx("p", { "data-slot": "package-info-description", className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
34
|
+
}
|
|
35
|
+
function PackageInfoContent({ className, ...props }) {
|
|
36
|
+
return _jsx("div", { "data-slot": "package-info-content", className: cn("grid gap-3", className), ...props });
|
|
37
|
+
}
|
|
38
|
+
function PackageInfoDependencies({ className, ...props }) {
|
|
39
|
+
return (_jsx("div", { "data-slot": "package-info-dependencies", className: cn("grid gap-1", className), ...props }));
|
|
40
|
+
}
|
|
41
|
+
function PackageInfoDependency({ children, className, name, version, ...props }) {
|
|
42
|
+
return (_jsxs("div", { "data-slot": "package-info-dependency", className: cn("flex min-w-0 items-center justify-between gap-3 rounded-md bg-muted/40 px-2 py-1 text-sm", className), ...props, children: [_jsx("span", { className: "truncate font-mono text-xs", children: children ?? name }), version ? (_jsx("span", { className: "shrink-0 font-mono text-xs text-muted-foreground", children: version })) : null] }));
|
|
43
|
+
}
|
|
44
|
+
export { PackageInfo, PackageInfoChangeType, PackageInfoContent, PackageInfoDependencies, PackageInfoDependency, PackageInfoDescription, PackageInfoHeader, PackageInfoName, PackageInfoVersion, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { Panel as PanelPrimitive } from "@xyflow/react";
|
|
3
|
+
type PanelProps = React.ComponentProps<typeof PanelPrimitive>;
|
|
4
|
+
declare function Panel({ className, ...props }: PanelProps): React.JSX.Element;
|
|
5
|
+
export { Panel };
|
|
6
|
+
export type { PanelProps };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Panel as PanelPrimitive } from "@xyflow/react";
|
|
3
|
+
import { cn } from "@ciridae/ui/utils";
|
|
4
|
+
function Panel({ className, ...props }) {
|
|
5
|
+
return (_jsx(PanelPrimitive, { "data-slot": "panel", className: cn("rounded-lg border bg-card p-2 text-card-foreground shadow-xs", className), ...props }));
|
|
6
|
+
}
|
|
7
|
+
export { Panel };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { RiveParameters } from "@rive-app/react-webgl2";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
type PersonaState = "idle" | "listening" | "thinking" | "speaking" | "asleep";
|
|
4
|
+
type PersonaContainerProps = Omit<React.ComponentProps<"div">, "onLoad" | "onLoadError" | "onPause" | "onPlay" | "onReady" | "onStop">;
|
|
5
|
+
type PersonaProps = PersonaContainerProps & {
|
|
6
|
+
onLoad?: RiveParameters["onLoad"];
|
|
7
|
+
onLoadError?: RiveParameters["onLoadError"];
|
|
8
|
+
onPause?: RiveParameters["onPause"];
|
|
9
|
+
onPlay?: RiveParameters["onPlay"];
|
|
10
|
+
onReady?: () => void;
|
|
11
|
+
onStop?: RiveParameters["onStop"];
|
|
12
|
+
state?: PersonaState;
|
|
13
|
+
};
|
|
14
|
+
declare const Persona: React.MemoExoticComponent<({ className, onLoad, onLoadError, onPause, onPlay, onReady, onStop, state, ...props }: PersonaProps) => React.JSX.Element>;
|
|
15
|
+
export { Persona };
|
|
16
|
+
export type { PersonaProps, PersonaState };
|