mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-19 23:05:21 +00:00
fix(app): share the draft effort action across controls
Keep the schedule effort picker able to select Ultra Code while schedules use a single effort field.
This commit is contained in:
@@ -21,7 +21,6 @@ import {
|
||||
type ProviderSelectorProvider,
|
||||
} from "@/provider-selection/provider-selection";
|
||||
import { filterSelectableModels } from "@/provider-selection/model-catalog";
|
||||
import { findThinkingOptionReplacement } from "@/provider-selection/resolve-agent-form";
|
||||
import { useSessionStore } from "@/stores/session-store";
|
||||
import { useProvidersSnapshot } from "@/hooks/use-providers-snapshot";
|
||||
import { resolveProviderDefinition } from "@/utils/provider-definitions";
|
||||
@@ -1317,11 +1316,7 @@ export function DraftAgentControls({
|
||||
return toThinkingControlOptions(thinkingOptions);
|
||||
}, [thinkingOptions]);
|
||||
|
||||
// COMPAT(claudeUltracodePreference): added in v0.17.0, remove after 2027-05-18.
|
||||
const effectiveSelectedThinkingOption =
|
||||
findThinkingOptionReplacement(thinkingOptions, selectedThinkingOptionId) ||
|
||||
selectedThinkingOptionId ||
|
||||
mappedThinkingOptions[0]?.id;
|
||||
const effectiveSelectedThinkingOption = selectedThinkingOptionId || mappedThinkingOptions[0]?.id;
|
||||
|
||||
const modelOptions = useMemo<AgentControlOption[]>(
|
||||
() =>
|
||||
|
||||
@@ -24,7 +24,6 @@ export function buildDraftAgentControls(input: {
|
||||
optionControls?: DraftAgentControlsProps["optionControls"];
|
||||
options: DraftAgentControlsProps["options"];
|
||||
onSetOption: DraftAgentControlsProps["onSetOption"];
|
||||
onSelectThinkingOption?: DraftAgentControlsProps["onSelectThinkingOption"];
|
||||
onApplyAgentProfile: DraftAgentControlsProps["onApplyAgentProfile"];
|
||||
onDropdownClose?: DraftAgentControlsProps["onDropdownClose"];
|
||||
context: NonNullable<DraftAgentControlsProps["context"]>;
|
||||
@@ -57,7 +56,7 @@ export function buildDraftAgentControls(input: {
|
||||
onSelectProviderAndModel: formState.setProviderAndModelFromUser,
|
||||
thinkingOptions: formState.availableThinkingOptions,
|
||||
selectedThinkingOptionId: formState.selectedThinkingOptionId,
|
||||
onSelectThinkingOption: input.onSelectThinkingOption ?? formState.setThinkingOptionFromUser,
|
||||
onSelectThinkingOption: formState.setThinkingOptionFromUser,
|
||||
onApplyAgentProfile,
|
||||
optionControls,
|
||||
options,
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
resolveEffectiveComposerThinkingOptionId,
|
||||
type ProviderSelectionState,
|
||||
} from "@/provider-selection/provider-selection";
|
||||
import { findThinkingOptionReplacement } from "@/provider-selection/resolve-agent-form";
|
||||
import { useDraftStore, type DraftInput } from "@/stores/draft-store";
|
||||
import { AfterPaintPublication } from "@/composer/after-paint-publication";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
@@ -336,8 +337,18 @@ export function useAgentInputDraft(input: UseAgentInputDraftInput): AgentInputDr
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
// COMPAT(claudeUltracodePreference): added in v0.17.0, remove after 2027-05-18.
|
||||
const draftForm = {
|
||||
...formState,
|
||||
selectedThinkingOptionId:
|
||||
findThinkingOptionReplacement(
|
||||
formState.availableThinkingOptions,
|
||||
formState.selectedThinkingOptionId,
|
||||
) ?? formState.selectedThinkingOptionId,
|
||||
setThinkingOptionFromUser: setDraftThinking,
|
||||
};
|
||||
return {
|
||||
...draftForm,
|
||||
workingDir,
|
||||
effectiveModeId,
|
||||
effectiveModelId,
|
||||
@@ -345,11 +356,10 @@ export function useAgentInputDraft(input: UseAgentInputDraftInput): AgentInputDr
|
||||
providerOptions: draftOptions,
|
||||
metadata,
|
||||
agentControls: buildDraftAgentControls({
|
||||
formState,
|
||||
formState: draftForm,
|
||||
optionControls: draftOptionControls,
|
||||
options: draftShownOptions,
|
||||
onSetOption: setDraftOption,
|
||||
onSelectThinkingOption: setDraftThinking,
|
||||
onApplyAgentProfile: applyDraftAgentProfile,
|
||||
context: composerOptions.context ?? "draft",
|
||||
metadata,
|
||||
|
||||
@@ -187,7 +187,7 @@ function applyPreferences(form: ReturnType<typeof open>, preferences: FormPrefer
|
||||
}
|
||||
|
||||
describe("schedule form model", () => {
|
||||
it("preserves a legacy Ultra Code choice until the user changes the schedule's effort", () => {
|
||||
it("keeps Ultra Code available in the schedule effort picker", () => {
|
||||
const model = "claude-opus-4-8";
|
||||
const form = open({
|
||||
mode: "edit",
|
||||
@@ -232,7 +232,7 @@ describe("schedule form model", () => {
|
||||
);
|
||||
form.setThinking("high");
|
||||
expect(form.getState().selectedThinkingOptionId).toBe("high");
|
||||
expect(form.getState().availableThinkingOptions.map((option) => option.id)).not.toContain(
|
||||
expect(form.getState().availableThinkingOptions.map((option) => option.id)).toContain(
|
||||
"ultracode",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -274,7 +274,13 @@ function resolveThinkingOptions(
|
||||
modelId: string,
|
||||
): NonNullable<AgentModelDefinition["thinkingOptions"]> {
|
||||
const model = resolveEffectiveModel(resolveAvailableModels(entries, provider), modelId);
|
||||
return model?.thinkingOptions ?? [];
|
||||
const options = model?.thinkingOptions ?? [];
|
||||
// COMPAT(claudeUltracodePreference): added in v0.17.0, remove after 2027-05-18.
|
||||
// Schedules still use a single effort field.
|
||||
return findThinkingOptionReplacement(options, "ultracode") &&
|
||||
!options.some((option) => option.id === "ultracode")
|
||||
? [...options, { id: "ultracode", label: "Ultra Code" }]
|
||||
: options;
|
||||
}
|
||||
|
||||
function resolveModelDisplay(input: {
|
||||
@@ -572,18 +578,11 @@ function updateDerivedState(input: {
|
||||
providerEntries: readonly ProviderSnapshotEntry[];
|
||||
}): ScheduleFormState {
|
||||
const modeOptions = resolveModeOptions(input.providerEntries, input.state.selectedProvider);
|
||||
const thinkingOptions = resolveThinkingOptions(
|
||||
const availableThinkingOptions = resolveThinkingOptions(
|
||||
input.providerEntries,
|
||||
input.state.selectedProvider,
|
||||
input.state.selectedModel,
|
||||
);
|
||||
// COMPAT(claudeUltracodePreference): added in v0.17.0, remove after 2027-05-18.
|
||||
const availableThinkingOptions =
|
||||
input.state.selectedThinkingOptionId === "ultracode" &&
|
||||
findThinkingOptionReplacement(thinkingOptions, "ultracode") &&
|
||||
!thinkingOptions.some((option) => option.id === "ultracode")
|
||||
? [...thinkingOptions, { id: "ultracode", label: "Ultra Code" }]
|
||||
: thinkingOptions;
|
||||
const canUseWorktreeIsolation = resolveCanUseWorktreeIsolation({
|
||||
state: input.state,
|
||||
hosts: input.hosts,
|
||||
|
||||
Reference in New Issue
Block a user