English
core/charts/values.ts
Generated from the exports of core/charts/values.ts · npm run docs:gen
Values of alta.chart/0.1 (docs/standards/alta-chart-0.1.md §4): what the owner chooses at install, how a value is used elsewhere ("$<id>" as the whole string of a field) and the one-value conditions (when). Pure. A value is never a secret. There is no interpolation inside a string, no expression, no default operator, no loop.
Standards that cite this file: No standard page cites this file yet.
Exports
VALUE_KINDS const
ts
const VALUE_KINDS = ["text", "choice", "email", "path", "number", "boolean"] as constValueKind type
ts
type ValueKind = (typeof VALUE_KINDS)[number];VALUE_ID const
ts
const VALUE_ID = /^[a-z][a-z0-9-]{0,31}$/ANSWER_KEYS const
Keys of the engine's answers file a value may be prefilled from (from: "answers.<key>").
ts
const ANSWER_KEYS = ["slug", "language", "timezone", "display_name", "channel", "embeddings", "default_model"] as constOWNER_KEYS const
Keys of the owner profile (from: "owner.<key>"): mind and channel are the player's default provider of each need kind.
ts
const OWNER_KEYS = ["slug", "display_name", "language", "timezone", "mind", "channel"] as constValue interface
ts
interface Value {
kind: ValueKind;
label: Text;
hint?: Text;
required?: boolean;
default?: string | number | boolean;
from?: string;
min?: number; max?: number; pattern?: string;
choices?: Choice[];
}When type
A condition on one value, or on the provider a need is bound to: absent, always.
ts
type When = { value: string; is: (string | boolean)[] } | { need: string; is: string[] };needKey const
The key of a need's binding in the chosen values ("need:mind" → "claude").
ts
const needKey = (id: string) => …refOf const
The value id of a reference ("$hour" → "hour"), or undefined when the string is not one.
ts
const refOf = (v: unknown): string | undefined => …isRef const
ts
const isRef = (v: unknown) => …valueInput function
The value as the input of a step (so a default is checked by the same rules as a player's answer).
ts
function valueInput(id: string, v: Value): PlainInputvalueProblems function
Problems of one value declaration, each "values.<id>…: message (rule)".
ts
function valueProblems(id: string, v: Value): { rule: string; field: string; msg: string }[]valueFits function
Does a value of this declaration fit an executor's parameter? A closed list takes a choice inside it.
ts
function valueFits(v: Value, spec: ParamSpec): booleanwhenProblems function
Problems of a when against the chart's values.
ts
function whenProblems(at: string, w: unknown, values: Record<string, Value>, needs: Record<string, NeedOf> = {}): string[]holds function
Does a condition hold for the chosen values? Absent: always.
ts
function holds(w: When | undefined, chosen: Record<string, unknown>): booleanwithDefaults function
The chosen values with each value's default where nothing was chosen.
ts
function withDefaults(values: Record<string, Value> | undefined, chosen: Record<string, unknown> = {}): Record<string, unknown>resolveRefs function
An argument table with every "$<id>" replaced by the chosen value, and every "need:<id>" by the engine's word of the provider that need is bound to (claude, codex, local, telegram, none); undefined when nothing was chosen.
ts
function resolveRefs<T extends Record<string, unknown>>(args: T | undefined, chosen: Record<string, unknown>): Record<string, unknown>chosenProblems function
Problems of the owner's values given at install (the release's values): every id known, every value as its input would take it, every required value there (after defaults). Never echoes a value back.
ts
function chosenProblems(values: Record<string, Value> | undefined, chosen: Record<string, unknown>): string[]