/** * LandscapeAgent — Environment topology tracker * * Polls {@link EnvironmentManager.list} on a fixed interval and writes a * health record for each known environment to the blackboard under * `landscape:health:`. TransportAgent reads these records before * starting a DRAINING phase to detect degraded destinations early. * * Health logic: * - `missing` — environment directory does not exist * - `degraded` — last transport targeting this env failed or rolled back * - `healthy` — otherwise * * Blackboard keys written: * landscape:health: — {@link EnvironmentHealth} record (overwritten each poll) * * @module LandscapeAgent * @version 1.0.0 */ import type { LockedBlackboard } from './locked-blackboard'; import type { EnvironmentManager, EnvName } from './env-manager'; import type { TransportStatusRecord } from './transport-agent'; /** Status of a single environment as seen by {@link LandscapeAgent}. */ export type EnvironmentHealthStatus = 'healthy' | 'degraded' | 'missing'; /** Health record written to `landscape:health:`. */ export interface EnvironmentHealth { env: EnvName; status: EnvironmentHealthStatus; /** Number of config keys present in the environment directory. */ keyCount: number; /** ISO-8601 timestamp of the last successful poll. */ lastChecked: string; /** Status of the most recent transport that targeted this environment. */ lastTransportStatus?: TransportStatusRecord['status']; /** Transport request ID of the most recent completed transport. */ lastTransportId?: string; } /** Options for constructing a {@link LandscapeAgent}. */ export interface LandscapeAgentOptions { /** Blackboard used to publish health records. */ blackboard: LockedBlackboard; /** Environment manager for querying known environments. */ envManager: EnvironmentManager; /** Agent ID used for blackboard writes. Default: `'basis:landscape'`. */ agentId?: string; /** Poll interval in milliseconds. Default: 30 000. */ pollIntervalMs?: number; } /** * Slow-poll environment topology tracker. * * @example * ```typescript * const landscape = new LandscapeAgent({ blackboard, envManager }); * landscape.start(); * * // Read health for a specific environment: * const entry = blackboard.read('landscape:health:prod'); * const health = entry?.value as EnvironmentHealth; * ``` */ export declare class LandscapeAgent { private readonly _blackboard; private readonly _envManager; private readonly _agentId; private readonly _pollIntervalMs; private _pollHandle; private _running; constructor(options: LandscapeAgentOptions); /** * Start the poll loop. The first poll fires immediately. */ start(): void; /** Stop the poll loop. */ stop(): void; /** Whether the agent is currently running. */ get isRunning(): boolean; /** * Perform a single health poll and write results to the blackboard. * Can be called manually (e.g. from tests) without starting the loop. */ poll(): Promise; private _poll; private _computeHealth; /** Scan `transport:status:*` keys for the most recent TR that targeted `env`. */ private _findLastTransport; } //# sourceMappingURL=landscape-agent.d.ts.map