moi-computer 0.10.1-next.1 → 0.10.1-next.2
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/client/components/shared/AgentBlobatar.tsx +93 -0
- package/client/features/chat/ChatEmptyState.tsx +110 -80
- package/client/features/chat/ChatPanel.tsx +19 -11
- package/client/features/chat/ChatPopup.tsx +23 -11
- package/client/features/chat/ChatPromptBubbles.tsx +1 -1
- package/client/features/chat/TurnView.tsx +0 -17
- package/client/features/chat/useStickToBottom.ts +1 -1
- package/client/features/dev/ChatStatesPage.tsx +17 -9
- package/client/features/workspace/CustomizePanel.tsx +33 -4
- package/client/features/workspace/WorkspaceScreen.tsx +11 -5
- package/client/features/workspace/WorkspaceTabs.tsx +5 -8
- package/client/index.css +22 -12
- package/client/index.tsx +1 -0
- package/client/theme.css +9 -0
- package/dist/{chunk-efdyz6xp.js → chunk-0pcdwjkp.js} +1 -1
- package/dist/chunk-4xmcsjjv.js +1 -0
- package/dist/{chunk-5t06zksf.js → chunk-8jh75pjg.js} +2 -2
- package/dist/{chunk-97eg9mjn.js → chunk-9y2zbzqz.js} +1 -1
- package/dist/chunk-dfs36zgc.js +1 -0
- package/dist/chunk-e4e993yf.js +83 -0
- package/dist/chunk-ek8w9tsp.css +1 -0
- package/dist/chunk-vq8ga42s.js +1 -0
- package/dist/{chunk-ht1f95h9.js → chunk-yhj9bg1s.js} +2 -2
- package/dist/{chunk-0set7tmf.js → chunk-yt2qjn3m.js} +2 -2
- package/dist/chunk-yz743a75.js +10 -0
- package/dist/index.html +1 -1
- package/lib/themes.ts +21 -3
- package/lib/types.ts +1 -1
- package/package.json +4 -2
- package/server/bundler/build-applet.ts +30 -0
- package/server/cli-ui-components.ts +258 -0
- package/server/cli.ts +48 -5
- package/server/control.ts +5 -3
- package/server/moi-scaffold.ts +9 -1
- package/server/skills-template.ts +5 -0
- package/server/theme.ts +17 -5
- package/server/ui-components.ts +545 -0
- package/workspace/.claude/skills/moi-workspace/SKILL.md +27 -6
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +10 -2
- package/workspace/.claude/skills/moi-workspace/references/UI-COMPONENTS.md +211 -0
- package/client/components/shared/IconGhost.tsx +0 -127
- package/dist/chunk-10knptd0.css +0 -1
- package/dist/chunk-b4qp3p42.js +0 -83
- package/dist/chunk-dfe7qnrp.js +0 -1
- package/dist/chunk-h2kj1ysj.js +0 -1
- package/dist/chunk-nek4ec05.js +0 -1
- package/dist/chunk-qtc5a8qa.js +0 -10
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Blobatar } from '@blobatar/react'
|
|
2
|
+
import type { Expression, Palette } from 'blobatar'
|
|
3
|
+
import {
|
|
4
|
+
happy,
|
|
5
|
+
idle,
|
|
6
|
+
sad,
|
|
7
|
+
shy,
|
|
8
|
+
sleepy,
|
|
9
|
+
smug,
|
|
10
|
+
surprised,
|
|
11
|
+
thinking,
|
|
12
|
+
unsure,
|
|
13
|
+
wink
|
|
14
|
+
} from 'blobatar/expression'
|
|
15
|
+
|
|
16
|
+
import { cn } from '@/client/lib/cn'
|
|
17
|
+
import { AGENT_THEMES, DEFAULT_WORKSPACE_THEME } from '@/lib/themes'
|
|
18
|
+
import type { AgentTheme } from '@/lib/types'
|
|
19
|
+
|
|
20
|
+
const AGENT_BLOBATAR_SEED = 'moi-agent'
|
|
21
|
+
|
|
22
|
+
type AgentBlobatarColor = 'primary' | 'secondary' | 'default'
|
|
23
|
+
export type AgentBlobatarExpression =
|
|
24
|
+
| 'idle'
|
|
25
|
+
| 'happy'
|
|
26
|
+
| 'sad'
|
|
27
|
+
| 'surprised'
|
|
28
|
+
| 'wink'
|
|
29
|
+
| 'sleepy'
|
|
30
|
+
| 'smug'
|
|
31
|
+
| 'unsure'
|
|
32
|
+
| 'shy'
|
|
33
|
+
| 'thinking'
|
|
34
|
+
|
|
35
|
+
const AGENT_PALETTES = {
|
|
36
|
+
default: {
|
|
37
|
+
head: 'var(--foreground)',
|
|
38
|
+
eye: 'var(--background)'
|
|
39
|
+
},
|
|
40
|
+
primary: {
|
|
41
|
+
head: 'var(--primary)',
|
|
42
|
+
eye: 'var(--primary-foreground)'
|
|
43
|
+
},
|
|
44
|
+
secondary: {
|
|
45
|
+
head: 'var(--accent)',
|
|
46
|
+
eye: 'var(--accent-foreground)'
|
|
47
|
+
}
|
|
48
|
+
} satisfies Record<AgentBlobatarColor, Palette>
|
|
49
|
+
|
|
50
|
+
const AGENT_EXPRESSIONS = {
|
|
51
|
+
idle,
|
|
52
|
+
happy,
|
|
53
|
+
sad,
|
|
54
|
+
surprised,
|
|
55
|
+
wink,
|
|
56
|
+
sleepy,
|
|
57
|
+
smug,
|
|
58
|
+
unsure,
|
|
59
|
+
shy,
|
|
60
|
+
thinking
|
|
61
|
+
} satisfies Record<AgentBlobatarExpression, Expression>
|
|
62
|
+
|
|
63
|
+
type AgentBlobatarProps = {
|
|
64
|
+
size: number
|
|
65
|
+
preset?: AgentTheme
|
|
66
|
+
animated?: boolean
|
|
67
|
+
color?: AgentBlobatarColor
|
|
68
|
+
expression?: AgentBlobatarExpression
|
|
69
|
+
className?: string
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function AgentBlobatar({
|
|
73
|
+
size,
|
|
74
|
+
preset = DEFAULT_WORKSPACE_THEME.agent,
|
|
75
|
+
animated = false,
|
|
76
|
+
color = 'default',
|
|
77
|
+
expression = 'idle',
|
|
78
|
+
className
|
|
79
|
+
}: AgentBlobatarProps) {
|
|
80
|
+
return (
|
|
81
|
+
<Blobatar
|
|
82
|
+
name={AGENT_BLOBATAR_SEED}
|
|
83
|
+
size={size}
|
|
84
|
+
animate={animated ? 'always' : 'hover'}
|
|
85
|
+
palette={AGENT_PALETTES[color]}
|
|
86
|
+
expression={expression ? AGENT_EXPRESSIONS[expression] : undefined}
|
|
87
|
+
className={cn('shrink-0', className)}
|
|
88
|
+
traits={{ shape: AGENT_THEMES[preset].shape }}
|
|
89
|
+
/>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { AgentBlobatar }
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
IconArticle,
|
|
3
5
|
IconFileSearch,
|
|
4
|
-
IconGhost,
|
|
5
6
|
IconLayout2,
|
|
6
|
-
IconMessages,
|
|
7
7
|
IconPiano,
|
|
8
8
|
IconSketching,
|
|
9
|
-
IconTableSpark,
|
|
10
9
|
IconUmbrella2,
|
|
11
10
|
IconWallet,
|
|
12
11
|
type TablerIcon
|
|
13
12
|
} from '@tabler/icons-react'
|
|
14
13
|
|
|
14
|
+
import { AgentBlobatar } from '@/client/components/shared/AgentBlobatar'
|
|
15
15
|
import {
|
|
16
16
|
ChatPromptBubble,
|
|
17
17
|
ChatPromptBubbles,
|
|
18
18
|
type ChatPromptBubble as ChatPrompt
|
|
19
19
|
} from '@/client/features/chat/ChatPromptBubbles'
|
|
20
20
|
import { cn } from '@/client/lib/cn'
|
|
21
|
+
import type { AgentTheme } from '@/lib/types'
|
|
21
22
|
|
|
22
23
|
const ONBOARDING_HANDOFF_DIRECTIVE =
|
|
23
24
|
'Keep the final reply brief and user-facing. Do not include file or storage links, file paths, or bundle, test, and runtime-log summaries.'
|
|
@@ -81,8 +82,8 @@ export const WORKSPACE_ANALYSIS_PROMPT = {
|
|
|
81
82
|
icon: IconFileSearch
|
|
82
83
|
} satisfies ChatPrompt
|
|
83
84
|
|
|
84
|
-
export type ChatEmptyStateKind = 'view-builder' | '
|
|
85
|
-
export type
|
|
85
|
+
export type ChatEmptyStateKind = 'view-builder' | 'welcome' | 'explore-workspace' | 'empty'
|
|
86
|
+
export type WelcomeDestination = 'agent' | 'widgets' | 'views' | 'scratchpad'
|
|
86
87
|
|
|
87
88
|
type ResolveChatEmptyStateOptions = {
|
|
88
89
|
isViewBuilderDraft: boolean
|
|
@@ -96,22 +97,22 @@ export function resolveChatEmptyState({
|
|
|
96
97
|
isWorkspacePendingAnalysis
|
|
97
98
|
}: ResolveChatEmptyStateOptions): ChatEmptyStateKind {
|
|
98
99
|
if (isViewBuilderDraft) return 'view-builder'
|
|
99
|
-
if (!hasSentMessageFromMoi) return '
|
|
100
|
-
if (isWorkspacePendingAnalysis) return 'workspace
|
|
100
|
+
if (!hasSentMessageFromMoi) return 'welcome'
|
|
101
|
+
if (isWorkspacePendingAnalysis) return 'explore-workspace'
|
|
101
102
|
return 'empty'
|
|
102
103
|
}
|
|
103
104
|
|
|
104
|
-
const EMPTY_STATE_STYLES = cn('flex flex-1 flex-col items-center justify-center self-center')
|
|
105
|
-
|
|
106
105
|
type ChatEmptyStateProps = {
|
|
106
|
+
agent: AgentTheme
|
|
107
107
|
kind: ChatEmptyStateKind
|
|
108
108
|
hasWorkspaceApplets: boolean
|
|
109
109
|
disabled?: boolean
|
|
110
110
|
onSelectPrompt: (prompt: ChatPrompt) => void
|
|
111
|
-
onNavigate: (destination:
|
|
111
|
+
onNavigate: (destination: WelcomeDestination) => void
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
export function ChatEmptyState({
|
|
115
|
+
agent,
|
|
115
116
|
kind,
|
|
116
117
|
hasWorkspaceApplets,
|
|
117
118
|
disabled = false,
|
|
@@ -120,124 +121,153 @@ export function ChatEmptyState({
|
|
|
120
121
|
}: ChatEmptyStateProps) {
|
|
121
122
|
switch (kind) {
|
|
122
123
|
case 'view-builder':
|
|
123
|
-
return <
|
|
124
|
-
case '
|
|
124
|
+
return <ViewBuilderState agent={agent} />
|
|
125
|
+
case 'welcome':
|
|
125
126
|
return (
|
|
126
|
-
<
|
|
127
|
+
<WelcomeState
|
|
128
|
+
agent={agent}
|
|
127
129
|
disabled={disabled}
|
|
128
130
|
showExamples={!hasWorkspaceApplets}
|
|
129
131
|
onSelectPrompt={onSelectPrompt}
|
|
130
132
|
onNavigate={onNavigate}
|
|
131
133
|
/>
|
|
132
134
|
)
|
|
133
|
-
case 'workspace
|
|
134
|
-
return
|
|
135
|
+
case 'explore-workspace':
|
|
136
|
+
return (
|
|
137
|
+
<ExploreWorkspaceState agent={agent} disabled={disabled} onSelectPrompt={onSelectPrompt} />
|
|
138
|
+
)
|
|
135
139
|
case 'empty':
|
|
136
|
-
return <EmptyState />
|
|
140
|
+
return <EmptyState agent={agent} />
|
|
137
141
|
}
|
|
138
142
|
}
|
|
139
143
|
|
|
140
|
-
|
|
144
|
+
type EmptyStateFrameProps = {
|
|
145
|
+
agent: AgentTheme
|
|
146
|
+
children: ReactNode
|
|
147
|
+
className?: string
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function EmptyStateFrame({ agent, children, className }: EmptyStateFrameProps) {
|
|
141
151
|
return (
|
|
142
|
-
<div className={cn(
|
|
143
|
-
<
|
|
152
|
+
<div className={cn('flex flex-1 flex-col items-center justify-center self-center', className)}>
|
|
153
|
+
<AgentBlobatar
|
|
154
|
+
preset={agent}
|
|
155
|
+
color="secondary"
|
|
156
|
+
expression="idle"
|
|
157
|
+
size={64}
|
|
158
|
+
className="mb-2"
|
|
159
|
+
animated
|
|
160
|
+
/>
|
|
161
|
+
|
|
162
|
+
{children}
|
|
163
|
+
</div>
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
type AgentStateProps = {
|
|
168
|
+
agent: AgentTheme
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function ViewBuilderState({ agent }: AgentStateProps) {
|
|
172
|
+
return (
|
|
173
|
+
<EmptyStateFrame agent={agent} className="text-center text-muted-foreground">
|
|
144
174
|
<p className="mx-auto max-w-xs px-8 text-sm">
|
|
145
175
|
Describe the content, data, and key actions you need in the view
|
|
146
176
|
</p>
|
|
147
|
-
</
|
|
177
|
+
</EmptyStateFrame>
|
|
148
178
|
)
|
|
149
179
|
}
|
|
150
180
|
|
|
151
|
-
type
|
|
181
|
+
type PromptStateProps = {
|
|
182
|
+
agent: AgentTheme
|
|
152
183
|
disabled?: boolean
|
|
153
184
|
onSelectPrompt: (prompt: ChatPrompt) => void
|
|
154
185
|
}
|
|
155
186
|
|
|
156
|
-
type
|
|
187
|
+
type WelcomeStateProps = PromptStateProps & {
|
|
157
188
|
showExamples?: boolean
|
|
158
|
-
onNavigate: (destination:
|
|
189
|
+
onNavigate: (destination: WelcomeDestination) => void
|
|
159
190
|
}
|
|
160
191
|
|
|
161
|
-
|
|
192
|
+
function WelcomeState({
|
|
193
|
+
agent,
|
|
162
194
|
disabled = false,
|
|
163
195
|
showExamples = true,
|
|
164
196
|
onSelectPrompt,
|
|
165
197
|
onNavigate
|
|
166
|
-
}:
|
|
198
|
+
}: WelcomeStateProps) {
|
|
167
199
|
return (
|
|
168
|
-
<
|
|
169
|
-
<div className="
|
|
170
|
-
<
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
200
|
+
<EmptyStateFrame agent={agent} className="@container w-full max-w-md min-w-0">
|
|
201
|
+
<div className="mt-2 flex flex-col gap-4">
|
|
202
|
+
<div className="prose prose-sm min-w-0 wrap-anywhere prose-inherit">
|
|
203
|
+
<p>
|
|
204
|
+
moi is the visual workspace for you and your agent. It grows and adapts to the work
|
|
205
|
+
you're doing.
|
|
206
|
+
</p>
|
|
207
|
+
<p>
|
|
208
|
+
Ask your agent to build{' '}
|
|
209
|
+
<WelcomeTerm Icon={IconLayout2} destination="widgets" onNavigate={onNavigate}>
|
|
210
|
+
Widgets
|
|
211
|
+
</WelcomeTerm>{' '}
|
|
212
|
+
that surface information and quick actions, or entire{' '}
|
|
213
|
+
<WelcomeTerm Icon={IconArticle} destination="views" onNavigate={onNavigate}>
|
|
214
|
+
Views
|
|
215
|
+
</WelcomeTerm>{' '}
|
|
216
|
+
for more complex tools. Use{' '}
|
|
217
|
+
<WelcomeTerm Icon={IconSketching} destination="scratchpad" onNavigate={onNavigate}>
|
|
218
|
+
Scratchpad
|
|
219
|
+
</WelcomeTerm>{' '}
|
|
220
|
+
for exploring and shaping ideas with your agent.
|
|
221
|
+
</p>
|
|
222
|
+
{showExamples && <p>Try an example:</p>}
|
|
223
|
+
</div>
|
|
224
|
+
{showExamples && (
|
|
225
|
+
<ChatPromptBubbles
|
|
226
|
+
prompts={CHAT_WELCOME_PROMPTS}
|
|
227
|
+
disabled={disabled}
|
|
228
|
+
onSelect={onSelectPrompt}
|
|
229
|
+
/>
|
|
230
|
+
)}
|
|
194
231
|
</div>
|
|
195
|
-
|
|
196
|
-
<ChatPromptBubbles
|
|
197
|
-
prompts={CHAT_WELCOME_PROMPTS}
|
|
198
|
-
disabled={disabled}
|
|
199
|
-
onSelect={onSelectPrompt}
|
|
200
|
-
/>
|
|
201
|
-
)}
|
|
202
|
-
</div>
|
|
232
|
+
</EmptyStateFrame>
|
|
203
233
|
)
|
|
204
234
|
}
|
|
205
235
|
|
|
206
|
-
|
|
236
|
+
function ExploreWorkspaceState({ agent, disabled = false, onSelectPrompt }: PromptStateProps) {
|
|
207
237
|
return (
|
|
208
|
-
<
|
|
209
|
-
<div className="
|
|
210
|
-
<
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
238
|
+
<EmptyStateFrame agent={agent}>
|
|
239
|
+
<div className="flex flex-col items-center gap-4">
|
|
240
|
+
<div className="prose prose-sm max-w-xs min-w-0 text-center wrap-anywhere prose-inherit">
|
|
241
|
+
<p>
|
|
242
|
+
Your agent can explore this workspace and suggest useful widgets and views based on
|
|
243
|
+
what’s already here
|
|
244
|
+
</p>
|
|
245
|
+
</div>
|
|
246
|
+
<ChatPromptBubble
|
|
247
|
+
prompt={WORKSPACE_ANALYSIS_PROMPT}
|
|
248
|
+
disabled={disabled}
|
|
249
|
+
onSelect={onSelectPrompt}
|
|
250
|
+
/>
|
|
215
251
|
</div>
|
|
216
|
-
|
|
217
|
-
prompt={WORKSPACE_ANALYSIS_PROMPT}
|
|
218
|
-
disabled={disabled}
|
|
219
|
-
onSelect={onSelectPrompt}
|
|
220
|
-
/>
|
|
221
|
-
</div>
|
|
252
|
+
</EmptyStateFrame>
|
|
222
253
|
)
|
|
223
254
|
}
|
|
224
255
|
|
|
225
|
-
function EmptyState() {
|
|
256
|
+
function EmptyState({ agent }: AgentStateProps) {
|
|
226
257
|
return (
|
|
227
|
-
<
|
|
228
|
-
<IconMessages size={56} stroke={0.5} aria-hidden />
|
|
258
|
+
<EmptyStateFrame agent={agent} className="text-center text-muted-foreground">
|
|
229
259
|
<p className="mx-auto max-w-sm px-8 text-sm">
|
|
230
260
|
Chat with your agent, create widgets and views, and manage your workspace context from here
|
|
231
261
|
</p>
|
|
232
|
-
</
|
|
262
|
+
</EmptyStateFrame>
|
|
233
263
|
)
|
|
234
264
|
}
|
|
235
265
|
|
|
236
266
|
type WelcomeTermProps = {
|
|
237
|
-
Icon: TablerIcon
|
|
238
267
|
children: string
|
|
239
|
-
destination:
|
|
240
|
-
|
|
268
|
+
destination: WelcomeDestination
|
|
269
|
+
Icon: TablerIcon
|
|
270
|
+
onNavigate: (destination: WelcomeDestination) => void
|
|
241
271
|
}
|
|
242
272
|
|
|
243
273
|
function WelcomeTerm({ Icon, children, destination, onNavigate }: WelcomeTermProps) {
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
type ComposerAvailability,
|
|
8
8
|
focusComposer
|
|
9
9
|
} from '@/client/components/shared/Composer'
|
|
10
|
+
import { AgentBlobatar } from '@/client/components/shared/AgentBlobatar'
|
|
10
11
|
import { useStickToBottom } from '@/client/features/chat/useStickToBottom'
|
|
11
12
|
import { groupTurns } from '@/client/features/chat/group-turns'
|
|
12
13
|
import { chatNoticeLabel, interleaveNotices } from '@/client/features/chat/interleave-notices'
|
|
@@ -14,17 +15,13 @@ import { attachmentKey, useLive } from '@/client/features/chat/chat-store'
|
|
|
14
15
|
import type { ChatPromptBubble } from '@/client/features/chat/ChatPromptBubbles'
|
|
15
16
|
import type { ChatSendOptions } from '@/client/features/chat/chat-send'
|
|
16
17
|
import { useWorkspaceId } from '@/client/features/workspace/WorkspaceContext'
|
|
17
|
-
import type { SystemNotice, Turn, ViewState } from '@/lib/types'
|
|
18
|
+
import type { AgentTheme, SystemNotice, Turn, ViewState } from '@/lib/types'
|
|
18
19
|
|
|
19
20
|
import type { ComposerBanner } from './composer/banners/ComposerBanner'
|
|
20
21
|
import { ChatComposer, type ComposerAnnotationControls } from './composer/ChatComposer'
|
|
21
|
-
import {
|
|
22
|
-
ChatEmptyState,
|
|
23
|
-
type ChatWelcomeDestination,
|
|
24
|
-
resolveChatEmptyState
|
|
25
|
-
} from './ChatEmptyState'
|
|
22
|
+
import { ChatEmptyState, type WelcomeDestination, resolveChatEmptyState } from './ChatEmptyState'
|
|
26
23
|
import { ChatSelector } from './ChatSelector'
|
|
27
|
-
import {
|
|
24
|
+
import { TurnView } from './TurnView'
|
|
28
25
|
import { Button } from '@/client/components/ui/button'
|
|
29
26
|
import { Tooltip, TooltipContent, TooltipTrigger } from '@/client/components/ui/tooltip'
|
|
30
27
|
import { cn } from '@/client/lib/cn'
|
|
@@ -43,6 +40,7 @@ export type ViewBuilderChatDraft = {
|
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
type ChatPanelProps = {
|
|
43
|
+
agent: AgentTheme
|
|
46
44
|
active?: boolean
|
|
47
45
|
focusRequest?: number
|
|
48
46
|
docked?: boolean
|
|
@@ -62,7 +60,7 @@ type ChatPanelProps = {
|
|
|
62
60
|
annotation?: ComposerAnnotationControls
|
|
63
61
|
send: (text: string, options?: ChatSendOptions) => void
|
|
64
62
|
stop: () => void
|
|
65
|
-
onNavigateFromWelcome: (destination:
|
|
63
|
+
onNavigateFromWelcome: (destination: WelcomeDestination) => void
|
|
66
64
|
// Chat on a separate tab doesn't have a close button
|
|
67
65
|
onClose?: () => void
|
|
68
66
|
builderDraft?: ViewBuilderChatDraft
|
|
@@ -72,6 +70,7 @@ const EMPTY_TURNS: Turn[] = []
|
|
|
72
70
|
const EMPTY_NOTICES: SystemNotice[] = []
|
|
73
71
|
|
|
74
72
|
export function ChatPanel({
|
|
73
|
+
agent,
|
|
75
74
|
active = true,
|
|
76
75
|
focusRequest = 0,
|
|
77
76
|
docked = false,
|
|
@@ -195,6 +194,7 @@ export function ChatPanel({
|
|
|
195
194
|
<div className="mx-auto flex w-full max-w-(--chat-max-container) flex-1 flex-col gap-6">
|
|
196
195
|
{showEmptyState && (
|
|
197
196
|
<ChatEmptyState
|
|
197
|
+
agent={agent}
|
|
198
198
|
kind={emptyStateKind}
|
|
199
199
|
hasWorkspaceApplets={hasWorkspaceApplets}
|
|
200
200
|
disabled={promptDisabled}
|
|
@@ -213,9 +213,17 @@ export function ChatPanel({
|
|
|
213
213
|
/>
|
|
214
214
|
)
|
|
215
215
|
)}
|
|
216
|
-
{
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
{!showEmptyState && (
|
|
217
|
+
<div className="mt-auto -ml-3 pt-2">
|
|
218
|
+
<AgentBlobatar
|
|
219
|
+
preset={agent}
|
|
220
|
+
color="primary"
|
|
221
|
+
size={64}
|
|
222
|
+
animated={effectiveProcessing}
|
|
223
|
+
expression={effectiveProcessing ? 'thinking' : undefined}
|
|
224
|
+
/>
|
|
225
|
+
</div>
|
|
226
|
+
)}
|
|
219
227
|
</div>
|
|
220
228
|
</div>
|
|
221
229
|
|
|
@@ -2,11 +2,13 @@ import type { ComponentProps, ReactNode } from 'react'
|
|
|
2
2
|
|
|
3
3
|
import { motion } from 'motion/react'
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { Button } from '@/client/components/ui/button'
|
|
5
|
+
import { AgentBlobatar } from '@/client/components/shared/AgentBlobatar'
|
|
7
6
|
import { Popover, PopoverContent, PopoverTrigger } from '@/client/components/ui/popover'
|
|
7
|
+
import { cn } from '@/client/lib/cn'
|
|
8
|
+
import type { AgentTheme } from '@/lib/types'
|
|
8
9
|
|
|
9
10
|
type ChatPopupProps = {
|
|
11
|
+
agent: AgentTheme
|
|
10
12
|
loading: boolean
|
|
11
13
|
open: boolean
|
|
12
14
|
onOpenChange: (open: boolean) => void
|
|
@@ -15,6 +17,7 @@ type ChatPopupProps = {
|
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
export function ChatPopup({
|
|
20
|
+
agent,
|
|
18
21
|
loading,
|
|
19
22
|
open,
|
|
20
23
|
onOpenChange,
|
|
@@ -43,7 +46,7 @@ export function ChatPopup({
|
|
|
43
46
|
legible regardless of the active theme background. */}
|
|
44
47
|
<PopoverTrigger
|
|
45
48
|
render={
|
|
46
|
-
<div className="fixed right-4 bottom-4 sm:right-
|
|
49
|
+
<div className="fixed right-4 bottom-4 sm:right-4 sm:bottom-4">
|
|
47
50
|
<motion.div
|
|
48
51
|
variants={{
|
|
49
52
|
from: { opacity: 0, scale: 0.8, filter: 'blur(4px)' },
|
|
@@ -54,14 +57,24 @@ export function ChatPopup({
|
|
|
54
57
|
animate={open ? 'invisible' : 'to'}
|
|
55
58
|
transition={{ type: 'spring', duration: 0.3, delay: 0.2, bounce: 0 }}
|
|
56
59
|
>
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
className="bg-card shadow-md hover:shadow-lg"
|
|
60
|
+
<button
|
|
61
|
+
type="button"
|
|
62
|
+
className="group block cursor-pointer rounded-xl p-0 outline-none focus-visible:ring-3 focus-visible:ring-ring/50"
|
|
61
63
|
aria-label="Agent"
|
|
62
64
|
>
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
+
<AgentBlobatar
|
|
66
|
+
preset={agent}
|
|
67
|
+
color="primary"
|
|
68
|
+
size={56}
|
|
69
|
+
animated={loading}
|
|
70
|
+
expression={loading ? 'thinking' : undefined}
|
|
71
|
+
className={cn(
|
|
72
|
+
'drop-shadow-md drop-shadow-primary/30',
|
|
73
|
+
'group-hover:drop-shadow-lg group-hover:drop-shadow-primary/40',
|
|
74
|
+
'transition-[filter] duration-400 ease-in-out motion-reduce:transition-none'
|
|
75
|
+
)}
|
|
76
|
+
/>
|
|
77
|
+
</button>
|
|
65
78
|
</motion.div>
|
|
66
79
|
</div>
|
|
67
80
|
}
|
|
@@ -69,9 +82,8 @@ export function ChatPopup({
|
|
|
69
82
|
<PopoverContent
|
|
70
83
|
positionMethod="fixed"
|
|
71
84
|
side="top"
|
|
72
|
-
sideOffset={-
|
|
85
|
+
sideOffset={-56}
|
|
73
86
|
align="end"
|
|
74
|
-
alignOffset={-8}
|
|
75
87
|
className="flex h-[calc(100vh-2rem)] w-[min(440px,calc(100vw-1rem))] flex-col gap-0 rounded-3xl p-0 sm:h-[calc(100vh-8rem)] sm:w-[min(440px,calc(100vw-2rem))] sm:p-1"
|
|
76
88
|
keepMounted
|
|
77
89
|
>
|
|
@@ -50,7 +50,7 @@ type ChatPromptBubblesProps = {
|
|
|
50
50
|
|
|
51
51
|
export function ChatPromptBubbles({ prompts, disabled = false, onSelect }: ChatPromptBubblesProps) {
|
|
52
52
|
return (
|
|
53
|
-
<div className="row-gap-2 grid w-full grid-cols-1 gap-x-3 gap-y-2
|
|
53
|
+
<div className="row-gap-2 grid w-full grid-cols-1 gap-x-3 gap-y-2 @md:grid-cols-3">
|
|
54
54
|
{prompts.map((prompt, index) => {
|
|
55
55
|
return (
|
|
56
56
|
<ChatPromptBubble
|
|
@@ -15,23 +15,6 @@ import { formatDuration } from '@/client/features/chat/tool-group/format'
|
|
|
15
15
|
import { useWorkspaceLayoutCtx } from '@/client/features/workspace/WorkspaceLayoutContext'
|
|
16
16
|
import { cn } from '@/client/lib/cn'
|
|
17
17
|
|
|
18
|
-
export function ThinkingIndicator() {
|
|
19
|
-
return (
|
|
20
|
-
<div className="flex items-center gap-1 px-1 py-3">
|
|
21
|
-
{[0, 1, 2].map(i => (
|
|
22
|
-
<span
|
|
23
|
-
key={i}
|
|
24
|
-
className="block h-1 w-1 rounded-full bg-ring"
|
|
25
|
-
style={{
|
|
26
|
-
animation: 'pulse-dot 1.4s ease-in-out infinite',
|
|
27
|
-
animationDelay: `${i * 0.2}s`
|
|
28
|
-
}}
|
|
29
|
-
/>
|
|
30
|
-
))}
|
|
31
|
-
</div>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
18
|
// A part either folds into a tool-group "run" (reasoning + tool calls — including
|
|
36
19
|
// subagents and skills, which render as their own timeline rows) or stands alone
|
|
37
20
|
// (text, files, sources, data).
|
|
@@ -22,7 +22,7 @@ type StickToBottom = {
|
|
|
22
22
|
atBottom: boolean
|
|
23
23
|
// Scroll to the bottom and re-pin. `smooth` for user-initiated jumps.
|
|
24
24
|
scrollToBottom: (behavior?: ScrollBehavior) => void
|
|
25
|
-
// Show top-anchored content such as the initial
|
|
25
|
+
// Show top-anchored content such as the initial welcome state without the
|
|
26
26
|
// resize observer pulling it back to the bottom.
|
|
27
27
|
scrollToTop: () => void
|
|
28
28
|
}
|
|
@@ -10,6 +10,7 @@ import { useEffect, useState } from 'react'
|
|
|
10
10
|
|
|
11
11
|
import { IconChevronDown, IconEdit } from '@tabler/icons-react'
|
|
12
12
|
|
|
13
|
+
import { AgentBlobatar } from '@/client/components/shared/AgentBlobatar'
|
|
13
14
|
import { Button } from '@/client/components/ui/button'
|
|
14
15
|
import {
|
|
15
16
|
DropdownMenu,
|
|
@@ -24,7 +25,7 @@ import { Switch } from '@/client/components/ui/switch'
|
|
|
24
25
|
import { ChatNoticeRow } from '@/client/features/chat/ChatPanel'
|
|
25
26
|
import { ChatErrorBanner } from '@/client/features/chat/composer/banners/ChatErrorBanner'
|
|
26
27
|
import { ChatSessionItem } from '@/client/features/chat/ChatSelector'
|
|
27
|
-
import {
|
|
28
|
+
import { TurnView } from '@/client/features/chat/TurnView'
|
|
28
29
|
import { isSessionRunning, liveStore } from '@/client/features/chat/chat-store'
|
|
29
30
|
import { groupTurns } from '@/client/features/chat/group-turns'
|
|
30
31
|
import { interleaveNotices } from '@/client/features/chat/interleave-notices'
|
|
@@ -70,12 +71,12 @@ const ANCHOR_BY_ITEM_ID: Record<string, string> = Object.fromEntries(
|
|
|
70
71
|
conversationAnchors.map(a => [a.itemId, a.anchor])
|
|
71
72
|
)
|
|
72
73
|
|
|
73
|
-
type TailState = 'none' | '
|
|
74
|
+
type TailState = 'none' | 'waiting' | 'thinking' | 'text'
|
|
74
75
|
type BackgroundState = 'default' | 'muted'
|
|
75
76
|
|
|
76
77
|
const TAIL_OPTIONS: { value: TailState; label: string }[] = [
|
|
77
78
|
{ value: 'none', label: 'None' },
|
|
78
|
-
{ value: '
|
|
79
|
+
{ value: 'waiting', label: 'Waiting' },
|
|
79
80
|
{ value: 'thinking', label: 'Thinking' },
|
|
80
81
|
{ value: 'text', label: 'Text' }
|
|
81
82
|
]
|
|
@@ -102,9 +103,9 @@ type TranscriptProps = {
|
|
|
102
103
|
|
|
103
104
|
// Mirrors ChatPanel's timeline: append the preview turn, fold tool-only turns
|
|
104
105
|
// (groupTurns), weave notices in, then map to the real row components. The
|
|
105
|
-
//
|
|
106
|
-
//
|
|
107
|
-
//
|
|
106
|
+
// transcript avatar holds its thinking expression for the complete active run.
|
|
107
|
+
// Anchors render as zero-size absolute spans so the gap-6 rhythm between items
|
|
108
|
+
// stays untouched.
|
|
108
109
|
function Transcript({
|
|
109
110
|
turns,
|
|
110
111
|
notices = [],
|
|
@@ -131,7 +132,14 @@ function Transcript({
|
|
|
131
132
|
</div>
|
|
132
133
|
)
|
|
133
134
|
})}
|
|
134
|
-
|
|
135
|
+
<div className="-ml-3 pt-2">
|
|
136
|
+
<AgentBlobatar
|
|
137
|
+
color="primary"
|
|
138
|
+
size={64}
|
|
139
|
+
animated={processing}
|
|
140
|
+
expression={processing ? 'thinking' : undefined}
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
135
143
|
</div>
|
|
136
144
|
)
|
|
137
145
|
}
|
|
@@ -357,8 +365,8 @@ export function ChatStatesPage() {
|
|
|
357
365
|
is skipped, and the final answer shows in the summary segment.
|
|
358
366
|
</li>
|
|
359
367
|
<li>
|
|
360
|
-
The
|
|
361
|
-
|
|
368
|
+
The transcript avatar keeps its thinking expression for the full active run,
|
|
369
|
+
including while reasoning, text, or tool output is visible.
|
|
362
370
|
</li>
|
|
363
371
|
<li>
|
|
364
372
|
Empty-chat states (<code>ChatEmptyState</code>: placeholder and first-run welcome)
|