<!--
 ⚠️  AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
 This file is automatically generated by scripts/docs-generator.js
 To make changes, edit the source TypeScript files or update the generator script
-->

[playground](../../) / [Exports](../modules) / IBlockDataCollector

# Interface: IBlockDataCollector

Block data collector interface for capturing tool executions

## Implemented by

- [`PlaygroundBlockCollector`](../classes/PlaygroundBlockCollector)

## Table of contents

### Methods

- [collectBlock](IBlockDataCollector#collectblock)
- [updateBlock](IBlockDataCollector#updateblock)
- [getBlocks](IBlockDataCollector#getblocks)
- [getBlocksByParent](IBlockDataCollector#getblocksbyparent)
- [clearBlocks](IBlockDataCollector#clearblocks)
- [generateBlockId](IBlockDataCollector#generateblockid)
- [createGroupBlock](IBlockDataCollector#creategroupblock)
- [getStats](IBlockDataCollector#getstats)
- [addListener](IBlockDataCollector#addlistener)
- [removeListener](IBlockDataCollector#removelistener)

## Methods

### collectBlock

▸ **collectBlock**(`message`): `void`

Collect a new block message

#### Parameters

| Name      | Type                             |
| :-------- | :------------------------------- |
| `message` | [`IBlockMessage`](IBlockMessage) |

#### Returns

`void`

#### Defined in

[playground/src/lib/playground/block-tracking/types.ts:170](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/playground/src/lib/playground/block-tracking/types.ts#L170)

---

### updateBlock

▸ **updateBlock**(`blockId`, `updates`): `void`

Update an existing block

#### Parameters

| Name      | Type                                            |
| :-------- | :---------------------------------------------- |
| `blockId` | `string`                                        |
| `updates` | `Partial`\<[`IBlockMetadata`](IBlockMetadata)\> |

#### Returns

`void`

#### Defined in

[playground/src/lib/playground/block-tracking/types.ts:173](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/playground/src/lib/playground/block-tracking/types.ts#L173)

---

### getBlocks

▸ **getBlocks**(): [`IBlockMessage`](IBlockMessage)[]

Get all collected blocks

#### Returns

[`IBlockMessage`](IBlockMessage)[]

#### Defined in

[playground/src/lib/playground/block-tracking/types.ts:176](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/playground/src/lib/playground/block-tracking/types.ts#L176)

---

### getBlocksByParent

▸ **getBlocksByParent**(`parentId?`): [`IBlockMessage`](IBlockMessage)[]

Get blocks by parent ID for hierarchical rendering

#### Parameters

| Name        | Type     |
| :---------- | :------- |
| `parentId?` | `string` |

#### Returns

[`IBlockMessage`](IBlockMessage)[]

#### Defined in

[playground/src/lib/playground/block-tracking/types.ts:179](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/playground/src/lib/playground/block-tracking/types.ts#L179)

---

### clearBlocks

▸ **clearBlocks**(): `void`

Clear all blocks

#### Returns

`void`

#### Defined in

[playground/src/lib/playground/block-tracking/types.ts:182](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/playground/src/lib/playground/block-tracking/types.ts#L182)

---

### generateBlockId

▸ **generateBlockId**(): `string`

Generate unique block ID

#### Returns

`string`

#### Defined in

[playground/src/lib/playground/block-tracking/types.ts:185](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/playground/src/lib/playground/block-tracking/types.ts#L185)

---

### createGroupBlock

▸ **createGroupBlock**(`type`, `content`, `parentId?`, `level?`): [`IBlockMessage`](IBlockMessage)

Create a group block that can contain other blocks

#### Parameters

| Name        | Type                                                    |
| :---------- | :------------------------------------------------------ |
| `type`      | `"user"` \| `"assistant"` \| `"tool_call"` \| `"group"` |
| `content`   | `string`                                                |
| `parentId?` | `string`                                                |
| `level?`    | `number`                                                |

#### Returns

[`IBlockMessage`](IBlockMessage)

#### Defined in

[playground/src/lib/playground/block-tracking/types.ts:188](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/playground/src/lib/playground/block-tracking/types.ts#L188)

---

### getStats

▸ **getStats**(): `Object`

Get statistics about collected blocks

#### Returns

`Object`

| Name         | Type                           |
| :----------- | :----------------------------- |
| `total`      | `number`                       |
| `byType`     | `Record`\<`string`, `number`\> |
| `byState`    | `Record`\<`string`, `number`\> |
| `rootBlocks` | `number`                       |

#### Defined in

[playground/src/lib/playground/block-tracking/types.ts:196](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/playground/src/lib/playground/block-tracking/types.ts#L196)

---

### addListener

▸ **addListener**(`listener`): `void`

Add event listener

#### Parameters

| Name       | Type                                                              |
| :--------- | :---------------------------------------------------------------- |
| `listener` | [`TBlockCollectionListener`](../modules#tblockcollectionlistener) |

#### Returns

`void`

#### Defined in

[playground/src/lib/playground/block-tracking/types.ts:204](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/playground/src/lib/playground/block-tracking/types.ts#L204)

---

### removeListener

▸ **removeListener**(`listener`): `void`

Remove event listener

#### Parameters

| Name       | Type                                                              |
| :--------- | :---------------------------------------------------------------- |
| `listener` | [`TBlockCollectionListener`](../modules#tblockcollectionlistener) |

#### Returns

`void`

#### Defined in

[playground/src/lib/playground/block-tracking/types.ts:207](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/playground/src/lib/playground/block-tracking/types.ts#L207)
