Skip to content

agent-playground / Exports / PlaygroundBlockCollector

Class: PlaygroundBlockCollector

Playground-specific block collector implementation Manages block collection with React state integration

Implements

Table of contents

Constructors

Methods

Constructors

constructor

new PlaygroundBlockCollector(): PlaygroundBlockCollector

Returns

PlaygroundBlockCollector

Methods

addListener

addListener(listener): void

Add a listener for block collection events

Parameters

NameType
listenerTBlockCollectionListener

Returns

void

Implementation of

IPlaygroundBlockCollector.addListener

Defined in

agent-playground/src/lib/playground/block-tracking/block-collector.ts:38


removeListener

removeListener(listener): void

Remove a listener

Parameters

NameType
listenerTBlockCollectionListener

Returns

void

Implementation of

IPlaygroundBlockCollector.removeListener

Defined in

agent-playground/src/lib/playground/block-tracking/block-collector.ts:45


collectBlock

collectBlock(message): void

Collect a new block message

Parameters

NameType
messageIBlockMessage

Returns

void

Implementation of

IPlaygroundBlockCollector.collectBlock

Defined in

agent-playground/src/lib/playground/block-tracking/block-collector.ts:67


updateBlock

updateBlock(blockId, updates): void

Update an existing block

Parameters

NameType
blockIdstring
updatesPartial<IBlockMetadata>

Returns

void

Implementation of

IPlaygroundBlockCollector.updateBlock

Defined in

agent-playground/src/lib/playground/block-tracking/block-collector.ts:92


updateRealTimeBlock

updateRealTimeBlock(blockId, updates): void

Update a block's metadata in real-time

Parameters

NameType
blockIdstring
updatesPartial<IRealTimeBlockMetadata>

Returns

void

Implementation of

IPlaygroundBlockCollector.updateRealTimeBlock

Defined in

agent-playground/src/lib/playground/block-tracking/block-collector.ts:108


getBlocks

getBlocks(): IBlockMessage[]

Get all collected blocks

Returns

IBlockMessage[]

Implementation of

IPlaygroundBlockCollector.getBlocks

Defined in

agent-playground/src/lib/playground/block-tracking/block-collector.ts:124


getBlocksByParent

getBlocksByParent(parentId?): IBlockMessage[]

Get blocks by parent ID for hierarchical rendering

Parameters

NameType
parentId?string

Returns

IBlockMessage[]

Implementation of

IPlaygroundBlockCollector.getBlocksByParent

Defined in

agent-playground/src/lib/playground/block-tracking/block-collector.ts:131


getBlockTree

getBlockTree(): IBlockTreeNode[]

Build block tree for hierarchical visualization

Returns

IBlockTreeNode[]

Implementation of

IPlaygroundBlockCollector.getBlockTree

Defined in

agent-playground/src/lib/playground/block-tracking/block-collector.ts:152


clearBlocks

clearBlocks(): void

Clear all blocks

Returns

void

Implementation of

IPlaygroundBlockCollector.clearBlocks

Defined in

agent-playground/src/lib/playground/block-tracking/block-collector.ts:177


generateBlockId

generateBlockId(): string

Generate unique block ID

Returns

string

Implementation of

IPlaygroundBlockCollector.generateBlockId

Defined in

agent-playground/src/lib/playground/block-tracking/block-collector.ts:186


getBlock

getBlock(blockId): undefined | IBlockMessage

Get block by ID

Parameters

NameType
blockIdstring

Returns

undefined | IBlockMessage

Implementation of

IPlaygroundBlockCollector.getBlock

Defined in

agent-playground/src/lib/playground/block-tracking/block-collector.ts:193


removeBlock

removeBlock(blockId): void

Remove a block and its children

Parameters

NameType
blockIdstring

Returns

void

Implementation of

IPlaygroundBlockCollector.removeBlock

Defined in

agent-playground/src/lib/playground/block-tracking/block-collector.ts:200


createGroupBlock

createGroupBlock(type, content, parentId?, level?): IBlockMessage

Create a group block that can contain other blocks

Parameters

NameTypeDefault value
type"user" | "assistant" | "tool_call" | "group"undefined
contentstringundefined
parentId?stringundefined
levelnumber0

Returns

IBlockMessage

Implementation of

IPlaygroundBlockCollector.createGroupBlock

Defined in

agent-playground/src/lib/playground/block-tracking/block-collector.ts:237


getStats

getStats(): Object

Get statistics about collected blocks

Returns

Object

NameType
totalnumber
byTypeRecord<string, number>
byStateRecord<string, number>
rootBlocksnumber

Implementation of

IPlaygroundBlockCollector.getStats

Defined in

agent-playground/src/lib/playground/block-tracking/block-collector.ts:269

Released under the MIT License.