# `core/charts/conditions.ts`

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

**Standards that cite this file**: [alta.chart/0.1: the Agent Chart](https://docs.altasystem.ai/reference/advanced/specs/alta-chart-0.1)

## Exports

### `CONDITION_STATES` 
```ts
const CONDITION_STATES = ["Unknown", "Unsupported", "Blocked", "NeedsInput", "Planned", "Running", "Ready", "Drifted", "Repairing", "Failed"] as const
```

### `ConditionState` 
```ts
type ConditionState = (typeof CONDITION_STATES)[number];
```

### `CONDITION_REASONS` 
Closed list of reasons (rule `condition.reason`).

```ts
const CONDITION_REASONS = [ "OsNotListed", "ArchNotListed", "HostedNo", "NeedsMissing", "ResourcesShort", "RequiresMissing", "PartFirst", …
```

### `ConditionReason` 
```ts
type ConditionReason = (typeof CONDITION_REASONS)[number];
```

### `Condition` 
```ts
interface Condition {
  state: ConditionState;
  reason?: ConditionReason;
  /** ISO date of the last change of state. */
  since: string;
  /** One short line (a FAIL line of the engine, what is missing): never a secret, never a path of the owner's files. */
  detail?: string;
}
```

### `WORST_FIRST` 
The order of `worst`: the first that appears wins.

```ts
const WORST_FIRST: readonly ConditionState[]
```

### `fromStep` 
An `alta.step/1` status (engine/STEPS.md). `verb`: the engine verb that answered (`ok` of an apply waits for its proof).

```ts
function fromStep(status: string, verb: "plan" | "apply" | "check", since: string, detail?: string): Condition
```

### `fromRun` 
A run of the run engine (server/runs/engine.mjs).

```ts
function fromRun(state: string, since: string, detail?: string): Condition
```

### `fromJob` 
A job (server/lib/jobs.mjs): `unknown` is a job the server lost at a restart.

```ts
function fromJob(state: "running" | "done" | "failed" | "unknown", since: string, detail?: string): Condition
```

### `fromCheck` 
A check result. A failing proof of something that was Ready is a drift; before that it keeps its state.

```ts
function fromCheck(status: "pass" | "fail" | "unverifiable", previous: Condition | undefined, since: string): Condition
```

### `worst` 
The worst of several conditions (a release's condition); Unknown when there are none.

```ts
function worst(list: readonly (Condition | undefined)[], since = new Date(0).toISOString()): Condition
```

### `conditionProblems` 
Problems of a condition read from a file (a release record): state and reason in the closed lists.

```ts
function conditionProblems(at: string, c: unknown): string[]
```

### `conditionKey` 
The copy key of a state or a reason, for the page (content/copy/&lt;lang&gt;/conditions.json).

```ts
const conditionKey = (c: Pick<Condition, "state" | "reason">) => …
```
