fix(schema): loosen agent color response

This commit is contained in:
Dax Raad 2026-07-22 19:20:28 -04:00
commit a817fe5e6c
3 changed files with 14 additions and 4 deletions

View file

@ -8,6 +8,8 @@ export type ModelRef = { id: string; providerID: string; variant?: string }
export type ProviderSettings = { [x: string]: JsonValue }
export type AgentColor = string
export type PermissionV2Effect = "allow" | "deny" | "ask"
export type PluginInfo = { id: string }
@ -2003,7 +2005,7 @@ export type AgentInfo = {
description?: string
mode: "subagent" | "primary" | "all"
hidden: boolean
color?: string
color?: AgentColor
steps?: number
permissions: PermissionV2Ruleset
}

View file

@ -16,9 +16,7 @@ export type ID = typeof ID.Type
export const Name = Schema.String.pipe(Schema.brand("Agent.Name"))
export type Name = typeof Name.Type
export const Color = Schema.String.annotate({ identifier: "Agent.Color" }).check(
Schema.isPattern(/^#[0-9a-fA-F]{6}$/),
)
export const Color = Schema.String.annotate({ identifier: "Agent.Color" })
export type Color = typeof Color.Type
export interface Info extends Schema.Schema.Type<typeof Info> {}

View file

@ -0,0 +1,10 @@
import { expect, test } from "bun:test"
import { Schema } from "effect"
import { Agent } from "../src/agent.js"
test("Agent.Color preserves configured colors at the public boundary", () => {
const encode = Schema.encodeSync(Agent.Color)
expect(encode("info")).toBe("info")
expect(encode("custom-color")).toBe("custom-color")
})