Skip to content

Commit 1296100

Browse files
authored
feat: add workspace home collaboration and reasoning selectors (#299)
1 parent 6c03623 commit 1296100

5 files changed

Lines changed: 143 additions & 6 deletions

File tree

src/App.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,8 @@ function MainApp() {
10591059
activeWorkspace,
10601060
models,
10611061
selectedModelId,
1062+
effort: resolvedEffort,
1063+
collaborationMode: collaborationModePayload,
10621064
addWorktreeAgent,
10631065
connectWorkspace,
10641066
startThreadForWorkspace,
@@ -1962,6 +1964,13 @@ function MainApp() {
19621964
modelSelections={workspaceModelSelections}
19631965
onToggleModel={toggleWorkspaceModelSelection}
19641966
onModelCountChange={setWorkspaceModelCount}
1967+
collaborationModes={collaborationModes}
1968+
selectedCollaborationModeId={selectedCollaborationModeId}
1969+
onSelectCollaborationMode={setSelectedCollaborationModeId}
1970+
reasoningOptions={reasoningOptions}
1971+
selectedEffort={selectedEffort}
1972+
onSelectEffort={setSelectedEffort}
1973+
reasoningSupported={reasoningSupported}
19651974
error={workspaceRunError}
19661975
isSubmitting={workspaceRunSubmitting}
19671976
activeWorkspaceId={activeWorkspaceId}

src/features/workspaces/components/WorkspaceHome.tsx

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import type {
1515
SkillOption,
1616
WorkspaceInfo,
1717
} from "../../../types";
18+
import { formatCollaborationModeLabel } from "../../../utils/collaborationModes";
1819
import { ComposerInput } from "../../composer/components/ComposerInput";
1920
import { useComposerImages } from "../../composer/hooks/useComposerImages";
2021
import { useComposerAutocompleteState } from "../../composer/hooks/useComposerAutocompleteState";
@@ -56,6 +57,13 @@ type WorkspaceHomeProps = {
5657
modelSelections: Record<string, number>;
5758
onToggleModel: (modelId: string) => void;
5859
onModelCountChange: (modelId: string, count: number) => void;
60+
collaborationModes: { id: string; label: string }[];
61+
selectedCollaborationModeId: string | null;
62+
onSelectCollaborationMode: (id: string | null) => void;
63+
reasoningOptions: string[];
64+
selectedEffort: string | null;
65+
onSelectEffort: (effort: string) => void;
66+
reasoningSupported: boolean;
5967
error: string | null;
6068
isSubmitting: boolean;
6169
activeWorkspaceId: string | null;
@@ -124,6 +132,13 @@ export function WorkspaceHome({
124132
modelSelections,
125133
onToggleModel,
126134
onModelCountChange,
135+
collaborationModes,
136+
selectedCollaborationModeId,
137+
onSelectCollaborationMode,
138+
reasoningOptions,
139+
selectedEffort,
140+
onSelectEffort,
141+
reasoningSupported,
127142
error,
128143
isSubmitting,
129144
activeWorkspaceId,
@@ -671,6 +686,83 @@ export function WorkspaceHome({
671686
</div>
672687
)}
673688
</div>
689+
{collaborationModes.length > 0 && (
690+
<div className="composer-select-wrap workspace-home-control">
691+
<div className="open-app-button">
692+
<span className="composer-icon" aria-hidden>
693+
<svg viewBox="0 0 24 24" fill="none">
694+
<path
695+
d="M7 7h10M7 12h6M7 17h8"
696+
stroke="currentColor"
697+
strokeWidth="1.4"
698+
strokeLinecap="round"
699+
/>
700+
</svg>
701+
</span>
702+
<select
703+
className="composer-select composer-select--model"
704+
aria-label="Collaboration mode"
705+
value={selectedCollaborationModeId ?? ""}
706+
onChange={(event) =>
707+
onSelectCollaborationMode(event.target.value || null)
708+
}
709+
disabled={isSubmitting}
710+
>
711+
{collaborationModes.map((mode) => (
712+
<option key={mode.id} value={mode.id}>
713+
{formatCollaborationModeLabel(mode.label || mode.id)}
714+
</option>
715+
))}
716+
</select>
717+
</div>
718+
</div>
719+
)}
720+
<div className="composer-select-wrap workspace-home-control">
721+
<div className="open-app-button">
722+
<span className="composer-icon" aria-hidden>
723+
<svg viewBox="0 0 24 24" fill="none">
724+
<path
725+
d="M8.5 4.5a3.5 3.5 0 0 0-3.46 4.03A4 4 0 0 0 6 16.5h2"
726+
stroke="currentColor"
727+
strokeWidth="1.4"
728+
strokeLinecap="round"
729+
/>
730+
<path
731+
d="M15.5 4.5a3.5 3.5 0 0 1 3.46 4.03A4 4 0 0 1 18 16.5h-2"
732+
stroke="currentColor"
733+
strokeWidth="1.4"
734+
strokeLinecap="round"
735+
/>
736+
<path
737+
d="M9 12h6"
738+
stroke="currentColor"
739+
strokeWidth="1.4"
740+
strokeLinecap="round"
741+
/>
742+
<path
743+
d="M12 12v6"
744+
stroke="currentColor"
745+
strokeWidth="1.4"
746+
strokeLinecap="round"
747+
/>
748+
</svg>
749+
</span>
750+
<select
751+
className="composer-select composer-select--effort"
752+
aria-label="Thinking mode"
753+
value={selectedEffort ?? ""}
754+
onChange={(event) => onSelectEffort(event.target.value)}
755+
disabled={isSubmitting || !reasoningSupported}
756+
>
757+
{reasoningOptions.length === 0 && <option value="">Default</option>}
758+
{reasoningOptions.map((effortOption) => (
759+
<option key={effortOption} value={effortOption}>
760+
{effortOption}
761+
</option>
762+
))}
763+
</select>
764+
</div>
765+
</div>
674766
</div>
675767

676768
<div className="workspace-home-agent">

src/features/workspaces/hooks/useWorkspaceHome.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ type UseWorkspaceHomeOptions = {
3030
activeWorkspace: WorkspaceInfo | null;
3131
models: ModelOption[];
3232
selectedModelId: string | null;
33+
effort?: string | null;
34+
collaborationMode?: Record<string, unknown> | null;
3335
addWorktreeAgent: (
3436
workspace: WorkspaceInfo,
3537
branch: string,
@@ -45,7 +47,11 @@ type UseWorkspaceHomeOptions = {
4547
threadId: string,
4648
text: string,
4749
images?: string[],
48-
options?: { model?: string | null; effort?: string | null },
50+
options?: {
51+
model?: string | null;
52+
effort?: string | null;
53+
collaborationMode?: Record<string, unknown> | null;
54+
},
4955
) => Promise<void>;
5056
onWorktreeCreated?: (worktree: WorkspaceInfo, parent: WorkspaceInfo) => Promise<void> | void;
5157
};
@@ -166,6 +172,8 @@ export function useWorkspaceHome({
166172
activeWorkspace,
167173
models,
168174
selectedModelId,
175+
effort = null,
176+
collaborationMode = null,
169177
addWorktreeAgent,
170178
connectWorkspace,
171179
startThreadForWorkspace,
@@ -469,6 +477,8 @@ export function useWorkspaceHome({
469477
: null;
470478
await sendUserMessageToThread(activeWorkspace, threadId, prompt, images, {
471479
model: localModel,
480+
effort,
481+
collaborationMode,
472482
});
473483
const model =
474484
selectedModelId ? modelLookup.get(selectedModelId) ?? null : null;
@@ -530,7 +540,8 @@ export function useWorkspaceHome({
530540
images,
531541
{
532542
model: selection.model?.model ?? selection.modelId,
533-
effort: null,
543+
effort,
544+
collaborationMode,
534545
},
535546
);
536547
instances.push({
@@ -580,9 +591,11 @@ export function useWorkspaceHome({
580591
activeWorkspace,
581592
activeWorkspaceId,
582593
addWorktreeAgent,
594+
collaborationMode,
583595
connectWorkspace,
584596
onWorktreeCreated,
585597
draft,
598+
effort,
586599
isSubmitting,
587600
modelLookup,
588601
modelSelections,

src/styles/composer.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -661,13 +661,13 @@
661661
}
662662

663663
.composer-select--collab {
664-
width: 88px;
665-
max-width: 88px;
664+
width: 110px;
665+
max-width: 110px;
666666
}
667667

668668
.composer-select--effort {
669-
width: 60px;
670-
max-width: 60px;
669+
width: 80px;
670+
max-width: 80px;
671671
}
672672

673673
.composer-select--approval {

src/styles/workspace-home.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,29 @@
162162
background: var(--surface-card);
163163
}
164164

165+
.workspace-home-control.composer-select-wrap {
166+
padding: 0;
167+
background: transparent;
168+
border: none;
169+
border-radius: 0;
170+
min-height: 0;
171+
}
172+
173+
.workspace-home-control.composer-select-wrap .open-app-button {
174+
border-color: var(--border-muted);
175+
background: var(--surface-card);
176+
border-radius: 10px;
177+
padding: 6px 10px;
178+
align-items: center;
179+
gap: 6px;
180+
}
181+
182+
.workspace-home-control.composer-select-wrap .composer-select {
183+
font-size: 12px;
184+
color: var(--text-stronger);
185+
padding: 0 16px 0 0;
186+
}
187+
165188
.workspace-home-dropdown {
166189
left: 0;
167190
}

0 commit comments

Comments
 (0)