moi-computer 0.10.1-next.0 → 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/app/shell/SidebarLayout.tsx +3 -3
- package/client/components/shared/AgentBlobatar.tsx +93 -0
- package/client/features/chat/ChatEmptyState.tsx +122 -77
- package/client/features/chat/ChatPanel.tsx +22 -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/useChat.ts +10 -2
- 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 +17 -7
- 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-4057kxht.css +0 -1
- package/dist/chunk-b5c62p8h.js +0 -1
- package/dist/chunk-dfe7qnrp.js +0 -1
- package/dist/chunk-f6xmz3tn.js +0 -83
- package/dist/chunk-h2kj1ysj.js +0 -1
- package/dist/chunk-qtc5a8qa.js +0 -10
|
@@ -59,7 +59,7 @@ export function SidebarLayout({ children, showWorkspaces = true }: SidebarLayout
|
|
|
59
59
|
})
|
|
60
60
|
|
|
61
61
|
return (
|
|
62
|
-
<div className=
|
|
62
|
+
<div className="flex h-dvh bg-muted transition-colors duration-100 ease-out motion-reduce:transition-none">
|
|
63
63
|
<Sidebar workspaces={showWorkspaces ? (workspaces ?? []) : []} />
|
|
64
64
|
<main className="flex min-w-0 flex-1 flex-col">{children}</main>
|
|
65
65
|
</div>
|
|
@@ -166,7 +166,7 @@ function WorkspaceButton({ workspace, dragOverlay = false, dragState }: Workspac
|
|
|
166
166
|
<div
|
|
167
167
|
className={cn(
|
|
168
168
|
buttonVariants({ variant: 'ghost', size: 'icon-lg' }),
|
|
169
|
-
'pointer-events-none size-12',
|
|
169
|
+
'pointer-events-none size-12 transition-[border-radius,background-color,color] duration-100 ease-out motion-reduce:transition-none',
|
|
170
170
|
dragOverlay
|
|
171
171
|
? 'bg-background shadow-lg'
|
|
172
172
|
: 'group-hover:bg-accent group-hover:text-accent-foreground group-focus-visible:ring-3 group-focus-visible:ring-ring/50',
|
|
@@ -176,7 +176,7 @@ function WorkspaceButton({ workspace, dragOverlay = false, dragState }: Workspac
|
|
|
176
176
|
<img
|
|
177
177
|
src={workspace.icon ?? workspaceProviderIcon[workspace.type ?? 'claude-code']}
|
|
178
178
|
alt=""
|
|
179
|
-
className="size-7 shrink-0 rounded-xs"
|
|
179
|
+
className="size-7 shrink-0 rounded-xs transition-[border-radius] duration-100 ease-out motion-reduce:transition-none"
|
|
180
180
|
/>
|
|
181
181
|
</div>
|
|
182
182
|
)
|
|
@@ -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,133 +97,177 @@ 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
|
+
hasWorkspaceApplets: boolean
|
|
108
109
|
disabled?: boolean
|
|
109
110
|
onSelectPrompt: (prompt: ChatPrompt) => void
|
|
110
|
-
onNavigate: (destination:
|
|
111
|
+
onNavigate: (destination: WelcomeDestination) => void
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
export function ChatEmptyState({
|
|
115
|
+
agent,
|
|
114
116
|
kind,
|
|
117
|
+
hasWorkspaceApplets,
|
|
115
118
|
disabled = false,
|
|
116
119
|
onSelectPrompt,
|
|
117
120
|
onNavigate
|
|
118
121
|
}: ChatEmptyStateProps) {
|
|
119
122
|
switch (kind) {
|
|
120
123
|
case 'view-builder':
|
|
121
|
-
return <
|
|
122
|
-
case '
|
|
124
|
+
return <ViewBuilderState agent={agent} />
|
|
125
|
+
case 'welcome':
|
|
126
|
+
return (
|
|
127
|
+
<WelcomeState
|
|
128
|
+
agent={agent}
|
|
129
|
+
disabled={disabled}
|
|
130
|
+
showExamples={!hasWorkspaceApplets}
|
|
131
|
+
onSelectPrompt={onSelectPrompt}
|
|
132
|
+
onNavigate={onNavigate}
|
|
133
|
+
/>
|
|
134
|
+
)
|
|
135
|
+
case 'explore-workspace':
|
|
123
136
|
return (
|
|
124
|
-
<
|
|
137
|
+
<ExploreWorkspaceState agent={agent} disabled={disabled} onSelectPrompt={onSelectPrompt} />
|
|
125
138
|
)
|
|
126
|
-
case 'workspace-welcome':
|
|
127
|
-
return <ChatWorkspaceWelcome disabled={disabled} onSelectPrompt={onSelectPrompt} />
|
|
128
139
|
case 'empty':
|
|
129
|
-
return <EmptyState />
|
|
140
|
+
return <EmptyState agent={agent} />
|
|
130
141
|
}
|
|
131
142
|
}
|
|
132
143
|
|
|
133
|
-
|
|
144
|
+
type EmptyStateFrameProps = {
|
|
145
|
+
agent: AgentTheme
|
|
146
|
+
children: ReactNode
|
|
147
|
+
className?: string
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function EmptyStateFrame({ agent, children, className }: EmptyStateFrameProps) {
|
|
134
151
|
return (
|
|
135
|
-
<div className={cn(
|
|
136
|
-
<
|
|
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">
|
|
137
174
|
<p className="mx-auto max-w-xs px-8 text-sm">
|
|
138
175
|
Describe the content, data, and key actions you need in the view
|
|
139
176
|
</p>
|
|
140
|
-
</
|
|
177
|
+
</EmptyStateFrame>
|
|
141
178
|
)
|
|
142
179
|
}
|
|
143
180
|
|
|
144
|
-
type
|
|
181
|
+
type PromptStateProps = {
|
|
182
|
+
agent: AgentTheme
|
|
145
183
|
disabled?: boolean
|
|
146
184
|
onSelectPrompt: (prompt: ChatPrompt) => void
|
|
147
185
|
}
|
|
148
186
|
|
|
149
|
-
type
|
|
150
|
-
|
|
187
|
+
type WelcomeStateProps = PromptStateProps & {
|
|
188
|
+
showExamples?: boolean
|
|
189
|
+
onNavigate: (destination: WelcomeDestination) => void
|
|
151
190
|
}
|
|
152
191
|
|
|
153
|
-
|
|
192
|
+
function WelcomeState({
|
|
193
|
+
agent,
|
|
194
|
+
disabled = false,
|
|
195
|
+
showExamples = true,
|
|
196
|
+
onSelectPrompt,
|
|
197
|
+
onNavigate
|
|
198
|
+
}: WelcomeStateProps) {
|
|
154
199
|
return (
|
|
155
|
-
<
|
|
156
|
-
<div className="
|
|
157
|
-
<
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
+
)}
|
|
181
231
|
</div>
|
|
182
|
-
|
|
183
|
-
prompts={CHAT_WELCOME_PROMPTS}
|
|
184
|
-
disabled={disabled}
|
|
185
|
-
onSelect={onSelectPrompt}
|
|
186
|
-
/>
|
|
187
|
-
</div>
|
|
232
|
+
</EmptyStateFrame>
|
|
188
233
|
)
|
|
189
234
|
}
|
|
190
235
|
|
|
191
|
-
|
|
236
|
+
function ExploreWorkspaceState({ agent, disabled = false, onSelectPrompt }: PromptStateProps) {
|
|
192
237
|
return (
|
|
193
|
-
<
|
|
194
|
-
<div className="
|
|
195
|
-
<
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
+
/>
|
|
200
251
|
</div>
|
|
201
|
-
|
|
202
|
-
prompt={WORKSPACE_ANALYSIS_PROMPT}
|
|
203
|
-
disabled={disabled}
|
|
204
|
-
onSelect={onSelectPrompt}
|
|
205
|
-
/>
|
|
206
|
-
</div>
|
|
252
|
+
</EmptyStateFrame>
|
|
207
253
|
)
|
|
208
254
|
}
|
|
209
255
|
|
|
210
|
-
function EmptyState() {
|
|
256
|
+
function EmptyState({ agent }: AgentStateProps) {
|
|
211
257
|
return (
|
|
212
|
-
<
|
|
213
|
-
<IconMessages size={56} stroke={0.5} aria-hidden />
|
|
258
|
+
<EmptyStateFrame agent={agent} className="text-center text-muted-foreground">
|
|
214
259
|
<p className="mx-auto max-w-sm px-8 text-sm">
|
|
215
260
|
Chat with your agent, create widgets and views, and manage your workspace context from here
|
|
216
261
|
</p>
|
|
217
|
-
</
|
|
262
|
+
</EmptyStateFrame>
|
|
218
263
|
)
|
|
219
264
|
}
|
|
220
265
|
|
|
221
266
|
type WelcomeTermProps = {
|
|
222
|
-
Icon: TablerIcon
|
|
223
267
|
children: string
|
|
224
|
-
destination:
|
|
225
|
-
|
|
268
|
+
destination: WelcomeDestination
|
|
269
|
+
Icon: TablerIcon
|
|
270
|
+
onNavigate: (destination: WelcomeDestination) => void
|
|
226
271
|
}
|
|
227
272
|
|
|
228
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,10 +40,12 @@ 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
|
|
49
47
|
chatLoaded: boolean
|
|
48
|
+
hasWorkspaceApplets: boolean
|
|
50
49
|
view: ViewState
|
|
51
50
|
// The live streaming preview as a synthetic assistant turn (or null). Merged
|
|
52
51
|
// into the transcript through the same groupTurns pipeline so a thinking-only
|
|
@@ -61,7 +60,7 @@ type ChatPanelProps = {
|
|
|
61
60
|
annotation?: ComposerAnnotationControls
|
|
62
61
|
send: (text: string, options?: ChatSendOptions) => void
|
|
63
62
|
stop: () => void
|
|
64
|
-
onNavigateFromWelcome: (destination:
|
|
63
|
+
onNavigateFromWelcome: (destination: WelcomeDestination) => void
|
|
65
64
|
// Chat on a separate tab doesn't have a close button
|
|
66
65
|
onClose?: () => void
|
|
67
66
|
builderDraft?: ViewBuilderChatDraft
|
|
@@ -71,10 +70,12 @@ const EMPTY_TURNS: Turn[] = []
|
|
|
71
70
|
const EMPTY_NOTICES: SystemNotice[] = []
|
|
72
71
|
|
|
73
72
|
export function ChatPanel({
|
|
73
|
+
agent,
|
|
74
74
|
active = true,
|
|
75
75
|
focusRequest = 0,
|
|
76
76
|
docked = false,
|
|
77
77
|
chatLoaded,
|
|
78
|
+
hasWorkspaceApplets,
|
|
78
79
|
view,
|
|
79
80
|
previewTurn,
|
|
80
81
|
sessionId,
|
|
@@ -193,7 +194,9 @@ export function ChatPanel({
|
|
|
193
194
|
<div className="mx-auto flex w-full max-w-(--chat-max-container) flex-1 flex-col gap-6">
|
|
194
195
|
{showEmptyState && (
|
|
195
196
|
<ChatEmptyState
|
|
197
|
+
agent={agent}
|
|
196
198
|
kind={emptyStateKind}
|
|
199
|
+
hasWorkspaceApplets={hasWorkspaceApplets}
|
|
197
200
|
disabled={promptDisabled}
|
|
198
201
|
onSelectPrompt={handlePromptSelect}
|
|
199
202
|
onNavigate={onNavigateFromWelcome}
|
|
@@ -210,9 +213,17 @@ export function ChatPanel({
|
|
|
210
213
|
/>
|
|
211
214
|
)
|
|
212
215
|
)}
|
|
213
|
-
{
|
|
214
|
-
|
|
215
|
-
|
|
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
|
+
)}
|
|
216
227
|
</div>
|
|
217
228
|
</div>
|
|
218
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).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useMemo } from 'react'
|
|
1
|
+
import { useCallback, useEffect, useMemo } from 'react'
|
|
2
2
|
|
|
3
3
|
import { useQueryClient } from '@tanstack/react-query'
|
|
4
4
|
|
|
@@ -48,9 +48,17 @@ export function useChat(address: WorkspaceTabAddress) {
|
|
|
48
48
|
const qc = useQueryClient()
|
|
49
49
|
const { layout } = useWorkspaceLayoutCtx()
|
|
50
50
|
const [selectedSession, selectSession] = useSelectedSession()
|
|
51
|
-
const selectedSessionId = selectedSession ?? null
|
|
52
51
|
const modelsData = useWorkspaceAgent(workspaceId).data
|
|
53
52
|
const sessions = useWorkspaceSessions(workspaceId).data
|
|
53
|
+
const selectedSessionMissing =
|
|
54
|
+
Boolean(selectedSession) &&
|
|
55
|
+
sessions !== undefined &&
|
|
56
|
+
!sessions.some(session => session.sessionId === selectedSession)
|
|
57
|
+
const selectedSessionId = selectedSessionMissing ? null : (selectedSession ?? null)
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (selectedSessionMissing) selectSession(null)
|
|
61
|
+
}, [selectSession, selectedSessionMissing])
|
|
54
62
|
// Snapshot of the workspace's ambient UI state + queued one-shot
|
|
55
63
|
// directives, taken when the message actually goes out.
|
|
56
64
|
const buildMoiContext = useMoiUserMessageContext(address)
|
|
@@ -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
|
}
|