feat: layer runtime and model selection across conversation, project and global

- Store runtime selection as { provider?, model? } layers and resolve them per
  field (conversation -> project -> global); drop the legacy auto provider.
- Migrate stored selections (database v49) and clear deleted profile ids.
- Re-resolve selections in Main per request and at queue dispatch.
- Add ProjectRuntimeSelector and a two-column RuntimeModelPicker; manage
  link opens model connections; restore per-runtime default model tabs.
- Stop duplicating trusted instructions and history across OpenCode,
  Continue and DeepSeek Harness runtimes.
- Document the layered design, global provider removal plan and planned
  purpose-specific models.
This commit is contained in:
mesalogo
2026-09-29 21:33:06 +08:00
parent d1b92deff3
commit 9c88ca20f3
50 changed files with 2879 additions and 1836 deletions
+10 -4
View File
@@ -1,7 +1,10 @@
import { z } from 'zod'
import { runtimeChecklistSchema } from './runtime-checklist'
import { externalKnowledgeLocatorSchema } from './external-knowledge-contracts'
import { agentRuntimeSelectionSchema } from './runtime-selection-contracts'
import {
runtimeSelectionLayerSchema,
type AgentRuntimeSelection
} from './runtime-selection-contracts'
import { sshHostIdSchema } from './ssh-host-contracts'
export const assistantIdSchema = z.string().uuid()
@@ -143,7 +146,8 @@ export const projectCreateSchema = z
description: z.string().trim().max(2_000),
rootPath: z.string().trim().max(4_096),
defaultWorkMode: workModeSchema,
runtimeSelection: agentRuntimeSelectionSchema.optional()
/** Project layer; absent means follow the global settings. */
runtimeSelection: runtimeSelectionLayerSchema.optional()
})
.strict()
@@ -579,7 +583,8 @@ export const conversationSnapshotSchema = z
.object({
id: assistantIdSchema,
projectId: assistantIdSchema.optional(),
runtimeSelection: agentRuntimeSelectionSchema.optional(),
/** Conversation layer; absent means follow the project. */
runtimeSelection: runtimeSelectionLayerSchema.optional(),
knowledgeLibraryIds: z.array(assistantIdSchema).max(20).optional(),
workMode: workModeSchema.optional(),
knowledgeRetrievalMode: z.enum(['auto', 'always']).optional(),
@@ -895,7 +900,8 @@ export type AssistantSchedule = Omit<z.output<typeof scheduleCreateSchema>, 'run
id: string
taskId: string
conversationId: string
runtimeSelection?: ProjectCreateInput['runtimeSelection']
/** A concrete selection captured by legacy schedule templates. */
runtimeSelection?: AgentRuntimeSelection
enabled: boolean
lastRunAt?: string
createdAt: string