prompttest 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CONTRIBUTING.md +80 -0
  2. package/LICENSE +36 -0
  3. package/LICENSES.md +81 -0
  4. package/README.md +402 -0
  5. package/SECURITY.md +56 -0
  6. package/dist/bin/prompttest.d.ts +2 -0
  7. package/dist/bin/prompttest.js +1020 -0
  8. package/dist/constants/commands.d.ts +125 -0
  9. package/dist/index.d.ts +140 -0
  10. package/dist/index.js +862 -0
  11. package/dist/lib/adb.d.ts +394 -0
  12. package/dist/lib/ai/heuristic-resolver.d.ts +19 -0
  13. package/dist/lib/ai/index.d.ts +16 -0
  14. package/dist/lib/ai/llm-provider.d.ts +40 -0
  15. package/dist/lib/ai/types.d.ts +64 -0
  16. package/dist/lib/baseline.d.ts +111 -0
  17. package/dist/lib/benchmark.d.ts +100 -0
  18. package/dist/lib/checkpoint.d.ts +61 -0
  19. package/dist/lib/config-loader.d.ts +87 -0
  20. package/dist/lib/config.d.ts +136 -0
  21. package/dist/lib/crawler.d.ts +335 -0
  22. package/dist/lib/data-loader.d.ts +53 -0
  23. package/dist/lib/dfs-engine.d.ts +106 -0
  24. package/dist/lib/dictionary.d.ts +41 -0
  25. package/dist/lib/doctor.d.ts +45 -0
  26. package/dist/lib/driver-interface.d.ts +50 -0
  27. package/dist/lib/enterprise.d.ts +71 -0
  28. package/dist/lib/errors.d.ts +68 -0
  29. package/dist/lib/explorer.d.ts +121 -0
  30. package/dist/lib/form-filler.d.ts +101 -0
  31. package/dist/lib/ios-driver.d.ts +38 -0
  32. package/dist/lib/live-server.d.ts +47 -0
  33. package/dist/lib/lock.d.ts +30 -0
  34. package/dist/lib/logger.d.ts +68 -0
  35. package/dist/lib/memory.d.ts +259 -0
  36. package/dist/lib/patterns.d.ts +202 -0
  37. package/dist/lib/prompt-runner.d.ts +100 -0
  38. package/dist/lib/recorder.d.ts +115 -0
  39. package/dist/lib/repl.d.ts +29 -0
  40. package/dist/lib/reporter.d.ts +253 -0
  41. package/dist/lib/runner-utils.d.ts +290 -0
  42. package/dist/lib/step-handlers.d.ts +388 -0
  43. package/docs/ARCHITECTURE.md +154 -0
  44. package/docs/USER_MANUAL.md +765 -0
  45. package/package.json +90 -0
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @module enterprise
3
+ * @description
4
+ * Enterprise Quality Controls & Result Aggregation for PromptTest.
5
+ * Provides:
6
+ * 1. Release Confidence / Quality Scoring (inspired by Testsigma Atto).
7
+ * 2. Multi-Device Central Result Aggregator (merges per-device results into unified matrices).
8
+ * 3. Executive Summary HTML Dashboard generation.
9
+ */
10
+ import type { QaReportData } from './reporter.js';
11
+ export type ConfidenceGrade = 'A' | 'B' | 'C' | 'F';
12
+ export interface ReleaseConfidence {
13
+ score: number;
14
+ grade: ConfidenceGrade;
15
+ verdict: 'READY_FOR_RELEASE' | 'PROCEED_WITH_CAUTION' | 'RELEASE_BLOCKER';
16
+ rationale: string;
17
+ metrics: {
18
+ passRate: number;
19
+ criticalFailures: number;
20
+ visualDefects: number;
21
+ totalSteps: number;
22
+ skippedSteps: number;
23
+ };
24
+ }
25
+ export interface DeviceRunSummary {
26
+ deviceId: string;
27
+ suiteName: string;
28
+ packageName: string;
29
+ totalSteps: number;
30
+ passedSteps: number;
31
+ failedSteps: number;
32
+ skippedSteps: number;
33
+ durationSeconds: number;
34
+ confidenceScore: number;
35
+ confidenceGrade: ConfidenceGrade;
36
+ sourceFile: string;
37
+ }
38
+ export interface AggregatedReport {
39
+ timestamp: string;
40
+ totalRuns: number;
41
+ uniqueDevices: string[];
42
+ totalSteps: number;
43
+ passedSteps: number;
44
+ failedSteps: number;
45
+ skippedSteps: number;
46
+ overallPassRate: number;
47
+ overallConfidence: ReleaseConfidence;
48
+ deviceSummaries: DeviceRunSummary[];
49
+ }
50
+ /**
51
+ * Calculates the Atto-inspired Release Confidence score and letter grade for a test execution report.
52
+ *
53
+ * @param report - Complete QaReportData from a test run.
54
+ * @returns ReleaseConfidence assessment.
55
+ */
56
+ export declare function calculateReleaseConfidence(report: QaReportData): ReleaseConfidence;
57
+ /**
58
+ * Merges multiple per-device test execution reports into an aggregated enterprise summary.
59
+ * Scans directories recursively for `*-results.json` or accepts explicit JSON file paths.
60
+ *
61
+ * @param input - Directory path to scan or array of JSON file paths.
62
+ * @returns Combined AggregatedReport.
63
+ */
64
+ export declare function mergeReports(input?: string | string[]): AggregatedReport;
65
+ /**
66
+ * Generates an executive-ready, standalone HTML dashboard summarizing multi-device regression passes.
67
+ *
68
+ * @param aggregated - The AggregatedReport data.
69
+ * @returns Full HTML string.
70
+ */
71
+ export declare function generateAggregatedHtml(aggregated: AggregatedReport): string;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * @module errors
3
+ * @description Standardized error taxonomy and process exit codes for PromptTest.
4
+ * Distinguishes infrastructure/device failures from test assertion failures and config errors.
5
+ */
6
+ /**
7
+ * Standard process exit codes for CLI automation and CI/CD pipelines.
8
+ */
9
+ export declare enum ExitCode {
10
+ /** All steps passed successfully */
11
+ SUCCESS = 0,
12
+ /** One or more test steps failed assertion/matching */
13
+ TEST_FAILED = 1,
14
+ /** Device is offline, unauthorized, or disconnected */
15
+ DEVICE_UNAVAILABLE = 2,
16
+ /** Invalid configuration, missing files, or bad CLI flags */
17
+ CONFIG_ERROR = 3,
18
+ /** Device lock contention or hardware mutex error */
19
+ LOCKED = 4
20
+ }
21
+ /**
22
+ * Base error class for all PromptTest-specific exceptions.
23
+ */
24
+ export declare class PromptTestError extends Error {
25
+ readonly exitCode: ExitCode;
26
+ readonly phase?: string;
27
+ constructor(message: string, exitCode?: ExitCode, phase?: string);
28
+ }
29
+ /**
30
+ * Thrown when ADB or the target Android device cannot be reached or goes offline.
31
+ */
32
+ export declare class DeviceError extends PromptTestError {
33
+ constructor(message: string, phase?: string);
34
+ }
35
+ /**
36
+ * Thrown when a UI element locator cannot be resolved or matched within the timeout.
37
+ */
38
+ export declare class LocatorError extends PromptTestError {
39
+ readonly target?: string;
40
+ readonly candidateMatches?: {
41
+ text: string;
42
+ score: number;
43
+ }[];
44
+ constructor(message: string, target?: string, candidateMatches?: {
45
+ text: string;
46
+ score: number;
47
+ }[], phase?: string);
48
+ }
49
+ /**
50
+ * Thrown when a spec file is missing, syntax is corrupt, or invalid arguments are passed.
51
+ */
52
+ export declare class ConfigError extends PromptTestError {
53
+ constructor(message: string, phase?: string);
54
+ }
55
+ /**
56
+ * Thrown when the target device is already locked by another active process.
57
+ */
58
+ export declare class LockError extends PromptTestError {
59
+ readonly serial?: string;
60
+ constructor(message: string, serial?: string, phase?: string);
61
+ }
62
+ /**
63
+ * Thrown when circular references are detected in modular spec inclusion (INCLUDE/RUN_SPEC).
64
+ */
65
+ export declare class SpecRecursionError extends PromptTestError {
66
+ readonly cycle?: string[];
67
+ constructor(message: string, cycle?: string[], phase?: string);
68
+ }
@@ -0,0 +1,121 @@
1
+ import { AndroidDriver } from './adb.js';
2
+ import { type SafetyMode, type UiNode } from './crawler.js';
3
+ import { SemanticFormFiller } from './form-filler.js';
4
+ import { QaReporter } from './reporter.js';
5
+ import { MemoryEngine } from './memory.js';
6
+ /**
7
+ * Configuration options for the AutonomousExplorer.
8
+ */
9
+ export interface ExplorerOptions {
10
+ /** The target Android package name to explore (e.g., com.example.app) */
11
+ packageName: string;
12
+ /** Optional device serial number. If omitted, the default device is used. */
13
+ serial?: string;
14
+ /** Exploration strategy to use ('dfs' for universal hierarchical state-graph DFS, 'heuristic' for 5-step heuristic). Default is 'dfs'. */
15
+ strategy?: 'dfs' | 'heuristic';
16
+ /** Maximum number of bottom navigation tabs to traverse. Default is 15. */
17
+ maxTabs?: number;
18
+ /** Whether to explore master-detail list views. Default is true. */
19
+ exploreLists?: boolean;
20
+ /** Whether to fast-forward past previously crawled screens recorded in MemoryEngine (AX-07). Default is true. */
21
+ skipAlreadyCrawled?: boolean;
22
+ /** Safety mode enforcement policy (AX-10). Default is 'strict'. */
23
+ safetyMode?: SafetyMode;
24
+ /** Custom blacklist keywords to treat as destructive actions (AX-09). */
25
+ safetyBlacklist?: string[];
26
+ /** Maximum number of unique screen states to discover and index (AX-12). Default is 30. */
27
+ maxScreens?: number;
28
+ /** Maximum recursion depth for nested screen transitions (AX-12). Default is 5. */
29
+ maxDepth?: number;
30
+ /** Maximum number of interaction steps to execute in total (AX-12). Default is 100. */
31
+ stepBudget?: number;
32
+ /** Screenshot policy ('state-change', 'failure-only', 'all') (AX-16). Default is 'state-change'. */
33
+ screenshots?: 'state-change' | 'failure-only' | 'all';
34
+ }
35
+ /**
36
+ * AutonomousExplorer implements the heuristic mobile crawler.
37
+ * It coordinates ADB interactions, UI hierarchy analysis, and action execution
38
+ * to automatically test the application and discover crashes or errors.
39
+ */
40
+ export declare class AutonomousExplorer {
41
+ private driver;
42
+ private formFiller;
43
+ private reporter;
44
+ private memory;
45
+ private safetyHitList;
46
+ private externalSkippedList;
47
+ private devDefectsList;
48
+ private visitedScreenHashes;
49
+ private executedStepCount;
50
+ /**
51
+ * Creates an instance of AutonomousExplorer.
52
+ *
53
+ * @param driver - The AndroidDriver instance for ADB commands (dependency injection).
54
+ * @param formFiller - The SemanticFormFiller instance for handling input forms.
55
+ * @param reporter - The QaReporter instance for logging test steps and generating the report.
56
+ * @param memory - The MemoryEngine instance for offline crawl coverage and learning (AX-07).
57
+ */
58
+ constructor(driver?: AndroidDriver, formFiller?: SemanticFormFiller, reporter?: QaReporter, memory?: MemoryEngine);
59
+ /**
60
+ * Retrieves the underlying MemoryEngine instance.
61
+ */
62
+ getMemory(): MemoryEngine;
63
+ /**
64
+ * Retrieves the list of destructive action labels prevented by the safety guard.
65
+ */
66
+ getSafetyHitList(): readonly string[];
67
+ /**
68
+ * Retrieves the list of external intent links bypassed by the jail guard.
69
+ */
70
+ getExternalSkippedList(): readonly string[];
71
+ /**
72
+ * Retrieves the list of development errors/LogBoxes triaged.
73
+ */
74
+ getDevDefectsList(): readonly string[];
75
+ /**
76
+ * Retrieves the count of unique screen states visited during exploration.
77
+ */
78
+ getVisitedScreensCount(): number;
79
+ /**
80
+ * Detects whether the active foreground app has escaped into an external application (AX-12),
81
+ * and executes containment recovery to restore the target application into the foreground.
82
+ */
83
+ packageJailGuard(packageName: string, serial?: string): Promise<boolean>;
84
+ /**
85
+ * Captures UI hierarchy globally, intercepting and triaging any development error consoles,
86
+ * LogBox overlays, warnings, info toasts, or ANRs before returning a clean app hierarchy.
87
+ */
88
+ getCleanUiHierarchy(packageName: string, serial?: string, maxTriageAttempts?: number): Promise<{
89
+ xml: string;
90
+ flat: UiNode[];
91
+ }>;
92
+ /**
93
+ * Scans and triages development error consoles, LogBox overlays, or ANRs (AX-13).
94
+ */
95
+ handleDevOverlays(nodes: UiNode[], packageName: string, serial?: string): Promise<boolean>;
96
+ /**
97
+ * Automatically lowers the on-screen soft keyboard after typing (AX-14).
98
+ */
99
+ dismissSoftKeyboard(serial?: string): Promise<void>;
100
+ /**
101
+ * Executes the heuristic exploration pipeline on the target application.
102
+ *
103
+ * @param options - The ExplorerOptions configuring the exploration.
104
+ * @returns A promise that resolves when the exploration and report generation are complete.
105
+ */
106
+ explore(options: ExplorerOptions): Promise<void>;
107
+ /**
108
+ * Executes the error sentinel which combines parallel logcat crash checking
109
+ * and UI hierarchy parsing for maximum speed and robust error detection.
110
+ *
111
+ * @param packageName - The target application package name.
112
+ * @param serial - The device serial number.
113
+ * @param context - A contextual string describing when the check occurred (e.g., 'Post-Launch').
114
+ * @returns An object indicating whether errors were detected and the list of error messages.
115
+ */
116
+ private runErrorSentinel;
117
+ }
118
+ /**
119
+ * Singleton instance of the AutonomousExplorer, ready for use.
120
+ */
121
+ export declare const autonomousExplorer: AutonomousExplorer;
@@ -0,0 +1,101 @@
1
+ import { AndroidDriver } from './adb.js';
2
+ import { UiNode } from './crawler.js';
3
+ export interface TestDataPool {
4
+ auth?: {
5
+ phone?: string;
6
+ password?: string;
7
+ email?: string;
8
+ otp?: string;
9
+ };
10
+ profile?: {
11
+ name?: string;
12
+ firstName?: string;
13
+ lastName?: string;
14
+ phone?: string;
15
+ email?: string;
16
+ address?: string;
17
+ city?: string;
18
+ pincode?: string;
19
+ };
20
+ review?: {
21
+ text?: string;
22
+ rating?: number;
23
+ title?: string;
24
+ };
25
+ search?: {
26
+ query?: string;
27
+ };
28
+ payment?: {
29
+ upiId?: string;
30
+ card?: string;
31
+ };
32
+ [key: string]: Record<string, unknown> | string | number | boolean | undefined;
33
+ }
34
+ export interface FormFillResult {
35
+ filledFields: {
36
+ fieldId: string;
37
+ fieldLabel: string;
38
+ valueEntered: string;
39
+ }[];
40
+ submitted: boolean;
41
+ submitButtonText?: string;
42
+ }
43
+ /**
44
+ * Engine for semantically identifying and filling Android UI forms.
45
+ * It uses heuristics and keyword matching to map input fields to appropriate test data.
46
+ */
47
+ export declare class SemanticFormFiller {
48
+ private testData;
49
+ private dataPath;
50
+ private isLoaded;
51
+ private driver;
52
+ /**
53
+ * Initializes the semantic form filler.
54
+ * @param customDataPath Optional absolute path to a custom test data JSON file. Defaults to test-data.json in cwd.
55
+ * @param driver Optional AndroidDriver instance for dependency injection. Defaults to the global androidDriver.
56
+ */
57
+ constructor(customDataPath?: string, driver?: AndroidDriver);
58
+ /**
59
+ * Directly sets the test data pool, bypassing file loading.
60
+ * @param data The TestDataPool object to use for form filling.
61
+ */
62
+ setTestData(data: TestDataPool): void;
63
+ /**
64
+ * Ensures that test data has been loaded from disk into memory.
65
+ * Does nothing if data is already loaded.
66
+ * @returns A promise that resolves when data is loaded (or immediately if already loaded).
67
+ */
68
+ ensureDataLoaded(): Promise<void>;
69
+ /**
70
+ * Force reloads test data from the specified path or the default path.
71
+ * @param customDataPath Optional new path to load test data from.
72
+ * @returns A promise that resolves with the loaded TestDataPool.
73
+ */
74
+ loadTestData(customDataPath?: string): Promise<TestDataPool>;
75
+ /**
76
+ * Semantically infers what value from test-data.json matches this input field.
77
+ * Uses field text, content description, resource ID, and nearby labels to deduce the field type.
78
+ *
79
+ * @param node The UI node representing the input field.
80
+ * @param allNodes The list of all UI nodes on the current screen to provide context.
81
+ * @returns The inferred string value to enter into the field.
82
+ * @throws Error if a required field type is detected but the corresponding data is missing in TestDataPool.
83
+ */
84
+ inferValueForNode(node: UiNode, allNodes: UiNode[]): string;
85
+ /**
86
+ * Detects form fields, enters values, and submits the form.
87
+ * Automatically clears existing content, types values, dismisses the keyboard,
88
+ * and attempts to find and tap a submit button.
89
+ *
90
+ * @param allNodes The list of all UI nodes on the current screen.
91
+ * @param serial Optional device serial number to target a specific connected device.
92
+ * @param autoSubmit Whether to attempt automatically finding and clicking a submit button. Defaults to true.
93
+ * @param overwriteExisting Whether to overwrite fields that already contain non-placeholder text. Defaults to false.
94
+ * @returns A promise that resolves to the FormFillResult containing details of the operation.
95
+ */
96
+ fillAndSubmitForm(allNodes: UiNode[], serial?: string, autoSubmit?: boolean, overwriteExisting?: boolean): Promise<FormFillResult>;
97
+ }
98
+ /**
99
+ * Singleton instance of the SemanticFormFiller ready for use.
100
+ */
101
+ export declare const semanticFormFiller: SemanticFormFiller;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @module ios-driver
3
+ * @description
4
+ * Cross-platform iOS Device Driver for PromptTest.
5
+ * Connects to iOS Simulators and physical devices via Apple's `xcrun simctl`,
6
+ * Facebook's `idb` (iOS Development Bridge), or WebDriverAgent HTTP endpoints.
7
+ * Implements the universal DeviceDriver interface.
8
+ */
9
+ import { DeviceDriver, MobileDeviceInfo, ScreenDimensions } from './driver-interface.js';
10
+ export interface IosDriverOptions {
11
+ udid?: string;
12
+ wdaBaseUrl?: string;
13
+ useMock?: boolean;
14
+ }
15
+ /**
16
+ * Controller for iOS Simulators and Devices.
17
+ */
18
+ export declare class IosDriver implements DeviceDriver {
19
+ private defaultUdid?;
20
+ private wdaBaseUrl?;
21
+ private isMock;
22
+ private defaultDimensions;
23
+ constructor(options?: IosDriverOptions | string);
24
+ getDefaultDevice(): string | undefined;
25
+ ensureDefaultDevice(serial?: string): Promise<string>;
26
+ getConnectedDevices(): Promise<MobileDeviceInfo[]>;
27
+ getScreenDimensions(_serial?: string): Promise<ScreenDimensions>;
28
+ captureScreenshot(serial?: string): Promise<Buffer>;
29
+ getUiHierarchy(_serial?: string): Promise<string>;
30
+ tap(x: number, y: number, serial?: string): Promise<void>;
31
+ inputText(text: string, serial?: string): Promise<void>;
32
+ pressKey(key: string, serial?: string): Promise<void>;
33
+ swipe(x1: number, y1: number, x2: number, y2: number, durationMs?: number, serial?: string): Promise<void>;
34
+ launchApp(bundleId: string, serial?: string): Promise<void>;
35
+ forceStop(bundleId: string, serial?: string): Promise<void>;
36
+ isAppInstalled(bundleId: string, serial?: string): Promise<boolean>;
37
+ getForegroundPackage(_serial?: string): Promise<string | null>;
38
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @module live-server
3
+ * @description
4
+ * Lightweight, zero-dependency HTTP and Server-Sent Events (SSE) server for PromptTest.
5
+ * Powers the real-time test execution monitor, allowing developers and CI observers
6
+ * to watch live test execution events, inspect step screenshots, and view final
7
+ * HTML audit reports in real time without refreshing the browser.
8
+ */
9
+ import http from 'http';
10
+ import { AuditStep, QaReportData } from './reporter.js';
11
+ export interface LiveServerOptions {
12
+ /** The port number to listen on. Defaults to 4040 (or 0 for random available port). */
13
+ port?: number;
14
+ /** Host interface to bind to. Defaults to '127.0.0.1'. */
15
+ host?: string;
16
+ /** Directory where screenshots, recordings, and report artifacts are located. */
17
+ outputDir?: string;
18
+ /** Name of the test suite being executed. */
19
+ suiteName?: string;
20
+ /** Initial report data if available. */
21
+ initialReport?: QaReportData;
22
+ }
23
+ export interface LiveServerHandle {
24
+ /** The underlying Node.js HTTP server instance. */
25
+ server: http.Server;
26
+ /** The bound port number. */
27
+ port: number;
28
+ /** The base URL of the live server (e.g., http://localhost:4040). */
29
+ url: string;
30
+ /** Broadcasts a step completion event to all connected SSE clients. */
31
+ broadcastStep: (step: AuditStep) => void;
32
+ /** Broadcasts the final test report and updates the root HTML document. */
33
+ broadcastComplete: (report: QaReportData) => void;
34
+ /** Broadcasts an error event to connected clients. */
35
+ broadcastError: (errorMsg: string) => void;
36
+ /** Updates the cached report served at the root URL. */
37
+ updateReport: (report: QaReportData) => void;
38
+ /** Gracefully terminates the server and closes all active client connections. */
39
+ close: () => Promise<void>;
40
+ }
41
+ /**
42
+ * Starts a live HTTP and SSE monitoring server.
43
+ *
44
+ * @param options - Server configuration options.
45
+ * @returns A Promise resolving to a LiveServerHandle.
46
+ */
47
+ export declare function startLiveServer(options?: LiveServerOptions): Promise<LiveServerHandle>;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Represents the state of a device lock.
3
+ */
4
+ export interface DeviceLock {
5
+ /** The Android device serial number */
6
+ serial: string;
7
+ /** The absolute path to the lock file on the filesystem */
8
+ lockFilePath: string;
9
+ /** Whether the lock was successfully acquired */
10
+ acquired: boolean;
11
+ /** The process ID that holds the lock */
12
+ pid: number;
13
+ }
14
+ /**
15
+ * Acquires an exclusive file-based mutex lock for a specific Android device serial.
16
+ * Prevents multiple PromptTest processes from sending conflicting ADB commands to the same device.
17
+ * Automatically reclaims stale locks if the previous process crashed or terminated.
18
+ *
19
+ * @param serial The Android device serial number to lock.
20
+ * @returns A DeviceLock object representing the acquired lock.
21
+ * @throws {Error} If the device is currently locked by another active process.
22
+ * @throws {Error} If a concurrent process acquires the lock during the check-and-set window.
23
+ */
24
+ export declare function acquireDeviceLock(serial: string): DeviceLock;
25
+ /**
26
+ * Releases a previously acquired device lock.
27
+ *
28
+ * @param lock The DeviceLock object returned by acquireDeviceLock, or null/undefined.
29
+ */
30
+ export declare function releaseDeviceLock(lock: DeviceLock | null | undefined): void;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Defines the available log severity levels.
3
+ * Priority increases from DEBUG to SILENT.
4
+ */
5
+ export type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'SILENT';
6
+ /**
7
+ * A utility class for handling formatted, level-filtered console output.
8
+ */
9
+ export declare class Logger {
10
+ private currentLevel;
11
+ /**
12
+ * Initializes a new Logger instance.
13
+ * If an initialLevel is not provided, it falls back to the LOG_LEVEL environment variable,
14
+ * or defaults to 'INFO'.
15
+ *
16
+ * @param initialLevel An optional initial log level to override the default.
17
+ */
18
+ constructor(initialLevel?: LogLevel);
19
+ /**
20
+ * Updates the current log level threshold.
21
+ *
22
+ * @param level The new log level to apply.
23
+ */
24
+ setLevel(level: LogLevel): void;
25
+ /**
26
+ * Gets the current log level threshold.
27
+ *
28
+ * @returns The currently active LogLevel.
29
+ */
30
+ getLevel(): LogLevel;
31
+ /**
32
+ * Determines if a specific log level is currently enabled based on the threshold.
33
+ *
34
+ * @param level The log level to check.
35
+ * @returns true if messages of this level should be output, false otherwise.
36
+ */
37
+ isLevelEnabled(level: LogLevel): boolean;
38
+ private isJsonMode;
39
+ private emitJson;
40
+ /**
41
+ * Logs a debug message to stdout. Formatted in gray or structured JSON.
42
+ *
43
+ * @param args The message or variables to log.
44
+ */
45
+ debug(...args: unknown[]): void;
46
+ /**
47
+ * Logs an informational message to stdout. No special formatting applied or structured JSON.
48
+ *
49
+ * @param args The message or variables to log.
50
+ */
51
+ info(...args: unknown[]): void;
52
+ /**
53
+ * Logs a warning message to stderr. Formatted in yellow or structured JSON.
54
+ *
55
+ * @param args The message or variables to log.
56
+ */
57
+ warn(...args: unknown[]): void;
58
+ /**
59
+ * Logs an error message to stderr. Formatted in red or structured JSON.
60
+ *
61
+ * @param args The message or variables to log.
62
+ */
63
+ error(...args: unknown[]): void;
64
+ }
65
+ /**
66
+ * A globally accessible singleton instance of Logger for use throughout the PromptTest codebase.
67
+ */
68
+ export declare const logger: Logger;