refactor(tui): finish V2 theme migration (#38383)
This commit is contained in:
parent
36979c9641
commit
b6e14b5a74
15 changed files with 46 additions and 119 deletions
|
|
@ -6,10 +6,7 @@ import { ConfigProvider } from "./provider"
|
|||
import { ConfigModel } from "./model"
|
||||
import { PositiveInt } from "../schema"
|
||||
|
||||
export const Color = Schema.Union([
|
||||
Schema.String.check(Schema.isPattern(/^#[0-9a-fA-F]{6}$/)),
|
||||
Schema.Literals(["primary", "secondary", "accent", "success", "warning", "error", "info"]),
|
||||
])
|
||||
export const Color = Schema.String.check(Schema.isPattern(/^#[0-9a-fA-F]{6}$/))
|
||||
|
||||
export class Info extends Schema.Class<Info>("ConfigV2.Agent")({
|
||||
model: ConfigModel.Selection.pipe(Schema.optional),
|
||||
|
|
|
|||
|
|
@ -4,10 +4,7 @@ import { Schema, SchemaGetter } from "effect"
|
|||
import { PositiveInt } from "../../schema"
|
||||
import { ConfigPermissionV1 } from "./permission"
|
||||
|
||||
const Color = Schema.Union([
|
||||
Schema.String.check(Schema.isPattern(/^#[0-9a-fA-F]{6}$/)),
|
||||
Schema.Literals(["primary", "secondary", "accent", "success", "warning", "error", "info"]),
|
||||
])
|
||||
const Color = Schema.String.check(Schema.isPattern(/^#[0-9a-fA-F]{6}$/))
|
||||
|
||||
const AgentSchema = Schema.StructWithRest(
|
||||
Schema.Struct({
|
||||
|
|
@ -29,7 +26,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) or theme color (e.g., primary)",
|
||||
description: "Hex color code (e.g., #FF5733)",
|
||||
}),
|
||||
steps: Schema.optional(PositiveInt).annotate({
|
||||
description: "Maximum number of agentic iterations before forcing text-only response",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { describe, expect } from "bun:test"
|
||||
import { describe, expect, test } from "bun:test"
|
||||
import fs from "fs/promises"
|
||||
import path from "path"
|
||||
import { Effect, Schema } from "effect"
|
||||
|
|
@ -23,6 +23,10 @@ const defaultPermissions = [
|
|||
{ action: "external_directory", resource: "*", effect: "ask" },
|
||||
] satisfies PermissionV2.Ruleset
|
||||
|
||||
test("rejects named agent color tokens", () => {
|
||||
expect(() => decode({ agents: { reviewer: { color: "warning" } } })).toThrow()
|
||||
})
|
||||
|
||||
describe("ConfigAgentPlugin.Plugin", () => {
|
||||
it.effect("matches POSIX paths against home-relative permissions", () =>
|
||||
Effect.gen(function* () {
|
||||
|
|
@ -160,7 +164,7 @@ describe("ConfigAgentPlugin.Plugin", () => {
|
|||
description: "Reviews changes",
|
||||
mode: "subagent",
|
||||
hidden: true,
|
||||
color: "warning",
|
||||
color: "#ff6b6b",
|
||||
steps: 12,
|
||||
request: {
|
||||
headers: { first: "one", shared: "first" },
|
||||
|
|
@ -197,7 +201,7 @@ describe("ConfigAgentPlugin.Plugin", () => {
|
|||
description: "Reviews changes",
|
||||
mode: "subagent",
|
||||
hidden: true,
|
||||
color: "warning",
|
||||
color: "#ff6b6b",
|
||||
steps: 12,
|
||||
model: { providerID: "anthropic", id: "claude-sonnet" },
|
||||
})
|
||||
|
|
|
|||
|
|
@ -738,7 +738,7 @@ describe("Config", () => {
|
|||
system: "Find regressions.",
|
||||
mode: "subagent",
|
||||
hidden: false,
|
||||
color: "warning",
|
||||
color: "#ff6b6b",
|
||||
steps: 12,
|
||||
disabled: false,
|
||||
permissions: [{ action: "edit", resource: "*", effect: "deny" }],
|
||||
|
|
@ -824,7 +824,7 @@ describe("Config", () => {
|
|||
expect(reviewer?.system).toBe("Find regressions.")
|
||||
expect(reviewer?.mode).toBe("subagent")
|
||||
expect(reviewer?.hidden).toBe(false)
|
||||
expect(reviewer?.color).toBe("warning")
|
||||
expect(reviewer?.color).toBe("#ff6b6b")
|
||||
expect(reviewer?.steps).toBe(12)
|
||||
expect(reviewer?.disabled).toBe(false)
|
||||
expect(reviewer?.permissions).toEqual([{ action: "edit", resource: "*", effect: "deny" }])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue