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

@ -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")
})