Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/opencode/src/agent/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const Info = z
prompt: z.string().optional(),
options: z.record(z.string(), z.any()),
steps: z.number().int().positive().optional(),
order: z.number().int().optional(),
})
.meta({
ref: "Agent",
Expand Down Expand Up @@ -258,6 +259,7 @@ export const layer = Layer.effect(
item.hidden = value.hidden ?? item.hidden
item.name = value.name ?? item.name
item.steps = value.steps ?? item.steps
item.order = value.order ?? item.order
item.options = mergeDeep(item.options, value.options ?? {})
item.permission = Permission.merge(item.permission, Permission.fromConfig(value.permission ?? {}))
}
Expand Down Expand Up @@ -288,6 +290,7 @@ export const layer = Layer.effect(
agents,
values(),
sortBy(
[(x) => x.order ?? Number.MAX_SAFE_INTEGER, "asc"],
[(x) => (cfg.default_agent ? x.name === cfg.default_agent : x.name === "build"), "desc"],
[(x) => x.name, "asc"],
),
Expand Down
2 changes: 2 additions & 0 deletions packages/opencode/src/config/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const Info = z
.describe("Maximum number of agentic iterations before forcing text-only response"),
maxSteps: z.number().int().positive().optional().describe("@deprecated Use 'steps' field instead."),
permission: ConfigPermission.Info.optional(),
order: z.number().int().optional().describe("Display order in the agent list. Lower values appear first."),
})
.catchall(z.any())
.transform((agent, _ctx) => {
Expand All @@ -67,6 +68,7 @@ export const Info = z
"permission",
"disable",
"tools",
"order",
])

const options: Record<string, unknown> = { ...agent.options }
Expand Down
Loading