@soulcraft/brainy 3.2.0 → 3.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.
- package/dist/augmentations/cacheAugmentation.d.ts +1 -0
- package/dist/augmentations/cacheAugmentation.js +5 -0
- package/dist/augmentations/display/types.d.ts +2 -0
- package/dist/augmentations/metricsAugmentation.d.ts +1 -0
- package/dist/augmentations/universalDisplayAugmentation.js +4 -0
- package/dist/brainy.d.ts +1 -0
- package/dist/brainy.js +34 -3
- package/dist/utils/logger.d.ts +1 -0
- package/dist/utils/logger.js +6 -1
- package/package.json +1 -1
|
@@ -65,6 +65,11 @@ export class CacheAugmentation extends BaseAugmentation {
|
|
|
65
65
|
type: 'boolean',
|
|
66
66
|
default: true,
|
|
67
67
|
description: 'Automatically invalidate cache on data modifications'
|
|
68
|
+
},
|
|
69
|
+
silent: {
|
|
70
|
+
type: 'boolean',
|
|
71
|
+
default: false,
|
|
72
|
+
description: 'Suppress all console output'
|
|
68
73
|
}
|
|
69
74
|
},
|
|
70
75
|
additionalProperties: false
|
|
@@ -18,6 +18,8 @@ export interface DisplayConfig {
|
|
|
18
18
|
batchSize: number;
|
|
19
19
|
/** Minimum confidence threshold for AI type detection */
|
|
20
20
|
confidenceThreshold: number;
|
|
21
|
+
/** Silent mode - suppress all console output */
|
|
22
|
+
silent?: boolean;
|
|
21
23
|
/** Custom field mappings (userField -> displayField) */
|
|
22
24
|
customFieldMappings: Record<string, string>;
|
|
23
25
|
/** Type-specific priority fields for intelligent detection */
|
|
@@ -234,6 +234,10 @@ export class UniversalDisplayAugmentation extends BaseAugmentation {
|
|
|
234
234
|
*/
|
|
235
235
|
createExploreMethod(entity) {
|
|
236
236
|
return async () => {
|
|
237
|
+
// Respect silent mode
|
|
238
|
+
if (this.config.silent) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
237
241
|
console.log(`\n📋 Entity Exploration: ${entity.id || 'unknown'}`);
|
|
238
242
|
console.log('━'.repeat(50));
|
|
239
243
|
// Show user data
|
package/dist/brainy.d.ts
CHANGED
package/dist/brainy.js
CHANGED
|
@@ -63,7 +63,20 @@ export class Brainy {
|
|
|
63
63
|
}
|
|
64
64
|
// Configure logging based on config options
|
|
65
65
|
if (this.config.silent) {
|
|
66
|
-
|
|
66
|
+
// Store original console methods for restoration
|
|
67
|
+
this.originalConsole = {
|
|
68
|
+
log: console.log,
|
|
69
|
+
info: console.info,
|
|
70
|
+
warn: console.warn,
|
|
71
|
+
error: console.error
|
|
72
|
+
};
|
|
73
|
+
// Override all console methods to completely silence output
|
|
74
|
+
console.log = () => { };
|
|
75
|
+
console.info = () => { };
|
|
76
|
+
console.warn = () => { };
|
|
77
|
+
console.error = () => { };
|
|
78
|
+
// Also configure logger for silent mode
|
|
79
|
+
configureLogger({ level: LogLevel.SILENT }); // Suppress all logs
|
|
67
80
|
}
|
|
68
81
|
else if (this.config.verbose) {
|
|
69
82
|
configureLogger({ level: LogLevel.DEBUG }); // Enable verbose logging
|
|
@@ -1408,8 +1421,18 @@ export class Brainy {
|
|
|
1408
1421
|
*/
|
|
1409
1422
|
setupAugmentations() {
|
|
1410
1423
|
const registry = new AugmentationRegistry();
|
|
1411
|
-
// Register default augmentations
|
|
1412
|
-
const
|
|
1424
|
+
// Register default augmentations with silent mode support
|
|
1425
|
+
const augmentationConfig = {
|
|
1426
|
+
...this.config.augmentations,
|
|
1427
|
+
// Pass silent mode to all augmentations
|
|
1428
|
+
...(this.config.silent && {
|
|
1429
|
+
cache: this.config.augmentations?.cache !== false ? { ...this.config.augmentations?.cache, silent: true } : false,
|
|
1430
|
+
metrics: this.config.augmentations?.metrics !== false ? { ...this.config.augmentations?.metrics, silent: true } : false,
|
|
1431
|
+
display: this.config.augmentations?.display !== false ? { ...this.config.augmentations?.display, silent: true } : false,
|
|
1432
|
+
monitoring: this.config.augmentations?.monitoring !== false ? { ...this.config.augmentations?.monitoring, silent: true } : false
|
|
1433
|
+
})
|
|
1434
|
+
};
|
|
1435
|
+
const defaults = createDefaultAugmentations(augmentationConfig);
|
|
1413
1436
|
for (const aug of defaults) {
|
|
1414
1437
|
registry.register(aug);
|
|
1415
1438
|
}
|
|
@@ -1488,6 +1511,14 @@ export class Brainy {
|
|
|
1488
1511
|
await aug.shutdown();
|
|
1489
1512
|
}
|
|
1490
1513
|
}
|
|
1514
|
+
// Restore console methods if silent mode was enabled
|
|
1515
|
+
if (this.config.silent && this.originalConsole) {
|
|
1516
|
+
console.log = this.originalConsole.log;
|
|
1517
|
+
console.info = this.originalConsole.info;
|
|
1518
|
+
console.warn = this.originalConsole.warn;
|
|
1519
|
+
console.error = this.originalConsole.error;
|
|
1520
|
+
this.originalConsole = undefined;
|
|
1521
|
+
}
|
|
1491
1522
|
// Storage doesn't have close in current interface
|
|
1492
1523
|
// We'll just mark as not initialized
|
|
1493
1524
|
this.initialized = false;
|
package/dist/utils/logger.d.ts
CHANGED
package/dist/utils/logger.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { isProductionEnvironment, getLogLevel } from './environment.js';
|
|
7
7
|
export var LogLevel;
|
|
8
8
|
(function (LogLevel) {
|
|
9
|
+
LogLevel[LogLevel["SILENT"] = -1] = "SILENT";
|
|
9
10
|
LogLevel[LogLevel["ERROR"] = 0] = "ERROR";
|
|
10
11
|
LogLevel[LogLevel["WARN"] = 1] = "WARN";
|
|
11
12
|
LogLevel[LogLevel["INFO"] = 2] = "INFO";
|
|
@@ -45,7 +46,7 @@ class Logger {
|
|
|
45
46
|
// Convert environment log level to Logger LogLevel
|
|
46
47
|
switch (envLogLevel) {
|
|
47
48
|
case 'silent':
|
|
48
|
-
this.config.level =
|
|
49
|
+
this.config.level = LogLevel.SILENT;
|
|
49
50
|
break;
|
|
50
51
|
case 'error':
|
|
51
52
|
this.config.level = LogLevel.ERROR;
|
|
@@ -81,6 +82,10 @@ class Logger {
|
|
|
81
82
|
this.config = { ...this.config, ...config };
|
|
82
83
|
}
|
|
83
84
|
shouldLog(level, module) {
|
|
85
|
+
// Silent mode - never log anything
|
|
86
|
+
if (this.config.level === LogLevel.SILENT) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
84
89
|
// Check module-specific level first
|
|
85
90
|
if (this.config.modules && this.config.modules[module] !== undefined) {
|
|
86
91
|
return level <= this.config.modules[module];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soulcraft/brainy",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Universal Knowledge Protocol™ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. 31 nouns × 40 verbs for infinite expressiveness.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|