@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.
@@ -233,6 +233,12 @@ function combineSignals(signals) {
233
233
  return { signal: controller.signal, dispose };
234
234
  }
235
235
 
236
+ // ../../foundation-logger/dist/esm/log-timestamps.js
237
+ var LOG_TIMESTAMPS_FLAG = Symbol.for("@genesislcap/foundation-logger:timestamps");
238
+ function areLogTimestampsEnabled() {
239
+ return Reflect.get(globalThis, LOG_TIMESTAMPS_FLAG) === true;
240
+ }
241
+
236
242
  // ../../../../node_modules/consola/dist/core.mjs
237
243
  var LogLevels = {
238
244
  silent: Number.NEGATIVE_INFINITY,
@@ -813,15 +819,118 @@ function createConsola2(options = {}) {
813
819
  }
814
820
  var consola = createConsola2();
815
821
 
822
+ // ../../foundation-logger/dist/esm/timestamp-browser-reporter.js
823
+ var TIME_UNIT_DIGITS = 2;
824
+ var MILLISECOND_DIGITS = 3;
825
+ function formatLogTimestamp(date) {
826
+ const hours = String(date.getHours()).padStart(TIME_UNIT_DIGITS, "0");
827
+ const minutes = String(date.getMinutes()).padStart(TIME_UNIT_DIGITS, "0");
828
+ const seconds = String(date.getSeconds()).padStart(TIME_UNIT_DIGITS, "0");
829
+ const milliseconds = String(date.getMilliseconds()).padStart(MILLISECOND_DIGITS, "0");
830
+ return `${hours}:${minutes}:${seconds}.${milliseconds}`;
831
+ }
832
+ function getConsoleLogFn(level) {
833
+ const consolaConsole = console;
834
+ if (level < 1) {
835
+ return consolaConsole.__error || consolaConsole.error;
836
+ }
837
+ if (level === 1) {
838
+ return consolaConsole.__warn || consolaConsole.warn;
839
+ }
840
+ return consolaConsole.__log || consolaConsole.log;
841
+ }
842
+ function shouldIncludeTimestamp(ctx) {
843
+ var _a, _b, _c;
844
+ const timestamps = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.options) === null || _a === void 0 ? void 0 : _a.timestamps;
845
+ if (typeof timestamps === "boolean") {
846
+ return timestamps;
847
+ }
848
+ 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) {
849
+ return true;
850
+ }
851
+ return areLogTimestampsEnabled();
852
+ }
853
+ var TimestampBrowserReporter = class {
854
+ constructor() {
855
+ this.defaultColor = "#7f8c8d";
856
+ this.levelColorMap = {
857
+ 0: "#c0392b",
858
+ 1: "#f39c12",
859
+ 3: "#00BCD4"
860
+ };
861
+ this.typeColorMap = {
862
+ success: "#2ecc71"
863
+ };
864
+ }
865
+ /**
866
+ * Writes a log object to the console, prefixed with `logObj.date` when enabled.
867
+ *
868
+ * @param logObj - The Consola log object. See Consola's `LogObject`.
869
+ * @param ctx - Reporter context, including Consola options.
870
+ */
871
+ log(logObj, ctx) {
872
+ const consoleLogFn = getConsoleLogFn(logObj.level);
873
+ const type = logObj.type === "log" ? "" : logObj.type;
874
+ const tag = logObj.tag || "";
875
+ const timestamp = shouldIncludeTimestamp(ctx) ? formatLogTimestamp(logObj.date) : "";
876
+ const useBrowserStyles = typeof window !== "undefined" && !!(tag || type);
877
+ if (useBrowserStyles) {
878
+ this.logWithBrowserStyles(consoleLogFn, logObj, tag, type, timestamp);
879
+ return;
880
+ }
881
+ this.logPlain(consoleLogFn, logObj, tag, type, timestamp);
882
+ }
883
+ logWithBrowserStyles(consoleLogFn, logObj, tag, type, timestamp) {
884
+ const color = this.typeColorMap[logObj.type] || this.levelColorMap[logObj.level] || this.defaultColor;
885
+ const style = `
886
+ background: ${color};
887
+ border-radius: 0.5em;
888
+ color: white;
889
+ font-weight: bold;
890
+ padding: 2px 0.5em;
891
+ `;
892
+ const badge = `%c${[tag, type].filter(Boolean).join(":")}`;
893
+ const prefix = timestamp ? `${timestamp} ${badge}` : badge;
894
+ if (typeof logObj.args[0] === "string") {
895
+ consoleLogFn(`${prefix}%c ${logObj.args[0]}`, style, "", ...logObj.args.slice(1));
896
+ return;
897
+ }
898
+ consoleLogFn(prefix, style, ...logObj.args);
899
+ }
900
+ logPlain(consoleLogFn, logObj, tag, type, timestamp) {
901
+ const label = [tag, type].filter(Boolean).join(":");
902
+ const prefix = [timestamp, label ? `[${label}]` : ""].filter(Boolean).join(" ");
903
+ if (typeof logObj.args[0] === "string") {
904
+ consoleLogFn(prefix ? `${prefix} ${logObj.args[0]}` : logObj.args[0], ...logObj.args.slice(1));
905
+ return;
906
+ }
907
+ if (prefix) {
908
+ consoleLogFn(prefix, ...logObj.args);
909
+ return;
910
+ }
911
+ consoleLogFn(...logObj.args);
912
+ }
913
+ };
914
+
816
915
  // ../../foundation-logger/dist/esm/logger.js
817
916
  var defaultLoggerOptions = {
818
- level: LogLevels.debug
917
+ level: LogLevels.debug,
918
+ formatOptions: {
919
+ date: false
920
+ }
819
921
  };
820
- function createLogger(name, options = defaultLoggerOptions) {
821
- const createConsola3 = typeof window !== "undefined" ? createConsola2 : createConsola;
822
- const logger3 = createConsola3().withTag(name);
823
- if ((options === null || options === void 0 ? void 0 : options.level) !== void 0)
824
- logger3.level = options.level;
922
+ var browserReporter = new TimestampBrowserReporter();
923
+ function resolveLoggerOptions(options, isBrowser) {
924
+ const resolved = Object.assign(Object.assign(Object.assign({}, defaultLoggerOptions), options), { formatOptions: Object.assign(Object.assign({}, defaultLoggerOptions.formatOptions), options.formatOptions) });
925
+ if (isBrowser && !resolved.reporters) {
926
+ resolved.reporters = [browserReporter];
927
+ }
928
+ return resolved;
929
+ }
930
+ function createLogger(name, options = {}) {
931
+ const isBrowser = typeof window !== "undefined";
932
+ const createConsola3 = isBrowser ? createConsola2 : createConsola;
933
+ const logger3 = createConsola3(resolveLoggerOptions(options, isBrowser)).withTag(name);
825
934
  const typedLogger = logger3;
826
935
  typedLogger.deprecated = (symbol, instruction = "Consult docs for better alternative.", removalVersionTarget) => {
827
936
  typedLogger.warn(`Deprecated symbol used '${symbol}'. ${instruction}`, `${removalVersionTarget ? `Will be removed in version ${removalVersionTarget}.` : ""}`);