@agentxjs/ui 0.0.4 → 0.0.6

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.
@@ -1,4 +1,4 @@
1
- import { L as LogLevel, i as isStateEvent } from "./index-O2e5VGwL.js";
1
+ import { c as createLogger, i as isStateEvent, L as LogLevel } from "./index-B8Ijbzyc.js";
2
2
  var extendStatics = function(d, b) {
3
3
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
4
4
  d2.__proto__ = b2;
@@ -745,164 +745,6 @@ function take(count) {
745
745
  var __defProp = Object.defineProperty;
746
746
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
747
747
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
748
- var __defProp2 = Object.defineProperty;
749
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
750
- var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
751
- var _ConsoleLogger = class _ConsoleLogger2 {
752
- constructor(name, options = {}) {
753
- __publicField2(this, "name");
754
- __publicField2(this, "level");
755
- __publicField2(this, "colors");
756
- __publicField2(this, "timestamps");
757
- this.name = name;
758
- this.level = options.level ?? LogLevel.INFO;
759
- this.colors = options.colors ?? this.isNodeEnvironment();
760
- this.timestamps = options.timestamps ?? true;
761
- }
762
- debug(message, context) {
763
- if (this.isDebugEnabled()) {
764
- this.log("DEBUG", message, context);
765
- }
766
- }
767
- info(message, context) {
768
- if (this.isInfoEnabled()) {
769
- this.log("INFO", message, context);
770
- }
771
- }
772
- warn(message, context) {
773
- if (this.isWarnEnabled()) {
774
- this.log("WARN", message, context);
775
- }
776
- }
777
- error(message, context) {
778
- if (this.isErrorEnabled()) {
779
- if (message instanceof Error) {
780
- this.log("ERROR", message.message, { ...context, stack: message.stack });
781
- } else {
782
- this.log("ERROR", message, context);
783
- }
784
- }
785
- }
786
- isDebugEnabled() {
787
- return this.level <= LogLevel.DEBUG;
788
- }
789
- isInfoEnabled() {
790
- return this.level <= LogLevel.INFO;
791
- }
792
- isWarnEnabled() {
793
- return this.level <= LogLevel.WARN;
794
- }
795
- isErrorEnabled() {
796
- return this.level <= LogLevel.ERROR;
797
- }
798
- log(level, message, context) {
799
- const parts = [];
800
- if (this.timestamps) {
801
- parts.push((/* @__PURE__ */ new Date()).toISOString());
802
- }
803
- if (this.colors) {
804
- const color = _ConsoleLogger2.COLORS[level];
805
- parts.push(`${color}${level.padEnd(5)}${_ConsoleLogger2.COLORS.RESET}`);
806
- } else {
807
- parts.push(level.padEnd(5));
808
- }
809
- parts.push(`[${this.name}]`);
810
- parts.push(message);
811
- const logLine = parts.join(" ");
812
- const consoleMethod = this.getConsoleMethod(level);
813
- if (context && Object.keys(context).length > 0) {
814
- consoleMethod(logLine, context);
815
- } else {
816
- consoleMethod(logLine);
817
- }
818
- }
819
- getConsoleMethod(level) {
820
- switch (level) {
821
- case "DEBUG":
822
- return console.debug.bind(console);
823
- case "INFO":
824
- return console.info.bind(console);
825
- case "WARN":
826
- return console.warn.bind(console);
827
- case "ERROR":
828
- return console.error.bind(console);
829
- default:
830
- return console.log.bind(console);
831
- }
832
- }
833
- isNodeEnvironment() {
834
- var _a;
835
- return typeof process !== "undefined" && ((_a = process.versions) == null ? void 0 : _a.node) !== void 0;
836
- }
837
- };
838
- __publicField2(_ConsoleLogger, "COLORS", {
839
- DEBUG: "\x1B[36m",
840
- INFO: "\x1B[32m",
841
- WARN: "\x1B[33m",
842
- ERROR: "\x1B[31m",
843
- RESET: "\x1B[0m"
844
- });
845
- var ConsoleLogger = _ConsoleLogger;
846
- var externalFactory = null;
847
- var LoggerFactoryImpl = class {
848
- static getLogger(nameOrClass) {
849
- const name = typeof nameOrClass === "string" ? nameOrClass : nameOrClass.name;
850
- if (this.loggers.has(name)) {
851
- return this.loggers.get(name);
852
- }
853
- const lazyLogger = this.createLazyLogger(name);
854
- this.loggers.set(name, lazyLogger);
855
- return lazyLogger;
856
- }
857
- static configure(config2) {
858
- this.config = { ...this.config, ...config2 };
859
- }
860
- static reset() {
861
- this.loggers.clear();
862
- this.config = { defaultLevel: LogLevel.INFO };
863
- externalFactory = null;
864
- }
865
- static createLazyLogger(name) {
866
- let realLogger = null;
867
- const getRealLogger = () => {
868
- if (!realLogger) {
869
- realLogger = this.createLogger(name);
870
- }
871
- return realLogger;
872
- };
873
- return {
874
- name,
875
- level: this.config.defaultLevel || LogLevel.INFO,
876
- debug: (message, context) => getRealLogger().debug(message, context),
877
- info: (message, context) => getRealLogger().info(message, context),
878
- warn: (message, context) => getRealLogger().warn(message, context),
879
- error: (message, context) => getRealLogger().error(message, context),
880
- isDebugEnabled: () => getRealLogger().isDebugEnabled(),
881
- isInfoEnabled: () => getRealLogger().isInfoEnabled(),
882
- isWarnEnabled: () => getRealLogger().isWarnEnabled(),
883
- isErrorEnabled: () => getRealLogger().isErrorEnabled()
884
- };
885
- }
886
- static createLogger(name) {
887
- if (externalFactory) {
888
- return externalFactory.getLogger(name);
889
- }
890
- if (this.config.defaultImplementation) {
891
- return this.config.defaultImplementation(name);
892
- }
893
- return new ConsoleLogger(name, {
894
- level: this.config.defaultLevel,
895
- ...this.config.consoleOptions
896
- });
897
- }
898
- };
899
- __publicField2(LoggerFactoryImpl, "loggers", /* @__PURE__ */ new Map());
900
- __publicField2(LoggerFactoryImpl, "config", {
901
- defaultLevel: LogLevel.INFO
902
- });
903
- function createLogger(name) {
904
- return LoggerFactoryImpl.getLogger(name);
905
- }
906
748
  var logger = createLogger("agentx/DefinitionManager");
907
749
  function generateMetaImageId(definitionName) {
908
750
  return `meta_${definitionName}`;
@@ -3168,4 +3010,4 @@ createLogger("agentx/RemoteAgentIdResolver");
3168
3010
  export {
3169
3011
  createAgentX
3170
3012
  };
3171
- //# sourceMappingURL=index-CRELszoW.js.map
3013
+ //# sourceMappingURL=index-BtOS4F-X.js.map