feat(projects): pin a thinking level next to a project's model

A project could pin the model new chats start on, but not the level to
run it at: the default cascade dropped any variant as soon as a project
model won, and only ever considered the global one — which belongs to
the global model.

Projects now carry `defaultVariant` alongside `defaultModel`, stored and
sanitized only next to that model, and the cascade passes it through.
Both controls sit in one "Defaults for new chats" group laid out like the
Sessions defaults, and the level appears only for models that offer them.
This commit is contained in:
Bohdan Triapitsyn
2026-08-22 20:31:31 +03:00
parent e2e55756e2
commit 2740c7b3a2
25 changed files with 322 additions and 34 deletions
@@ -106,6 +106,22 @@ describe('settings normalization runtime - symlink resolution', () => {
expect(result[0].path).toBe('/resolved/missing/path');
});
it('keeps a default thinking level next to its model and drops it alone', () => {
const runtime = createTestRuntime({
realpathSync: (p) => p,
path: { resolve: (p) => p, sep: '/', dirname: (p) => p.split('/').slice(0, -1).join('/') || '/' },
});
const projects = [
{ id: 'proj1', path: '/a', defaultModel: 'anthropic/claude-opus-5', defaultVariant: 'high' },
{ id: 'proj2', path: '/b', defaultVariant: 'high' },
];
const result = runtime.sanitizeProjects(projects);
expect(result[0].defaultVariant).toBe('high');
expect(result[1].defaultVariant).toBe(undefined);
});
it('deduplicates projects that resolve to the same realpath', () => {
const runtime = createTestRuntime({
realpathSync: (p) => p.startsWith('/symlink') ? '/real/project' : p,