|
1 | | -/** |
2 | | - * Block tree utilities for updating nested content blocks. |
3 | | - */ |
4 | | - |
5 | 1 | import type { ContentBlock } from '../types/chat' |
6 | 2 | import { isCollapsibleBlock } from '../types/chat' |
7 | 3 |
|
8 | | -// ============================================================================ |
9 | | -// Internal helpers (not exported - used by public API) |
10 | | -// ============================================================================ |
11 | | - |
12 | 4 | /** Checks if a block matches the given ID (agentId, toolCallId, thinkingId, or id). */ |
13 | 5 | function blockMatchesId(block: ContentBlock, id: string): boolean { |
14 | 6 | if (block.type === 'agent' && block.agentId === id) return true |
@@ -50,10 +42,6 @@ function updateBlocksByPredicate( |
50 | 42 | return hasChanges ? result : blocks |
51 | 43 | } |
52 | 44 |
|
53 | | -// ============================================================================ |
54 | | -// Traversal and Search Utilities |
55 | | -// ============================================================================ |
56 | | - |
57 | 45 | /** Visits all blocks recursively. Return false from visitor to stop traversal early. Returns false if stopped early. */ |
58 | 46 | export function traverseBlocks( |
59 | 47 | blocks: ContentBlock[], |
@@ -117,10 +105,6 @@ export function mapBlocks( |
117 | 105 | return hasChanges ? result : blocks |
118 | 106 | } |
119 | 107 |
|
120 | | -// ============================================================================ |
121 | | -// Public API |
122 | | -// ============================================================================ |
123 | | - |
124 | 108 | /** Updates the block matching the given ID (checks agentId, toolCallId, thinkingId, id). */ |
125 | 109 | export function updateBlockById( |
126 | 110 | blocks: ContentBlock[], |
|
0 commit comments