moi-computer 0.3.1-next.1 → 0.4.1-next.0

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.
Files changed (130) hide show
  1. package/README.md +85 -12
  2. package/bin/moi.mjs +11 -0
  3. package/client/api/workspace-keys.ts +1 -0
  4. package/client/app/AppRouter.tsx +5 -1
  5. package/client/app/routes/WorkspaceRoute.tsx +9 -5
  6. package/client/app/shell/SidebarLayout.tsx +9 -7
  7. package/client/components/shared/BottomPanel.tsx +24 -5
  8. package/client/components/shared/Composer.tsx +1 -1
  9. package/client/components/shared/PanelHeader.tsx +1 -1
  10. package/client/components/ui/button.tsx +5 -5
  11. package/client/components/ui/dropdown-menu.tsx +6 -6
  12. package/client/components/ui/hover-card.tsx +1 -1
  13. package/client/components/ui/input.tsx +1 -1
  14. package/client/components/ui/popover.tsx +1 -1
  15. package/client/components/ui/skeleton.tsx +1 -1
  16. package/client/components/ui/textarea.tsx +1 -1
  17. package/client/components/ui/tooltip.tsx +1 -1
  18. package/client/features/applets/applet-cache.ts +20 -1
  19. package/client/features/applets/applet-log.ts +10 -30
  20. package/client/features/applets/applet-runtime.ts +272 -0
  21. package/client/features/applets/useApplet.ts +36 -10
  22. package/client/features/chat/ChatComposer.tsx +1 -1
  23. package/client/features/chat/ChatEmptyState.tsx +186 -0
  24. package/client/features/chat/ChatPanel.tsx +95 -54
  25. package/client/features/chat/ChatPopup.tsx +3 -13
  26. package/client/features/chat/ChatPromptBubbles.tsx +74 -0
  27. package/client/features/chat/MarkdownContent.tsx +15 -3
  28. package/client/features/chat/ModelPicker.tsx +1 -1
  29. package/client/features/chat/TurnView.tsx +6 -17
  30. package/client/features/chat/chat-send.ts +26 -1
  31. package/client/features/chat/tool-group/CodeBlock.tsx +1 -1
  32. package/client/features/chat/tool-group/ReadImagePreview.tsx +1 -1
  33. package/client/features/chat/tool-group/SubagentCard.tsx +1 -1
  34. package/client/features/chat/tool-group/TimelineRow.tsx +4 -4
  35. package/client/features/chat/tool-group/ToolCallGroup.tsx +12 -5
  36. package/client/features/chat/tool-group/ToolOutput.tsx +2 -2
  37. package/client/features/chat/tool-group/format.ts +25 -4
  38. package/client/features/chat/useAppletChatMessage.ts +69 -0
  39. package/client/features/chat/useChat.ts +49 -14
  40. package/client/features/chat/useStickToBottom.ts +11 -1
  41. package/client/features/connectors/McpServerCards.tsx +3 -3
  42. package/client/features/dev/HarnessDebugPage.tsx +213 -77
  43. package/client/features/dev/PixelPainter.tsx +1 -1
  44. package/client/features/dev/PlaygroundPage.tsx +1 -1
  45. package/client/features/dev/ToolCallsPage.tsx +2 -2
  46. package/client/features/home/HomePage.tsx +17 -14
  47. package/client/features/home/WorkspacePreview.tsx +12 -13
  48. package/client/features/home/api.ts +8 -5
  49. package/client/features/home/workspace-presentation.tsx +1 -1
  50. package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +1 -1
  51. package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +21 -8
  52. package/client/features/scratchpad/Scratchpad.tsx +41 -2
  53. package/client/features/scratchpad/ScratchpadControls.tsx +13 -13
  54. package/client/features/scratchpad/useScratchpadSnapshot.tsx +1 -1
  55. package/client/features/settings/EnvironmentSettings.tsx +1 -1
  56. package/client/features/settings/IconPicker.tsx +11 -11
  57. package/client/features/settings/SettingsLayout.tsx +1 -1
  58. package/client/features/settings/WorkspaceSettings.tsx +2 -2
  59. package/client/features/settings/api.ts +33 -1
  60. package/client/features/widgets/HiddenPanel.tsx +4 -3
  61. package/client/features/widgets/Widgets.tsx +1 -0
  62. package/client/features/workspace/CustomizePanel.tsx +96 -82
  63. package/client/features/workspace/WorkspaceScreen.tsx +129 -107
  64. package/client/features/workspace/WorkspaceSkillUpdateBanner.tsx +91 -0
  65. package/client/features/workspace/WorkspaceTabs.tsx +1 -1
  66. package/client/features/workspace/api.ts +52 -0
  67. package/client/features/workspace/moi-context.ts +63 -17
  68. package/client/features/workspace/tab-resolution.ts +75 -0
  69. package/client/features/workspace/useWorkspaceNavigation.ts +128 -0
  70. package/client/features/workspace/useWorkspaceSkillUpdates.ts +160 -0
  71. package/client/index.css +10 -15
  72. package/client/lib/app-icon-registry.ts +77 -70
  73. package/client/lib/rate-limit.ts +77 -0
  74. package/client/main.tsx +10 -2
  75. package/client/runtime/useWorkspaceEvents.ts +15 -2
  76. package/client/runtime/workspace-theme.ts +115 -0
  77. package/client/store/ui.ts +42 -17
  78. package/client/theme.css +20 -15
  79. package/dist/{chunk-1dfbr7n2.js → chunk-3m1xe1j3.js} +94 -94
  80. package/dist/chunk-5vaevt8z.js +2 -0
  81. package/dist/chunk-7bzpmtxp.js +50 -0
  82. package/dist/chunk-h0hk61pm.js +9 -0
  83. package/dist/{chunk-vkvb3hjm.js → chunk-h3evrtyp.js} +1 -1
  84. package/dist/chunk-k5sjx9s5.js +1 -0
  85. package/dist/{chunk-jen6xcm1.js → chunk-m9qja0nx.js} +1 -1
  86. package/dist/chunk-s7za1qsv.css +1 -0
  87. package/dist/{chunk-sxbfh73c.js → chunk-tcfa3vt3.js} +1 -1
  88. package/dist/chunk-v797g6ap.js +51 -0
  89. package/dist/chunk-xyrw8318.js +27 -0
  90. package/dist/index.html +1 -1
  91. package/lib/app-icons.ts +73 -0
  92. package/lib/moi-context.ts +104 -3
  93. package/lib/themes.ts +83 -45
  94. package/lib/types.ts +44 -9
  95. package/lib/workspace-tabs.ts +48 -0
  96. package/package.json +4 -1
  97. package/server/api.ts +57 -5
  98. package/server/app-settings.ts +65 -0
  99. package/server/applets.ts +132 -22
  100. package/server/bundler/build-applet.ts +74 -16
  101. package/server/cli.ts +144 -17
  102. package/server/control.ts +53 -7
  103. package/server/data-dir.ts +1 -1
  104. package/server/events.ts +1 -1
  105. package/server/functions-worker.ts +15 -1
  106. package/server/functions.ts +51 -6
  107. package/server/harness/claude-code/index.ts +2 -1
  108. package/server/harness/codex/adapter.ts +100 -9
  109. package/server/harness/codex/client.ts +34 -1
  110. package/server/harness/codex/index.ts +2 -1
  111. package/server/harness/codex/session.ts +32 -8
  112. package/server/layout.ts +9 -14
  113. package/server/moi-scaffold.ts +37 -3
  114. package/server/registry.ts +1 -1
  115. package/server/skill-update.ts +47 -0
  116. package/server/skill-version.ts +2 -11
  117. package/server/tabs.ts +59 -0
  118. package/server/theme.ts +8 -14
  119. package/server/view-builders.ts +6 -2
  120. package/workspace/.claude/skills/moi-workspace/DESIGN.md +265 -107
  121. package/workspace/.claude/skills/moi-workspace/SKILL.md +85 -11
  122. package/client/features/workspace/useWorkspaceTheme.ts +0 -82
  123. package/dist/chunk-339jds4x.js +0 -15
  124. package/dist/chunk-3xsvsnhr.css +0 -1
  125. package/dist/chunk-6c8cwpzc.js +0 -1
  126. package/dist/chunk-anqmsbjt.js +0 -2
  127. package/dist/chunk-hbvfb6sk.js +0 -63
  128. package/dist/chunk-qwm5f6qk.js +0 -48
  129. package/dist/chunk-yp4srgqt.js +0 -10
  130. package/workspace/.claude/skills/moi-workspace/VIEW-DESIGN.md +0 -22
