(html: string)
| 167 | // Agents need to discover what's in a composition before editing. |
| 168 | |
| 169 | export async function inspectComposition(html: string): Promise<{ |
| 170 | elementCount: number; |
| 171 | textElements: ElementSnapshot[]; |
| 172 | imageElements: ElementSnapshot[]; |
| 173 | ids: string[]; |
| 174 | }> { |
| 175 | const comp = await openComposition(html); |
| 176 | |
| 177 | const all = comp.getElements(); |
| 178 | const textElements = all.filter((el) => ["div", "p", "h1", "h2", "h3", "span"].includes(el.tag)); |
| 179 | const imageElements = all.filter((el) => el.tag === "img"); |
| 180 | |
| 181 | comp.dispose(); |
| 182 | |
| 183 | return { |
| 184 | elementCount: all.length, |
| 185 | textElements, |
| 186 | imageElements, |
| 187 | ids: all.map((el) => el.id), |
| 188 | }; |
| 189 | } |
| 190 | |
| 191 | // ── Timing normalization agent ──────────────────────────────────────────────── |
| 192 |
nothing calls this directly
no test coverage detected