pi-decider
Version:
Decision backends for pi and omp — TypeSafe Jev, OpenRouter's Decisions API, or an OpenAI-compatible chat proxy — exposed as one typed tool (noul / choice / score)
16 lines (13 loc) • 533 B
text/typescript
/**
* Schema helpers shared by the tool definition. `stringEnum` reproduces the shape pi's `StringEnum`
* helper produces — a plain `enum` schema rather than `anyOf`/`const`, which some providers reject —
* without importing a harness-specific package.
*/
import { Type } from "typebox";
export function stringEnum<T extends readonly string[]>(values: T, description?: string) {
return Type.Unsafe<T[number]>({
type: "string",
enum: [...values],
...(description === undefined ? {} : { description }),
});
}