let agentState = null;
export function getAgentState() {
    if (!agentState) {
        throw new Error("Agent state not initialized");
    }
    return agentState;
}
export function initAgentState(state) {
    agentState = state;
}
/**
 * Registered graceful-shutdown callbacks. Runs all registered callbacks
 * (channel adapters, pollers, etc.) during graceful shutdown.
 */
const shutdownCallbacks = [];
export function registerShutdownCallback(cb) {
    shutdownCallbacks.push(cb);
}
export async function runGracefulShutdown() {
    for (const cb of shutdownCallbacks) {
        await cb();
    }
}
//# sourceMappingURL=state.js.map