mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 16:04:21 +00:00
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.
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
/** 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]);
|
||
}
|