Skip to content

core/charts/chart.ts ​

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

The Agent Chart (alta.chart/0.1, docs/standards/alta-chart-0.1.md): the one format of anything a person installs and configures on their own machine. A chart is data: it names executors, checks, sign-in tools and repair kinds from closed lists that live in code. Nothing in it is run as code, there is no templating language, and nothing is written before the owner agrees to a plan card. checkChart(chart, env) returns the problems, each written "<field>: <message> (<rule id>)"; empty means valid. The same function runs in alta lint and in the server before an install. core/ reads no disk: the files of the chart folder are given by the caller (env.files).

Standards that cite this file: alta.chart/0.1: the Agent Chart

Exports ​

CHART_SCHEMA const ​

ts
const CHART_SCHEMA = "alta.chart/0.1"

ChartKind type ​

ts
type ChartKind = "agent" | "team" | "module" | "package" | "skill" | "system" | "quest-pack" | "universe" | "cosmetic";

CHART_KINDS const ​

ts
const CHART_KINDS: readonly ChartKind[]

DATA_KINDS const ​

Data charts: their only parts run item.data, they need no capability and show no plan card that writes.

ts
const DATA_KINDS: readonly ChartKind[]

RESERVED_IDS const ​

ts
const RESERVED_IDS = ["tests", "docs", "index"]

SIGNIN_EXECUTORS const ​

The connection executors a sign-in may use: they declare secret and connect an account or a device.

ts
const SIGNIN_EXECUTORS = ["signin.cli", "setup.other-signin", "channel.connect", "channel.pair-approve", "connector.connect", "tablet.pair"] as const

TOOLS_FLOOR const ​

Tools a community agent can never be allowed.

ts
const TOOLS_FLOOR = ["secrets", "gateway", "openclaw", "sessions_spawn", "terminal", "computer"] as const

RENDER_NAMES const ​

marks the engine replaces in an agent's text files when it renders the workspace.

