Skip to main content

Interface: LeafEventParts<I, O>

Defined in: packages/core/src/core/stream-hub.ts:117

What leafEvents builds a leaf's event side from.

Type Parameters​

I​

I

O​

O

Properties​

id​

id: () => string

Defined in: packages/core/src/core/stream-hub.ts:119

The id and name the leaf reports under, read at each event.

Returns​

string


lifecycle?​

optional lifecycle?: boolean

Defined in: packages/core/src/core/stream-hub.ts:130

Whether process() fires the lifecycle around run: onStart, then onComplete or onError, for the call and for subscribers. Default true. False for a leaf whose run reports its own lifecycle, such as a bot that completes only after validating its answer; its run reports completion through LeafEvents.complete.


name​

name: () => string

Defined in: packages/core/src/core/stream-hub.ts:120

Returns​

string


run​

run: (input, emit, options?) => Promise<O>

Defined in: packages/core/src/core/stream-hub.ts:122

The leaf's work. Each event it passes to emit reaches the call's onToken and the leaf's subscribers.

Parameters​

input​

I

emit​

(event) => void

options?​

ProcessOptions

Returns​

Promise<O>