@hyperframes/inspector

中文文档
0.8.226发布于 2026/11/01TypeScriptES Module构建来源已验证

Recover original HTML/CSS/GSAP context for known elements before an edit. This is not a video check, screenshot, diff, or affected-component verifier. It combines the I002 runtime/compiler provenance approach with the I003 HF-owned service boundary. T

原始使用文档
文档目录9 节
  1. Start
  2. Input
  3. Output
  4. Larger results
  5. Timeline
  6. Element map
  7. Errors
  8. Lifecycle and overhead
  9. Verification

Component source inspection (opt-in)

Recover original HTML/CSS/GSAP context for known elements before an edit. This is not a video check, screenshot, diff, or affected-component verifier. It combines the I002 runtime/compiler provenance approach with the I003 HF-owned service boundary. The agent adapter holds no DOM or animation state.

Published as @hyperframes/inspector. It does not modify the shared installation or register itself in a harness.

Start

From this checkout, with Bun and an installed Chrome/headless-shell:

bun install --ignore-scripts
bun run --filter '@hyperframes/{parsers,lint,studio-server}' build
bun run build:hyperframes-runtime
# Optional when Chrome is not already under ~/.cache/hyperframes/chrome:
export HF_INSPECT_CHROME=/absolute/path/to/chrome
bun packages/inspector/src/server.ts /absolute/video/project

The service prints its loopback URL. Starting it does not start a browser. First inspection loads the project once.

The package ships the capability, not agent tools: a harness defines its own tool names, descriptions and schemas, and calls POST /inspect with the JSON below. The service is bound to one project at startup, so no per-call project path is needed. GET /info returns project identity and startup/query counters. Stop with SIGINT/SIGTERM; the service disposes its own pages/browser.

Input

{
  "targets": [
    { "selector": "#title" },
    { "selector": ".subtitle", "within": "#chapter-flow" },
    { "hfId": "hf-8e8x" },
    { "ref": "hfi:GENERATION:NUMBER" }
  ]
}
  • within is optional. Exactly one match succeeds; multiple matches return candidates, never the first match silently. A bad target does not discard valid targets in the same batch.
  • Refs identify actual elements, including children without IDs, and expire on source change, idle release, or disposal. HF IDs can repeat across component instances; those return ambiguity too.
  • Descendants are included by default (up to 1,000, with an explicit truncation flag).
  • Ordinary requests do not seek, take pictures, render frames or encode video.
  • Optional time requests an exact HF seek and reports player time/duration. It is for deliberate runtime exploration, not required to inspect scheduled animation code.

Output

The default JSON is capped at 12,000 UTF-8 bytes, including metadata. Each snippet's id names its file and its start and end lines (file:start-end); a snippet also carries its kinds, unmodified full source lines, and whether that exact block occurs only once in the file. When a query names more than one target, targets gives the input target indices it serves. No pretty-printing or ellipses are inserted into code. Adjacent/overlapping blocks merge across targets.

{
  "generation": "...",
  "results": [{ "target": 0, "status": "found", "animations": 4 }],
  "snippets": [
    {
      "id": "scene.html:20-24",
      "kind": ["animation creation"],
      "targets": [0, 1],
      "code": "the exact original source lines, including whitespace",
      "uniqueInFile": true
    }
  ]
}

This illustration omits metadata. Actual files in the implementation report show the full output.

Shared helpers appear once with all queried targets using them. coTargets names up to three observed additional DOM targets of the same tween, prioritizing elements outside the query, and coTargetsOmitted counts the rest; it does not claim to enumerate all separate calls to a helper. Creation statements and authored caller statements are mapped; small named helper functions are returned whole. Variable assignments are not a stack/data-flow history. A missing source origin increments unmappedAnimations, rather than guessing an editable location.

HTML snippets are uniquely identified authored opening tags (their full source lines); dynamically generated markup may have no authored tag match. CSS is an authored-selector candidate scan, not proof of active cascade, media-query state, or inherited styles. In particular, a class reused in different scoped scene styles can have multiple candidate source rules.

Larger results

Code blocks are atomic. omitted, omittedCount, and nextOffset describe missing blocks. Repeat the same targets with returned generation and offset: nextOffset, or request selected IDs:

{ "targets": [], "generation": "RETURNED_GENERATION", "snippets": ["scene.html:20-24"] }

maxBytes can be raised explicitly (2,048–256,000). A block larger than the budget is not cut in half: request that ID with a larger budget or read its file/range. Pagination can therefore remain at the same offset until the budget increases. Old-generation continuations are rejected.

