moi-computer 0.5.2-next.0 → 0.5.2-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/app/shell/SidebarLayout.tsx +1 -1
- package/client/components/shared/Composer.tsx +12 -3
- package/client/components/ui/dropdown-menu.tsx +1 -4
- package/client/components/ui/popover.tsx +11 -4
- package/client/components/ui/slider.tsx +70 -0
- package/client/components/ui/tooltip.tsx +1 -1
- package/client/features/chat/ChatComposer.tsx +9 -13
- package/client/features/chat/ChatPanel.tsx +8 -8
- package/client/features/chat/ModelPicker.tsx +295 -116
- package/client/features/chat/TurnView.tsx +1 -1
- package/client/features/chat/chat-send.ts +15 -5
- package/client/features/chat/chat-store.ts +9 -22
- package/client/features/chat/model-order.ts +50 -28
- package/client/features/chat/useChat.ts +20 -11
- package/client/features/settings/IconPicker.tsx +2 -2
- package/client/features/views/api.ts +1 -0
- package/client/features/views/useViewBuilderActions.ts +4 -2
- package/client/features/workspace/WorkspaceScreen.tsx +2 -1
- package/client/features/workspace/WorkspaceSkillUpdateBanner.tsx +2 -2
- package/client/index.css +5 -3
- package/client/store/ui.ts +11 -1
- package/dist/chunk-94m3q9ce.js +1 -0
- package/dist/{chunk-v797g6ap.js → chunk-bcrkdhwe.js} +1 -1
- package/dist/{chunk-7bzpmtxp.js → chunk-jvhvme3z.js} +1 -1
- package/dist/chunk-k9dcnd73.js +27 -0
- package/dist/{chunk-jg6ezptn.js → chunk-kfw1qwqe.js} +2 -2
- package/dist/chunk-pk11vfzs.js +9 -0
- package/dist/{chunk-5vaevt8z.js → chunk-r2bqaege.js} +1 -1
- package/dist/{chunk-h3evrtyp.js → chunk-tzz101ea.js} +1 -1
- package/dist/chunk-xwhya7kb.js +1 -0
- package/dist/chunk-y4g8j7mv.css +1 -0
- package/dist/{chunk-m9qja0nx.js → chunk-zs4mte79.js} +1 -1
- package/dist/index.html +1 -1
- package/lib/types.ts +14 -5
- package/package.json +1 -1
- package/server/api.ts +13 -4
- package/server/harness/claude-code/models.ts +25 -2
- package/server/harness/claude-code/session.ts +28 -5
- package/server/harness/codex/adapter.ts +27 -2
- package/server/harness/codex/client.ts +33 -4
- package/server/harness/codex/session.ts +13 -4
- package/server/harness/types.ts +3 -2
- package/server/thread-config.ts +11 -7
- package/server/web.ts +3 -0
- package/workspace/.claude/skills/moi-workspace/DESIGN.md +38 -42
- package/workspace/.claude/skills/moi-workspace/SKILL.md +1 -1
- package/dist/chunk-fhhv99bd.js +0 -1
- package/dist/chunk-h0hk61pm.js +0 -9
- package/dist/chunk-k5sjx9s5.js +0 -1
- package/dist/chunk-rs9nb0fr.js +0 -27
- package/dist/chunk-s7za1qsv.css +0 -1
|
@@ -77,7 +77,7 @@ function Sidebar({ workspaces }: SidebarProps) {
|
|
|
77
77
|
const reorder = useReorderWorkspaces()
|
|
78
78
|
|
|
79
79
|
return (
|
|
80
|
-
<aside className="flex h-full shrink-0 flex-col items-center gap-4 px-2 py-5">
|
|
80
|
+
<aside className="flex h-full shrink-0 flex-col items-center gap-4 px-2 py-5 [font-family:var(--default-sans)]">
|
|
81
81
|
<Link href="/" aria-label="Home" title="Home" className={sidebarNavButtonClass}>
|
|
82
82
|
<IconSmartHome stroke={1.5} />
|
|
83
83
|
</Link>
|
|
@@ -10,6 +10,15 @@ type ComposerProps = Omit<ComponentProps<'form'>, 'ref'> & {
|
|
|
10
10
|
composerRef: RefObject<HTMLTextAreaElement | null>
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
type ComposerFocusTarget = Pick<HTMLTextAreaElement, 'focus' | 'setSelectionRange' | 'value'>
|
|
14
|
+
|
|
15
|
+
export function focusComposer(composer: ComposerFocusTarget | null) {
|
|
16
|
+
if (!composer) return
|
|
17
|
+
composer.focus()
|
|
18
|
+
const end = composer.value.length
|
|
19
|
+
composer.setSelectionRange(end, end)
|
|
20
|
+
}
|
|
21
|
+
|
|
13
22
|
export function Composer({
|
|
14
23
|
composerRef,
|
|
15
24
|
className,
|
|
@@ -28,10 +37,10 @@ export function Composer({
|
|
|
28
37
|
event.target.closest('button, input, textarea, select, a, [contenteditable="true"]')
|
|
29
38
|
)
|
|
30
39
|
return
|
|
31
|
-
composerRef.current
|
|
40
|
+
focusComposer(composerRef.current)
|
|
32
41
|
}}
|
|
33
42
|
className={cn(
|
|
34
|
-
'flex w-full cursor-text flex-col gap-1 rounded-xl bg-card p-2 text-card-foreground shadow-xs transition-[color,box-shadow] outline-none focus-within:shadow-sm',
|
|
43
|
+
'group/composer flex w-full cursor-text flex-col gap-1 rounded-xl bg-card p-2 text-card-foreground shadow-xs transition-[color,box-shadow] outline-none focus-within:shadow-sm',
|
|
35
44
|
className
|
|
36
45
|
)}
|
|
37
46
|
>
|
|
@@ -61,7 +70,7 @@ type ComposerFooterProps = ComponentProps<'div'>
|
|
|
61
70
|
|
|
62
71
|
export function ComposerFooter({ className, children, ...props }: ComposerFooterProps) {
|
|
63
72
|
return (
|
|
64
|
-
<div {...props} className={cn('flex items-center justify-end gap-
|
|
73
|
+
<div {...props} className={cn('flex items-center justify-end gap-3', className)}>
|
|
65
74
|
{children}
|
|
66
75
|
</div>
|
|
67
76
|
)
|
|
@@ -63,10 +63,7 @@ function DropdownMenuLabel({
|
|
|
63
63
|
<MenuPrimitive.GroupLabel
|
|
64
64
|
data-slot="dropdown-menu-label"
|
|
65
65
|
data-inset={inset}
|
|
66
|
-
className={cn(
|
|
67
|
-
'px-2 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7',
|
|
68
|
-
className
|
|
69
|
-
)}
|
|
66
|
+
className={cn('px-2 pt-1.5 pb-0.5 text-xs text-muted-foreground data-inset:pl-7', className)}
|
|
70
67
|
{...props}
|
|
71
68
|
/>
|
|
72
69
|
)
|
|
@@ -12,23 +12,30 @@ function PopoverTrigger({ ...props }: PopoverPrimitive.Trigger.Props) {
|
|
|
12
12
|
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
type PopoverContentProps = PopoverPrimitive.Popup.Props &
|
|
16
|
+
Pick<
|
|
17
|
+
PopoverPrimitive.Positioner.Props,
|
|
18
|
+
'align' | 'alignOffset' | 'disableAnchorTracking' | 'side' | 'sideOffset'
|
|
19
|
+
> &
|
|
20
|
+
Pick<PopoverPrimitive.Portal.Props, 'keepMounted' | 'container'>
|
|
21
|
+
|
|
15
22
|
function PopoverContent({
|
|
16
23
|
className,
|
|
17
24
|
align = 'center',
|
|
18
25
|
alignOffset = 0,
|
|
26
|
+
disableAnchorTracking = false,
|
|
19
27
|
side = 'bottom',
|
|
20
28
|
sideOffset = 4,
|
|
21
29
|
keepMounted = false,
|
|
22
30
|
container,
|
|
23
31
|
...props
|
|
24
|
-
}:
|
|
25
|
-
Pick<PopoverPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'> &
|
|
26
|
-
Pick<PopoverPrimitive.Portal.Props, 'keepMounted' | 'container'>) {
|
|
32
|
+
}: PopoverContentProps) {
|
|
27
33
|
return (
|
|
28
34
|
<PopoverPrimitive.Portal keepMounted={keepMounted} container={container}>
|
|
29
35
|
<PopoverPrimitive.Positioner
|
|
30
36
|
align={align}
|
|
31
37
|
alignOffset={alignOffset}
|
|
38
|
+
disableAnchorTracking={disableAnchorTracking}
|
|
32
39
|
side={side}
|
|
33
40
|
sideOffset={sideOffset}
|
|
34
41
|
className="isolate z-50"
|
|
@@ -36,7 +43,7 @@ function PopoverContent({
|
|
|
36
43
|
<PopoverPrimitive.Popup
|
|
37
44
|
data-slot="popover-content"
|
|
38
45
|
className={cn(
|
|
39
|
-
'z-50 flex w-72 origin-(--transform-origin) flex-col gap-
|
|
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 ring-1 ring-border 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',
|
|
40
47
|
className
|
|
41
48
|
)}
|
|
42
49
|
{...props}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
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 }
|
|
@@ -36,7 +36,7 @@ function TooltipContent({
|
|
|
36
36
|
<TooltipPrimitive.Popup
|
|
37
37
|
data-slot="tooltip-content"
|
|
38
38
|
className={cn(
|
|
39
|
-
'z-50 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',
|
|
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
40
|
className
|
|
41
41
|
)}
|
|
42
42
|
{...props}
|
|
@@ -15,10 +15,11 @@ import { useWorkspaceId } from '@/client/features/workspace/WorkspaceContext'
|
|
|
15
15
|
import { uploadFiles } from '@/client/features/chat/uploads'
|
|
16
16
|
import {
|
|
17
17
|
type ChatAttachment,
|
|
18
|
-
|
|
18
|
+
attachmentKey,
|
|
19
19
|
liveStore,
|
|
20
20
|
useLive
|
|
21
21
|
} from '@/client/features/chat/chat-store'
|
|
22
|
+
import { useUiStore } from '@/client/store/ui'
|
|
22
23
|
|
|
23
24
|
import { ModelPicker } from './ModelPicker'
|
|
24
25
|
|
|
@@ -30,11 +31,9 @@ type ChatComposerProps = {
|
|
|
30
31
|
unavailableReason: string | null | undefined
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
// active thread, so switching threads swaps the unsent text with you. Attachments
|
|
37
|
-
// (drag/drop, paste, attach button) are tracked the same way and cleared on send.
|
|
34
|
+
// Draft text is persisted per workspace, while attachments remain ephemeral and
|
|
35
|
+
// follow the active chat. Both stores are subscribed here so a keystroke or
|
|
36
|
+
// upload re-renders only the composer.
|
|
38
37
|
export function ChatComposer({
|
|
39
38
|
composerRef,
|
|
40
39
|
onSend,
|
|
@@ -45,8 +44,8 @@ export function ChatComposer({
|
|
|
45
44
|
const fileRef = useRef<HTMLInputElement>(null)
|
|
46
45
|
const workspaceId = useWorkspaceId()
|
|
47
46
|
const sessionId = useLive(s => s.activeByWorkspace[workspaceId] ?? null)
|
|
48
|
-
const value =
|
|
49
|
-
const attachments = useLive(s => s.attachments[
|
|
47
|
+
const value = useUiStore(s => s.composerDrafts[workspaceId] ?? '')
|
|
48
|
+
const attachments = useLive(s => s.attachments[attachmentKey(workspaceId, sessionId)] ?? EMPTY)
|
|
50
49
|
const [dragOver, setDragOver] = useState(false)
|
|
51
50
|
|
|
52
51
|
const uploading = attachments.some(a => a.status === 'uploading')
|
|
@@ -54,7 +53,7 @@ export function ChatComposer({
|
|
|
54
53
|
const hasContent = value.trim().length > 0 || hasReady
|
|
55
54
|
const canSend = canSubmitComposerAction(hasContent, uploading, unavailableReason)
|
|
56
55
|
|
|
57
|
-
const onChange = (next: string) =>
|
|
56
|
+
const onChange = (next: string) => useUiStore.getState().setComposerDraft(workspaceId, next)
|
|
58
57
|
|
|
59
58
|
// Upload each picked file immediately, tracking its in-flight status so the
|
|
60
59
|
// thumbnail row can show a spinner / error per file.
|
|
@@ -90,10 +89,7 @@ export function ChatComposer({
|
|
|
90
89
|
const send = () => {
|
|
91
90
|
if (!canSend) return
|
|
92
91
|
onSend(value)
|
|
93
|
-
|
|
94
|
-
// this clears the `'new'` draft; `send` then mints the real id and the input
|
|
95
|
-
// re-renders empty under the new key. (Attachments are cleared by `send`.)
|
|
96
|
-
liveStore.getState().setDraft(workspaceId, sessionId, '')
|
|
92
|
+
useUiStore.getState().setComposerDraft(workspaceId, '')
|
|
97
93
|
}
|
|
98
94
|
|
|
99
95
|
return (
|
|
@@ -2,10 +2,10 @@ import { type ReactNode, useCallback, useEffect, useLayoutEffect, useMemo, useRe
|
|
|
2
2
|
|
|
3
3
|
import { IconChevronDown, IconX } from '@tabler/icons-react'
|
|
4
4
|
|
|
5
|
-
import { canSubmitComposerAction } from '@/client/components/shared/Composer'
|
|
5
|
+
import { canSubmitComposerAction, focusComposer } from '@/client/components/shared/Composer'
|
|
6
6
|
import { useStickToBottom } from '@/client/features/chat/useStickToBottom'
|
|
7
7
|
import { groupTurns } from '@/client/features/chat/group-turns'
|
|
8
|
-
import {
|
|
8
|
+
import { attachmentKey, useLive } from '@/client/features/chat/chat-store'
|
|
9
9
|
import type { ChatPromptBubble } from '@/client/features/chat/ChatPromptBubbles'
|
|
10
10
|
import type { ChatSendOptions } from '@/client/features/chat/chat-send'
|
|
11
11
|
import { useWorkspaceId } from '@/client/features/workspace/WorkspaceContext'
|
|
@@ -69,7 +69,7 @@ export function ChatPanel({
|
|
|
69
69
|
(state.workspaceIdsPendingAnalysis ?? []).includes(workspaceId)
|
|
70
70
|
)
|
|
71
71
|
const attachmentsUploading = useLive(state =>
|
|
72
|
-
(state.attachments[
|
|
72
|
+
(state.attachments[attachmentKey(workspaceId, sessionId ?? null)] ?? []).some(
|
|
73
73
|
attachment => attachment.status === 'uploading'
|
|
74
74
|
)
|
|
75
75
|
)
|
|
@@ -100,7 +100,7 @@ export function ChatPanel({
|
|
|
100
100
|
// The active chat surface owns initial focus. A monotonically increasing
|
|
101
101
|
// request also refocuses an already-visible composer after intent actions.
|
|
102
102
|
useEffect(() => {
|
|
103
|
-
if (active) composerRef.current
|
|
103
|
+
if (active) focusComposer(composerRef.current)
|
|
104
104
|
}, [active, focusRequest])
|
|
105
105
|
|
|
106
106
|
// Sending always returns the user to the bottom, even if they'd scrolled up —
|
|
@@ -178,22 +178,22 @@ export function ChatPanel({
|
|
|
178
178
|
<div
|
|
179
179
|
className={cn(
|
|
180
180
|
'@container flex w-full flex-col transition-[padding]',
|
|
181
|
-
(composerBanner || error) && 'gap-
|
|
181
|
+
(composerBanner || error) && 'gap-2 rounded-t-xl rounded-b-2xl p-2',
|
|
182
182
|
composerBanner && 'bg-muted',
|
|
183
183
|
error && 'bg-destructive/10'
|
|
184
184
|
)}
|
|
185
185
|
>
|
|
186
186
|
{composerBanner}
|
|
187
187
|
{error && (
|
|
188
|
-
<div className="flex w-full items-
|
|
189
|
-
<span className="flex-1 wrap-break-word">{error}</span>
|
|
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
190
|
{onDismissError && (
|
|
191
191
|
<Button
|
|
192
192
|
type="button"
|
|
193
193
|
variant="ghost"
|
|
194
194
|
size="icon-sm"
|
|
195
195
|
onClick={onDismissError}
|
|
196
|
-
className="-
|
|
196
|
+
className="text-destructive hover:text-destructive"
|
|
197
197
|
aria-label="Dismiss error"
|
|
198
198
|
>
|
|
199
199
|
<IconX stroke={1.75} />
|