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
+12 -6
View File
@@ -1348,17 +1348,17 @@ export class DeepSeekHarnessRuntime implements AgentRuntime {
state: HarnessState,
conversationId: string,
workspace: string
): Promise<string> {
): Promise<{ id: string; created: boolean }> {
const current = this.sessions.get(conversationId)
if (current?.workspace === workspace) {
return current.id
return { id: current.id, created: false }
}
if (current) {
await this.releaseConversation(conversationId)
}
const pending = this.sessionInitializations.get(conversationId)
if (pending) {
return pending
return { id: await pending, created: false }
}
const creation = state.agent
.newSession({
@@ -1374,7 +1374,7 @@ export class DeepSeekHarnessRuntime implements AgentRuntime {
})
this.sessionInitializations.set(conversationId, creation)
try {
return await creation
return { id: await creation, created: true }
} finally {
this.sessionInitializations.delete(conversationId)
}
@@ -1496,11 +1496,14 @@ export class DeepSeekHarnessRuntime implements AgentRuntime {
const workspace = request.executionWorkspace
? await realpath(request.executionWorkspace)
: state.workspace
sessionId = await this.getSession(
const session = await this.getSession(
state,
request.conversationId,
workspace
)
sessionId = session.id
// A reused Harness session already retains earlier turns natively.
const includeHistory = session.created
run = {
request,
toolProvider: this.toolsFor(workspace),
@@ -1557,7 +1560,10 @@ export class DeepSeekHarnessRuntime implements AgentRuntime {
prompt: [
{
type: 'text',
text: promptWithUntrustedConversationHistory(request, true)
text: promptWithUntrustedConversationHistory(
request,
includeHistory
)
},
...(request.images ?? []).map((image) => ({
type: 'image' as const,