# `core/charts/values.ts`

<p class="generated-note">Generated from the exports of <a href="https://github.com/altasystem-ai/alta/blob/main/core/charts/values.ts"><code>core/charts/values.ts</code></a> · <code>npm run docs:gen</code></p>

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 ("$&lt;id&gt;" 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` 
```ts
const VALUE_KINDS = ["text", "choice", "email", "path", "number", "boolean"] as const
```

### `ValueKind` 
```ts
type ValueKind = (typeof VALUE_KINDS)[number];
```

### `VALUE_ID` 
```ts
const VALUE_ID = /^[a-z][a-z0-9-]{0,31}$/
```

### `ANSWER_KEYS` 
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 const
```

### `OWNER_KEYS` 
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 const
```

### `Value` 
```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` 
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` 
The key of a need's binding in the chosen values ("need:mind" → "claude").

```ts
const needKey = (id: string) => …
```

### `refOf` 
The value id of a reference ("$hour" → "hour"), or undefined when the string is not one.

```ts
const refOf = (v: unknown): string | undefined => …
```

### `isRef` 
```ts
const isRef = (v: unknown) => …
```

### `valueInput` 
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): PlainInput
```

### `valueProblems` 
Problems of one value declaration, each "values.&lt;id&gt;…: message (rule)".

```ts
function valueProblems(id: string, v: Value): { rule: string; field: string; msg: string }[]
```

### `valueFits` 
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): boolean
```

### `whenProblems` 
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` 
Does a condition hold for the chosen values? Absent: always.

```ts
function holds(w: When | undefined, chosen: Record<string, unknown>): boolean
```

### `withDefaults` 
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` 
An argument table with every "$&lt;id&gt;" replaced by the chosen value, and every "need:&lt;id&gt;" 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` 
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[]
```
