/** * Runtime Verification Types * * Types for app launching, golden path testing, and runtime verification. * * @module scanners/runtime/types */ import { z } from "zod"; /** * Supported frameworks for automatic detection and launching */ export type Framework = "nextjs" | "vite" | "create-react-app" | "express" | "fastapi" | "flask" | "django" | "rails" | "unknown"; /** * Framework detection result */ export interface FrameworkDetection { framework: Framework; version?: string; confidence: number; devCommand: string; buildCommand?: string; port: number; healthEndpoint: string; indicators: string[]; } /** * App launch configuration */ export interface AppLaunchConfig { projectPath: string; framework?: Framework; port?: number; command?: string; env?: Record; timeout?: number; healthEndpoint?: string; } /** * App launch result */ export interface AppLaunchResult { success: boolean; framework: Framework; port: number; pid?: number; url: string; healthStatus: "healthy" | "unhealthy" | "timeout"; startupTime: number; error?: string; } /** * Golden path action types */ export type GoldenPathAction = "navigate" | "click" | "fill" | "select" | "assert" | "wait" | "screenshot" | "api"; /** * Golden path step definition */ export interface GoldenPathStep { action: GoldenPathAction; url?: string; selector?: string; value?: string; timeout?: number; screenshot?: boolean; description?: string; } /** * Golden path flow definition (YAML schema) */ export declare const GoldenPathFlowSchema: z.ZodObject<{ name: z.ZodString; description: z.ZodOptional; priority: z.ZodDefault>; tags: z.ZodOptional>; baseUrl: z.ZodOptional; steps: z.ZodArray; url: z.ZodOptional; selector: z.ZodOptional; value: z.ZodOptional; method: z.ZodOptional>; body: z.ZodOptional>; headers: z.ZodOptional>; timeout: z.ZodOptional; screenshot: z.ZodOptional; description: z.ZodOptional; /** Use this named identity's headers/token for the request. */ identity: z.ZodOptional; /** Capture a value from the response into a variable for later `{{var}}` use. */ captureAs: z.ZodOptional; /** JSON path into the response body for `captureAs` (e.g. "data.0.id"). Default: whole body. */ capturePath: z.ZodOptional; /** Assert the response status equals this. */ expectStatus: z.ZodOptional; /** Assert the response status is one of these (e.g. [401,403,404]). */ expectStatusIn: z.ZodOptional>; /** Assert the response body contains this string. */ expectBodyContains: z.ZodOptional; /** Assert the response body does NOT contain this string (cross-tenant leak check). */ expectBodyNotContains: z.ZodOptional; /** Repeat this step N times (e.g. 5x wrong password). */ loop: z.ZodOptional; }, "strip", z.ZodTypeAny, { action: "fill" | "api" | "select" | "navigate" | "click" | "assert" | "wait" | "screenshot"; method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | undefined; value?: string | undefined; timeout?: number | undefined; url?: string | undefined; description?: string | undefined; headers?: Record | undefined; body?: Record | undefined; identity?: string | undefined; screenshot?: boolean | undefined; selector?: string | undefined; captureAs?: string | undefined; capturePath?: string | undefined; expectStatus?: number | undefined; expectStatusIn?: number[] | undefined; expectBodyContains?: string | undefined; expectBodyNotContains?: string | undefined; loop?: number | undefined; }, { action: "fill" | "api" | "select" | "navigate" | "click" | "assert" | "wait" | "screenshot"; method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | undefined; value?: string | undefined; timeout?: number | undefined; url?: string | undefined; description?: string | undefined; headers?: Record | undefined; body?: Record | undefined; identity?: string | undefined; screenshot?: boolean | undefined; selector?: string | undefined; captureAs?: string | undefined; capturePath?: string | undefined; expectStatus?: number | undefined; expectStatusIn?: number[] | undefined; expectBodyContains?: string | undefined; expectBodyNotContains?: string | undefined; loop?: number | undefined; }>, "many">; /** * Named identities for multi-account flows (e.g. cross-tenant isolation). * Each supplies headers/token injected when a step sets `identity`. */ identities: z.ZodOptional; headers: z.ZodOptional>; }, "strip", z.ZodTypeAny, { headers?: Record | undefined; token?: string | undefined; }, { headers?: Record | undefined; token?: string | undefined; }>>>; }, "strip", z.ZodTypeAny, { name: string; steps: { action: "fill" | "api" | "select" | "navigate" | "click" | "assert" | "wait" | "screenshot"; method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | undefined; value?: string | undefined; timeout?: number | undefined; url?: string | undefined; description?: string | undefined; headers?: Record | undefined; body?: Record | undefined; identity?: string | undefined; screenshot?: boolean | undefined; selector?: string | undefined; captureAs?: string | undefined; capturePath?: string | undefined; expectStatus?: number | undefined; expectStatusIn?: number[] | undefined; expectBodyContains?: string | undefined; expectBodyNotContains?: string | undefined; loop?: number | undefined; }[]; priority: "critical" | "high" | "medium" | "low"; tags?: string[] | undefined; description?: string | undefined; baseUrl?: string | undefined; identities?: Record | undefined; token?: string | undefined; }> | undefined; }, { name: string; steps: { action: "fill" | "api" | "select" | "navigate" | "click" | "assert" | "wait" | "screenshot"; method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | undefined; value?: string | undefined; timeout?: number | undefined; url?: string | undefined; description?: string | undefined; headers?: Record | undefined; body?: Record | undefined; identity?: string | undefined; screenshot?: boolean | undefined; selector?: string | undefined; captureAs?: string | undefined; capturePath?: string | undefined; expectStatus?: number | undefined; expectStatusIn?: number[] | undefined; expectBodyContains?: string | undefined; expectBodyNotContains?: string | undefined; loop?: number | undefined; }[]; tags?: string[] | undefined; description?: string | undefined; priority?: "critical" | "high" | "medium" | "low" | undefined; baseUrl?: string | undefined; identities?: Record | undefined; token?: string | undefined; }> | undefined; }>; export type GoldenPathFlow = z.infer; /** * Step execution result */ export interface StepResult { step: number; action: GoldenPathAction; success: boolean; duration: number; error?: string; screenshot?: string; assertion?: { expected: string; actual: string; passed: boolean; }; } /** * Golden path execution result */ export interface GoldenPathResult { flowName: string; success: boolean; totalSteps: number; passedSteps: number; failedSteps: number; duration: number; steps: StepResult[]; screenshots: string[]; error?: string; /** Flow priority (used to grade emitted findings). */ priority?: "critical" | "high" | "medium" | "low"; /** Flow tags (e.g. "cross-tenant", "auth-failure") used to categorize findings. */ tags?: string[]; } /** * Visual regression result */ export interface VisualRegressionResult { baseline: string; current: string; diff?: string; pixelDifference: number; percentDifference: number; passed: boolean; threshold: number; } /** * Runtime verification score components */ export interface RuntimeScore { goldenPathsPassed: number; goldenPathsTotal: number; visualRegressionsPassed: number; visualRegressionsTotal: number; apiTestsPassed: number; apiTestsTotal: number; overallScore: number; } /** * Full runtime verification result */ export interface RuntimeVerificationResult { success: boolean; framework: Framework; appUrl: string; duration: number; goldenPaths: GoldenPathResult[]; visualRegressions: VisualRegressionResult[]; score: RuntimeScore; error?: string; /** * Findings emitted from failed critical flows (cross-tenant isolation, auth * failure-paths) so they can feed certification consensus gating. */ findings?: RuntimeFinding[]; } /** A finding emitted by a failed runtime proof flow. */ export interface RuntimeFinding { id: string; severity: "critical" | "high" | "medium" | "low"; category: string; description: string; evidence: string; flowName: string; } //# sourceMappingURL=types.d.ts.map