import type { ShelfConfig } from './config.js'; import type { ConfidenceResult } from './confidence/mad.js'; import { ShelfEventEmitter } from './events/emitter.js'; import { HypothesisApplier, HypothesisGenerator, HypothesisReverter } from './hypothesis/index.js'; import { JsonlLogger } from './logger/jsonl.js'; import { SessionLogger } from './logger/session.js'; import type { SessionState } from './logger/session.js'; import { QueryGenerator } from './queries/generator.js'; import type { ScoringProvider, ScoringQuery } from './scorer/types.js'; import { ShopifyAdminClient } from './shopify/admin.js'; import type { ShopifyProduct } from './shopify/types.js'; import { FileCache } from './utils/cache.js'; export interface RunLoopDependencies { admin?: ShopifyAdminClient; providers?: ScoringProvider[]; generator?: HypothesisGenerator; applier?: HypothesisApplier; reverter?: HypothesisReverter; queryGenerator?: QueryGenerator; sessionLogger?: SessionLogger; jsonl?: JsonlLogger; cache?: FileCache; products?: ShopifyProduct[]; queries?: ScoringQuery[]; sleepMs?: (ms: number) => Promise; now?: () => number; propagationDelayMs?: number; iterationDelayMs?: number; queryCount?: number; storeCategory?: string; } /** * Top-level orchestrator. Bootstraps dependencies, measures the baseline, * then drives the propose → apply → measure → decide loop until a stop * condition fires (budget exhausted, plateau, no recent wins, or max iters). * * Per-iteration logic lives in {@link runIteration}; stop conditions live * in {@link shouldStop}. This function should read top-to-bottom as the * shape of the algorithm, not the implementation of any single step. */ export declare function runLoop(config: ShelfConfig, emitter: ShelfEventEmitter, deps?: RunLoopDependencies): Promise; /** * Pure decision: given a score-before, score-after, and the MAD-derived * confidence, classify the experiment as kept / kept_uncertain / reverted. * * - Score went up + high confidence → kept * - Score went up + lower confidence → kept_uncertain * - Score did not improve → reverted * * Reasoning is included so callers can log *why* an experiment landed * where it did without re-deriving the rule. */ export declare function decideVerdict(scoreBefore: number, scoreAfter: number, confidence: ConfidenceResult): { verdict: 'kept' | 'kept_uncertain' | 'reverted'; reasoning: string; }; export declare function loadFixtureProducts(): ShopifyProduct[]; //# sourceMappingURL=loop.d.ts.map