@justanarthur/modo-ui-ai 0.2.0 → 0.3.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/blocks/conversation/agent-prompt/index.tsx +3 -3
- package/blocks/conversation/composer/examples.mdx +50 -0
- package/blocks/conversation/composer/index.tsx +182 -48
- package/blocks/conversation/transcript/index.tsx +8 -6
- package/blocks/dialogs/command-palette/examples.mdx +17 -0
- package/blocks/dialogs/command-palette/index.tsx +12 -5
- package/blocks/panes/usage-pane/examples.mdx +10 -0
- package/blocks/panes/usage-pane/index.tsx +8 -5
- package/blocks/profiles/profile-switcher/examples.mdx +11 -0
- package/blocks/profiles/profile-switcher/index.tsx +18 -3
- package/blocks/profiles/profile-usage/examples.mdx +20 -0
- package/blocks/profiles/profile-usage/index.tsx +22 -8
- package/blocks/sessions/session-sidebar/examples.mdx +53 -3
- package/blocks/sessions/session-sidebar/index.tsx +133 -78
- package/components/conversation/agent-run/examples.mdx +8 -0
- package/components/conversation/agent-run/index.tsx +4 -3
- package/components/conversation/message/index.tsx +8 -6
- package/components/conversation/reasoning/examples.mdx +10 -0
- package/components/conversation/reasoning/index.tsx +5 -4
- package/dist/blocks/conversation/agent-prompt/index.d.ts +1 -1
- package/dist/blocks/conversation/agent-prompt/index.js +1 -1
- package/dist/blocks/conversation/composer/index.d.ts +1 -1
- package/dist/blocks/conversation/composer/index.js +3 -2
- package/dist/blocks/conversation/transcript/index.d.ts +11 -11
- package/dist/blocks/conversation/transcript/index.js +3 -3
- package/dist/blocks/dialogs/command-palette/index.d.ts +1 -1
- package/dist/blocks/dialogs/command-palette/index.js +4 -4
- package/dist/blocks/panes/side-pane/index.js +3 -3
- package/dist/blocks/panes/usage-pane/index.d.ts +1 -1
- package/dist/blocks/panes/usage-pane/index.js +2 -2
- package/dist/blocks/profiles/profile-switcher/index.d.ts +1 -1
- package/dist/blocks/profiles/profile-switcher/index.js +2 -1
- package/dist/blocks/profiles/profile-usage/index.d.ts +1 -1
- package/dist/blocks/profiles/profile-usage/index.js +2 -2
- package/dist/blocks/sessions/session-board/index.js +8 -7
- package/dist/blocks/sessions/session-sidebar/index.d.ts +1 -1
- package/dist/blocks/sessions/session-sidebar/index.js +4 -4
- package/dist/components/conversation/agent-run/index.d.ts +1 -1
- package/dist/components/conversation/message/index.d.ts +2 -2
- package/dist/components/conversation/message/index.js +5 -5
- package/dist/components/conversation/reasoning/index.d.ts +1 -1
- package/dist/components/conversation/reasoning/index.js +1 -1
- package/dist/index.d.ts +12 -12
- package/dist/index.js +17 -17
- package/dist/lib/pace-bar.d.ts +1 -1
- package/dist/lib/pace.d.ts +2 -2
- package/dist/lib/pace.js +3 -1
- package/dist/shared/{chunk-rzajcn44.d.ts → chunk-1hzrm8r5.d.ts} +3 -1
- package/dist/shared/{chunk-k5zegxje.d.ts → chunk-1qdwg7w5.d.ts} +10 -10
- package/dist/shared/{chunk-cd4f87as.d.ts → chunk-3ps5h55t.d.ts} +2 -0
- package/dist/shared/{chunk-45rqgey6.d.ts → chunk-3yaftgh0.d.ts} +6 -3
- package/dist/shared/{chunk-1f96cz69.js → chunk-58jh3mje.js} +3 -2
- package/dist/shared/{chunk-1aq2xzv5.js → chunk-6kwk9vag.js} +4 -4
- package/dist/shared/{chunk-4248zvmh.js → chunk-6rdwkymk.js} +1 -1
- package/dist/shared/{chunk-gkyk663q.d.ts → chunk-71j8qzvb.d.ts} +8 -4
- package/dist/shared/{chunk-6g4970a6.d.ts → chunk-74bvf3tw.d.ts} +3 -2
- package/dist/shared/{chunk-w5z8qnf8.js → chunk-7mfer3tp.js} +4 -3
- package/dist/shared/{chunk-bzs6amnv.js → chunk-94grzz9f.js} +4 -4
- package/dist/shared/{chunk-g28hweee.d.ts → chunk-b4dz15em.d.ts} +4 -3
- package/dist/shared/{chunk-8xg5gwwy.js → chunk-b5ccp5de.js} +2 -5
- package/dist/shared/{chunk-rjfwje37.d.ts → chunk-dxzrtvt9.d.ts} +58 -9
- package/dist/shared/{chunk-fbn0h7cr.js → chunk-fapc805j.js} +11 -4
- package/dist/shared/{chunk-sfqvyzcs.d.ts → chunk-fm1qyrae.d.ts} +6 -6
- package/dist/shared/{chunk-5k6xwqfj.d.ts → chunk-gb5ee5dw.d.ts} +27 -7
- package/dist/shared/{chunk-a4s440b6.js → chunk-mnzw0bav.js} +4 -3
- package/dist/shared/{chunk-wgvzavx1.js → chunk-n31qwnj2.js} +88 -32
- package/dist/shared/{chunk-kw9npka5.js → chunk-njf851p1.js} +44 -23
- package/dist/shared/{chunk-hd4gtj5z.d.ts → chunk-nkbgg7bw.d.ts} +4 -3
- package/dist/shared/{chunk-cmwby8f9.js → chunk-nvh33x9x.js} +112 -91
- package/dist/shared/{chunk-4n0v64qx.js → chunk-qt31n444.js} +7 -8
- package/dist/shared/{chunk-szkvrqg1.d.ts → chunk-ty2ccknv.d.ts} +4 -4
- package/dist/shared/{chunk-vd59gzzd.js → chunk-wq9h37gy.js} +3 -3
- package/lib/pace.ts +7 -3
- package/package.json +3 -3
|
@@ -16,3 +16,14 @@ Press the trigger: the panel grows out of it. Pick a profile and its background
|
|
|
16
16
|
<div className="flex h-[560px] w-full items-start justify-center pt-6">
|
|
17
17
|
<ProfileSwitcher profiles={PROFILES} defaultValue="work" />
|
|
18
18
|
</div>
|
|
19
|
+
|
|
20
|
+
# No usage yet
|
|
21
|
+
|
|
22
|
+
A profile has no limits until its first turn reports usage (`limits: []`): its row shows a dash instead of a share, and Limits says so.
|
|
23
|
+
|
|
24
|
+
<div className="flex h-[560px] w-full items-start justify-center pt-6">
|
|
25
|
+
<ProfileSwitcher
|
|
26
|
+
profiles={[...PROFILES, { ...PROFILES[2], id: 'fresh', name: 'fresh', configDir: '~/.claude-fresh', limits: [] }]}
|
|
27
|
+
defaultValue="fresh"
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
@@ -19,6 +19,7 @@ import { useControllableState } from '@justanarthur/modo-ui/lib/use-controllable
|
|
|
19
19
|
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
20
20
|
import { SizeProvider } from '@justanarthur/modo-ui/primitives/systems/sizes'
|
|
21
21
|
import { useIcon } from '../../../lib/icons'
|
|
22
|
+
import { NO_USAGE, percent } from '../../../lib/pace'
|
|
22
23
|
import { RowTrigger } from '../../../lib/row-trigger'
|
|
23
24
|
import type { Profile } from '../../../lib/types'
|
|
24
25
|
|
|
@@ -52,7 +53,7 @@ export function ProfileTile({ profile, size = 'md', className }: ProfileTileProp
|
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
function ProfileRow({ profile }: { profile: Profile }) {
|
|
55
|
-
const top = Math.max(...profile.limits.map(l => l.value))
|
|
56
|
+
const top = profile.limits.length > 0 ? Math.max(...profile.limits.map(l => l.value)) : undefined
|
|
56
57
|
return (
|
|
57
58
|
<span className="flex min-w-0 flex-1 items-center gap-2">
|
|
58
59
|
<ProfileTile profile={profile} />
|
|
@@ -64,7 +65,14 @@ function ProfileRow({ profile }: { profile: Profile }) {
|
|
|
64
65
|
))}
|
|
65
66
|
</span>
|
|
66
67
|
<span className="w-8 shrink-0 text-right text-caption tabular-nums text-muted-foreground">
|
|
67
|
-
{
|
|
68
|
+
{top === undefined ? (
|
|
69
|
+
<>
|
|
70
|
+
<span aria-hidden="true">–</span>
|
|
71
|
+
<span className="sr-only">{NO_USAGE}</span>
|
|
72
|
+
</>
|
|
73
|
+
) : (
|
|
74
|
+
percent(top)
|
|
75
|
+
)}
|
|
68
76
|
</span>
|
|
69
77
|
</span>
|
|
70
78
|
)
|
|
@@ -98,7 +106,9 @@ interface ProfileSwitcherProps {
|
|
|
98
106
|
* (its sign-in, settings, memory and limits), so the switcher shows what
|
|
99
107
|
* the switch costs before you make it: the plan, the config dir or base
|
|
100
108
|
* URL, how many sessions run there, and the session and weekly meters,
|
|
101
|
-
* which turn amber and red as a limit runs out.
|
|
109
|
+
* which turn amber and red as a limit runs out. A profile with no limits yet
|
|
110
|
+
* (`limits: []`, before its first turn reports usage) shows a dash for its
|
|
111
|
+
* share and "No usage yet" under Limits. The panel grows out of the
|
|
102
112
|
* trigger; the active profile's background melts to the row you pick, and
|
|
103
113
|
* the arrow keys move the pick.
|
|
104
114
|
*
|
|
@@ -162,6 +172,11 @@ export default function ProfileSwitcher({
|
|
|
162
172
|
title={`Limits · ${active.name}`}
|
|
163
173
|
aside={active.provider === 'compatible' ? active.baseUrl : active.configDir}
|
|
164
174
|
>
|
|
175
|
+
{active.limits.length === 0 && (
|
|
176
|
+
<p className="m-0 px-[var(--space-2)] text-caption text-muted-foreground">
|
|
177
|
+
{NO_USAGE}: limits show once a session under this profile reports usage.
|
|
178
|
+
</p>
|
|
179
|
+
)}
|
|
165
180
|
{active.limits.map(limit => (
|
|
166
181
|
<List.Row key={limit.label} label={limit.label}>
|
|
167
182
|
<Meter variant="line" className="w-16" label={limit.label} value={limit.value} />
|
|
@@ -19,3 +19,23 @@ Every profile by name with its session and tightest weekly limit as pace bars: `
|
|
|
19
19
|
<Sidebar.Inset className="min-h-0" />
|
|
20
20
|
</Sidebar.Provider>
|
|
21
21
|
</div>
|
|
22
|
+
|
|
23
|
+
# No usage yet
|
|
24
|
+
|
|
25
|
+
A profile has no limits until its first turn reports usage (`limits: []`): it reads "No usage yet" instead of a bar.
|
|
26
|
+
|
|
27
|
+
<div className="flex h-[360px] w-full overflow-hidden rounded-xl border border-border bg-background">
|
|
28
|
+
<Sidebar.Provider className="h-full min-h-0" persist={false} mobileBreakpoint={0}>
|
|
29
|
+
<Sidebar className="h-full">
|
|
30
|
+
<Sidebar.Content>
|
|
31
|
+
<Sidebar.Group>
|
|
32
|
+
<Sidebar.GroupLabel>Usage</Sidebar.GroupLabel>
|
|
33
|
+
<ProfileUsage
|
|
34
|
+
profiles={[PROFILES[0], { ...PROFILES[2], id: 'fresh', name: 'fresh', configDir: '~/.claude-fresh', limits: [] }]}
|
|
35
|
+
/>
|
|
36
|
+
</Sidebar.Group>
|
|
37
|
+
</Sidebar.Content>
|
|
38
|
+
</Sidebar>
|
|
39
|
+
<Sidebar.Inset className="min-h-0" />
|
|
40
|
+
</Sidebar.Provider>
|
|
41
|
+
</div>
|
|
@@ -15,7 +15,7 @@ import Popover from '@justanarthur/modo-ui/components/overlays/popover'
|
|
|
15
15
|
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
16
16
|
import { SizeProvider } from '@justanarthur/modo-ui/primitives/systems/sizes'
|
|
17
17
|
import { useIcon } from '../../../lib/icons'
|
|
18
|
-
import { duration, type LimitPace, paceOf, percent, VERDICT_TEXT } from '../../../lib/pace'
|
|
18
|
+
import { duration, type LimitPace, NO_USAGE, paceOf, percent, VERDICT_TEXT } from '../../../lib/pace'
|
|
19
19
|
import { PaceBar } from '../../../lib/pace-bar'
|
|
20
20
|
import type { Profile } from '../../../lib/types'
|
|
21
21
|
|
|
@@ -47,6 +47,8 @@ interface ProfileUsageProps {
|
|
|
47
47
|
* fill past the tick is spending faster than the window refills. The row
|
|
48
48
|
* lists every profile by name with its session limit over its tightest
|
|
49
49
|
* weekly one; press it for every limit with its share and time to reset.
|
|
50
|
+
* A profile with no limits yet (`limits: []`, as before its first turn
|
|
51
|
+
* reports usage) reads "No usage yet" instead of a bar.
|
|
50
52
|
*
|
|
51
53
|
* Put it in a Sidebar (the session sidebar puts it in its footer).
|
|
52
54
|
*
|
|
@@ -72,16 +74,22 @@ export default function ProfileUsage({ profiles, onManage }: ProfileUsageProps)
|
|
|
72
74
|
<span
|
|
73
75
|
className={cn(
|
|
74
76
|
'truncate text-caption',
|
|
75
|
-
binding.verdict === 'free'
|
|
77
|
+
binding === undefined || binding.verdict === 'free'
|
|
78
|
+
? 'text-foreground'
|
|
79
|
+
: VERDICT_TEXT[binding.verdict],
|
|
76
80
|
)}
|
|
77
81
|
>
|
|
78
82
|
{profile.name}
|
|
79
83
|
</span>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
{binding ? (
|
|
85
|
+
<span className="flex flex-col gap-1">
|
|
86
|
+
{glanceLimits(limits).map(pace => (
|
|
87
|
+
<PaceBar key={pace.limit.label} pace={pace} />
|
|
88
|
+
))}
|
|
89
|
+
</span>
|
|
90
|
+
) : (
|
|
91
|
+
<span className="truncate text-caption text-muted-foreground">{NO_USAGE}</span>
|
|
92
|
+
)}
|
|
85
93
|
</span>
|
|
86
94
|
))}
|
|
87
95
|
</span>
|
|
@@ -97,7 +105,13 @@ export default function ProfileUsage({ profiles, onManage }: ProfileUsageProps)
|
|
|
97
105
|
<List.Section
|
|
98
106
|
key={profile.id}
|
|
99
107
|
title={`${profile.name} · ${profile.plan}`}
|
|
100
|
-
aside={
|
|
108
|
+
aside={
|
|
109
|
+
binding ? (
|
|
110
|
+
<span className={VERDICT_TEXT[binding.verdict]}>{VERDICT_WORD[binding.verdict]}</span>
|
|
111
|
+
) : (
|
|
112
|
+
<span className="text-muted-foreground">{NO_USAGE}</span>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
101
115
|
>
|
|
102
116
|
{limits.map(pace => (
|
|
103
117
|
<List.Row key={pace.limit.label} label={pace.limit.label}>
|
|
@@ -2,6 +2,50 @@ import SessionSidebar from './index'
|
|
|
2
2
|
import Sidebar from '@justanarthur/modo-ui/components/navigation/sidebar'
|
|
3
3
|
import { SidebarInsetTopbar } from '@justanarthur/modo-ui/blocks/sidebar-app'
|
|
4
4
|
import { SESSIONS } from '../../../mock/mock'
|
|
5
|
+
import { useState } from 'react'
|
|
6
|
+
|
|
7
|
+
export const noop = () => {}
|
|
8
|
+
|
|
9
|
+
export const ACTIONS = {
|
|
10
|
+
onPin: noop,
|
|
11
|
+
onArchive: noop,
|
|
12
|
+
onOpenSplit: noop,
|
|
13
|
+
onRename: noop,
|
|
14
|
+
onMarkUnread: noop,
|
|
15
|
+
onFork: noop,
|
|
16
|
+
onNewSessionIn: noop,
|
|
17
|
+
onFilterSection: noop,
|
|
18
|
+
onOpenSettings: noop,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function Pinning() {
|
|
22
|
+
const [pinned, setPinned] = useState(SESSIONS.pinned)
|
|
23
|
+
const [groups, setGroups] = useState(SESSIONS.groups)
|
|
24
|
+
const onPin = (id, pin) => {
|
|
25
|
+
if (pin) {
|
|
26
|
+
const group = groups.find(g => g.sessions.some(s => s.id === id))
|
|
27
|
+
const session = group.sessions.find(s => s.id === id)
|
|
28
|
+
setGroups(groups.map(g => ({ ...g, sessions: g.sessions.filter(s => s.id !== id) })))
|
|
29
|
+
setPinned([...pinned, { ...session, pinned: true, project: group.label }])
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
const session = pinned.find(s => s.id === id)
|
|
33
|
+
setPinned(pinned.filter(s => s.id !== id))
|
|
34
|
+
setGroups(
|
|
35
|
+
groups.map(g => (g.label === session.project ? { ...g, sessions: [{ ...session, pinned: false }, ...g.sessions] } : g)),
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
return (
|
|
39
|
+
<div className="flex h-[640px] w-full overflow-hidden rounded-xl border border-border bg-background">
|
|
40
|
+
<Sidebar.Provider className="h-full min-h-0" persist={false} mobileBreakpoint={0}>
|
|
41
|
+
<SessionSidebar {...SESSIONS} pinned={pinned} groups={groups} onPin={onPin} className="h-full" />
|
|
42
|
+
<Sidebar.Inset className="min-h-0">
|
|
43
|
+
<SidebarInsetTopbar />
|
|
44
|
+
</Sidebar.Inset>
|
|
45
|
+
</Sidebar.Provider>
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
5
49
|
|
|
6
50
|
# Sessions
|
|
7
51
|
|
|
@@ -9,7 +53,7 @@ Pinned first, then a group per project and per section, the archive folded at th
|
|
|
9
53
|
|
|
10
54
|
<div className="flex h-[640px] w-full overflow-hidden rounded-xl border border-border bg-background">
|
|
11
55
|
<Sidebar.Provider className="h-full min-h-0" persist={false} mobileBreakpoint={0}>
|
|
12
|
-
<SessionSidebar {...SESSIONS} className="h-full" defaultValue="ai-app" />
|
|
56
|
+
<SessionSidebar {...SESSIONS} {...ACTIONS} className="h-full" defaultValue="ai-app" />
|
|
13
57
|
<Sidebar.Inset className="min-h-0">
|
|
14
58
|
<SidebarInsetTopbar />
|
|
15
59
|
</Sidebar.Inset>
|
|
@@ -22,7 +66,7 @@ Pinned first, then a group per project and per section, the archive folded at th
|
|
|
22
66
|
|
|
23
67
|
<div className="flex h-[640px] w-full overflow-hidden rounded-xl border border-border bg-background">
|
|
24
68
|
<Sidebar.Provider className="h-full min-h-0" persist={false} mobileBreakpoint={0}>
|
|
25
|
-
<SessionSidebar {...SESSIONS} className="h-full" variant="sidebar" defaultValue="billing" />
|
|
69
|
+
<SessionSidebar {...SESSIONS} {...ACTIONS} className="h-full" variant="sidebar" defaultValue="billing" />
|
|
26
70
|
<Sidebar.Inset className="min-h-0">
|
|
27
71
|
<SidebarInsetTopbar />
|
|
28
72
|
</Sidebar.Inset>
|
|
@@ -35,9 +79,15 @@ Pinned first, then a group per project and per section, the archive folded at th
|
|
|
35
79
|
|
|
36
80
|
<div className="flex h-[640px] w-full overflow-hidden rounded-xl border border-border bg-background">
|
|
37
81
|
<Sidebar.Provider className="h-full min-h-0" persist={false} mobileBreakpoint={0}>
|
|
38
|
-
<SessionSidebar {...SESSIONS} className="h-full" list="filters" defaultValue="state:waiting" />
|
|
82
|
+
<SessionSidebar {...SESSIONS} {...ACTIONS} className="h-full" list="filters" defaultValue="state:waiting" />
|
|
39
83
|
<Sidebar.Inset className="min-h-0">
|
|
40
84
|
<SidebarInsetTopbar />
|
|
41
85
|
</Sidebar.Inset>
|
|
42
86
|
</Sidebar.Provider>
|
|
43
87
|
</div>
|
|
88
|
+
|
|
89
|
+
# Only what your app does
|
|
90
|
+
|
|
91
|
+
Each row action, group action and the Settings row shows only with its callback. Here only `onPin` is passed: hover a row for its pin, which moves it into Pinned and back into its project; no archive, no menu, no Settings row.
|
|
92
|
+
|
|
93
|
+
<Pinning />
|
|
@@ -59,14 +59,23 @@ function ReorderAction() {
|
|
|
59
59
|
)
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/** What a row's hover actions and menu call. An action whose callback is absent is left out. */
|
|
63
|
+
type RowActions = Pick<
|
|
64
|
+
SessionSidebarProps,
|
|
65
|
+
'onOpenSplit' | 'onPin' | 'onArchive' | 'onRename' | 'onMarkUnread' | 'onFork'
|
|
66
|
+
>
|
|
67
|
+
|
|
62
68
|
interface SessionRowProps {
|
|
63
69
|
session: Session
|
|
64
70
|
/** Inside the pinned Sortable: the actions lead with a grip. */
|
|
65
71
|
reorder?: boolean
|
|
66
|
-
|
|
72
|
+
/** Inside the archive: Archive becomes Unarchive. */
|
|
73
|
+
archived?: boolean
|
|
74
|
+
actions: RowActions
|
|
67
75
|
}
|
|
68
76
|
|
|
69
|
-
function SessionRow({ session, reorder,
|
|
77
|
+
function SessionRow({ session, reorder, archived = false, actions }: SessionRowProps) {
|
|
78
|
+
const { onOpenSplit, onPin, onArchive, onRename, onMarkUnread, onFork } = actions
|
|
70
79
|
const Pin = useIcon('pin')
|
|
71
80
|
const Archive = useIcon('archive')
|
|
72
81
|
const More = useIcon('more-vertical')
|
|
@@ -76,6 +85,55 @@ function SessionRow({ session, reorder, onOpenSplit }: SessionRowProps) {
|
|
|
76
85
|
const Branch = useIcon('git-branch')
|
|
77
86
|
const glyph = STATUS_GLYPH[session.status]
|
|
78
87
|
const children = session.children ?? []
|
|
88
|
+
const pinLabel = session.pinned ? 'Unpin' : 'Pin'
|
|
89
|
+
const archiveLabel = archived ? 'Unarchive' : 'Archive'
|
|
90
|
+
|
|
91
|
+
const menu = [
|
|
92
|
+
onOpenSplit && (
|
|
93
|
+
<MenuItem key="split" icon={Columns} label="Open in split view" onSelect={() => onOpenSplit(session.id)} />
|
|
94
|
+
),
|
|
95
|
+
onRename && <MenuItem key="rename" icon={Pencil} label="Rename" onSelect={() => onRename(session.id)} />,
|
|
96
|
+
onMarkUnread && session.status !== 'unread' && (
|
|
97
|
+
<MenuItem key="unread" icon={Dot} label="Mark as unread" onSelect={() => onMarkUnread(session.id)} />
|
|
98
|
+
),
|
|
99
|
+
onFork && <MenuItem key="fork" icon={Branch} label="Fork into a new session" onSelect={() => onFork(session.id)} />,
|
|
100
|
+
reorder && onArchive && (
|
|
101
|
+
<MenuItem key="archive" icon={Archive} label={archiveLabel} onSelect={() => onArchive(session.id, !archived)} />
|
|
102
|
+
),
|
|
103
|
+
].filter(Boolean)
|
|
104
|
+
|
|
105
|
+
// Filtered: the cluster sizes the row's gutter by its child count, nulls included. A pinned row trades Archive (in its menu) for the grip.
|
|
106
|
+
const cluster = [
|
|
107
|
+
reorder && <ReorderAction key="reorder" />,
|
|
108
|
+
onPin && (
|
|
109
|
+
<Tooltip key="pin" content={pinLabel} side="top">
|
|
110
|
+
<Sidebar.MenuAction aria-label={pinLabel} onClick={() => onPin(session.id, !session.pinned)}>
|
|
111
|
+
<Pin />
|
|
112
|
+
</Sidebar.MenuAction>
|
|
113
|
+
</Tooltip>
|
|
114
|
+
),
|
|
115
|
+
!reorder && onArchive && (
|
|
116
|
+
<Tooltip key="archive" content={archiveLabel} side="top">
|
|
117
|
+
<Sidebar.MenuAction aria-label={archiveLabel} onClick={() => onArchive(session.id, !archived)}>
|
|
118
|
+
<Archive />
|
|
119
|
+
</Sidebar.MenuAction>
|
|
120
|
+
</Tooltip>
|
|
121
|
+
),
|
|
122
|
+
menu.length > 0 && (
|
|
123
|
+
<DropdownMenu key="more">
|
|
124
|
+
<DropdownTrigger
|
|
125
|
+
render={
|
|
126
|
+
<Sidebar.MenuAction aria-label="More options">
|
|
127
|
+
<More />
|
|
128
|
+
</Sidebar.MenuAction>
|
|
129
|
+
}
|
|
130
|
+
/>
|
|
131
|
+
<DropdownContent className="w-[240px] min-w-0" align="start" sideOffset={4}>
|
|
132
|
+
{menu}
|
|
133
|
+
</DropdownContent>
|
|
134
|
+
</DropdownMenu>
|
|
135
|
+
),
|
|
136
|
+
].filter(Boolean)
|
|
79
137
|
|
|
80
138
|
return (
|
|
81
139
|
<Sidebar.MenuItem
|
|
@@ -91,45 +149,7 @@ function SessionRow({ session, reorder, onOpenSplit }: SessionRowProps) {
|
|
|
91
149
|
<span className="truncate">{session.title}</span>
|
|
92
150
|
</Sidebar.MenuButton>
|
|
93
151
|
<Sidebar.MenuBadge>{session.updated}</Sidebar.MenuBadge>
|
|
94
|
-
<Sidebar.MenuActions showOnHover>
|
|
95
|
-
{/* Filtered: the cluster sizes the row's gutter by its child count, nulls included. A pinned row trades Archive (in its menu) for the grip. */}
|
|
96
|
-
{[
|
|
97
|
-
reorder && <ReorderAction key="reorder" />,
|
|
98
|
-
<Tooltip key="pin" content={session.pinned ? 'Unpin' : 'Pin'} side="top">
|
|
99
|
-
<Sidebar.MenuAction aria-label={session.pinned ? 'Unpin' : 'Pin'}>
|
|
100
|
-
<Pin />
|
|
101
|
-
</Sidebar.MenuAction>
|
|
102
|
-
</Tooltip>,
|
|
103
|
-
!reorder && (
|
|
104
|
-
<Tooltip key="archive" content="Archive" side="top">
|
|
105
|
-
<Sidebar.MenuAction aria-label="Archive">
|
|
106
|
-
<Archive />
|
|
107
|
-
</Sidebar.MenuAction>
|
|
108
|
-
</Tooltip>
|
|
109
|
-
),
|
|
110
|
-
<DropdownMenu key="more">
|
|
111
|
-
<DropdownTrigger
|
|
112
|
-
render={
|
|
113
|
-
<Sidebar.MenuAction aria-label="More options">
|
|
114
|
-
<More />
|
|
115
|
-
</Sidebar.MenuAction>
|
|
116
|
-
}
|
|
117
|
-
/>
|
|
118
|
-
<DropdownContent className="w-[240px] min-w-0" align="start" sideOffset={4}>
|
|
119
|
-
<MenuItem
|
|
120
|
-
index={0}
|
|
121
|
-
icon={Columns}
|
|
122
|
-
label="Open in split view"
|
|
123
|
-
onSelect={() => onOpenSplit?.(session.id)}
|
|
124
|
-
/>
|
|
125
|
-
<MenuItem index={1} icon={Pencil} label="Rename" />
|
|
126
|
-
<MenuItem index={2} icon={Dot} label="Mark as unread" />
|
|
127
|
-
<MenuItem index={3} icon={Branch} label="Fork into a new session" />
|
|
128
|
-
{reorder && <MenuItem index={4} icon={Archive} label="Archive" />}
|
|
129
|
-
</DropdownContent>
|
|
130
|
-
</DropdownMenu>,
|
|
131
|
-
].filter(Boolean)}
|
|
132
|
-
</Sidebar.MenuActions>
|
|
152
|
+
{cluster.length > 0 && <Sidebar.MenuActions showOnHover>{cluster}</Sidebar.MenuActions>}
|
|
133
153
|
{children.length > 0 && (
|
|
134
154
|
<Sidebar.MenuSub>
|
|
135
155
|
{children.map(child => (
|
|
@@ -237,17 +257,31 @@ interface SessionSidebarProps {
|
|
|
237
257
|
value?: string
|
|
238
258
|
/** Initial selected session id, for an uncontrolled sidebar. */
|
|
239
259
|
defaultValue?: string
|
|
240
|
-
/** Called with the session id when a row is picked
|
|
260
|
+
/** Called with the session id when a row is picked; the header's Overview row picks `'overview'` and its New session row `'new'`. */
|
|
241
261
|
onValueChange?: (value: string) => void
|
|
242
|
-
/** Called when a row's menu asks to open its session in split view. */
|
|
262
|
+
/** Called when a row's menu asks to open its session in split view. Omit to leave the menu item out. */
|
|
243
263
|
onOpenSplit?: (id: string) => void
|
|
264
|
+
/** Called by a row's pin action with the session id and whether it should now be pinned. Omit to leave the action out. */
|
|
265
|
+
onPin?: (id: string, pinned: boolean) => void
|
|
266
|
+
/** Called by a row's archive action (in a pinned row's menu, Unarchive in the archive) with the session id and whether it should now be archived. Omit to leave the action out. */
|
|
267
|
+
onArchive?: (id: string, archived: boolean) => void
|
|
268
|
+
/** Called by a row's Rename menu item with the session id: open your rename field (the title bar's, say). Omit to leave the item out. */
|
|
269
|
+
onRename?: (id: string) => void
|
|
270
|
+
/** Called by a row's Mark as unread menu item, shown on rows not already unread. Omit to leave the item out. */
|
|
271
|
+
onMarkUnread?: (id: string) => void
|
|
272
|
+
/** Called by a row's Fork into a new session menu item with the session id. Omit to leave the item out. */
|
|
273
|
+
onFork?: (id: string) => void
|
|
274
|
+
/** Called by a project group's New session action with that group. Omit to leave the action out. */
|
|
275
|
+
onNewSessionIn?: (group: SessionGroup) => void
|
|
276
|
+
/** Called by a section's Filter action with that section. Omit to leave the action out. */
|
|
277
|
+
onFilterSection?: (group: SessionGroup) => void
|
|
244
278
|
/** What needs you across sessions: a header row opens them, with the unread count. Omit for no inbox row. */
|
|
245
279
|
inbox?: InboxItem[]
|
|
246
280
|
/** Called when an inbox row is answered or opened. */
|
|
247
281
|
onInboxAction?: (item: InboxItem, action: InboxAction) => void
|
|
248
282
|
/** Called when the search field is clicked or Enter is pressed in it: open your ⌘K palette. Omit to keep it a plain field. */
|
|
249
283
|
onSearch?: () => void
|
|
250
|
-
/** Called by the footer's
|
|
284
|
+
/** Called by the footer's Settings row and the usage's manage action. Omit to leave the Settings row out. */
|
|
251
285
|
onOpenSettings?: () => void
|
|
252
286
|
/** The sidebar's layout (see Sidebar). Defaults to `'inset'`. */
|
|
253
287
|
variant?: 'sidebar' | 'floating' | 'inset'
|
|
@@ -269,9 +303,15 @@ interface SessionSidebarProps {
|
|
|
269
303
|
* A row's leading glyph is its state: an arc turning while it runs, an
|
|
270
304
|
* amber dot while it waits for you, a filled dot for an unread reply and a
|
|
271
305
|
* ring when idle; its badge is the last activity. Hover a row for pin,
|
|
272
|
-
* archive and a menu that opens the session in split view, renames it
|
|
273
|
-
* forks it.
|
|
274
|
-
*
|
|
306
|
+
* archive and a menu that opens the session in split view, renames it,
|
|
307
|
+
* marks it unread or forks it. Each of those actions, a group's New session
|
|
308
|
+
* or Filter action and the footer's Settings row shows only when you pass
|
|
309
|
+
* its callback (`onPin`, `onArchive`, `onOpenSplit`, `onRename`,
|
|
310
|
+
* `onMarkUnread`, `onFork`, `onNewSessionIn`, `onFilterSection`,
|
|
311
|
+
* `onOpenSettings`), so the sidebar offers only what your app does. The
|
|
312
|
+
* Overview and New session rows are picks like a session's: `onValueChange`
|
|
313
|
+
* gets `'overview'` or `'new'`. Sessions started from another one fold
|
|
314
|
+
* under it as linked children. Pick a row and the active background melts over to it.
|
|
275
315
|
*
|
|
276
316
|
* On the overview, whose board is the session list widened, `list="filters"`
|
|
277
317
|
* trades the list for filters: by state, project and profile, each with its
|
|
@@ -294,6 +334,13 @@ export default function SessionSidebar({
|
|
|
294
334
|
defaultValue,
|
|
295
335
|
onValueChange,
|
|
296
336
|
onOpenSplit,
|
|
337
|
+
onPin,
|
|
338
|
+
onArchive,
|
|
339
|
+
onRename,
|
|
340
|
+
onMarkUnread,
|
|
341
|
+
onFork,
|
|
342
|
+
onNewSessionIn,
|
|
343
|
+
onFilterSection,
|
|
297
344
|
onOpenSettings,
|
|
298
345
|
inbox,
|
|
299
346
|
onInboxAction,
|
|
@@ -308,6 +355,7 @@ export default function SessionSidebar({
|
|
|
308
355
|
const Bell = useIcon('bell')
|
|
309
356
|
const unread = inbox?.filter(item => !item.read).length ?? 0
|
|
310
357
|
const waiting = everySession(pinned, groups).filter(s => s.status === 'waiting').length
|
|
358
|
+
const actions = { onOpenSplit, onPin, onArchive, onRename, onMarkUnread, onFork }
|
|
311
359
|
|
|
312
360
|
return (
|
|
313
361
|
<Sidebar
|
|
@@ -378,38 +426,43 @@ export default function SessionSidebar({
|
|
|
378
426
|
items={pinned.map(session => ({
|
|
379
427
|
id: session.id,
|
|
380
428
|
label: session.title,
|
|
381
|
-
content: <SessionRow session={session} reorder
|
|
429
|
+
content: <SessionRow session={session} reorder actions={actions} />,
|
|
382
430
|
}))}
|
|
383
431
|
onOrderChange={onPinnedOrderChange}
|
|
384
432
|
/>
|
|
385
433
|
</Sidebar.Menu>
|
|
386
434
|
</Sidebar.Group>
|
|
387
435
|
|
|
388
|
-
{groups.map(group =>
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
)
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
436
|
+
{groups.map(group => {
|
|
437
|
+
const isProject = group.kind === 'project'
|
|
438
|
+
const onAction = isProject ? onNewSessionIn : onFilterSection
|
|
439
|
+
const label = isProject ? `New session in ${group.label}` : 'Filter'
|
|
440
|
+
return (
|
|
441
|
+
<Sidebar.Group key={group.label} collapsible>
|
|
442
|
+
<Sidebar.GroupLabel>{group.label}</Sidebar.GroupLabel>
|
|
443
|
+
{onAction && (
|
|
444
|
+
<Sidebar.GroupActions>
|
|
445
|
+
<Tooltip content={label} side="top">
|
|
446
|
+
<Sidebar.GroupAction aria-label={label} onClick={() => onAction(group)}>
|
|
447
|
+
{isProject ? <Plus /> : <Filter />}
|
|
448
|
+
</Sidebar.GroupAction>
|
|
449
|
+
</Tooltip>
|
|
450
|
+
</Sidebar.GroupActions>
|
|
451
|
+
)}
|
|
452
|
+
<Sidebar.Menu>
|
|
453
|
+
{group.sessions.map(session => (
|
|
454
|
+
<SessionRow key={session.id} session={session} actions={actions} />
|
|
455
|
+
))}
|
|
456
|
+
</Sidebar.Menu>
|
|
457
|
+
</Sidebar.Group>
|
|
458
|
+
)
|
|
459
|
+
})}
|
|
407
460
|
|
|
408
461
|
<Sidebar.Group collapsible defaultOpen={false}>
|
|
409
462
|
<Sidebar.GroupLabel>Archived</Sidebar.GroupLabel>
|
|
410
463
|
<Sidebar.Menu>
|
|
411
464
|
{archived.map(session => (
|
|
412
|
-
<SessionRow key={session.id} session={session}
|
|
465
|
+
<SessionRow key={session.id} session={session} archived actions={actions} />
|
|
413
466
|
))}
|
|
414
467
|
</Sidebar.Menu>
|
|
415
468
|
</Sidebar.Group>
|
|
@@ -422,16 +475,18 @@ export default function SessionSidebar({
|
|
|
422
475
|
<Sidebar.GroupLabel>Usage</Sidebar.GroupLabel>
|
|
423
476
|
<ProfileUsage profiles={profiles} onManage={onOpenSettings} />
|
|
424
477
|
</Sidebar.Group>
|
|
425
|
-
|
|
426
|
-
<Sidebar.
|
|
427
|
-
<Sidebar.
|
|
428
|
-
Settings
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
478
|
+
{onOpenSettings && (
|
|
479
|
+
<Sidebar.Menu>
|
|
480
|
+
<Sidebar.MenuItem>
|
|
481
|
+
<Sidebar.MenuButton icon={Settings} onClick={onOpenSettings}>
|
|
482
|
+
Settings
|
|
483
|
+
<Kbd variant="plain" className="ml-auto">
|
|
484
|
+
⌘,
|
|
485
|
+
</Kbd>
|
|
486
|
+
</Sidebar.MenuButton>
|
|
487
|
+
</Sidebar.MenuItem>
|
|
488
|
+
</Sidebar.Menu>
|
|
489
|
+
)}
|
|
435
490
|
</Sidebar.Footer>
|
|
436
491
|
</Sidebar>
|
|
437
492
|
)
|
|
@@ -23,6 +23,14 @@ A background run carries a badge and keeps turning after the turn ends.
|
|
|
23
23
|
<AgentRun agent="general-purpose" description="Run the full test suite on main" status="running" background meta="3 tool uses" />
|
|
24
24
|
</div>
|
|
25
25
|
|
|
26
|
+
# Waiting on you
|
|
27
|
+
|
|
28
|
+
Held on a permission or a question: the warning dot, as on a waiting ToolCall.
|
|
29
|
+
|
|
30
|
+
<div className="w-full max-w-2xl">
|
|
31
|
+
<AgentRun agent="general-purpose" description="Migrate the settings store" status="waiting" meta="7 tool uses" />
|
|
32
|
+
</div>
|
|
33
|
+
|
|
26
34
|
# Failed
|
|
27
35
|
|
|
28
36
|
<div className="w-full max-w-2xl">
|
|
@@ -13,14 +13,14 @@ import type { ReactNode } from 'react'
|
|
|
13
13
|
import { type IconName, useIcon } from '../../../lib/icons'
|
|
14
14
|
import { ToolStatusMark } from '../tool-call'
|
|
15
15
|
|
|
16
|
-
type AgentRunStatus = 'running' | 'done' | 'error'
|
|
16
|
+
type AgentRunStatus = 'running' | 'waiting' | 'done' | 'error'
|
|
17
17
|
|
|
18
18
|
interface AgentRunProps {
|
|
19
19
|
/** The agent's name or type: `Explore`, `researcher`, a custom agent. */
|
|
20
20
|
agent: string
|
|
21
21
|
/** What it was asked to do, in a few words. */
|
|
22
22
|
description: string
|
|
23
|
-
/** Where it stands. Defaults to `'done'`. */
|
|
23
|
+
/** Where it stands: `'waiting'` while it is held on you (a permission, a question). Defaults to `'done'`. */
|
|
24
24
|
status?: AgentRunStatus
|
|
25
25
|
/** Ran detached: the conversation went on without waiting. Defaults to `false`. */
|
|
26
26
|
background?: boolean
|
|
@@ -37,7 +37,8 @@ interface AgentRunProps {
|
|
|
37
37
|
* its calls and its report.
|
|
38
38
|
*
|
|
39
39
|
* The header names the agent and its task, with the tally and the run's
|
|
40
|
-
* state on the right (the Spinner while it runs, the
|
|
40
|
+
* state on the right (the Spinner while it runs, the warning dot while it
|
|
41
|
+
* waits on you, the failed mark on error).
|
|
41
42
|
* A background run carries a badge: the conversation went on without
|
|
42
43
|
* waiting for it. Inside, a `ToolCall.Group` lists its calls and a line of
|
|
43
44
|
* text its report.
|
|
@@ -13,7 +13,7 @@ import { useShape } from '@justanarthur/modo-ui/lib/shape-context'
|
|
|
13
13
|
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
14
14
|
import type { ReactNode } from 'react'
|
|
15
15
|
import { useIcon } from '../../../lib/icons'
|
|
16
|
-
import { Working, type WorkingProps } from './working'
|
|
16
|
+
import { Working as WorkingDots, type WorkingProps } from './working'
|
|
17
17
|
|
|
18
18
|
type MessageRole = 'user' | 'assistant'
|
|
19
19
|
|
|
@@ -25,7 +25,7 @@ interface MentionProps {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/** An @-mention of a file inside a message. */
|
|
28
|
-
function
|
|
28
|
+
function MentionChip({ path }: MentionProps) {
|
|
29
29
|
const At = useIcon('at-sign')
|
|
30
30
|
return (
|
|
31
31
|
<span className="inline-flex translate-y-px items-center gap-0.5 rounded-glyph bg-active px-1 align-baseline font-mono text-caption text-foreground">
|
|
@@ -45,7 +45,7 @@ interface AttachmentProps {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/** A file, image or pasted text that came with a message. */
|
|
48
|
-
function
|
|
48
|
+
function AttachmentChip({ name, detail, kind = 'file' }: AttachmentProps) {
|
|
49
49
|
const shape = useShape()
|
|
50
50
|
const Icon = useIcon(kind === 'pasted' ? 'clipboard' : kind === 'image' ? 'image' : 'file-text')
|
|
51
51
|
return (
|
|
@@ -101,7 +101,7 @@ const Message = Object.assign(
|
|
|
101
101
|
return (
|
|
102
102
|
<MarkdownProse className={className}>
|
|
103
103
|
{children}
|
|
104
|
-
{streaming && <
|
|
104
|
+
{streaming && <WorkingDots />}
|
|
105
105
|
</MarkdownProse>
|
|
106
106
|
)
|
|
107
107
|
|
|
@@ -119,10 +119,12 @@ const Message = Object.assign(
|
|
|
119
119
|
</div>
|
|
120
120
|
)
|
|
121
121
|
},
|
|
122
|
-
|
|
122
|
+
// No key names a binding of this file: the declaration bundler renames a clashing
|
|
123
|
+
// binding to Name2, and a key spelled like it goes along (`Message.Working2`).
|
|
124
|
+
{ Mention: MentionChip, Attachment: AttachmentChip, Working: WorkingDots },
|
|
123
125
|
)
|
|
124
126
|
|
|
125
127
|
export type { AttachmentKind, AttachmentProps, MentionProps, MessageProps, MessageRole, WorkingProps }
|
|
126
|
-
export { Attachment, Mention, Message, Working }
|
|
128
|
+
export { AttachmentChip as Attachment, MentionChip as Mention, Message, WorkingDots as Working }
|
|
127
129
|
|
|
128
130
|
export default Message
|
|
@@ -20,3 +20,13 @@ Starts unfolded.
|
|
|
20
20
|
<p className="m-0">The hover fill already reaches into the margin, so the label stays flush with the text.</p>
|
|
21
21
|
</Reasoning>
|
|
22
22
|
</div>
|
|
23
|
+
|
|
24
|
+
# No timing
|
|
25
|
+
|
|
26
|
+
Without a `duration` (a source that doesn't report how long it thought), the row reads "Thought".
|
|
27
|
+
|
|
28
|
+
<div className="w-full max-w-2xl">
|
|
29
|
+
<Reasoning>
|
|
30
|
+
<p className="m-0">The CLI streams the thinking but not its timing, so the row leaves the duration out.</p>
|
|
31
|
+
</Reasoning>
|
|
32
|
+
</div>
|