playground / Exports / PlaygroundBlockCollector
Class: PlaygroundBlockCollector
Playground-specific block collector implementation Manages block collection with React state integration
Implements
Table of contents
Constructors
Methods
- addListener
- removeListener
- collectBlock
- updateBlock
- updateRealTimeBlock
- getBlocks
- getBlocksByParent
- getBlockTree
- clearBlocks
- generateBlockId
- getBlock
- removeBlock
- createGroupBlock
- getStats
Constructors
constructor
• new PlaygroundBlockCollector(): PlaygroundBlockCollector
Returns
Methods
addListener
▸ addListener(listener): void
Add a listener for block collection events
Parameters
| Name | Type |
|---|---|
listener | TBlockCollectionListener |
Returns
void
Implementation of
IBlockDataCollector.addListener
Defined in
playground/src/lib/playground/block-tracking/block-collector.ts:25
removeListener
▸ removeListener(listener): void
Remove a listener
Parameters
| Name | Type |
|---|---|
listener | TBlockCollectionListener |
Returns
void
Implementation of
IBlockDataCollector.removeListener
Defined in
playground/src/lib/playground/block-tracking/block-collector.ts:32
collectBlock
▸ collectBlock(message): void
Collect a new block message
Parameters
| Name | Type |
|---|---|
message | IBlockMessage |
Returns
void
Implementation of
IBlockDataCollector.collectBlock
Defined in
playground/src/lib/playground/block-tracking/block-collector.ts:52
updateBlock
▸ updateBlock(blockId, updates): void
Update an existing block
Parameters
| Name | Type |
|---|---|
blockId | string |
updates | Partial<IBlockMetadata> |
Returns
void
Implementation of
IBlockDataCollector.updateBlock
Defined in
playground/src/lib/playground/block-tracking/block-collector.ts:77
updateRealTimeBlock
▸ updateRealTimeBlock(blockId, updates): void
Update a block's metadata in real-time
Parameters
| Name | Type |
|---|---|
blockId | string |
updates | Partial<IRealTimeBlockMetadata> |
Returns
void
Defined in
playground/src/lib/playground/block-tracking/block-collector.ts:93
getBlocks
▸ getBlocks(): IBlockMessage[]
Get all collected blocks
Returns
Implementation of
Defined in
playground/src/lib/playground/block-tracking/block-collector.ts:109
getBlocksByParent
▸ getBlocksByParent(parentId?): IBlockMessage[]
Get blocks by parent ID for hierarchical rendering
Parameters
| Name | Type |
|---|---|
parentId? | string |
Returns
Implementation of
IBlockDataCollector.getBlocksByParent
Defined in
playground/src/lib/playground/block-tracking/block-collector.ts:116
getBlockTree
▸ getBlockTree(): IBlockTreeNode[]
Build block tree for hierarchical visualization
Returns
Defined in
playground/src/lib/playground/block-tracking/block-collector.ts:137
clearBlocks
▸ clearBlocks(): void
Clear all blocks
Returns
void
Implementation of
IBlockDataCollector.clearBlocks
Defined in
playground/src/lib/playground/block-tracking/block-collector.ts:164
generateBlockId
▸ generateBlockId(): string
Generate unique block ID
Returns
string
Implementation of
IBlockDataCollector.generateBlockId
Defined in
playground/src/lib/playground/block-tracking/block-collector.ts:173
getBlock
▸ getBlock(blockId): undefined | IBlockMessage
Get block by ID
Parameters
| Name | Type |
|---|---|
blockId | string |
Returns
undefined | IBlockMessage
Defined in
playground/src/lib/playground/block-tracking/block-collector.ts:180
removeBlock
▸ removeBlock(blockId): void
Remove a block and its children
Parameters
| Name | Type |
|---|---|
blockId | string |
Returns
void
Defined in
playground/src/lib/playground/block-tracking/block-collector.ts:187
createGroupBlock
▸ createGroupBlock(type, content, parentId?, level?): IBlockMessage
Create a group block that can contain other blocks
Parameters
| Name | Type | Default value |
|---|---|---|
type | "user" | "assistant" | "tool_call" | "group" | undefined |
content | string | undefined |
parentId? | string | undefined |
level | number | 0 |
Returns
Implementation of
IBlockDataCollector.createGroupBlock
Defined in
playground/src/lib/playground/block-tracking/block-collector.ts:224
getStats
▸ getStats(): Object
Get statistics about collected blocks
Returns
Object
| Name | Type |
|---|---|
total | number |
byType | Record<string, number> |
byState | Record<string, number> |
rootBlocks | number |
Implementation of
Defined in
playground/src/lib/playground/block-tracking/block-collector.ts:256