/** * Guard configuration types and parsing for tmux-pilot.config.yaml. * * Each role in the routing YAML can have a `guards` block that configures * turn limits, grace periods, and steer threshold actions. The top level * can have `harnessSettings` and `maxConcurrentAgents`. */ /** * Configuration for a single turn threshold action. * Extensible — new action types can be added without breaking existing code. */ export interface TurnThresholdAction { /** The type of action to execute. Currently only "steer" is supported. */ type: "steer"; /** * Template prompt sent to the agent. Supports {{turnsRemaining}} template variable. * Only used when type is "steer". */ prompt?: string; } /** * A turn threshold definition — fires when turnsRemaining === atTurnsRemaining. */ export interface TurnThreshold { /** Fire when maxTurns - turnCount === this value */ atTurnsRemaining: number; /** The action to execute when this threshold is reached */ action: TurnThresholdAction; } /** * Guard configuration for a single agent role. */ export interface GuardConfig { /** Max time (ms) to wait for session file to appear. Default: 30000 */ sessionFileTimeoutMs: number; /** Target turn count before grace period. 0 = no limit. */ maxTurns: number; /** Extra turns allowed after maxTurns before forced stop. 0 = no grace. */ graceTurns: number; /** Turn thresholds for deterministic steer actions. */ turnThresholds: TurnThreshold[]; /** * Max total monitoring time (ms) before declaring a timeout failure. * `0` = DISABLED (default) — the agent runs at its own pace, bounded only by * the authoritative lifecycle-end sentinel. A finite value is opt-in. Note: * when disabled, a terminal transition is never forced by elapsed time, so it * cannot trigger config-dir cleanup that would ENOENT a still-running agent. */ maxPollTimeMs: number; /** Polling interval in ms for session analysis. Global-only, default: 500. Min: 100. */ sessionPollIntervalMs?: number; /** * Max time (ms) with NO session-file entry growth — while the lifecycle-end * sentinel has NOT fired — before failing the agent as wedged. * * `0` = DISABLED (default). Inactivity is NOT a failure: a subagent doing a * long tool call (batch web fetch, big grep/build) legitimately writes * nothing to its session file for a while, and killing it for that throws * away real work. With staleness disabled, completion is detected solely by * the authoritative lifecycle-end sentinel and the only runaway bound is * `maxPollTimeMs`. Set a positive value only if you want early wedge * detection and accept that long tool calls may trip it. */ stalenessTimeoutMs: number; } /** * Per-harness settings. */ export interface HarnessSettings { /** tmux key combo to send when grace is exceeded. Default: "C-c" */ stopKeyCombo: string; } /** * Top-level extension guard configuration parsed from tmux-pilot.config.yaml. */ export interface GuardRoutingConfig { /** Per-role guard configs. Keyed by agent type name. */ roleGuards: Record; /** Global max concurrent agents. 0 = unlimited. */ maxConcurrentAgents: number; /** Per-harness settings. */ harnessSettings: Record; } /** Default guard config used when a role has no guards block. */ export declare const DEFAULT_GUARD_CONFIG: GuardConfig; /** Default harness settings keyed by harness id. */ export declare const DEFAULT_HARNESS_SETTINGS: Record; /** Publish a harness's declared default stop combo (composition root). */ export declare function registerHarnessStopCombo(harnessId: string, combo: string): void; /** Clear the declared stop-combo overlay — for test hygiene between cases. */ export declare function clearHarnessStopComboOverlay(): void; /** * Parse guard config from a role's YAML config block. * Returns defaults for any missing keys. * * Supports a 3-layer merge chain: * DEFAULT_GUARD_CONFIG ← baseGuards ← role.guards * Each layer does a shallow per-field override — if the role config defines a * field it wins; otherwise the base value is used; if the base doesn't define * it either, DEFAULT_GUARD_CONFIG provides the final fallback. * * @param roleConfig Raw YAML config block for a single role. * @param baseGuards Optional base to merge over instead of DEFAULT_GUARD_CONFIG. * When provided, fields not set in the role config will * inherit from this base instead of DEFAULT_GUARD_CONFIG. */ export declare function parseGuardConfig(roleConfig: Record | undefined, baseGuards?: GuardConfig): GuardConfig; /** * Parse per-harness stop combos. * * Precedence per harness id (canonical only — retired `harnessSettings` is * stripped by the config conversion and never reaches this resolver): * `harness-global-defaults..stopKeyCombo` (already renamed by conversion) * > declared `defaultStopKeyCombo` overlay * > `DEFAULT_HARNESS_SETTINGS[id]` * > `"C-c"` */ export declare function parseHarnessSettings(routingConfig: Record | undefined): Record; /** * Parse max concurrent agents from the top-level config. * Returns 0 for unlimited. */ export declare function getMaxConcurrentAgents(routingConfig: Record | undefined): number; //# sourceMappingURL=guard-config.d.ts.map