/** * Fleet-health flag dispatcher — consume side of the platform fleet-health signal. * * A fleet-managed mount is bound live by the host fleet rclone, so it is excluded * from the boot-time no-phantom-workspace barrier. The in-container manager runs a * local `stat`/`readdir` probe that catches directly-detectable failures (EIO / * dead bind), but a *silently-empty-but-writable* degraded fleet mount is only * visible to the host, which knows `core/stats.errors`. * * The platform fleet-health poll writes its verdict for connector `` into * `/.skaile/fleet-health/` (body: `healthy` | `degraded` | * `error`). The runner watches that directory and forwards each verdict to the * ConnectorManager's `reportFleetHealth`, which trips/lifts the read-only gate * with hysteresis. * * Contract: * - dir: `/.skaile/fleet-health/` * - file: one per connectorId; basename === connectorId. * - body: trimmed, lowercased; `healthy` → healthy, `degraded` → degraded * (live + readable but writes failing ⇒ read-only-readable surface), * anything else (`error` | unreadable | empty) → error (fail-closed). * * Extracted so the watcher logic can be unit-tested without the WebSocket server. */ import type { FleetHealthVerdict } from "@skaile/workspaces/connectors"; import type { Logger } from "@skaile/workspaces/types"; /** Minimal ConnectorManager surface the dispatcher needs (structural for tests). */ export interface FleetHealthReporter { reportFleetHealth(connectorId: string, verdict: FleetHealthVerdict): Promise; } /** Map a flag-file body to a verdict. Fail-closed: unknown/empty ⇒ `error`. */ export declare function parseFleetHealthBody(body: string): FleetHealthVerdict; /** * Read the verdict for one changed flag file and forward it to the manager. * * @param dir - the fleet-health flag directory. * @param fileName - the changed entry's basename (=== connectorId). * @param manager - the active connector manager, or `null` to short-circuit. */ export declare function dispatchFleetHealthFlag(dir: string, fileName: string, manager: FleetHealthReporter | null, log: Logger): Promise; //# sourceMappingURL=fleet-health-flag-dispatcher.d.ts.map