Skip to content

ChainGraph API Documentation / @badaitech/chaingraph-types / ExecutionContext

Class: ExecutionContext ​

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:30

Constructors ​

Constructor ​

new ExecutionContext(flowId, abortController, metadata?, executionId?, integrations?, rootExecutionId?, parentExecutionId?, eventData?, isChildExecution?, executionDepth?, getNodeById?, findNodes?): ExecutionContext

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:65

Parameters ​

flowId ​

string

abortController ​

AbortController

metadata? ​

Record<string, unknown>

executionId? ​

string

integrations? ​

objectOutputType<{ archai: ZodOptional<ZodObject<{ agentID: ZodOptional<ZodString>; agentSession: ZodOptional<ZodString>; chatID: ZodOptional<ZodString>; messageID: ZodOptional<ZodNumber>; }, "strip", ZodTypeAny, { agentID?: string; agentSession?: string; chatID?: string; messageID?: number; }, { agentID?: string; agentSession?: string; chatID?: string; messageID?: number; }>>; external: ZodOptional<ZodRecord<ZodString, ZodAny>>; wallet: ZodOptional<ZodObject<{ address: ZodOptional<ZodString>; capabilities: ZodOptional<ZodObject<{ supportsBatchTransactions: ZodOptional<ZodBoolean>; supportsEIP1559: ZodOptional<ZodBoolean>; supportsEIP712: ZodOptional<ZodBoolean>; }, "strip", ZodTypeAny, { supportsBatchTransactions?: boolean; supportsEIP1559?: boolean; supportsEIP712?: boolean; }, { supportsBatchTransactions?: boolean; supportsEIP1559?: boolean; supportsEIP712?: boolean; }>>; chainId: ZodOptional<ZodNumber>; ensName: ZodOptional<ZodString>; isConnected: ZodBoolean; lastUpdated: ZodOptional<ZodNumber>; providerType: ZodOptional<ZodString>; rpcUrl: ZodOptional<ZodString>; }, "strip", ZodTypeAny, { address?: string; capabilities?: { supportsBatchTransactions?: boolean; supportsEIP1559?: boolean; supportsEIP712?: boolean; }; chainId?: number; ensName?: string; isConnected: boolean; lastUpdated?: number; providerType?: string; rpcUrl?: string; }, { address?: string; capabilities?: { supportsBatchTransactions?: boolean; supportsEIP1559?: boolean; supportsEIP712?: boolean; }; chainId?: number; ensName?: string; isConnected: boolean; lastUpdated?: number; providerType?: string; rpcUrl?: string; }>>; }, ZodAny, "strip">

rootExecutionId? ​

string

parentExecutionId? ​

string

eventData? ​
eventName ​

string = ...

payload? ​

any = ...

isChildExecution? ​

boolean

executionDepth? ​

number

getNodeById? ​

(nodeId) => INode | undefined

findNodes? ​

(predicate) => INode[] | undefined

Returns ​

ExecutionContext

Properties ​

abortController ​

readonly abortController: AbortController

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:38


currentNodeId? ​

optional currentNodeId: string

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:52


emittedEvents? ​

optional emittedEvents: EmittedEvent[]

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:49


eventData? ​

readonly optional eventData: object

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:50

eventName ​

eventName: string

payload? ​

optional payload: any


executionDepth ​

readonly executionDepth: number

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:53


executionId ​

readonly executionId: string

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:31


findNodes() ​

readonly findNodes: (predicate) => INode[] | undefined

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:57

Parameters ​

predicate ​

(node) => boolean

Returns ​

INode[] | undefined


flowId? ​

readonly optional flowId: string

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:36


getNodeById() ​

readonly getNodeById: (nodeId) => INode | undefined

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:55

Parameters ​

nodeId ​

string

Returns ​

INode | undefined


integrations ​

readonly integrations: objectOutputType

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:46


isChildExecution? ​

readonly optional isChildExecution: boolean

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:51


metadata ​

readonly metadata: Record<string, unknown>

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:37


parentExecutionId? ​

readonly optional parentExecutionId: string

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:33


rootExecutionId? ​

readonly optional rootExecutionId: string

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:32


startTime ​

readonly startTime: Date

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:35

Accessors ​

abortSignal ​

Get Signature ​

get abortSignal(): AbortSignal

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:100

Returns ​

AbortSignal

Methods ​

cloneForChildExecution() ​

cloneForChildExecution(eventData, childExecutionId): ExecutionContext

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:160

Clone this context for a child execution

Parameters ​

eventData ​

The event data for the child execution

eventName ​

string = ...

payload? ​

any = ...

childExecutionId ​

string

The ID for the child execution

Returns ​

ExecutionContext


emitEvent() ​

emitEvent(eventType, data, nodeId): void

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:141

Emit an event that can trigger listener nodes

Parameters ​

eventType ​

string

The type of event to emit

data ​

any

The event data

nodeId ​

string

The ID of the node emitting the event (for tracking)

Returns ​

void


getECDHKeyPair() ​

getECDHKeyPair(): Promise<CryptoKeyPair>

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:104

Returns ​

Promise<CryptoKeyPair>


getEventsQueue() ​

getEventsQueue(): EventQueue<ExecutionEvent<ExecutionEventEnum>>

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:119

Returns ​

EventQueue<ExecutionEvent<ExecutionEventEnum>>


getIntegration() ​

getIntegration<T>(type): T | undefined

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:128

Helper method to get a specific integration by type

Type Parameters ​

T ​

T = unknown

Parameters ​

type ​

string

The integration type to retrieve

Returns ​

T | undefined

The integration data or undefined if not found


sendEvent() ​

sendEvent(event): Promise<void>

Defined in: packages/chaingraph-types/src/execution/execution-context.ts:115

Parameters ​

event ​

ExecutionEvent

Returns ​

Promise<void>

Licensed under BUSL-1.1