agent.ts 1.0 KB

12345678910111213141516171819202122232425
  1. export * as ConfigAgent from "./agent"
  2. import { Schema } from "effect"
  3. import { PermissionSchema } from "../permission/schema"
  4. import { ConfigProvider } from "./provider"
  5. import { PositiveInt } from "../schema"
  6. export const Color = Schema.Union([
  7. Schema.String.check(Schema.isPattern(/^#[0-9a-fA-F]{6}$/)),
  8. Schema.Literals(["primary", "secondary", "accent", "success", "warning", "error", "info"]),
  9. ])
  10. export class Info extends Schema.Class<Info>("ConfigV2.Agent")({
  11. model: Schema.String.pipe(Schema.optional),
  12. variant: Schema.String.pipe(Schema.optional),
  13. request: ConfigProvider.Request.pipe(Schema.optional),
  14. system: Schema.String.pipe(Schema.optional),
  15. description: Schema.String.pipe(Schema.optional),
  16. mode: Schema.Literals(["subagent", "primary", "all"]).pipe(Schema.optional),
  17. hidden: Schema.Boolean.pipe(Schema.optional),
  18. color: Color.pipe(Schema.optional),
  19. steps: PositiveInt.pipe(Schema.optional),
  20. disabled: Schema.Boolean.pipe(Schema.optional),
  21. permissions: PermissionSchema.Ruleset.pipe(Schema.optional),
  22. }) {}