Agent/mode config schema and loaders that parse markdown definitions from disk.

Members

(static, constant) Info

Decoded agent config schema that applies normalize on decode and a Zod equivalent via statics.

(inner, constant) AgentSchema

Raw agent config schema as authored, allowing arbitrary extra keys (normalized later).

(inner, constant) Color

Schema for an agent color: a six-digit hex code or a named theme color.

(inner, constant) KNOWN_KEYS

The set of recognized top-level agent config keys; any other key is folded into options.

Methods

(static) load(dir) → {Promise.<Object>}

Load all agent definitions under a directory by scanning {agent,agents}/**\/*.md, parsing each markdown file's frontmatter and body, and decoding it into an agent config. Parse failures are logged and published as a session error event and skipped rather than aborting the whole load.

Parameters:
NameTypeDescription
dirstring

The base directory to scan for agent markdown files.

Returns:

A map of agent name to its parsed config.

Type: 
Promise.<Object>

(static) loadMode(dir) → {Promise.<Object>}

Load all mode definitions under a directory by scanning {mode,modes}/*.md, parsing each markdown file, and decoding it as an agent config forced into mode: "primary". Parse failures are logged and published as a session error event; entries that fail schema decoding are skipped.

Parameters:
NameTypeDescription
dirstring

The base directory to scan for mode markdown files.

Returns:

A map of mode name to its parsed config (each with mode set to "primary").

Type: 
Promise.<Object>

(inner) normalize(agent) → {Object}

Normalize a raw agent config: promote unknown keys into options, translate the deprecated tools boolean map into a permission object (write/edit/patch collapse into permission.edit), merge any explicit permission on top, and coalesce steps ?? maxSteps.

Parameters:
NameTypeDescription
agentObject

The raw parsed agent config.

Returns:

The normalized agent config with options, permission, and steps settled.

Type: 
Object