Full runtime evidence is only available by an explicit HTTP request with debug: true; it is deliberately not part of the default request or its output budget.

Timeline

POST /timeline answers which animations are scheduled when, from the same browser, page and generation as /inspect. It never seeks, renders or edits files.

{ "component": { "selector": "#title" }, "boundary": 7.9 }

component is optional and resolves like an /inspect target; omit it for every registered HF timeline. Give at most one of at, range: [start, end] or boundary, in global seconds; omit all three for the schedule overview. Results are short text grouped by component, with event times, targets, properties and source locations; generation and offset page through them. Coverage is registered DOM-target GSAP animations and explicit HF items only; anything outside that, or past the expansion limits, is reported as incomplete coverage rather than guessed.

Element map

POST /element-map returns the composition's element map from the same page. It reads no query fields. A project with no index.html answers 404 { "error": "no-composition", "code": "no-composition" }.

Errors

Every refusal is JSON { "error", "code" }. code is the stable token (no-composition, stale_generation, source_changed_during_query, request_too_large); a sentence with no token is invalid_request. A missing browser is 503 browser_unavailable, and an unexpected failure is 500 internal_error. Importing the module does not listen; createInspectorServer(project) builds one. An unknown route is 404 { "error": "not_found", "code": "not_found" }. GET /info adds version, this package's version. The process listens on 127.0.0.1 and refuses a Host that is not loopback, so a rebinding request cannot read the project path. Install the server with the package: hyperframes-inspector <project> [port], or node dist/server.js.

Lifecycle and overhead

One lazy browser, one immutable bundled page per project service. Warm queries reuse both. Source HTML/JS/CSS/JSON are content-hashed; a change closes the old page and creates a new one, reusing the browser. The service serializes requests and checks the source fingerprint again after querying. No Studio hot-patching or old timeline objects survive a rebuild. Two idle minutes release both page and browser. Changes to only media bytes are not part of this source-context invalidation mechanism.

GSAP hooks are installed before authored page scripts. They live only in inspection pages, not the normal Studio, check, or rendering paths. Runtime records are capped at 20,000. No recorder is injected into normal HF output. Unexecuted callback-created animations, raw constructors, other animation systems, iframe contents and removed animations are outside coverage. An explicit time query can execute callbacks; it cannot prove all future paths are covered.

Verification

bun run --filter @hyperframes/inspector test
bunx tsc -p packages/inspector/tsconfig.json --noEmit
bun packages/inspector/tests/browser.ts /absolute/path/to/gsap.min.js
bun packages/inspector/tests/lifecycle.ts /absolute/path/to/gsap.min.js
bun packages/inspector/tests/transport.ts /absolute/path/to/Rowan-film
bun packages/inspector/tests/film.ts /absolute/path/to/Rowan-film /tmp/film-inspection.json

Browser tests generate disposable fixtures. The film audit copies source/assets into a temporary project before editing; it never edits the supplied original. It checks fixed-frame parity, exact-source snippets, page replacement, browser reuse, and player time/duration. This is engineering verification, not an additional paid agent A/B or a demonstrated token/cost benefit.

版本与发布记录

@hyperframes/inspector 共发布 75 个版本,首次发布于 2026/10/13;过去 12 个月发布了 75 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.8.226latest2026/11/012 天前
0.8.2252026/11/012 天前
0.8.2242026/11/012 天前
0.8.2232026/10/313 天前
0.8.2222026/10/313 天前
0.8.2212026/10/304 天前

其他发布通道:hdr → 0.8.190-hdr.1。

关于 @hyperframes/inspector 的常见问题

@hyperframes/inspector 是什么?

恢复原始的HTML/CSS/GSAP上下文 编辑前的已知元素。这不是视频检查、屏幕截图、diff或受影响组件验证器。它将I002运行时/编译器来源方法与I003 hf拥有的服务边界结合起来。T

如何安装 @hyperframes/inspector?

在项目目录运行 npm install @hyperframes/inspector,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 hyperframes-inspector,可以用 npx hyperframes-inspector 直接运行。

@hyperframes/inspector 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@hyperframes/inspector 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@hyperframes/inspector 可以商用吗?

@hyperframes/inspector 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@hyperframes/inspector 还在维护吗?

最新版本 0.8.226 发布于 2026/11/01(2 天前);至今共发布 75 个版本,其中过去 12 个月发布了 75 个;首次发布于 2026/10/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。