slnodejs 6.1.1150 → 6.1.1152

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/messages/common/build-scanner.json +54 -0
  2. package/messages/common/cd-agent.json +10 -0
  3. package/messages/common/error-network.json +52 -0
  4. package/messages/common/general.json +17 -0
  5. package/messages/common/package.json +6 -0
  6. package/messages/common/test-listener.json +84 -0
  7. package/messages/node/package.json +6 -0
  8. package/package.json +9 -3
  9. package/tsOutputs/build-scanner/build-diff-process.js +33 -3
  10. package/tsOutputs/build-scanner/build-diff-process.js.map +1 -1
  11. package/tsOutputs/build-scanner/instrumentation/browser-instrumenter.js +28 -1
  12. package/tsOutputs/build-scanner/instrumentation/browser-instrumenter.js.map +1 -1
  13. package/tsOutputs/cli-parse/constants/constants.js +4 -2
  14. package/tsOutputs/cli-parse/constants/constants.js.map +1 -1
  15. package/tsOutputs/cli-parse/executors/base-executor.js +30 -13
  16. package/tsOutputs/cli-parse/executors/base-executor.js.map +1 -1
  17. package/tsOutputs/cli-parse/executors/build-executor.js +22 -1
  18. package/tsOutputs/cli-parse/executors/build-executor.js.map +1 -1
  19. package/tsOutputs/cli-parse/executors/config-executor.js +17 -0
  20. package/tsOutputs/cli-parse/executors/config-executor.js.map +1 -1
  21. package/tsOutputs/cli-parse/executors/dry-run/dry-run-executor.js +0 -2
  22. package/tsOutputs/cli-parse/executors/dry-run/dry-run-executor.js.map +1 -1
  23. package/tsOutputs/cli-parse/executors/instrument-executor.js +0 -1
  24. package/tsOutputs/cli-parse/executors/instrument-executor.js.map +1 -1
  25. package/tsOutputs/cli-parse/executors/test-listener-executor.js +58 -0
  26. package/tsOutputs/cli-parse/executors/test-listener-executor.js.map +1 -1
  27. package/tsOutputs/common/console-message-service.d.ts +229 -0
  28. package/tsOutputs/common/console-message-service.js +408 -0
  29. package/tsOutputs/common/console-message-service.js.map +1 -0
  30. package/tsOutputs/common/footprints-process-v6/index.d.ts +2 -0
  31. package/tsOutputs/common/footprints-process-v6/index.js +20 -0
  32. package/tsOutputs/common/footprints-process-v6/index.js.map +1 -1
  33. package/tsOutputs/common/scm/scm-factory.js +1 -1
  34. package/tsOutputs/common/scm/scm-factory.js.map +1 -1
  35. package/tsOutputs/common/utils/simple-mustache.d.ts +29 -0
  36. package/tsOutputs/common/utils/simple-mustache.js +60 -0
  37. package/tsOutputs/common/utils/simple-mustache.js.map +1 -0
  38. package/tsOutputs/messages/message-keys.generated.d.ts +276 -0
  39. package/tsOutputs/messages/message-keys.generated.js +97 -0
  40. package/tsOutputs/messages/message-keys.generated.js.map +1 -0
  41. package/tsOutputs/mocha-reporter/index.js +48 -5
  42. package/tsOutputs/mocha-reporter/index.js.map +1 -1
  43. package/tsOutputs/test-listener/test-recommendation-handler.d.ts +1 -0
  44. package/tsOutputs/test-listener/test-recommendation-handler.js +17 -0
  45. package/tsOutputs/test-listener/test-recommendation-handler.js.map +1 -1
