Skip to content

Commit 2d00592

Browse files
Merge remote-tracking branch 'origin/main' into jerrai/skills-docs_drift_fixes-10232026
# Conflicts: # skills-manifest.json
2 parents 74ccceb + d5526bd commit 2d00592

6 files changed

Lines changed: 88 additions & 12 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { spawnSync } from "node:child_process";
2+
import { afterAll, beforeAll, describe, expect, it } from "vitest";
3+
import type { Browser } from "puppeteer-core";
4+
import { resolveHeadlessShellPath } from "./browserManager.js";
5+
import { pollVideosReady } from "./frameCapture.js";
6+
import { closeTestChrome, launchTestChrome } from "./__fixtures__/loopback.js";
7+
8+
const chromePath = resolveHeadlessShellPath();
9+
const hasBrowser = chromePath !== undefined && spawnSync(chromePath, ["--version"]).status === 0;
10+
11+
describe.skipIf(!hasBrowser)("pollVideosReady and a hidden video", () => {
12+
let browser: Browser;
13+
beforeAll(async () => {
14+
browser = await launchTestChrome(chromePath);
15+
});
16+
afterAll(async () => {
17+
await closeTestChrome(browser);
18+
});
19+
20+
it("does not wait for a video inside a hidden node, which has no source to decode", async () => {
21+
const page = await browser.newPage();
22+
await page.setContent(`<div data-hidden=""><video id="gone"></video></div>`);
23+
const started = Date.now();
24+
await expect(pollVideosReady(page, [], 3_000, 20)).resolves.toBe(true);
25+
expect(Date.now() - started).toBeLessThan(1_500);
26+
await page.close();
27+
}, 15_000);
28+
29+
it("still waits for a live video that has not decoded", async () => {
30+
const page = await browser.newPage();
31+
await page.setContent(`<video id="live"></video>`);
32+
await expect(pollVideosReady(page, [], 400, 20)).resolves.toBe(false);
33+
await page.close();
34+
}, 15_000);
35+
});

‎packages/engine/src/services/frameCapture.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,7 @@ export async function pollSubCompositionTimelines(
20212021
return scriptFailureBail ? "script_failure" : "timeout";
20222022
}
20232023

