@sixb/app 0.1.14 → 0.1.16
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/agent/agent-chat.d.ts +8 -1
- package/dist/agent/agent-chat.d.ts.map +1 -1
- package/dist/agent/agent-panel.d.ts +8 -1
- package/dist/agent/agent-panel.d.ts.map +1 -1
- package/dist/agent/agent-surface.d.ts +8 -1
- package/dist/agent/agent-surface.d.ts.map +1 -1
- package/dist/agent/approvals.d.ts +1 -4
- package/dist/agent/approvals.d.ts.map +1 -1
- package/dist/agent/artifact-panel.d.ts +21 -2
- package/dist/agent/artifact-panel.d.ts.map +1 -1
- package/dist/agent/components/activity-status.d.ts +1 -1
- package/dist/agent/components/activity-status.d.ts.map +1 -1
- package/dist/agent/components/agent-threads.d.ts +15 -0
- package/dist/agent/components/agent-threads.d.ts.map +1 -0
- package/dist/agent/components/approval-card.d.ts +4 -4
- package/dist/agent/components/approval-card.d.ts.map +1 -1
- package/dist/agent/components/approval-mode-chip.d.ts +4 -6
- package/dist/agent/components/approval-mode-chip.d.ts.map +1 -1
- package/dist/agent/components/auto-model-chip.d.ts +2 -3
- package/dist/agent/components/auto-model-chip.d.ts.map +1 -1
- package/dist/agent/components/composer-menu.d.ts +42 -0
- package/dist/agent/components/composer-menu.d.ts.map +1 -0
- package/dist/agent/components/composer.d.ts +8 -5
- package/dist/agent/components/composer.d.ts.map +1 -1
- package/dist/agent/components/conversation-panel.d.ts +3 -12
- package/dist/agent/components/conversation-panel.d.ts.map +1 -1
- package/dist/agent/components/dictation-bar.d.ts +13 -0
- package/dist/agent/components/dictation-bar.d.ts.map +1 -0
- package/dist/agent/components/message-parts.d.ts.map +1 -1
- package/dist/agent/components/message-view.d.ts +3 -1
- package/dist/agent/components/message-view.d.ts.map +1 -1
- package/dist/agent/components/model-controls.d.ts +15 -0
- package/dist/agent/components/model-controls.d.ts.map +1 -1
- package/dist/agent/components/model-picker-row.d.ts +9 -2
- package/dist/agent/components/model-picker-row.d.ts.map +1 -1
- package/dist/agent/components/participant-input.d.ts +7 -6
- package/dist/agent/components/participant-input.d.ts.map +1 -1
- package/dist/agent/components/thread-people.d.ts +4 -4
- package/dist/agent/components/thread-people.d.ts.map +1 -1
- package/dist/agent/components/threads-button.d.ts +14 -0
- package/dist/agent/components/threads-button.d.ts.map +1 -0
- package/dist/agent/conversation.d.ts +3 -1
- package/dist/agent/conversation.d.ts.map +1 -1
- package/dist/agent/delegation/child-card.d.ts +24 -11
- package/dist/agent/delegation/child-card.d.ts.map +1 -1
- package/dist/agent/delegation/child-cards.d.ts +2 -2
- package/dist/agent/delegation/child-cards.d.ts.map +1 -1
- package/dist/agent/delegation/child-group.d.ts +5 -4
- package/dist/agent/delegation/child-group.d.ts.map +1 -1
- package/dist/agent/delegation/child-parts.d.ts +17 -18
- package/dist/agent/delegation/child-parts.d.ts.map +1 -1
- package/dist/agent/delegation/child-work.d.ts +0 -13
- package/dist/agent/delegation/child-work.d.ts.map +1 -1
- package/dist/agent/delegation/interpret.d.ts +0 -5
- package/dist/agent/delegation/interpret.d.ts.map +1 -1
- package/dist/agent/delegation/model.d.ts +12 -6
- package/dist/agent/delegation/model.d.ts.map +1 -1
- package/dist/agent/dictation.d.ts +16 -0
- package/dist/agent/dictation.d.ts.map +1 -0
- package/dist/agent/hooks/use-agent-conversation.d.ts +3 -270
- package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
- package/dist/agent/hooks/use-people-suggestions.d.ts +21 -0
- package/dist/agent/hooks/use-people-suggestions.d.ts.map +1 -0
- package/dist/agent/hooks/use-thread-lists.d.ts +220 -0
- package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -0
- package/dist/agent/i18n/en.d.ts +47 -36
- package/dist/agent/i18n/en.d.ts.map +1 -1
- package/dist/agent/i18n/fr.d.ts.map +1 -1
- package/dist/agent/i18n/index.d.ts +84 -72
- package/dist/agent/i18n/index.d.ts.map +1 -1
- package/dist/agent/react-router.d.ts +9 -0
- package/dist/agent/react-router.d.ts.map +1 -1
- package/dist/agent/run-presentation.d.ts +4 -1
- package/dist/agent/run-presentation.d.ts.map +1 -1
- package/dist/agent/thread-navigation.d.ts +8 -0
- package/dist/agent/thread-navigation.d.ts.map +1 -1
- package/dist/agent/thread-pages.d.ts +11 -0
- package/dist/agent/thread-pages.d.ts.map +1 -0
- package/dist/artifacts/person-avatar.d.ts +2 -2
- package/dist/{chunk-aes17xmx.js → chunk-12v6y89k.js} +4180 -3793
- package/dist/{chunk-aes17xmx.js.map → chunk-12v6y89k.js.map} +48 -42
- package/dist/{chunk-0yb22w6m.js → chunk-2a69ge8h.js} +1 -1
- package/dist/{chunk-vtp6nk44.js → chunk-bpj9mg5c.js} +1 -1
- package/dist/{chunk-1rhht9y0.js → chunk-hzy2g13h.js} +1 -1
- package/dist/createCustomApp.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -6
- package/dist/index.js.map +6 -6
- package/dist/pages/home.d.ts.map +1 -1
- package/dist/pages/observability/ai-usage/calls.d.ts.map +1 -1
- package/dist/pages/settings/memory-history.d.ts.map +1 -1
- package/dist/pages/settings/messages.d.ts.map +1 -1
- package/dist/pages/values.d.ts +5 -0
- package/dist/pages/values.d.ts.map +1 -1
- package/dist/pages.d.ts +1 -1
- package/dist/pages.d.ts.map +1 -1
- 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/dist/shell/agent-dock.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/agent/agent-chat.tsx +15 -23
- package/src/agent/agent-panel.tsx +11 -0
- package/src/agent/agent-surface.tsx +11 -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 +168 -103
- package/src/agent/components/context-chips.tsx +1 -1
- package/src/agent/components/conversation-panel.tsx +16 -36
- package/src/agent/components/dictation-bar.tsx +110 -0
- 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/dictation.ts +48 -0
- package/src/agent/hooks/use-agent-conversation.ts +10 -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 +100 -83
- package/src/agent/i18n/fr.ts +109 -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/dist/agent/agents-page.d.ts +0 -4
- package/dist/agent/agents-page.d.ts.map +0 -1
- package/dist/agent/components/agent-thread-switcher.d.ts +0 -37
- package/dist/agent/components/agent-thread-switcher.d.ts.map +0 -1
- package/src/agent/agents-page.ts +0 -7
- package/src/agent/components/agent-thread-switcher.tsx +0 -519
- /package/dist/{chunk-0yb22w6m.js.map → chunk-2a69ge8h.js.map} +0 -0
- /package/dist/{chunk-vtp6nk44.js.map → chunk-bpj9mg5c.js.map} +0 -0
- /package/dist/{chunk-1rhht9y0.js.map → chunk-hzy2g13h.js.map} +0 -0
|
@@ -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} />
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { DictationWaveform, Spinner } from "@sixb/ui/components"
|
|
2
|
+
import type { SpeechRecognitionState } from "@sixb/ui/hooks"
|
|
3
|
+
import { cn } from "@sixb/ui/lib/utils"
|
|
4
|
+
import { Check, X } from "lucide-react"
|
|
5
|
+
import { type KeyboardEvent, useEffect, useState } from "react"
|
|
6
|
+
import { useAgentMessages } from "../i18n"
|
|
7
|
+
|
|
8
|
+
export interface DictationBarProps {
|
|
9
|
+
/** A dictation under way: starting, listening, or transcribing. */
|
|
10
|
+
readonly dictation: SpeechRecognitionState
|
|
11
|
+
/** The filled control's look, so Done sits where Send was. */
|
|
12
|
+
readonly doneClassName: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The composer's toolbar while a message is dictated: cancel, the voice as a waveform, how long it
|
|
17
|
+
* has run, and Done. Done takes the focus, so Enter or Space finishes and Escape cancels.
|
|
18
|
+
*/
|
|
19
|
+
export function DictationBar({ dictation, doneClassName }: DictationBarProps) {
|
|
20
|
+
const messages = useAgentMessages().composer
|
|
21
|
+
const transcribing = dictation.status === "stopping"
|
|
22
|
+
const seconds = useRecordingSeconds(dictation.status === "listening")
|
|
23
|
+
|
|
24
|
+
const cancelOnEscape = (event: KeyboardEvent) => {
|
|
25
|
+
if (event.key !== "Escape") return
|
|
26
|
+
event.preventDefault()
|
|
27
|
+
dictation.abort()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
// Escape is a shortcut: both buttons stay reachable with the keyboard.
|
|
32
|
+
<div className="flex min-w-0 flex-1 items-center gap-2" onKeyDown={cancelOnEscape}>
|
|
33
|
+
<button
|
|
34
|
+
type="button"
|
|
35
|
+
onClick={dictation.abort}
|
|
36
|
+
aria-label={messages.cancelDictation}
|
|
37
|
+
title={messages.cancelDictation}
|
|
38
|
+
className={cn(
|
|
39
|
+
"flex size-8 shrink-0 items-center justify-center rounded-full text-muted-foreground outline-none transition-colors",
|
|
40
|
+
"hover:bg-muted hover:text-foreground focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring/40"
|
|
41
|
+
)}
|
|
42
|
+
>
|
|
43
|
+
<X className="size-[18px]" strokeWidth={1.75} />
|
|
44
|
+
</button>
|
|
45
|
+
|
|
46
|
+
<DictationWaveform
|
|
47
|
+
dictation={dictation}
|
|
48
|
+
className={cn(
|
|
49
|
+
"min-w-0 flex-1 text-foreground/60 transition-opacity duration-300",
|
|
50
|
+
transcribing && "opacity-30"
|
|
51
|
+
)}
|
|
52
|
+
/>
|
|
53
|
+
|
|
54
|
+
<span
|
|
55
|
+
className="w-10 shrink-0 text-right text-xs text-muted-foreground tabular-nums"
|
|
56
|
+
aria-hidden="true"
|
|
57
|
+
>
|
|
58
|
+
{formatSeconds(seconds)}
|
|
59
|
+
</span>
|
|
60
|
+
<span className="sr-only" role="status">
|
|
61
|
+
{transcribing ? messages.dictationTranscribing : messages.dictationListening}
|
|
62
|
+
</span>
|
|
63
|
+
|
|
64
|
+
<button
|
|
65
|
+
type="button"
|
|
66
|
+
// The reader just pressed the microphone: Done is what comes next. It stays focusable while
|
|
67
|
+
// transcribing, so the focus, and Escape with it, stay in the bar.
|
|
68
|
+
autoFocus
|
|
69
|
+
onClick={transcribing ? undefined : dictation.stop}
|
|
70
|
+
aria-disabled={transcribing}
|
|
71
|
+
aria-label={messages.finishDictation}
|
|
72
|
+
title={messages.finishDictation}
|
|
73
|
+
className={cn(
|
|
74
|
+
doneClassName,
|
|
75
|
+
"ml-1 aria-disabled:bg-foreground/25 dark:aria-disabled:bg-white/20"
|
|
76
|
+
)}
|
|
77
|
+
>
|
|
78
|
+
{transcribing ? (
|
|
79
|
+
<Spinner className="size-3.5" />
|
|
80
|
+
) : (
|
|
81
|
+
<Check className="size-4" strokeWidth={2.25} />
|
|
82
|
+
)}
|
|
83
|
+
</button>
|
|
84
|
+
</div>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Whole seconds since recording started, held while it is transcribed. */
|
|
89
|
+
function useRecordingSeconds(recording: boolean): number {
|
|
90
|
+
const [seconds, setSeconds] = useState(0)
|
|
91
|
+
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
if (!recording) return
|
|
94
|
+
|
|
95
|
+
const startedAt = Date.now()
|
|
96
|
+
setSeconds(0)
|
|
97
|
+
const timer = setInterval(() => {
|
|
98
|
+
setSeconds(Math.floor((Date.now() - startedAt) / 1000))
|
|
99
|
+
}, 250)
|
|
100
|
+
return () => clearInterval(timer)
|
|
101
|
+
}, [recording])
|
|
102
|
+
|
|
103
|
+
return seconds
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function formatSeconds(total: number): string {
|
|
107
|
+
const minutes = Math.floor(total / 60)
|
|
108
|
+
const seconds = total % 60
|
|
109
|
+
return `${minutes}:${String(seconds).padStart(2, "0")}`
|
|
110
|
+
}
|
|
@@ -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
|
>
|
|
@@ -9,10 +9,18 @@ import {
|
|
|
9
9
|
MarkerContent,
|
|
10
10
|
MarkerIcon,
|
|
11
11
|
} from "@sixb/ui/components"
|
|
12
|
-
import {
|
|
12
|
+
import { cn } from "@sixb/ui/lib/utils"
|
|
13
|
+
import {
|
|
14
|
+
AlertTriangle,
|
|
15
|
+
ArrowRight,
|
|
16
|
+
ChevronRight,
|
|
17
|
+
Clock3,
|
|
18
|
+
type LucideIcon,
|
|
19
|
+
RotateCcw,
|
|
20
|
+
Unplug,
|
|
21
|
+
} from "lucide-react"
|
|
13
22
|
import { memo, type ReactNode } from "react"
|
|
14
23
|
import type { FileSource } from "../../artifacts/file-source"
|
|
15
|
-
import { PersonAvatar } from "../../artifacts/person-avatar"
|
|
16
24
|
import type { AgentConversationMessage } from "../conversation"
|
|
17
25
|
import { useAgentMessages } from "../i18n"
|
|
18
26
|
import type { AgentMessages } from "../i18n/en"
|
|
@@ -83,7 +91,9 @@ function UserMessage({
|
|
|
83
91
|
) : null}
|
|
84
92
|
{text ? (
|
|
85
93
|
<Bubble variant="secondary" align="end">
|
|
86
|
-
<BubbleContent className="whitespace-pre-wrap">
|
|
94
|
+
<BubbleContent className="rounded-2xl px-3.5 py-2 text-[15px] whitespace-pre-wrap">
|
|
95
|
+
{text}
|
|
96
|
+
</BubbleContent>
|
|
87
97
|
</Bubble>
|
|
88
98
|
) : null}
|
|
89
99
|
</div>
|
|
@@ -150,12 +160,7 @@ function AssistantMessage({
|
|
|
150
160
|
export function AuthorLine({ author }: { readonly author: AuthorLabel | undefined }) {
|
|
151
161
|
if (!author) return null
|
|
152
162
|
|
|
153
|
-
return
|
|
154
|
-
<p className="mt-2 flex items-center gap-1.5 px-1 text-xs text-muted-foreground">
|
|
155
|
-
<PersonAvatar name={author.name} size="xs" />
|
|
156
|
-
<span>{author.label}</span>
|
|
157
|
-
</p>
|
|
158
|
-
)
|
|
163
|
+
return <p className="mt-2 px-1 text-xs text-muted-foreground">{author.label}</p>
|
|
159
164
|
}
|
|
160
165
|
|
|
161
166
|
function CompactionResult({ summary }: { summary: string }) {
|
|
@@ -198,9 +203,106 @@ export function ThinkingMarker({ takingLonger = false }: { takingLonger?: boolea
|
|
|
198
203
|
)
|
|
199
204
|
}
|
|
200
205
|
|
|
206
|
+
/**
|
|
207
|
+
* How a turn ended short of a full answer: one quiet line, its icon tinted by what happened, and at
|
|
208
|
+
* most one way on. Every ending reads the same way, so only the words and the icon change.
|
|
209
|
+
*/
|
|
210
|
+
function TurnNotice({
|
|
211
|
+
icon: Icon,
|
|
212
|
+
tone = "warning",
|
|
213
|
+
children,
|
|
214
|
+
action,
|
|
215
|
+
}: {
|
|
216
|
+
icon?: LucideIcon
|
|
217
|
+
tone?: "warning" | "error"
|
|
218
|
+
children: ReactNode
|
|
219
|
+
action?: ReactNode
|
|
220
|
+
}) {
|
|
221
|
+
return (
|
|
222
|
+
<div className="flex flex-wrap items-center gap-x-3 gap-y-2" role="status">
|
|
223
|
+
<p className="flex min-w-0 items-center gap-2 text-sm text-muted-foreground">
|
|
224
|
+
{Icon ? (
|
|
225
|
+
<Icon
|
|
226
|
+
aria-hidden="true"
|
|
227
|
+
className={cn(
|
|
228
|
+
"size-4 shrink-0",
|
|
229
|
+
tone === "error" ? "text-destructive" : "text-amber-600 dark:text-amber-400"
|
|
230
|
+
)}
|
|
231
|
+
/>
|
|
232
|
+
) : null}
|
|
233
|
+
<span>{children}</span>
|
|
234
|
+
</p>
|
|
235
|
+
{action}
|
|
236
|
+
</div>
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function TurnAction({
|
|
241
|
+
icon: Icon,
|
|
242
|
+
label,
|
|
243
|
+
onClick,
|
|
244
|
+
disabled,
|
|
245
|
+
}: {
|
|
246
|
+
icon: LucideIcon
|
|
247
|
+
label: string
|
|
248
|
+
onClick: () => void
|
|
249
|
+
disabled: boolean
|
|
250
|
+
}) {
|
|
251
|
+
return (
|
|
252
|
+
<Button
|
|
253
|
+
variant="secondary"
|
|
254
|
+
size="sm"
|
|
255
|
+
onClick={onClick}
|
|
256
|
+
disabled={disabled}
|
|
257
|
+
className="h-8 rounded-full px-3"
|
|
258
|
+
>
|
|
259
|
+
<Icon aria-hidden="true" />
|
|
260
|
+
{label}
|
|
261
|
+
</Button>
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** A turn cut short goes on from what it saved, or runs again when it saved nothing. */
|
|
266
|
+
function PickUpAction({
|
|
267
|
+
hasProgress,
|
|
268
|
+
onRetry,
|
|
269
|
+
onContinue,
|
|
270
|
+
retrying,
|
|
271
|
+
continuing,
|
|
272
|
+
}: {
|
|
273
|
+
hasProgress: boolean
|
|
274
|
+
onRetry?: () => void
|
|
275
|
+
onContinue?: () => void
|
|
276
|
+
retrying: boolean
|
|
277
|
+
continuing: boolean
|
|
278
|
+
}) {
|
|
279
|
+
const messages = useAgentMessages().transcript
|
|
280
|
+
if (hasProgress && onContinue) {
|
|
281
|
+
return (
|
|
282
|
+
<TurnAction
|
|
283
|
+
icon={ArrowRight}
|
|
284
|
+
label={continuing ? messages.continuing : messages.continue}
|
|
285
|
+
onClick={onContinue}
|
|
286
|
+
disabled={continuing}
|
|
287
|
+
/>
|
|
288
|
+
)
|
|
289
|
+
}
|
|
290
|
+
if (!hasProgress && onRetry) {
|
|
291
|
+
return (
|
|
292
|
+
<TurnAction
|
|
293
|
+
icon={RotateCcw}
|
|
294
|
+
label={retrying ? messages.retrying : messages.tryAgain}
|
|
295
|
+
onClick={onRetry}
|
|
296
|
+
disabled={retrying}
|
|
297
|
+
/>
|
|
298
|
+
)
|
|
299
|
+
}
|
|
300
|
+
return null
|
|
301
|
+
}
|
|
302
|
+
|
|
201
303
|
export function RunCancelledMarker() {
|
|
202
304
|
const messages = useAgentMessages().transcript
|
|
203
|
-
return <
|
|
305
|
+
return <TurnNotice>{messages.stopped}</TurnNotice>
|
|
204
306
|
}
|
|
205
307
|
|
|
206
308
|
export function RunTimeoutMarker({
|
|
@@ -221,28 +323,20 @@ export function RunTimeoutMarker({
|
|
|
221
323
|
const messages = useAgentMessages().transcript
|
|
222
324
|
const limit = formatTurnTimeout(timeoutMs, messages)
|
|
223
325
|
return (
|
|
224
|
-
<
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
{
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
) : null}
|
|
239
|
-
{!hasProgress && onRetry ? (
|
|
240
|
-
<Button variant="outline" size="sm" onClick={onRetry} disabled={retrying}>
|
|
241
|
-
<RotateCcw aria-hidden="true" />
|
|
242
|
-
{retrying ? messages.retrying : messages.tryAgain}
|
|
243
|
-
</Button>
|
|
244
|
-
) : null}
|
|
245
|
-
</div>
|
|
326
|
+
<TurnNotice
|
|
327
|
+
icon={Clock3}
|
|
328
|
+
action={
|
|
329
|
+
<PickUpAction
|
|
330
|
+
hasProgress={hasProgress}
|
|
331
|
+
onRetry={onRetry}
|
|
332
|
+
onContinue={onContinue}
|
|
333
|
+
retrying={retrying}
|
|
334
|
+
continuing={continuing}
|
|
335
|
+
/>
|
|
336
|
+
}
|
|
337
|
+
>
|
|
338
|
+
{hasProgress ? messages.stoppedAtLimit(limit) : messages.limitBeforeAnswer(limit)}
|
|
339
|
+
</TurnNotice>
|
|
246
340
|
)
|
|
247
341
|
}
|
|
248
342
|
|
|
@@ -262,26 +356,20 @@ export function RunInterruptedMarker({
|
|
|
262
356
|
}) {
|
|
263
357
|
const messages = useAgentMessages().transcript
|
|
264
358
|
return (
|
|
265
|
-
<
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
<Button variant="outline" size="sm" onClick={onRetry} disabled={retrying}>
|
|
280
|
-
<RotateCcw aria-hidden="true" />
|
|
281
|
-
{retrying ? messages.retrying : messages.tryAgain}
|
|
282
|
-
</Button>
|
|
283
|
-
) : null}
|
|
284
|
-
</div>
|
|
359
|
+
<TurnNotice
|
|
360
|
+
icon={Unplug}
|
|
361
|
+
action={
|
|
362
|
+
<PickUpAction
|
|
363
|
+
hasProgress={hasProgress}
|
|
364
|
+
onRetry={onRetry}
|
|
365
|
+
onContinue={onContinue}
|
|
366
|
+
retrying={retrying}
|
|
367
|
+
continuing={continuing}
|
|
368
|
+
/>
|
|
369
|
+
}
|
|
370
|
+
>
|
|
371
|
+
{messages.interrupted}
|
|
372
|
+
</TurnNotice>
|
|
285
373
|
)
|
|
286
374
|
}
|
|
287
375
|
|
|
@@ -294,15 +382,22 @@ export function RunFailureMarker({
|
|
|
294
382
|
}) {
|
|
295
383
|
const messages = useAgentMessages().transcript
|
|
296
384
|
return (
|
|
297
|
-
<
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
385
|
+
<TurnNotice
|
|
386
|
+
icon={AlertTriangle}
|
|
387
|
+
tone="error"
|
|
388
|
+
action={
|
|
389
|
+
onRetry ? (
|
|
390
|
+
<TurnAction
|
|
391
|
+
icon={RotateCcw}
|
|
392
|
+
label={retrying ? messages.retrying : messages.retry}
|
|
393
|
+
onClick={onRetry}
|
|
394
|
+
disabled={retrying}
|
|
395
|
+
/>
|
|
396
|
+
) : null
|
|
397
|
+
}
|
|
398
|
+
>
|
|
399
|
+
{messages.notStarted}
|
|
400
|
+
</TurnNotice>
|
|
306
401
|
)
|
|
307
402
|
}
|
|
308
403
|
|
|
@@ -326,14 +421,33 @@ export function UserFileAttachment({
|
|
|
326
421
|
return <FileAttachmentCard fileRef={fileRef} source={source} />
|
|
327
422
|
}
|
|
328
423
|
|
|
329
|
-
export function RunErrorMarker({
|
|
424
|
+
export function RunErrorMarker({
|
|
425
|
+
message,
|
|
426
|
+
onContinue,
|
|
427
|
+
continuing = false,
|
|
428
|
+
}: {
|
|
429
|
+
message: string
|
|
430
|
+
onContinue?: () => void
|
|
431
|
+
continuing?: boolean
|
|
432
|
+
}) {
|
|
433
|
+
const messages = useAgentMessages().transcript
|
|
330
434
|
return (
|
|
331
|
-
<
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
435
|
+
<TurnNotice
|
|
436
|
+
icon={AlertTriangle}
|
|
437
|
+
tone="error"
|
|
438
|
+
action={
|
|
439
|
+
onContinue ? (
|
|
440
|
+
<TurnAction
|
|
441
|
+
icon={ArrowRight}
|
|
442
|
+
label={continuing ? messages.continuing : messages.continue}
|
|
443
|
+
onClick={onContinue}
|
|
444
|
+
disabled={continuing}
|
|
445
|
+
/>
|
|
446
|
+
) : null
|
|
447
|
+
}
|
|
448
|
+
>
|
|
449
|
+
{message}
|
|
450
|
+
</TurnNotice>
|
|
337
451
|
)
|
|
338
452
|
}
|
|
339
453
|
|