@ciridae/ui-agent 0.3.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.
Files changed (70) hide show
  1. package/README.md +19 -0
  2. package/dist/components/agentic/agent-plan.d.ts +27 -0
  3. package/dist/components/agentic/agent-plan.js +43 -0
  4. package/dist/components/agentic/agent-queue.d.ts +46 -0
  5. package/dist/components/agentic/agent-queue.js +53 -0
  6. package/dist/components/agentic/agent-task.d.ts +16 -0
  7. package/dist/components/agentic/agent-task.js +20 -0
  8. package/dist/components/agentic/approval-request.d.ts +24 -0
  9. package/dist/components/agentic/approval-request.js +57 -0
  10. package/dist/components/agentic/artifact.d.ts +24 -0
  11. package/dist/components/agentic/artifact.js +147 -0
  12. package/dist/components/agentic/attachments.d.ts +124 -0
  13. package/dist/components/agentic/attachments.js +591 -0
  14. package/dist/components/agentic/clipboard.d.ts +2 -0
  15. package/dist/components/agentic/clipboard.js +12 -0
  16. package/dist/components/agentic/code-block.d.ts +44 -0
  17. package/dist/components/agentic/code-block.js +182 -0
  18. package/dist/components/agentic/conversation.d.ts +25 -0
  19. package/dist/components/agentic/conversation.js +56 -0
  20. package/dist/components/agentic/file-tree.d.ts +24 -0
  21. package/dist/components/agentic/file-tree.js +56 -0
  22. package/dist/components/agentic/image.d.ts +9 -0
  23. package/dist/components/agentic/image.js +11 -0
  24. package/dist/components/agentic/inline-citation.d.ts +40 -0
  25. package/dist/components/agentic/inline-citation.js +111 -0
  26. package/dist/components/agentic/message-branch.d.ts +20 -0
  27. package/dist/components/agentic/message-branch.js +83 -0
  28. package/dist/components/agentic/message-response.css +242 -0
  29. package/dist/components/agentic/message-response.css.d.ts +2 -0
  30. package/dist/components/agentic/message.d.ts +29 -0
  31. package/dist/components/agentic/message.js +191 -0
  32. package/dist/components/agentic/model-selector.d.ts +39 -0
  33. package/dist/components/agentic/model-selector.js +47 -0
  34. package/dist/components/agentic/prompt-input-action-menu.d.ts +16 -0
  35. package/dist/components/agentic/prompt-input-action-menu.js +22 -0
  36. package/dist/components/agentic/prompt-input-command.d.ts +18 -0
  37. package/dist/components/agentic/prompt-input-command.js +25 -0
  38. package/dist/components/agentic/prompt-input-hover-card.d.ts +10 -0
  39. package/dist/components/agentic/prompt-input-hover-card.js +13 -0
  40. package/dist/components/agentic/prompt-input-select.d.ts +14 -0
  41. package/dist/components/agentic/prompt-input-select.js +19 -0
  42. package/dist/components/agentic/prompt-input-tabs.d.ts +17 -0
  43. package/dist/components/agentic/prompt-input-tabs.js +45 -0
  44. package/dist/components/agentic/prompt-input.d.ts +66 -0
  45. package/dist/components/agentic/prompt-input.js +227 -0
  46. package/dist/components/agentic/reasoning.d.ts +21 -0
  47. package/dist/components/agentic/reasoning.js +106 -0
  48. package/dist/components/agentic/run-checkpoint.d.ts +13 -0
  49. package/dist/components/agentic/run-checkpoint.js +19 -0
  50. package/dist/components/agentic/run-trace.d.ts +30 -0
  51. package/dist/components/agentic/run-trace.js +56 -0
  52. package/dist/components/agentic/sandbox.d.ts +24 -0
  53. package/dist/components/agentic/sandbox.js +33 -0
  54. package/dist/components/agentic/schema-display.d.ts +39 -0
  55. package/dist/components/agentic/schema-display.js +56 -0
  56. package/dist/components/agentic/shimmer.d.ts +11 -0
  57. package/dist/components/agentic/shimmer.js +16 -0
  58. package/dist/components/agentic/snippet.d.ts +18 -0
  59. package/dist/components/agentic/snippet.js +35 -0
  60. package/dist/components/agentic/sources.d.ts +16 -0
  61. package/dist/components/agentic/sources.js +130 -0
  62. package/dist/components/agentic/terminal.d.ts +24 -0
  63. package/dist/components/agentic/terminal.js +47 -0
  64. package/dist/components/agentic/tool.d.ts +25 -0
  65. package/dist/components/agentic/tool.js +73 -0
  66. package/dist/components/agentic/types.d.ts +172 -0
  67. package/dist/components/agentic/types.js +1 -0
  68. package/dist/components/agentic/web-preview.d.ts +25 -0
  69. package/dist/components/agentic/web-preview.js +33 -0
  70. package/package.json +179 -0
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { BrainIcon, ChevronDownIcon, DotIcon } from "lucide-react";
3
+ import { createContext, memo, useCallback, useContext, useMemo, useState } from "react";
4
+ import { Badge } from "@ciridae/ui/badge";
5
+ import { cn } from "@ciridae/ui/utils";
6
+ const RunTraceContext = createContext(null);
7
+ const stepStatusClasses = {
8
+ active: "text-foreground",
9
+ complete: "text-muted-foreground",
10
+ pending: "text-muted-foreground/50",
11
+ };
12
+ function useRunTrace() {
13
+ const context = useContext(RunTraceContext);
14
+ if (!context)
15
+ throw new Error("RunTrace components must be used within RunTrace");
16
+ return context;
17
+ }
18
+ const RunTrace = memo(function RunTrace({ children, className, defaultOpen = false, onOpenChange, open, ...props }) {
19
+ const [internalOpen, setInternalOpen] = useState(defaultOpen);
20
+ const isControlled = open !== undefined;
21
+ const isOpen = open ?? internalOpen;
22
+ const setIsOpen = useCallback((nextOpen) => {
23
+ if (!isControlled)
24
+ setInternalOpen(nextOpen);
25
+ onOpenChange?.(nextOpen);
26
+ }, [isControlled, onOpenChange]);
27
+ const contextValue = useMemo(() => ({ isOpen, setIsOpen }), [isOpen, setIsOpen]);
28
+ return (_jsx(RunTraceContext.Provider, { value: contextValue, children: _jsx("div", { "data-slot": "run-trace", className: cn("grid w-full gap-3", className), ...props, children: children }) }));
29
+ });
30
+ const RunTraceHeader = memo(function RunTraceHeader({ children, className, onClick, type = "button", ...props }) {
31
+ const { isOpen, setIsOpen } = useRunTrace();
32
+ return (_jsxs("button", { "data-slot": "run-trace-header", "aria-expanded": isOpen, className: cn("flex w-full items-center gap-2 rounded-md text-left text-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-[var(--focus-ring-width)] focus-visible:ring-ring focus-visible:outline-none", className), ...props, onClick: (event) => {
33
+ onClick?.(event);
34
+ if (!event.defaultPrevented)
35
+ setIsOpen(!isOpen);
36
+ }, type: type, children: [_jsx(BrainIcon, { "aria-hidden": "true", className: "size-4 shrink-0" }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: children ?? "Run trace" }), _jsx(ChevronDownIcon, { "aria-hidden": "true", className: cn("size-4 shrink-0 transition-transform", isOpen ? "rotate-180" : undefined) })] }));
37
+ });
38
+ const RunTraceContent = memo(function RunTraceContent({ children, className, ...props }) {
39
+ const { isOpen } = useRunTrace();
40
+ if (!isOpen)
41
+ return null;
42
+ return (_jsx("div", { "data-slot": "run-trace-content", className: cn("grid gap-3", className), ...props, children: children }));
43
+ });
44
+ const RunTraceStep = memo(function RunTraceStep({ children, className, description, icon: Icon = DotIcon, label, status = "complete", ...props }) {
45
+ return (_jsxs("div", { "data-slot": "run-trace-step", className: cn("flex gap-2 text-sm", stepStatusClasses[status], className), ...props, children: [_jsxs("div", { className: "relative mt-0.5", children: [_jsx(Icon, { "aria-hidden": "true", className: "size-4" }), _jsx("div", { className: "absolute top-7 bottom-0 left-1/2 -mx-px w-px bg-border" })] }), _jsxs("div", { className: "min-w-0 flex-1 space-y-2", children: [_jsx("div", { children: label }), description ? _jsx("div", { className: "text-xs text-muted-foreground", children: description }) : null, children] })] }));
46
+ });
47
+ function RunTraceSearchResults({ className, ...props }) {
48
+ return (_jsx("div", { "data-slot": "run-trace-search-results", className: cn("flex flex-wrap items-center gap-2", className), ...props }));
49
+ }
50
+ function RunTraceSearchResult({ className, variant = "secondary", ...props }) {
51
+ return (_jsx(Badge, { "data-slot": "run-trace-search-result", className: cn("font-normal", className), variant: variant, ...props }));
52
+ }
53
+ function RunTraceImage({ caption, children, className, ...props }) {
54
+ return (_jsxs("div", { "data-slot": "run-trace-image", className: cn("grid gap-2", className), ...props, children: [_jsx("div", { className: "flex max-h-80 items-center justify-center overflow-hidden rounded-lg border bg-muted/40 p-3", children: children }), caption ? _jsx("p", { className: "text-xs text-muted-foreground", children: caption }) : null] }));
55
+ }
56
+ export { RunTrace, RunTraceContent, RunTraceHeader, RunTraceImage, RunTraceSearchResult, RunTraceSearchResults, RunTraceStep, };
@@ -0,0 +1,24 @@
1
+ import type * as React from "react";
2
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@ciridae/ui/collapsible";
3
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@ciridae/ui/tabs";
4
+ type SandboxProps = React.ComponentProps<typeof Collapsible>;
5
+ type SandboxHeaderProps = React.ComponentProps<typeof CollapsibleTrigger> & {
6
+ description?: React.ReactNode;
7
+ title?: React.ReactNode;
8
+ };
9
+ type SandboxContentProps = React.ComponentProps<typeof CollapsibleContent>;
10
+ type SandboxTabsProps = React.ComponentProps<typeof Tabs>;
11
+ type SandboxTabsBarProps = React.ComponentProps<"div">;
12
+ type SandboxTabsListProps = React.ComponentProps<typeof TabsList>;
13
+ type SandboxTabsTriggerProps = React.ComponentProps<typeof TabsTrigger>;
14
+ type SandboxTabContentProps = React.ComponentProps<typeof TabsContent>;
15
+ declare function Sandbox({ className, defaultOpen, ...props }: SandboxProps): React.JSX.Element;
16
+ declare function SandboxHeader({ children, className, description, title, ...props }: SandboxHeaderProps): React.JSX.Element;
17
+ declare function SandboxContent({ className, ...props }: SandboxContentProps): React.JSX.Element;
18
+ declare function SandboxTabs({ className, ...props }: SandboxTabsProps): React.JSX.Element;
19
+ declare function SandboxTabsBar({ className, ...props }: SandboxTabsBarProps): React.JSX.Element;
20
+ declare function SandboxTabsList(props: SandboxTabsListProps): React.JSX.Element;
21
+ declare function SandboxTabsTrigger(props: SandboxTabsTriggerProps): React.JSX.Element;
22
+ declare function SandboxTabContent({ className, ...props }: SandboxTabContentProps): React.JSX.Element;
23
+ export { Sandbox, SandboxContent, SandboxHeader, SandboxTabContent, SandboxTabs, SandboxTabsBar, SandboxTabsList, SandboxTabsTrigger, };
24
+ export type { SandboxContentProps, SandboxHeaderProps, SandboxProps, SandboxTabContentProps, SandboxTabsBarProps, SandboxTabsListProps, SandboxTabsProps, SandboxTabsTriggerProps, };
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ChevronDownIcon } from "lucide-react";
3
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@ciridae/ui/collapsible";
4
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@ciridae/ui/tabs";
5
+ import { cn } from "@ciridae/ui/utils";
6
+ function Sandbox({ className, defaultOpen = true, ...props }) {
7
+ return (_jsx(Collapsible, { "data-slot": "sandbox", className: cn("w-full overflow-hidden rounded-lg border bg-card", className), defaultOpen: defaultOpen, ...props }));
8
+ }
9
+ function SandboxHeader({ children, className, description, title = "Sandbox", ...props }) {
10
+ return (_jsxs(CollapsibleTrigger, { "data-slot": "sandbox-header", className: cn("group flex w-full items-start justify-between gap-3 border-b px-4 py-3 text-left", className), ...props, children: [children ?? _jsx(SandboxHeaderText, { description: description, title: title }), _jsx(ChevronDownIcon, { "aria-hidden": "true", className: "size-4 shrink-0 transition-transform group-data-[state=open]:rotate-180" })] }));
11
+ }
12
+ function SandboxHeaderText({ description, title, }) {
13
+ return (_jsxs("div", { className: "min-w-0 space-y-1", children: [_jsx("div", { className: "truncate text-sm font-medium", children: title }), description ? _jsx("div", { className: "text-sm text-muted-foreground", children: description }) : null] }));
14
+ }
15
+ function SandboxContent({ className, ...props }) {
16
+ return (_jsx(CollapsibleContent, { "data-slot": "sandbox-content", className: cn("min-h-0", className), ...props }));
17
+ }
18
+ function SandboxTabs({ className, ...props }) {
19
+ return (_jsx(Tabs, { "data-slot": "sandbox-tabs", className: cn("flex min-h-0 flex-col", className), ...props }));
20
+ }
21
+ function SandboxTabsBar({ className, ...props }) {
22
+ return (_jsx("div", { "data-slot": "sandbox-tabs-bar", className: cn("flex items-center justify-between gap-3 border-b p-2", className), ...props }));
23
+ }
24
+ function SandboxTabsList(props) {
25
+ return _jsx(TabsList, { "data-slot": "sandbox-tabs-list", ...props });
26
+ }
27
+ function SandboxTabsTrigger(props) {
28
+ return _jsx(TabsTrigger, { "data-slot": "sandbox-tabs-trigger", ...props });
29
+ }
30
+ function SandboxTabContent({ className, ...props }) {
31
+ return (_jsx(TabsContent, { "data-slot": "sandbox-tab-content", className: cn("m-0 min-h-0 p-4", className), ...props }));
32
+ }
33
+ export { Sandbox, SandboxContent, SandboxHeader, SandboxTabContent, SandboxTabs, SandboxTabsBar, SandboxTabsList, SandboxTabsTrigger, };
@@ -0,0 +1,39 @@
1
+ import type * as React from "react";
2
+ import { Badge } from "@ciridae/ui/badge";
3
+ import { Collapsible } from "@ciridae/ui/collapsible";
4
+ type HttpMethod = "DELETE" | "GET" | "PATCH" | "POST" | "PUT";
5
+ type SchemaDisplayProps = React.ComponentProps<"div"> & {
6
+ method?: HttpMethod;
7
+ path?: string;
8
+ };
9
+ type SchemaDisplayHeaderProps = React.ComponentProps<"div">;
10
+ type SchemaDisplayMethodProps = React.ComponentProps<typeof Badge>;
11
+ type SchemaDisplayPathProps = React.ComponentProps<"span">;
12
+ type SchemaDisplayDescriptionProps = React.ComponentProps<"p">;
13
+ type SchemaDisplayContentProps = React.ComponentProps<"div">;
14
+ type SchemaDisplayBodyProps = React.ComponentProps<"div">;
15
+ type SchemaDisplayParameterProps = React.ComponentProps<"div"> & {
16
+ name: string;
17
+ required?: boolean;
18
+ type?: string;
19
+ };
20
+ type SchemaDisplayParametersProps = React.ComponentProps<typeof Collapsible>;
21
+ type SchemaDisplayPropertyProps = SchemaDisplayParameterProps;
22
+ type SchemaDisplayRequestProps = React.ComponentProps<typeof Collapsible>;
23
+ type SchemaDisplayResponseProps = React.ComponentProps<typeof Collapsible>;
24
+ type SchemaDisplayExampleProps = React.ComponentProps<"pre">;
25
+ declare function SchemaDisplay({ children, className, method, path, ...props }: SchemaDisplayProps): React.JSX.Element;
26
+ declare function SchemaDisplayHeader({ className, ...props }: SchemaDisplayHeaderProps): React.JSX.Element;
27
+ declare function SchemaDisplayMethod({ children, variant, ...props }: SchemaDisplayMethodProps): React.JSX.Element;
28
+ declare function SchemaDisplayPath({ className, ...props }: SchemaDisplayPathProps): React.JSX.Element;
29
+ declare function SchemaDisplayDescription({ className, ...props }: SchemaDisplayDescriptionProps): React.JSX.Element;
30
+ declare function SchemaDisplayContent({ className, ...props }: SchemaDisplayContentProps): React.JSX.Element;
31
+ declare function SchemaDisplayBody({ className, ...props }: SchemaDisplayBodyProps): React.JSX.Element;
32
+ declare function SchemaDisplayParameter({ className, name, required, type, ...props }: SchemaDisplayParameterProps): React.JSX.Element;
33
+ declare function SchemaDisplayParameters(props: SchemaDisplayParametersProps): React.JSX.Element;
34
+ declare function SchemaDisplayProperty(props: SchemaDisplayPropertyProps): React.JSX.Element;
35
+ declare function SchemaDisplayRequest(props: SchemaDisplayRequestProps): React.JSX.Element;
36
+ declare function SchemaDisplayResponse(props: SchemaDisplayResponseProps): React.JSX.Element;
37
+ declare function SchemaDisplayExample({ className, ...props }: SchemaDisplayExampleProps): React.JSX.Element;
38
+ export { SchemaDisplay, SchemaDisplayBody, SchemaDisplayContent, SchemaDisplayDescription, SchemaDisplayExample, SchemaDisplayHeader, SchemaDisplayMethod, SchemaDisplayParameter, SchemaDisplayParameters, SchemaDisplayPath, SchemaDisplayProperty, SchemaDisplayRequest, SchemaDisplayResponse, };
39
+ export type { HttpMethod, SchemaDisplayBodyProps, SchemaDisplayContentProps, SchemaDisplayDescriptionProps, SchemaDisplayExampleProps, SchemaDisplayHeaderProps, SchemaDisplayMethodProps, SchemaDisplayParameterProps, SchemaDisplayParametersProps, SchemaDisplayPathProps, SchemaDisplayPropertyProps, SchemaDisplayProps, SchemaDisplayRequestProps, SchemaDisplayResponseProps, };
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ChevronDownIcon } from "lucide-react";
3
+ import { createContext, useContext, useMemo } from "react";
4
+ import { Badge } from "@ciridae/ui/badge";
5
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@ciridae/ui/collapsible";
6
+ import { cn } from "@ciridae/ui/utils";
7
+ const SchemaDisplayContext = createContext({});
8
+ function useSchemaDisplay() {
9
+ return useContext(SchemaDisplayContext);
10
+ }
11
+ function SchemaDisplay({ children, className, method, path, ...props }) {
12
+ const contextValue = useMemo(() => ({ method, path }), [method, path]);
13
+ return (_jsx(SchemaDisplayContext.Provider, { value: contextValue, children: _jsx("div", { "data-slot": "schema-display", className: cn("grid gap-3 rounded-lg border bg-card p-4", className), ...props, children: children }) }));
14
+ }
15
+ function SchemaDisplayHeader({ className, ...props }) {
16
+ return (_jsx("div", { "data-slot": "schema-display-header", className: cn("flex min-w-0 flex-wrap items-center gap-2", className), ...props }));
17
+ }
18
+ function SchemaDisplayMethod({ children, variant = "outline", ...props }) {
19
+ const { method } = useSchemaDisplay();
20
+ return (_jsx(Badge, { "data-slot": "schema-display-method", variant: variant, ...props, children: children ?? method }));
21
+ }
22
+ function SchemaDisplayPath({ className, ...props }) {
23
+ const { path } = useSchemaDisplay();
24
+ return (_jsx("span", { "data-slot": "schema-display-path", className: cn("min-w-0 truncate font-mono text-sm", className), ...props, children: props.children ?? path }));
25
+ }
26
+ function SchemaDisplayDescription({ className, ...props }) {
27
+ return (_jsx("p", { "data-slot": "schema-display-description", className: cn("text-sm text-muted-foreground", className), ...props }));
28
+ }
29
+ function SchemaDisplayContent({ className, ...props }) {
30
+ return (_jsx("div", { "data-slot": "schema-display-content", className: cn("grid gap-3", className), ...props }));
31
+ }
32
+ function SchemaDisplayBody({ className, ...props }) {
33
+ return _jsx("div", { "data-slot": "schema-display-body", className: cn("grid gap-2", className), ...props });
34
+ }
35
+ function SchemaDisplayParameter({ className, name, required, type = "string", ...props }) {
36
+ return (_jsxs("div", { "data-slot": "schema-display-parameter", className: cn("grid gap-1 rounded-md border bg-muted/30 p-2", className), ...props, children: [_jsxs("div", { className: "flex min-w-0 items-center justify-between gap-3", children: [_jsx("span", { className: "truncate font-mono text-xs", children: name }), _jsx("span", { className: "shrink-0 font-mono text-xs text-muted-foreground", children: type })] }), required ? _jsx("div", { className: "text-meta text-muted-foreground", children: "required" }) : null] }));
37
+ }
38
+ function SchemaDisplayParameters(props) {
39
+ return _jsx(SchemaSection, { dataSlot: "schema-display-parameters", label: "Parameters", ...props });
40
+ }
41
+ function SchemaDisplayProperty(props) {
42
+ return _jsx(SchemaDisplayParameter, { "data-slot": "schema-display-property", ...props });
43
+ }
44
+ function SchemaDisplayRequest(props) {
45
+ return _jsx(SchemaSection, { dataSlot: "schema-display-request", label: "Request", ...props });
46
+ }
47
+ function SchemaDisplayResponse(props) {
48
+ return _jsx(SchemaSection, { dataSlot: "schema-display-response", label: "Response", ...props });
49
+ }
50
+ function SchemaDisplayExample({ className, ...props }) {
51
+ return (_jsx("pre", { "data-slot": "schema-display-example", className: cn("overflow-auto rounded-md bg-muted/50 p-3 font-mono text-xs", className), ...props }));
52
+ }
53
+ function SchemaSection({ children, className, dataSlot, defaultOpen = true, label, ...props }) {
54
+ return (_jsxs(Collapsible, { "data-slot": dataSlot, className: cn("rounded-md border", className), defaultOpen: defaultOpen, ...props, children: [_jsxs(CollapsibleTrigger, { className: "group flex w-full items-center justify-between px-3 py-2 text-sm font-medium", children: [_jsx("span", { children: label }), _jsx(ChevronDownIcon, { "aria-hidden": "true", className: "size-4 transition-transform group-data-[state=open]:rotate-180" })] }), _jsx(CollapsibleContent, { className: "grid gap-2 border-t p-3", children: children })] }));
55
+ }
56
+ export { SchemaDisplay, SchemaDisplayBody, SchemaDisplayContent, SchemaDisplayDescription, SchemaDisplayExample, SchemaDisplayHeader, SchemaDisplayMethod, SchemaDisplayParameter, SchemaDisplayParameters, SchemaDisplayPath, SchemaDisplayProperty, SchemaDisplayRequest, SchemaDisplayResponse, };
@@ -0,0 +1,11 @@
1
+ import type { ElementType, HTMLAttributes } from "react";
2
+ type ShimmerProps = HTMLAttributes<HTMLElement> & {
3
+ as?: ElementType;
4
+ children: string;
5
+ duration?: number;
6
+ spread?: number;
7
+ };
8
+ declare function ShimmerComponent({ as: Component, children, className, duration, spread, style, ...props }: ShimmerProps): import("react").JSX.Element;
9
+ declare const Shimmer: import("react").MemoExoticComponent<typeof ShimmerComponent>;
10
+ export { Shimmer };
11
+ export type { ShimmerProps };
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo, useMemo } from "react";
3
+ import { cn } from "@ciridae/ui/utils";
4
+ function ShimmerComponent({ as: Component = "p", children, className, duration = 2, spread = 2, style, ...props }) {
5
+ const dynamicSpread = useMemo(() => (children?.length ?? 0) * spread, [children, spread]);
6
+ const trackWidth = useMemo(() => Math.max((children?.length ?? 0) * 0.62, 12), [children]);
7
+ const shimmerStyle = {
8
+ "--agentic-shimmer-duration": `${duration}s`,
9
+ "--agentic-shimmer-spread": `${Math.max(dynamicSpread, 80)}px`,
10
+ "--agentic-shimmer-track-width": `${trackWidth}ch`,
11
+ ...style,
12
+ };
13
+ return (_jsx(Component, { "data-slot": "shimmer", className: cn("agentic-shimmer relative inline-block text-muted-foreground", className), style: shimmerStyle, ...props, children: children }));
14
+ }
15
+ const Shimmer = memo(ShimmerComponent);
16
+ export { Shimmer };
@@ -0,0 +1,18 @@
1
+ import type * as React from "react";
2
+ import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText } from "@ciridae/ui/input-group";
3
+ type SnippetProps = React.ComponentProps<typeof InputGroup> & {
4
+ value: string;
5
+ };
6
+ type SnippetAddonProps = React.ComponentProps<typeof InputGroupAddon>;
7
+ type SnippetTextProps = React.ComponentProps<typeof InputGroupText>;
8
+ type SnippetInputProps = Omit<React.ComponentProps<typeof InputGroupInput>, "value"> & {
9
+ value?: string;
10
+ };
11
+ type SnippetCopyButtonProps = React.ComponentProps<typeof InputGroupButton>;
12
+ declare function Snippet({ children, className, value, ...props }: SnippetProps): React.JSX.Element;
13
+ declare function SnippetAddon(props: SnippetAddonProps): React.JSX.Element;
14
+ declare function SnippetText({ className, ...props }: SnippetTextProps): React.JSX.Element;
15
+ declare function SnippetInput({ className, value, ...props }: SnippetInputProps): React.JSX.Element;
16
+ declare function SnippetCopyButton({ children, ...props }: SnippetCopyButtonProps): React.JSX.Element;
17
+ export { Snippet, SnippetAddon, SnippetCopyButton, SnippetInput, SnippetText };
18
+ export type { SnippetAddonProps, SnippetCopyButtonProps, SnippetInputProps, SnippetProps, SnippetTextProps, };
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CheckIcon, CopyIcon } from "lucide-react";
3
+ import { createContext, useContext, useMemo, useState } from "react";
4
+ import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, } from "@ciridae/ui/input-group";
5
+ import { cn } from "@ciridae/ui/utils";
6
+ import { copyToClipboard } from "./clipboard";
7
+ const SnippetContext = createContext({ value: "" });
8
+ function useSnippet() {
9
+ return useContext(SnippetContext);
10
+ }
11
+ function Snippet({ children, className, value, ...props }) {
12
+ const contextValue = useMemo(() => ({ value }), [value]);
13
+ return (_jsx(SnippetContext.Provider, { value: contextValue, children: _jsx(InputGroup, { "data-slot": "snippet", className: cn("font-mono", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsx(SnippetInput, { readOnly: true }), _jsx(SnippetCopyButton, {})] })) }) }));
14
+ }
15
+ function SnippetAddon(props) {
16
+ return _jsx(InputGroupAddon, { "data-slot": "snippet-addon", ...props });
17
+ }
18
+ function SnippetText({ className, ...props }) {
19
+ return (_jsx(InputGroupText, { "data-slot": "snippet-text", className: cn("font-mono", className), ...props }));
20
+ }
21
+ function SnippetInput({ className, value, ...props }) {
22
+ const context = useSnippet();
23
+ return (_jsx(InputGroupInput, { "data-slot": "snippet-input", className: cn("font-mono", className), value: value ?? context.value, ...props }));
24
+ }
25
+ function SnippetCopyButton({ children, ...props }) {
26
+ const { value } = useSnippet();
27
+ const [copied, setCopied] = useState(false);
28
+ const Icon = copied ? CheckIcon : CopyIcon;
29
+ return (_jsx(InputGroupButton, { "aria-label": copied ? "Copied" : "Copy snippet", type: "button", ...props, onClick: (event) => {
30
+ props.onClick?.(event);
31
+ if (!event.defaultPrevented)
32
+ void copyToClipboard(value, setCopied);
33
+ }, children: children ?? _jsx(Icon, { "aria-hidden": "true", className: "size-4" }) }));
34
+ }
35
+ export { Snippet, SnippetAddon, SnippetCopyButton, SnippetInput, SnippetText };
@@ -0,0 +1,16 @@
1
+ import type * as React from "react";
2
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@ciridae/ui/collapsible";
3
+ type SourcesProps = React.ComponentProps<typeof Collapsible>;
4
+ type SourcesTriggerProps = React.ComponentProps<typeof CollapsibleTrigger> & {
5
+ count: number;
6
+ };
7
+ type SourcesContentProps = React.ComponentProps<typeof CollapsibleContent>;
8
+ type SourceProps = React.ComponentProps<"a"> & {
9
+ title?: string;
10
+ };
11
+ declare function Sources({ ...props }: SourcesProps): React.JSX.Element;
12
+ declare function SourcesTrigger({ children, className, count, ...props }: SourcesTriggerProps): React.JSX.Element;
13
+ declare function SourcesContent({ className, ...props }: SourcesContentProps): React.JSX.Element;
14
+ declare function Source({ children, className, href, title, ...props }: SourceProps): React.JSX.Element;
15
+ export { Source, Sources, SourcesContent, SourcesTrigger };
16
+ export type { SourceProps, SourcesContentProps, SourcesProps, SourcesTriggerProps };
@@ -0,0 +1,130 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { BookOpenIcon, ChevronDownIcon, ExternalLinkIcon } from "lucide-react";
3
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@ciridae/ui/collapsible";
4
+ import { cn } from "@ciridae/ui/utils";
5
+ import { css } from "@ciridae/ui/styled-system/css";
6
+ const sourcesTriggerClassName = css({
7
+ alignItems: "center",
8
+ backgroundColor: "card",
9
+ borderColor: "border",
10
+ borderRadius: "md",
11
+ borderStyle: "solid",
12
+ borderWidth: "default",
13
+ color: "card.foreground",
14
+ display: "flex",
15
+ fontSize: "sm",
16
+ gap: "gap.3",
17
+ justifyContent: "space-between",
18
+ paddingBlock: "spacing.2",
19
+ paddingInline: "spacing.3",
20
+ transitionProperty: "color, background-color",
21
+ width: "full",
22
+ "&:hover": {
23
+ backgroundColor: "accent",
24
+ color: "accent.foreground",
25
+ },
26
+ "&:focus-visible": {
27
+ boxShadow: "focus",
28
+ outline: "none",
29
+ },
30
+ });
31
+ const sourcesTriggerLabelClassName = css({
32
+ alignItems: "center",
33
+ display: "flex",
34
+ gap: "gap.2",
35
+ minWidth: 0,
36
+ });
37
+ const sourcesIconClassName = css({
38
+ color: "muted.foreground",
39
+ flexShrink: 0,
40
+ height: "icon.sm",
41
+ width: "icon.sm",
42
+ });
43
+ const sourcesTriggerTextClassName = css({
44
+ overflow: "hidden",
45
+ textOverflow: "ellipsis",
46
+ whiteSpace: "nowrap",
47
+ });
48
+ const sourcesChevronClassName = css({
49
+ color: "muted.foreground",
50
+ flexShrink: 0,
51
+ height: "icon.sm",
52
+ transitionProperty: "transform",
53
+ width: "icon.sm",
54
+ ".group[data-state='open'] &": {
55
+ transform: "rotate(180deg)",
56
+ },
57
+ });
58
+ const sourcesContentClassName = css({
59
+ display: "grid",
60
+ gap: "gap.2",
61
+ marginTop: "spacing.2",
62
+ overflow: "hidden",
63
+ "&[data-state='closed']": {
64
+ animationName: "fade-out",
65
+ },
66
+ });
67
+ const sourceClassName = css({
68
+ alignItems: "center",
69
+ backgroundColor: "background",
70
+ borderColor: "border",
71
+ borderRadius: "md",
72
+ borderStyle: "solid",
73
+ borderWidth: "default",
74
+ color: "foreground",
75
+ display: "flex",
76
+ fontSize: "sm",
77
+ gap: "gap.2",
78
+ minWidth: 0,
79
+ paddingBlock: "spacing.2",
80
+ paddingInline: "spacing.3",
81
+ transitionProperty: "color, background-color",
82
+ "&:hover": {
83
+ backgroundColor: "accent",
84
+ color: "accent.foreground",
85
+ },
86
+ "&:focus-visible": {
87
+ boxShadow: "focus",
88
+ outline: "none",
89
+ },
90
+ });
91
+ const sourceTextClassName = css({
92
+ flex: 1,
93
+ minWidth: 0,
94
+ overflow: "hidden",
95
+ textOverflow: "ellipsis",
96
+ whiteSpace: "nowrap",
97
+ });
98
+ const sourceExternalIconClassName = css({
99
+ color: "muted.foreground",
100
+ flexShrink: 0,
101
+ height: "0.875rem",
102
+ width: "0.875rem",
103
+ });
104
+ function Sources({ ...props }) {
105
+ return _jsx(Collapsible, { "data-slot": "sources", ...props });
106
+ }
107
+ function SourcesTrigger({ children, className, count, ...props }) {
108
+ return (_jsxs(CollapsibleTrigger, { "data-slot": "sources-trigger", className: cn("group", sourcesTriggerClassName, className), ...props, children: [_jsxs("span", { className: sourcesTriggerLabelClassName, children: [_jsx(BookOpenIcon, { "aria-hidden": "true", className: sourcesIconClassName }), _jsx("span", { className: sourcesTriggerTextClassName, children: children ?? `${count} sources` })] }), _jsx(ChevronDownIcon, { "aria-hidden": "true", className: sourcesChevronClassName })] }));
109
+ }
110
+ function SourcesContent({ className, ...props }) {
111
+ return (_jsx(CollapsibleContent, { "data-slot": "sources-content", className: cn(sourcesContentClassName, className), ...props }));
112
+ }
113
+ function Source({ children, className, href, title, ...props }) {
114
+ const safeHref = getSafeExternalHref(href);
115
+ return (_jsxs("a", { "data-slot": "source", href: safeHref, target: safeHref ? "_blank" : undefined, rel: safeHref ? "noopener noreferrer" : undefined, className: cn(sourceClassName, className), ...props, children: [_jsx("span", { className: sourceTextClassName, children: children ?? title ?? safeHref ?? href }), safeHref ? (_jsx(ExternalLinkIcon, { "aria-hidden": "true", className: sourceExternalIconClassName })) : null] }));
116
+ }
117
+ function getSafeExternalHref(href) {
118
+ if (!href)
119
+ return undefined;
120
+ try {
121
+ const url = new URL(href, window.location.origin);
122
+ if (url.protocol !== "http:" && url.protocol !== "https:")
123
+ return undefined;
124
+ return url.toString();
125
+ }
126
+ catch {
127
+ return undefined;
128
+ }
129
+ }
130
+ export { Source, Sources, SourcesContent, SourcesTrigger };
@@ -0,0 +1,24 @@
1
+ import type * as React from "react";
2
+ import { Button } from "@ciridae/ui/button";
3
+ type TerminalProps = React.ComponentProps<"div"> & {
4
+ output?: string;
5
+ };
6
+ type TerminalHeaderProps = React.ComponentProps<"div">;
7
+ type TerminalTitleProps = React.ComponentProps<"div">;
8
+ type TerminalStatusProps = React.ComponentProps<"div"> & {
9
+ status?: "idle" | "running" | "success" | "error";
10
+ };
11
+ type TerminalActionsProps = React.ComponentProps<"div">;
12
+ type TerminalCopyButtonProps = React.ComponentProps<typeof Button>;
13
+ type TerminalClearButtonProps = React.ComponentProps<typeof Button>;
14
+ type TerminalContentProps = React.ComponentProps<"pre">;
15
+ declare function Terminal({ children, className, output, ...props }: TerminalProps): React.JSX.Element;
16
+ declare function TerminalHeader({ className, ...props }: TerminalHeaderProps): React.JSX.Element;
17
+ declare function TerminalTitle({ className, ...props }: TerminalTitleProps): React.JSX.Element;
18
+ declare function TerminalStatus({ className, status, ...props }: TerminalStatusProps): React.JSX.Element;
19
+ declare function TerminalActions({ className, ...props }: TerminalActionsProps): React.JSX.Element;
20
+ declare function TerminalCopyButton({ children, ...props }: TerminalCopyButtonProps): React.JSX.Element;
21
+ declare function TerminalClearButton({ children, ...props }: TerminalClearButtonProps): React.JSX.Element;
22
+ declare function TerminalContent({ children, className, ...props }: TerminalContentProps): React.JSX.Element;
23
+ export { Terminal, TerminalActions, TerminalClearButton, TerminalContent, TerminalCopyButton, TerminalHeader, TerminalStatus, TerminalTitle, };
24
+ export type { TerminalActionsProps, TerminalClearButtonProps, TerminalContentProps, TerminalCopyButtonProps, TerminalHeaderProps, TerminalProps, TerminalStatusProps, TerminalTitleProps, };
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CheckIcon, CopyIcon, SquareIcon, XIcon } from "lucide-react";
3
+ import { createContext, useContext, useMemo, useState } from "react";
4
+ import { Button } from "@ciridae/ui/button";
5
+ import { cn } from "@ciridae/ui/utils";
6
+ import { copyToClipboard } from "./clipboard";
7
+ const TerminalContext = createContext({ output: "" });
8
+ const statusLabel = { error: "error", idle: "idle", running: "running", success: "success" };
9
+ const statusClass = {
10
+ error: "text-destructive",
11
+ idle: "text-muted-foreground",
12
+ running: "text-foreground",
13
+ success: "text-foreground",
14
+ };
15
+ function Terminal({ children, className, output = "", ...props }) {
16
+ const contextValue = useMemo(() => ({ output }), [output]);
17
+ return (_jsx(TerminalContext.Provider, { value: contextValue, children: _jsx("div", { "data-slot": "terminal", className: cn("w-full overflow-hidden rounded-lg border bg-card text-card-foreground", className), ...props, children: children ?? _jsx(TerminalContent, { children: output }) }) }));
18
+ }
19
+ function TerminalHeader({ className, ...props }) {
20
+ return (_jsx("div", { "data-slot": "terminal-header", className: cn("flex min-w-0 items-center justify-between gap-3 border-b px-3 py-2", className), ...props }));
21
+ }
22
+ function TerminalTitle({ className, ...props }) {
23
+ return (_jsx("div", { "data-slot": "terminal-title", className: cn("truncate text-sm font-medium", className), ...props }));
24
+ }
25
+ function TerminalStatus({ className, status = "idle", ...props }) {
26
+ return (_jsxs("div", { "data-slot": "terminal-status", className: cn("flex items-center gap-1 text-xs", statusClass[status], className), ...props, children: [_jsx(SquareIcon, { "aria-hidden": "true", className: "size-2 fill-current" }), _jsx("span", { children: statusLabel[status] })] }));
27
+ }
28
+ function TerminalActions({ className, ...props }) {
29
+ return (_jsx("div", { "data-slot": "terminal-actions", className: cn("flex shrink-0 items-center gap-1", className), ...props }));
30
+ }
31
+ function TerminalCopyButton({ children, ...props }) {
32
+ const { output } = useContext(TerminalContext);
33
+ const [copied, setCopied] = useState(false);
34
+ const Icon = copied ? CheckIcon : CopyIcon;
35
+ return (_jsx(Button, { "aria-label": copied ? "Copied" : "Copy terminal output", size: "icon", type: "button", variant: "ghost", ...props, onClick: (event) => {
36
+ props.onClick?.(event);
37
+ if (!event.defaultPrevented)
38
+ void copyToClipboard(output, setCopied);
39
+ }, children: children ?? _jsx(Icon, { "aria-hidden": "true", className: "size-4" }) }));
40
+ }
41
+ function TerminalClearButton({ children, ...props }) {
42
+ return (_jsx(Button, { "aria-label": "Clear terminal", size: "icon", type: "button", variant: "ghost", ...props, children: children ?? _jsx(XIcon, { "aria-hidden": "true", className: "size-4" }) }));
43
+ }
44
+ function TerminalContent({ children, className, ...props }) {
45
+ return (_jsx("pre", { "data-slot": "terminal-content", className: cn("max-h-96 overflow-auto bg-muted/30 p-4 font-mono text-sm leading-6", className), ...props, children: children }));
46
+ }
47
+ export { Terminal, TerminalActions, TerminalClearButton, TerminalContent, TerminalCopyButton, TerminalHeader, TerminalStatus, TerminalTitle, };
@@ -0,0 +1,25 @@
1
+ import type * as React from "react";
2
+ import type { AgenticToolState } from "@ciridae/ui-agent/types";
3
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@ciridae/ui/collapsible";
4
+ type ToolProps = React.ComponentProps<typeof Collapsible>;
5
+ type ToolHeaderProps = Omit<React.ComponentProps<typeof CollapsibleTrigger>, "type"> & {
6
+ state: AgenticToolState;
7
+ title?: string;
8
+ toolName?: string;
9
+ type?: string;
10
+ };
11
+ type ToolContentProps = React.ComponentProps<typeof CollapsibleContent>;
12
+ type ToolInputProps = React.ComponentProps<"div"> & {
13
+ input?: unknown;
14
+ };
15
+ type ToolOutputProps = React.ComponentProps<"div"> & {
16
+ errorText?: string;
17
+ output?: React.ReactNode | unknown;
18
+ };
19
+ declare function Tool({ className, ...props }: ToolProps): React.JSX.Element;
20
+ declare function ToolHeader({ className, state, title, toolName, type, ...props }: ToolHeaderProps): React.JSX.Element;
21
+ declare function ToolContent({ className, ...props }: ToolContentProps): React.JSX.Element;
22
+ declare function ToolInput({ className, input, ...props }: ToolInputProps): React.JSX.Element | null;
23
+ declare function ToolOutput({ className, errorText, output, ...props }: ToolOutputProps): React.JSX.Element | null;
24
+ export { Tool, ToolContent, ToolHeader, ToolInput, ToolOutput };
25
+ export type { ToolContentProps, ToolHeaderProps, ToolInputProps, ToolOutputProps, ToolProps };
@@ -0,0 +1,73 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CheckCircleIcon, ChevronDownIcon, CircleIcon, ClockIcon, WrenchIcon, XCircleIcon, } from "lucide-react";
3
+ import { isValidElement } from "react";
4
+ import { Badge } from "@ciridae/ui/badge";
5
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@ciridae/ui/collapsible";
6
+ import { cn } from "@ciridae/ui/utils";
7
+ const statusLabels = {
8
+ "approval-requested": "Awaiting approval",
9
+ "approval-responded": "Responded",
10
+ "input-available": "Running",
11
+ "input-streaming": "Pending",
12
+ "output-available": "Completed",
13
+ "output-denied": "Denied",
14
+ "output-error": "Error",
15
+ };
16
+ const statusVariants = {
17
+ "approval-requested": "warning",
18
+ "approval-responded": "info",
19
+ "input-available": "secondary",
20
+ "input-streaming": "outline",
21
+ "output-available": "success",
22
+ "output-denied": "warning",
23
+ "output-error": "destructive",
24
+ };
25
+ function Tool({ className, ...props }) {
26
+ return (_jsx(Collapsible, { "data-slot": "tool", className: cn("group rounded-lg border bg-card text-card-foreground", className), ...props }));
27
+ }
28
+ function ToolHeader({ className, state, title, toolName, type, ...props }) {
29
+ const derivedName = title ?? toolName ?? type?.replace(/^tool-/, "") ?? "Tool call";
30
+ return (_jsxs(CollapsibleTrigger, { "data-slot": "tool-header", className: cn("flex w-full items-center justify-between gap-3 px-3 py-2 text-sm transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:ring-[var(--focus-ring-width)] focus-visible:ring-ring focus-visible:outline-none", className), ...props, children: [_jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [_jsx(WrenchIcon, { "aria-hidden": "true", className: "size-4 shrink-0 text-muted-foreground" }), _jsx("span", { className: "min-w-0 truncate font-medium", children: derivedName }), _jsx(ToolStatusBadge, { state: state })] }), _jsx(ChevronDownIcon, { "aria-hidden": "true", className: "size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" })] }));
31
+ }
32
+ function ToolStatusBadge({ state }) {
33
+ return (_jsxs(Badge, { className: "gap-1 rounded-full", variant: statusVariants[state], children: [_jsx(ToolStatusIcon, { state: state }), statusLabels[state]] }));
34
+ }
35
+ function ToolStatusIcon({ state }) {
36
+ if (state === "output-available" || state === "approval-responded")
37
+ return _jsx(CheckCircleIcon, {});
38
+ if (state === "output-denied" || state === "output-error")
39
+ return _jsx(XCircleIcon, {});
40
+ if (state === "approval-requested" || state === "input-available")
41
+ return _jsx(ClockIcon, {});
42
+ return _jsx(CircleIcon, {});
43
+ }
44
+ function ToolContent({ className, ...props }) {
45
+ return (_jsx(CollapsibleContent, { "data-slot": "tool-content", className: cn("grid gap-3 border-t px-3 py-3 text-sm", className), ...props }));
46
+ }
47
+ function ToolInput({ className, input, ...props }) {
48
+ if (input === undefined)
49
+ return null;
50
+ return (_jsxs("div", { "data-slot": "tool-input", className: cn("grid gap-2", className), ...props, children: [_jsx("h4", { className: "text-meta text-muted-foreground", children: "Parameters" }), _jsx(ToolCode, { value: input })] }));
51
+ }
52
+ function ToolOutput({ className, errorText, output, ...props }) {
53
+ if (output === undefined && !errorText)
54
+ return null;
55
+ return (_jsxs("div", { "data-slot": "tool-output", className: cn("grid gap-2", className), ...props, children: [_jsx("h4", { className: "text-meta text-muted-foreground", children: errorText ? "Error" : "Result" }), errorText ? (_jsx("div", { className: "rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorText })) : (_jsx(ToolCode, { value: output }))] }));
56
+ }
57
+ function ToolCode({ value }) {
58
+ if (isValidElement(value))
59
+ return value;
60
+ const code = serializeToolValue(value);
61
+ return (_jsx("pre", { className: "max-h-64 overflow-auto rounded-md border bg-muted/40 p-3 font-mono text-xs text-foreground", children: _jsx("code", { children: code }) }));
62
+ }
63
+ function serializeToolValue(value) {
64
+ if (typeof value === "string")
65
+ return value;
66
+ try {
67
+ return JSON.stringify(value, null, 2);
68
+ }
69
+ catch {
70
+ return String(value);
71
+ }
72
+ }
73
+ export { Tool, ToolContent, ToolHeader, ToolInput, ToolOutput };