@genesislcap/ai-assistant 15.41.0 → 15.42.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.
@@ -151,6 +151,12 @@ function combineSignals(signals) {
151
151
  return { signal: controller.signal, dispose };
152
152
  }
153
153
 
154
+ // ../../foundation-logger/dist/esm/log-timestamps.js
155
+ var LOG_TIMESTAMPS_FLAG = Symbol.for("@genesislcap/foundation-logger:timestamps");
156
+ function areLogTimestampsEnabled() {
157
+ return Reflect.get(globalThis, LOG_TIMESTAMPS_FLAG) === true;
158
+ }
159
+
154
160
  // ../../../../node_modules/consola/dist/core.mjs
155
161
  var LogLevels = {
156
162
  silent: Number.NEGATIVE_INFINITY,
@@ -731,15 +737,118 @@ function createConsola2(options = {}) {
731
737
  }
732
738
  var consola = createConsola2();
733
739
 
740
+ // ../../foundation-logger/dist/esm/timestamp-browser-reporter.js
741
+ var TIME_UNIT_DIGITS = 2;
742
+ var MILLISECOND_DIGITS = 3;
743
+ function formatLogTimestamp(date) {
744
+ const hours = String(date.getHours()).padStart(TIME_UNIT_DIGITS, "0");
745
+ const minutes = String(date.getMinutes()).padStart(TIME_UNIT_DIGITS, "0");
746
+ const seconds = String(date.getSeconds()).padStart(TIME_UNIT_DIGITS, "0");
747
+ const milliseconds = String(date.getMilliseconds()).padStart(MILLISECOND_DIGITS, "0");
748
+ return `${hours}:${minutes}:${seconds}.${milliseconds}`;
749
+ }
750
+ function getConsoleLogFn(level) {
751
+ const consolaConsole = console;
752
+ if (level < 1) {
753
+ return consolaConsole.__error || consolaConsole.error;
754
+ }
755
+ if (level === 1) {
756
+ return consolaConsole.__warn || consolaConsole.warn;
757
+ }
758
+ return consolaConsole.__log || consolaConsole.log;
759
+ }
760
+ function shouldIncludeTimestamp(ctx) {
761
+ var _a, _b, _c;
762
+ const timestamps = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.options) === null || _a === void 0 ? void 0 : _a.timestamps;
763
+ if (typeof timestamps === "boolean") {
764
+ return timestamps;
765
+ }
766
+ if (((_c = (_b = ctx === null || ctx === void 0 ? void 0 : ctx.options) === null || _b === void 0 ? void 0 : _b.formatOptions) === null || _c === void 0 ? void 0 : _c.date) === true) {
767
+ return true;
768
+ }
769
+ return areLogTimestampsEnabled();
770
+ }
771
+ var TimestampBrowserReporter = class {
772
+ constructor() {
773
+ this.defaultColor = "#7f8c8d";
774
+ this.levelColorMap = {
775
+ 0: "#c0392b",
776
+ 1: "#f39c12",
777
+ 3: "#00BCD4"
778
+ };
779
+ this.typeColorMap = {
780
+ success: "#2ecc71"
781
+ };
782
+ }
783
+ /**
784
+ * Writes a log object to the console, prefixed with `logObj.date` when enabled.
785
+ *
786
+ * @param logObj - The Consola log object. See Consola's `LogObject`.
787
+ * @param ctx - Reporter context, including Consola options.
788
+ */
789
+ log(logObj, ctx) {
790
+ const consoleLogFn = getConsoleLogFn(logObj.level);
791
+ const type = logObj.type === "log" ? "" : logObj.type;
792
+ const tag = logObj.tag || "";
793
+ const timestamp = shouldIncludeTimestamp(ctx) ? formatLogTimestamp(logObj.date) : "";
794
+ const useBrowserStyles = typeof window !== "undefined" && !!(tag || type);
795
+ if (useBrowserStyles) {
796
+ this.logWithBrowserStyles(consoleLogFn, logObj, tag, type, timestamp);
797
+ return;
798
+ }
799
+ this.logPlain(consoleLogFn, logObj, tag, type, timestamp);
800
+ }
801
+ logWithBrowserStyles(consoleLogFn, logObj, tag, type, timestamp) {
802
+ const color = this.typeColorMap[logObj.type] || this.levelColorMap[logObj.level] || this.defaultColor;
803
+ const style = `
804
+ background: ${color};
805
+ border-radius: 0.5em;
806
+ color: white;
807
+ font-weight: bold;
808
+ padding: 2px 0.5em;
809
+ `;
810
+ const badge = `%c${[tag, type].filter(Boolean).join(":")}`;
811
+ const prefix = timestamp ? `${timestamp} ${badge}` : badge;
812
+ if (typeof logObj.args[0] === "string") {
813
+ consoleLogFn(`${prefix}%c ${logObj.args[0]}`, style, "", ...logObj.args.slice(1));
814
+ return;
815
+ }
816
+ consoleLogFn(prefix, style, ...logObj.args);
817
+ }
818
+ logPlain(consoleLogFn, logObj, tag, type, timestamp) {
819
+ const label = [tag, type].filter(Boolean).join(":");
820
+ const prefix = [timestamp, label ? `[${label}]` : ""].filter(Boolean).join(" ");
821
+ if (typeof logObj.args[0] === "string") {
822
+ consoleLogFn(prefix ? `${prefix} ${logObj.args[0]}` : logObj.args[0], ...logObj.args.slice(1));
823
+ return;
824
+ }
825
+ if (prefix) {
826
+ consoleLogFn(prefix, ...logObj.args);
827
+ return;
828
+ }
829
+ consoleLogFn(...logObj.args);
830
+ }
831
+ };
832
+
734
833
  // ../../foundation-logger/dist/esm/logger.js
735
834
  var defaultLoggerOptions = {
736
- level: LogLevels.debug
835
+ level: LogLevels.debug,
836
+ formatOptions: {
837
+ date: false
838
+ }
737
839
  };
738
- function createLogger(name, options = defaultLoggerOptions) {
739
- const createConsola3 = typeof window !== "undefined" ? createConsola2 : createConsola;
740
- const logger3 = createConsola3().withTag(name);
741
- if ((options === null || options === void 0 ? void 0 : options.level) !== void 0)
742
- logger3.level = options.level;
840
+ var browserReporter = new TimestampBrowserReporter();
841
+ function resolveLoggerOptions(options, isBrowser) {
842
+ const resolved = Object.assign(Object.assign(Object.assign({}, defaultLoggerOptions), options), { formatOptions: Object.assign(Object.assign({}, defaultLoggerOptions.formatOptions), options.formatOptions) });
843
+ if (isBrowser && !resolved.reporters) {
844
+ resolved.reporters = [browserReporter];
845
+ }
846
+ return resolved;
847
+ }
848
+ function createLogger(name, options = {}) {
849
+ const isBrowser = typeof window !== "undefined";
850
+ const createConsola3 = isBrowser ? createConsola2 : createConsola;
851
+ const logger3 = createConsola3(resolveLoggerOptions(options, isBrowser)).withTag(name);
743
852
  const typedLogger = logger3;
744
853
  typedLogger.deprecated = (symbol, instruction = "Consult docs for better alternative.", removalVersionTarget) => {
745
854
  typedLogger.warn(`Deprecated symbol used '${symbol}'. ${instruction}`, `${removalVersionTarget ? `Will be removed in version ${removalVersionTarget}.` : ""}`);