/** * In-memory seed of the Theme-4 strategy lifecycle state machine (running→paused→stopped). * Short-term (§4); the durable crash-safe (SQLite) version is §5 merge work. * * Owns the self-pause state that RiskGuard used to hold. RiskGuard is now a stateless * gate evaluator that only reports; this component remembers which gates are currently * paused per strategy and fires the hook event + user notification on a genuine * running→paused transition, deduped so it alerts once per breach and re-arms only on * an explicit OPEN (re-running) of the same gate. */ import type { RiskGateEvaluation, RiskGateId, RiskSource } from "../health/types.js"; import type { HookSystem } from "../types/hooks.js"; import type { NotificationCopy, NotificationService } from "../types/notification.js"; /** One gate-block mapping: the hook event fired and the notification subtype the * user alert is tagged with. Kept together in a single map so a gate can never be * wired for one without the other (the old two-map split let a gate get an event * but silently no subtype → a dropped, untagged notification). */ interface GateBlock { /** Hook event fired on a genuine breach of this gate. */ event: string; /** Notification subtype the user alert is tagged with (routes it out of the * generic strategies bucket into its own category). */ subtype: string; } /** * Maps a genuinely-breached cap/halt gate to its gate-blocked hook event AND its * notification subtype — both in one record so they can never drift apart. Only * real breaches (CLOSED + evaluationOk + no fallback) qualify — fail-closed / * transport errors and cooldowns are excluded so we don't alert on transient API * issues. Adding a new gate-blocked gate: add one entry here (+ GATE_BLOCK_COPY_BUILDERS). */ export declare const GATE_BLOCK_BY_GATE: Partial>; /** * Build a friendly, per-gate gate-blocked copy block. Uses the real numbers from * the breached evaluation's `metrics`. Falls back to a generic, never-blank copy * when a gate has no builder or a needed metric is missing. */ export declare function buildGateBlockCopy(gateId: RiskGateId, metrics: Record | null | undefined, reason: string): NotificationCopy; export interface StrategyLifecycleDeps { /** Optional hook system to emit self-pause / cap-hit events. */ hookSystem?: HookSystem; /** Optional notification service for user-facing self-pause messages. */ notifications?: NotificationService; /** Runtime name attached to fired hook events (defaults to "runtime"). */ runtimeName?: string; } export interface StrategyLifecycle { /** * Observe one risk evaluation pass for a strategy and drive its self-pause state. * @param address strategy wallet address * @param label human strategy label (name or truncated address) for messages * @param evaluations per-gate evaluations from the risk guard * @param source evaluation source (runtime / cli) */ observe(address: string, label: string, evaluations: RiskGateEvaluation[], source: RiskSource): void; } export declare function createStrategyLifecycle(deps?: StrategyLifecycleDeps): StrategyLifecycle; export {}; //# sourceMappingURL=strategy-lifecycle.d.ts.map