@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
|
@@ -25,7 +25,7 @@ interface OfferProps {
|
|
|
25
25
|
onChoose?: (where: 'new-session' | 'here') => void
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
function
|
|
28
|
+
function OfferPrompt({ title, brief, onChoose }: OfferProps) {
|
|
29
29
|
return (
|
|
30
30
|
<PromptCard
|
|
31
31
|
icon="split"
|
|
@@ -58,7 +58,7 @@ interface TaskProps {
|
|
|
58
58
|
onDecide?: (decision: 'start' | 'dismiss') => void
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
function
|
|
61
|
+
function TaskPrompt({ title, brief, where, onDecide }: TaskProps) {
|
|
62
62
|
return (
|
|
63
63
|
<PromptCard
|
|
64
64
|
icon="git-fork"
|
|
@@ -104,7 +104,7 @@ const AgentPrompt = Object.assign(
|
|
|
104
104
|
function AgentPrompt(props: AgentPromptProps) {
|
|
105
105
|
return <PromptCard {...props} />
|
|
106
106
|
},
|
|
107
|
-
{ Permission: PermissionRequest, Question: QuestionPrompt, Plan: PlanApproval, Offer:
|
|
107
|
+
{ Permission: PermissionRequest, Question: QuestionPrompt, Plan: PlanApproval, Offer: OfferPrompt, Task: TaskPrompt },
|
|
108
108
|
)
|
|
109
109
|
|
|
110
110
|
export type { AgentPromptProps, OfferProps, TaskProps }
|
|
@@ -1,8 +1,52 @@
|
|
|
1
1
|
import Composer from './index'
|
|
2
2
|
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
3
3
|
import { Plus } from 'lucide-react'
|
|
4
|
+
import { useState } from 'react'
|
|
4
5
|
import { COMPOSER, ZCODE_MODELS } from '../../../mock/mock'
|
|
5
6
|
|
|
7
|
+
export function ControlledSettings() {
|
|
8
|
+
const [project, setProject] = useState(COMPOSER.projects[0].path)
|
|
9
|
+
const [worktree, setWorktree] = useState(true)
|
|
10
|
+
const [baseBranch, setBaseBranch] = useState(COMPOSER.branches[0])
|
|
11
|
+
const [profile, setProfile] = useState(COMPOSER.profiles[0].id)
|
|
12
|
+
const [model, setModel] = useState('Sonnet 5.5')
|
|
13
|
+
const [effort, setEffort] = useState('High')
|
|
14
|
+
const [permissionMode, setPermissionMode] = useState('Accept edits')
|
|
15
|
+
const [fast, setFast] = useState(false)
|
|
16
|
+
const [outputStyle, setOutputStyle] = useState('Default')
|
|
17
|
+
return (
|
|
18
|
+
<div className="flex h-[240px] w-full max-w-2xl flex-col justify-end gap-3">
|
|
19
|
+
<Composer
|
|
20
|
+
{...COMPOSER}
|
|
21
|
+
target
|
|
22
|
+
context={0}
|
|
23
|
+
project={project}
|
|
24
|
+
onProjectChange={setProject}
|
|
25
|
+
worktree={worktree}
|
|
26
|
+
onWorktreeChange={setWorktree}
|
|
27
|
+
baseBranch={baseBranch}
|
|
28
|
+
onBaseBranchChange={setBaseBranch}
|
|
29
|
+
profile={profile}
|
|
30
|
+
onProfileChange={setProfile}
|
|
31
|
+
model={model}
|
|
32
|
+
onModelChange={setModel}
|
|
33
|
+
effort={effort}
|
|
34
|
+
onEffortChange={setEffort}
|
|
35
|
+
permissionMode={permissionMode}
|
|
36
|
+
onPermissionModeChange={setPermissionMode}
|
|
37
|
+
fast={fast}
|
|
38
|
+
onFastChange={setFast}
|
|
39
|
+
outputStyle={outputStyle}
|
|
40
|
+
onOutputStyleChange={setOutputStyle}
|
|
41
|
+
/>
|
|
42
|
+
<code className="font-mono text-caption text-muted-foreground">
|
|
43
|
+
{profile} · {project}{worktree ? ` (worktree from ${baseBranch})` : ''} · --model "{model}" --effort "{effort}"
|
|
44
|
+
--permission-mode "{permissionMode}"{fast ? ' · fast' : ''} · {outputStyle}
|
|
45
|
+
</code>
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
6
50
|
# Composer
|
|
7
51
|
|
|
8
52
|
In the draft, the + palette and the run trigger (permission mode, model, effort, context ring) that opens the run settings. On the shell, where the session runs: the project and the profile with its usage lines.
|
|
@@ -19,6 +63,12 @@ In the draft, the + palette and the run trigger (permission mode, model, effort,
|
|
|
19
63
|
<Composer {...COMPOSER} target context={0} placeholder="Describe the task, or type / for commands" />
|
|
20
64
|
</div>
|
|
21
65
|
|
|
66
|
+
# Controlled settings
|
|
67
|
+
|
|
68
|
+
Every choice on the row is controllable: the caller holds the project (by its path), the worktree, the base branch, the profile, the model, the effort, the permission mode, fast mode and the output style, and passes them on to the agent.
|
|
69
|
+
|
|
70
|
+
<ControlledSettings />
|
|
71
|
+
|
|
22
72
|
# Near compaction
|
|
23
73
|
|
|
24
74
|
Past 80% the context ring in the run trigger turns amber; at 95% it compacts.
|
|
@@ -24,9 +24,9 @@ import Switch from '@justanarthur/modo-ui/components/inputs/switch'
|
|
|
24
24
|
import Dropdown from '@justanarthur/modo-ui/components/overlays/dropdown'
|
|
25
25
|
import Popover from '@justanarthur/modo-ui/components/overlays/popover'
|
|
26
26
|
import { SURFACE_BG } from '@justanarthur/modo-ui/lib/surface-classes'
|
|
27
|
+
import { useControllableState } from '@justanarthur/modo-ui/lib/use-controllable-state'
|
|
27
28
|
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
28
29
|
import { SizeProvider } from '@justanarthur/modo-ui/primitives/systems/sizes'
|
|
29
|
-
import { useState } from 'react'
|
|
30
30
|
import { useIcon } from '../../../lib/icons'
|
|
31
31
|
import { RowTrigger } from '../../../lib/row-trigger'
|
|
32
32
|
import type { Command, Model, PermissionMode, Profile, Project } from '../../../lib/types'
|
|
@@ -83,29 +83,47 @@ function AddPalette({ files, commands, onAttach }: { files: string[]; commands:
|
|
|
83
83
|
)
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
/** `value` while `options` holds it, else `fallback`: a pick never outlives its list. */
|
|
87
|
+
function inList(value: string, options: string[], fallback = options[0] ?? '') {
|
|
88
|
+
return options.includes(value) ? value : fallback
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface ProjectPickerProps {
|
|
92
|
+
projects: Project[]
|
|
93
|
+
branches: string[]
|
|
94
|
+
branch?: string
|
|
95
|
+
locked: boolean
|
|
96
|
+
project: string
|
|
97
|
+
onProjectChange: (path: string) => void
|
|
98
|
+
worktree: boolean
|
|
99
|
+
onWorktreeChange: (worktree: boolean) => void
|
|
100
|
+
baseBranch: string
|
|
101
|
+
onBaseBranchChange: (branch: string) => void
|
|
102
|
+
}
|
|
103
|
+
|
|
86
104
|
/** Where a session runs: the project, a worktree of its own and how it is set up. */
|
|
87
105
|
function ProjectPicker({
|
|
88
106
|
projects,
|
|
89
107
|
branches,
|
|
90
108
|
branch,
|
|
91
109
|
locked,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const
|
|
110
|
+
project,
|
|
111
|
+
onProjectChange,
|
|
112
|
+
worktree,
|
|
113
|
+
onWorktreeChange,
|
|
114
|
+
baseBranch,
|
|
115
|
+
onBaseBranchChange,
|
|
116
|
+
}: ProjectPickerProps) {
|
|
117
|
+
const label = projects.find(p => p.path === project)?.label ?? ''
|
|
100
118
|
const Folder = useIcon('folder')
|
|
101
119
|
const Branch = useIcon('git-branch')
|
|
102
120
|
return (
|
|
103
121
|
<Popover>
|
|
104
122
|
<Popover.Trigger
|
|
105
123
|
render={
|
|
106
|
-
<RowTrigger aria-label={`Project: ${
|
|
124
|
+
<RowTrigger aria-label={`Project: ${label}${worktree ? ', new worktree' : ''}`}>
|
|
107
125
|
<Folder size={14} strokeWidth={1.5} className="shrink-0 text-muted-foreground" />
|
|
108
|
-
<span className="min-w-0 truncate">{
|
|
126
|
+
<span className="min-w-0 truncate">{label}</span>
|
|
109
127
|
{worktree && <Branch size={14} strokeWidth={1.5} className="shrink-0 text-muted-foreground" />}
|
|
110
128
|
</RowTrigger>
|
|
111
129
|
}
|
|
@@ -116,11 +134,11 @@ function ProjectPicker({
|
|
|
116
134
|
<ChoiceList
|
|
117
135
|
label="Project"
|
|
118
136
|
value={project}
|
|
119
|
-
onValueChange={
|
|
137
|
+
onValueChange={onProjectChange}
|
|
120
138
|
options={projects.map(g => ({
|
|
121
|
-
value: g.
|
|
139
|
+
value: g.path,
|
|
122
140
|
label: g.label,
|
|
123
|
-
disabled: locked && g.
|
|
141
|
+
disabled: locked && g.path !== project,
|
|
124
142
|
content: (
|
|
125
143
|
<span className="flex min-w-0 flex-1 items-baseline justify-between gap-2">
|
|
126
144
|
<span className="text-body text-foreground">{g.label}</span>
|
|
@@ -140,7 +158,7 @@ function ProjectPicker({
|
|
|
140
158
|
<Switch
|
|
141
159
|
label="New worktree"
|
|
142
160
|
checked={worktree}
|
|
143
|
-
onCheckedChange={
|
|
161
|
+
onCheckedChange={onWorktreeChange}
|
|
144
162
|
disabled={locked}
|
|
145
163
|
className={LIST_SWITCH}
|
|
146
164
|
/>
|
|
@@ -149,7 +167,7 @@ function ProjectPicker({
|
|
|
149
167
|
<Switch label="Run setup script" defaultChecked disabled={locked} className={LIST_SWITCH} />
|
|
150
168
|
</List.Row>
|
|
151
169
|
<List.Row label="Base branch">
|
|
152
|
-
<Select
|
|
170
|
+
<Select value={baseBranch} onValueChange={onBaseBranchChange} disabled={locked}>
|
|
153
171
|
<Select.Trigger variant="borderless" className="min-w-0" />
|
|
154
172
|
<Select.Content>
|
|
155
173
|
{branches.map((b, i) => (
|
|
@@ -174,10 +192,16 @@ interface RunSettingsProps {
|
|
|
174
192
|
outputStyles: string[]
|
|
175
193
|
context: number
|
|
176
194
|
compacting: boolean
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
195
|
+
model: string
|
|
196
|
+
onModelChange: (model: string) => void
|
|
197
|
+
effort: string
|
|
198
|
+
onEffortChange: (effort: string) => void
|
|
199
|
+
mode: string
|
|
200
|
+
onModeChange: (mode: string) => void
|
|
201
|
+
fast: boolean
|
|
202
|
+
onFastChange: (fast: boolean) => void
|
|
203
|
+
style: string
|
|
204
|
+
onStyleChange: (style: string) => void
|
|
181
205
|
}
|
|
182
206
|
|
|
183
207
|
/** How the agent runs, behind one trigger: "Opus 5.5 · High ◔". */
|
|
@@ -188,16 +212,17 @@ function RunSettings({
|
|
|
188
212
|
outputStyles,
|
|
189
213
|
context,
|
|
190
214
|
compacting,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
215
|
+
model,
|
|
216
|
+
onModelChange,
|
|
217
|
+
effort,
|
|
218
|
+
onEffortChange,
|
|
219
|
+
mode,
|
|
220
|
+
onModeChange,
|
|
221
|
+
fast,
|
|
222
|
+
onFastChange,
|
|
223
|
+
style,
|
|
224
|
+
onStyleChange,
|
|
195
225
|
}: RunSettingsProps) {
|
|
196
|
-
const [model, setModel] = useState(defaultModel)
|
|
197
|
-
const [effort, setEffort] = useState(defaultEffort)
|
|
198
|
-
const [mode, setMode] = useState(defaultMode)
|
|
199
|
-
const [fast, setFast] = useState(defaultFast)
|
|
200
|
-
const [style, setStyle] = useState(outputStyles[0] ?? '')
|
|
201
226
|
const activeMode = permissionModes.find(m => m.label === mode)
|
|
202
227
|
const ModeIcon = useIcon(activeMode?.icon ?? 'shield-check')
|
|
203
228
|
const Zap = useIcon('zap')
|
|
@@ -226,7 +251,7 @@ function RunSettings({
|
|
|
226
251
|
<ChoiceList
|
|
227
252
|
label="Model"
|
|
228
253
|
value={model}
|
|
229
|
-
onValueChange={
|
|
254
|
+
onValueChange={onModelChange}
|
|
230
255
|
options={models.map(m => ({
|
|
231
256
|
value: m.name,
|
|
232
257
|
label: m.name,
|
|
@@ -247,13 +272,13 @@ function RunSettings({
|
|
|
247
272
|
max={efforts.length - 1}
|
|
248
273
|
step={1}
|
|
249
274
|
value={Math.max(efforts.indexOf(effort), 0)}
|
|
250
|
-
onValueChange={v =>
|
|
275
|
+
onValueChange={v => onEffortChange(efforts[typeof v === 'number' ? v : v[0]] ?? effort)}
|
|
251
276
|
formatValue={v => efforts[v] ?? ''}
|
|
252
277
|
/>
|
|
253
278
|
</div>
|
|
254
279
|
<List.Section title="Behaviour">
|
|
255
280
|
<List.Row label="Permissions">
|
|
256
|
-
<Select value={mode} onValueChange={
|
|
281
|
+
<Select value={mode} onValueChange={onModeChange}>
|
|
257
282
|
<Select.Trigger variant="borderless" icon={ModeIcon} className="min-w-0" title={activeMode?.note} />
|
|
258
283
|
<Select.Content>
|
|
259
284
|
{permissionModes.map((m, i) => (
|
|
@@ -265,10 +290,10 @@ function RunSettings({
|
|
|
265
290
|
</Select>
|
|
266
291
|
</List.Row>
|
|
267
292
|
<List.Row label="Fast mode">
|
|
268
|
-
<Switch label="Fast mode" checked={fast} onCheckedChange={
|
|
293
|
+
<Switch label="Fast mode" checked={fast} onCheckedChange={onFastChange} className={LIST_SWITCH} />
|
|
269
294
|
</List.Row>
|
|
270
295
|
<List.Row label="Output style">
|
|
271
|
-
<Select value={style} onValueChange={
|
|
296
|
+
<Select value={style} onValueChange={onStyleChange}>
|
|
272
297
|
<Select.Trigger variant="borderless" className="min-w-0" />
|
|
273
298
|
<Select.Content>
|
|
274
299
|
{outputStyles.map((o, i) => (
|
|
@@ -333,16 +358,56 @@ interface ComposerProps {
|
|
|
333
358
|
branches: string[]
|
|
334
359
|
/** The session's own branch, shown in the project menu. Omit before the session has one. */
|
|
335
360
|
branch?: string
|
|
361
|
+
/** The project the session runs in, by `Project.path`, controlled. Pair with `onProjectChange`. A path not in `projects` shows, and stands for, the first project. */
|
|
362
|
+
project?: string
|
|
363
|
+
/** The initial project, by `Project.path`, when uncontrolled. Defaults to the first project. */
|
|
364
|
+
defaultProject?: string
|
|
365
|
+
/** Called with the picked project's `path`. Only a new session (`target`) can pick one. */
|
|
366
|
+
onProjectChange?: (path: string) => void
|
|
367
|
+
/** Whether the session gets a new git worktree, controlled. Pair with `onWorktreeChange`. */
|
|
368
|
+
worktree?: boolean
|
|
369
|
+
/** Start with a new worktree when uncontrolled. Defaults to `true`. */
|
|
370
|
+
defaultWorktree?: boolean
|
|
371
|
+
/** Called when the new-worktree switch flips. Only a new session (`target`) can flip it. */
|
|
372
|
+
onWorktreeChange?: (worktree: boolean) => void
|
|
373
|
+
/** The branch a new worktree starts from, controlled. Pair with `onBaseBranchChange`. A branch not in `branches` stands for the first one. */
|
|
374
|
+
baseBranch?: string
|
|
375
|
+
/** The initial base branch when uncontrolled. Defaults to the first branch. */
|
|
376
|
+
defaultBaseBranch?: string
|
|
377
|
+
/** Called with the base branch picked. Only a new session (`target`) can pick one. */
|
|
378
|
+
onBaseBranchChange?: (branch: string) => void
|
|
336
379
|
/** The profiles a session can run under. */
|
|
337
380
|
profiles: Profile[]
|
|
338
|
-
/**
|
|
381
|
+
/** The model, by name, controlled. Pair with `onModelChange`. A name not in `models` (say, after a switch to another provider) stands for the first model. */
|
|
382
|
+
model?: string
|
|
383
|
+
/** Initial model, by name, when uncontrolled. Defaults to the first model. */
|
|
339
384
|
defaultModel?: string
|
|
340
|
-
/**
|
|
341
|
-
|
|
342
|
-
/**
|
|
385
|
+
/** Called with the model's name when another one is picked. */
|
|
386
|
+
onModelChange?: (model: string) => void
|
|
387
|
+
/** The effort step, controlled. Pair with `onEffortChange`. A step not in `efforts` stands for the middle one. */
|
|
388
|
+
effort?: string
|
|
389
|
+
/** Initial effort when uncontrolled. Defaults to the middle step. */
|
|
343
390
|
defaultEffort?: string
|
|
344
|
-
/**
|
|
391
|
+
/** Called with the effort step the slider lands on. */
|
|
392
|
+
onEffortChange?: (effort: string) => void
|
|
393
|
+
/** The permission mode, by label, controlled. Pair with `onPermissionModeChange`. A label not in `permissionModes` stands for the first mode. */
|
|
394
|
+
permissionMode?: string
|
|
395
|
+
/** Initial permission mode, by label, when uncontrolled. Defaults to the first mode. */
|
|
396
|
+
defaultPermissionMode?: string
|
|
397
|
+
/** Called with the permission mode's label when another one is picked. */
|
|
398
|
+
onPermissionModeChange?: (mode: string) => void
|
|
399
|
+
/** Whether fast mode is on, controlled. Pair with `onFastChange`. */
|
|
400
|
+
fast?: boolean
|
|
401
|
+
/** Start with fast mode on when uncontrolled. Defaults to `false`. */
|
|
345
402
|
defaultFast?: boolean
|
|
403
|
+
/** Called when the fast mode switch flips. */
|
|
404
|
+
onFastChange?: (fast: boolean) => void
|
|
405
|
+
/** The output style, controlled. Pair with `onOutputStyleChange`. A style not in `outputStyles` stands for the first one. */
|
|
406
|
+
outputStyle?: string
|
|
407
|
+
/** Initial output style when uncontrolled. Defaults to the first style. */
|
|
408
|
+
defaultOutputStyle?: string
|
|
409
|
+
/** Called with the output style picked. */
|
|
410
|
+
onOutputStyleChange?: (style: string) => void
|
|
346
411
|
/** Used share of the context window, 0–1. Defaults to `0.62`. */
|
|
347
412
|
context?: number
|
|
348
413
|
/** The conversation is being compacted: the context meter says so. Defaults to `false`. */
|
|
@@ -379,9 +444,11 @@ interface ComposerProps {
|
|
|
379
444
|
maxFiles?: number
|
|
380
445
|
/** A new session: the project and profile can still be picked. Otherwise they show where this session runs. Defaults to `false`. */
|
|
381
446
|
target?: boolean
|
|
382
|
-
/** The profile the session runs under, by id.
|
|
447
|
+
/** The profile the session runs under, by id, controlled. Pair with `onProfileChange`. An id not in `profiles` shows the first profile. */
|
|
448
|
+
profile?: string
|
|
449
|
+
/** The profile the session runs under, by id, when uncontrolled. Defaults to the first profile. */
|
|
383
450
|
defaultProfile?: string
|
|
384
|
-
/** Called with the profile picked. */
|
|
451
|
+
/** Called with the profile picked, by id. */
|
|
385
452
|
onProfileChange?: (profile: string) => void
|
|
386
453
|
/** The draft's placeholder. Defaults to `'Ask, or type / for commands'`. */
|
|
387
454
|
placeholder?: string
|
|
@@ -421,7 +488,14 @@ interface ComposerProps {
|
|
|
421
488
|
*
|
|
422
489
|
* Every draft prop has its uncontrolled twin (`defaultValue`,
|
|
423
490
|
* `defaultQueue`, `defaultStatus`), so a composer runs with no state in the
|
|
424
|
-
* caller.
|
|
491
|
+
* caller. So does every choice on the row: the project (by its `path`), the
|
|
492
|
+
* worktree switch, the base branch, the profile, the model, the effort, the
|
|
493
|
+
* permission mode, fast mode and the output style each take a controlled
|
|
494
|
+
* prop, a `default…` and an `on…Change`, so an app can pass them on to the
|
|
495
|
+
* agent (`--model`, `--effort`, `--permission-mode`). A choice its list no
|
|
496
|
+
* longer holds (a model after a switch to another provider, a project that
|
|
497
|
+
* was removed) stands for the list's first entry (the middle one for effort)
|
|
498
|
+
* instead of lingering.
|
|
425
499
|
*
|
|
426
500
|
* Statics:
|
|
427
501
|
* - `Composer.Draft` — the draft alone, without the shell and its menus:
|
|
@@ -448,21 +522,63 @@ const Composer = Object.assign(
|
|
|
448
522
|
projects,
|
|
449
523
|
branches,
|
|
450
524
|
branch,
|
|
525
|
+
project: projectProp,
|
|
526
|
+
defaultProject,
|
|
527
|
+
onProjectChange,
|
|
528
|
+
worktree: worktreeProp,
|
|
529
|
+
defaultWorktree = true,
|
|
530
|
+
onWorktreeChange,
|
|
531
|
+
baseBranch: baseBranchProp,
|
|
532
|
+
defaultBaseBranch,
|
|
533
|
+
onBaseBranchChange,
|
|
451
534
|
profiles,
|
|
535
|
+
model: modelProp,
|
|
452
536
|
defaultModel,
|
|
453
|
-
|
|
537
|
+
onModelChange,
|
|
538
|
+
effort: effortProp,
|
|
454
539
|
defaultEffort,
|
|
540
|
+
onEffortChange,
|
|
541
|
+
permissionMode: permissionModeProp,
|
|
542
|
+
defaultPermissionMode,
|
|
543
|
+
onPermissionModeChange,
|
|
544
|
+
fast: fastProp,
|
|
455
545
|
defaultFast = false,
|
|
546
|
+
onFastChange,
|
|
547
|
+
outputStyle: outputStyleProp,
|
|
548
|
+
defaultOutputStyle,
|
|
549
|
+
onOutputStyleChange,
|
|
456
550
|
context = 0.62,
|
|
457
551
|
compacting = false,
|
|
458
552
|
defaultStatus = 'idle',
|
|
459
553
|
target = false,
|
|
554
|
+
profile,
|
|
460
555
|
defaultProfile,
|
|
461
556
|
onProfileChange,
|
|
462
557
|
placeholder = 'Ask, or type / for commands',
|
|
463
558
|
className,
|
|
464
559
|
...draft
|
|
465
560
|
}: ComposerProps) {
|
|
561
|
+
const projectPaths = projects.map(p => p.path)
|
|
562
|
+
const modelNames = models.map(m => m.name)
|
|
563
|
+
const modeLabels = permissionModes.map(m => m.label)
|
|
564
|
+
const middleEffort = efforts[Math.floor(efforts.length / 2)] ?? ''
|
|
565
|
+
const [project, setProject] = useControllableState(projectProp, defaultProject ?? '', onProjectChange)
|
|
566
|
+
const [worktree, setWorktree] = useControllableState(worktreeProp, defaultWorktree, onWorktreeChange)
|
|
567
|
+
const [baseBranch, setBaseBranch] = useControllableState(
|
|
568
|
+
baseBranchProp,
|
|
569
|
+
defaultBaseBranch ?? '',
|
|
570
|
+
onBaseBranchChange,
|
|
571
|
+
)
|
|
572
|
+
const [model, setModel] = useControllableState(modelProp, defaultModel ?? '', onModelChange)
|
|
573
|
+
const [effort, setEffort] = useControllableState(effortProp, defaultEffort ?? middleEffort, onEffortChange)
|
|
574
|
+
const [mode, setMode] = useControllableState(
|
|
575
|
+
permissionModeProp,
|
|
576
|
+
defaultPermissionMode ?? '',
|
|
577
|
+
onPermissionModeChange,
|
|
578
|
+
)
|
|
579
|
+
const [fast, setFast] = useControllableState(fastProp, defaultFast, onFastChange)
|
|
580
|
+
const [style, setStyle] = useControllableState(outputStyleProp, defaultOutputStyle ?? '', onOutputStyleChange)
|
|
581
|
+
|
|
466
582
|
return (
|
|
467
583
|
<ShellCard
|
|
468
584
|
variant="elevated"
|
|
@@ -470,9 +586,21 @@ const Composer = Object.assign(
|
|
|
470
586
|
footer={
|
|
471
587
|
<SizeProvider size="compact">
|
|
472
588
|
<ShellCard.Footer className="justify-start gap-[var(--space-1)] pt-[var(--space-1)]">
|
|
473
|
-
<ProjectPicker
|
|
589
|
+
<ProjectPicker
|
|
590
|
+
projects={projects}
|
|
591
|
+
branches={branches}
|
|
592
|
+
branch={branch}
|
|
593
|
+
locked={!target}
|
|
594
|
+
project={inList(project, projectPaths)}
|
|
595
|
+
onProjectChange={setProject}
|
|
596
|
+
worktree={worktree}
|
|
597
|
+
onWorktreeChange={setWorktree}
|
|
598
|
+
baseBranch={inList(baseBranch, branches)}
|
|
599
|
+
onBaseBranchChange={setBaseBranch}
|
|
600
|
+
/>
|
|
474
601
|
<ProfileSwitcher
|
|
475
602
|
profiles={profiles}
|
|
603
|
+
value={profile}
|
|
476
604
|
defaultValue={defaultProfile}
|
|
477
605
|
onValueChange={onProfileChange}
|
|
478
606
|
side="top"
|
|
@@ -485,10 +613,16 @@ const Composer = Object.assign(
|
|
|
485
613
|
outputStyles={outputStyles}
|
|
486
614
|
context={context}
|
|
487
615
|
compacting={compacting}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
616
|
+
model={inList(model, modelNames)}
|
|
617
|
+
onModelChange={setModel}
|
|
618
|
+
effort={inList(effort, efforts, middleEffort)}
|
|
619
|
+
onEffortChange={setEffort}
|
|
620
|
+
mode={inList(mode, modeLabels)}
|
|
621
|
+
onModeChange={setMode}
|
|
622
|
+
fast={fast}
|
|
623
|
+
onFastChange={setFast}
|
|
624
|
+
style={inList(style, outputStyles)}
|
|
625
|
+
onStyleChange={setStyle}
|
|
492
626
|
/>
|
|
493
627
|
</div>
|
|
494
628
|
</ShellCard.Footer>
|
|
@@ -16,7 +16,7 @@ import ScrollArea from '@justanarthur/modo-ui/primitives/layout/scroll-area'
|
|
|
16
16
|
import { type ReactNode, useEffect, useLayoutEffect, useRef, useState } from 'react'
|
|
17
17
|
import AgentRun from '../../../components/conversation/agent-run'
|
|
18
18
|
import ChapterNav, { type ChapterNavItem } from '../../../components/conversation/chapter-nav'
|
|
19
|
-
import Message, { type MessageProps
|
|
19
|
+
import Message, { type MessageProps } from '../../../components/conversation/message'
|
|
20
20
|
import Reasoning from '../../../components/conversation/reasoning'
|
|
21
21
|
import Recap from '../../../components/conversation/recap'
|
|
22
22
|
import TodoList, { type TodoItem } from '../../../components/conversation/todo-list'
|
|
@@ -26,18 +26,20 @@ import { useIcon } from '../../../lib/icons'
|
|
|
26
26
|
|
|
27
27
|
type TurnProps = Omit<MessageProps, 'role'>
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
// No static's key names a binding of this file: the declaration bundler renames
|
|
30
|
+
// a clashing binding to Name2, and a key spelled like it goes along (`Transcript.Working2`).
|
|
31
|
+
function UserTurn(props: TurnProps) {
|
|
30
32
|
// biome-ignore lint/a11y/useValidAriaRole: Message's `role` is who speaks, not an ARIA role
|
|
31
33
|
return <Message role="user" {...props} />
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
/** The agent's turn. A string is markdown, rendered as it streams in; JSX (work, tool runs, prose) renders as is. */
|
|
35
|
-
function
|
|
37
|
+
function AssistantTurn({ children, streaming, ...props }: TurnProps) {
|
|
36
38
|
if (typeof children === 'string')
|
|
37
39
|
return (
|
|
38
40
|
<div className="flex flex-col gap-3">
|
|
39
41
|
<Markdown streaming={streaming}>{children}</Markdown>
|
|
40
|
-
{streaming && <Working />}
|
|
42
|
+
{streaming && <Message.Working />}
|
|
41
43
|
</div>
|
|
42
44
|
)
|
|
43
45
|
return (
|
|
@@ -176,8 +178,8 @@ const Transcript = Object.assign(
|
|
|
176
178
|
)
|
|
177
179
|
},
|
|
178
180
|
{
|
|
179
|
-
User:
|
|
180
|
-
Assistant:
|
|
181
|
+
User: UserTurn,
|
|
182
|
+
Assistant: AssistantTurn,
|
|
181
183
|
Work: WorkSummary,
|
|
182
184
|
Thinking: Reasoning,
|
|
183
185
|
Tools: ToolCall.Group,
|
|
@@ -31,3 +31,20 @@ With `work` active, new sessions start under it and its own row is disabled. Wit
|
|
|
31
31
|
commands={COMMANDS}
|
|
32
32
|
/>
|
|
33
33
|
</div>
|
|
34
|
+
|
|
35
|
+
# Fewer groups
|
|
36
|
+
|
|
37
|
+
An app without side panes or a settings window leaves those groups out: `panes={false}` drops Panes and `settings={[]}` drops Settings. `panes={['changes', 'terminal']}` would offer just those two.
|
|
38
|
+
|
|
39
|
+
<div className="flex h-[520px] w-full items-start justify-center pt-6">
|
|
40
|
+
<CommandPalette
|
|
41
|
+
hotkey={false}
|
|
42
|
+
label="Search lean"
|
|
43
|
+
sessions={PINNED}
|
|
44
|
+
projects={PROJECTS}
|
|
45
|
+
profiles={PROFILES}
|
|
46
|
+
commands={COMMANDS}
|
|
47
|
+
panes={false}
|
|
48
|
+
settings={[]}
|
|
49
|
+
/>
|
|
50
|
+
</div>
|
|
@@ -12,7 +12,7 @@ import Command, { type CommandGroup } from '@justanarthur/modo-ui/components/ove
|
|
|
12
12
|
import type { ReactElement } from 'react'
|
|
13
13
|
import { useIcons } from '../../../lib/icons'
|
|
14
14
|
import { STATUS_GLYPH } from '../../../lib/status-glyph'
|
|
15
|
-
import type { Command as AgentCommand, PaletteItem, Profile, Project, Session } from '../../../lib/types'
|
|
15
|
+
import type { Command as AgentCommand, PaletteItem, PaneId, Profile, Project, Session } from '../../../lib/types'
|
|
16
16
|
import { PANES } from '../../panes/side-pane'
|
|
17
17
|
import type { SettingsWindowSection } from '../../settings/settings-window'
|
|
18
18
|
|
|
@@ -25,8 +25,10 @@ interface CommandPaletteProps {
|
|
|
25
25
|
profiles: Profile[]
|
|
26
26
|
/** Slash commands, skills and plugins. */
|
|
27
27
|
commands: AgentCommand[]
|
|
28
|
-
/** Settings sections to open;
|
|
28
|
+
/** Settings sections to open; omitted, one row opens the settings; `[]` drops the Settings group. */
|
|
29
29
|
settings?: SettingsWindowSection[]
|
|
30
|
+
/** The side panes to offer, in the side pane's order; `false` (or `[]`) drops the Panes group. Defaults to every pane. */
|
|
31
|
+
panes?: PaneId[] | false
|
|
30
32
|
/** The active profile's id: new sessions start under it. Defaults to the first profile. */
|
|
31
33
|
profile?: string
|
|
32
34
|
/** The current project's path: "New session as …" starts there. Defaults to the first project. */
|
|
@@ -59,7 +61,9 @@ interface CommandPaletteProps {
|
|
|
59
61
|
* on you). New sessions start in each project under the active profile, or
|
|
60
62
|
* under each other profile in the current project. Picking a row hands it to
|
|
61
63
|
* `onSelect` and closes the panel. The panel is Command's: it grows out of
|
|
62
|
-
* the trigger, and ⌘K (Ctrl+K elsewhere) toggles it from anywhere.
|
|
64
|
+
* the trigger, and ⌘K (Ctrl+K elsewhere) toggles it from anywhere. A group
|
|
65
|
+
* with no rows is left out: an app without side panes passes `panes={false}`,
|
|
66
|
+
* one without a settings window `settings={[]}`.
|
|
63
67
|
*
|
|
64
68
|
* @example {@include ./examples.mdx}
|
|
65
69
|
*/
|
|
@@ -69,6 +73,7 @@ export default function CommandPalette({
|
|
|
69
73
|
profiles,
|
|
70
74
|
commands,
|
|
71
75
|
settings,
|
|
76
|
+
panes,
|
|
72
77
|
profile,
|
|
73
78
|
project,
|
|
74
79
|
onSelect,
|
|
@@ -158,7 +163,7 @@ export default function CommandPalette({
|
|
|
158
163
|
},
|
|
159
164
|
{
|
|
160
165
|
label: 'Panes',
|
|
161
|
-
items: PANES.map(p => ({
|
|
166
|
+
items: (panes === false ? [] : panes ? PANES.filter(p => panes.includes(p.id)) : PANES).map(p => ({
|
|
162
167
|
label: `Open ${p.label.toLowerCase()}`,
|
|
163
168
|
icon: icons[p.icon],
|
|
164
169
|
keywords: ['pane', 'side'],
|
|
@@ -168,7 +173,9 @@ export default function CommandPalette({
|
|
|
168
173
|
{
|
|
169
174
|
label: 'Settings',
|
|
170
175
|
items: [
|
|
171
|
-
|
|
176
|
+
...(settings?.length === 0
|
|
177
|
+
? []
|
|
178
|
+
: [{ label: 'Open settings', icon: icons.settings, shortcut: '⌘,', onSelect: pick({ kind: 'settings' }) }]),
|
|
172
179
|
...(settings ?? []).map(s => ({
|
|
173
180
|
label: `Settings: ${s.label}`,
|
|
174
181
|
icon: icons[s.icon],
|
|
@@ -11,3 +11,13 @@ Every profile's limits as pace bars, each with its verdict; the tick is where an
|
|
|
11
11
|
<UsagePane profiles={PROFILES} />
|
|
12
12
|
</SizeProvider>
|
|
13
13
|
</div>
|
|
14
|
+
|
|
15
|
+
# No usage yet
|
|
16
|
+
|
|
17
|
+
A profile with no limits yet (`limits: []`, before its first turn reports usage) reads "No usage yet".
|
|
18
|
+
|
|
19
|
+
<div className="w-full max-w-sm overflow-hidden rounded-xl border border-border bg-background p-2">
|
|
20
|
+
<SizeProvider size="compact">
|
|
21
|
+
<UsagePane profiles={[PROFILES[1], { ...PROFILES[2], id: 'fresh', name: 'fresh', configDir: '~/.claude-fresh', limits: [] }]} />
|
|
22
|
+
</SizeProvider>
|
|
23
|
+
</div>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import Badge from '@justanarthur/modo-ui/components/data-display/badge'
|
|
10
10
|
import { useSize } from '@justanarthur/modo-ui/lib/size-context'
|
|
11
11
|
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
12
|
-
import { duration, paceOf, percent, VERDICT_TEXT } from '../../../lib/pace'
|
|
12
|
+
import { duration, NO_USAGE, paceOf, percent, VERDICT_TEXT } from '../../../lib/pace'
|
|
13
13
|
import { PaceBar } from '../../../lib/pace-bar'
|
|
14
14
|
import { PaneSection } from '../../../lib/pane-parts'
|
|
15
15
|
import type { Profile } from '../../../lib/types'
|
|
@@ -17,7 +17,7 @@ import type { Profile } from '../../../lib/types'
|
|
|
17
17
|
const VERDICT_WORD = { free: 'on pace', watch: 'only just', tight: 'too fast' } as const
|
|
18
18
|
|
|
19
19
|
interface UsagePaneProps {
|
|
20
|
-
/** The profiles to read, each with its limits. */
|
|
20
|
+
/** The profiles to read, each with its limits (empty until the profile reports usage). */
|
|
21
21
|
profiles: Profile[]
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -28,7 +28,8 @@ interface UsagePaneProps {
|
|
|
28
28
|
* Each profile is a section with its plan and a verdict on its tightest
|
|
29
29
|
* limit (on pace, only just, too fast); each limit is a pace bar whose tick
|
|
30
30
|
* is where an even spend would be by now, with its share and the time
|
|
31
|
-
* until it resets.
|
|
31
|
+
* until it resets. A profile with no limits yet (`limits: []`, before its
|
|
32
|
+
* first turn reports usage) reads "No usage yet".
|
|
32
33
|
*
|
|
33
34
|
* @example {@include ./examples.mdx}
|
|
34
35
|
*/
|
|
@@ -50,8 +51,10 @@ export default function UsagePane({ profiles }: UsagePaneProps) {
|
|
|
50
51
|
title={profile.name}
|
|
51
52
|
meta={profile.plan}
|
|
52
53
|
actions={
|
|
53
|
-
<span
|
|
54
|
-
{
|
|
54
|
+
<span
|
|
55
|
+
className={cn('pr-1 text-caption', binding ? VERDICT_TEXT[binding.verdict] : 'text-muted-foreground')}
|
|
56
|
+
>
|
|
57
|
+
{binding ? VERDICT_WORD[binding.verdict] : NO_USAGE}
|
|
55
58
|
</span>
|
|
56
59
|
}
|
|
57
60
|
>
|