mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-08 00:33:24 +00:00
fix(core): migrate named agent colors (#38414)
This commit is contained in:
parent
203b9f59b7
commit
f1f0f47ee2
2 changed files with 6 additions and 3 deletions
|
|
@ -4,7 +4,10 @@ import { Schema, SchemaGetter } from "effect"
|
|||
import { PositiveInt } from "../../schema"
|
||||
import { ConfigPermissionV1 } from "./permission"
|
||||
|
||||
const Color = Schema.String.check(Schema.isPattern(/^#[0-9a-fA-F]{6}$/))
|
||||
const Color = Schema.Union([
|
||||
Schema.String.check(Schema.isPattern(/^#[0-9a-fA-F]{6}$/)),
|
||||
Schema.Literals(["primary", "secondary", "accent", "success", "warning", "error", "info"]),
|
||||
])
|
||||
|
||||
const AgentSchema = Schema.StructWithRest(
|
||||
Schema.Struct({
|
||||
|
|
@ -26,7 +29,7 @@ const AgentSchema = Schema.StructWithRest(
|
|||
}),
|
||||
options: Schema.optional(Schema.Record(Schema.String, Schema.Any)),
|
||||
color: Schema.optional(Color).annotate({
|
||||
description: "Hex color code (e.g., #FF5733)",
|
||||
description: "Hex color code (e.g., #FF5733) or theme color (e.g., primary)",
|
||||
}),
|
||||
steps: Schema.optional(PositiveInt).annotate({
|
||||
description: "Maximum number of agentic iterations before forcing text-only response",
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ export function migrateAgent(info: ConfigAgentV1.Info) {
|
|||
description: info.description,
|
||||
mode: info.mode,
|
||||
hidden: info.hidden,
|
||||
color: info.color,
|
||||
color: info.color === undefined ? undefined : info.color.startsWith("#") ? info.color : "#aaaaaa",
|
||||
steps: info.steps,
|
||||
disabled: info.disable,
|
||||
permissions: permissions(info.permission),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue