@fromsko/chat-ui 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +100 -2
- package/lib/adapters/event-bus.d.ts +80 -0
- package/lib/adapters/event-bus.js +73 -0
- package/lib/adapters/index.d.ts +3 -0
- package/lib/adapters/index.js +3 -0
- package/lib/adapters/labels.d.ts +6 -0
- package/lib/adapters/labels.js +17 -0
- package/lib/adapters/stream-bridge.d.ts +9 -0
- package/lib/adapters/stream-bridge.js +7 -0
- package/lib/blocks/cards/AskCard.d.ts +8 -0
- package/lib/blocks/cards/AskCard.js +97 -0
- package/lib/blocks/cards/CompactionCard.d.ts +5 -0
- package/lib/blocks/cards/CompactionCard.js +5 -0
- package/lib/blocks/cards/ContextUsage.d.ts +14 -0
- package/lib/blocks/cards/ContextUsage.js +136 -0
- package/lib/blocks/cards/DisplayCard.d.ts +7 -0
- package/lib/blocks/cards/DisplayCard.js +27 -0
- package/lib/blocks/cards/MemoryPill.d.ts +5 -0
- package/lib/blocks/cards/MemoryPill.js +5 -0
- package/lib/blocks/cards/OutputCard.d.ts +5 -0
- package/lib/blocks/cards/OutputCard.js +13 -0
- package/lib/blocks/cards/PermissionCard.d.ts +21 -0
- package/lib/blocks/cards/PermissionCard.js +26 -0
- package/lib/blocks/cards/SpringCheck.d.ts +9 -0
- package/lib/blocks/cards/SpringCheck.js +17 -0
- package/lib/blocks/cards/TodoCard.d.ts +19 -0
- package/lib/blocks/cards/TodoCard.js +28 -0
- package/lib/blocks/cards/index.d.ts +10 -0
- package/lib/blocks/cards/index.js +10 -0
- package/lib/blocks/composer/Composer.d.ts +66 -0
- package/lib/blocks/composer/Composer.js +73 -0
- package/lib/blocks/composer/ComposerAttachments.d.ts +17 -0
- package/lib/blocks/composer/ComposerAttachments.js +10 -0
- package/lib/blocks/composer/ComposerGrip.d.ts +1 -0
- package/lib/blocks/composer/ComposerGrip.js +39 -0
- package/lib/blocks/composer/ComposerInput.d.ts +18 -0
- package/lib/blocks/composer/ComposerInput.js +60 -0
- package/lib/blocks/composer/ComposerMenus.d.ts +10 -0
- package/lib/blocks/composer/ComposerMenus.js +78 -0
- package/lib/blocks/composer/ComposerToolbar.d.ts +27 -0
- package/lib/blocks/composer/ComposerToolbar.js +16 -0
- package/lib/blocks/composer/MentionPicker.d.ts +13 -0
- package/lib/blocks/composer/MentionPicker.js +71 -0
- package/lib/blocks/composer/PromptPop.d.ts +7 -0
- package/lib/blocks/composer/PromptPop.js +40 -0
- package/lib/blocks/composer/QueuedPrompts.d.ts +14 -0
- package/lib/blocks/composer/QueuedPrompts.js +21 -0
- package/lib/blocks/composer/SlingButton.d.ts +10 -0
- package/lib/blocks/composer/SlingButton.js +112 -0
- package/lib/blocks/composer/index.d.ts +7 -0
- package/lib/blocks/composer/index.js +1 -0
- package/lib/blocks/conversation/ChatEmptyScene.d.ts +4 -0
- package/lib/blocks/conversation/ChatEmptyScene.js +21 -0
- package/lib/blocks/conversation/ChatHeader.d.ts +13 -0
- package/lib/blocks/conversation/ChatHeader.js +20 -0
- package/lib/blocks/conversation/ChatPane.d.ts +90 -0
- package/lib/blocks/conversation/ChatPane.js +60 -0
- package/lib/blocks/conversation/Conversation.d.ts +11 -0
- package/lib/blocks/conversation/Conversation.js +41 -0
- package/lib/blocks/conversation/LineSidebar.d.ts +14 -0
- package/lib/blocks/conversation/LineSidebar.js +42 -0
- package/lib/blocks/conversation/index.d.ts +5 -0
- package/lib/blocks/conversation/index.js +5 -0
- package/lib/blocks/index.d.ts +9 -0
- package/lib/blocks/index.js +9 -0
- package/lib/blocks/message/DayDivider.d.ts +10 -0
- package/lib/blocks/message/DayDivider.js +29 -0
- package/lib/blocks/message/DiffView.d.ts +5 -0
- package/lib/blocks/message/DiffView.js +18 -0
- package/lib/blocks/message/MermaidDiagram.d.ts +4 -0
- package/lib/blocks/message/MermaidDiagram.js +43 -0
- package/lib/blocks/message/Message.d.ts +17 -0
- package/lib/blocks/message/Message.js +45 -0
- package/lib/blocks/message/MessageActionBar.d.ts +18 -0
- package/lib/blocks/message/MessageActionBar.js +15 -0
- package/lib/blocks/message/MessageArtifacts.d.ts +13 -0
- package/lib/blocks/message/MessageArtifacts.js +9 -0
- package/lib/blocks/message/MessageAttachments.d.ts +5 -0
- package/lib/blocks/message/MessageAttachments.js +28 -0
- package/lib/blocks/message/MessageBubble.d.ts +11 -0
- package/lib/blocks/message/MessageBubble.js +31 -0
- package/lib/blocks/message/MessageRow.d.ts +20 -0
- package/lib/blocks/message/MessageRow.js +49 -0
- package/lib/blocks/message/MessageStream.d.ts +23 -0
- package/lib/blocks/message/MessageStream.js +80 -0
- package/lib/blocks/message/MessageTrace.d.ts +16 -0
- package/lib/blocks/message/MessageTrace.js +39 -0
- package/lib/blocks/message/PartView.d.ts +10 -0
- package/lib/blocks/message/PartView.js +29 -0
- package/lib/blocks/message/code-text.d.ts +15 -0
- package/lib/blocks/message/code-text.js +17 -0
- package/lib/blocks/message/index.d.ts +12 -0
- package/lib/blocks/message/index.js +12 -0
- package/lib/blocks/reasoning/Reasoning.d.ts +7 -0
- package/lib/blocks/reasoning/Reasoning.js +26 -0
- package/lib/blocks/reasoning/ReasoningBlock.d.ts +6 -0
- package/lib/blocks/reasoning/ReasoningBlock.js +5 -0
- package/lib/blocks/reasoning/index.d.ts +2 -0
- package/lib/blocks/reasoning/index.js +2 -0
- package/lib/blocks/selection/SelectionActions.d.ts +12 -0
- package/lib/blocks/selection/SelectionActions.js +29 -0
- package/lib/blocks/selection/SelectionBar.d.ts +10 -0
- package/lib/blocks/selection/SelectionBar.js +6 -0
- package/lib/blocks/selection/index.d.ts +2 -0
- package/lib/blocks/selection/index.js +2 -0
- package/lib/blocks/settings/DisplaySettingsPanel.d.ts +5 -0
- package/lib/blocks/settings/DisplaySettingsPanel.js +33 -0
- package/lib/blocks/settings/SquishSwitch.d.ts +8 -0
- package/lib/blocks/settings/SquishSwitch.js +21 -0
- package/lib/blocks/settings/index.d.ts +2 -0
- package/lib/blocks/settings/index.js +2 -0
- package/lib/blocks/status/LatticeLoader.d.ts +12 -0
- package/lib/blocks/status/LatticeLoader.js +22 -0
- package/lib/blocks/status/TypingIndicator.d.ts +5 -0
- package/lib/blocks/status/TypingIndicator.js +5 -0
- package/lib/blocks/status/index.d.ts +2 -0
- package/lib/blocks/status/index.js +2 -0
- package/lib/blocks/tool/SandboxCard.d.ts +5 -0
- package/lib/blocks/tool/SandboxCard.js +10 -0
- package/lib/blocks/tool/ToolCard.d.ts +10 -0
- package/lib/blocks/tool/ToolCard.js +32 -0
- package/lib/blocks/tool/ToolGroup.d.ts +6 -0
- package/lib/blocks/tool/ToolGroup.js +23 -0
- package/lib/blocks/tool/exec-envelope.d.ts +7 -0
- package/lib/blocks/tool/exec-envelope.js +43 -0
- package/lib/blocks/tool/index.d.ts +4 -0
- package/lib/blocks/tool/index.js +4 -0
- package/lib/domain/ask.d.ts +14 -0
- package/lib/domain/ask.js +50 -0
- package/lib/domain/attachments.d.ts +16 -0
- package/lib/domain/attachments.js +126 -0
- package/lib/domain/attribution.d.ts +4 -0
- package/lib/domain/attribution.js +11 -0
- package/lib/domain/composer-palette.d.ts +15 -0
- package/lib/domain/composer-palette.js +131 -0
- package/lib/domain/index.d.ts +12 -0
- package/lib/domain/index.js +12 -0
- package/lib/domain/mention.d.ts +17 -0
- package/lib/domain/mention.js +95 -0
- package/lib/domain/message-blocks.d.ts +29 -0
- package/lib/domain/message-blocks.js +63 -0
- package/lib/domain/message-menu.d.ts +4 -0
- package/lib/domain/message-menu.js +46 -0
- package/lib/domain/queue.d.ts +23 -0
- package/lib/domain/queue.js +52 -0
- package/lib/domain/reducer.d.ts +137 -0
- package/lib/domain/reducer.js +442 -0
- package/lib/domain/selection-actions.d.ts +13 -0
- package/lib/domain/selection-actions.js +56 -0
- package/lib/domain/selection-gates.d.ts +6 -0
- package/lib/domain/selection-gates.js +36 -0
- package/lib/domain/slash-commands.d.ts +16 -0
- package/lib/domain/slash-commands.js +142 -0
- package/lib/hooks/index.d.ts +8 -0
- package/lib/hooks/index.js +8 -0
- package/lib/hooks/useComposerPalette.d.ts +35 -0
- package/lib/hooks/useComposerPalette.js +120 -0
- package/lib/hooks/useComposerSubmit.d.ts +31 -0
- package/lib/hooks/useComposerSubmit.js +135 -0
- package/lib/hooks/useInputHistory.d.ts +14 -0
- package/lib/hooks/useInputHistory.js +52 -0
- package/lib/hooks/usePendingAsk.d.ts +11 -0
- package/lib/hooks/usePendingAsk.js +33 -0
- package/lib/hooks/usePendingPermissions.d.ts +10 -0
- package/lib/hooks/usePendingPermissions.js +26 -0
- package/lib/hooks/useQueuedPrompts.d.ts +12 -0
- package/lib/hooks/useQueuedPrompts.js +91 -0
- package/lib/hooks/useSelectionPop.d.ts +13 -0
- package/lib/hooks/useSelectionPop.js +130 -0
- package/lib/hooks/useStreamBridge.d.ts +1 -0
- package/lib/hooks/useStreamBridge.js +23 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +10 -0
- package/lib/primitives/Badge.d.ts +7 -0
- package/lib/primitives/Badge.js +13 -0
- package/lib/primitives/Button.d.ts +9 -0
- package/lib/primitives/Button.js +21 -0
- package/lib/primitives/Collapsible.d.ts +12 -0
- package/lib/primitives/Collapsible.js +14 -0
- package/lib/primitives/Dialog.d.ts +10 -0
- package/lib/primitives/Dialog.js +19 -0
- package/lib/primitives/DropdownMenu.d.ts +28 -0
- package/lib/primitives/DropdownMenu.js +37 -0
- package/lib/primitives/Empty.d.ts +8 -0
- package/lib/primitives/Empty.js +6 -0
- package/lib/primitives/Input.d.ts +3 -0
- package/lib/primitives/Input.js +6 -0
- package/lib/primitives/Kbd.d.ts +2 -0
- package/lib/primitives/Kbd.js +5 -0
- package/lib/primitives/Popover.d.ts +15 -0
- package/lib/primitives/Popover.js +32 -0
- package/lib/primitives/ScrollArea.d.ts +5 -0
- package/lib/primitives/ScrollArea.js +5 -0
- package/lib/primitives/Separator.d.ts +5 -0
- package/lib/primitives/Separator.js +5 -0
- package/lib/primitives/Spinner.d.ts +5 -0
- package/lib/primitives/Spinner.js +5 -0
- package/lib/primitives/Textarea.d.ts +3 -0
- package/lib/primitives/Textarea.js +6 -0
- package/lib/primitives/Tooltip.d.ts +8 -0
- package/lib/primitives/Tooltip.js +7 -0
- package/lib/primitives/index.d.ts +14 -0
- package/lib/primitives/index.js +14 -0
- package/lib/reactbits/Motion.d.ts +24 -0
- package/lib/reactbits/Motion.js +52 -0
- package/lib/reactbits/index.d.ts +1 -0
- package/lib/reactbits/index.js +1 -0
- package/lib/stores/chat-store.d.ts +33 -0
- package/lib/stores/chat-store.js +93 -0
- package/lib/stores/display-store.d.ts +15 -0
- package/lib/stores/display-store.js +116 -0
- package/lib/stores/index.d.ts +3 -0
- package/lib/stores/index.js +3 -0
- package/lib/stores/theme-store.d.ts +8 -0
- package/lib/stores/theme-store.js +29 -0
- package/lib/tokens/index.d.ts +21 -0
- package/lib/tokens/index.js +66 -0
- package/lib/types/agent.d.ts +62 -0
- package/lib/types/agent.js +1 -0
- package/lib/types/callbacks.d.ts +55 -0
- package/lib/types/callbacks.js +1 -0
- package/lib/types/composer.d.ts +116 -0
- package/lib/types/composer.js +1 -0
- package/lib/types/conversation.d.ts +54 -0
- package/lib/types/conversation.js +1 -0
- package/lib/types/display.d.ts +25 -0
- package/lib/types/display.js +40 -0
- package/lib/types/index.d.ts +8 -0
- package/lib/types/index.js +8 -0
- package/lib/types/message.d.ts +100 -0
- package/lib/types/message.js +1 -0
- package/lib/types/selection.d.ts +60 -0
- package/lib/types/selection.js +1 -0
- package/lib/types/theme.d.ts +100 -0
- package/lib/types/theme.js +1 -0
- package/lib/utils/clipboard.d.ts +4 -0
- package/lib/utils/clipboard.js +41 -0
- package/lib/utils/cn.d.ts +2 -0
- package/lib/utils/cn.js +14 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.js +3 -0
- package/lib/utils/storage.d.ts +11 -0
- package/lib/utils/storage.js +48 -0
- package/package.json +93 -4
- package/src/styles/blocks.css +2439 -0
- package/src/styles/index.css +3 -0
- package/src/tokens/theme.css +464 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { cn } from "../utils/cn";
|
|
4
|
+
export function Tooltip({ content, children, side = "top", className }) {
|
|
5
|
+
const [open, setOpen] = useState(false);
|
|
6
|
+
return (_jsxs("span", { className: cn("relative inline-flex", className), onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false), onFocus: () => setOpen(true), onBlur: () => setOpen(false), children: [children, open ? (_jsx("span", { role: "tooltip", className: cn("pointer-events-none absolute left-1/2 z-tooltip -translate-x-1/2 whitespace-nowrap rounded-[var(--radius-sm)] border border-border bg-popover px-1.5 py-1 text-micro text-popover-foreground shadow-md", side === "top" ? "bottom-full mb-1.5" : "top-full mt-1.5"), children: content })) : null] }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { Button, type ButtonProps, type ButtonVariant, type ButtonSize } from "./Button";
|
|
2
|
+
export { Badge, type BadgeProps, type BadgeVariant } from "./Badge";
|
|
3
|
+
export { Textarea, type TextareaProps } from "./Textarea";
|
|
4
|
+
export { Input, type InputProps } from "./Input";
|
|
5
|
+
export { Kbd } from "./Kbd";
|
|
6
|
+
export { Spinner } from "./Spinner";
|
|
7
|
+
export { Separator, type SeparatorProps } from "./Separator";
|
|
8
|
+
export { Collapsible, type CollapsibleProps } from "./Collapsible";
|
|
9
|
+
export { Tooltip, type TooltipProps } from "./Tooltip";
|
|
10
|
+
export { DropdownMenu, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, type DropdownMenuProps, } from "./DropdownMenu";
|
|
11
|
+
export { Popover, type PopoverProps } from "./Popover";
|
|
12
|
+
export { Dialog, type DialogProps } from "./Dialog";
|
|
13
|
+
export { ScrollArea, type ScrollAreaProps } from "./ScrollArea";
|
|
14
|
+
export { Empty, type EmptyProps } from "./Empty";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { Button } from "./Button";
|
|
2
|
+
export { Badge } from "./Badge";
|
|
3
|
+
export { Textarea } from "./Textarea";
|
|
4
|
+
export { Input } from "./Input";
|
|
5
|
+
export { Kbd } from "./Kbd";
|
|
6
|
+
export { Spinner } from "./Spinner";
|
|
7
|
+
export { Separator } from "./Separator";
|
|
8
|
+
export { Collapsible } from "./Collapsible";
|
|
9
|
+
export { Tooltip } from "./Tooltip";
|
|
10
|
+
export { DropdownMenu, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, } from "./DropdownMenu";
|
|
11
|
+
export { Popover } from "./Popover";
|
|
12
|
+
export { Dialog } from "./Dialog";
|
|
13
|
+
export { ScrollArea } from "./ScrollArea";
|
|
14
|
+
export { Empty } from "./Empty";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export declare function ShimmerText({ children, className, }: {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
6
|
+
export declare function CountUp({ value, duration, className, }: {
|
|
7
|
+
value: number;
|
|
8
|
+
duration?: number;
|
|
9
|
+
className?: string;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
export declare function BlurIn({ children, delay, className, }: {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
delay?: number;
|
|
14
|
+
className?: string;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
16
|
+
export declare function StaggerChildren({ children, className, step, }: {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
step?: number;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
21
|
+
export declare function GlowCard({ children, className, }: {
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
className?: string;
|
|
24
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { animate, stagger, useInView } from "motion/react";
|
|
4
|
+
import { cn } from "../utils/cn";
|
|
5
|
+
export function ShimmerText({ children, className, }) {
|
|
6
|
+
return (_jsx("span", { className: cn("animate-shimmer bg-gradient-to-r from-muted-foreground/50 via-foreground to-muted-foreground/50 bg-[length:200%_100%] bg-clip-text text-transparent", className), children: children }));
|
|
7
|
+
}
|
|
8
|
+
export function CountUp({ value, duration = 0.8, className, }) {
|
|
9
|
+
const ref = useRef(null);
|
|
10
|
+
const [display, setDisplay] = useState(value);
|
|
11
|
+
const prev = useRef(value);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const el = ref.current;
|
|
14
|
+
if (!el)
|
|
15
|
+
return;
|
|
16
|
+
const controls = animate(prev.current, value, {
|
|
17
|
+
duration,
|
|
18
|
+
ease: "easeOut",
|
|
19
|
+
onUpdate: (v) => setDisplay(Math.round(v)),
|
|
20
|
+
});
|
|
21
|
+
prev.current = value;
|
|
22
|
+
return () => controls.stop();
|
|
23
|
+
}, [value, duration]);
|
|
24
|
+
return (_jsx("span", { ref: ref, className: cn("tabular-nums", className), children: display }));
|
|
25
|
+
}
|
|
26
|
+
export function BlurIn({ children, delay = 0, className, }) {
|
|
27
|
+
const ref = useRef(null);
|
|
28
|
+
const inView = useInView(ref, { once: true });
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const el = ref.current;
|
|
31
|
+
if (!el || !inView)
|
|
32
|
+
return;
|
|
33
|
+
animate(el, { opacity: [0, 1], filter: ["blur(8px)", "blur(0px)"], y: [12, 0] }, { duration: 0.5, delay, ease: "easeOut" });
|
|
34
|
+
}, [inView, delay]);
|
|
35
|
+
return (_jsx("div", { ref: ref, className: cn("opacity-0", className), children: children }));
|
|
36
|
+
}
|
|
37
|
+
export function StaggerChildren({ children, className, step = 0.05, }) {
|
|
38
|
+
const ref = useRef(null);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
const el = ref.current;
|
|
41
|
+
if (!el)
|
|
42
|
+
return;
|
|
43
|
+
const items = Array.from(el.children);
|
|
44
|
+
if (items.length === 0)
|
|
45
|
+
return;
|
|
46
|
+
animate(items, { opacity: [0, 1], y: [8, 0] }, { duration: 0.35, delay: stagger(step), ease: "easeOut" });
|
|
47
|
+
}, [step]);
|
|
48
|
+
return (_jsx("div", { ref: ref, className: className, children: children }));
|
|
49
|
+
}
|
|
50
|
+
export function GlowCard({ children, className, }) {
|
|
51
|
+
return (_jsx("div", { className: cn("cursor-glow relative rounded-[var(--radius-lg)] border border-border bg-card p-4 transition-shadow hover:shadow-lg", className), children: children }));
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ShimmerText, CountUp, BlurIn, StaggerChildren, GlowCard, } from "./Motion";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ShimmerText, CountUp, BlurIn, StaggerChildren, GlowCard, } from "./Motion";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Agent } from "../types/agent";
|
|
2
|
+
import type { Conversation, ConversationId, ConversationStatus } from "../types/conversation";
|
|
3
|
+
import type { Attachment, ChatMessage } from "../types/message";
|
|
4
|
+
import { type ConversationAction, type ConversationState } from "../domain/reducer";
|
|
5
|
+
export interface ChatStore extends ConversationState {
|
|
6
|
+
dispatch: (action: ConversationAction) => void;
|
|
7
|
+
select: (id: ConversationId) => void;
|
|
8
|
+
setDraft: (id: ConversationId, value: string) => void;
|
|
9
|
+
append: (id: ConversationId, message: ChatMessage) => void;
|
|
10
|
+
deleteMessage: (id: ConversationId, messageId: string) => void;
|
|
11
|
+
insertMessageAt: (id: ConversationId, index: number, message: ChatMessage) => void;
|
|
12
|
+
replaceAgents: (agents: Record<string, Agent>) => void;
|
|
13
|
+
reportError: (message: string) => void;
|
|
14
|
+
clearPersistError: () => void;
|
|
15
|
+
bindRequest: (requestId: string) => void;
|
|
16
|
+
streamDelta: (requestId: string, text: string) => void;
|
|
17
|
+
streamReasoning: (requestId: string, text: string) => void;
|
|
18
|
+
streamToolCall: (requestId: string, toolCallId: string, name: string, args: unknown) => void;
|
|
19
|
+
streamToolResult: (requestId: string, toolCallId: string, result: string, isError: boolean) => void;
|
|
20
|
+
streamContextUsage: (requestId: string, inputTokens: number, outputTokens: number, window: number) => void;
|
|
21
|
+
streamMemory: (requestId: string, count: number, excerpt: string) => void;
|
|
22
|
+
streamCompaction: (requestId: string | null, beforeTokens: number, afterTokens: number, reason: string) => void;
|
|
23
|
+
streamDisplay: (requestId: string, view: string, title?: string, payload?: unknown) => void;
|
|
24
|
+
streamOutput: (requestId: string, outputKind: "text" | "file" | "link" | "json", label?: string, value?: string) => void;
|
|
25
|
+
streamEnd: (requestId: string, outcome: "done" | "error", error?: string) => void;
|
|
26
|
+
send: (text: string, attachments?: Attachment[], deliver?: (text: string, attachments?: Attachment[] | undefined) => void | Promise<void>) => void;
|
|
27
|
+
}
|
|
28
|
+
export declare const useChatStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ChatStore>>;
|
|
29
|
+
export declare const selectActive: (s: ChatStore) => Conversation | null;
|
|
30
|
+
export declare const selectActiveMessages: (s: ChatStore) => ChatMessage[];
|
|
31
|
+
export declare const selectActiveMembers: (s: ChatStore) => Agent[];
|
|
32
|
+
export declare const selectActiveStreaming: (s: ChatStore) => boolean;
|
|
33
|
+
export declare const selectActiveStatus: (s: ChatStore) => ConversationStatus;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
import { conversationReducer, createConversationState, isConversationStreaming, } from "../domain/reducer";
|
|
3
|
+
import { clockLabel } from "../adapters/labels";
|
|
4
|
+
let seq = 0;
|
|
5
|
+
function nextId(prefix) {
|
|
6
|
+
seq += 1;
|
|
7
|
+
return `${prefix}-${seq}`;
|
|
8
|
+
}
|
|
9
|
+
export const useChatStore = create()((set, get) => {
|
|
10
|
+
const dispatch = (action) => set((state) => conversationReducer(state, action));
|
|
11
|
+
return {
|
|
12
|
+
...createConversationState(),
|
|
13
|
+
dispatch,
|
|
14
|
+
select: (id) => dispatch({ type: "select", id }),
|
|
15
|
+
setDraft: (id, value) => dispatch({ type: "draft", id, value }),
|
|
16
|
+
append: (id, message) => dispatch({ type: "append", id, message }),
|
|
17
|
+
deleteMessage: (id, messageId) => dispatch({ type: "deleteMessage", id, messageId }),
|
|
18
|
+
insertMessageAt: (id, index, message) => dispatch({ type: "insertMessageAt", id, index, message }),
|
|
19
|
+
replaceAgents: (agents) => dispatch({ type: "replaceAgents", agents }),
|
|
20
|
+
reportError: (message) => dispatch({ type: "persistError", value: message }),
|
|
21
|
+
clearPersistError: () => dispatch({ type: "persistError", value: null }),
|
|
22
|
+
bindRequest: (requestId) => dispatch({ type: "bindRequest", requestId }),
|
|
23
|
+
streamDelta: (requestId, text) => dispatch({ type: "streamDelta", requestId, text }),
|
|
24
|
+
streamReasoning: (requestId, text) => dispatch({ type: "streamReasoning", requestId, text }),
|
|
25
|
+
streamToolCall: (requestId, toolCallId, name, args) => dispatch({ type: "streamToolCall", requestId, toolCallId, name, args }),
|
|
26
|
+
streamToolResult: (requestId, toolCallId, result, isError) => dispatch({
|
|
27
|
+
type: "streamToolResult",
|
|
28
|
+
requestId,
|
|
29
|
+
toolCallId,
|
|
30
|
+
result,
|
|
31
|
+
isError,
|
|
32
|
+
}),
|
|
33
|
+
streamContextUsage: (requestId, inputTokens, outputTokens, window) => dispatch({
|
|
34
|
+
type: "streamContextUsage",
|
|
35
|
+
requestId,
|
|
36
|
+
inputTokens,
|
|
37
|
+
outputTokens,
|
|
38
|
+
window,
|
|
39
|
+
}),
|
|
40
|
+
streamMemory: (requestId, count, excerpt) => dispatch({ type: "streamMemory", requestId, count, excerpt }),
|
|
41
|
+
streamCompaction: (requestId, beforeTokens, afterTokens, reason) => dispatch({
|
|
42
|
+
type: "streamCompaction",
|
|
43
|
+
requestId,
|
|
44
|
+
beforeTokens,
|
|
45
|
+
afterTokens,
|
|
46
|
+
reason,
|
|
47
|
+
}),
|
|
48
|
+
streamDisplay: (requestId, view, title, payload) => dispatch({ type: "streamDisplay", requestId, view, title, payload }),
|
|
49
|
+
streamOutput: (requestId, outputKind, label, value) => dispatch({
|
|
50
|
+
type: "streamOutput",
|
|
51
|
+
requestId,
|
|
52
|
+
outputKind,
|
|
53
|
+
label,
|
|
54
|
+
value: value ?? "",
|
|
55
|
+
}),
|
|
56
|
+
streamEnd: (requestId, outcome, error) => dispatch({ type: "streamEnd", requestId, outcome, error }),
|
|
57
|
+
send: (text, attachments, deliver) => {
|
|
58
|
+
const state = get();
|
|
59
|
+
const active = state.activeId;
|
|
60
|
+
if (!active)
|
|
61
|
+
return;
|
|
62
|
+
const trimmed = text.trim();
|
|
63
|
+
if (trimmed.length === 0 && (attachments?.length ?? 0) === 0)
|
|
64
|
+
return;
|
|
65
|
+
if (isConversationStreaming(state, active))
|
|
66
|
+
return;
|
|
67
|
+
const message = {
|
|
68
|
+
id: nextId(`${active}-u`),
|
|
69
|
+
role: "user",
|
|
70
|
+
text: trimmed,
|
|
71
|
+
attachments,
|
|
72
|
+
timeLabel: clockLabel(),
|
|
73
|
+
state: "done",
|
|
74
|
+
};
|
|
75
|
+
dispatch({ type: "append", id: active, message });
|
|
76
|
+
dispatch({ type: "draft", id: active, value: "" });
|
|
77
|
+
void deliver?.(trimmed, attachments);
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
const EMPTY_MESSAGES = [];
|
|
82
|
+
export const selectActive = (s) => s.conversations.find((c) => c.id === s.activeId) ?? null;
|
|
83
|
+
export const selectActiveMessages = (s) => (s.activeId ? s.messages[s.activeId] : undefined) ?? EMPTY_MESSAGES;
|
|
84
|
+
export const selectActiveMembers = (s) => {
|
|
85
|
+
const active = selectActive(s);
|
|
86
|
+
if (!active)
|
|
87
|
+
return [];
|
|
88
|
+
return active.memberIds
|
|
89
|
+
.map((id) => s.agents[id])
|
|
90
|
+
.filter((a) => a !== undefined);
|
|
91
|
+
};
|
|
92
|
+
export const selectActiveStreaming = (s) => s.activeId ? isConversationStreaming(s, s.activeId) : false;
|
|
93
|
+
export const selectActiveStatus = (s) => selectActiveStreaming(s) ? "streaming" : s.persistError ? "error" : "idle";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BlockVisibility, BlockVisibilityKey, DensityMode, DisplayConfig, MessageStyleMode, RadiusMode, WidthPreset } from "../types/display";
|
|
2
|
+
export interface DisplayStore extends DisplayConfig {
|
|
3
|
+
setRadius: (radius: RadiusMode) => void;
|
|
4
|
+
setDensity: (density: DensityMode) => void;
|
|
5
|
+
setMessageStyle: (style: MessageStyleMode) => void;
|
|
6
|
+
setStreamWidth: (width: WidthPreset) => void;
|
|
7
|
+
setComposerWidth: (width: WidthPreset) => void;
|
|
8
|
+
setStreamWidthPx: (px: number | null) => void;
|
|
9
|
+
setComposerWidthPx: (px: number | null) => void;
|
|
10
|
+
setBlockHidden: (key: BlockVisibilityKey, hidden: boolean) => void;
|
|
11
|
+
resetDisplay: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const useDisplayStore: import("zustand").UseBoundStore<import("zustand").StoreApi<DisplayStore>>;
|
|
14
|
+
export declare function initDisplayStore(): void;
|
|
15
|
+
export type { DisplayConfig, RadiusMode, DensityMode, MessageStyleMode, BlockVisibility, BlockVisibilityKey };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
import { DEFAULT_DISPLAY_CONFIG, WIDTH_MAX, WIDTH_MIN, WIDTH_PRESET_VALUES, } from "../types/display";
|
|
3
|
+
import { LS_KEYS, loadJSON, saveJSON } from "../utils/storage";
|
|
4
|
+
function applyToDom(config) {
|
|
5
|
+
if (typeof document === "undefined")
|
|
6
|
+
return;
|
|
7
|
+
const root = document.documentElement;
|
|
8
|
+
root.setAttribute("data-radius", config.radius);
|
|
9
|
+
root.setAttribute("data-density", config.density);
|
|
10
|
+
root.setAttribute("data-msg-style", config.messageStyle);
|
|
11
|
+
const streamW = config.streamWidthPx != null
|
|
12
|
+
? `${config.streamWidthPx}px`
|
|
13
|
+
: config.streamWidth === "full"
|
|
14
|
+
? "100%"
|
|
15
|
+
: `${WIDTH_PRESET_VALUES[config.streamWidth]}px`;
|
|
16
|
+
const composerW = config.composerWidthPx != null
|
|
17
|
+
? `${config.composerWidthPx}px`
|
|
18
|
+
: config.composerWidth === "full"
|
|
19
|
+
? "100%"
|
|
20
|
+
: `${WIDTH_PRESET_VALUES[config.composerWidth]}px`;
|
|
21
|
+
root.style.setProperty("--ac-stream-width", streamW);
|
|
22
|
+
root.style.setProperty("--ac-composer-width", composerW);
|
|
23
|
+
root.setAttribute("data-stream-width", String(config.streamWidth));
|
|
24
|
+
root.setAttribute("data-composer-width", String(config.composerWidth));
|
|
25
|
+
const hidden = Object.entries(config.hidden)
|
|
26
|
+
.filter(([, v]) => v)
|
|
27
|
+
.map(([k]) => k);
|
|
28
|
+
if (hidden.length > 0)
|
|
29
|
+
root.setAttribute("data-hide", hidden.join(" "));
|
|
30
|
+
else
|
|
31
|
+
root.removeAttribute("data-hide");
|
|
32
|
+
}
|
|
33
|
+
function persist(config) {
|
|
34
|
+
saveJSON(LS_KEYS.displayConfig, config);
|
|
35
|
+
applyToDom(config);
|
|
36
|
+
}
|
|
37
|
+
function mergeHidden(partial) {
|
|
38
|
+
return { ...DEFAULT_DISPLAY_CONFIG.hidden, ...partial };
|
|
39
|
+
}
|
|
40
|
+
function normalizeWidth(v) {
|
|
41
|
+
return v === "narrow" || v === "wide" || v === "full" ? v : "standard";
|
|
42
|
+
}
|
|
43
|
+
function clampPx(n) {
|
|
44
|
+
return Math.max(WIDTH_MIN, Math.min(WIDTH_MAX, Math.round(n)));
|
|
45
|
+
}
|
|
46
|
+
function normalizePx(v) {
|
|
47
|
+
return typeof v === "number" && Number.isFinite(v) ? clampPx(v) : null;
|
|
48
|
+
}
|
|
49
|
+
const initial = (() => {
|
|
50
|
+
const saved = loadJSON(LS_KEYS.displayConfig, null);
|
|
51
|
+
if (!saved || typeof saved !== "object")
|
|
52
|
+
return DEFAULT_DISPLAY_CONFIG;
|
|
53
|
+
return {
|
|
54
|
+
radius: saved.radius === "square" ? "square" : "rounded",
|
|
55
|
+
density: saved.density === "compact" ? "compact" : "comfortable",
|
|
56
|
+
messageStyle: saved.messageStyle === "bubble" ? "bubble" : "seamless",
|
|
57
|
+
streamWidth: normalizeWidth(saved.streamWidth),
|
|
58
|
+
composerWidth: normalizeWidth(saved.composerWidth),
|
|
59
|
+
streamWidthPx: normalizePx(saved.streamWidthPx),
|
|
60
|
+
composerWidthPx: normalizePx(saved.composerWidthPx),
|
|
61
|
+
hidden: mergeHidden(saved.hidden ?? {}),
|
|
62
|
+
};
|
|
63
|
+
})();
|
|
64
|
+
export const useDisplayStore = create((set, get) => ({
|
|
65
|
+
...initial,
|
|
66
|
+
setRadius: (radius) => {
|
|
67
|
+
const next = { ...get(), radius };
|
|
68
|
+
persist(next);
|
|
69
|
+
set({ radius });
|
|
70
|
+
},
|
|
71
|
+
setDensity: (density) => {
|
|
72
|
+
const next = { ...get(), density };
|
|
73
|
+
persist(next);
|
|
74
|
+
set({ density });
|
|
75
|
+
},
|
|
76
|
+
setMessageStyle: (messageStyle) => {
|
|
77
|
+
const next = { ...get(), messageStyle };
|
|
78
|
+
persist(next);
|
|
79
|
+
set({ messageStyle });
|
|
80
|
+
},
|
|
81
|
+
setStreamWidth: (streamWidth) => {
|
|
82
|
+
const next = { ...get(), streamWidth, streamWidthPx: null };
|
|
83
|
+
persist(next);
|
|
84
|
+
set({ streamWidth, streamWidthPx: null });
|
|
85
|
+
},
|
|
86
|
+
setComposerWidth: (composerWidth) => {
|
|
87
|
+
const next = { ...get(), composerWidth, composerWidthPx: null };
|
|
88
|
+
persist(next);
|
|
89
|
+
set({ composerWidth, composerWidthPx: null });
|
|
90
|
+
},
|
|
91
|
+
setStreamWidthPx: (px) => {
|
|
92
|
+
const streamWidthPx = px == null ? null : clampPx(px);
|
|
93
|
+
const next = { ...get(), streamWidthPx };
|
|
94
|
+
persist(next);
|
|
95
|
+
set({ streamWidthPx });
|
|
96
|
+
},
|
|
97
|
+
setComposerWidthPx: (px) => {
|
|
98
|
+
const composerWidthPx = px == null ? null : clampPx(px);
|
|
99
|
+
const next = { ...get(), composerWidthPx };
|
|
100
|
+
persist(next);
|
|
101
|
+
set({ composerWidthPx });
|
|
102
|
+
},
|
|
103
|
+
setBlockHidden: (key, hidden) => {
|
|
104
|
+
const nextHidden = { ...get().hidden, [key]: hidden };
|
|
105
|
+
const next = { ...get(), hidden: nextHidden };
|
|
106
|
+
persist(next);
|
|
107
|
+
set({ hidden: nextHidden });
|
|
108
|
+
},
|
|
109
|
+
resetDisplay: () => {
|
|
110
|
+
persist(DEFAULT_DISPLAY_CONFIG);
|
|
111
|
+
set({ ...DEFAULT_DISPLAY_CONFIG, hidden: { ...DEFAULT_DISPLAY_CONFIG.hidden } });
|
|
112
|
+
},
|
|
113
|
+
}));
|
|
114
|
+
export function initDisplayStore() {
|
|
115
|
+
applyToDom(useDisplayStore.getState());
|
|
116
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { useChatStore, selectActive, selectActiveMessages, selectActiveMembers, selectActiveStreaming, selectActiveStatus, type ChatStore, } from "./chat-store";
|
|
2
|
+
export { useDisplayStore, initDisplayStore, type DisplayStore, } from "./display-store";
|
|
3
|
+
export { useThemeStore, initThemeStore, type ThemeStore, } from "./theme-store";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { useChatStore, selectActive, selectActiveMessages, selectActiveMembers, selectActiveStreaming, selectActiveStatus, } from "./chat-store";
|
|
2
|
+
export { useDisplayStore, initDisplayStore, } from "./display-store";
|
|
3
|
+
export { useThemeStore, initThemeStore, } from "./theme-store";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ThemeName } from "../types/theme";
|
|
2
|
+
export interface ThemeStore {
|
|
3
|
+
theme: ThemeName;
|
|
4
|
+
setTheme: (theme: ThemeName) => void;
|
|
5
|
+
toggleTheme: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const useThemeStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ThemeStore>>;
|
|
8
|
+
export declare function initThemeStore(): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
import { LS_KEYS, loadJSON, saveJSON } from "../utils/storage";
|
|
3
|
+
const THEME_VALUES = ["dark", "light", "glass"];
|
|
4
|
+
function normalize(value) {
|
|
5
|
+
return value === "light" || value === "glass" ? value : "dark";
|
|
6
|
+
}
|
|
7
|
+
function applyToDom(theme) {
|
|
8
|
+
if (typeof document === "undefined")
|
|
9
|
+
return;
|
|
10
|
+
document.documentElement.setAttribute("data-theme", theme);
|
|
11
|
+
}
|
|
12
|
+
const initial = normalize(loadJSON(LS_KEYS.theme, "dark"));
|
|
13
|
+
export const useThemeStore = create((set, get) => ({
|
|
14
|
+
theme: initial,
|
|
15
|
+
setTheme: (theme) => {
|
|
16
|
+
const next = normalize(theme);
|
|
17
|
+
saveJSON(LS_KEYS.theme, next);
|
|
18
|
+
applyToDom(next);
|
|
19
|
+
set({ theme: next });
|
|
20
|
+
},
|
|
21
|
+
toggleTheme: () => {
|
|
22
|
+
const idx = THEME_VALUES.indexOf(get().theme);
|
|
23
|
+
const next = THEME_VALUES[(idx + 1) % THEME_VALUES.length];
|
|
24
|
+
get().setTheme(next);
|
|
25
|
+
},
|
|
26
|
+
}));
|
|
27
|
+
export function initThemeStore() {
|
|
28
|
+
applyToDom(useThemeStore.getState().theme);
|
|
29
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ControlScale, DesignTokens, GapScale, RadiusScale, ThemeName, TypeScale, ZIndexScale } from "../types/theme";
|
|
2
|
+
export declare const control: ControlScale;
|
|
3
|
+
export declare const type: TypeScale;
|
|
4
|
+
export declare const gaps: GapScale;
|
|
5
|
+
export declare const radius: RadiusScale;
|
|
6
|
+
export declare const z: ZIndexScale;
|
|
7
|
+
export declare const themeNames: ThemeName[];
|
|
8
|
+
export declare function applyTheme(theme: ThemeName): void;
|
|
9
|
+
export declare function readTheme(): ThemeName;
|
|
10
|
+
export declare function designTokens(theme?: ThemeName): DesignTokens;
|
|
11
|
+
export declare const tokens: {
|
|
12
|
+
control: ControlScale;
|
|
13
|
+
type: TypeScale;
|
|
14
|
+
gaps: GapScale;
|
|
15
|
+
radius: RadiusScale;
|
|
16
|
+
z: ZIndexScale;
|
|
17
|
+
themeNames: ThemeName[];
|
|
18
|
+
applyTheme: typeof applyTheme;
|
|
19
|
+
readTheme: typeof readTheme;
|
|
20
|
+
};
|
|
21
|
+
export default tokens;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export const control = {
|
|
2
|
+
xs: 22,
|
|
3
|
+
sm: 28,
|
|
4
|
+
md: 32,
|
|
5
|
+
lg: 40,
|
|
6
|
+
};
|
|
7
|
+
export const type = {
|
|
8
|
+
micro: { size: 11, lineHeight: 16 },
|
|
9
|
+
meta: { size: 12, lineHeight: 18 },
|
|
10
|
+
body: { size: 13, lineHeight: 20 },
|
|
11
|
+
label: { size: 13, lineHeight: 20 },
|
|
12
|
+
title: { size: 14, lineHeight: 22 },
|
|
13
|
+
heading: { size: 16, lineHeight: 24 },
|
|
14
|
+
};
|
|
15
|
+
export const gaps = {
|
|
16
|
+
xs: 4,
|
|
17
|
+
sm: 8,
|
|
18
|
+
md: 12,
|
|
19
|
+
lg: 16,
|
|
20
|
+
xl: 20,
|
|
21
|
+
xxl: 24,
|
|
22
|
+
stream: 14,
|
|
23
|
+
bubbleX: 14,
|
|
24
|
+
bubbleY: 10,
|
|
25
|
+
};
|
|
26
|
+
export const radius = {
|
|
27
|
+
sm: "var(--radius-sm)",
|
|
28
|
+
md: "var(--radius-md)",
|
|
29
|
+
lg: "var(--radius-lg)",
|
|
30
|
+
xl: "var(--radius-xl)",
|
|
31
|
+
pill: "var(--radius-pill)",
|
|
32
|
+
};
|
|
33
|
+
export const z = {
|
|
34
|
+
underCanvas: 0,
|
|
35
|
+
sticky: 1,
|
|
36
|
+
canvasOverlay: 10,
|
|
37
|
+
panel: 20,
|
|
38
|
+
tooltip: 40,
|
|
39
|
+
modal: 50,
|
|
40
|
+
top: 60,
|
|
41
|
+
};
|
|
42
|
+
export const themeNames = ["dark", "light", "glass"];
|
|
43
|
+
export function applyTheme(theme) {
|
|
44
|
+
if (typeof document === "undefined")
|
|
45
|
+
return;
|
|
46
|
+
document.documentElement.setAttribute("data-theme", theme);
|
|
47
|
+
}
|
|
48
|
+
export function readTheme() {
|
|
49
|
+
if (typeof document === "undefined")
|
|
50
|
+
return "dark";
|
|
51
|
+
const v = document.documentElement.getAttribute("data-theme");
|
|
52
|
+
return v === "light" || v === "glass" ? v : "dark";
|
|
53
|
+
}
|
|
54
|
+
export function designTokens(theme = "dark") {
|
|
55
|
+
return {
|
|
56
|
+
theme,
|
|
57
|
+
palette: {},
|
|
58
|
+
control,
|
|
59
|
+
type,
|
|
60
|
+
gaps,
|
|
61
|
+
radius,
|
|
62
|
+
z,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export const tokens = { control, type, gaps, radius, z, themeNames, applyTheme, readTheme };
|
|
66
|
+
export default tokens;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { AgentId, PermissionMode } from "./conversation";
|
|
2
|
+
export type AgentStatus = "online" | "busy" | "offline";
|
|
3
|
+
export type ToolOrigin = "builtin" | "mcp" | "canvas";
|
|
4
|
+
export interface ToolToggle {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
description: string;
|
|
8
|
+
origin: ToolOrigin;
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
available: boolean;
|
|
11
|
+
unavailableReason?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface PolicyRule {
|
|
14
|
+
id: string;
|
|
15
|
+
label: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface ModelParams {
|
|
20
|
+
temperature?: number | null;
|
|
21
|
+
topP?: number | null;
|
|
22
|
+
maxTokens?: number | null;
|
|
23
|
+
}
|
|
24
|
+
export interface Agent {
|
|
25
|
+
id: AgentId;
|
|
26
|
+
name: string;
|
|
27
|
+
role: string;
|
|
28
|
+
badge: string;
|
|
29
|
+
status: AgentStatus;
|
|
30
|
+
persona: string;
|
|
31
|
+
model: string;
|
|
32
|
+
modelId: string | null;
|
|
33
|
+
contextWindowLabel?: string;
|
|
34
|
+
maxSteps?: number;
|
|
35
|
+
tools: ToolToggle[];
|
|
36
|
+
mcpServers: {
|
|
37
|
+
name: string;
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
}[];
|
|
40
|
+
memory: {
|
|
41
|
+
backend: string;
|
|
42
|
+
entries?: number;
|
|
43
|
+
autoSummary?: boolean;
|
|
44
|
+
};
|
|
45
|
+
sandbox: string;
|
|
46
|
+
permissionMode?: PermissionMode;
|
|
47
|
+
policies: PolicyRule[];
|
|
48
|
+
workPath: string | null;
|
|
49
|
+
modelParams: ModelParams;
|
|
50
|
+
disabledSkills: string[];
|
|
51
|
+
}
|
|
52
|
+
export interface AgentIdentity {
|
|
53
|
+
name: string;
|
|
54
|
+
role: string;
|
|
55
|
+
badge?: string;
|
|
56
|
+
persona: string;
|
|
57
|
+
}
|
|
58
|
+
export interface SenderAttribution {
|
|
59
|
+
name: string;
|
|
60
|
+
badge: string;
|
|
61
|
+
agent?: Agent;
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { AgentId } from "./conversation";
|
|
2
|
+
import type { PendingAsk, QueuedPrompt, SessionSearchHit, ConversationId } from "./conversation";
|
|
3
|
+
import type { Attachment, ChatMessage } from "./message";
|
|
4
|
+
export type OnSend = (text: string, attachments?: Attachment[]) => void;
|
|
5
|
+
export type OnStop = () => void;
|
|
6
|
+
export type OnNotice = (message: string) => void;
|
|
7
|
+
export type OnCopyText = (text: string) => Promise<boolean> | boolean;
|
|
8
|
+
export type OnDeleteMessage = (messageId: string) => void;
|
|
9
|
+
export type OnRetry = (messageId: string) => void;
|
|
10
|
+
export type OnEditMessage = (messageId: string, text: string) => void;
|
|
11
|
+
export type OnQuoteMessage = (text: string) => void;
|
|
12
|
+
export type OnTraceMessage = (messageId: string) => void;
|
|
13
|
+
export type OnOpenAgent = (id: AgentId) => void;
|
|
14
|
+
export type OnRespondPermission = (permissionId: string, approved: boolean, remembered: boolean) => void;
|
|
15
|
+
export type OnAnswerAsk = (callId: string, answer: string) => void;
|
|
16
|
+
export type OnSkipAsk = (callId: string) => void;
|
|
17
|
+
export interface SelectionTarget {
|
|
18
|
+
text: string;
|
|
19
|
+
agentId: AgentId | null;
|
|
20
|
+
}
|
|
21
|
+
export type OnFavoriteSelection = (target: SelectionTarget) => void;
|
|
22
|
+
export type OnBatchCopy = () => void;
|
|
23
|
+
export type OnBatchRemove = () => void;
|
|
24
|
+
export type OnSelectConversation = (id: ConversationId) => void;
|
|
25
|
+
export type OnOpenConversationHit = (hit: SessionSearchHit) => void;
|
|
26
|
+
export type { ComposerModelSwitch, PermissionModeSwitch, } from "./composer";
|
|
27
|
+
export interface QueuedPromptsCallbacks {
|
|
28
|
+
onMoveUp: (id: string) => void;
|
|
29
|
+
onMoveDown: (id: string) => void;
|
|
30
|
+
onSendNow: (id: string) => void;
|
|
31
|
+
onEdit: (id: string) => void;
|
|
32
|
+
onRemove: (id: string) => void;
|
|
33
|
+
}
|
|
34
|
+
export interface MessageMenuCallbacks {
|
|
35
|
+
onCopyText?: OnCopyText;
|
|
36
|
+
onQuote?: OnQuoteMessage;
|
|
37
|
+
onCopySelection?: OnCopyText;
|
|
38
|
+
onTrace?: OnTraceMessage;
|
|
39
|
+
onDelete?: OnDeleteMessage;
|
|
40
|
+
onMultiSelect?: () => void;
|
|
41
|
+
}
|
|
42
|
+
export interface StreamEventCallbacks {
|
|
43
|
+
onDelta: (requestId: string, text: string) => void;
|
|
44
|
+
onReasoning: (requestId: string, text: string) => void;
|
|
45
|
+
onToolCall: (requestId: string, toolCallId: string, name: string, args: unknown) => void;
|
|
46
|
+
onToolResult: (requestId: string, toolCallId: string, result: string, isError: boolean) => void;
|
|
47
|
+
onContextUsage: (requestId: string, inputTokens: number, outputTokens: number, window: number) => void;
|
|
48
|
+
onMemory: (requestId: string, count: number, excerpt: string) => void;
|
|
49
|
+
onCompaction: (requestId: string | null, beforeTokens: number, afterTokens: number, reason: string) => void;
|
|
50
|
+
onEnd: (requestId: string, outcome: "done" | "error", error?: string) => void;
|
|
51
|
+
onDisplay?: (requestId: string, view: string, title?: string, payload?: unknown) => void;
|
|
52
|
+
onOutput?: (requestId: string, outputKind: "text" | "file" | "link" | "json", label?: string, value?: string) => void;
|
|
53
|
+
}
|
|
54
|
+
export type DeliverFn = (text: string, attachments?: Attachment[]) => void;
|
|
55
|
+
export type { PendingAsk, QueuedPrompt, ChatMessage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|