/**
 * EconomicObserver — Cost/value guard for autonomous agents.
 *
 * Tracks per-agent token costs vs. outcome value over a 7-day rolling window.
 * Agents with negative ROI get throttled (cycle skipped with reason
 * `economic_observer:negative_roi`).
 *
 * The SDK defines ONLY the interface + guard factory — pure, no DB.
 * Forge implements `PostgresEconomicObserver` backed by TimescaleDB.
 *
 * Throttle logic:
 *   if cost_7d > value_7d * 0.5 AND cycles > 20 → throttle (skip cycle).
 *   Cycles under 20 always run (cold-start grace period).
 *
 * @public
 */
// ─── Guard Factory ──────────────────────────────────────────────────────────────
/**
 * Create a RiskGuard from an EconomicObserver.
 *
 * Returns a guard compatible with `OODAAgentConfig.riskGuards` —
 * zero boilerplate wiring into the OODA loop.
 */
export function economicObserverGuard(observer, agentId) {
    return {
        name: "economic_observer",
        check: async (_ctx) => {
            const throttled = await observer.shouldThrottle(agentId);
            return {
                proceed: !throttled,
                reason: throttled ? "economic_observer:negative_roi" : undefined,
            };
        },
    };
}
//# sourceMappingURL=economic-observer.js.map