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
+33
View File
@@ -207,6 +207,10 @@ function runClient(events: Record<string, unknown>[]) {
data: true,
error: undefined,
}),
deleteMessage: vi.fn().mockResolvedValue({
data: true,
error: undefined,
}),
},
event: {
subscribe: vi.fn().mockImplementation(async () => {
@@ -4155,6 +4159,35 @@ describe("OpenCodeRuntime embedded permission mediation", () => {
await runtime.dispose();
});
it("removes an unanswered prompt from a reused session after failure", async () => {
const { client, session } = runClient([
{
id: "event-error",
type: "session.error",
properties: {
sessionID: "session-1",
error: { name: "UnknownError", data: { message: "model failed" } },
},
},
]);
const runtime = embeddedRuntime(client);
await expect(collectRun(runtime)).rejects.toThrow("model failed");
const promptMessageId = vi.mocked(session.promptAsync).mock.calls[0]?.[0]
?.messageID;
expect(promptMessageId).toMatch(/^msg_/);
expect(session.deleteMessage).toHaveBeenCalledWith(
{
sessionID: "session-1",
messageID: promptMessageId,
directory: process.cwd(),
},
{ signal: expect.any(AbortSignal) },
);
await runtime.dispose();
});
it("deletes an ephemeral OpenCode session when released", async () => {
const { client, session } = runClient([
{