moi-computer 0.8.0 → 0.9.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.
- package/client/api/workspace-keys.ts +1 -2
- package/client/app/AppRouter.tsx +10 -3
- package/client/app/routes/HomeRoute.tsx +1 -1
- package/client/app/shell/SidebarLayout.tsx +2 -14
- package/client/components/shared/Composer.tsx +20 -7
- package/client/components/shared/PanelHeader.tsx +8 -1
- package/client/components/ui/button.tsx +3 -3
- package/client/components/ui/dialog.tsx +1 -1
- package/client/components/ui/dropdown-menu.tsx +2 -2
- package/client/components/ui/hover-card.tsx +1 -1
- package/client/components/ui/popover.tsx +1 -1
- package/client/components/ui/resizable.tsx +40 -0
- package/client/features/chat/ChatEmptyState.tsx +9 -11
- package/client/features/chat/ChatPanel.tsx +76 -48
- package/client/features/chat/ChatPopup.tsx +16 -2
- package/client/features/chat/ChatPromptBubbles.tsx +6 -8
- package/client/features/chat/ChatSelector.tsx +24 -7
- package/client/features/chat/MarkdownContent.tsx +1 -1
- package/client/features/chat/ModelPicker.tsx +5 -4
- package/client/features/chat/TurnView.tsx +108 -13
- package/client/features/chat/api.ts +1 -18
- package/client/features/chat/chat-send.ts +2 -2
- package/client/features/chat/{ChatComposer.tsx → composer/ChatComposer.tsx} +6 -5
- package/client/features/chat/composer/banners/ChatErrorBanner.tsx +28 -0
- package/client/features/chat/composer/banners/ComposerBanner.tsx +30 -0
- package/client/features/chat/composer/banners/WorkspaceAgentAvailabilityBanner.tsx +91 -0
- package/client/features/{workspace → chat/composer/banners}/WorkspaceSkillUpdateBanner.tsx +9 -7
- package/client/features/chat/composer/useWorkspaceComposerState.tsx +74 -0
- package/client/features/{workspace → chat/composer}/useWorkspaceSkillUpdates.ts +1 -1
- package/client/features/chat/group-turns.ts +46 -28
- package/client/features/chat/interleave-notices.ts +84 -0
- package/client/features/chat/model-order.ts +9 -3
- package/client/features/chat/tool-group/TimelineRow.tsx +23 -11
- package/client/features/chat/tool-group/ToolCallGroup.tsx +38 -3
- package/client/features/chat/tool-group/format.ts +51 -10
- package/client/features/chat/useAppletChatMessage.ts +11 -16
- package/client/features/chat/useChat.ts +3 -7
- package/client/features/dev/ChatStatesPage.tsx +466 -0
- package/client/features/dev/DevIndexPage.tsx +52 -0
- package/client/features/dev/DevRoutes.tsx +6 -3
- package/client/features/dev/HarnessDebugPage.tsx +3 -3
- package/client/features/dev/chat-states-fixtures.ts +744 -0
- package/client/features/scratchpad/Scratchpad.tsx +4 -0
- package/client/features/scratchpad/scratch-session.ts +71 -0
- package/client/features/views/ViewBuilderTab.tsx +5 -4
- package/client/features/views/useViewBuilderActions.ts +2 -2
- package/client/features/workspace/WorkspaceLayoutContext.tsx +4 -2
- package/client/features/workspace/WorkspaceScreen.tsx +128 -146
- package/client/features/workspace/WorkspaceSplitLayout.tsx +111 -0
- package/client/features/workspace/api.ts +33 -8
- package/client/features/workspace/useFitsSplitLayout.ts +31 -5
- package/client/index.css +1 -1
- package/client/lib/flags.ts +4 -3
- package/client/runtime/useWorkspaceEvents.ts +18 -1
- package/client/store/ui.ts +5 -1
- package/dist/{chunk-0pcdwjkp.js → chunk-2vaafjp4.js} +1 -1
- package/dist/{chunk-9y2zbzqz.js → chunk-35fq49qa.js} +1 -1
- package/dist/{chunk-h9h8f176.js → chunk-3b3rkjet.js} +1 -1
- package/dist/chunk-gt7n06ef.js +1 -0
- package/dist/{chunk-r5ce5cdg.js → chunk-kkj86722.js} +75 -75
- package/dist/chunk-ty1sqbmn.js +80 -0
- package/dist/chunk-xeyxk7ep.js +10 -0
- package/dist/chunk-yz6wd5vc.css +1 -0
- package/dist/index.html +1 -1
- package/lib/format.ts +37 -7
- package/lib/themes.ts +2 -2
- package/lib/types.ts +38 -8
- package/lib/workspace-layout.ts +2 -2
- package/package.json +6 -4
- package/server/agent.ts +199 -0
- package/server/api.ts +36 -17
- package/server/bundler/build-applet.ts +35 -44
- package/server/cli-env.ts +2 -2
- package/server/cli.ts +39 -53
- package/server/constants.ts +8 -0
- package/server/control-client.ts +124 -0
- package/server/control.ts +2 -2
- package/server/env-apply.ts +4 -0
- package/server/harness/README.md +32 -12
- package/server/harness/claude-code/auth.ts +54 -0
- package/server/harness/claude-code/index.ts +6 -1
- package/server/harness/codex/adapter.ts +9 -1
- package/server/harness/codex/auth.ts +50 -0
- package/server/harness/codex/index.ts +6 -1
- package/server/harness/codex/session.ts +33 -14
- package/server/harness/openclaw/NOTES.md +619 -186
- package/server/harness/openclaw/adapter.ts +121 -54
- package/server/harness/openclaw/compat.ts +95 -0
- package/server/harness/openclaw/cron-view.ts +78 -0
- package/server/harness/openclaw/discovery.ts +145 -52
- package/server/harness/openclaw/gateway.ts +224 -36
- package/server/harness/openclaw/index.ts +56 -21
- package/server/harness/openclaw/session.ts +1002 -67
- package/server/harness/openclaw/strip.ts +71 -23
- package/server/harness/openclaw/thinking.ts +150 -0
- package/server/harness/types.ts +10 -5
- package/server/layout.ts +5 -2
- package/server/service.ts +2 -2
- package/workspace/.claude/skills/moi-workspace/SKILL.md +6 -6
- package/workspace/.claude/skills/moi-workspace/{DESIGN.md → references/DESIGN.md} +19 -9
- package/client/features/dev/PixelPainter.tsx +0 -94
- package/client/features/dev/PlaygroundPage.tsx +0 -69
- package/dist/chunk-0k7brsms.js +0 -9
- package/dist/chunk-dfs36zgc.js +0 -1
- package/dist/chunk-dtwxpxbg.js +0 -51
- package/dist/chunk-ga7t9qsk.js +0 -2
- package/dist/chunk-tey2nq7c.js +0 -31
- package/dist/chunk-z73xpsa0.js +0 -50
- package/dist/chunk-zzgredta.css +0 -1
- /package/workspace/.claude/skills/moi-workspace/{SCRATCHPAD.md → references/SCRATCHPAD.md} +0 -0
|
@@ -12,8 +12,7 @@ export const workspaceKeys = {
|
|
|
12
12
|
sessionConfig: (id: string, sessionId: string) =>
|
|
13
13
|
['workspaces', 'sessionConfig', id, sessionId] as const,
|
|
14
14
|
mcp: (id: string) => ['workspaces', 'mcp', id] as const,
|
|
15
|
-
|
|
16
|
-
availability: (id: string) => ['workspaces', 'availability', id] as const,
|
|
15
|
+
agent: (id: string) => ['workspaces', 'agent', id] as const,
|
|
17
16
|
skills: (id: string) => ['workspaces', 'skills', id] as const,
|
|
18
17
|
env: (id: string) => ['workspaces', 'env', id] as const
|
|
19
18
|
}
|
package/client/app/AppRouter.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Suspense, lazy, useEffect } from 'react'
|
|
2
2
|
|
|
3
|
-
import { Route, Switch, useLocation } from 'wouter'
|
|
3
|
+
import { Redirect, Route, Switch, useLocation } from 'wouter'
|
|
4
4
|
|
|
5
5
|
import { setWorkspaceSwitchHandler } from '@/client/features/chat/chat-connection'
|
|
6
6
|
|
|
@@ -8,10 +8,17 @@ import { HomeRoute } from './routes/HomeRoute'
|
|
|
8
8
|
import { WorkspaceRoute } from './routes/WorkspaceRoute'
|
|
9
9
|
|
|
10
10
|
// Dev-only playground routes: colocated in features/dev and loaded as a
|
|
11
|
-
// separate lazy chunk
|
|
12
|
-
|
|
11
|
+
// separate lazy chunk. The NODE_ENV gate is statically false in the prod
|
|
12
|
+
// build (scripts/build-client.ts defines it), so the bundler drops the
|
|
13
|
+
// dynamic import and none of features/dev is emitted into dist at all —
|
|
14
|
+
// same mechanism as DevAgentation in main.tsx. In prod /dev redirects home.
|
|
15
|
+
const DevRoutes =
|
|
16
|
+
process.env.NODE_ENV === 'development'
|
|
17
|
+
? lazy(() => import('@/client/features/dev/DevRoutes'))
|
|
18
|
+
: null
|
|
13
19
|
|
|
14
20
|
function DevLazy() {
|
|
21
|
+
if (!DevRoutes) return <Redirect to="/" />
|
|
15
22
|
return (
|
|
16
23
|
<Suspense fallback={null}>
|
|
17
24
|
<DevRoutes />
|
|
@@ -4,7 +4,7 @@ import { HomePage } from '@/client/features/home/HomePage'
|
|
|
4
4
|
// The `/` route: the app shell wrapping the workspaces view.
|
|
5
5
|
export function HomeRoute() {
|
|
6
6
|
return (
|
|
7
|
-
<SidebarLayout
|
|
7
|
+
<SidebarLayout showWorkspaces={false}>
|
|
8
8
|
<div className="min-h-0 flex-1 overflow-y-auto">
|
|
9
9
|
<HomePage />
|
|
10
10
|
</div>
|
|
@@ -29,17 +29,12 @@ type SidebarLayoutProps = {
|
|
|
29
29
|
// Full panel content — the page supplies its own header (compose it with
|
|
30
30
|
// <PanelHeader>) and body.
|
|
31
31
|
children?: ReactNode
|
|
32
|
-
panel?: 'default' | 'flat'
|
|
33
32
|
showWorkspaces?: boolean
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
// App shell: a slim icon rail beside the page content. The page owns the panel's
|
|
37
36
|
// header and body.
|
|
38
|
-
export function SidebarLayout({
|
|
39
|
-
children,
|
|
40
|
-
panel = 'default',
|
|
41
|
-
showWorkspaces = true
|
|
42
|
-
}: SidebarLayoutProps) {
|
|
37
|
+
export function SidebarLayout({ children, showWorkspaces = true }: SidebarLayoutProps) {
|
|
43
38
|
const { data: workspaces } = useWorkspaces()
|
|
44
39
|
|
|
45
40
|
// `moi config` / the settings modal broadcast `workspace:updated` (identity
|
|
@@ -57,14 +52,7 @@ export function SidebarLayout({
|
|
|
57
52
|
return (
|
|
58
53
|
<div className={cn('flex h-dvh bg-muted')}>
|
|
59
54
|
<Sidebar workspaces={showWorkspaces ? (workspaces ?? []) : []} />
|
|
60
|
-
<main
|
|
61
|
-
className={cn(
|
|
62
|
-
'flex min-w-0 flex-1 flex-col overflow-hidden',
|
|
63
|
-
panel === 'default' && 'bg-background shadow-xs'
|
|
64
|
-
)}
|
|
65
|
-
>
|
|
66
|
-
{children}
|
|
67
|
-
</main>
|
|
55
|
+
<main className="flex min-w-0 flex-1 flex-col">{children}</main>
|
|
68
56
|
</div>
|
|
69
57
|
)
|
|
70
58
|
}
|
|
@@ -77,12 +77,24 @@ export function ComposerFooter({ className, children, ...props }: ComposerFooter
|
|
|
77
77
|
)
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
export type ComposerAvailability =
|
|
81
|
+
| { status: 'checking' }
|
|
82
|
+
| { status: 'available' }
|
|
83
|
+
| { status: 'unavailable' }
|
|
84
|
+
|
|
85
|
+
export function composerAvailabilityTooltip(
|
|
86
|
+
availability: ComposerAvailability
|
|
87
|
+
): string | undefined {
|
|
88
|
+
if (availability.status === 'checking') return 'Checking agent status…'
|
|
89
|
+
return undefined
|
|
90
|
+
}
|
|
91
|
+
|
|
80
92
|
export function canSubmitComposerAction(
|
|
81
93
|
hasContent: boolean,
|
|
82
94
|
busy: boolean,
|
|
83
|
-
|
|
95
|
+
availability: ComposerAvailability
|
|
84
96
|
): boolean {
|
|
85
|
-
return hasContent && !busy &&
|
|
97
|
+
return hasContent && !busy && availability.status === 'available'
|
|
86
98
|
}
|
|
87
99
|
|
|
88
100
|
type ComposerSubmitButtonProps = {
|
|
@@ -90,7 +102,7 @@ type ComposerSubmitButtonProps = {
|
|
|
90
102
|
hasContent: boolean
|
|
91
103
|
busy?: boolean
|
|
92
104
|
loading?: boolean
|
|
93
|
-
|
|
105
|
+
availability: ComposerAvailability
|
|
94
106
|
}
|
|
95
107
|
|
|
96
108
|
export function ComposerSubmitButton({
|
|
@@ -98,21 +110,22 @@ export function ComposerSubmitButton({
|
|
|
98
110
|
hasContent,
|
|
99
111
|
busy = false,
|
|
100
112
|
loading = false,
|
|
101
|
-
|
|
113
|
+
availability
|
|
102
114
|
}: ComposerSubmitButtonProps) {
|
|
103
|
-
const canSubmit = canSubmitComposerAction(hasContent, busy || loading,
|
|
115
|
+
const canSubmit = canSubmitComposerAction(hasContent, busy || loading, availability)
|
|
116
|
+
const availabilityTooltip = composerAvailabilityTooltip(availability)
|
|
104
117
|
const button = (
|
|
105
118
|
<Button type="submit" size="icon" disabled={!canSubmit} aria-label={label}>
|
|
106
119
|
{loading ? <Spinner /> : <IconArrowUp stroke={1.5} />}
|
|
107
120
|
</Button>
|
|
108
121
|
)
|
|
109
122
|
|
|
110
|
-
if (loading || !
|
|
123
|
+
if (loading || !availabilityTooltip) return button
|
|
111
124
|
|
|
112
125
|
return (
|
|
113
126
|
<Tooltip>
|
|
114
127
|
<TooltipTrigger render={<span className="inline-flex">{button}</span>} />
|
|
115
|
-
<TooltipContent className="max-w-64 text-center">{
|
|
128
|
+
<TooltipContent className="max-w-64 text-center">{availabilityTooltip}</TooltipContent>
|
|
116
129
|
</Tooltip>
|
|
117
130
|
)
|
|
118
131
|
}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import { cn } from '@/client/lib/cn'
|
|
1
2
|
import type { ReactNode } from 'react'
|
|
2
3
|
|
|
3
4
|
export function PanelHeader({ children }: { children?: ReactNode }) {
|
|
4
5
|
return (
|
|
5
|
-
<header
|
|
6
|
+
<header
|
|
7
|
+
className={cn(
|
|
8
|
+
'@container relative flex shrink-0 items-center gap-2.5 py-2 pr-3 pl-4',
|
|
9
|
+
// Header bottom border that overflows the tab content and contrasts with it
|
|
10
|
+
'after:absolute after:top-full after:left-0 after:h-px after:w-full after:bg-border'
|
|
11
|
+
)}
|
|
12
|
+
>
|
|
6
13
|
{children}
|
|
7
14
|
</header>
|
|
8
15
|
)
|
|
@@ -4,12 +4,12 @@ import { type VariantProps, cva } from 'class-variance-authority'
|
|
|
4
4
|
import { cn } from '@/client/lib/cn'
|
|
5
5
|
|
|
6
6
|
const buttonVariants = cva(
|
|
7
|
-
'inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
|
|
7
|
+
'inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-lg text-sm font-medium whitespace-nowrap transition-all duration-100 outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
11
11
|
default:
|
|
12
|
-
'bg-primary text-primary-foreground hover:bg-primary/90 disabled:bg-
|
|
12
|
+
'bg-primary text-primary-foreground hover:bg-primary/90 disabled:bg-accent disabled:text-muted-foreground disabled:opacity-100',
|
|
13
13
|
secondary:
|
|
14
14
|
'bg-accent text-foreground hover:bg-[color-mix(in_oklch,var(--accent),var(--foreground)_5%)] hover:text-accent-foreground',
|
|
15
15
|
outline: 'bg-background shadow-xs hover:text-accent-foreground hover:shadow-sm',
|
|
@@ -18,7 +18,7 @@ const buttonVariants = cva(
|
|
|
18
18
|
'bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20'
|
|
19
19
|
},
|
|
20
20
|
size: {
|
|
21
|
-
sm: 'h-7 gap-1.5 rounded-md px-2.5
|
|
21
|
+
sm: 'h-7 gap-1.5 rounded-md px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg]:size-4',
|
|
22
22
|
default:
|
|
23
23
|
'h-8 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5 [&_svg]:size-5',
|
|
24
24
|
lg: 'h-10 rounded-xl px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3 [&_svg]:size-5',
|
|
@@ -24,7 +24,7 @@ function DialogContent({ className, children, ...props }: DialogPrimitive.Popup.
|
|
|
24
24
|
<DialogPrimitive.Popup
|
|
25
25
|
data-slot="dialog-content"
|
|
26
26
|
className={cn(
|
|
27
|
-
'fixed top-1/2 left-1/2 z-50 origin-center -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-xl bg-card text-card-foreground shadow-xl
|
|
27
|
+
'fixed top-1/2 left-1/2 z-50 origin-center -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-xl bg-card text-card-foreground shadow-xl outline-hidden duration-150 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',
|
|
28
28
|
className
|
|
29
29
|
)}
|
|
30
30
|
{...props}
|
|
@@ -38,7 +38,7 @@ function DropdownMenuContent({
|
|
|
38
38
|
<MenuPrimitive.Popup
|
|
39
39
|
data-slot="dropdown-menu-content"
|
|
40
40
|
className={cn(
|
|
41
|
-
'z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md
|
|
41
|
+
'z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md duration-100 outline-none 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-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95',
|
|
42
42
|
className
|
|
43
43
|
)}
|
|
44
44
|
{...props}
|
|
@@ -132,7 +132,7 @@ function DropdownMenuSubContent({
|
|
|
132
132
|
<DropdownMenuContent
|
|
133
133
|
data-slot="dropdown-menu-sub-content"
|
|
134
134
|
className={cn(
|
|
135
|
-
'w-auto min-w-[96px] rounded-lg bg-popover p-1 text-popover-foreground shadow-lg
|
|
135
|
+
'w-auto min-w-[96px] rounded-lg bg-popover p-1 text-popover-foreground shadow-lg duration-100 data-[side=bottom]:slide-in-from-top-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-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',
|
|
136
136
|
className
|
|
137
137
|
)}
|
|
138
138
|
align={align}
|
|
@@ -31,7 +31,7 @@ function HoverCardContent({
|
|
|
31
31
|
<PreviewCardPrimitive.Popup
|
|
32
32
|
data-slot="hover-card-content"
|
|
33
33
|
className={cn(
|
|
34
|
-
'z-50 w-64 origin-(--transform-origin) rounded-xl bg-popover p-2.5 text-sm text-popover-foreground shadow-md
|
|
34
|
+
'z-50 w-64 origin-(--transform-origin) rounded-xl bg-popover p-2.5 text-sm text-popover-foreground shadow-md outline-hidden duration-100 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-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',
|
|
35
35
|
className
|
|
36
36
|
)}
|
|
37
37
|
{...props}
|
|
@@ -43,7 +43,7 @@ function PopoverContent({
|
|
|
43
43
|
<PopoverPrimitive.Popup
|
|
44
44
|
data-slot="popover-content"
|
|
45
45
|
className={cn(
|
|
46
|
-
'z-50 flex w-72 origin-(--transform-origin) flex-col gap-3 rounded-lg bg-popover p-3 text-sm text-popover-foreground shadow-md
|
|
46
|
+
'z-50 flex w-72 origin-(--transform-origin) flex-col gap-3 rounded-lg bg-popover p-3 text-sm text-popover-foreground shadow-md outline-hidden duration-100 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-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',
|
|
47
47
|
className
|
|
48
48
|
)}
|
|
49
49
|
{...props}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as ResizablePrimitive from 'react-resizable-panels'
|
|
2
|
+
|
|
3
|
+
import { cn } from '@/client/lib/cn'
|
|
4
|
+
|
|
5
|
+
function ResizablePanelGroup({ className, ...props }: ResizablePrimitive.GroupProps) {
|
|
6
|
+
return (
|
|
7
|
+
<ResizablePrimitive.Group
|
|
8
|
+
data-slot="resizable-panel-group"
|
|
9
|
+
className={cn('flex h-full w-full aria-[orientation=vertical]:flex-col', className)}
|
|
10
|
+
{...props}
|
|
11
|
+
/>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function ResizablePanel({ ...props }: ResizablePrimitive.PanelProps) {
|
|
16
|
+
return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function ResizableHandle({
|
|
20
|
+
withHandle,
|
|
21
|
+
className,
|
|
22
|
+
...props
|
|
23
|
+
}: ResizablePrimitive.SeparatorProps & {
|
|
24
|
+
withHandle?: boolean
|
|
25
|
+
}) {
|
|
26
|
+
return (
|
|
27
|
+
<ResizablePrimitive.Separator
|
|
28
|
+
data-slot="resizable-handle"
|
|
29
|
+
className={cn(
|
|
30
|
+
'relative flex w-0 items-center justify-center ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-0 aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90',
|
|
31
|
+
className
|
|
32
|
+
)}
|
|
33
|
+
{...props}
|
|
34
|
+
>
|
|
35
|
+
{withHandle && <div className="flex h-6 w-1 shrink-0 rounded-lg bg-border" />}
|
|
36
|
+
</ResizablePrimitive.Separator>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { ResizableHandle, ResizablePanel, ResizablePanelGroup }
|
|
@@ -120,20 +120,18 @@ type WelcomeProps = {
|
|
|
120
120
|
|
|
121
121
|
export function ChatWelcome({ disabled = false, onSelectPrompt }: WelcomeProps) {
|
|
122
122
|
return (
|
|
123
|
-
<div className={cn(EMPTY_STATE_STYLES, 'max-w-md min-w-0
|
|
123
|
+
<div className={cn(EMPTY_STATE_STYLES, '@container w-full max-w-md min-w-0')}>
|
|
124
124
|
<div className="prose prose-sm min-w-0 wrap-anywhere prose-inherit">
|
|
125
|
-
<p>moi is the visual workspace for you and your agent.</p>
|
|
126
125
|
<p>
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
moi is the visual workspace for you and your agent. It grows and adapts to the work you're
|
|
127
|
+
doing.
|
|
129
128
|
</p>
|
|
130
129
|
<p>
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
exploring and shaping ideas with your agent.
|
|
130
|
+
Ask <WelcomeTerm Icon={IconGhost}>Agent</WelcomeTerm> to build{' '}
|
|
131
|
+
<WelcomeTerm Icon={IconLayout2}>Widgets</WelcomeTerm> that surface information and quick
|
|
132
|
+
actions, or entire <WelcomeTerm Icon={IconArticle}>Views</WelcomeTerm> for more complex
|
|
133
|
+
tools. Use <WelcomeTerm Icon={IconSketching}>Scratchpad</WelcomeTerm> for exploring and
|
|
134
|
+
shaping ideas with your agent.
|
|
137
135
|
</p>
|
|
138
136
|
<p>Give it a try:</p>
|
|
139
137
|
</div>
|
|
@@ -164,7 +162,7 @@ export function ChatWorkspaceWelcome({ disabled = false, onSelectPrompt }: Welco
|
|
|
164
162
|
function EmptyState() {
|
|
165
163
|
return (
|
|
166
164
|
<div className={cn(EMPTY_STATE_STYLES, 'gap-1 text-center')}>
|
|
167
|
-
<p className="mx-auto max-w-sm text-sm text-muted-foreground">
|
|
165
|
+
<p className="mx-auto max-w-sm px-8 text-sm text-muted-foreground">
|
|
168
166
|
Chat with your agent, create widgets and views, and manage your workspace context from here
|
|
169
167
|
</p>
|
|
170
168
|
</div>
|
|
@@ -1,27 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react'
|
|
2
2
|
|
|
3
|
-
import { IconChevronDown, IconX } from '@tabler/icons-react'
|
|
3
|
+
import { IconChevronDown, IconChevronsRight, IconX } from '@tabler/icons-react'
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
canSubmitComposerAction,
|
|
7
|
+
type ComposerAvailability,
|
|
8
|
+
focusComposer
|
|
9
|
+
} from '@/client/components/shared/Composer'
|
|
6
10
|
import { useStickToBottom } from '@/client/features/chat/useStickToBottom'
|
|
7
11
|
import { groupTurns } from '@/client/features/chat/group-turns'
|
|
12
|
+
import { chatNoticeLabel, interleaveNotices } from '@/client/features/chat/interleave-notices'
|
|
8
13
|
import { attachmentKey, useLive } from '@/client/features/chat/chat-store'
|
|
9
14
|
import type { ChatPromptBubble } from '@/client/features/chat/ChatPromptBubbles'
|
|
10
15
|
import type { ChatSendOptions } from '@/client/features/chat/chat-send'
|
|
11
16
|
import { useWorkspaceId } from '@/client/features/workspace/WorkspaceContext'
|
|
12
|
-
import type { Turn, ViewState } from '@/lib/types'
|
|
17
|
+
import type { SystemNotice, Turn, ViewState } from '@/lib/types'
|
|
13
18
|
|
|
14
|
-
import {
|
|
19
|
+
import type { ComposerBanner } from './composer/banners/ComposerBanner'
|
|
20
|
+
import { ChatComposer } from './composer/ChatComposer'
|
|
15
21
|
import { ChatEmptyState, resolveChatEmptyState } from './ChatEmptyState'
|
|
16
22
|
import { ChatSelector } from './ChatSelector'
|
|
17
23
|
import { ThinkingIndicator, TurnView } from './TurnView'
|
|
18
24
|
import { Button } from '@/client/components/ui/button'
|
|
25
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '@/client/components/ui/tooltip'
|
|
19
26
|
import { cn } from '@/client/lib/cn'
|
|
20
27
|
import { useUiStore } from '@/client/store/ui'
|
|
21
28
|
|
|
22
29
|
type ChatPanelProps = {
|
|
23
30
|
active?: boolean
|
|
24
31
|
focusRequest?: number
|
|
32
|
+
docked?: boolean
|
|
25
33
|
chatLoaded: boolean
|
|
26
34
|
view: ViewState
|
|
27
35
|
// The live streaming preview as a synthetic assistant turn (or null). Merged
|
|
@@ -32,29 +40,26 @@ type ChatPanelProps = {
|
|
|
32
40
|
// session switch).
|
|
33
41
|
sessionId?: string | null
|
|
34
42
|
processing: boolean
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
composerBanner?: ReactNode
|
|
38
|
-
unavailableReason: string | null | undefined
|
|
43
|
+
composerBanner?: ComposerBanner
|
|
44
|
+
composerAvailability: ComposerAvailability
|
|
39
45
|
send: (text: string, options?: ChatSendOptions) => void
|
|
40
46
|
stop: () => void
|
|
41
47
|
onSelectSession: (sessionId: string | null) => void
|
|
42
|
-
//
|
|
48
|
+
// Chat on a separate tab doesn't have a close button
|
|
43
49
|
onClose?: () => void
|
|
44
50
|
}
|
|
45
51
|
|
|
46
52
|
export function ChatPanel({
|
|
47
53
|
active = true,
|
|
48
54
|
focusRequest = 0,
|
|
55
|
+
docked = false,
|
|
49
56
|
chatLoaded,
|
|
50
57
|
view,
|
|
51
58
|
previewTurn,
|
|
52
59
|
sessionId,
|
|
53
60
|
processing,
|
|
54
|
-
error,
|
|
55
|
-
onDismissError,
|
|
56
61
|
composerBanner,
|
|
57
|
-
|
|
62
|
+
composerAvailability,
|
|
58
63
|
send,
|
|
59
64
|
stop,
|
|
60
65
|
onSelectSession,
|
|
@@ -73,7 +78,7 @@ export function ChatPanel({
|
|
|
73
78
|
attachment => attachment.status === 'uploading'
|
|
74
79
|
)
|
|
75
80
|
)
|
|
76
|
-
const promptDisabled = !canSubmitComposerAction(true, attachmentsUploading,
|
|
81
|
+
const promptDisabled = !canSubmitComposerAction(true, attachmentsUploading, composerAvailability)
|
|
77
82
|
// Visual grouping: fold consecutive tool-only assistant turns into one
|
|
78
83
|
// synthetic turn so OpenAI Codex–style traces (which serialize one
|
|
79
84
|
// assistant message per agent step) don't render with the wider
|
|
@@ -84,7 +89,15 @@ export function ChatPanel({
|
|
|
84
89
|
() => groupTurns(previewTurn ? [...turns, previewTurn] : turns),
|
|
85
90
|
[turns, previewTurn]
|
|
86
91
|
)
|
|
87
|
-
|
|
92
|
+
// Grouped turns plus the renderable notices (compaction, model changes)
|
|
93
|
+
// woven in at the moment they happened. Interleaving runs AFTER grouping so
|
|
94
|
+
// a notice never splits a tool-only run apart.
|
|
95
|
+
const timeline = useMemo(
|
|
96
|
+
() => interleaveNotices(groupedTurns, view.notices),
|
|
97
|
+
[groupedTurns, view.notices]
|
|
98
|
+
)
|
|
99
|
+
const lastTurnId = groupedTurns.length > 0 ? groupedTurns[groupedTurns.length - 1].id : null
|
|
100
|
+
const showEmptyChat = chatLoaded && timeline.length === 0 && !processing
|
|
88
101
|
const emptyStateKind = resolveChatEmptyState({
|
|
89
102
|
hasSentMessageFromMoi,
|
|
90
103
|
isWorkspacePendingAnalysis
|
|
@@ -125,9 +138,21 @@ export function ChatPanel({
|
|
|
125
138
|
<div className="flex min-h-0 flex-1 flex-col pt-2 pb-3">
|
|
126
139
|
<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
140
|
<ChatSelector selectedSessionId={sessionId ?? null} onSelectSession={onSelectSession} />
|
|
128
|
-
{onClose && (
|
|
129
|
-
<
|
|
130
|
-
<
|
|
141
|
+
{onClose && docked && (
|
|
142
|
+
<Tooltip>
|
|
143
|
+
<TooltipTrigger
|
|
144
|
+
render={
|
|
145
|
+
<Button variant="ghost" size="icon-sm" onClick={onClose} aria-label="Undock agent">
|
|
146
|
+
<IconChevronsRight className="size-5! text-muted-foreground" stroke={1.5} />
|
|
147
|
+
</Button>
|
|
148
|
+
}
|
|
149
|
+
/>
|
|
150
|
+
<TooltipContent>Undock agent</TooltipContent>
|
|
151
|
+
</Tooltip>
|
|
152
|
+
)}
|
|
153
|
+
{onClose && !docked && (
|
|
154
|
+
<Button variant="ghost" size="icon-sm" onClick={onClose} aria-label="Close chat">
|
|
155
|
+
<IconX stroke={2} />
|
|
131
156
|
</Button>
|
|
132
157
|
)}
|
|
133
158
|
</header>
|
|
@@ -137,7 +162,7 @@ export function ChatPanel({
|
|
|
137
162
|
ref={scrollRef}
|
|
138
163
|
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]"
|
|
139
164
|
>
|
|
140
|
-
<div className="mx-auto flex w-full max-w-(--chat-max-container) flex-1 flex-col gap-6">
|
|
165
|
+
<div className="mx-auto flex w-full max-w-(--chat-max-container) flex-1 flex-col items-center gap-6">
|
|
141
166
|
{showEmptyChat && (
|
|
142
167
|
<ChatEmptyState
|
|
143
168
|
kind={emptyStateKind}
|
|
@@ -145,13 +170,17 @@ export function ChatPanel({
|
|
|
145
170
|
onSelectPrompt={handlePromptSelect}
|
|
146
171
|
/>
|
|
147
172
|
)}
|
|
148
|
-
{
|
|
149
|
-
|
|
150
|
-
key={
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
173
|
+
{timeline.map(item =>
|
|
174
|
+
item.kind === 'notice' ? (
|
|
175
|
+
<ChatNoticeRow key={`notice:${item.notice.id}`} notice={item.notice} />
|
|
176
|
+
) : (
|
|
177
|
+
<TurnView
|
|
178
|
+
key={item.turn.id}
|
|
179
|
+
turn={item.turn}
|
|
180
|
+
processing={processing && item.turn.id === lastTurnId}
|
|
181
|
+
/>
|
|
182
|
+
)
|
|
183
|
+
)}
|
|
155
184
|
{/* Pulsing dots only before the first token — once the preview has
|
|
156
185
|
visible content it renders as a (possibly merged) grouped turn. */}
|
|
157
186
|
{processing && !previewTurn && <ThinkingIndicator />}
|
|
@@ -178,39 +207,38 @@ export function ChatPanel({
|
|
|
178
207
|
<div
|
|
179
208
|
className={cn(
|
|
180
209
|
'@container flex w-full flex-col transition-[padding]',
|
|
181
|
-
|
|
182
|
-
composerBanner && 'bg-muted',
|
|
183
|
-
|
|
210
|
+
composerBanner && 'gap-2 rounded-t-xl rounded-b-2xl p-2',
|
|
211
|
+
composerBanner?.tone === 'muted' && 'bg-muted',
|
|
212
|
+
composerBanner?.tone === 'destructive' && 'bg-destructive/10'
|
|
184
213
|
)}
|
|
185
214
|
>
|
|
186
|
-
{composerBanner}
|
|
187
|
-
{error && (
|
|
188
|
-
<div className="flex w-full items-center gap-2 p-1 pl-4 text-sm">
|
|
189
|
-
<span className="flex-1 wrap-break-word text-destructive">{error}</span>
|
|
190
|
-
{onDismissError && (
|
|
191
|
-
<Button
|
|
192
|
-
type="button"
|
|
193
|
-
variant="ghost"
|
|
194
|
-
size="icon-sm"
|
|
195
|
-
onClick={onDismissError}
|
|
196
|
-
className="text-destructive hover:text-destructive"
|
|
197
|
-
aria-label="Dismiss error"
|
|
198
|
-
>
|
|
199
|
-
<IconX stroke={1.75} />
|
|
200
|
-
</Button>
|
|
201
|
-
)}
|
|
202
|
-
</div>
|
|
203
|
-
)}
|
|
215
|
+
{composerBanner?.content}
|
|
204
216
|
<ChatComposer
|
|
205
217
|
composerRef={composerRef}
|
|
206
218
|
onSend={handleSend}
|
|
207
219
|
onStop={stop}
|
|
208
220
|
processing={processing}
|
|
209
221
|
sessionId={sessionId ?? null}
|
|
210
|
-
|
|
222
|
+
availability={composerAvailability}
|
|
211
223
|
/>
|
|
212
224
|
</div>
|
|
213
225
|
</div>
|
|
214
226
|
</div>
|
|
215
227
|
)
|
|
216
228
|
}
|
|
229
|
+
|
|
230
|
+
type ChatNoticeRowProps = { notice: SystemNotice }
|
|
231
|
+
|
|
232
|
+
// A quiet, centered one-liner marking a session event (context compacted,
|
|
233
|
+
// model changed) at its place in the transcript. Kinds without designed copy
|
|
234
|
+
// render nothing (see chatNoticeLabel). Exported for the /dev/chat-states
|
|
235
|
+
// catalog.
|
|
236
|
+
export function ChatNoticeRow({ notice }: ChatNoticeRowProps) {
|
|
237
|
+
const label = chatNoticeLabel(notice)
|
|
238
|
+
if (!label) return null
|
|
239
|
+
return (
|
|
240
|
+
<div className="flex justify-center">
|
|
241
|
+
<span className="max-w-full truncate text-xs text-muted-foreground">{label}</span>
|
|
242
|
+
</div>
|
|
243
|
+
)
|
|
244
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode } from 'react'
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react'
|
|
2
2
|
|
|
3
3
|
import { motion } from 'motion/react'
|
|
4
4
|
|
|
@@ -22,9 +22,23 @@ export function ChatPopup({
|
|
|
22
22
|
children
|
|
23
23
|
}: ChatPopupProps) {
|
|
24
24
|
const onClose = () => onOpenChange(false)
|
|
25
|
+
const handleOpenChange: NonNullable<ComponentProps<typeof Popover>['onOpenChange']> = (
|
|
26
|
+
nextOpen,
|
|
27
|
+
eventDetails
|
|
28
|
+
) => {
|
|
29
|
+
if (!nextOpen && eventDetails.reason === 'outside-press') {
|
|
30
|
+
eventDetails.cancel()
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
onOpenChange(nextOpen)
|
|
34
|
+
}
|
|
25
35
|
|
|
26
36
|
return (
|
|
27
|
-
<Popover
|
|
37
|
+
<Popover
|
|
38
|
+
open={open}
|
|
39
|
+
onOpenChange={handleOpenChange}
|
|
40
|
+
onOpenChangeComplete={onOpenChangeComplete}
|
|
41
|
+
>
|
|
28
42
|
<PopoverTrigger
|
|
29
43
|
render={
|
|
30
44
|
<div className="fixed right-4 bottom-4 sm:right-6 sm:bottom-6">
|
|
@@ -28,13 +28,11 @@ export function ChatPromptBubble({
|
|
|
28
28
|
return (
|
|
29
29
|
<Button
|
|
30
30
|
type="button"
|
|
31
|
-
variant="secondary"
|
|
32
31
|
size="sm"
|
|
33
32
|
disabled={disabled}
|
|
34
33
|
onClick={() => onSelect(prompt)}
|
|
35
34
|
className={cn(
|
|
36
|
-
'h-auto items-start justify-start gap-2 rounded-
|
|
37
|
-
'hover:bg-accent',
|
|
35
|
+
'h-auto items-start justify-start gap-2 rounded-lg p-2 px-3 text-left leading-snug whitespace-normal',
|
|
38
36
|
className
|
|
39
37
|
)}
|
|
40
38
|
>
|
|
@@ -52,7 +50,7 @@ type ChatPromptBubblesProps = {
|
|
|
52
50
|
|
|
53
51
|
export function ChatPromptBubbles({ prompts, disabled = false, onSelect }: ChatPromptBubblesProps) {
|
|
54
52
|
return (
|
|
55
|
-
<div className="grid w-full grid-cols-1 gap-3 py-2
|
|
53
|
+
<div className="row-gap-2 grid w-full grid-cols-1 gap-x-3 gap-y-2 py-2 @md:grid-cols-3">
|
|
56
54
|
{prompts.map((prompt, index) => {
|
|
57
55
|
return (
|
|
58
56
|
<ChatPromptBubble
|
|
@@ -61,10 +59,10 @@ export function ChatPromptBubbles({ prompts, disabled = false, onSelect }: ChatP
|
|
|
61
59
|
disabled={disabled}
|
|
62
60
|
onSelect={onSelect}
|
|
63
61
|
className={cn(
|
|
64
|
-
'h-full w-full',
|
|
65
|
-
index === 0 && 'translate-y-3 rotate-3 hover:translate-y-2.5',
|
|
66
|
-
index === 1 && '
|
|
67
|
-
index === 2 && 'translate-y-3
|
|
62
|
+
'h-full w-fit @md:w-full',
|
|
63
|
+
index === 0 && '@md:translate-y-3 @md:rotate-3 @md:hover:translate-y-2.5',
|
|
64
|
+
index === 1 && '@md:-rotate-1',
|
|
65
|
+
index === 2 && '@md:translate-y-3 @md:-rotate-4 @md:hover:translate-y-2.5'
|
|
68
66
|
)}
|
|
69
67
|
/>
|
|
70
68
|
)
|