summaryrefslogtreecommitdiffhomepage
path: root/packages/console/core/src/black.ts
blob: 0ecbc94a45faac8e4d248685b60eca53630677ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { z } from "zod"
import { fn } from "./util/fn"
import { Resource } from "@opencode-ai/console-resource"

export namespace BlackData {
  const Schema = z.object({
    fixedLimit: z.number().int(),
    rollingLimit: z.number().int(),
    rollingWindow: z.number().int(),
  })

  export const validate = fn(Schema, (input) => {
    return input
  })

  export const get = fn(z.void(), () => {
    const json = JSON.parse(Resource.ZEN_BLACK.value)
    return Schema.parse(json)
  })
}