moi-computer 0.11.1-next.0 → 0.11.1-next.1
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/AGENTS.md +2 -2
- package/client/components/ui/button.tsx +1 -53
- package/client/components/ui/collapsible.tsx +1 -15
- package/client/components/ui/dialog.tsx +1 -58
- package/client/components/ui/dropdown-menu.tsx +1 -254
- package/client/components/ui/hover-card.tsx +1 -44
- package/client/components/ui/input.tsx +1 -21
- package/client/components/ui/popover.tsx +1 -88
- package/client/components/ui/resizable.tsx +1 -40
- package/client/components/ui/skeleton.tsx +1 -13
- package/client/components/ui/slider.tsx +1 -70
- package/client/components/ui/spinner.tsx +1 -18
- package/client/components/ui/switch.tsx +1 -23
- package/client/components/ui/tabs.tsx +1 -0
- package/client/components/ui/textarea.tsx +1 -18
- package/client/components/ui/tooltip.tsx +1 -51
- package/client/features/chat/ChatPanel.tsx +6 -6
- package/client/features/chat/ChatPopup.tsx +3 -4
- package/client/features/chat/TurnView.tsx +5 -4
- package/client/features/chat/api.ts +5 -14
- package/client/features/chat/chat-frames.ts +5 -2
- package/client/features/chat/composer/ChatComposer.tsx +5 -1
- package/client/features/chat/composer/ModelPicker.tsx +4 -3
- package/client/features/chat/composer/banners/ErrorBanner.tsx +20 -12
- package/client/features/chat/composer/useWorkspaceComposerState.tsx +15 -7
- package/client/features/chat/group-turns.ts +11 -0
- package/client/features/chat/session-view.ts +53 -0
- package/client/features/chat/useChat.ts +5 -1
- package/client/features/dev/ChatStatesPage.tsx +3 -1
- package/client/features/dev/DevIndexPage.tsx +5 -0
- package/client/features/dev/DevRoutes.tsx +2 -0
- package/client/features/dev/HarnessDebugPage.tsx +1 -1
- package/client/features/dev/UiComponentPreviews.tsx +834 -0
- package/client/features/dev/UiComponentsPage.tsx +60 -0
- package/client/features/home/WorkspacePreview.tsx +1 -1
- package/client/features/home/workspace-setup/DemoDialog.tsx +3 -2
- package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +5 -8
- package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +7 -20
- package/client/features/settings/SettingsLayout.tsx +1 -1
- package/client/features/settings/WorkspaceSettings.tsx +4 -1
- package/client/features/views/ViewManager.tsx +14 -9
- package/client/features/widgets/WidgetFrame.tsx +1 -1
- package/client/features/widgets/Widgets.tsx +1 -3
- package/client/features/workspace/WorkspaceScreen.tsx +5 -1
- package/client/features/workspace/WorkspaceSplitLayout.tsx +6 -1
- package/client/features/workspace/api.ts +2 -4
- package/client/index.css +22 -29
- package/dist/{chunk-tny85yt2.js → chunk-4s15axjs.js} +2 -2
- package/dist/{chunk-c9pjqx9m.js → chunk-53a7pxcz.js} +1 -1
- package/dist/chunk-6664vxpk.css +1 -0
- package/dist/{chunk-104m57qw.js → chunk-87thzbtw.js} +2 -2
- package/dist/chunk-a6jad1a6.js +1 -0
- package/dist/chunk-dghwstd2.js +9 -0
- package/dist/chunk-eg120aca.js +1 -0
- package/dist/{chunk-v7wr1df4.js → chunk-j3wvxjr7.js} +1 -1
- package/dist/chunk-vwjeezeb.js +1 -0
- package/dist/chunk-w482ew2c.js +546 -0
- package/dist/chunk-yc471zah.js +70 -0
- package/dist/index.html +1 -1
- package/lib/format.ts +49 -1
- package/lib/themes.ts +6 -6
- package/lib/types.ts +5 -7
- package/package.json +12 -5
- package/registry.json +643 -0
- package/server/agent.ts +1 -1
- package/server/api.ts +25 -29
- package/server/applets.ts +30 -29
- package/server/bundler/applet-css.ts +6 -1
- package/server/bundler/build-applet.ts +5 -1
- package/server/bundler/build-worker.ts +178 -0
- package/server/cli-ui-components.ts +28 -33
- package/server/cli.ts +6 -11
- package/server/data-dir.ts +1 -1
- package/server/harness/README.md +13 -9
- package/server/harness/acp/NOTES.md +426 -0
- package/server/harness/acp/discovery.ts +27 -30
- package/server/harness/acp/model-state.ts +57 -0
- package/server/harness/acp/session.ts +18 -6
- package/server/harness/claude-code/NOTES.md +47 -12
- package/server/harness/claude-code/cli.ts +40 -0
- package/server/harness/claude-code/index.ts +11 -5
- package/server/harness/claude-code/models.ts +72 -19
- package/server/harness/claude-code/session.ts +408 -299
- package/server/harness/hermes/NOTES.md +18 -0
- package/server/harness/hermes/discovery.ts +20 -0
- package/server/harness/hermes/index.ts +9 -0
- package/server/harness/hermes/models.ts +28 -8
- package/server/harness/types.ts +4 -2
- package/server/moi-scaffold.ts +1 -1
- package/server/preview.ts +3 -1
- package/server/registry.ts +63 -41
- package/server/tldraw-package.d.ts +4 -0
- package/server/ui-components.ts +101 -434
- package/server/view-builders.ts +2 -1
- package/server/web.ts +9 -5
- package/server/workspace-env.ts +3 -2
- package/tsconfig.json +0 -1
- package/ui-components/accordion.tsx +71 -0
- package/ui-components/alert-dialog.tsx +165 -0
- package/ui-components/alert.tsx +68 -0
- package/ui-components/attachment.tsx +195 -0
- package/ui-components/avatar.tsx +90 -0
- package/ui-components/badge.tsx +49 -0
- package/ui-components/button-group.tsx +78 -0
- package/ui-components/button.tsx +55 -0
- package/ui-components/calendar.tsx +180 -0
- package/ui-components/card.tsx +84 -0
- package/ui-components/carousel.tsx +235 -0
- package/ui-components/chart.tsx +338 -0
- package/ui-components/checkbox.tsx +27 -0
- package/ui-components/collapsible.tsx +15 -0
- package/ui-components/combobox.tsx +265 -0
- package/ui-components/context-menu.tsx +244 -0
- package/ui-components/dialog.tsx +138 -0
- package/ui-components/docs/accordion.md +463 -0
- package/ui-components/docs/alert-dialog.md +481 -0
- package/ui-components/docs/alert.md +301 -0
- package/ui-components/docs/attachment.md +689 -0
- package/ui-components/docs/avatar.md +495 -0
- package/ui-components/docs/badge.md +258 -0
- package/ui-components/docs/button-group.md +879 -0
- package/ui-components/docs/button.md +26 -0
- package/ui-components/docs/calendar.md +862 -0
- package/ui-components/docs/card.md +265 -0
- package/ui-components/docs/carousel.md +627 -0
- package/ui-components/docs/chart.md +1256 -0
- package/ui-components/docs/checkbox.md +477 -0
- package/ui-components/docs/collapsible.md +446 -0
- package/ui-components/docs/combobox.md +1003 -0
- package/ui-components/docs/context-menu.md +860 -0
- package/ui-components/docs/data-table.md +1580 -0
- package/ui-components/docs/date-picker.md +614 -0
- package/ui-components/docs/dialog.md +414 -0
- package/ui-components/docs/drawer.md +51 -0
- package/ui-components/docs/dropdown-menu.md +1000 -0
- package/ui-components/docs/field.md +1192 -0
- package/ui-components/docs/hover-card.md +275 -0
- package/ui-components/docs/input-group.md +866 -0
- package/ui-components/docs/input.md +456 -0
- package/ui-components/docs/label.md +295 -0
- package/ui-components/docs/pagination.md +416 -0
- package/ui-components/docs/popover.md +348 -0
- package/ui-components/docs/progress.md +214 -0
- package/ui-components/docs/radio-group.md +389 -0
- package/ui-components/docs/resizable.md +265 -0
- package/ui-components/docs/select.md +616 -0
- package/ui-components/docs/separator.md +216 -0
- package/ui-components/docs/skeleton.md +205 -0
- package/ui-components/docs/slider.md +226 -0
- package/ui-components/docs/spinner.md +332 -0
- package/ui-components/docs/switch.md +236 -0
- package/ui-components/docs/table.md +551 -0
- package/ui-components/docs/tabs.md +379 -0
- package/ui-components/docs/textarea.md +187 -0
- package/ui-components/docs/toggle-group.md +370 -0
- package/ui-components/docs/toggle.md +91 -0
- package/ui-components/docs/tooltip.md +290 -0
- package/ui-components/drawer.tsx +213 -0
- package/ui-components/dropdown-menu.tsx +263 -0
- package/ui-components/field.tsx +224 -0
- package/ui-components/hover-card.tsx +46 -0
- package/ui-components/input-group.tsx +146 -0
- package/ui-components/input.tsx +20 -0
- package/ui-components/label.tsx +17 -0
- package/ui-components/pagination.tsx +124 -0
- package/ui-components/popover.tsx +81 -0
- package/ui-components/progress.tsx +63 -0
- package/ui-components/radio-group.tsx +37 -0
- package/ui-components/resizable.tsx +40 -0
- package/ui-components/scoped-portal.tsx +31 -0
- package/ui-components/select.tsx +195 -0
- package/ui-components/separator.tsx +18 -0
- package/ui-components/skeleton.tsx +15 -0
- package/ui-components/slider.tsx +75 -0
- package/ui-components/spinner.tsx +20 -0
- package/ui-components/switch.tsx +26 -0
- package/ui-components/table.tsx +86 -0
- package/ui-components/tabs.tsx +75 -0
- package/ui-components/textarea.tsx +17 -0
- package/ui-components/toggle-group.tsx +85 -0
- package/ui-components/toggle.tsx +42 -0
- package/ui-components/tooltip.tsx +61 -0
- package/ui-components/utils.ts +8 -0
- package/workspace/.claude/skills/moi-workspace/SKILL.md +11 -20
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +4 -3
- package/workspace/.claude/skills/moi-workspace/references/UI-COMPONENTS.md +67 -203
- package/dist/chunk-59zf0m6n.js +0 -1
- package/dist/chunk-bj3akjs2.js +0 -1
- package/dist/chunk-j2w2vak4.js +0 -546
- package/dist/chunk-k2r9c95m.js +0 -10
- package/dist/chunk-kmbxhgwv.js +0 -1
- package/dist/chunk-p1yqa71k.js +0 -83
- package/dist/chunk-r5xrenjy.css +0 -1
|
@@ -1,70 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Slider as SliderPrimitive } from '@base-ui/react/slider'
|
|
4
|
-
|
|
5
|
-
import { cn } from '@/client/lib/cn'
|
|
6
|
-
|
|
7
|
-
function Slider({
|
|
8
|
-
children,
|
|
9
|
-
className,
|
|
10
|
-
defaultValue,
|
|
11
|
-
value,
|
|
12
|
-
min = 0,
|
|
13
|
-
max = 100,
|
|
14
|
-
...props
|
|
15
|
-
}: SliderPrimitive.Root.Props) {
|
|
16
|
-
const [animationReady, setAnimationReady] = useState(false)
|
|
17
|
-
const _values = Array.isArray(value)
|
|
18
|
-
? value
|
|
19
|
-
: Array.isArray(defaultValue)
|
|
20
|
-
? defaultValue
|
|
21
|
-
: [min, max]
|
|
22
|
-
|
|
23
|
-
// Let Base UI measure the initial positions before transitions are enabled.
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
const frame = requestAnimationFrame(() => setAnimationReady(true))
|
|
26
|
-
return () => cancelAnimationFrame(frame)
|
|
27
|
-
}, [])
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<SliderPrimitive.Root
|
|
31
|
-
className={cn('data-horizontal:w-full data-vertical:h-full', className)}
|
|
32
|
-
data-slot="slider"
|
|
33
|
-
defaultValue={defaultValue}
|
|
34
|
-
value={value}
|
|
35
|
-
min={min}
|
|
36
|
-
max={max}
|
|
37
|
-
thumbAlignment="edge"
|
|
38
|
-
{...props}
|
|
39
|
-
>
|
|
40
|
-
<SliderPrimitive.Control className="relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col">
|
|
41
|
-
<SliderPrimitive.Track
|
|
42
|
-
data-slot="slider-track"
|
|
43
|
-
className="relative grow overflow-hidden rounded-full bg-muted select-none data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1"
|
|
44
|
-
>
|
|
45
|
-
<SliderPrimitive.Indicator
|
|
46
|
-
data-slot="slider-range"
|
|
47
|
-
className={cn(
|
|
48
|
-
'bg-primary select-none data-horizontal:h-full data-vertical:w-full',
|
|
49
|
-
animationReady && 'transition-[width] duration-150 ease-in-out'
|
|
50
|
-
)}
|
|
51
|
-
/>
|
|
52
|
-
</SliderPrimitive.Track>
|
|
53
|
-
{children}
|
|
54
|
-
{Array.from({ length: _values.length }, (_, index) => (
|
|
55
|
-
<SliderPrimitive.Thumb
|
|
56
|
-
data-slot="slider-thumb"
|
|
57
|
-
key={index}
|
|
58
|
-
className={cn(
|
|
59
|
-
'relative block size-3 shrink-0 cursor-ew-resize rounded-full border border-ring bg-white ring-ring/50 select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50',
|
|
60
|
-
animationReady &&
|
|
61
|
-
'transition-[inset-inline-start,color,box-shadow] duration-150 ease-in-out'
|
|
62
|
-
)}
|
|
63
|
-
/>
|
|
64
|
-
))}
|
|
65
|
-
</SliderPrimitive.Control>
|
|
66
|
-
</SliderPrimitive.Root>
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { Slider }
|
|
1
|
+
export * from '@/ui-components/slider'
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { cn } from '@/client/lib/cn'
|
|
4
|
-
|
|
5
|
-
function Spinner({ className, ...props }: React.ComponentProps<typeof IconLoader2>) {
|
|
6
|
-
return (
|
|
7
|
-
<IconLoader2
|
|
8
|
-
data-slot="spinner"
|
|
9
|
-
role="status"
|
|
10
|
-
aria-label="Loading"
|
|
11
|
-
className={cn('size-4 animate-spin', className)}
|
|
12
|
-
stroke={1.75}
|
|
13
|
-
{...props}
|
|
14
|
-
/>
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { Spinner }
|
|
1
|
+
export * from '@/ui-components/spinner'
|
|
@@ -1,23 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { cn } from '@/client/lib/cn'
|
|
4
|
-
|
|
5
|
-
function Switch({ className, ...props }: SwitchPrimitive.Root.Props) {
|
|
6
|
-
return (
|
|
7
|
-
<SwitchPrimitive.Root
|
|
8
|
-
data-slot="switch"
|
|
9
|
-
className={cn(
|
|
10
|
-
'peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-xs transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-checked:bg-primary data-unchecked:bg-input',
|
|
11
|
-
className
|
|
12
|
-
)}
|
|
13
|
-
{...props}
|
|
14
|
-
>
|
|
15
|
-
<SwitchPrimitive.Thumb
|
|
16
|
-
data-slot="switch-thumb"
|
|
17
|
-
className="pointer-events-none block size-4 rounded-full bg-background shadow-sm ring-0 transition-transform data-checked:translate-x-4 data-unchecked:translate-x-0.5"
|
|
18
|
-
/>
|
|
19
|
-
</SwitchPrimitive.Root>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export { Switch }
|
|
1
|
+
export * from '@/ui-components/switch'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@/ui-components/tabs'
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { cn } from '@/client/lib/cn'
|
|
4
|
-
|
|
5
|
-
function Textarea({ className, ...props }: ComponentProps<'textarea'>) {
|
|
6
|
-
return (
|
|
7
|
-
<textarea
|
|
8
|
-
data-slot="textarea"
|
|
9
|
-
className={cn(
|
|
10
|
-
'flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-sm transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40',
|
|
11
|
-
className
|
|
12
|
-
)}
|
|
13
|
-
{...props}
|
|
14
|
-
/>
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { Textarea }
|
|
1
|
+
export * from '@/ui-components/textarea'
|
|
@@ -1,51 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { cn } from '@/client/lib/cn'
|
|
4
|
-
|
|
5
|
-
function TooltipProvider({ delay = 100, ...props }: TooltipPrimitive.Provider.Props) {
|
|
6
|
-
return <TooltipPrimitive.Provider data-slot="tooltip-provider" delay={delay} {...props} />
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function Tooltip({ ...props }: TooltipPrimitive.Root.Props) {
|
|
10
|
-
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {
|
|
14
|
-
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function TooltipContent({
|
|
18
|
-
className,
|
|
19
|
-
side = 'top',
|
|
20
|
-
sideOffset = 6,
|
|
21
|
-
align = 'center',
|
|
22
|
-
alignOffset = 0,
|
|
23
|
-
children,
|
|
24
|
-
...props
|
|
25
|
-
}: TooltipPrimitive.Popup.Props &
|
|
26
|
-
Pick<TooltipPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'>) {
|
|
27
|
-
return (
|
|
28
|
-
<TooltipPrimitive.Portal>
|
|
29
|
-
<TooltipPrimitive.Positioner
|
|
30
|
-
align={align}
|
|
31
|
-
alignOffset={alignOffset}
|
|
32
|
-
side={side}
|
|
33
|
-
sideOffset={sideOffset}
|
|
34
|
-
className="isolate z-50"
|
|
35
|
-
>
|
|
36
|
-
<TooltipPrimitive.Popup
|
|
37
|
-
data-slot="tooltip-content"
|
|
38
|
-
className={cn(
|
|
39
|
-
'z-50 flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-lg bg-popover px-2.5 py-1.5 text-xs font-medium text-popover-foreground shadow-md has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-lg data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
|
|
40
|
-
className
|
|
41
|
-
)}
|
|
42
|
-
{...props}
|
|
43
|
-
>
|
|
44
|
-
{children}
|
|
45
|
-
</TooltipPrimitive.Popup>
|
|
46
|
-
</TooltipPrimitive.Positioner>
|
|
47
|
-
</TooltipPrimitive.Portal>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider }
|
|
1
|
+
export * from '@/ui-components/tooltip'
|
|
@@ -5,7 +5,7 @@ import { IconChevronDown, IconChevronsRight, IconX } from '@tabler/icons-react'
|
|
|
5
5
|
import { canSubmitComposerAction, focusComposer } from '@/client/components/shared/Composer'
|
|
6
6
|
import { AgentBlobatar } from '@/client/components/shared/AgentBlobatar'
|
|
7
7
|
import { useStickToBottom } from '@/client/features/chat/useStickToBottom'
|
|
8
|
-
import { groupTurns } from '@/client/features/chat/group-turns'
|
|
8
|
+
import { appendPreviewTurn, groupTurns } from '@/client/features/chat/group-turns'
|
|
9
9
|
import { chatNoticeLabel, interleaveNotices } from '@/client/features/chat/interleave-notices'
|
|
10
10
|
import { attachmentKey, useLive } from '@/client/features/chat/chat-store'
|
|
11
11
|
import type { ChatPromptBubble } from '@/client/features/chat/ChatPromptBubbles'
|
|
@@ -45,7 +45,7 @@ type ChatPanelProps = {
|
|
|
45
45
|
hasWorkspaceApplets: boolean
|
|
46
46
|
view: ViewState
|
|
47
47
|
// The live streaming preview as a synthetic assistant turn (or null). Merged
|
|
48
|
-
// into the
|
|
48
|
+
// into the trailing assistant run so a thinking-only
|
|
49
49
|
// preview folds into the current tool group. See client/lib/preview-turn.ts.
|
|
50
50
|
previewTurn?: Turn | null
|
|
51
51
|
// Selected session id — used only as the scroll reset key (jump to bottom on
|
|
@@ -106,13 +106,13 @@ export function ChatPanel({
|
|
|
106
106
|
// synthetic turn so OpenAI Codex–style traces (which serialize one
|
|
107
107
|
// assistant message per agent step) don't render with the wider
|
|
108
108
|
// inter-turn gap between every tool call. See `dev/turn-spacing.md`.
|
|
109
|
-
//
|
|
110
|
-
// preview merges into the trailing tool group exactly like its finalized form.
|
|
109
|
+
// Group saved history once, then merge previews into just the trailing run.
|
|
111
110
|
const effectivePreviewTurn = builderDraft ? null : previewTurn
|
|
112
111
|
const notices = builderDraft ? EMPTY_NOTICES : view.notices
|
|
112
|
+
const savedGroups = useMemo(() => groupTurns(turns), [turns])
|
|
113
113
|
const groupedTurns = useMemo(
|
|
114
|
-
() =>
|
|
115
|
-
[
|
|
114
|
+
() => appendPreviewTurn(savedGroups, effectivePreviewTurn),
|
|
115
|
+
[savedGroups, effectivePreviewTurn]
|
|
116
116
|
)
|
|
117
117
|
// Grouped turns plus the renderable notices (compaction, model changes)
|
|
118
118
|
// woven in at the moment they happened. Interleaving runs AFTER grouping so
|
|
@@ -46,7 +46,7 @@ export function ChatPopup({
|
|
|
46
46
|
legible regardless of the active theme background. */}
|
|
47
47
|
<PopoverTrigger
|
|
48
48
|
render={
|
|
49
|
-
<div className="fixed right-
|
|
49
|
+
<div className="fixed right-3 bottom-3">
|
|
50
50
|
<motion.div
|
|
51
51
|
variants={{
|
|
52
52
|
from: { opacity: 0, scale: 0.8, filter: 'blur(4px)' },
|
|
@@ -59,7 +59,7 @@ export function ChatPopup({
|
|
|
59
59
|
>
|
|
60
60
|
<button
|
|
61
61
|
type="button"
|
|
62
|
-
className="group block cursor-pointer rounded-xl p-0 outline-none focus-visible:ring-3 focus-visible:ring-ring/50"
|
|
62
|
+
className="group block cursor-pointer rounded-xl p-0 drop-shadow-[0_0_4px_var(--primary-foreground)] outline-none focus-visible:ring-3 focus-visible:ring-ring/50"
|
|
63
63
|
aria-label="Agent"
|
|
64
64
|
>
|
|
65
65
|
<AgentBlobatar
|
|
@@ -80,9 +80,8 @@ export function ChatPopup({
|
|
|
80
80
|
}
|
|
81
81
|
/>
|
|
82
82
|
<PopoverContent
|
|
83
|
-
positionMethod="fixed"
|
|
84
83
|
side="top"
|
|
85
|
-
sideOffset={-
|
|
84
|
+
sideOffset={({ anchor }) => -anchor.height}
|
|
86
85
|
align="end"
|
|
87
86
|
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"
|
|
88
87
|
keepMounted
|
|
@@ -156,9 +156,8 @@ export function AssistantTurnParts({
|
|
|
156
156
|
|
|
157
157
|
type TurnViewProps = { turn: Turn; processing?: boolean }
|
|
158
158
|
|
|
159
|
-
//
|
|
160
|
-
//
|
|
161
|
-
// or `processing` actually changed.
|
|
159
|
+
// ChatPanel preserves completed groups during streaming, so token updates only
|
|
160
|
+
// render the active row. A changed transcript still refreshes the saved groups.
|
|
162
161
|
export const TurnView = memo(function TurnView({ turn, processing = false }: TurnViewProps) {
|
|
163
162
|
const cwd = useWorkspaceLayoutCtx().cwd
|
|
164
163
|
|
|
@@ -262,7 +261,9 @@ type DataPartProps = { name: string; data: unknown }
|
|
|
262
261
|
function DataPart({ name, data }: DataPartProps) {
|
|
263
262
|
return (
|
|
264
263
|
<details>
|
|
265
|
-
<summary className="cursor-pointer text-xs text-muted-foreground">
|
|
264
|
+
<summary className="cursor-pointer list-none text-xs text-muted-foreground marker:hidden [&::-webkit-details-marker]:hidden">
|
|
265
|
+
data:{name}
|
|
266
|
+
</summary>
|
|
266
267
|
<pre className="mt-1 overflow-auto rounded bg-muted p-2 font-mono text-xs text-muted-foreground">
|
|
267
268
|
{JSON.stringify(data, null, 2)}
|
|
268
269
|
</pre>
|
|
@@ -3,8 +3,8 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
|
|
3
3
|
import { jsonRequest, requestJson, requestVoid } from '@/client/api/http'
|
|
4
4
|
import { WORKSPACE_RESOURCE_OPTIONS } from '@/client/api/query-options'
|
|
5
5
|
import { workspaceKeys } from '@/client/api/workspace-keys'
|
|
6
|
-
import {
|
|
7
|
-
import type { SessionConfig, SessionInfo
|
|
6
|
+
import { sessionViewOptions } from '@/client/features/chat/session-view'
|
|
7
|
+
import type { SessionConfig, SessionInfo } from '@/lib/types'
|
|
8
8
|
|
|
9
9
|
export function useWorkspaceSessions(workspaceId: string) {
|
|
10
10
|
return useQuery<SessionInfo[]>({
|
|
@@ -42,18 +42,9 @@ export function useArchiveWorkspaceSession(workspaceId: string) {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export function useSessionView(workspaceId: string, sessionId: string | null) {
|
|
45
|
-
return useQuery
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const response = await fetch(`/api/workspaces/${workspaceId}/sessions/${sessionId}/events`)
|
|
49
|
-
const events: StreamEvent[] = response.ok ? await response.json() : []
|
|
50
|
-
return applyEvents(events)
|
|
51
|
-
},
|
|
52
|
-
enabled: Boolean(sessionId),
|
|
53
|
-
staleTime: Infinity,
|
|
54
|
-
gcTime: 5 * 60_000,
|
|
55
|
-
refetchOnMount: false,
|
|
56
|
-
refetchOnWindowFocus: false
|
|
45
|
+
return useQuery({
|
|
46
|
+
...sessionViewOptions(workspaceId, sessionId ?? ''),
|
|
47
|
+
enabled: Boolean(sessionId)
|
|
57
48
|
})
|
|
58
49
|
}
|
|
59
50
|
|
|
@@ -3,6 +3,7 @@ import type { QueryClient } from '@tanstack/react-query'
|
|
|
3
3
|
import { workspaceKeys } from '@/client/api/workspace-keys'
|
|
4
4
|
import { getScratchExecutor } from '@/client/features/scratchpad/scratch-executor'
|
|
5
5
|
import { liveStore } from '@/client/features/chat/chat-store'
|
|
6
|
+
import { bufferSessionEvent } from '@/client/features/chat/session-view'
|
|
6
7
|
import { renameSelectedSessionInCache } from '@/client/features/chat/useSelectedSession'
|
|
7
8
|
import { applyEvent } from '@/lib/format'
|
|
8
9
|
import type {
|
|
@@ -161,8 +162,10 @@ function patchView(
|
|
|
161
162
|
sessionId: string,
|
|
162
163
|
event: StreamEvent
|
|
163
164
|
) {
|
|
165
|
+
if (!queryClient) return
|
|
166
|
+
bufferSessionEvent(queryClient, workspaceId, sessionId, event)
|
|
164
167
|
const queryKey = workspaceKeys.events(workspaceId, sessionId)
|
|
165
|
-
const existing = queryClient
|
|
168
|
+
const existing = queryClient.getQueryData<ViewState>(queryKey)
|
|
166
169
|
if (existing === undefined) return
|
|
167
|
-
queryClient
|
|
170
|
+
queryClient.setQueryData<ViewState>(queryKey, applyEvent(existing, event))
|
|
168
171
|
}
|
|
@@ -364,7 +364,11 @@ function DrawingAttachmentChip({ attachment, onRemove }: DrawingAttachmentChipPr
|
|
|
364
364
|
<span>{label}</span>
|
|
365
365
|
</HoverCardTrigger>
|
|
366
366
|
{previewUrl && (
|
|
367
|
-
<HoverCardContent
|
|
367
|
+
<HoverCardContent
|
|
368
|
+
side="top"
|
|
369
|
+
align="start"
|
|
370
|
+
className="w-60 max-w-[calc(100vw-2rem)] rounded-xl"
|
|
371
|
+
>
|
|
368
372
|
<img
|
|
369
373
|
src={previewUrl}
|
|
370
374
|
alt={`${label} preview`}
|
|
@@ -172,7 +172,7 @@ function EffortPicker({
|
|
|
172
172
|
/>
|
|
173
173
|
}
|
|
174
174
|
/>
|
|
175
|
-
<PopoverContent align="end" side="top" className="w-64"
|
|
175
|
+
<PopoverContent align="end" side="top" className="w-64">
|
|
176
176
|
<PopoverHeader className="relative h-5 flex-row items-center">
|
|
177
177
|
<AnimatePresence mode="popLayout" initial={false}>
|
|
178
178
|
{dragging ? (
|
|
@@ -237,7 +237,7 @@ function EffortPicker({
|
|
|
237
237
|
<label className="block">
|
|
238
238
|
<span className="sr-only">Reasoning effort</span>
|
|
239
239
|
<Slider
|
|
240
|
-
value={draftIndex}
|
|
240
|
+
value={[draftIndex]}
|
|
241
241
|
min={0}
|
|
242
242
|
max={effortLevels.length - 1}
|
|
243
243
|
step={1}
|
|
@@ -252,8 +252,9 @@ function EffortPicker({
|
|
|
252
252
|
}}
|
|
253
253
|
className={cn(
|
|
254
254
|
'**:data-[slot=slider-track]:h-6 **:data-[slot=slider-track]:rounded-sm',
|
|
255
|
-
'**:data-[slot=slider-thumb]:h-6 **:data-[slot=slider-thumb]:w-5 **:data-[slot=slider-thumb]:rounded-sm **:data-[slot=slider-thumb]:
|
|
255
|
+
'**:data-[slot=slider-thumb]:h-6 **:data-[slot=slider-thumb]:w-5 **:data-[slot=slider-thumb]:rounded-sm **:data-[slot=slider-thumb]:ring-0'
|
|
256
256
|
)}
|
|
257
|
+
animate
|
|
257
258
|
>
|
|
258
259
|
<span
|
|
259
260
|
data-slot="slider-marks"
|
|
@@ -6,23 +6,31 @@ import { ComposerBannerShell } from './ComposerBanner'
|
|
|
6
6
|
|
|
7
7
|
type ErrorBannerProps = {
|
|
8
8
|
error: string
|
|
9
|
-
onDismiss
|
|
9
|
+
onDismiss?: () => void
|
|
10
|
+
onRetry?: () => void
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
export function ErrorBanner({ error, onDismiss }: ErrorBannerProps) {
|
|
13
|
+
export function ErrorBanner({ error, onDismiss, onRetry }: ErrorBannerProps) {
|
|
13
14
|
return (
|
|
14
15
|
<ComposerBannerShell role="alert" className="flex items-center gap-2 text-destructive">
|
|
15
16
|
<span className="flex-1 wrap-break-word">{error}</span>
|
|
16
|
-
|
|
17
|
-
type="button"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
{onRetry && (
|
|
18
|
+
<Button type="button" variant="ghost" size="sm" onClick={onRetry}>
|
|
19
|
+
Retry
|
|
20
|
+
</Button>
|
|
21
|
+
)}
|
|
22
|
+
{onDismiss && (
|
|
23
|
+
<Button
|
|
24
|
+
type="button"
|
|
25
|
+
variant="ghost"
|
|
26
|
+
size="icon-sm"
|
|
27
|
+
onClick={onDismiss}
|
|
28
|
+
className="text-destructive hover:text-destructive"
|
|
29
|
+
aria-label="Dismiss error"
|
|
30
|
+
>
|
|
31
|
+
<IconX stroke={1.75} />
|
|
32
|
+
</Button>
|
|
33
|
+
)}
|
|
26
34
|
</ComposerBannerShell>
|
|
27
35
|
)
|
|
28
36
|
}
|
|
@@ -10,6 +10,8 @@ import { useWorkspaceSkillUpdates } from './useWorkspaceSkillUpdates'
|
|
|
10
10
|
type WorkspaceComposerStateOptions = {
|
|
11
11
|
chatError: string | null
|
|
12
12
|
onDismissChatError: () => void
|
|
13
|
+
chatLoadError?: string | null
|
|
14
|
+
onRetryChatLoad?: () => void
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
type WorkspaceComposerState = {
|
|
@@ -20,7 +22,7 @@ type WorkspaceComposerState = {
|
|
|
20
22
|
|
|
21
23
|
export function useWorkspaceComposerState(
|
|
22
24
|
workspaceId: string,
|
|
23
|
-
{ chatError, onDismissChatError }: WorkspaceComposerStateOptions
|
|
25
|
+
{ chatError, onDismissChatError, chatLoadError, onRetryChatLoad }: WorkspaceComposerStateOptions
|
|
24
26
|
): WorkspaceComposerState {
|
|
25
27
|
const { data: agent, error } = useWorkspaceAgent(workspaceId)
|
|
26
28
|
const availability = agent?.availability
|
|
@@ -43,12 +45,18 @@ export function useWorkspaceComposerState(
|
|
|
43
45
|
)
|
|
44
46
|
}
|
|
45
47
|
: undefined
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
48
|
+
let chatErrorBanner: ComposerBanner | undefined
|
|
49
|
+
if (chatLoadError) {
|
|
50
|
+
chatErrorBanner = {
|
|
51
|
+
tone: 'error',
|
|
52
|
+
content: <ErrorBanner error={chatLoadError} onRetry={onRetryChatLoad} />
|
|
53
|
+
}
|
|
54
|
+
} else if (chatError) {
|
|
55
|
+
chatErrorBanner = {
|
|
56
|
+
tone: 'error',
|
|
57
|
+
content: <ErrorBanner error={chatError} onDismiss={onDismissChatError} />
|
|
58
|
+
}
|
|
59
|
+
}
|
|
52
60
|
const skillUpdate: ComposerBanner | undefined = skillUpdateBanner
|
|
53
61
|
? {
|
|
54
62
|
tone: 'default',
|
|
@@ -22,6 +22,17 @@ function mergeAssistantTurns(first: Turn, next: Turn): Turn {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
// Saved history is already grouped. A token update only changes its trailing
|
|
26
|
+
// assistant run; all completed rows keep their identities for React.memo.
|
|
27
|
+
export function appendPreviewTurn(grouped: Turn[], preview: Turn | null | undefined): Turn[] {
|
|
28
|
+
if (!preview) return grouped
|
|
29
|
+
const last = grouped.at(-1)
|
|
30
|
+
if (last?.role === 'assistant') {
|
|
31
|
+
return [...grouped.slice(0, -1), mergeAssistantTurns(last, preview)]
|
|
32
|
+
}
|
|
33
|
+
return [...grouped, preview]
|
|
34
|
+
}
|
|
35
|
+
|
|
25
36
|
export function groupTurns(turns: Turn[]): Turn[] {
|
|
26
37
|
const out: Turn[] = []
|
|
27
38
|
for (const t of turns) {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { queryOptions, type QueryClient } from '@tanstack/react-query'
|
|
2
|
+
|
|
3
|
+
import { requestJson } from '@/client/api/http'
|
|
4
|
+
import { workspaceKeys } from '@/client/api/workspace-keys'
|
|
5
|
+
import { applyEvents } from '@/lib/format'
|
|
6
|
+
import type { StreamEvent } from '@/lib/types'
|
|
7
|
+
|
|
8
|
+
type PendingFetch = {
|
|
9
|
+
workspaceId: string
|
|
10
|
+
sessionId: string
|
|
11
|
+
events: StreamEvent[]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const pendingFetches = new WeakMap<QueryClient, Set<PendingFetch>>()
|
|
15
|
+
|
|
16
|
+
// Keep socket events that arrive after an HTTP snapshot starts loading. This
|
|
17
|
+
// also covers the first load, before there is any cached view to patch.
|
|
18
|
+
export function bufferSessionEvent(
|
|
19
|
+
client: QueryClient,
|
|
20
|
+
workspaceId: string,
|
|
21
|
+
sessionId: string,
|
|
22
|
+
event: StreamEvent
|
|
23
|
+
) {
|
|
24
|
+
for (const pending of pendingFetches.get(client) ?? []) {
|
|
25
|
+
if (pending.workspaceId === workspaceId && pending.sessionId === sessionId) {
|
|
26
|
+
pending.events.push(event)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function sessionViewOptions(workspaceId: string, sessionId: string) {
|
|
32
|
+
return queryOptions({
|
|
33
|
+
queryKey: workspaceKeys.events(workspaceId, sessionId),
|
|
34
|
+
queryFn: async ({ client, signal }) => {
|
|
35
|
+
const requests = pendingFetches.get(client) ?? new Set<PendingFetch>()
|
|
36
|
+
pendingFetches.set(client, requests)
|
|
37
|
+
const pending: PendingFetch = { workspaceId, sessionId, events: [] }
|
|
38
|
+
requests.add(pending)
|
|
39
|
+
try {
|
|
40
|
+
const events = await requestJson<StreamEvent[]>(
|
|
41
|
+
`/api/workspaces/${workspaceId}/sessions/${sessionId}/events`,
|
|
42
|
+
{ signal },
|
|
43
|
+
'Couldn’t load chat'
|
|
44
|
+
)
|
|
45
|
+
return applyEvents([...events, ...pending.events])
|
|
46
|
+
} finally {
|
|
47
|
+
requests.delete(pending)
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
staleTime: Infinity,
|
|
51
|
+
gcTime: 5 * 60_000
|
|
52
|
+
})
|
|
53
|
+
}
|
|
@@ -74,12 +74,14 @@ export function useChat(address: WorkspaceTabAddress) {
|
|
|
74
74
|
)
|
|
75
75
|
|
|
76
76
|
const viewQuery = useSessionView(workspaceId, selectedSessionId)
|
|
77
|
+
const { refetch } = viewQuery
|
|
78
|
+
const retryLoad = useCallback(() => void refetch(), [refetch])
|
|
77
79
|
const view = viewQuery.data ?? EMPTY
|
|
78
80
|
const chatLoaded =
|
|
79
81
|
sessions !== undefined && (selectedSessionId === null || viewQuery.data !== undefined)
|
|
80
82
|
|
|
81
83
|
// The live streaming preview as a synthetic assistant turn, so the ChatPanel
|
|
82
|
-
// can
|
|
84
|
+
// can merge it into the trailing assistant run — a
|
|
83
85
|
// thinking-only preview then folds into the current tool group instead of
|
|
84
86
|
// rendering as a detached block. The selector returns the stored root-preview
|
|
85
87
|
// object for THIS session (not the whole slice): deltas for other sessions
|
|
@@ -210,6 +212,8 @@ export function useChat(address: WorkspaceTabAddress) {
|
|
|
210
212
|
sessionId: selectedSessionId,
|
|
211
213
|
processing,
|
|
212
214
|
error,
|
|
215
|
+
loadError: viewQuery.error?.message ?? null,
|
|
216
|
+
retryLoad,
|
|
213
217
|
send,
|
|
214
218
|
stop,
|
|
215
219
|
selectSession,
|
|
@@ -336,7 +336,9 @@ export function ChatStatesPage() {
|
|
|
336
336
|
</div>
|
|
337
337
|
|
|
338
338
|
<details className="mt-16 border-t border-border pt-6 text-xs text-muted-foreground">
|
|
339
|
-
<summary className="cursor-pointer font-medium
|
|
339
|
+
<summary className="cursor-pointer list-none font-medium marker:hidden [&::-webkit-details-marker]:hidden">
|
|
340
|
+
Notes for designers
|
|
341
|
+
</summary>
|
|
340
342
|
<ul className="mt-3 flex list-disc flex-col gap-1.5 pl-4">
|
|
341
343
|
<li>
|
|
342
344
|
User bubbles render markdown verbatim (whitespace preserved, no markdown parsing)
|
|
@@ -23,6 +23,11 @@ const DEV_ROUTES: DevRouteEntry[] = [
|
|
|
23
23
|
title: 'Tool calls',
|
|
24
24
|
description: 'Tool-call group fixtures: single and merged runs, live states, subagent traces.'
|
|
25
25
|
},
|
|
26
|
+
{
|
|
27
|
+
path: '/dev/ui-components',
|
|
28
|
+
title: 'UI components',
|
|
29
|
+
description: 'Interactive previews for every component in the local moi registry.'
|
|
30
|
+
},
|
|
26
31
|
{
|
|
27
32
|
path: '/dev/textures',
|
|
28
33
|
title: 'Texture lab',
|
|
@@ -6,6 +6,7 @@ import { DevIndexPage } from './DevIndexPage'
|
|
|
6
6
|
import { HarnessDebugPage } from './HarnessDebugPage'
|
|
7
7
|
import { TextureLabPage } from './TextureLabPage'
|
|
8
8
|
import { ToolCallsPage } from './ToolCallsPage'
|
|
9
|
+
import { UiComponentsPage } from './UiComponentsPage'
|
|
9
10
|
|
|
10
11
|
// All /dev/* routes, colocated with their pages so the whole dev playground
|
|
11
12
|
// (and its dependencies) lives in this folder and loads as one lazy chunk —
|
|
@@ -19,6 +20,7 @@ export default function DevRoutes() {
|
|
|
19
20
|
<Route path="/dev/chat-states" component={ChatStatesPage} />
|
|
20
21
|
<Route path="/dev/tool-calls" component={ToolCallsPage} />
|
|
21
22
|
<Route path="/dev/textures" component={TextureLabPage} />
|
|
23
|
+
<Route path="/dev/ui-components" component={UiComponentsPage} />
|
|
22
24
|
<Route path="/dev" component={DevIndexPage} />
|
|
23
25
|
</Switch>
|
|
24
26
|
)
|
|
@@ -99,7 +99,7 @@ type LogRowProps = {
|
|
|
99
99
|
function LogRow({ time, badge, badgeClass, label, body }: LogRowProps) {
|
|
100
100
|
return (
|
|
101
101
|
<details className="group border-b border-border/40 px-2 py-1 text-[11px] leading-tight">
|
|
102
|
-
<summary className="flex cursor-pointer items-baseline gap-2 font-mono whitespace-nowrap">
|
|
102
|
+
<summary className="flex cursor-pointer list-none items-baseline gap-2 font-mono whitespace-nowrap marker:hidden [&::-webkit-details-marker]:hidden">
|
|
103
103
|
<span className="text-muted-foreground/60 tabular-nums">{ts(time)}</span>
|
|
104
104
|
<span className={cn('rounded px-1 font-semibold', badgeClass)}>{badge}</span>
|
|
105
105
|
<span className="shrink-0 font-semibold">{label}</span>
|