Merge agent and mode into one (#1689)

The concept of mode has been deprecated, there is now only the agent field in the config.

An agent can be cycled through as your primary agent with <tab> or you can spawn a subagent by @ mentioning it. if you include a description of when to use it, the primary agent will try to automatically use it

Full docs here: https://opencode.ai/docs/agents/
This commit is contained in:
Dax
2025-08-07 16:32:12 -04:00
committed by GitHub
parent 12f1ad521f
commit c34aec060f
42 changed files with 1755 additions and 930 deletions

View File

@@ -16,10 +16,10 @@ import { Config } from "../config/config"
import { File } from "../file"
import { LSP } from "../lsp"
import { MessageV2 } from "../session/message-v2"
import { Mode } from "../session/mode"
import { callTui, TuiRoute } from "./tui"
import { Permission } from "../permission"
import { lazy } from "../util/lazy"
import { Agent } from "../agent/agent"
const ERRORS = {
400: {
@@ -872,23 +872,23 @@ export namespace Server {
},
)
.get(
"/mode",
"/agent",
describeRoute({
description: "List all modes",
operationId: "app.modes",
description: "List all agents",
operationId: "app.agents",
responses: {
200: {
description: "List of modes",
description: "List of agents",
content: {
"application/json": {
schema: resolver(Mode.Info.array()),
schema: resolver(Agent.Info.array()),
},
},
},
},
}),
async (c) => {
const modes = await Mode.list()
const modes = await Agent.list()
return c.json(modes)
},
)
@@ -1027,7 +1027,7 @@ export namespace Server {
.post(
"/tui/execute-command",
describeRoute({
description: "Execute a TUI command (e.g. switch_mode)",
description: "Execute a TUI command (e.g. switch_agent)",
operationId: "tui.executeCommand",
responses: {
200: {