Skip to content

core/charts/risk.ts ​

Generated from the exports of core/charts/risk.ts · npm run docs:gen

The risk level of a chart (docs/standards/alta-chart-0.1.md §8, "Risk level"): computed from what the chart names, never declared by its author. Deterministic, because capabilities must already equal the capabilities of the executors the chart names (chart.capabilities) and the permissions are closed lists. Every reason is returned: the consent step and alta verify show them. Conservative: a when is ignored (what a chart may do with some values, it may do). Pure: no disk, no network.

Standards that cite this file: alta.attestation/0.1: who signed which files of a chart · alta.chart/0.1: the Agent Chart

Exports ​

RiskLevel type ​

ts
type RiskLevel = "low" | "medium" | "high";

RISK_LEVELS const ​

ts
const RISK_LEVELS: readonly RiskLevel[]

RISK_RULES const ​

The rules, in the order they are checked. Ids are stable: the docs and the tests name them.

ts
const RISK_RULES = [ { id: "risk.exec", level: "high" }, { id: "risk.tools-floor", level: "high" }, { id: "risk.setup", level: "high" }, { …

RiskRuleId type ​

ts
type RiskRuleId = (typeof RISK_RULES)[number]["id"];

RiskReason interface ​

ts
interface RiskReason { rule: RiskRuleId; level: RiskLevel; en: string; fr: string }

Risk interface ​

ts
interface Risk { level: RiskLevel; reasons: RiskReason[] }

RiskTables interface ​

The tables the rules read (the defaults are the closed lists of this build; a test may give others).

ts
interface RiskTables {
  toolsFloor?: readonly string[];
  netTools?: readonly string[];
  /** Is a repair kind one the owner may allow to run without being asked? */
  grantable?: (kind: unknown) => boolean;
  /** The capability of an executor id (default: the closed list, core/runs/executors.ts). */
  capOf?: (executor: unknown) => string | null | undefined;
}

riskOf function ​

The risk level of a chart and every reason for it. bindings (need id → provider): the real case after binding, for the consent step; absent, the worst case among each need's providers, for the catalogue.

ts
function riskOf(chart: Chart | Loose, tables: RiskTables = {}, bindings?: Record<string, string | undefined>): Risk

RISK_WORDS const ​

The level in plain words, for the consent step.

ts
const RISK_WORDS: Readonly<Record<RiskLevel, { en: string; fr: string }>>

riskLines function ​

The lines of the consent step: the level, then one line per reason.

ts
function riskLines(r: Risk): { en: string[]; fr: string[] }

Alta OS is open source (MIT).