toolchain
The built-in Policy toolchain, against a session on the wrong tool versions, rules missing from the agent’s context: its defaults, its options and a configuration that writes it.
To learn what it guards against and see it at work, read the guide: Toolchain and rules.
Defaults
| Default | Value |
|---|---|
| On by default | no: an entry turns it on |
| Fail mode | open |
| Timeout | 9000 ms |
| Events | SessionStart, UserPromptSubmit |
| Tools | every tool, or as its options set |
| Agent types | every agent, or as its options set |
Options
| Option | Type | Default | Description |
|---|---|---|---|
deadlineMillis | integer | — | How long the session-start check may take, in milliseconds, before it says why it could not finish (6000 when absent). |
overrideEnv | string | — | The variable that, set at the session's start to anything but nothing or 0, lets prompts through a mismatch; HARNESS_ALLOW_ENV_SKEW when absent. |
pins | (object | object)[] | — | The tools whose version is compared with a pin at each session start, each { name, versionCommand, expect or expectFromFile, match?, blocking?, hint? }. |
required | object[] | — | The tools the session needs on PATH, each { name, hint }, named with its hint when missing. |
Example
A configuration that writes every option, a comment above each:
import { defineConfig } from '@microeinhundert/harness-kit';
export default defineConfig({
// The Policy entries, in the order their Decisions merge in.
policies: [
{
// The Policy's name, unique in the configuration; messages and logs name the Policy by it.
id: 'toolchain',
// The constructor's options, which it decodes.
options: {
// How long the session-start check may take, in milliseconds, before it says why it could
// not finish (6000 when absent).
deadlineMillis: 1,
// The variable that, set at the session's start to anything but nothing or `0`, lets
// prompts through a mismatch; `HARNESS_ALLOW_ENV_SKEW` when absent.
overrideEnv: 'HARNESS_ALLOW_ENV_SKEW',
// The tools whose version is compared with a pin at each session start, each
// `{ name, versionCommand, expect or expectFromFile, match?, blocking?, hint? }`.
pins: [
{
// Whether a mismatch refuses the session's prompts; `true` when absent.
blocking: true,
// The step that fixes a mismatch.
hint: 'Run `nvm use`.',
// How the installed version is compared with the pin: `exact` (the same version),
// `prefix` (the pin or a version below it) or `major` (the same first number); `exact`
// when absent.
match: 'exact',
// The tool's name, which names its record and its messages.
name: 'node',
// The command that prints the tool's installed version, its program and arguments, run
// without a shell.
versionCommand: ['node'],
// The version the tool must have, written out.
expect: '1.4.8',
},
],
// The tools the session needs on `PATH`, each `{ name, hint }`, named with its hint when
// missing.
required: [
{
// The step that installs the tool, named when it is missing.
hint: 'Install it with `brew install jq`.',
// The tool's program name, looked up on `PATH`.
name: 'jq',
},
],
},
// The name of the kit's Policy constructor that builds the Policy.
use: 'toolchain',
},
],
});keep-awake
The built-in Policy keep-awake, against the machine sleeping while the agent works: its defaults, its options and a configuration that writes it.
rules
The built-in Policy rules, against a session on the wrong tool versions, rules missing from the agent’s context: its defaults, its options and a configuration that writes it.