MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / inspectComposition

Function inspectComposition

packages/sdk/examples/headless-agent.ts:169–189  ·  view source on GitHub ↗
(html: string)

Source from the content-addressed store, hash-verified

167// Agents need to discover what's in a composition before editing.
168
169export 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

Callers

nothing calls this directly

Calls 3

openCompositionFunction · 0.85
getElementsMethod · 0.65
disposeMethod · 0.65

Tested by

no test coverage detected