Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/main/sharedSettingsFile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ describe("sharedSettingsFile", () => {
wslConflictResolverFast: false,
wslConflictResolverPresentationMode: "gui",
agentSettings: {},
machineScopeModes: {
providerOrder: "synced",
hiddenModels: "synced",
disabledAgents: "synced",
},
machineSettings: {},
hiddenModels: {},
disabledAgents: [],
providerOrder: [],
Expand Down Expand Up @@ -254,6 +260,12 @@ describe("sharedSettingsFile", () => {
wslConflictResolverFast: false,
wslConflictResolverPresentationMode: "gui",
agentSettings: {},
machineScopeModes: {
providerOrder: "synced",
hiddenModels: "synced",
disabledAgents: "synced",
},
machineSettings: {},
hiddenModels: {},
disabledAgents: [],
providerOrder: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { Tooltip } from "@heroui/react";
import { ProviderIcon } from "@/renderer/components/providers/ProviderIcon";
import { ResponsiveMenuSurface, useResponsiveMenu } from "../ResponsiveMenuSurface";
import { useSharedSettings } from "@/renderer/state/sharedSettingsStore";
import { effectiveProviderOrder } from "@/shared/machineSettings";
import { LOCAL_NATIVE_MACHINE_KEY } from "@/shared/machines";
import { baseAgentKind, type ThreadPresentationMode } from "@/shared/contracts";
import { migrateCursorBaseId, parseCursorModelId } from "@/shared/cursorModelId";
import { Button } from "../Button";
Expand Down Expand Up @@ -66,6 +68,11 @@ export interface ProviderModelMenuProps {
/** When set, only this provider's rows are rendered. */
lockedAgentKind?: string;
presentationMode?: ThreadPresentationMode;
/**
* Machine whose provider-order preference applies ("local" when omitted).
* Only affects ordering while the provider-order lock is off.
*/
machineKey?: string;
isDisabled?: boolean;
hideLabelOnWrap?: boolean;
forceHideLabel?: boolean;
Expand Down Expand Up @@ -284,7 +291,9 @@ export function ProviderModelMenu(props: ProviderModelMenuProps) {

const favorites = useSharedSettings((s) => s.favoriteModels);
const recents = useSharedSettings((s) => s.recentModels);
const providerOrder = useSharedSettings((s) => s.providerOrder);
const providerOrder = useSharedSettings((s) =>
effectiveProviderOrder(s, props.machineKey ?? LOCAL_NATIVE_MACHINE_KEY),
);
const hiddenModels = useSharedSettings((s) => s.hiddenModels);
const providerModelPreferences = useSharedSettings((s) => s.providerModelPreferences);
const providerConfigs = useSharedSettings((s) => s.providerConfigs);
Expand Down
11 changes: 6 additions & 5 deletions src/renderer/components/thread/AgentDiscoveryScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { MessageDescriptor } from "@lingui/core";
import { PixelLoader } from "@/renderer/components/common/PixelLoader";
import { ProviderIcon } from "@/renderer/components/providers/ProviderIcon";
import { getProviderManifests } from "@/renderer/components/providers/providerManifest";
import { localEnvLabel } from "@/renderer/utils/machineLabels";
import { useAgentStatusesStore } from "@/renderer/state/agentStatusesStore";
import type { AgentStatus, ProjectLocation } from "@/shared/contracts";
import type { CSSProperties, ReactNode } from "react";
Expand Down Expand Up @@ -98,20 +99,20 @@ export function AgentDiscoveryScreen(props: {
? [
{
key: `wsl:${wslDistro}`,
label: `WSL: ${wslDistro}`,
label: localEnvLabel({ kind: "wsl", distro: wslDistro }),
matches: (status) => status.envKind === "wsl" && status.envDistro === wslDistro,
},
]
: props.wslDistros !== undefined
? [
{
key: "native",
label: t`Windows`,
label: localEnvLabel({ kind: "native" }),
matches: (status) => status.envKind !== "wsl",
},
...props.wslDistros.map((distro) => ({
key: `wsl:${distro}`,
label: `WSL: ${distro}`,
label: localEnvLabel({ kind: "wsl", distro }),
matches: (status: AgentStatus) =>
status.envKind === "wsl" && status.envDistro === distro,
})),
Expand All @@ -120,12 +121,12 @@ export function AgentDiscoveryScreen(props: {
? [
{
key: "native",
label: "Windows",
label: localEnvLabel({ kind: "native" }),
matches: (status) => status.envKind !== "wsl",
},
...discoveryScope.wslDistros.map((distro) => ({
key: `wsl:${distro}`,
label: `WSL: ${distro}`,
label: localEnvLabel({ kind: "wsl", distro }),
matches: (status: AgentStatus) =>
status.envKind === "wsl" && status.envDistro === distro,
})),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe("ThreadAgentUpdateDock", () => {
render(<ThreadAgentUpdateDock agentStatus={sdkStatus} project={project} />);

expect(
await screen.findByText(/Cursor SDK: Windows · v1\.0\.24 → v1\.0\.31/u),
await screen.findByText(/Cursor SDK: This computer · v1\.0\.24 → v1\.0\.31/u),
).toBeInTheDocument();
expect(screen.queryByText(/2026\.07\.09/u)).toBeNull();
expect(bridgeMock.getLatestAgentVersion).toHaveBeenCalledWith({
Expand Down Expand Up @@ -170,7 +170,9 @@ describe("ThreadAgentUpdateDock", () => {
);

expect(
await screen.findByText(/Cursor: Windows · v2026\.07\.09-a3815c0 → v2026\.07\.23-e383d2b/u),
await screen.findByText(
/Cursor: This computer · v2026\.07\.09-a3815c0 → v2026\.07\.23-e383d2b/u,
),
).toBeInTheDocument();
expect(bridgeMock.getLatestAgentVersion).toHaveBeenCalledWith({ agentKind: "cursor" });

Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/thread/ThreadComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export type ComposerControl =
currentAgentKind: string;
currentModel: string;
lockedAgentKind?: string;
machineKey?: string;
presentationMode?: ThreadPresentationMode;
isDisabled?: boolean;
hideLabelOnWrap?: boolean;
Expand Down Expand Up @@ -440,6 +441,7 @@ export function ThreadComposer(props: {
currentAgentKind={control.currentAgentKind}
currentModel={control.currentModel}
{...(control.lockedAgentKind ? { lockedAgentKind: control.lockedAgentKind } : {})}
{...(control.machineKey ? { machineKey: control.machineKey } : {})}
{...(control.presentationMode ? { presentationMode: control.presentationMode } : {})}
{...(control.isDisabled !== undefined ? { isDisabled: control.isDisabled } : {})}
{...(control.openSignal !== undefined ? { openSignal: control.openSignal } : {})}
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/thread/ThreadComposerSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import { ThreadContextIndicator } from "./ThreadContextIndicator";
import { getApprovalDenyOption } from "./ThreadRuntimeRequestPanel/helpers";
import { hasReportedContextUsage, resolveThreadContextUsageSummary } from "./threadContextUsage";
import { buildControls } from "./buildModelPickerControls";
import { machineKeyForLocation } from "@/shared/machines";
import { submitComposerPrompt } from "./threadComposerSubmit";
import {
filterSlashCommands,
Expand Down Expand Up @@ -440,6 +441,7 @@ function ThreadComposerSectionInner(props: ThreadComposerSectionProps & { thread
(config) => changeThreadConfig(thread.id, config),
modelPreferences,
(model, preference) => setProviderModelPreference(thread.agentKind, model, preference),
machineKeyForLocation(projectLocation),
);
const controlsWithOpenSignal = controls.map((control): ComposerControl => {
if (controlOpenRequest?.target === "model" && control.kind === "provider-model") {
Expand Down
3 changes: 3 additions & 0 deletions src/renderer/components/thread/ThreadDraftView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
buildProviderModelMenuProviders,
patchConfigForModelChange,
} from "./buildModelPickerControls";
import { machineKeyForLocation } from "@/shared/machines";
import {
agentWithCapabilities,
formatAgentList,
Expand Down Expand Up @@ -975,6 +976,7 @@ export function ThreadDraftView(props: {
thinking,
capabilities: filteredCaps,
presentationMode,
machineKey: machineKeyForLocation(project.location),
onProviderModelChange: (next) => latestProviderModelChangeRef.current(next),
onConfigPatch: (patch) => latestConfigPatchRef.current(patch),
});
Expand All @@ -989,6 +991,7 @@ export function ThreadDraftView(props: {
fast,
thinking,
presentationMode,
project.location,
]);

const providerDraftControls = useMemo(() => {
Expand Down
6 changes: 6 additions & 0 deletions src/renderer/components/thread/buildModelPickerControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export type BuildModelPickerControlsInput = {
capabilities: AgentCapability;
presentationMode?: ThreadPresentationMode;
lockedAgentKind?: string;
/** Machine whose provider-order preference applies to the picker. */
machineKey?: string;
isDisabled?: boolean;
hideLabelOnWrap?: boolean;
includeFastToggle?: boolean;
Expand Down Expand Up @@ -211,6 +213,7 @@ export function buildModelPickerControls(input: BuildModelPickerControlsInput):
capabilities: filteredCaps,
presentationMode,
lockedAgentKind,
machineKey,
isDisabled,
hideLabelOnWrap = true,
includeFastToggle = true,
Expand Down Expand Up @@ -239,6 +242,7 @@ export function buildModelPickerControls(input: BuildModelPickerControlsInput):
currentAgentKind: selectedAgentKind,
currentModel: model,
...(lockedAgentKind ? { lockedAgentKind } : {}),
...(machineKey ? { machineKey } : {}),
...(presentationMode ? { presentationMode } : {}),
...(isDisabled !== undefined ? { isDisabled } : {}),
hideLabelOnWrap,
Expand Down Expand Up @@ -364,6 +368,7 @@ export function buildControls(
onConfigChange: (config: ThreadConfig) => void,
modelPreferences?: Record<string, ProviderModelPreference>,
onModelPreferenceChange?: (model: string, preference: ProviderModelPreference) => void,
machineKey?: string,
): ComposerControl[] {
const presentationMode =
thread.presentationMode ?? agentStatus?.capabilities.presentationMode ?? "terminal";
Expand Down Expand Up @@ -407,6 +412,7 @@ export function buildControls(
...(effectiveConfig.thinking ? { thinking: effectiveConfig.thinking } : {}),
capabilities: filteredCaps,
lockedAgentKind: thread.agentKind,
...(machineKey ? { machineKey } : {}),
presentationMode,
isDisabled,
onProviderModelChange: ({ model }) => {
Expand Down
Loading