Skip to content

PersistentAI API Documentation / @persistentai/fireflow-types / ICoreNode

Interface: ICoreNode

Defined in: packages/fireflow-types/src/node/interfaces/icore-node.ts:16

Core node interface defining the essential properties and methods of a node.

Properties

dispose()

dispose: () => Promise<void>

Defined in: packages/fireflow-types/src/node/interfaces/icore-node.ts:87

Release resources and prepare the node for garbage collection

Returns

Promise<void>


execute()

execute: (context) => Promise<NodeExecutionResult>

Defined in: packages/fireflow-types/src/node/interfaces/icore-node.ts:49

Execute the node with the given context

Parameters

context

ExecutionContext

The execution context

Returns

Promise<NodeExecutionResult>

A promise resolving to the execution result


id

readonly id: string

Defined in: packages/fireflow-types/src/node/interfaces/icore-node.ts:18

Unique identifier of the node


metadata

readonly metadata: NodeMetadata

Defined in: packages/fireflow-types/src/node/interfaces/icore-node.ts:21

Metadata describing the node


postExecute()?

optional postExecute: (context) => Promise<void | PostExecuteResult>

Defined in: packages/fireflow-types/src/node/interfaces/icore-node.ts:71

Optional post-execution hook for three-phase deterministic execution.

Called in sorted nodeId order AFTER parallel execution completes ("ordered await"). This ensures DBOS completion calls happen in deterministic order.

Execution flow:

  • Phase 1: preExecute() in sorted order → emit NODE_STARTED
  • Phase 2: execute() in parallel (no events)
  • Phase 3: postExecute() in sorted order → emit NODE_COMPLETED

Use cases:

  • DBOS completion calls (await final results)
  • Emit custom events in deterministic order
  • Cleanup after execution

Parameters

context

ExecutionContext

The execution context

Returns

Promise<void | PostExecuteResult>

Optional result with custom events

See

docs/design/023-deterministic-execution-proof.md


preExecute()?

optional preExecute: (context) => Promise<void | PreExecuteResult>

Defined in: packages/fireflow-types/src/node/interfaces/icore-node.ts:42

Optional pre-execution hook for two-phase DBOS execution.

When implemented, enables parallel awaiting pattern:

  • Phase 2a: preExecute() called in sorted order (deterministic DBOS registration)
  • Phase 2b: execute() runs in parallel (concurrent awaiting)

Use cases:

  • Start async DBOS operations (subflows, sleeps) and return handle
  • Resolve ports early (e.g., childExecutionId before completion)
  • Store work handles for execute() to await

Parameters

context

ExecutionContext

The execution context

Returns

Promise<void | PreExecuteResult>

Optional result with resolved ports and work handle

See

docs/design/022-unified-execution-model.md


reset()

reset: () => Promise<void>

Defined in: packages/fireflow-types/src/node/interfaces/icore-node.ts:82

Reset the node to its initial state

Returns

Promise<void>


setMetadata()

setMetadata: (metadata) => void

Defined in: packages/fireflow-types/src/node/interfaces/icore-node.ts:100

Set the node metadata

Parameters

metadata

NodeMetadata

New metadata

Returns

void


setStatus()

setStatus: (status, emitEvent?) => void

Defined in: packages/fireflow-types/src/node/interfaces/icore-node.ts:94

Set the node status

Parameters

status

NodeStatus

New status

emitEvent?

boolean

Whether to emit a status change event

Returns

void


status

readonly status: NodeStatus

Defined in: packages/fireflow-types/src/node/interfaces/icore-node.ts:24

Current execution status of the node


validate()

validate: () => Promise<NodeValidationResult>

Defined in: packages/fireflow-types/src/node/interfaces/icore-node.ts:77

Validate the node configuration

Returns

Promise<NodeValidationResult>

A promise resolving to the validation result

Licensed under BUSL-1.1