@zenflux/core 0.1.10 → 0.1.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenflux/core",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "types": "dist/zenflux-core.d.ts",
5
5
  "type": "module",
6
6
  "files": [
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@jest/globals": "^29.7.0",
36
- "@zenflux/cli": "0.1.32"
36
+ "@zenflux/cli": "0.1.33"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"
@@ -42,6 +42,6 @@
42
42
  "fastmcp": "^3.23.1",
43
43
  "zod": "^4.1.12",
44
44
  "picocolors": "^1.0.0",
45
- "@zenflux/utils": "0.1.14"
45
+ "@zenflux/utils": "0.1.15"
46
46
  }
47
47
  }
@@ -16,7 +16,21 @@ import type * as interfaces from "../../interfaces";
16
16
  // TODO: Should by dynamic/configure-able.
17
17
  const MAX_MAPPING_RECURSIVE_DEPTH = 4,
18
18
  UNKNOWN_CALLER_NAME = "anonymous function",
19
- MAX_COLOR_ATTEMPTS = 25; // Stop color generation from looping forever when palette is saturated.
19
+ MAX_COLOR_ATTEMPTS = 25, // Stop color generation from looping forever when palette is saturated.
20
+ FALLBACK_PALETTE = [
21
+ "#EF4444", // red-500
22
+ "#F59E0B", // amber-500
23
+ "#10B981", // emerald-500
24
+ "#3B82F6", // blue-500
25
+ "#6366F1", // indigo-500
26
+ "#EC4899", // pink-500
27
+ "#8B5CF6", // violet-500
28
+ "#14B8A6", // teal-500
29
+ "#F97316", // orange-500
30
+ "#A855F7", // purple-500
31
+ "#22D3EE", // cyan-400
32
+ "#84CC16", // lime-500
33
+ ]; // Predefined distinct colors for guaranteed fallback.
20
34
 
21
35
  // TODO: Should by dynamic/configure-able.
22
36
  Error.stackTraceLimit = 50;
@@ -296,8 +310,17 @@ export abstract class LoggerBrowserInfra extends ObjectBase {
296
310
  }
297
311
  }
298
312
 
299
- // Fallback: return the last generated color even if it's similar to avoid infinite recursion.
300
- return lastTried;
313
+ // Fallback: pick a color from a predefined palette to guarantee termination.
314
+ // Prefer an unused palette color; otherwise reuse by index to preserve determinism.
315
+ const unusedPaletteColor = FALLBACK_PALETTE.find( ( paletteColor ) => {
316
+ return ! LoggerBrowserInfra.colorsUsed.includes( paletteColor );
317
+ } );
318
+
319
+ if ( unusedPaletteColor ) {
320
+ return unusedPaletteColor;
321
+ }
322
+
323
+ return FALLBACK_PALETTE[ LoggerBrowserInfra.colorsUsed.length % FALLBACK_PALETTE.length ] || lastTried;
301
324
  }
302
325
 
303
326
  protected getCallerName( caller: interfaces.TCaller ) {