feat(project): per-project new-chat defaults (agent, workspace, approval, thinking, model) (#191)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Yaowei Zheng
2026-08-04 22:52:34 +08:00
committed by GitHub
parent 7cc5c30e71
commit 89435bf62a
27 changed files with 1980 additions and 638 deletions
@@ -29,6 +29,23 @@ export const THINKING_LEVELS = ["none", "low", "medium", "high", "xhigh"] as con
*/
export const SELECTABLE_THINKING_LEVELS = ["low", "medium", "high", "xhigh"] as const;
/**
* Effective thinking level for the draft picker's DISPLAY — the SAME chain core resolves
* when a Session is created (core/src/agent.ts `configuredThinkingLevel`, the single rule):
* the Agent's explicit `model.thinking_level` > the Project's `default_chat.thinking_level`
* > the built-in "medium". Keep the two sites in sync. `agentLevel` is the raw agent-config
* value ("" = no explicit override); `projectDefault` is `default_chat.thinking_level`
* (undefined when the Project sets none). The picker shows this effective value; picking
* still writes through to the AGENT config only — the project default is a fallback, never
* overwritten by the picker.
*/
export function effectiveThinkingLevel(
agentLevel: string,
projectDefault: string | undefined,
): string {
return agentLevel || (projectDefault ?? "medium");
}
/**
* Short display label for a level from the localized name table (S.chat.thinkingLevelNames).
* Covers all five stored levels including "none" (so a legacy value displays sanely instead