@@ -1,19 +1,28 @@
1
- import { type ReactNode, useCallback, useEffect, useMemo, useRef } from 'react'
1
+ import { type ReactNode, useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react'
2
2
 
3
3
  import { IconChevronDown, IconX } from '@tabler/icons-react'
4
4
 
5
+ import { canSubmitComposerAction } from '@/client/components/shared/Composer'
5
6
  import { useStickToBottom } from '@/client/features/chat/useStickToBottom'
6
7
  import { groupTurns } from '@/client/features/chat/group-turns'
8
+ import { draftKey, useLive } from '@/client/features/chat/chat-store'
9
+ import type { ChatPromptBubble } from '@/client/features/chat/ChatPromptBubbles'
10
+ import type { ChatSendOptions } from '@/client/features/chat/chat-send'
11
+ import { useWorkspaceId } from '@/client/features/workspace/WorkspaceContext'
7
12
  import type { Turn, ViewState } from '@/lib/types'
8
13
 
9
14
  import { ChatComposer } from './ChatComposer'
15
+ import { ChatEmptyState, resolveChatEmptyState } from './ChatEmptyState'
10
16
  import { ChatSelector } from './ChatSelector'
11
- import { EmptyState, ThinkingIndicator, TurnView } from './TurnView'
17
+ import { ThinkingIndicator, TurnView } from './TurnView'
12
18
  import { Button } from '@/client/components/ui/button'
19
+ import { cn } from '@/client/lib/cn'
20
+ import { useUiStore } from '@/client/store/ui'
13
21
 
14
22
  type ChatPanelProps = {
15
23
  active?: boolean
16
24
  focusRequest?: number
25
+ chatLoaded: boolean
17
26
  view: ViewState
18
27
  // The live streaming preview as a synthetic assistant turn (or null). Merged
19
28
  // into the transcript through the same groupTurns pipeline so a thinking-only
@@ -25,17 +34,11 @@ type ChatPanelProps = {
25
34
  processing: boolean
26
35
  error?: string | null
27
36
  onDismissError?: () => void
37
+ composerBanner?: ReactNode
28
38
  unavailableReason: string | null | undefined
29
- send: (text: string) => void
39
+ send: (text: string, options?: ChatSendOptions) => void
30
40
  stop: () => void
31
41
  onSwitchThread: (sessionId: string | null) => void
32
- // Extra content for the header's left edge, rendered before the thread
33
- // selector when the chat is the primary panel.
34
- headerLeft?: ReactNode
35
- // Extra controls for the header's right edge — the parent supplies whatever
36
- // chrome belongs here in the current layout (e.g. the section reopen toggle
37
- // plus MCP/settings menus when the chat is fullscreen).
38
- headerRight?: ReactNode
39
42
  // Floating popup: render a close (X) button that dismisses the popup.
40
43
  onClose?: () => void
41
44
  }
@@ -43,23 +46,34 @@ type ChatPanelProps = {
43
46
  export function ChatPanel({
44
47
  active = true,
45
48
  focusRequest = 0,
49
+ chatLoaded,
46
50
  view,
47
51
  previewTurn,
48
52
  sessionId,
49
53
  processing,
50
54
  error,
51
55
  onDismissError,
56
+ composerBanner,
52
57
  unavailableReason,
53
58
  send,
54
59
  stop,
55
60
  onSwitchThread,
56
- headerLeft,
57
- headerRight,
58
61
  onClose
59
62
  }: ChatPanelProps) {
63
+ const workspaceId = useWorkspaceId()
60
64
  const composerRef = useRef<HTMLTextAreaElement>(null)
61
65
  const scrollRef = useRef<HTMLDivElement>(null)
62
66
  const turns = view.turns
67
+ const hasSentMessageFromMoi = useUiStore(state => state.hasSentMessageFromMoi)
68
+ const isWorkspacePendingAnalysis = useUiStore(state =>
69
+ (state.workspaceIdsPendingAnalysis ?? []).includes(workspaceId)
70
+ )
71
+ const attachmentsUploading = useLive(state =>
72
+ (state.attachments[draftKey(workspaceId, sessionId ?? null)] ?? []).some(
73
+ attachment => attachment.status === 'uploading'
74
+ )
75
+ )
76
+ const promptDisabled = !canSubmitComposerAction(true, attachmentsUploading, unavailableReason)
63
77
  // Visual grouping: fold consecutive tool-only assistant turns into one
64
78
  // synthetic turn so OpenAI Codex–style traces (which serialize one
65
79
  // assistant message per agent step) don't render with the wider
@@ -70,9 +84,18 @@ export function ChatPanel({
70
84
  () => groupTurns(previewTurn ? [...turns, previewTurn] : turns),
71
85
  [turns, previewTurn]
72
86
  )
87
+ const showEmptyChat = chatLoaded && groupedTurns.length === 0 && !processing
88
+ const emptyStateKind = resolveChatEmptyState({
89
+ hasSentMessageFromMoi,
90
+ isWorkspacePendingAnalysis
91
+ })
73
92
 
74
93
  // Stick to the bottom while pinned; respect scroll-up; jump on thread switch.
75
- const { atBottom, scrollToBottom } = useStickToBottom(scrollRef, sessionId)
94
+ const { atBottom, scrollToBottom, scrollToTop } = useStickToBottom(scrollRef, sessionId)
95
+
96
+ useLayoutEffect(() => {
97
+ if (showEmptyChat && emptyStateKind !== 'empty') scrollToTop()
98
+ }, [showEmptyChat, emptyStateKind, scrollToTop])
76
99
 
77
100
  // The active chat surface owns initial focus. A monotonically increasing
78
101
  // request also refocuses an already-visible composer after intent actions.
@@ -83,28 +106,30 @@ export function ChatPanel({
83
106
  // Sending always returns the user to the bottom, even if they'd scrolled up —
84
107
  // they expect to see their message and the reply.
85
108
  const handleSend = useCallback(
86
- (text: string) => {
87
- send(text)
109
+ (text: string, options?: ChatSendOptions) => {
110
+ send(text, options)
88
111
  scrollToBottom()
89
112
  },
90
113
  [send, scrollToBottom]
91
114
  )
92
115
 
116
+ const handlePromptSelect = useCallback(
117
+ (prompt: ChatPromptBubble) => {
118
+ if (promptDisabled) return
119
+ handleSend(prompt.prompt, { directives: prompt.context })
120
+ },
121
+ [handleSend, promptDisabled]
122
+ )
123
+
93
124
  return (
94
125
  <div className="flex min-h-0 flex-1 flex-col pt-2 pb-3">
95
- <header className="flex items-center justify-between pr-2 pb-2 pl-2">
96
- <div className="flex min-w-0 items-center gap-2.5">
97
- {headerLeft}
98
- <ChatSelector onSwitch={onSwitchThread} />
99
- </div>
100
- <div className="flex items-center gap-0.5">
101
- {headerRight}
102
- {onClose && (
103
- <Button variant="ghost" size="icon" onClick={onClose} aria-label="Close chat">
104
- <IconX stroke={1.5} />
105
- </Button>
106
- )}
107
- </div>
126
+ <header className="mx-auto flex w-full max-w-[calc(var(--chat-max-container)+40px)] items-center justify-between pr-2 pb-2 pl-2">
127
+ <ChatSelector onSwitch={onSwitchThread} />
128
+ {onClose && (
129
+ <Button variant="ghost" size="icon" onClick={onClose} aria-label="Close chat">
130
+ <IconX stroke={1.5} />
131
+ </Button>
132
+ )}
108
133
  </header>
109
134
 
110
135
  <div className="relative flex min-h-0 flex-1 flex-col">
@@ -113,7 +138,13 @@ export function ChatPanel({
113
138
  className="flex scrollbar-thin flex-1 scroll-fade flex-col overflow-y-auto overscroll-contain px-5 pt-4 pb-12 [--scroll-fade-reveal:8px]"
114
139
  >
115
140
  <div className="mx-auto flex w-full max-w-(--chat-max-container) flex-1 flex-col gap-6">
116
- {turns.length === 0 && !processing && <EmptyState />}
141
+ {showEmptyChat && (
142
+ <ChatEmptyState
143
+ kind={emptyStateKind}
144
+ disabled={promptDisabled}
145
+ onSelectPrompt={handlePromptSelect}
146
+ />
147
+ )}
117
148
  {groupedTurns.map((turn, i) => (
118
149
  <TurnView
119
150
  key={turn.id}
@@ -143,31 +174,41 @@ export function ChatPanel({
143
174
  )}
144
175
  </div>
145
176
 
146
- <div className="mx-auto flex w-full flex-col items-center px-3">
147
- {error && (
148
- <div className="mb-2 flex w-full max-w-(--chat-max-container) items-start gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive">
149
- <span className="flex-1 wrap-break-word">{error}</span>
150
- {onDismissError && (
151
- <Button
152
- type="button"
153
- variant="ghost"
154
- size="icon-sm"
155
- onClick={onDismissError}
156
- className="-m-1"
157
- aria-label="Dismiss error"
158
- >
159
- <IconX stroke={1.75} />
160
- </Button>
161
- )}
162
- </div>
163
- )}
164
- <ChatComposer
165
- composerRef={composerRef}
166
- onSend={handleSend}
167
- onStop={stop}
168
- processing={processing}
169
- unavailableReason={unavailableReason}
170
- />
177
+ <div className="mx-auto flex w-full max-w-[calc(var(--chat-max-container)+24px)] flex-col px-3">
178
+ <div
179
+ className={cn(
180
+ '@container flex w-full flex-col transition-[padding]',
181
+ (composerBanner || error) && 'gap-1 rounded-2xl p-2',
182
+ composerBanner && 'bg-muted',
183
+ error && 'bg-destructive/10'
184
+ )}
185
+ >
186
+ {composerBanner}
187
+ {error && (
188
+ <div className="flex w-full items-start gap-2 px-3 py-2 text-sm text-destructive">
189
+ <span className="flex-1 wrap-break-word">{error}</span>
190
+ {onDismissError && (
191
+ <Button
192
+ type="button"
193
+ variant="ghost"
194
+ size="icon-sm"
195
+ onClick={onDismissError}
196
+ className="-m-1"
197
+ aria-label="Dismiss error"
198
+ >
199
+ <IconX stroke={1.75} />
200
+ </Button>
201
+ )}
202
+ </div>
203
+ )}
204
+ <ChatComposer
205
+ composerRef={composerRef}
206
+ onSend={handleSend}
207
+ onStop={stop}
208
+ processing={processing}
209
+ unavailableReason={unavailableReason}
210
+ />
211
+ </div>
171
212
  </div>
172
213
  </div>
173
214
  )
@@ -1,4 +1,4 @@
1
- import type { ReactNode, RefObject } from 'react'
1
+ import type { ReactNode } from 'react'
2
2
 
3
3
  import { motion } from 'motion/react'
4
4
 
@@ -11,19 +11,10 @@ type ChatPopupProps = {
11
11
  open: boolean
12
12
  onOpenChange: (open: boolean) => void
13
13
  onOpenChangeComplete: (open: boolean) => void
14
- // Portal target for the floating chat — pass the themed workspace wrapper so
15
- // the popup inherits its scoped CSS vars instead of landing on a bare body.
16
- container?: RefObject<HTMLElement | null>
17
14
  children: (onClose: () => void) => ReactNode
18
15
  }
19
16
 
20
- export function ChatPopup({
21
- open,
22
- onOpenChange,
23
- onOpenChangeComplete,
24
- container,
25
- children
26
- }: ChatPopupProps) {
17
+ export function ChatPopup({ open, onOpenChange, onOpenChangeComplete, children }: ChatPopupProps) {
27
18
  const onClose = () => onOpenChange(false)
28
19
 
29
20
  return (
@@ -46,7 +37,7 @@ export function ChatPopup({
46
37
  <Button
47
38
  variant="outline"
48
39
  size="icon-lg"
49
- className="shadow-md hover:shadow-lg"
40
+ className="bg-card shadow-md hover:shadow-lg"
50
41
  aria-label="Agent"
51
42
  >
52
43
  <IconGhost stroke={1.75} />
@@ -62,7 +53,6 @@ export function ChatPopup({
62
53
  alignOffset={-8}
63
54
  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"
64
55
  keepMounted
65
- container={container}
66
56
  >
67
57
  {children(onClose)}
68
58
  </PopoverContent>
@@ -0,0 +1,74 @@
1
+ import type { TablerIcon } from '@tabler/icons-react'
2
+
3
+ import { Button } from '@/client/components/ui/button'
4
+ import { cn } from '@/client/lib/cn'
5
+
6
+ export type ChatPromptBubble = {
7
+ label: string
8
+ prompt: string
9
+ context: readonly string[]
10
+ icon: TablerIcon
11
+ }
12
+
13
+ type ChatPromptBubbleProps = {
14
+ className?: string
15
+ prompt: ChatPromptBubble
16
+ disabled?: boolean
17
+ onSelect: (prompt: ChatPromptBubble) => void
18
+ }
19
+
20
+ export function ChatPromptBubble({
21
+ className,
22
+ prompt,
23
+ disabled = false,
24
+ onSelect
25
+ }: ChatPromptBubbleProps) {
26
+ const Icon = prompt.icon
27
+
28
+ return (
29
+ <Button
30
+ type="button"
31
+ variant="secondary"
32
+ size="sm"
33
+ disabled={disabled}
34
+ onClick={() => onSelect(prompt)}
35
+ className={cn(
36
+ 'h-auto items-start justify-start gap-2 rounded-xl p-3 px-4 text-left leading-snug whitespace-normal',
37
+ 'hover:bg-accent',
38
+ className
39
+ )}
40
+ >
41
+ <Icon stroke={2} aria-hidden className="mt-0.5 text-muted-foreground" />
42
+ <span>{prompt.label}</span>
43
+ </Button>
44
+ )
45
+ }
46
+
47
+ type ChatPromptBubblesProps = {
48
+ prompts: readonly ChatPromptBubble[]
49
+ disabled?: boolean
50
+ onSelect: (prompt: ChatPromptBubble) => void
51
+ }
52
+
53
+ export function ChatPromptBubbles({ prompts, disabled = false, onSelect }: ChatPromptBubblesProps) {
54
+ return (
55
+ <div className="grid w-full grid-cols-1 gap-3 py-2 sm:grid-cols-3">
56
+ {prompts.map((prompt, index) => {
57
+ return (
58
+ <ChatPromptBubble
59
+ key={prompt.prompt}
60
+ prompt={prompt}
61
+ disabled={disabled}
62
+ onSelect={onSelect}
63
+ className={cn(
64
+ 'h-full w-full',
65
+ index === 0 && 'translate-y-3 rotate-3 hover:translate-y-2.5',
66
+ index === 1 && 'translate-y-0 -rotate-1 hover:-translate-y-0.5',
67
+ index === 2 && 'translate-y-3 -rotate-4 hover:translate-y-2.5'
68
+ )}
69
+ />
70
+ )
71
+ })}
72
+ </div>
73
+ )
74
+ }
@@ -14,7 +14,7 @@ const components = {
14
14
  return (
15
15
  <code
16
16
  className={cn(
17
- 'rounded-[4px] bg-accent px-1 py-0.5 font-mono font-normal before:content-none after:content-none',
17
+ 'rounded-xs bg-accent px-1 py-0.5 font-mono font-normal before:content-none after:content-none',
18
18
  className
19
19
  )}
20
20
  {...props}
@@ -25,8 +25,8 @@ const components = {
25
25
  },
26
26
  pre({ children }: ComponentProps<'pre'>) {
27
27
  return (
28
- <div className="not-prose my-2 rounded-md border border-border bg-muted px-3 py-2.5">
29
- <pre className="max-h-[300px] overflow-auto font-mono text-xs leading-relaxed whitespace-pre text-foreground [&>code]:rounded-none [&>code]:bg-transparent [&>code]:p-0">
28
+ <div className="not-prose my-2 rounded-lg border border-border bg-muted px-3 py-2.5">
29
+ <pre className="overflow-auto font-mono text-xs leading-relaxed whitespace-pre text-foreground [&>code]:rounded-none [&>code]:bg-transparent [&>code]:p-0">
30
30
  {children}
31
31
  </pre>
32
32
  </div>
@@ -39,6 +39,10 @@ type MarkdownContentProps = {
39
39
  content: string
40
40
  }
41
41
 
42
+ type PlainMarkdownTextProps = {
43
+ content: string
44
+ }
45
+
42
46
  export function MarkdownContent({ size = 'sm', content }: MarkdownContentProps) {
43
47
  return (
44
48
  <div
@@ -57,3 +61,11 @@ export function MarkdownContent({ size = 'sm', content }: MarkdownContentProps)
57
61
  </div>
58
62
  )
59
63
  }
64
+
65
+ export function PlainMarkdownText({ content }: PlainMarkdownTextProps) {
66
+ return (
67
+ <ReactMarkdown allowedElements={[]} skipHtml unwrapDisallowed>
68
+ {content}
69
+ </ReactMarkdown>
70
+ )
71
+ }
@@ -174,7 +174,7 @@ export const ModelPicker = memo(function ModelPicker({ scope = 'active-chat' }:
174
174
 
175
175
  {showFastMode && (
176
176
  <DropdownMenuGroup className="mt-0.5">
177
- <label className="flex cursor-pointer items-center justify-between gap-4 rounded-xs px-2 py-1 text-sm">
177
+ <label className="flex cursor-pointer items-center justify-between gap-4 rounded-md px-2 py-1 text-sm">
178
178
  Fast mode
179
179
  <Switch checked={fastMode} onCheckedChange={setFastMode} />
180
180
  </label>
@@ -7,24 +7,13 @@ import { ToolCallGroup } from '@/client/features/chat/tool-group/ToolCallGroup'
7
7
  import { useWorkspaceLayoutCtx } from '@/client/features/workspace/WorkspaceLayoutContext'
8
8
  import type { Part, Turn } from '@/lib/types'
9
9
 
10
- export function EmptyState() {
11
- return (
12
- <div className="flex flex-1 flex-col items-center justify-center gap-1.5 text-center">
13
- <h2 className="font-medium">Every journey starts somewhere</h2>
14
- <p className="mx-auto max-w-sm text-sm text-muted-foreground">
15
- Chat with your agent, create widgets and views, and manage your workspace context from here.
16
- </p>
17
- </div>
18
- )
19
- }
20
-
21
10
  export function ThinkingIndicator() {
22
11
  return (
23
- <div className="flex items-center gap-1.5 px-1 py-3">
12
+ <div className="flex items-center gap-1 px-1 py-3">
24
13
  {[0, 1, 2].map(i => (
25
14
  <span
26
15
  key={i}
27
- className="block h-1.5 w-1.5 rounded-full bg-ring"
16
+ className="block h-1 w-1 rounded-full bg-ring"
28
17
  style={{
29
18
  animation: 'pulse-dot 1.4s ease-in-out infinite',
30
19
  animationDelay: `${i * 0.2}s`
@@ -124,7 +113,7 @@ export const TurnView = memo(function TurnView({ turn, processing = false }: Tur
124
113
  <FilePart key={i} mediaType={p.mediaType} url={p.url} filename={p.filename} />
125
114
  ))}
126
115
  {text && (
127
- <p className="max-w-full min-w-0 rounded-md bg-accent px-4 py-2 text-sm leading-normal wrap-anywhere whitespace-pre-wrap text-accent-foreground">
116
+ <p className="max-w-full min-w-0 rounded-lg bg-accent px-4 py-2 text-sm leading-normal wrap-anywhere whitespace-pre-wrap text-accent-foreground">
128
117
  {text}
129
118
  </p>
130
119
  )}
@@ -170,12 +159,12 @@ function FilePart({ mediaType, url, filename }: FilePartProps) {
170
159
  <img
171
160
  src={url}
172
161
  alt={filename ?? 'attachment'}
173
- className="max-h-64 max-w-full rounded-md border border-border object-contain"
162
+ className="max-h-64 max-w-full rounded-lg border border-border object-contain"
174
163
  />
175
164
  )
176
165
  }
177
166
  return (
178
- <div className="flex items-center gap-1.5 rounded-md border border-border bg-accent px-2.5 py-1.5 text-xs text-accent-foreground">
167
+ <div className="flex items-center gap-1.5 rounded-lg border border-border bg-accent px-2.5 py-1.5 text-xs text-accent-foreground">
179
168
  <IconFile size={16} stroke={1.75} />
180
169
  <span className="truncate">{filename ?? mediaType}</span>
181
170
  </div>
@@ -196,7 +185,7 @@ function DataPart({ name, data }: DataPartProps) {
196
185
  return (
197
186
  <details>
198
187
  <summary className="cursor-pointer text-xs text-muted-foreground">data:{name}</summary>
199
- <pre className="mt-1 overflow-auto rounded bg-muted p-2 text-xs text-muted-foreground">
188
+ <pre className="mt-1 overflow-auto rounded bg-muted p-2 font-mono text-xs text-muted-foreground">
200
189
  {JSON.stringify(data, null, 2)}
201
190
  </pre>
202
191
  </details>
@@ -1,11 +1,36 @@
1
1
  import type { QueryClient } from '@tanstack/react-query'
2
2
 
3
3
  import { workspaceKeys } from '@/client/api/workspace-keys'
4
- import { liveStore } from '@/client/features/chat/chat-store'
4
+ import { type ChatAttachment, draftKey, liveStore } from '@/client/features/chat/chat-store'
5
+ import type { MoiUserMessageOptions } from '@/client/features/workspace/moi-context'
5
6
  import { STREAM_RESPONSES } from '@/client/lib/flags'
6
7
  import { applyEvent, emptyViewState } from '@/lib/format'
7
8
  import type { Part, ViewState, WorkspaceModels } from '@/lib/types'
8
9
 
10
+ // What a caller may attach to one message beyond its text. All of it is
11
+ // envelope material — the agent sees it, the chat bubble does not.
12
+ export type ChatSendOptions = MoiUserMessageOptions
13
+
14
+ // Whether this send owns what the user has staged in the composer. Only a send
15
+ // FROM the composer does. An applet's message is not the message the user is
16
+ // building, so it must neither carry files they staged for their own message
17
+ // nor clear ones still uploading out from under them.
18
+ export function ownsComposerAttachments(options?: ChatSendOptions): boolean {
19
+ return !options?.applet
20
+ }
21
+
22
+ // The fully-uploaded attachments this send should carry — none for a send that
23
+ // doesn't own the composer's.
24
+ export function attachmentsForSend(
25
+ workspaceId: string,
26
+ sessionId: string | null,
27
+ options?: ChatSendOptions
28
+ ): ChatAttachment[] {
29
+ if (!ownsComposerAttachments(options)) return []
30
+ const pending = liveStore.getState().attachments[draftKey(workspaceId, sessionId)] ?? []
31
+ return pending.filter(a => a.status === 'ready' && a.upload)
32
+ }
33
+
9
34
  type StartOptimisticTurnInput = {
10
35
  queryClient: QueryClient
11
36
  workspaceId: string
@@ -35,7 +35,7 @@ export function CodeBlock({ code, className }: CodeBlockProps) {
35
35
  )}
36
36
  >
37
37
  {/* sugar-high escapes token text, so this HTML is safe to inject. */}
38
- <code dangerouslySetInnerHTML={{ __html: html }} />
38
+ <code className="font-mono" dangerouslySetInnerHTML={{ __html: html }} />
39
39
  </pre>
40
40
  )
41
41
  }
@@ -40,7 +40,7 @@ export function ReadImagePreview({ relPath }: ReadImagePreviewProps) {
40
40
  alt={relPath}
41
41
  loading="lazy"
42
42
  onError={() => setFailed(true)}
43
- className="max-h-64 max-w-full self-start rounded-md border border-border object-contain"
43
+ className="max-h-64 max-w-full self-start rounded-lg border border-border object-contain"
44
44
  />
45
45
  )
46
46
  }
@@ -114,7 +114,7 @@ export function SubagentCard({ call, cwd, isFirst, isLast, renderNestedParts }:
114
114
  the final summary (muted bg, roomier padding) below, split by a
115
115
  border. The divider + summary segment only render when there's a
116
116
  summary, so a steps-only card has no trailing border. */}
117
- <div className="mt-1 mb-1 overflow-hidden rounded-md border border-border">
117
+ <div className="mt-1 mb-1 overflow-hidden rounded-lg border border-border">
118
118
  {nestedParts.length > 0 && (
119
119
  <div className="py-1.5 pr-2 pl-3">{renderNestedParts(nestedParts, cwd)}</div>
120
120
  )}
@@ -47,10 +47,10 @@ export function TimelineRow({
47
47
  1px rule lands on a single pixel column instead of straddling two. */}
48
48
  <div className="relative w-[13px] shrink-0">
49
49
  {!isFirst && (
50
- <span className="absolute top-0 left-1/2 h-4 w-px -translate-x-1/2 bg-border" />
50
+ <span className="absolute top-0 left-1/2 h-3 w-px -translate-x-1/2 bg-border" />
51
51
  )}
52
52
  {!isLast && (
53
- <span className="absolute top-[15px] bottom-0 left-1/2 w-px -translate-x-1/2 bg-border" />
53
+ <span className="absolute top-[18px] bottom-0 left-1/2 w-px -translate-x-1/2 bg-border" />
54
54
  )}
55
55
  {marker ? (
56
56
  <span className="absolute top-[15px] left-1/2 z-10 -translate-x-1/2 -translate-y-1/2">
@@ -59,7 +59,7 @@ export function TimelineRow({
59
59
  ) : loading ? (
60
60
  // A spinner node stands in for the dot; bg-background carves the rule.
61
61
  <span className="absolute top-[15px] left-1/2 z-10 flex -translate-x-1/2 -translate-y-1/2 rounded-full bg-background p-0.5">
62
- <IconLoader2 size={12} stroke={1.75} className="animate-spin text-ring" />
62
+ <IconLoader2 size={12} stroke={1.75} className="animate-spin text-muted-foreground" />
63
63
  </span>
64
64
  ) : (
65
65
  // Background-colored ring carves a gap in the rule around the dot.
@@ -102,7 +102,7 @@ export function NodeBox({ children, className }: { children: ReactNode; classNam
102
102
  return (
103
103
  <span
104
104
  className={cn(
105
- 'flex size-4 items-center justify-center overflow-hidden rounded-[4px] bg-muted ring-2 ring-background',
105
+ 'flex size-4 items-center justify-center overflow-hidden rounded-xs bg-muted ring-2 ring-background',
106
106
  className
107
107
  )}
108
108
  >
@@ -15,6 +15,7 @@ import { type ReactNode, useState } from 'react'
15
15
  import { IconLoader2, IconPackage } from '@tabler/icons-react'
16
16
 
17
17
  import { cn } from '@/client/lib/cn'
18
+ import { PlainMarkdownText } from '@/client/features/chat/MarkdownContent'
18
19
  import { formatMcpServerName, getMcpIcon } from '@/client/features/connectors/mcp-icons'
19
20
  import type { Part, ToolCall } from '@/lib/types'
20
21
 
@@ -109,12 +110,18 @@ function ToolRow({ isFirst, isLast, call, leading, marker, name, brief, preview
109
110
  {leading}
110
111
  <span className="shrink-0 text-xs font-medium whitespace-nowrap">{name}</span>
111
112
  {brief && (
112
- <span className="min-w-0 self-baseline truncate text-[12px] text-ring">{brief}</span>
113
+ <span className="min-w-0 self-baseline truncate text-[12px] text-muted-foreground">
114
+ {brief}
115
+ </span>
113
116
  )}
114
117
  {/* Dotted rows spin at the node instead; only icon (MCP) rows, whose
115
118
  node can't spin, keep a header spinner. */}
116
119
  {isRunning && marker && (
117
- <IconLoader2 size={12} stroke={1.75} className="shrink-0 animate-spin text-ring" />
120
+ <IconLoader2
121
+ size={12}
122
+ stroke={1.75}
123
+ className="shrink-0 animate-spin text-muted-foreground"
124
+ />
118
125
  )}
119
126
  {hasBody && <RowChevron open={open} />}
120
127
  </button>
@@ -147,7 +154,7 @@ function ReasoningRow({ isFirst, isLast, text, inProgress = false }: ReasoningRo
147
154
  <div className="min-w-0 flex-1">
148
155
  <button
149
156
  type="button"
150
- title={`${label}: ${text}`}
157
+ aria-expanded={expanded}
151
158
  onClick={() => setOpen(o => !o)}
152
159
  className={cn(HEADER, 'cursor-pointer')}
153
160
  >
@@ -156,7 +163,7 @@ function ReasoningRow({ isFirst, isLast, text, inProgress = false }: ReasoningRo
156
163
  </button>
157
164
  <Collapse open={expanded}>
158
165
  <div className="mt-1 mb-1 pr-2 text-xs leading-relaxed whitespace-pre-wrap text-muted-foreground">
159
- {text}
166
+ <PlainMarkdownText content={text} />
160
167
  </div>
161
168
  </Collapse>
162
169
  </div>
@@ -191,7 +198,7 @@ function ToolCallCard({ call, cwd, isFirst, isLast }: ToolCallCardProps) {
191
198
  isLast={isLast}
192
199
  call={call}
193
200
  marker={succeeded ? <IconMarker icon={IconPackage} size={16} stroke={1.75} /> : undefined}
194
- name="Loading Skill"
201
+ name="Loading skill"
195
202
  brief={call.skill.skillName}
196
203
  />
197
204
  )
@@ -28,7 +28,7 @@ export function ToolOutput({ call, output, isError }: ToolOutputProps) {
28
28
  return (
29
29
  <div
30
30
  className={cn(
31
- 'rounded-md border',
31
+ 'rounded-lg border',
32
32
  isError ? 'border-destructive/30 bg-destructive/10' : 'border-border bg-muted'
33
33
  )}
34
34
  >
@@ -46,7 +46,7 @@ export function ToolOutput({ call, output, isError }: ToolOutputProps) {
46
46
  }
47
47
 
48
48
  return (
49
- <div className="overflow-hidden rounded-md border border-border bg-muted">
49
+ <div className="overflow-hidden rounded-lg border border-border bg-muted">
50
50
  {/* Size is always the raw output; copy grabs whatever's currently shown. */}
51
51
  <Header raw={raw} onRaw={setRaw} label={view.label} copyText={raw ? output : view.code} />
52
52
  {raw ? (