Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

fix: scope overlap checks to component owners

rpone69cc91b0d2bc
diff --git a/.agents/skills/hypit/references/element-review.md b/.agents/skills/hypit/references/element-review.md
index 9acedef5..1e4d4321 100644
--- a/.agents/skills/hypit/references/element-review.md
+++ b/.agents/skills/hypit/references/element-review.md
@@ -119,11 +119,13 @@ element ids. Use those numbers as the mechanical findings and let the observer d
alignment or overflow matches the reference/intent. The report cannot measure renderer-shaped glyph
bounds or infer intent, so the visual pass must still confirm text and marks in the rendered image.
-The same report includes `layout_geometry.overlaps`. It is an advisory list of Source-level placement
-pairs that are on the same Canvas, present during an overlapping timing scope, and have a positive-area
-rectangle intersection without either rectangle fully containing the other. Full containment is omitted
-because a background or parent Frame commonly covers its child intentionally. Treat each entry as a
-candidate finding: confirm it in the rendered frame and against the author intent before changing Source.
+The same report includes `layout_geometry.overlaps`. It is an advisory list of independent component
+placements that are on the same Canvas, present during an overlapping timing scope, and have a
+positive-area rectangle intersection without either rectangle fully containing the other. Nested
+placements owned by the same component are excluded; their internal layout is judged against that
+component's own parent/Frame. Full containment is omitted because a background or parent Frame commonly
+covers its child intentionally. Treat each entry as a candidate finding: confirm it in the rendered
+frame and against the author intent before changing Source.
The check compares only declared Canvas/Frame placement bounds; it cannot see glyph-level or other
package-internal bounds that a Producer does not expose.
diff --git a/.agents/skills/hypit/references/original-authoring/conformance-round.md b/.agents/skills/hypit/references/original-authoring/conformance-round.md
index 6f75eb2e..d13d9814 100644
--- a/.agents/skills/hypit/references/original-authoring/conformance-round.md
+++ b/.agents/skills/hypit/references/original-authoring/conformance-round.md
@@ -74,9 +74,11 @@ overflow, and check the final visible bounds against all four Canvas edges.
`authoring_check` returns `layout_geometry` with deterministic Canvas/Frame bounds, centres, parent and
Canvas offsets, containment overflow, and bound element ids. Use it as the mechanical report and make
the conformance decision from the rendered picture and intent. It also reports
-`layout_geometry.overlaps` for same-Canvas placements that are simultaneous and partially intersecting;
-full containment is omitted and the entries are advisory candidates, not automatic failures. It cannot
-measure actual glyph or package-internal bounds or infer intent, so those still require the reader.
+`layout_geometry.overlaps` for independent same-Canvas component placements that are simultaneous and
+partially intersecting; nested placements owned by one component are excluded and remain subject to
+component-local parent/Frame centring. Full containment is omitted and the entries are advisory
+candidates, not automatic failures. It cannot measure actual glyph or package-internal bounds or infer
+intent, so those still require the reader.
Clearly platform/player/export-tool watermarks are not authored content and should be ignored. If a mark
could be intentional design, preserve the uncertainty and do not silently remove it.
diff --git a/.agents/skills/hypit/references/preview.md b/.agents/skills/hypit/references/preview.md
index 74efa8ab..f36e7b86 100644
--- a/.agents/skills/hypit/references/preview.md
+++ b/.agents/skills/hypit/references/preview.md
@@ -112,10 +112,11 @@ Before reading the picture, run the route's `reconstruction_check` or `authoring
`layout_geometry` object with the render. It is the mechanical Canvas/Frame report used to check centre
offsets, frame capacity, and Canvas containment; the observer still confirms rendered text bounds and
whether any bleed is intentional. Also inspect `layout_geometry.overlaps`: it lists only partial
-rectangle intersections between same-Canvas placements whose timing scopes overlap. Full containment is
-omitted as a likely intentional parent/background relationship. These are candidates, not automatic
-failures; verify them in the frame and remember that package-internal glyph bounds are not available to
-the mechanical check.
+rectangle intersections between independent same-Canvas component placements whose timing scopes
+overlap. Nested placements owned by one component are excluded so its internal centring is checked
+against its own parent/Frame. Full containment is omitted as a likely intentional parent/background
+relationship. These are candidates, not automatic failures; verify them in the frame and remember that
+package-internal glyph bounds are not available to the mechanical check.
## Open the whole Run for a person
diff --git a/.agents/skills/hypit/references/reconstruction/comparison-round.md b/.agents/skills/hypit/references/reconstruction/comparison-round.md
index cd7b0dc1..bab67b91 100644
--- a/.agents/skills/hypit/references/reconstruction/comparison-round.md
+++ b/.agents/skills/hypit/references/reconstruction/comparison-round.md
@@ -164,10 +164,12 @@ The `reconstruction_check` JSON includes `layout_geometry`, a mechanical report
centres, parent/Canvas offsets, containment overflow, and bound element ids. The agent should use those
facts alongside the comparison text. They are deterministic Source facts, not a decision: rendered
glyph bounds and whether an overhang is intentional still require the observer. Its
-`layout_geometry.overlaps` list is an advisory set of same-Canvas, temporally simultaneous partial
-rectangle intersections. Full containment is intentionally omitted; confirm each candidate against the
-rendered frame and intent, and do not treat it as an automatic gate failure. The list cannot detect
-overlap between package-internal glyphs or other bounds not exposed by Source placement.
+`layout_geometry.overlaps` list is an advisory set of independent same-Canvas component placements that
+are temporally simultaneous and partially intersecting. Nested placements owned by one component are
+excluded; their internal centring remains a component-local parent/Frame comparison. Full containment
+is intentionally omitted; confirm each candidate against the rendered frame and intent, and do not treat
+it as an automatic gate failure. The list cannot detect overlap between package-internal glyphs or other
+bounds not exposed by Source placement.
## Measuring, on this route
diff --git a/packages/reference-video-tools/src/checks.ts b/packages/reference-video-tools/src/checks.ts
index 3ff4939d..05425656 100644
--- a/packages/reference-video-tools/src/checks.ts
+++ b/packages/reference-video-tools/src/checks.ts
@@ -625,6 +625,8 @@ function framesPastTheCanvas(svml: string): readonly OutOfBoundsFrame[] {
type PlacementClaim = {
readonly id: string;
+ /** The outer Source placement that owns this claim; nested Surface elements share it. */
+ readonly owner: string;
readonly canvas: string;
readonly box: Box;
readonly start: number;
@@ -632,6 +634,40 @@ type PlacementClaim = {
readonly scope: string;
};
+/**
+ * Resolve the outer component placement for each namespaced opening tag.
+ *
+ * A structured Surface may contain its own placed children (for example an Image with several Layers).
+ * Those children are part of one component's internal layout and must not be compared as peer
+ * components. The owner is therefore the nearest ancestor that declares an id and a placement port;
+ * a top-level placement owns itself. This is Source structure only, not a guess based on rectangle size.
+ */
+function placementOwners(svml: string): ReadonlyMap<number, string> {
+ const owners = new Map<number, string>();
+ const stack: { readonly tag: string; readonly owner?: string }[] = [];
+ for (const match of svml.matchAll(/<\/?([a-z][a-z0-9-]*:[A-Za-z][A-Za-z0-9]*)\b([^>]*?)>/gsu)) {
+ const full = match[0] ?? "";
+ const tag = match[1] ?? "";
+ if (full.startsWith("</")) {
+ for (let index = stack.length - 1; index >= 0; index -= 1) {
+ if (stack[index]!.tag === tag) {
+ stack.length = index;
+ break;
+ }
+ }
+ continue;
+ }
+ const attributes = match[2] ?? "";
+ const id = /\bid="([^"]+)"/u.exec(attributes)?.[1];
+ const placement = /\b(?:frame|visual-frame|canvas)=\{([A-Za-z0-9_-]+)\}/u.test(attributes);
+ const inherited = [...stack].reverse().find((entry) => entry.owner !== undefined)?.owner;
+ const owner = inherited ?? (id !== undefined && placement ? id : undefined);
+ if (id !== undefined && placement && owner !== undefined) owners.set(match.index!, owner);
+ if (!/\/\s*>$/u.test(full)) stack.push({ tag, ...(owner === undefined ? {} : { owner }) });
+ }
+ return owners;
+}
+
function overlapArea(left: Box, right: Box): Box | undefined {
const intersection = {
left: Math.max(left.left, right.left),
@@ -684,6 +720,7 @@ function layoutOverlaps(svml: string, geometry: FrameGeometry): readonly LayoutO
} catch {
// Keep spatial findings useful while another check reports the malformed Script.
}
+ const owners = placementOwners(svml);
const claims: PlacementClaim[] = [];
for (const match of svml.matchAll(/<([a-z][a-z0-9-]*:[A-Za-z][A-Za-z0-9]*)\b([^>]*?)\/?\s*>/gsu)) {
const tag = match[1] ?? "";
@@ -699,14 +736,14 @@ function layoutOverlaps(svml: string, geometry: FrameGeometry): readonly LayoutO
if (canvas === undefined || box === undefined) continue;
const timing = placementTiming(attributes, parsed);
if (timing.end <= timing.start) continue;
- claims.push({ id, canvas, box, ...timing });
+ claims.push({ id, owner: owners.get(match.index!) ?? id, canvas, box, ...timing });
}
const report: LayoutOverlap[] = [];
for (let first = 0; first < claims.length; first += 1) {
for (let second = first + 1; second < claims.length; second += 1) {
const left = claims[first]!;
const right = claims[second]!;
- if (left.id === right.id || left.canvas !== right.canvas || left.end <= right.start || right.end <= left.start) continue;
+ if (left.owner === right.owner || left.canvas !== right.canvas || left.end <= right.start || right.end <= left.start) continue;
const intersection = overlapArea(left.box, right.box);
if (intersection === undefined || containsBox(left.box, right.box) || containsBox(right.box, left.box)) continue;
report.push({
diff --git a/packages/reference-video-tools/src/cli.ts b/packages/reference-video-tools/src/cli.ts
index 40d1977a..fb88332a 100644
--- a/packages/reference-video-tools/src/cli.ts
+++ b/packages/reference-video-tools/src/cli.ts
@@ -77,7 +77,8 @@ function usage(): string {
"Both checks also return layout_geometry: deterministic Canvas/Frame bounds, centres, parent and",
"Canvas offsets, containment overflow and bound element ids. Use it as a mechanical geometry report",
"for the observer to judge centring, frame capacity and Canvas safety; layout_geometry.overlaps adds",
- "advisory same-Canvas, simultaneous partial-intersection candidates (full containment is omitted).",
+ "advisory independent same-Canvas, simultaneous partial-intersection candidates; nested placements",
+ "owned by one component are excluded (full containment is omitted).",
"It does not measure rendered glyph bounds or decide whether an overhang or overlap is intentional.",
"",
"render_element draws one element of a Source the way that Source configures it, without a Build.",