/** * Fastify route: `GET /state`. * * Returns the full {@link RuntimeSystemState} for every running runtime — * the same shape `senpi runtime state --json` returns over the OpenClaw * gateway, exposed here over HTTP for callers (e.g. the producer wrapper's * daemon liveness check) that don't want a gateway dependency. * * Mirrors the existing CLI separation: * - {@link registerHealthRoute `/health`} — lightweight readiness probe * suitable for LB / Kubernetes probes (returns wallet + queue depth only). * - `/state` (this route) — full runtime state including registered * scanners, action handles, DSL state, risk gates. * * HTTP status: * - `200` with envelope `{ success: true, data: { runtimes: [...] } }` on * success. Always 200 — the response is informational; an empty * `runtimes` array is a valid answer ("no runtimes registered"). * - `503` on internal error from a `getSystemState()` call. Surfaces * the senpi-stack error envelope. * * Optional filter: `?address=0x...` returns only the runtime matching * that wallet address (case-insensitive). Saves bytes per probe when a * caller only cares about its own wallet. */ import type { FastifyInstance } from "fastify"; import type { RuntimeHandle } from "../../runtime/run.js"; import type { Logger } from "../../utils/logger.js"; /** * Dependencies injected into the `/state` route at registration time. */ export interface StateRouteDeps { /** Live runtime handles maintained by the plugin, keyed by lowercased address. */ runtimeHandles: Map; /** Logger instance for unexpected errors. */ logger: Logger; } /** * Register `GET /state` on the given Fastify instance. * * Iterates runtime handles, calls `getSystemState()` on each, returns the * collected list under `data.runtimes[]`. A handle whose `getSystemState()` * returns `null` (runtime is mid-startup or mid-shutdown) is omitted from * the result rather than included as a sentinel — callers waiting for a * specific wallet should re-probe rather than try to interpret a null. * * @param fastify Fastify instance to register the route on. * @param deps Route dependencies injected at plugin start. */ export declare function registerStateRoute(fastify: FastifyInstance, deps: StateRouteDeps): void; //# sourceMappingURL=state.d.ts.map