2024-
async function pollVideosReady(
2024+
export async function pollVideosReady(
20252025
page: Page,
20262026
skipIds: readonly string[],
20272027
timeoutMs: number,
@@ -2031,7 +2031,9 @@ async function pollVideosReady(
20312031
return Boolean(
20322032
await page.evaluate((skipIdList: readonly string[]) => {
20332033
const skip = new Set(skipIdList);
2034-
const vids = Array.from(document.querySelectorAll("video")).filter((v) => !skip.has(v.id));
2034+
const vids = Array.from(document.querySelectorAll("video"))
2035+
.filter((v) => !skip.has(v.id))
2036+
.filter((v) => !v.closest("[data-hidden]"));
20352037
return (
20362038
vids.length === 0 ||
20372039
vids.every((v) => {
@@ -2653,6 +2655,7 @@ export async function initializeSession(session: CaptureSession): Promise<void>
26532655
const skip = new Set(skipIdList);
26542656
return Array.from(document.querySelectorAll("video"))
26552657
.filter((v) => !skip.has(v.id))
2658+
.filter((v) => !v.closest("[data-hidden]"))
26562659
.filter((v) => (v as HTMLVideoElement).readyState < 2 && !(v as HTMLVideoElement).error)
26572660
.map((v) => (v as HTMLVideoElement).src || v.getAttribute("src") || "(no src)")
26582661
.join(", ");
@@ -2794,6 +2797,7 @@ export async function initializeSession(session: CaptureSession): Promise<void>
27942797
const skip = new Set(skipIdList);
27952798
return Array.from(document.querySelectorAll("video"))
27962799
.filter((v) => !skip.has(v.id))
2800+
.filter((v) => !v.closest("[data-hidden]"))
27972801
.filter((v) => (v as HTMLVideoElement).readyState < 2 && !(v as HTMLVideoElement).error)
27982802
.map((v) => (v as HTMLVideoElement).src || v.getAttribute("src") || "(no src)")
27992803
.join(", ");

‎packages/sdk/src/engine/apply-patches.scriptTargets.test.ts‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,37 @@ describe("a stored delete a script looks up", () => {
6969
expect(serializeDocument(parsed)).not.toContain('id="arch-path"');
7070
});
7171
});
72+
73+
const MEDIA_HTML = `<!DOCTYPE html><html><body>
74+
<div data-composition-id="c" data-width="1920" data-height="1080">
75+
<video data-hf-id="hf-vid" id="clip" src="https://cdn.test/clip.mp4" poster="https://cdn.test/p.png" data-start="0" data-duration="5"></video>
76+
<picture data-hf-id="hf-pic" id="pic"><source srcset="https://cdn.test/a.webp"><img src="https://cdn.test/a.png" srcset="https://cdn.test/a2.png 2x"></picture>
77+
<div data-hf-id="hf-bg" id="bg" style="background-image: url(https://cdn.test/bg.png); color: red"></div>
78+
<div data-hf-id="hf-keep" id="keep" style="background-image: url(https://cdn.test/live.png)"></div>
79+
</div>
80+
<script>document.getElementById('clip').getBoundingClientRect(); document.getElementById('pic').getBoundingClientRect(); document.getElementById('bg').getBoundingClientRect();</script>
81+
</body></html>`;
82+
83+
describe("a kept delete carries no media source", () => {
84+
const out = () => {
85+
const parsed = parseMutable(MEDIA_HTML);
86+
applyOverrideSet(parsed, { "hf-vid": null, "hf-pic": null, "hf-bg": null });
87+
return serializeDocument(parsed);
88+
};
89+
90+
it("keeps the nodes a script looks up but drops what the renderer would fetch", () => {
91+
const html = out();
92+
for (const id of ["clip", "pic", "bg"]) expect(html).toContain(`id="${id}"`);
93+
expect(html).not.toContain("clip.mp4");
94+
expect(html).not.toContain("p.png");
95+
expect(html).not.toContain("a.webp");
96+
expect(html).not.toContain("a.png");
97+
expect(html).not.toContain("a2.png");
98+
expect(html).not.toContain("bg.png");
99+
expect(html).toContain("color: red");
100+
});
101+
102+
it("leaves the sources of nodes that were not deleted", () => {
103+
expect(out()).toContain("live.png");
104+
});
105+
});

‎packages/sdk/src/engine/serialize.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@
55
* Phase 3b: GSAP script section will use the meriyah/offset-splice path once available.
66
*/
77

8-
import { findById, setElementStyles, type KeptDelete, type ParsedDocument } from "./model.js";
8+
import {
9+
findById,
10+
getElementStyles,
11+
setElementStyles,
12+
type KeptDelete,
13+
type ParsedDocument,
14+
} from "./model.js";
915

1016
// A kept delete is not a clip: without these the renderer would still schedule its media and stretch the film.
1117
const CLIP_ATTRIBUTES = ["data-start", "data-duration", "data-end", "data-track-index"];
18+
// A hidden copy still gets its media fetched, and extracted when it is a video, so it keeps no source.
19+
const MEDIA_SOURCE_ATTRIBUTES = ["src", "srcset", "poster"];
1220

1321
/** The deleted node, hidden and no longer a clip, so a script that looks it up still finds it. */
1422
function hiddenCopy(doc: Document, kept: KeptDelete): Element | null {
@@ -18,6 +26,9 @@ function hiddenCopy(doc: Document, kept: KeptDelete): Element | null {
1826
if (!node) return null;
1927
for (const el of [node, ...Array.from(node.querySelectorAll("*"))]) {
2028
for (const name of CLIP_ATTRIBUTES) el.removeAttribute(name);
29+
for (const name of MEDIA_SOURCE_ATTRIBUTES) el.removeAttribute(name);
30+
const remote = Object.entries(getElementStyles(el)).filter(([, v]) => v.includes("url("));
31+
if (remote.length > 0) setElementStyles(el, Object.fromEntries(remote.map(([k]) => [k, null])));
2132
}
2233
setElementStyles(node, { display: "none" });
2334
node.setAttribute("data-hidden", "");

‎skills-manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"files": 77
1111
},
1212
"hyperframes-cli": {
13-
"hash": "13ad91aefec2e07f",
13+
"hash": "c7d7fb8c6106d8dd",
1414
"files": 13
1515
},
1616
"hyperframes-registry": {

‎skills/hyperframes-cli/references/upgrade-info-misc.md‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,3 @@ Run `npx hyperframes usage --json` at the start of a video workflow and again at
132132
Known results contain `status: "known"`, `harness`, `planTier`, `session`, `weekly`, and `spend`. Each available window contains `usedPercent`, `remainingPercent`, and `resetsAt`; an unavailable window is `null`. `planTier` is the readable subscription tier when available, otherwise `null`. Claude Code reports its shared five-hour and weekly windows; a spend-metered plan (such as Enterprise) has neither and reports `spend`, the share of its billing-period spend limit already used, with `resetsAt: null`. Codex reports its shared session and weekly windows when available. Grok reports its included weekly allowance with `session: null`. Only Claude Code reports `spend`; it is `null` elsewhere. When no window is available the result is `status: "unknown"` with `reason: "no_usage_windows"`.
133133

134134
Unknown results contain `status: "unknown"` and a token-free `reason`. Missing, expired, unsupported, ambiguous, or unreadable logins and unavailable provider responses return unknown. Report the unknown state without guessing allowance. The command reads existing credentials without refreshing or rewriting them and emits no tokens or telemetry. Usage is a snapshot; it does not reserve allowance or estimate the next video's cost. Keep scope and workflow choices with the user.
135-
136-
## Remaining harness usage
137-
138-
Run `npx hyperframes usage --json` at the start of a video workflow and again at milestones such as after drafting and before rendering. A fresh read at handoff can serve as the start read. Use `--harness claude-code`, `--harness codex`, or `--harness grok` to select explicitly.
139-
140-
Known results contain `status: "known"`, `harness`, `planTier`, `session`, `weekly`, and `spend`. Each available window contains `usedPercent`, `remainingPercent`, and `resetsAt`; an unavailable window is `null`. `planTier` is the readable subscription tier when available, otherwise `null`. Claude Code reports its shared five-hour and weekly windows; a spend-metered plan (such as Enterprise) has neither and reports `spend`, the share of its billing-period spend limit already used, with `resetsAt: null`. Codex reports its shared session and weekly windows when available. Grok reports its included weekly allowance with `session: null`. Only Claude Code reports `spend`; it is `null` elsewhere. When no window is available the result is `status: "unknown"` with `reason: "no_usage_windows"`.
141-
142-
Unknown results contain `status: "unknown"` and a token-free `reason`. Missing, expired, unsupported, ambiguous, or unreadable logins and unavailable provider responses return unknown. Report the unknown state without guessing allowance. The command reads existing credentials without refreshing or rewriting them and emits no tokens or telemetry. Usage is a snapshot; it does not reserve allowance or estimate the next video's cost. Keep scope and workflow choices with the user.

0 commit comments

Comments
 (0)