@@ -0,0 +1,229 @@
1
+ /**
2
+ * Console Message Service
3
+ *
4
+ * Singleton service for displaying user-facing console messages to stdout.
5
+ * Messages are loaded from JSON files and rendered using Mustache templates.
6
+ *
7
+ * Features:
8
+ * - Singleton pattern for global access
9
+ * - Configurable prefix (default: [SeaLights])
10
+ * - Quiet mode support (--quiet flag or SL_QUIET env var)
11
+ * - Lazy loading of message files
12
+ * - No third-party dependencies
13
+ *
14
+ * @example
15
+ * // Initialize once at startup
16
+ * ConsoleMessageService.initialize({
17
+ * prefix: '[SeaLights]',
18
+ * quiet: false,
19
+ * messagesPath: './messages'
20
+ * });
21
+ *
22
+ * // Use anywhere in the application
23
+ * const cms = ConsoleMessageService.getInstance();
24
+ * cms.print('config-new-build', {
25
+ * appName: 'MyApp',
26
+ * branchName: 'main',
27
+ * buildName: '1.0.0'
28
+ * });
29
+ */
30
+ import { TemplateData } from './utils/simple-mustache';
31
+ import { MessageKey, MessageParamsMap } from '../messages/message-keys.generated';
32
+ import { Logger } from './contracts';
33
+ /**
34
+ * Conditional args type for print methods.
35
+ * Returns empty tuple if message has no params, otherwise requires the params object.
36
+ */
37
+ type PrintArgs<K extends MessageKey> = MessageParamsMap[K] extends Record<string, never> ? [] : [data: MessageParamsMap[K]];
38
+ /**
39
+ * Configuration options for Console Message Service
40
+ */
41
+ export interface IConsoleMessageConfig {
42
+ /** Prefix to prepend to all messages (default: '[SeaLights]') */
43
+ prefix?: string;
44
+ /** Whether to suppress all console output (default: false) */
45
+ quiet?: boolean;
46
+ /** Path to messages directory (default: computed from __dirname) */
47
+ messagesPath?: string;
48
+ /** Throttle window in milliseconds to prevent duplicate messages (default: 1000) */
49
+ throttleMs?: number;
50
+ /** Optional logger for INFO-level logging of messages (for file/remote logging) */
51
+ logger?: Logger;
52
+ }
53
+ /**
54
+ * Internal configuration with required fields (except logger which remains optional)
55
+ */
56
+ type InternalConfig = Required<Omit<IConsoleMessageConfig, 'logger'>> & {
57
+ logger?: Logger;
58
+ };
59
+ /**
60
+ * Console Message Service - Singleton
61
+ */
62
+ export declare class ConsoleMessageService {
63
+ private static instance;
64
+ private config;
65
+ private messages;
66
+ private loadedFiles;
67
+ private messageTimestamps;
68
+ private stateTrackers;
69
+ /** Maximum number of throttle entries before cleanup (prevents memory leak) */
70
+ private static readonly MAX_THROTTLE_ENTRIES;
71
+ /**
72
+ * Private constructor (singleton pattern)
73
+ */
74
+ private constructor();
75
+ /**
76
+ * Initialize the console message service (call once at startup)
77
+ * If already initialized, this is a no-op. Use reset() in tests to re-initialize.
78
+ *
79
+ * @param config - Configuration options
80
+ */
81
+ static initialize(config?: IConsoleMessageConfig): void;
82
+ /**
83
+ * Get the singleton instance
84
+ *
85
+ * @returns Console message service instance
86
+ */
87
+ static getInstance(): ConsoleMessageService;
88
+ /**
89
+ * Reset the service (for testing)
90
+ */
91
+ static reset(): void;
92
+ /**
93
+ * Print a message to stdout
94
+ *
95
+ * @param messageKey - Message key (type-safe enum value)
96
+ * @param data - Data to substitute in template (type-safe based on message key)
97
+ */
98
+ print<K extends MessageKey>(messageKey: K, ...args: PrintArgs<K>): void;
99
+ /**
100
+ * Print an arbitrary string to stdout
101
+ *
102
+ * @param message - Message string to print
103
+ */
104
+ printString(message: string): void;
105
+ /**
106
+ * Print a message only when the state changes.
107
+ * This is useful for messages that should only be shown once when a state
108
+ * transitions (e.g., from no active test stage to active test stage).
109
+ *
110
+ * @param stateKey - Unique key to track this state (e.g., 'test-stage-status')
111
+ * @param currentState - Current state value (e.g., 'active' or 'inactive')
112
+ * @param messageKey - Message key to print (type-safe enum value)
113
+ * @param data - Data to substitute in template (type-safe based on message key)
114
+ * @returns True if the message was printed (state changed), false otherwise
115
+ */
116
+ printOnStateChange<K extends MessageKey>(stateKey: string, currentState: string, messageKey: K, ...args: PrintArgs<K>): boolean;
117
+ /**
118
+ * Get configuration
119
+ */
120
+ getConfig(): Readonly<InternalConfig>;
121
+ /**
122
+ * Check if a message should be throttled
123
+ *
124
+ * @param messageKey - Message key
125
+ * @param data - Data to substitute
126
+ * @returns True if message should be throttled (skipped)
127
+ */
128
+ private isThrottled;
129
+ /**
130
+ * Record timestamp for a message
131
+ *
132
+ * @param messageKey - Message key
133
+ * @param data - Data to substitute
134
+ */
135
+ private recordMessageTimestamp;
136
+ /**
137
+ * Remove timestamps older than throttle window (cleanup for memory management)
138
+ */
139
+ private cleanupOldTimestamps;
140
+ /**
141
+ * Create a hash from message key and data
142
+ *
143
+ * @param messageKey - Message key
144
+ * @param data - Data to substitute
145
+ * @returns Hash string
146
+ */
147
+ private createMessageHash;
148
+ /**
149
+ * Render a message template with data (without printing)
150
+ *
151
+ * @param messageKey - Message key
152
+ * @param data - Data to substitute
153
+ * @returns Array of rendered lines
154
+ */
155
+ private renderMessage;
156
+ /**
157
+ * Render a message template with data as a single string (without printing)
158
+ * Convenience method that joins multiple lines with newlines.
159
+ *
160
+ * @param messageKey - Message key
161
+ * @param data - Data to substitute
162
+ * @returns Rendered message as a single string
163
+ */
164
+ renderMessageAsString(messageKey: MessageKey, data?: TemplateData): string;
165
+ /**
166
+ * Ensure messages are loaded (lazy loading)
167
+ */
168
+ private ensureMessagesLoaded;
169
+ /**
170
+ * Load all message files from the messages directory
171
+ */
172
+ private loadAllMessages;
173
+ /**
174
+ * Load messages from a specific directory
175
+ *
176
+ * @param dirPath - Directory path
177
+ */
178
+ private loadMessagesFromDirectory;
179
+ /**
180
+ * Load messages from a JSON file
181
+ *
182
+ * @param filePath - Path to JSON file
183
+ */
184
+ private loadMessageFile;
185
+ /**
186
+ * Output lines to stdout with prefix
187
+ *
188
+ * @param lines - Lines to output
189
+ */
190
+ private outputLines;
191
+ /**
192
+ * Log warning to stderr (respects quiet mode)
193
+ *
194
+ * @param message - Warning message
195
+ */
196
+ private logWarning;
197
+ /**
198
+ * Log error to stderr (respects quiet mode)
199
+ *
200
+ * @param message - Error message
201
+ */
202
+ private logError;
203
+ /**
204
+ * Check if NODE_DEBUG includes 'sl' or 'sl-console' (console logging enabled)
205
+ *
206
+ * @returns True if NODE_DEBUG includes 'sl' or 'sl-console'
207
+ */
208
+ private isNodeDebugConsoleEnabled;
209
+ /**
210
+ * Check if NODE_DEBUG includes 'sl-file' (file logging enabled)
211
+ *
212
+ * @returns True if NODE_DEBUG includes 'sl-file'
213
+ */
214
+ private isNodeDebugFileEnabled;
215
+ /**
216
+ * Log a message at INFO level if appropriate.
217
+ * Logs when:
218
+ * - quiet=true (console output is suppressed, need to log for visibility)
219
+ * - quiet=false AND NODE_DEBUG doesn't include 'sl' (no console duplication)
220
+ * - quiet=false AND NODE_DEBUG includes both 'sl' and 'sl-file' (user wants file logging)
221
+ *
222
+ * Skips logging when:
223
+ * - quiet=false AND NODE_DEBUG=sl only (would duplicate console output, no file logging requested)
224
+ *
225
+ * @param lines - Lines to log
226
+ */
227
+ private logInfoIfAppropriate;
228
+ }
229
+ export {};
@@ -0,0 +1,408 @@
1
+ "use strict";
2
+ /**
3
+ * Console Message Service
4
+ *
5
+ * Singleton service for displaying user-facing console messages to stdout.
6
+ * Messages are loaded from JSON files and rendered using Mustache templates.
7
+ *
8
+ * Features:
9
+ * - Singleton pattern for global access
10
+ * - Configurable prefix (default: [SeaLights])
11
+ * - Quiet mode support (--quiet flag or SL_QUIET env var)
12
+ * - Lazy loading of message files
13
+ * - No third-party dependencies
14
+ *
15
+ * @example
16
+ * // Initialize once at startup
17
+ * ConsoleMessageService.initialize({
18
+ * prefix: '[SeaLights]',
19
+ * quiet: false,
20
+ * messagesPath: './messages'
21
+ * });
22
+ *
23
+ * // Use anywhere in the application
24
+ * const cms = ConsoleMessageService.getInstance();
25
+ * cms.print('config-new-build', {
26
+ * appName: 'MyApp',
27
+ * branchName: 'main',
28
+ * buildName: '1.0.0'
29
+ * });
30
+ */
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.ConsoleMessageService = void 0;
33
+ const fs = require("fs");
34
+ const path = require("path");
35
+ const simple_mustache_1 = require("./utils/simple-mustache");
36
+ const system_date_1 = require("./system-date");
37
+ /**
38
+ * Console Message Service - Singleton
39
+ */
40
+ class ConsoleMessageService {
41
+ /**
42
+ * Private constructor (singleton pattern)
43
+ */
44
+ constructor(config) {
45
+ var _a, _b;
46
+ this.messages = new Map();
47
+ this.loadedFiles = new Set();
48
+ this.messageTimestamps = new Map();
49
+ this.stateTrackers = new Map();
50
+ // Set defaults
51
+ this.config = {
52
+ prefix: config.prefix || '[SeaLights]',
53
+ quiet: (_a = config.quiet) !== null && _a !== void 0 ? _a : false,
54
+ messagesPath: config.messagesPath || path.join(__dirname, '../..', 'messages'),
55
+ throttleMs: (_b = config.throttleMs) !== null && _b !== void 0 ? _b : 1000,
56
+ logger: config.logger,
57
+ };
58
+ }
59
+ /**
60
+ * Initialize the console message service (call once at startup)
61
+ * If already initialized, this is a no-op. Use reset() in tests to re-initialize.
62
+ *
63
+ * @param config - Configuration options
64
+ */
65
+ static initialize(config = {}) {
66
+ if (ConsoleMessageService.instance) {
67
+ return; // Already initialized, no-op
68
+ }
69
+ ConsoleMessageService.instance = new ConsoleMessageService(config);
70
+ }
71
+ /**
72
+ * Get the singleton instance
73
+ *
74
+ * @returns Console message service instance
75
+ */
76
+ static getInstance() {
77
+ if (!ConsoleMessageService.instance) {
78
+ // Auto-initialize with defaults if not explicitly initialized
79
+ // This provides a fallback for development
80
+ ConsoleMessageService.initialize({});
81
+ }
82
+ return ConsoleMessageService.instance;
83
+ }
84
+ /**
85
+ * Reset the service (for testing)
86
+ */
87
+ static reset() {
88
+ if (ConsoleMessageService.instance) {
89
+ ConsoleMessageService.instance.messageTimestamps.clear();
90
+ ConsoleMessageService.instance.stateTrackers.clear();
91
+ }
92
+ ConsoleMessageService.instance = null;
93
+ }
94
+ /**
95
+ * Print a message to stdout
96
+ *
97
+ * @param messageKey - Message key (type-safe enum value)
98
+ * @param data - Data to substitute in template (type-safe based on message key)
99
+ */
100
+ print(messageKey, ...args) {
101
+ var _a;
102
+ const data = (_a = args[0]) !== null && _a !== void 0 ? _a : {};
103
+ // Check throttling (applies to both console output and logging)
104
+ if (this.isThrottled(messageKey, data)) {
105
+ return; // Skip duplicate message within throttle window
106
+ }
107
+ try {
108
+ const lines = this.renderMessage(messageKey, data);
109
+ if (lines.length > 0) {
110
+ // Output to console if not in quiet mode
111
+ if (!this.config.quiet) {
112
+ this.outputLines(lines);
113
+ }
114
+ // Log at INFO level if appropriate (for file/remote logging)
115
+ this.logInfoIfAppropriate(lines);
116
+ // Record timestamp for throttling
117
+ this.recordMessageTimestamp(messageKey, data);
118
+ }
119
+ }
120
+ catch (error) {
121
+ // Log to stderr without crashing
122
+ this.logError(`Failed to print message '${messageKey}': ${error.message}`);
123
+ }
124
+ }
125
+ /**
126
+ * Print an arbitrary string to stdout
127
+ *
128
+ * @param message - Message string to print
129
+ */
130
+ printString(message) {
131
+ // Output to console if not in quiet mode
132
+ if (!this.config.quiet) {
133
+ console.log(`${this.config.prefix} ${message}`);
134
+ }
135
+ // Log at INFO level if appropriate (for file/remote logging)
136
+ this.logInfoIfAppropriate([message]);
137
+ }
138
+ /**
139
+ * Print a message only when the state changes.
140
+ * This is useful for messages that should only be shown once when a state
141
+ * transitions (e.g., from no active test stage to active test stage).
142
+ *
143
+ * @param stateKey - Unique key to track this state (e.g., 'test-stage-status')
144
+ * @param currentState - Current state value (e.g., 'active' or 'inactive')
145
+ * @param messageKey - Message key to print (type-safe enum value)
146
+ * @param data - Data to substitute in template (type-safe based on message key)
147
+ * @returns True if the message was printed (state changed), false otherwise
148
+ */
149
+ printOnStateChange(stateKey, currentState, messageKey, ...args) {
150
+ const previousState = this.stateTrackers.get(stateKey);
151
+ // Only print if state changed (or first time)
152
+ if (previousState !== currentState) {
153
+ this.stateTrackers.set(stateKey, currentState);
154
+ // Use type assertion with spread to preserve argument structure
155
+ // This is safe because args matches the expected signature from the generic constraint
156
+ this.print(messageKey, ...args);
157
+ return true;
158
+ }
159
+ return false;
160
+ }
161
+ /**
162
+ * Get configuration
163
+ */
164
+ getConfig() {
165
+ return Object.assign({}, this.config);
166
+ }
167
+ /**
168
+ * Check if a message should be throttled
169
+ *
170
+ * @param messageKey - Message key
171
+ * @param data - Data to substitute
172
+ * @returns True if message should be throttled (skipped)
173
+ */
174
+ isThrottled(messageKey, data) {
175
+ const hash = this.createMessageHash(messageKey, data);
176
+ const lastTimestamp = this.messageTimestamps.get(hash);
177
+ if (!lastTimestamp) {
178
+ return false; // Never printed before
179
+ }
180
+ const now = (0, system_date_1.getSystemDateValueOfLocal)();
181
+ const timeSinceLastPrint = now - lastTimestamp;
182
+ return timeSinceLastPrint < this.config.throttleMs;
183
+ }
184
+ /**
185
+ * Record timestamp for a message
186
+ *
187
+ * @param messageKey - Message key
188
+ * @param data - Data to substitute
189
+ */
190
+ recordMessageTimestamp(messageKey, data) {
191
+ // Cleanup old entries if map is getting too large (prevents memory leak)
192
+ if (this.messageTimestamps.size >= ConsoleMessageService.MAX_THROTTLE_ENTRIES) {
193
+ this.cleanupOldTimestamps();
194
+ }
195
+ const hash = this.createMessageHash(messageKey, data);
196
+ this.messageTimestamps.set(hash, (0, system_date_1.getSystemDateValueOfLocal)());
197
+ }
198
+ /**
199
+ * Remove timestamps older than throttle window (cleanup for memory management)
200
+ */
201
+ cleanupOldTimestamps() {
202
+ const now = (0, system_date_1.getSystemDateValueOfLocal)();
203
+ const cutoff = now - this.config.throttleMs;
204
+ // Collect keys to delete first to avoid modifying Map during iteration
205
+ const keysToDelete = [];
206
+ this.messageTimestamps.forEach((timestamp, hash) => {
207
+ if (timestamp < cutoff) {
208
+ keysToDelete.push(hash);
209
+ }
210
+ });
211
+ keysToDelete.forEach((hash) => this.messageTimestamps.delete(hash));
212
+ }
213
+ /**
214
+ * Create a hash from message key and data
215
+ *
216
+ * @param messageKey - Message key
217
+ * @param data - Data to substitute
218
+ * @returns Hash string
219
+ */
220
+ createMessageHash(messageKey, data) {
221
+ // Simple hash: concatenate key with sorted JSON of data
222
+ const dataStr = JSON.stringify(data, Object.keys(data).sort());
223
+ return `${messageKey}:${dataStr}`;
224
+ }
225
+ /**
226
+ * Render a message template with data (without printing)
227
+ *
228
+ * @param messageKey - Message key
229
+ * @param data - Data to substitute
230
+ * @returns Array of rendered lines
231
+ */
232
+ renderMessage(messageKey, data = {}) {
233
+ // Ensure messages are loaded
234
+ this.ensureMessagesLoaded();
235
+ // Get template
236
+ const template = this.messages.get(messageKey);
237
+ if (!template) {
238
+ this.logWarning(`Message key not found: '${messageKey}'`);
239
+ return [];
240
+ }
241
+ // Render template
242
+ return (0, simple_mustache_1.renderTemplateLines)(template.template, data);
243
+ }
244
+ /**
245
+ * Render a message template with data as a single string (without printing)
246
+ * Convenience method that joins multiple lines with newlines.
247
+ *
248
+ * @param messageKey - Message key
249
+ * @param data - Data to substitute
250
+ * @returns Rendered message as a single string
251
+ */
252
+ renderMessageAsString(messageKey, data = {}) {
253
+ return this.renderMessage(messageKey, data).join('\n');
254
+ }
255
+ /**
256
+ * Ensure messages are loaded (lazy loading)
257
+ */
258
+ ensureMessagesLoaded() {
259
+ if (this.loadedFiles.size > 0) {
260
+ return; // Already loaded
261
+ }
262
+ this.loadAllMessages();
263
+ }
264
+ /**
265
+ * Load all message files from the messages directory
266
+ */
267
+ loadAllMessages() {
268
+ const messagesPath = this.config.messagesPath;
269
+ // Check if messages directory exists
270
+ if (!fs.existsSync(messagesPath)) {
271
+ this.logWarning(`Messages directory not found: ${messagesPath} (continuing without messages)`);
272
+ return;
273
+ }
274
+ // Load from common and node directories
275
+ this.loadMessagesFromDirectory(path.join(messagesPath, 'common'));
276
+ this.loadMessagesFromDirectory(path.join(messagesPath, 'node'));
277
+ }
278
+ /**
279
+ * Load messages from a specific directory
280
+ *
281
+ * @param dirPath - Directory path
282
+ */
283
+ loadMessagesFromDirectory(dirPath) {
284
+ if (!fs.existsSync(dirPath)) {
285
+ return; // Directory doesn't exist, skip
286
+ }
287
+ try {
288
+ const files = fs
289
+ .readdirSync(dirPath)
290
+ .filter((file) => file.endsWith('.json') && file !== 'package.json');
291
+ for (const file of files) {
292
+ this.loadMessageFile(path.join(dirPath, file));
293
+ }
294
+ }
295
+ catch (error) {
296
+ this.logWarning(`Failed to read messages from ${dirPath}: ${error.message}`);
297
+ }
298
+ }
299
+ /**
300
+ * Load messages from a JSON file
301
+ *
302
+ * @param filePath - Path to JSON file
303
+ */
304
+ loadMessageFile(filePath) {
305
+ try {
306
+ const content = fs.readFileSync(filePath, 'utf8');
307
+ const messages = JSON.parse(content);
308
+ // Add messages to collection
309
+ for (const [key, template] of Object.entries(messages)) {
310
+ if (this.messages.has(key)) {
311
+ this.logWarning(`Duplicate message key '${key}' in ${filePath} (overwriting)`);
312
+ }
313
+ this.messages.set(key, template);
314
+ }
315
+ this.loadedFiles.add(filePath);
316
+ }
317
+ catch (error) {
318
+ this.logWarning(`Failed to load message file ${filePath}: ${error.message}`);
319
+ }
320
+ }
321
+ /**
322
+ * Output lines to stdout with prefix
323
+ *
324
+ * @param lines - Lines to output
325
+ */
326
+ outputLines(lines) {
327
+ for (const line of lines) {
328
+ console.log(`${this.config.prefix} ${line}`);
329
+ }
330
+ }
331
+ /**
332
+ * Log warning to stderr (respects quiet mode)
333
+ *
334
+ * @param message - Warning message
335
+ */
336
+ logWarning(message) {
337
+ if (!this.config.quiet) {
338
+ console.warn(`[ConsoleMessageService] WARNING: ${message}`);
339
+ }
340
+ }
341
+ /**
342
+ * Log error to stderr (respects quiet mode)
343
+ *
344
+ * @param message - Error message
345
+ */
346
+ logError(message) {
347
+ if (!this.config.quiet) {
348
+ console.error(`[ConsoleMessageService] ERROR: ${message}`);
349
+ }
350
+ }
351
+ /**
352
+ * Check if NODE_DEBUG includes 'sl' or 'sl-console' (console logging enabled)
353
+ *
354
+ * @returns True if NODE_DEBUG includes 'sl' or 'sl-console'
355
+ */
356
+ isNodeDebugConsoleEnabled() {
357
+ var _a, _b;
358
+ const nodeDebug = (_b = (_a = process.env['NODE_DEBUG']) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '';
359
+ const parts = nodeDebug.split(',').map((p) => p.trim());
360
+ return parts.includes('sl') || parts.includes('sl-console');
361
+ }
362
+ /**
363
+ * Check if NODE_DEBUG includes 'sl-file' (file logging enabled)
364
+ *
365
+ * @returns True if NODE_DEBUG includes 'sl-file'
366
+ */
367
+ isNodeDebugFileEnabled() {
368
+ var _a, _b;
369
+ const nodeDebug = (_b = (_a = process.env['NODE_DEBUG']) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '';
370
+ const parts = nodeDebug.split(',').map((p) => p.trim());
371
+ return parts.includes('sl-file');
372
+ }
373
+ /**
374
+ * Log a message at INFO level if appropriate.
375
+ * Logs when:
376
+ * - quiet=true (console output is suppressed, need to log for visibility)
377
+ * - quiet=false AND NODE_DEBUG doesn't include 'sl' (no console duplication)
378
+ * - quiet=false AND NODE_DEBUG includes both 'sl' and 'sl-file' (user wants file logging)
379
+ *
380
+ * Skips logging when:
381
+ * - quiet=false AND NODE_DEBUG=sl only (would duplicate console output, no file logging requested)
382
+ *
383
+ * @param lines - Lines to log
384
+ */
385
+ logInfoIfAppropriate(lines) {
386
+ // No logger configured, skip
387
+ if (!this.config.logger) {
388
+ return;
389
+ }
390
+ // If quiet=false and NODE_DEBUG=sl (but NOT sl-file), skip to avoid duplication
391
+ // (both console.log and logger.info would show in terminal)
392
+ // But if sl-file is also set, we need to log for file output
393
+ if (!this.config.quiet &&
394
+ this.isNodeDebugConsoleEnabled() &&
395
+ !this.isNodeDebugFileEnabled()) {
396
+ return;
397
+ }
398
+ // Log each line at INFO level
399
+ for (const line of lines) {
400
+ this.config.logger.info(`${this.config.prefix} ${line}`);
401
+ }
402
+ }
403
+ }
404
+ exports.ConsoleMessageService = ConsoleMessageService;
405
+ ConsoleMessageService.instance = null;
406
+ /** Maximum number of throttle entries before cleanup (prevents memory leak) */
407
+ ConsoleMessageService.MAX_THROTTLE_ENTRIES = 1000;
408
+ //# sourceMappingURL=console-message-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-message-service.js","sourceRoot":"","sources":["../../common/console-message-service.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;AAEH,yBAAyB;AACzB,6BAA6B;AAC7B,6DAA4E;AAC5E,+CAA0D;AA0D1D;;GAEG;AACH,MAAa,qBAAqB;IAYhC;;OAEG;IACH,YAAoB,MAA6B;;QAXzC,aAAQ,GAAkC,IAAI,GAAG,EAAE,CAAC;QACpD,gBAAW,GAAgB,IAAI,GAAG,EAAE,CAAC;QACrC,sBAAiB,GAAwB,IAAI,GAAG,EAAE,CAAC;QACnD,kBAAa,GAA+B,IAAI,GAAG,EAAE,CAAC;QAS5D,eAAe;QACf,IAAI,CAAC,MAAM,GAAG;YACZ,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,aAAa;YACtC,KAAK,EAAE,MAAA,MAAM,CAAC,KAAK,mCAAI,KAAK;YAC5B,YAAY,EACV,MAAM,CAAC,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,E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{
24
24
  private _backendProxy;
25
25
  private _ongoingRequestsCounter;
26
26
  private footprintsEnqueueOnce;
27
+ private _notifiedFirstCoverageSent;
28
+ private cms;
27
29
  constructor(cfg: AgentConfig, sendToServerWatchdog: IWatchdog, keepaliveWatchdog: IWatchdog, logger: Logger, hitsCollector: HitsCollector, hitsConverter: HitsConverter, footprintsBuffer: FootprintsBuffer, backendProxy: IBackendProxy, stateTracker: StateTracker | StateTrackerFpv6);
28
30
  enqueueCurrentFootprints(execution: IExecutionData, testName: string, isFinalFootprints?: boolean): Promise<void>;
29
31
  updateConfig(updatedCfg: AgentConfig): Promise<void>;