@@ -11,6 +11,7 @@ import {
1111
1212import {
1313 AgentConfig ,
14+ AgentDebugConfig ,
1415 RunAgentParameters ,
1516 ResolvedAgentDebugConfig ,
1617 resolveAgentDebugConfig ,
@@ -50,7 +51,7 @@ export abstract class AbstractAgent {
5051 public threadId : string ;
5152 public messages : Message [ ] ;
5253 public state : State ;
53- public debug : ResolvedAgentDebugConfig ;
54+ private _debug : ResolvedAgentDebugConfig ;
5455 private _debugLogger : DebugLogger | undefined ;
5556 public subscribers : AgentSubscriber [ ] = [ ] ;
5657 public isRunning : boolean = false ;
@@ -63,6 +64,15 @@ export abstract class AbstractAgent {
6364 return packageJson . version ;
6465 }
6566
67+ get debug ( ) : ResolvedAgentDebugConfig {
68+ return this . _debug ;
69+ }
70+
71+ set debug ( value : AgentDebugConfig | ResolvedAgentDebugConfig ) {
72+ this . _debug = resolveAgentDebugConfig ( value as AgentDebugConfig ) ;
73+ this . _debugLogger = createDebugLogger ( this . _debug ) ;
74+ }
75+
6676 get debugLogger ( ) : DebugLogger | undefined {
6777 return this . _debugLogger ;
6878 }
@@ -90,8 +100,8 @@ export abstract class AbstractAgent {
90100 this . threadId = threadId ?? uuidv4 ( ) ;
91101 this . messages = structuredClone_ ( initialMessages ?? [ ] ) ;
92102 this . state = structuredClone_ ( initialState ?? { } ) ;
93- this . debug = resolveAgentDebugConfig ( debug ) ;
94- this . debugLogger = createDebugLogger ( this . debug ) ;
103+ this . _debug = resolveAgentDebugConfig ( debug ) ;
104+ this . _debugLogger = createDebugLogger ( this . _debug ) ;
95105
96106 if ( compareVersions ( this . maxVersion , "0.0.39" ) <= 0 ) {
97107 this . middlewares . unshift ( new BackwardCompatibility_0_0_39 ( ) ) ;
@@ -497,8 +507,8 @@ export abstract class AbstractAgent {
497507 cloned . threadId = this . threadId ;
498508 cloned . messages = structuredClone_ ( this . messages ) ;
499509 cloned . state = structuredClone_ ( this . state ) ;
500- cloned . debug = this . debug ;
501- cloned . debugLogger = this . debugLogger ;
510+ cloned . _debug = this . _debug ;
511+ cloned . _debugLogger = this . _debugLogger ;
502512 cloned . isRunning = this . isRunning ;
503513 cloned . subscribers = [ ...this . subscribers ] ;
504514 cloned . middlewares = [ ...this . middlewares ] ;
0 commit comments