agents / Exports / ContextualEventService
Class: ContextualEventService
Implements
ContextualEventServiceInterface
Table of contents
Constructors
Methods
Constructors
constructor
• new ContextualEventService(baseEventService?, logger?, executionContext?, config?): ContextualEventService
Parameters
| Name | Type |
|---|---|
baseEventService? | ContextualEventServiceInterface |
logger? | SimpleLogger |
executionContext? | EventServiceCreationContext |
config? | Partial<ContextualEventServiceConfig> |
Returns
Defined in
packages/agents/src/services/contextual-event/contextual-event-service.ts:33
• new ContextualEventService(config): ContextualEventService
Parameters
| Name | Type |
|---|---|
config | ContextualEventServiceConfig |
Returns
Defined in
packages/agents/src/services/contextual-event/contextual-event-service.ts:39
Methods
emit
▸ emit(eventType, data): void
🎯 Core EventService method - emit events with automatic context injection
Parameters
| Name | Type |
|---|---|
eventType | string |
data | ServiceEventData |
Returns
void
Implementation of
ContextualEventServiceInterface.emit
Defined in
packages/agents/src/services/contextual-event/contextual-event-service.ts:95
trackExecution
▸ trackExecution(executionId, parentExecutionId?, level?): void
📊 Track execution hierarchy
Parameters
| Name | Type |
|---|---|
executionId | string |
parentExecutionId? | string |
level? | number |
Returns
void
Implementation of
ContextualEventServiceInterface.trackExecution
Defined in
packages/agents/src/services/contextual-event/contextual-event-service.ts:130
createBoundEmit
▸ createBoundEmit(executionId): (eventType: string, data: ServiceEventData) => void
🔗 Create bound emit function for specific execution context
Parameters
| Name | Type |
|---|---|
executionId | string |
Returns
fn
▸ (eventType, data): void
Parameters
| Name | Type |
|---|---|
eventType | string |
data | ServiceEventData |
Returns
void
Implementation of
ContextualEventServiceInterface.createBoundEmit
Defined in
packages/agents/src/services/contextual-event/contextual-event-service.ts:152
createChild
▸ createChild(childContext): ContextualEventServiceInterface
🏭 Factory method - Create child EventService with inherited context This is the key method that replaces all the complex factory logic
Parameters
| Name | Type |
|---|---|
childContext | EventServiceCreationContext |
Returns
ContextualEventServiceInterface
Implementation of
ContextualEventServiceInterface.createChild
Defined in
packages/agents/src/services/contextual-event/contextual-event-service.ts:170
▸ createChild(sourceObject): ContextualEventServiceInterface
Parameters
| Name | Type |
|---|---|
sourceObject | unknown |
Returns
ContextualEventServiceInterface
Implementation of
ContextualEventServiceInterface.createChild
Defined in
packages/agents/src/services/contextual-event/contextual-event-service.ts:171
getExecutionContext
▸ getExecutionContext(): undefined | InternalExecutionContext
📊 Get current execution context (for debugging)
Returns
undefined | InternalExecutionContext
Implementation of
ContextualEventServiceInterface.getExecutionContext
Defined in
packages/agents/src/services/contextual-event/contextual-event-service.ts:214
getContextHierarchy
▸ getContextHierarchy(): InternalExecutionContext[]
🌳 Get full context hierarchy (for debugging)
Returns
InternalExecutionContext[]
Implementation of
ContextualEventServiceInterface.getContextHierarchy
Defined in
packages/agents/src/services/contextual-event/contextual-event-service.ts:221