import type { VeryfrontConfig } from "../config/index.js"; import type { RuntimeAdapter } from "../platform/index.js"; /** Source definition families handled by shared trigger discovery. */ export type SourceTriggerKind = "schedule" | "webhook"; /** Stable failure categories emitted while discovering source triggers. */ export type SourceTriggerDiscoveryErrorCode = "parse_error" | "invalid_definition" | "dynamic_definition" | "duplicate_source_id" | "unsupported_target" | "manual_conflict"; /** Structured failure produced while discovering one source definition. */ export interface SourceTriggerDiscoveryError { /** Stable discriminator for structured source discovery failures. */ kind: "source_trigger_discovery_error"; /** Definition kind being discovered. */ sourceKind: SourceTriggerKind; /** Source path that produced the failure. */ sourcePath: string; /** Definition id when it could be safely determined. */ sourceId?: string; /** Machine-readable discovery failure category. */ code: SourceTriggerDiscoveryErrorCode; /** Human-readable, safe error description. */ message: string; /** Structured diagnostic context such as every ambiguous source path. */ details?: Record; } /** Deterministic source trigger discovery result. */ export interface SourceTriggerDiscoveryResult { /** Unique, normalized definitions in deterministic id order. */ items: T[]; /** Deterministically ordered source failures. */ errors: SourceTriggerDiscoveryError[]; } interface TriggerDiscoveryBaseOptions { /** Project root used to resolve local source paths and module imports. */ projectDir: string; /** Runtime-specific filesystem and module execution adapter. */ adapter: RuntimeAdapter; /** Optional project configuration, including virtual filesystem mode. */ config?: VeryfrontConfig; /** Source definition kind used in diagnostics. */ sourceKind: SourceTriggerKind; /** Explicit host-owned capability for a trusted local or dedicated runtime. */ allowHostProjectCodeExecution?: boolean; } /** Shared filesystem, directory, and source-kind options for trigger discovery. */ export type TriggerDiscoveryOptions = TriggerDiscoveryBaseOptions & ({ /** One source directory relative to the project or virtual filesystem root. */ triggerDir: string; triggerDirs?: never; } | { triggerDir?: never; /** Multiple source directories searched as one deterministic namespace. */ triggerDirs: readonly string[]; }); /** Minimum contract required for source trigger de-duplication. */ export interface TriggerDefinitionWithId { /** Canonical source trigger identifier. */ id: string; } /** Validation and normalization contract for source trigger discovery. */ export type SourceTriggerDiscoveryOptions = TriggerDiscoveryOptions & { /** Reject module exports that are not definitions of the expected kind. */ validate: (value: unknown) => value is T; /** Copy and normalize a validated definition before returning it. */ normalize?: (value: T) => T; }; /** * Discover, validate, normalize, and deterministically de-duplicate source * trigger definitions. */ export declare function discoverSourceTriggers(options: SourceTriggerDiscoveryOptions): Promise>; export {}; //# sourceMappingURL=discovery.d.ts.map