Skip to content

agents / Exports / ContextualEventService

Class: ContextualEventService

Implements

  • ContextualEventServiceInterface

Table of contents

Constructors

Methods

Constructors

constructor

new ContextualEventService(baseEventService?, logger?, executionContext?, config?): ContextualEventService

Parameters

NameType
baseEventService?ContextualEventServiceInterface
logger?SimpleLogger
executionContext?EventServiceCreationContext
config?Partial<ContextualEventServiceConfig>

Returns

ContextualEventService

Defined in

packages/agents/src/services/contextual-event/contextual-event-service.ts:33

new ContextualEventService(config): ContextualEventService

Parameters

NameType
configContextualEventServiceConfig

Returns

ContextualEventService

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

NameType
eventTypestring
dataServiceEventData

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

NameType
executionIdstring
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

NameType
executionIdstring

Returns

fn

▸ (eventType, data): void

Parameters
NameType
eventTypestring
dataServiceEventData
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

NameType
childContextEventServiceCreationContext

Returns

ContextualEventServiceInterface

Implementation of

ContextualEventServiceInterface.createChild

Defined in

packages/agents/src/services/contextual-event/contextual-event-service.ts:170

createChild(sourceObject): ContextualEventServiceInterface

Parameters

NameType
sourceObjectunknown

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

Released under the MIT License.