Files
openidea/src/features/agents/agentSettings.ts
T
l0ng-ai 4f5622d72c refactor(agents): remove playful words from the working status (#4555)
Removes Settings › Agents › Working Status and its playfulStatus / playfulAfterSeconds / playfulWords settings. The line under a working conversation keeps saying what the agent is doing (Reading…, Running a command…); stored values of the removed settings are ignored.
2026-11-20 09:13:57 +08:00

35 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** Settings › Agents, with the defaults filled in. */
import { useMemo } from "react";
import type { AgentSettings } from "@/bindings";
import { useProject } from "@/platform/project";
export type ResolvedAgentSettings = Required<AgentSettings>;
export const AGENT_SETTINGS_DEFAULTS: ResolvedAgentSettings = {
showContextUsage: true,
showWorkTime: true,
showUsageLimits: true,
showCost: false,
foldTurns: true,
smoothText: true,
fitWindowWidth: false,
thinking: "auto",
toolCalls: "grouped",
expandToolOutput: false,
sendWith: "enter",
whileRunning: "queue",
newTaskApprovals: "bypass",
defaults: {},
mcpServers: {},
};
export function resolveAgentSettings(s: AgentSettings | null | undefined): ResolvedAgentSettings {
const set = Object.fromEntries(Object.entries(s ?? {}).filter(([, v]) => v !== undefined && v !== null));
return { ...AGENT_SETTINGS_DEFAULTS, ...set };
}
export function useAgentSettings(): ResolvedAgentSettings {
const s = useProject((p) => p.settings?.agents);
return useMemo(() => resolveAgentSettings(s), [s]);
}