ts
const RENDER_NAMES = ["owner_slug", "owner_display", "language", "timezone", "home", "agents", "engine", "os_repo", "model_primary", …

HOOK_KINDS const ​

ts
const HOOK_KINDS = ["value", "section", "record", "addendum", "extend"] as const

GAME_ONLY_CHECKS const ​

Check types a chart's proof may name: the server's read-only checks. The core's own (answer, entity, world, mission, seen) describe the game, not the machine, and are refused in a proof.

ts
const GAME_ONLY_CHECKS = ["answer", "entity", "world", "mission", "seen", "item"]

CHEAP_CHECKS const ​

Check types that cost nothing (an alive proof may only use these): no model call, no network beyond 127.0.0.1 and the tools' own status commands.

ts
const CHEAP_CHECKS = ["identity", "module", "automation", "config", "file", "skill", "service", "bin", "signin", "model", "permission", …

Duration type ​

ts
type Duration = string;

durationS function ​

Seconds of a duration ("5m", "1h", "26h", "7d"), or null.

ts
function durationS(d: unknown): number | null

Signin interface ​

ts
interface Signin {
  use: (typeof SIGNIN_EXECUTORS)[number];
  args?: Record<string, string | number | boolean>;
  proof: Check;
  why: Text;
  optional?: boolean;
  when?: When;
  requires?: string[];
}

Permissions interface ​

ts
interface Permissions {
  tools: { allow: string[]; deny: string[] };
  exec?: { mode: "deny" | "allowlist"; allow?: { bin: string }[] };
  /** Channels it may write to: a pinned kind (telegram, whatsapp) or a channel need ("need:<id>"). */
  channels?: string[];
}

ChartAgent interface ​

ts
interface ChartAgent {
  id: string; name: Text; emoji?: string; role?: AgentRole; domain?: string;
  files: string[];
  /** A mind need ("need:<id>"), or a pinned form: a value, an engine decision, an exact model. */
  model: string | { from: string } | { decision: string } | { id: string };
  fallbacks?: string[];
  /** A channel need ("need:<id>"), or a pinned channel. */
  channel?: string | { kind: "telegram" | "whatsapp" | "none"; session?: string };
  permissions: Permissions;
  wake?: string[];
  watch?: { function: string; controller: string; mother: string; watches: string[] };
  instance?: string[];
  when?: When;
  /** Origin alta only: what the engine's render of a core agent needs beyond these fields (its own contract). */
  engine?: Record<string, unknown>;
}

Automation interface ​

ts
interface Automation {
  key: string; title: Text; agent: string;
  schedule: { cron: string; tz: string } | { daily: string } | { every: Duration } | { trigger: string };
  message: string;
  spends: "none" | "model";
  when?: When;
}

Service interface ​

ts
interface Service { id: string; label: PerOS<string>; port?: number; health?: Check; when?: When }

Hook interface ​

ts
interface Hook { kind: (typeof HOOK_KINDS)[number]; contract: 1; doc: string; args?: unknown; pattern?: string; default?: unknown; target?: string; field?: string; maxLines?: number; timeoutS?: number; heading?: string; when?: "render" }

Package type ​

ts
type Package =
  | { type: "chart" }
  | { type: "alta-module"; scripts: PerOS<{ install: string; check: string; checkArgs?: string[]; selftest?: string }>; module?: Record<string, unknown> }
  | { type: "openclaw-skill"; slug: string; version: string; sha256: string }
  | { type: "data" };

ChartPart interface ​

ts
interface ChartPart {
  id: string; title?: Text; do: string;
  args?: Record<string, string | number | boolean>;
  requires?: string[];
  when?: When;
  resources?: Resources;
  undo?: "auto" | "command" | "archive" | "none";
  proof: Check[];
}

AliveProof interface ​

ts
interface AliveProof { id: string; check: Check; every?: Duration; grace?: number; when?: When; repair?: string[] }

Proofs interface ​

ts
interface Proofs { installed?: Check[]; ready: Check[]; alive?: AliveProof[] }

Requires interface ​

ts
interface Requires { alta?: string; openclaw?: string; charts?: { id: string; version: string; optional?: boolean }[]; skills?: string[] }

ChartPrivacy type ​

ts
type ChartPrivacy = "personal" | "shareable";

PRIVACY_KINDS const ​

The kinds that may say privacy: what holds an owner's own words (agents, teams) or code they may share.

ts
const PRIVACY_KINDS: readonly ChartKind[]

chartPrivacy const ​

A chart's privacy: shareable only when it says so; absent means personal.

ts
const chartPrivacy = (c: { privacy?: unknown }): ChartPrivacy => …

privacyFindings function ​

ts
function privacyFindings(text: string, keywords: readonly RegExp[] = []): string[]

CHART_CATEGORIES const ​

Categories a chart may be listed under (closed, at most 3 per chart).

ts
const CHART_CATEGORIES = ["assistant", "writing", "research", "media", "home", "work", "developer", "system", "game"] as const

ChartCategory type ​

ts
type ChartCategory = (typeof CHART_CATEGORIES)[number];

Publisher interface ​

Who publishes a chart: never an e-mail.

ts
interface Publisher { id: string; name: string; url?: string }

SPDX_COMMON const ​

SPDX identifiers most charts use; LicenseRef-<name> names the author's own terms. Others are a warning, not an error.

ts
const SPDX_COMMON = ["MIT", "Apache-2.0", "BSD-2-Clause", "BSD-3-Clause", "ISC", "MPL-2.0", "GPL-2.0-only", "GPL-2.0-or-later", …

isSpdx function ​

Is a license an SPDX expression of the common identifiers (AND, OR, WITH, parentheses, LicenseRef-…)?

ts
function isSpdx(license: unknown): boolean

Chart interface ​

ts
interface Chart {
  schema: typeof CHART_SCHEMA;
  id: string; version: string; kind: ChartKind; status?: "ready" | "draft";
  title: Text; summary: Text; why?: Text; author: string; license: string; price: "free" | "paid";
  origin: "alta" | "community"; verified?: boolean; source?: ChartSource;
  /** Who may see it: `personal` (the default: the owner's own, kept private) or `shareable` (may be published). */
  privacy?: ChartPrivacy;
  /** What it needs of the network at run time (§8, "External services and locality"). Absent: not declared. */
  locality?: Locality;
  /** The online services it talks to. */
  external?: External;
  publisher?: Publisher;
  homepage?: string;
  keywords?: string[];
  categories?: ChartCategory[];
  /** A .png or .webp file of the chart, 256 KB at most. */
  icon?: string;
  /** What changed in this version, in plain words. */
  changes?: Text;
  support: Support; resources?: Resources;
  requires?: Requires;
  capabilities: Capability[];
  /** What it needs, by kind (a mind, a channel), bound by the player to a provider (section "Needs"). */
  needs?: Record<string, NeedDecl>;
  values?: Record<string, Value>;
  signins?: Record<string, Signin>;
  agents?: ChartAgent[];
  skills?: ({ slug: string; path: string } | { ref: string; version: string; sha256: string })[];
  automations?: Automation[];
  services?: Service[];
  uses?: string[];
  /** Local models the chart pulls (the targets of its `model.pull` repairs). */
  models?: string[];
  hooks?: Record<string, Hook>;
  package?: Package;
  parts: ChartPart[];
  proofs: Proofs;
  repairs?: Repair[];
  spawn?: { entity: { id: string; kind: EntityKind; name: string; role?: AgentRole } };
  branch?: QuestFragment | Branch;
  universe?: unknown;
  scene?: Cutscene;
  review?: { reviewer?: { at: string; verdict: "pass" | "warn"; note?: Text }; guardian?: { at: string; touches: string[] } };
}

ChartFile interface ​

One file of the chart folder, as the caller read it: its size, its text when it is a text file, and whether it is a link that leaves the folder.

ts
interface ChartFile { size: number; text?: string; escapes?: boolean }

ChartEnv interface ​

ts
interface ChartEnv {
  /** Executors this build knows (default: the closed list). */
  executors?: readonly ExecutorInfo[];
  /** Quest uids of the game (a chart's quests must not collide). */
  questUids?: Set<string>;
  /** When given, the chart's quest fragment must merge into it. */
  game?: Game;
  /** The files of the chart folder, by relative path ("chart.json", "agents/brief/SOUL.md"…). Absent: files are not checked. */
  files?: Record<string, ChartFile>;
  /** The name of the folder that holds chart.json (must equal the id). */
  folder?: string;
  /** Other charts known (installed, or of the same catalog): for cycles of `requires.charts` and services. */
  others?: readonly Pick<Chart, "id" | "requires" | "services">[];
  /** The owner's private keyword list (one expression per line of their local file), applied to a shareable chart. */
  privacyKeywords?: readonly RegExp[];
}

ChartProblem interface ​

A problem, before it is written as one line.

ts
interface ChartProblem { rule: string; field: string; msg: string; level?: "warning" }

formatChartProblem const ​

ts
const formatChartProblem = (p: ChartProblem) => …

chartRuleOf const ​

The rule id at the end of a problem line, or undefined.

ts
const chartRuleOf = (line: string) => …

safePath const ​

A path inside the chart: relative, with /, never .., never absolute.

ts
const safePath = (p: unknown) => …

ROOT_CHARTS const ​

Alta's charts that are a whole folder of the Alta OS repository: their folder is not named after their id.

ts
const ROOT_CHARTS: Readonly<Record<string, string>>

agentDir const ​

Where an agent's files are, in its chart folder: agents/<id>/, or <id>/ for the core agents (the folder agents/ itself).

ts
const agentDir = (c: Pick<Chart, "id" | "origin">, agent: string) => …

chartProblems function ​

The structured problems of a chart (and its warnings, level: "warning").

ts
function chartProblems(input: unknown, env: ChartEnv = {}): ChartProblem[]

checkChart function ​

Problems of a chart, one line each, warnings left out (empty = valid).

ts
function checkChart(c: unknown, env: ChartEnv = {}): string[]

chartWarnings function ​

Warnings of a chart, one line each.

ts
function chartWarnings(c: unknown, env: ChartEnv = {}): string[]

widenings function ​

What a new version adds that the owner never agreed to: a capability, a tool, an exec entry, a channel, a sign-in, a repair kind, an online service, a host, a kind of data that leaves the machine, or a less local locality. A widening always needs the consent screen again and is never applied in the background.

ts
function widenings(old: Chart, next: Chart): string[]

widens const ​

ts
const widens = (old: Chart, next: Chart) => …

partOrder function ​

The parts that hold for these values, in the order they run: requires first, then the order of the list.

ts
function partOrder(c: Chart, chosen: Record<string, unknown> = {}): ChartPart[]

Alta OS is open source (MIT).