@sixb/app 0.1.14 → 0.1.15
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/dist/{chunk-vtp6nk44.js → chunk-736c9akn.js} +1 -1
- package/dist/{chunk-1rhht9y0.js → chunk-n0cxwvej.js} +1 -1
- package/dist/{chunk-0yb22w6m.js → chunk-qh1panvd.js} +1 -1
- package/dist/{chunk-aes17xmx.js → chunk-twjs2sb9.js} +3928 -3717
- package/dist/{chunk-aes17xmx.js.map → chunk-twjs2sb9.js.map} +46 -42
- package/dist/index.js +15 -6
- package/dist/index.js.map +6 -6
- package/dist/pages.js +60 -44
- package/dist/pages.js.map +8 -8
- package/dist/server.js +12 -6
- package/dist/server.js.map +3 -3
- package/package.json +3 -3
- package/src/agent/agent-chat.tsx +4 -22
- package/src/agent/agent-panel.tsx +4 -0
- package/src/agent/agent-surface.tsx +4 -0
- package/src/agent/agent.css +33 -3
- package/src/agent/approvals.ts +4 -5
- package/src/agent/artifact-panel.tsx +113 -37
- package/src/agent/components/activity-status.tsx +1 -1
- package/src/agent/components/agent-threads.tsx +377 -0
- package/src/agent/components/approval-card.tsx +336 -327
- package/src/agent/components/approval-mode-chip.tsx +38 -145
- package/src/agent/components/auto-model-chip.tsx +103 -167
- package/src/agent/components/composer-menu.tsx +185 -0
- package/src/agent/components/composer.tsx +38 -43
- package/src/agent/components/context-chips.tsx +1 -1
- package/src/agent/components/conversation-panel.tsx +16 -36
- package/src/agent/components/file-attachment-card.tsx +5 -2
- package/src/agent/components/message-parts.tsx +27 -11
- package/src/agent/components/message-view.tsx +182 -68
- package/src/agent/components/model-controls.tsx +133 -125
- package/src/agent/components/model-picker-row.tsx +38 -17
- package/src/agent/components/participant-input.tsx +159 -31
- package/src/agent/components/reasoning-effort-slider.tsx +27 -27
- package/src/agent/components/shared-thread-notice.tsx +1 -1
- package/src/agent/components/thread-people.tsx +45 -15
- package/src/agent/components/threads-button.tsx +70 -0
- package/src/agent/components/transcript.tsx +30 -1
- package/src/agent/conversation.ts +25 -1
- package/src/agent/delegation/child-card.tsx +187 -247
- package/src/agent/delegation/child-cards.tsx +4 -7
- package/src/agent/delegation/child-group.tsx +179 -98
- package/src/agent/delegation/child-parts.tsx +71 -106
- package/src/agent/delegation/child-work.tsx +6 -52
- package/src/agent/delegation/interpret.ts +0 -28
- package/src/agent/delegation/model.ts +115 -39
- package/src/agent/hooks/use-agent-conversation.ts +7 -92
- package/src/agent/hooks/use-people-suggestions.ts +90 -0
- package/src/agent/hooks/use-thread-lists.ts +77 -0
- package/src/agent/i18n/en.ts +96 -83
- package/src/agent/i18n/fr.ts +105 -100
- package/src/agent/react-router.tsx +48 -5
- package/src/agent/run-presentation.ts +6 -2
- package/src/agent/thread-navigation.ts +16 -0
- package/src/agent/thread-pages.ts +24 -0
- package/src/artifacts/person-avatar.tsx +1 -1
- package/src/createCustomApp.ts +13 -6
- package/src/index.ts +7 -3
- package/src/pages/home.tsx +3 -1
- package/src/pages/observability/ai-usage/calls.tsx +2 -1
- package/src/pages/settings/memory-history.tsx +2 -1
- package/src/pages/settings/messages.ts +2 -3
- package/src/pages/values.tsx +23 -1
- package/src/pages.ts +5 -1
- package/src/shell/agent-dock.tsx +4 -2
- package/src/agent/agents-page.ts +0 -7
- package/src/agent/components/agent-thread-switcher.tsx +0 -519
- /package/dist/{chunk-vtp6nk44.js.map → chunk-736c9akn.js.map} +0 -0
- /package/dist/{chunk-1rhht9y0.js.map → chunk-n0cxwvej.js.map} +0 -0
- /package/dist/{chunk-0yb22w6m.js.map → chunk-qh1panvd.js.map} +0 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Drawer,
|
|
3
|
+
DrawerContent,
|
|
4
|
+
DrawerDescription,
|
|
5
|
+
DrawerTitle,
|
|
6
|
+
DrawerTrigger,
|
|
7
|
+
Popover,
|
|
8
|
+
PopoverContent,
|
|
9
|
+
PopoverTrigger,
|
|
10
|
+
} from "@sixb/ui/components"
|
|
11
|
+
import { useIsMobile } from "@sixb/ui/hooks"
|
|
12
|
+
import { cn } from "@sixb/ui/lib/utils"
|
|
13
|
+
import { Check } from "lucide-react"
|
|
14
|
+
import { type ReactNode, useEffect, useRef } from "react"
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The anatomy the composer's menus share (permissions, model, Auto): rows of an icon, a title and
|
|
18
|
+
* a line of description, the choice in medium weight with its check at the trailing edge.
|
|
19
|
+
*/
|
|
20
|
+
const COMPOSER_MENU_CLASS_NAME =
|
|
21
|
+
"w-[19rem] max-w-[calc(100vw-1rem)] overflow-hidden rounded-[18px] border-black/[0.06] p-0 shadow-[0_18px_50px_-18px_rgb(0_0_0/0.28),0_2px_8px_-2px_rgb(0_0_0/0.06)] dark:border-white/[0.08] dark:shadow-[0_18px_50px_-18px_rgb(0_0_0/0.8)]"
|
|
22
|
+
|
|
23
|
+
export const COMPOSER_MENU_ROW_CLASS_NAME =
|
|
24
|
+
"flex w-full min-w-0 items-center gap-3 rounded-[10px] px-3 py-2 text-left outline-none transition-colors duration-100 hover:bg-black/[0.045] focus-visible:bg-black/[0.045] disabled:opacity-50 dark:hover:bg-white/[0.07] dark:focus-visible:bg-white/[0.07]"
|
|
25
|
+
|
|
26
|
+
/** A composer control that opens one of these menus: quiet medium text, filled while open. */
|
|
27
|
+
export const COMPOSER_TRIGGER_CLASS_NAME = cn(
|
|
28
|
+
"flex h-8 min-w-0 items-center gap-1.5 rounded-full px-2.5 text-xs font-medium text-muted-foreground outline-none transition-colors",
|
|
29
|
+
"hover:bg-muted hover:text-foreground focus-visible:bg-muted focus-visible:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
30
|
+
"disabled:cursor-default disabled:opacity-60 aria-expanded:bg-muted/60 aria-expanded:text-foreground"
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
/** The chosen row's resting highlight, as when the pointer is over it. */
|
|
34
|
+
export const COMPOSER_MENU_ROW_SELECTED_CLASS_NAME = "bg-black/[0.045] dark:bg-white/[0.07]"
|
|
35
|
+
|
|
36
|
+
/** The thinking slider's section under a model menu's list. */
|
|
37
|
+
export const COMPOSER_MENU_SECTION_CLASS_NAME =
|
|
38
|
+
"shrink-0 border-t border-black/[0.06] px-4 pt-3 pb-3.5 dark:border-white/[0.07]"
|
|
39
|
+
|
|
40
|
+
export function ComposerMenuHeader({ children }: { readonly children: ReactNode }) {
|
|
41
|
+
return <div className="px-2.5 pt-1.5 pb-1 text-xs text-muted-foreground">{children}</div>
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** A row's title, the choice in medium weight, over a line that says what it does. */
|
|
45
|
+
export function ComposerMenuRowText({
|
|
46
|
+
title,
|
|
47
|
+
description,
|
|
48
|
+
descriptionId,
|
|
49
|
+
selected = false,
|
|
50
|
+
}: {
|
|
51
|
+
readonly title: string
|
|
52
|
+
readonly description: string
|
|
53
|
+
readonly descriptionId: string
|
|
54
|
+
readonly selected: boolean
|
|
55
|
+
}) {
|
|
56
|
+
return (
|
|
57
|
+
<span className="min-w-0 flex-1">
|
|
58
|
+
<span
|
|
59
|
+
className={cn(
|
|
60
|
+
"block break-words text-[13.5px] tracking-[-0.005em] text-foreground",
|
|
61
|
+
selected && "font-medium"
|
|
62
|
+
)}
|
|
63
|
+
>
|
|
64
|
+
{title}
|
|
65
|
+
</span>
|
|
66
|
+
<span id={descriptionId} className="block text-xs leading-snug text-muted-foreground">
|
|
67
|
+
{description}
|
|
68
|
+
</span>
|
|
69
|
+
</span>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function ComposerMenuCheck({ checked }: { readonly checked: boolean }) {
|
|
74
|
+
return (
|
|
75
|
+
<span className="flex size-4 shrink-0 items-center justify-center">
|
|
76
|
+
{checked ? (
|
|
77
|
+
<Check className="size-4 text-foreground" strokeWidth={2.2} aria-hidden="true" />
|
|
78
|
+
) : null}
|
|
79
|
+
</span>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function ComposerMenuDivider() {
|
|
84
|
+
return <div className="mx-2.5 my-1 h-px bg-border/70" />
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* A composer menu above its trigger, or a bottom sheet on a phone. `trigger` is the button that
|
|
89
|
+
* opens it.
|
|
90
|
+
*/
|
|
91
|
+
export function ComposerMenu({
|
|
92
|
+
open,
|
|
93
|
+
onOpenChange,
|
|
94
|
+
trigger,
|
|
95
|
+
title,
|
|
96
|
+
align,
|
|
97
|
+
className,
|
|
98
|
+
children,
|
|
99
|
+
}: {
|
|
100
|
+
readonly open: boolean
|
|
101
|
+
readonly onOpenChange: (open: boolean) => void
|
|
102
|
+
readonly trigger: ReactNode
|
|
103
|
+
/** Names the menu to assistive technology. */
|
|
104
|
+
readonly title: string
|
|
105
|
+
readonly align: "start" | "end"
|
|
106
|
+
readonly className?: string
|
|
107
|
+
readonly children: ReactNode
|
|
108
|
+
}) {
|
|
109
|
+
const mobile = useIsMobile()
|
|
110
|
+
|
|
111
|
+
if (mobile) {
|
|
112
|
+
return (
|
|
113
|
+
<Drawer open={open} onOpenChange={onOpenChange}>
|
|
114
|
+
<DrawerTrigger asChild>{trigger}</DrawerTrigger>
|
|
115
|
+
<DrawerContent className="max-h-[85dvh]">
|
|
116
|
+
<DrawerTitle className="sr-only">{title}</DrawerTitle>
|
|
117
|
+
<DrawerDescription className="sr-only">{title}</DrawerDescription>
|
|
118
|
+
<div className="flex min-h-0 flex-col px-2 pt-1 pb-[max(0.75rem,env(safe-area-inset-bottom))]">
|
|
119
|
+
{children}
|
|
120
|
+
</div>
|
|
121
|
+
</DrawerContent>
|
|
122
|
+
</Drawer>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<Popover open={open} onOpenChange={onOpenChange}>
|
|
128
|
+
<PopoverTrigger asChild>{trigger}</PopoverTrigger>
|
|
129
|
+
<PopoverContent
|
|
130
|
+
align={align}
|
|
131
|
+
side="top"
|
|
132
|
+
sideOffset={10}
|
|
133
|
+
collisionPadding={12}
|
|
134
|
+
aria-label={title}
|
|
135
|
+
// Capped by the viewport, not Radix's available-height variable: a size that depends on a
|
|
136
|
+
// value Radix rewrites loops its resize observer.
|
|
137
|
+
className={cn(
|
|
138
|
+
COMPOSER_MENU_CLASS_NAME,
|
|
139
|
+
"flex max-h-[min(32rem,calc(100dvh-8rem))] flex-col",
|
|
140
|
+
className
|
|
141
|
+
)}
|
|
142
|
+
>
|
|
143
|
+
{children}
|
|
144
|
+
</PopoverContent>
|
|
145
|
+
</Popover>
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* A menu's scrolling list, fading out at the bottom while more is below, so a cut-off row reads as
|
|
151
|
+
* "more" rather than broken.
|
|
152
|
+
*/
|
|
153
|
+
export function ComposerMenuScroll({ className, children, ...props }: React.ComponentProps<"div">) {
|
|
154
|
+
const ref = useRef<HTMLDivElement>(null)
|
|
155
|
+
|
|
156
|
+
useEffect(() => {
|
|
157
|
+
const element = ref.current
|
|
158
|
+
if (!element) return
|
|
159
|
+
const update = () => {
|
|
160
|
+
const more = element.scrollTop + element.clientHeight < element.scrollHeight - 2
|
|
161
|
+
element.toggleAttribute("data-more", more)
|
|
162
|
+
}
|
|
163
|
+
update()
|
|
164
|
+
const observer = new ResizeObserver(update)
|
|
165
|
+
observer.observe(element)
|
|
166
|
+
element.addEventListener("scroll", update, { passive: true })
|
|
167
|
+
return () => {
|
|
168
|
+
observer.disconnect()
|
|
169
|
+
element.removeEventListener("scroll", update)
|
|
170
|
+
}
|
|
171
|
+
}, [])
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
<div
|
|
175
|
+
ref={ref}
|
|
176
|
+
{...props}
|
|
177
|
+
className={cn(
|
|
178
|
+
"scrollbar-thin min-h-0 overflow-y-auto data-[more]:[mask-image:linear-gradient(to_bottom,black_calc(100%-2rem),transparent)]",
|
|
179
|
+
className
|
|
180
|
+
)}
|
|
181
|
+
>
|
|
182
|
+
{children}
|
|
183
|
+
</div>
|
|
184
|
+
)
|
|
185
|
+
}
|
|
@@ -101,13 +101,10 @@ export interface ComposerProps {
|
|
|
101
101
|
/**
|
|
102
102
|
* What the agent may change without asking in the reader's next turns. With
|
|
103
103
|
* {@link onApprovalModeChange}, the composer shows it as a chip, and Shift+Tab in an empty input
|
|
104
|
-
*
|
|
104
|
+
* cycles through the modes.
|
|
105
105
|
*/
|
|
106
106
|
readonly approvalMode?: AgentApprovalMode
|
|
107
|
-
/** The reader's mode for new conversations, which the chip's menu offers to change. */
|
|
108
|
-
readonly defaultApprovalMode?: AgentApprovalMode
|
|
109
107
|
readonly onApprovalModeChange?: (mode: AgentApprovalMode) => void
|
|
110
|
-
readonly onMakeApprovalModeDefault?: (mode: AgentApprovalMode) => void
|
|
111
108
|
/** A turn waits for the reader's approval: the input says how to answer it or move on. */
|
|
112
109
|
readonly awaitingApproval?: boolean
|
|
113
110
|
}
|
|
@@ -135,6 +132,13 @@ type ComposerAttachment =
|
|
|
135
132
|
|
|
136
133
|
const MAX_HEIGHT_PX = 200
|
|
137
134
|
|
|
135
|
+
// Send and stop: the one filled control in the box.
|
|
136
|
+
const SEND_BUTTON_CLASS_NAME = cn(
|
|
137
|
+
"flex size-8 shrink-0 items-center justify-center rounded-full outline-none transition-colors",
|
|
138
|
+
"bg-foreground text-background hover:bg-foreground/85 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-offset-2 focus-visible:ring-offset-card",
|
|
139
|
+
"disabled:bg-foreground/25 disabled:text-background dark:disabled:bg-white/20 dark:disabled:text-white/70"
|
|
140
|
+
)
|
|
141
|
+
|
|
138
142
|
export function composerCanFocus({
|
|
139
143
|
disabled,
|
|
140
144
|
pending,
|
|
@@ -172,9 +176,7 @@ export function Composer({
|
|
|
172
176
|
ambientContext = [],
|
|
173
177
|
compact = false,
|
|
174
178
|
approvalMode,
|
|
175
|
-
defaultApprovalMode,
|
|
176
179
|
onApprovalModeChange,
|
|
177
|
-
onMakeApprovalModeDefault,
|
|
178
180
|
awaitingApproval = false,
|
|
179
181
|
}: ComposerProps) {
|
|
180
182
|
const agentMessages = useAgentMessages()
|
|
@@ -536,9 +538,8 @@ export function Composer({
|
|
|
536
538
|
}
|
|
537
539
|
|
|
538
540
|
// Enter sends; Cmd/Ctrl+Enter and Shift+Enter insert a newline (and let the field grow).
|
|
539
|
-
// Shift+Tab in an empty input
|
|
540
|
-
//
|
|
541
|
-
// from the chip's menu.
|
|
541
|
+
// Shift+Tab in an empty input cycles Manual, Accept edits and Auto, as in a terminal agent. Once
|
|
542
|
+
// something is typed, it moves focus back as everywhere else.
|
|
542
543
|
const handleKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {
|
|
543
544
|
if (
|
|
544
545
|
event.key === "Tab" &&
|
|
@@ -611,6 +612,8 @@ export function Composer({
|
|
|
611
612
|
? messages.attachmentsFailed(failedCount)
|
|
612
613
|
: hint
|
|
613
614
|
|
|
615
|
+
const showPermissions = approvalMode !== undefined && onApprovalModeChange !== undefined
|
|
616
|
+
|
|
614
617
|
return (
|
|
615
618
|
<div ref={rootRef} className={cn("relative bg-background px-4 pt-2 pb-3", className)}>
|
|
616
619
|
{draggingFiles ? (
|
|
@@ -620,7 +623,7 @@ export function Composer({
|
|
|
620
623
|
<DropFilesOverlay compact={compact} />
|
|
621
624
|
)
|
|
622
625
|
) : null}
|
|
623
|
-
<div className="mx-auto w-full max-w-
|
|
626
|
+
<div className="mx-auto w-full max-w-[46rem]">
|
|
624
627
|
{error ? (
|
|
625
628
|
<Marker role="alert" className="mb-2 items-start text-destructive">
|
|
626
629
|
<MarkerIcon>
|
|
@@ -630,10 +633,8 @@ export function Composer({
|
|
|
630
633
|
</Marker>
|
|
631
634
|
) : null}
|
|
632
635
|
<div
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
draggingFiles && "border-primary/50 ring-2 ring-primary/15"
|
|
636
|
-
)}
|
|
636
|
+
data-dragging={draggingFiles || undefined}
|
|
637
|
+
className="sixb-composer-surface relative rounded-3xl bg-card"
|
|
637
638
|
>
|
|
638
639
|
<ContextPicker
|
|
639
640
|
open={mention !== null}
|
|
@@ -660,7 +661,12 @@ export function Composer({
|
|
|
660
661
|
))}
|
|
661
662
|
</div>
|
|
662
663
|
) : null}
|
|
663
|
-
<div
|
|
664
|
+
<div
|
|
665
|
+
className={cn(
|
|
666
|
+
"px-4 pb-1",
|
|
667
|
+
contextEntries.length > 0 || attachments.length > 0 ? "pt-1" : "pt-3.5"
|
|
668
|
+
)}
|
|
669
|
+
>
|
|
664
670
|
<Textarea
|
|
665
671
|
ref={textareaRef}
|
|
666
672
|
autoFocus={composerCanFocus({ disabled, pending, running })}
|
|
@@ -682,10 +688,10 @@ export function Composer({
|
|
|
682
688
|
: (placeholder ?? messages.placeholder)
|
|
683
689
|
}
|
|
684
690
|
aria-label={messages.message}
|
|
685
|
-
className="max-h-[200px] min-h-9 w-full resize-none overflow-y-hidden border-0 bg-transparent px-0 py-1 text-[15px] leading-relaxed shadow-none focus-visible:ring-0 md:text-[15px]"
|
|
691
|
+
className="max-h-[200px] min-h-9 w-full resize-none overflow-y-hidden border-0 bg-transparent px-0 py-1 text-[15px] leading-relaxed shadow-none placeholder:text-muted-foreground/80 focus-visible:ring-0 md:text-[15px]"
|
|
686
692
|
/>
|
|
687
693
|
</div>
|
|
688
|
-
<div className="relative flex min-w-0 items-center gap-
|
|
694
|
+
<div className="relative flex min-w-0 items-center gap-0.5 px-2 pb-2">
|
|
689
695
|
<input
|
|
690
696
|
ref={fileInputRef}
|
|
691
697
|
type="file"
|
|
@@ -701,21 +707,17 @@ export function Composer({
|
|
|
701
707
|
disabled={!canAttachFiles}
|
|
702
708
|
aria-label={messages.attachFiles}
|
|
703
709
|
className={cn(
|
|
704
|
-
"flex size-
|
|
705
|
-
"hover:bg-muted
|
|
710
|
+
"flex size-8 shrink-0 items-center justify-center rounded-full text-muted-foreground outline-none transition-colors",
|
|
711
|
+
"hover:bg-muted hover:text-foreground focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
712
|
+
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
706
713
|
)}
|
|
707
714
|
>
|
|
708
|
-
<Plus className="size-
|
|
715
|
+
<Plus className="size-[18px]" strokeWidth={1.75} />
|
|
709
716
|
</button>
|
|
710
|
-
{
|
|
711
|
-
<ApprovalModeChip
|
|
712
|
-
mode={approvalMode}
|
|
713
|
-
defaultMode={defaultApprovalMode}
|
|
714
|
-
onChange={changeApprovalMode}
|
|
715
|
-
onMakeDefault={onMakeApprovalModeDefault}
|
|
716
|
-
/>
|
|
717
|
+
{showPermissions ? (
|
|
718
|
+
<ApprovalModeChip mode={approvalMode} onChange={changeApprovalMode} />
|
|
717
719
|
) : null}
|
|
718
|
-
<span className="min-w-
|
|
720
|
+
<span className="min-w-2 flex-1" />
|
|
719
721
|
{onSelectModel && onSelectReasoning ? (
|
|
720
722
|
<ModelControls
|
|
721
723
|
models={models}
|
|
@@ -738,16 +740,12 @@ export function Composer({
|
|
|
738
740
|
onClick={onStop}
|
|
739
741
|
disabled={stopping}
|
|
740
742
|
aria-label={messages.stop}
|
|
741
|
-
className={cn(
|
|
742
|
-
"flex size-9 shrink-0 items-center justify-center rounded-full transition-colors",
|
|
743
|
-
"bg-primary text-primary-foreground hover:bg-primary/90",
|
|
744
|
-
"disabled:bg-muted disabled:text-muted-foreground"
|
|
745
|
-
)}
|
|
743
|
+
className={cn(SEND_BUTTON_CLASS_NAME, "ml-1")}
|
|
746
744
|
>
|
|
747
745
|
{stopping ? (
|
|
748
|
-
<Spinner className="size-
|
|
746
|
+
<Spinner className="size-3.5" />
|
|
749
747
|
) : (
|
|
750
|
-
<Square className="size-
|
|
748
|
+
<Square className="size-2.5 fill-current" />
|
|
751
749
|
)}
|
|
752
750
|
</button>
|
|
753
751
|
) : (
|
|
@@ -756,16 +754,12 @@ export function Composer({
|
|
|
756
754
|
onClick={submit}
|
|
757
755
|
disabled={!canSend}
|
|
758
756
|
aria-label={messages.send}
|
|
759
|
-
className={cn(
|
|
760
|
-
"flex size-9 shrink-0 items-center justify-center rounded-full transition-colors",
|
|
761
|
-
"bg-primary text-primary-foreground hover:bg-primary/90",
|
|
762
|
-
"disabled:bg-muted disabled:text-muted-foreground"
|
|
763
|
-
)}
|
|
757
|
+
className={cn(SEND_BUTTON_CLASS_NAME, "ml-1")}
|
|
764
758
|
>
|
|
765
759
|
{pending || uploading ? (
|
|
766
|
-
<Spinner className="size-
|
|
760
|
+
<Spinner className="size-3.5" />
|
|
767
761
|
) : (
|
|
768
|
-
<ArrowUp className="size-
|
|
762
|
+
<ArrowUp className="size-4" strokeWidth={2.25} />
|
|
769
763
|
)}
|
|
770
764
|
</button>
|
|
771
765
|
)}
|
|
@@ -777,9 +771,10 @@ export function Composer({
|
|
|
777
771
|
{statusHint ? (
|
|
778
772
|
<p
|
|
779
773
|
className={cn(
|
|
780
|
-
"mt-
|
|
774
|
+
"mt-2 truncate px-4 text-xs text-muted-foreground",
|
|
781
775
|
failedCount > 0 && "text-destructive"
|
|
782
776
|
)}
|
|
777
|
+
title={statusHint}
|
|
783
778
|
>
|
|
784
779
|
{statusHint}
|
|
785
780
|
</p>
|
|
@@ -40,7 +40,7 @@ function ContextChip({
|
|
|
40
40
|
const messages = useAgentMessages().context
|
|
41
41
|
const label = useAgentContextLabel(context)
|
|
42
42
|
return (
|
|
43
|
-
<span className="inline-flex max-w-[min(100%,20rem)] items-center gap-1.5 rounded-full
|
|
43
|
+
<span className="inline-flex max-w-[min(100%,20rem)] items-center gap-1.5 rounded-full bg-muted py-1 pr-1.5 pl-2 text-xs text-foreground">
|
|
44
44
|
{context.kind === "object" ? (
|
|
45
45
|
<Box className="size-3.5 shrink-0 text-muted-foreground" aria-hidden="true" />
|
|
46
46
|
) : (
|
|
@@ -5,8 +5,8 @@ import type { ReactNode } from "react"
|
|
|
5
5
|
import type { ConversationComposerProps } from "../hooks/use-agent-conversation"
|
|
6
6
|
import { useAgentMessages } from "../i18n"
|
|
7
7
|
import type { Agent, AgentContextInput, AgentThread } from "../types"
|
|
8
|
-
import { AgentThreadSwitcher, type SharedThreadList } from "./agent-thread-switcher"
|
|
9
8
|
import { Composer } from "./composer"
|
|
9
|
+
import { ThreadsButton } from "./threads-button"
|
|
10
10
|
import { Transcript, type TranscriptProps } from "./transcript"
|
|
11
11
|
|
|
12
12
|
export interface ConversationPanelProps {
|
|
@@ -20,21 +20,13 @@ export interface ConversationPanelProps {
|
|
|
20
20
|
readonly messagesError: string | null
|
|
21
21
|
/** The selected durable thread, or null while composing a new one. */
|
|
22
22
|
readonly currentThread: AgentThread | null
|
|
23
|
-
/** Other chats with this agent, for the header history menu. */
|
|
24
|
-
readonly agentThreads: readonly AgentThread[]
|
|
25
|
-
/** Chats other people shared with the reader. */
|
|
26
|
-
readonly sharedThreads?: SharedThreadList
|
|
27
23
|
/** Runs active across the threads visible to this agent surface. */
|
|
28
24
|
readonly runningThreadCount: number
|
|
29
25
|
/** The threads where a call waits for the reader's approval. */
|
|
30
26
|
readonly waitingThreadIds?: ReadonlySet<string>
|
|
31
|
-
readonly threadsError?: string | null
|
|
32
|
-
readonly hasMoreThreads?: boolean
|
|
33
|
-
readonly loadingMoreThreads?: boolean
|
|
34
|
-
readonly loadMoreThreadsError?: boolean
|
|
35
|
-
readonly onLoadMoreThreads?: () => void
|
|
36
27
|
readonly onNewChat: () => void
|
|
37
|
-
|
|
28
|
+
/** Open the page of every conversation; without it, the header offers no way there. */
|
|
29
|
+
readonly onOpenThreads?: () => void
|
|
38
30
|
readonly composerPlaceholder?: string
|
|
39
31
|
readonly ambientContext?: readonly AgentContextInput[]
|
|
40
32
|
readonly compact?: boolean
|
|
@@ -50,17 +42,10 @@ export function ConversationPanel({
|
|
|
50
42
|
messagesLoading,
|
|
51
43
|
messagesError,
|
|
52
44
|
currentThread,
|
|
53
|
-
agentThreads,
|
|
54
|
-
sharedThreads,
|
|
55
45
|
runningThreadCount,
|
|
56
46
|
waitingThreadIds,
|
|
57
|
-
threadsError,
|
|
58
|
-
hasMoreThreads,
|
|
59
|
-
loadingMoreThreads,
|
|
60
|
-
loadMoreThreadsError,
|
|
61
|
-
onLoadMoreThreads,
|
|
62
47
|
onNewChat,
|
|
63
|
-
|
|
48
|
+
onOpenThreads,
|
|
64
49
|
composerPlaceholder,
|
|
65
50
|
ambientContext = [],
|
|
66
51
|
compact = false,
|
|
@@ -70,7 +55,6 @@ export function ConversationPanel({
|
|
|
70
55
|
composerNotice,
|
|
71
56
|
}: ConversationPanelProps) {
|
|
72
57
|
const labels = useAgentMessages()
|
|
73
|
-
const name = agent?.name ?? "Agent"
|
|
74
58
|
// Optimistic activity (a just-sent message or a live run) takes over the pane immediately, so the
|
|
75
59
|
// brief durable-message load never flashes a centered "Loading…".
|
|
76
60
|
const hasActivity =
|
|
@@ -88,33 +72,24 @@ export function ConversationPanel({
|
|
|
88
72
|
/>
|
|
89
73
|
)
|
|
90
74
|
|
|
91
|
-
const
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
currentThread={currentThread}
|
|
95
|
-
threads={agentThreads}
|
|
96
|
-
sharedThreads={sharedThreads}
|
|
75
|
+
const threadsButton = onOpenThreads ? (
|
|
76
|
+
<ThreadsButton
|
|
77
|
+
currentThreadId={currentThread?.id ?? null}
|
|
97
78
|
runningThreadCount={runningThreadCount}
|
|
98
79
|
waitingThreadIds={waitingThreadIds}
|
|
99
|
-
|
|
100
|
-
hasMoreThreads={hasMoreThreads}
|
|
101
|
-
loadingMoreThreads={loadingMoreThreads}
|
|
102
|
-
loadMoreThreadsError={loadMoreThreadsError}
|
|
103
|
-
onLoadMoreThreads={onLoadMoreThreads}
|
|
104
|
-
onSelectThread={onSelectThread}
|
|
105
|
-
onNewThread={onNewChat}
|
|
80
|
+
onOpen={onOpenThreads}
|
|
106
81
|
/>
|
|
107
|
-
)
|
|
82
|
+
) : null
|
|
108
83
|
|
|
109
84
|
return (
|
|
110
|
-
<div className="relative flex h-full min-h-0 flex-col">
|
|
85
|
+
<div className="relative flex h-full min-h-0 flex-col" data-thread-id={currentThread?.id}>
|
|
111
86
|
<header
|
|
112
87
|
data-agent-conversation-header=""
|
|
113
88
|
className={cn("flex shrink-0 items-center gap-1 px-2.5 py-2.5", compact && "h-11 py-1.5")}
|
|
114
89
|
>
|
|
115
90
|
<div className="ml-auto flex items-center gap-1">
|
|
116
91
|
{headerActions}
|
|
117
|
-
{
|
|
92
|
+
{threadsButton}
|
|
118
93
|
<Button
|
|
119
94
|
variant="ghost"
|
|
120
95
|
size="icon-lg"
|
|
@@ -144,6 +119,11 @@ export function ConversationPanel({
|
|
|
144
119
|
) : (
|
|
145
120
|
<>
|
|
146
121
|
<div className="relative flex min-h-0 flex-1 flex-col">
|
|
122
|
+
{/* Scrolled content fades under the header instead of being cut at its edge. */}
|
|
123
|
+
<div
|
|
124
|
+
aria-hidden="true"
|
|
125
|
+
className="pointer-events-none absolute inset-x-0 top-0 z-10 h-6 bg-gradient-to-b from-background to-transparent"
|
|
126
|
+
/>
|
|
147
127
|
{messagesLoading && !hasActivity ? (
|
|
148
128
|
<div className="flex flex-1 items-center justify-center">
|
|
149
129
|
<LoadingInline label={labels.chat.loadingConversation} />
|
|
@@ -41,7 +41,7 @@ export function FileAttachmentCard({
|
|
|
41
41
|
state="done"
|
|
42
42
|
data-selected={selected ? "" : undefined}
|
|
43
43
|
className={cn(
|
|
44
|
-
"w-[20rem] max-w-[80vw] rounded-2xl border-
|
|
44
|
+
"w-[20rem] max-w-[80vw] rounded-2xl border-transparent bg-card shadow-[0_1px_2px_rgb(0_0_0/0.04)] ring-1 ring-black/[0.06] dark:shadow-none dark:ring-white/10",
|
|
45
45
|
selected &&
|
|
46
46
|
"border-foreground/25 bg-muted/70 shadow-none ring-1 ring-foreground/10 ring-inset",
|
|
47
47
|
className
|
|
@@ -121,7 +121,10 @@ function fileIconPresentation(mediaType: string | undefined, fileName: string) {
|
|
|
121
121
|
normalized?.includes("csv") ||
|
|
122
122
|
/\.(csv|tsv|xls|xlsx)$/i.test(lowerName)
|
|
123
123
|
) {
|
|
124
|
-
return {
|
|
124
|
+
return {
|
|
125
|
+
Icon: Table2,
|
|
126
|
+
className: "bg-emerald-500/[0.08] text-emerald-600 dark:text-emerald-300",
|
|
127
|
+
}
|
|
125
128
|
}
|
|
126
129
|
if (normalized?.startsWith("image/") || /\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(lowerName)) {
|
|
127
130
|
return { Icon: FileImage, className: "bg-sky-500/[0.08] text-sky-600 dark:text-sky-300" }
|
|
@@ -23,6 +23,9 @@ import { ApprovalCards } from "./approval-card"
|
|
|
23
23
|
import { FileAttachmentCard } from "./file-attachment-card"
|
|
24
24
|
import { WebSources } from "./web-sources"
|
|
25
25
|
|
|
26
|
+
/** Calls a sub-agent's row stands for, in the conversation and in its thread. */
|
|
27
|
+
const DELEGATION_ROW_TOOLS: ReadonlySet<string> = new Set(["spawn_agent", "wait_agent"])
|
|
28
|
+
|
|
26
29
|
/**
|
|
27
30
|
* Render an assistant body from normalized parts. Narration text stays on the main reading path;
|
|
28
31
|
* every run of consecutive reasoning + tool parts collapses into a single "work" disclosure, so a
|
|
@@ -64,11 +67,24 @@ export function AssistantBody({
|
|
|
64
67
|
if (workBuffer.length === 0) return
|
|
65
68
|
const work = workBuffer
|
|
66
69
|
workBuffer = []
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
// Starting and awaiting sub-agents is what their line shows, and a call held for approval is
|
|
71
|
+
// what its card shows: the work line leaves them out — but not a wait that brought back a
|
|
72
|
+
// question, which the work keeps on record — and a run of nothing else, or of only step
|
|
73
|
+
// boundaries, has no line at all.
|
|
74
|
+
const shown = work.filter(
|
|
75
|
+
(part) =>
|
|
76
|
+
!(
|
|
77
|
+
part.kind === "tool" &&
|
|
78
|
+
((DELEGATION_ROW_TOOLS.has(part.tool.toolName) &&
|
|
79
|
+
childQuestions(part.tool).length === 0) ||
|
|
80
|
+
(!nested && heldCallsInParts([part]).length > 0))
|
|
81
|
+
)
|
|
71
82
|
)
|
|
83
|
+
if (shown.some((part) => part.kind !== "step-start")) {
|
|
84
|
+
blocks.push(
|
|
85
|
+
<WorkGroup key={`block-${key++}`} parts={shown} inProgress={inProgress} nested={nested} />
|
|
86
|
+
)
|
|
87
|
+
}
|
|
72
88
|
if (nested) return
|
|
73
89
|
|
|
74
90
|
const held = heldCallsInParts(work)
|
|
@@ -173,11 +189,11 @@ function WorkGroup({
|
|
|
173
189
|
}: {
|
|
174
190
|
parts: readonly NormalizedPart[]
|
|
175
191
|
inProgress: boolean
|
|
176
|
-
/**
|
|
192
|
+
/** In a sub-agent's thread: closed like the chat's own work line, and without a scroll once open. */
|
|
177
193
|
nested?: boolean
|
|
178
194
|
}) {
|
|
179
195
|
const messages = useAgentMessages()
|
|
180
|
-
const [open, setOpen] = useState(
|
|
196
|
+
const [open, setOpen] = useState(false)
|
|
181
197
|
const sources = collectWebSources(parts)
|
|
182
198
|
const searches = parts.flatMap((part) =>
|
|
183
199
|
part.kind === "tool" && part.tool.toolName === "web_search" ? [part.tool] : []
|
|
@@ -198,8 +214,9 @@ function WorkGroup({
|
|
|
198
214
|
const toolCount = parts.reduce((count, part) => count + (part.kind === "tool" ? 1 : 0), 0)
|
|
199
215
|
const hasTools = toolCount > 0
|
|
200
216
|
const liveLabel = latestWorkLabel(parts, messages)
|
|
201
|
-
|
|
202
|
-
|
|
217
|
+
// Named by what it holds, not in a tense: the same line is read while the turn still works,
|
|
218
|
+
// while it waits on the reader, and once it is done.
|
|
219
|
+
const label = hasTools ? messages.activity.steps(toolCount) : messages.activity.reasoning
|
|
203
220
|
|
|
204
221
|
return (
|
|
205
222
|
<Collapsible open={open} onOpenChange={setOpen} className="max-w-full">
|
|
@@ -214,13 +231,12 @@ function WorkGroup({
|
|
|
214
231
|
) : (
|
|
215
232
|
<span>{label}</span>
|
|
216
233
|
)}
|
|
217
|
-
|
|
218
|
-
<ChevronRight className="size-4 shrink-0 opacity-0 transition-all group-hover:opacity-100 group-focus-visible:opacity-100 group-data-[state=open]:rotate-90 group-data-[state=open]:opacity-100" />
|
|
234
|
+
<ChevronRight className="size-3.5 shrink-0 opacity-50 transition-all group-hover:opacity-100 group-focus-visible:opacity-100 group-data-[state=open]:rotate-90 group-data-[state=open]:opacity-100" />
|
|
219
235
|
</CollapsibleTrigger>
|
|
220
236
|
<CollapsibleContent>
|
|
221
237
|
<div
|
|
222
238
|
className={cn(
|
|
223
|
-
"mt-2 ml-1
|
|
239
|
+
"mt-2 ml-1 flex flex-col gap-3 border-l border-border py-0.5 pr-2 pl-3.5",
|
|
224
240
|
!nested && "scrollbar-thin max-h-[min(24rem,50vh)] overflow-y-auto overscroll-contain"
|
|
225
241
|
)}
|
|
226
242
|
>
|