external
The built-in Policy external, against whatever an executable you write decides, in any language: its defaults, its options and a configuration that writes it.
To learn what it guards against and see it at work, read the guide: External.
Defaults
| Default | Value |
|---|---|
| On by default | no: an entry turns it on |
| Fail mode | closed |
| Timeout | 12000 ms |
| Events | set by its options |
| Tools | every tool, or as its options set |
| Agent types | every agent, or as its options set |
Options
| Option | Type | Default | Description |
|---|---|---|---|
adapter | string | required | The adapter that decides, by its name under the configuration's adapters. |
agentTypes | string[] | — | The agent types the Policy runs for; every agent and the main session when absent. |
events | ("PostToolUse" | "PreToolUse" | "SessionStart" | "Stop" | "SubagentStop" | "UserPromptSubmit")[] | required | The hook events the Policy runs for. |
timeoutMillis | integer | — | How long one decide may take, in milliseconds; the adapter's own timeout when shorter, 10000 when absent. The Policy's timeout follows from it. |
tools | string[] | — | The tools the Policy runs for, each a name or a prefix ending in *; every tool when absent. |
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: 'external',
// The constructor's options, which it decodes.
options: {
// The adapter that decides, by its name under the configuration's `adapters`.
adapter: 'secrets-guard',
// The agent types the Policy runs for; every agent and the main session when absent.
agentTypes: ['verifier'],
// The hook events the Policy runs for.
events: ['PostToolUse'],
// How long one `decide` may take, in milliseconds; the adapter's own timeout when shorter,
// 10000 when absent. The Policy's timeout follows from it.
timeoutMillis: 1,
// The tools the Policy runs for, each a name or a prefix ending in `*`; every tool when
// absent.
tools: ['Bash'],
},
// The name of the kit's Policy constructor that builds the Policy.
use: 'external',
},
],
});