import type { TSchema } from "@sinclair/typebox"; import type { SharedArtifactContract } from "./artifacts.js"; import type { ScannerInputDescriptor } from "./input-descriptors.js"; import type { ScannerId } from "./types.js"; /** Controls how much signal history is retained on disk. */ export declare enum RetentionPolicy { /** Keep only the latest run and remove history. */ LAST_ONLY = "last_only", /** Keep latest plus a bounded tail of previous runs. */ ROLLING_WINDOW = "rolling_window" } /** Controls when a run result should be persisted. */ export declare enum PersistencePolicy { /** Persist every run result. */ ALWAYS = "always", /** Persist only when at least one signal is actionable. */ ACTIONABLE_ONLY = "actionable_only", /** Never persist; return result in-memory only. */ NEVER = "never" } export type ScannerScheduleMode = "interval" | "external"; export type ExternalFieldType = "string" | "number" | "boolean" | "object" | "array"; export interface ExternalFieldDefinition { type: ExternalFieldType; required?: boolean; } export interface ExternalScannerConfig { fields: Record; } export interface ScannerOutputs { /** Whether the scanner emits action-oriented signals. */ signals: boolean; /** Whether the scanner publishes one retained context output for others to consume. */ context: boolean; } export type ScannerDependencyPolicyMode = "fail" | "skip" | "degrade"; export interface ScannerContextDependency { /** Source scanner id whose retained context output feeds this scanner. */ scanner: ScannerId; /** Whether the dependency is required for a successful run. */ required?: boolean; /** Maximum acceptable age of the source context in milliseconds. */ maxAgeMs?: number; /** Behavior when the source context is missing. */ onMissing?: ScannerDependencyPolicyMode; /** Behavior when the source context is stale. */ onStale?: ScannerDependencyPolicyMode; } /** * Immutable scanner definition shared across all strategy runtimes. * Runtime state/config for a scanner instance is kept separately in RuntimeStore. */ export interface ScannerDefinition { /** Scanner identifier; unique per strategy runtime instance. */ id: ScannerId; /** Domain-level signal type emitted by this scanner. */ signalType: string; /** Declares whether this scanner emits signals, retained context, or both. */ outputs: ScannerOutputs; /** Human-readable purpose/behavior summary. */ description: string; /** Interval-driven scanners schedule on a timer; external scanners are push-driven. */ scheduleMode?: ScannerScheduleMode; /** Default schedule interval in seconds. External scanners use `0`. */ intervalSeconds: number; /** Signal retention behavior for persisted runs. */ retention: RetentionPolicy; /** Maximum number of history rows when using ROLLING_WINDOW. */ retentionMaxRuns?: number; /** Persistence decision policy used by engine when hooks do not override. */ persistence: PersistencePolicy; /** Declarative provider-backed and artifact-backed input requirements for each scan run. */ inputs: ScannerInputDescriptor[]; /** YAML-level scanner dependency wiring resolved at runtime registration time. */ dependsOn?: ScannerContextDependency[]; /** * Optional metadata describing which shared artifacts the scanner produces. * These artifacts are shared market intelligence between scanners, not trading signals. */ artifacts?: { produces?: SharedArtifactContract[]; }; /** Config validation schema enforced by engine before initialization/runs. */ configSchema: TSchema; /** Default config used when runtime config does not exist yet. */ defaultConfig: Cfg; /** Optional state validation schema enforced by the engine before initialize()/scan(). */ stateSchema?: TSchema; /** Default state used when runtime state is missing or must be repaired. */ defaultState?: St; } //# sourceMappingURL=scanner-definition.d.ts.map